Search code examples
node.jsazure-language-understanding

LUIS Intent not recognized by bot


EDIT

So sorry everyone, it was just due to a missing comma after the name of the intent. I am so sorry x:


I am recently creating a chat bot using Microsoft Bot Framework (botbuilder v3.14.0), Node.js (v8.9.4) and LUIS.

I am able to successfully 'recognize' some intents in the bot, and return the desired results, but for some intents, the bot doesn't seem to be able to pick up the intents, even though the results from LUIS is pointing towards the correct one.

I have tried testing using the LUIS testing blade and entering the query directly after the endpoint URL in chrome. Both methods will return me the same and correct intent. A sample result from the endpoint URL method is as below:

{
  "query": "why do you exist",
  "topScoringIntent": {
    "intent": "bot-existence",
    "score": 0.597947
  },
  "intents": [
    {
      "intent": "bot-existence",
      "score": 0.597947
    },
    {
      "intent": "bot-joke",
      "score": 0.04189388
    },
    {
      "intent": "Exit",
      "score": 0.0182088781
    },
    {
      "intent": "None",
      "score": 0.0164906159
    },
    {
      "intent": "Cancel",
      "score": 0.009767669
    },
    {
      "intent": "Stop",
      "score": 0.009608646
    },
    {
      "intent": "bot-age",
      "score": 0.009238302
    },
    {
      "intent": "Greeting",
      "score": 0.008374314
    },
    {
      "intent": "bot-name",
      "score": 0.00683666952
    },
    {
      "intent": "Help",
      "score": 0.00357789616
    },
    {
      "intent": "StartOver",
      "score": 0.00262053218
    },
    {
      "intent": "checkDBStatus",
      "score": 0.002412489
    },
    {
      "intent": "refreshSchema",
      "score": 1.35339326E-06
    },
    {
      "intent": "checkDutyPerson",
      "score": 5.41015623E-08
    }
  ],
  "entities": []
}

In this case, the bot should be able to pick out the bot-existence intent and execute this code:

intents.matches('bot-existence' [
    function (session) {
        console.log('bot-existence Intent');

        session.beginDialog('bot-existDialog');
    }
]);

but it doesn't. It works for the other intents though, such as bot-age, bot-joke and checkDBStatus. The codes for these intent are the same as the one above for bot-existence, just edited to fit the intents appropriately. I have also published the LUIS app multiple times, just in case, but to no avail.

Any idea why?


Solution

  • So sorry guys, all I was missing was a comma in the code, right next to the intent name ('bot-existence'). Edited code segment as below!

    intents.matches('bot-existence', [
        function (session) {
            console.log('bot-existence Intent');
    
            session.beginDialog('bot-existDialog');
        }
    ]);