subhan
subhan

Reputation: 53

I am trying to integrate v2 of LUIS api in my node.js bot but it's not working

The following code works fine with LUIS v1 but not working with v2.

Any one know the update to/work with v2?

        var bot = new builder.UniversalBot(connector);
         server.post('/api/messages', connector.listen()); 
          var recognizer = new builder.LuisRecognizer('https://api.projectoxford.ai/luis/v2.0/apps/956c-4784-a26d-b7fb3e00df7b?subscription-key=492514272a354088915b56321');
              var intents = new builder.IntentDialog({ recognizers: [recognizer] });
                                            bot.dialog('/', intents);

               intents.matches('TSUGGEST', [
                      function (session, args, next) {
                       var task = builder.EntityRecognizer.findEntity(args.entities);
              var task1=builder.EntityRecognizer.findEntity(args.entities,'builtin.number');
        if (!task1) {
                  builder.Prompts.text(session, "Please tell article name");

                     } 

          else {
      next({ response: task1.entity });
           }
      },
      function (session, results) {
         if (results.response) {
        // ... save task
           session.send("Ok... '%s' task.", results.response);
           } else {
         session.send("Ok");
               }
               }]);

Upvotes: 2

Views: 323

Answers (2)

Ezequiel Jadib
Ezequiel Jadib

Reputation: 14787

It seems they added support to v2 on Node.js a few days ago, per this commit to the master branch; however that's not yet published as npm package.

You might have to get the library from the GitHub repository and try using that instead of the package published; or you can use the prelease version of the builder by doing:

npm install --save botbuilder@next

This was discussed here.

Upvotes: 2

cmatic
cmatic

Reputation: 51

after contact with ms team, it is really a bug. a quick workaround is to add "&verbose=true" at the end of luis v2 endpoint

Upvotes: 2

Related Questions