Kirsten
Kirsten

Reputation: 18076

LuisIntent Attribute not being correctly recognised

I am working through a course Getting Started with Building Bots on the Microsoft Bot Framework and using some code from the course.

When I type "Hi" in the bot emulator, Luis realises that it is a Greeting Intent however the Bot catches it as a None Intent and says " I'm sorry I don't know what you mean"

[Serializable]
public class LUISDialog : LuisDialog<BugReport>
{
 private readonly BuildFormDelegate<BugReport> NewBugReport;

 public LUISDialog(BuildFormDelegate<BugReport> newBugReport)
 {
    this.NewBugReport = newBugReport;
 }

[LuisIntent("Greeting")]
public async Task Greeting(IDialogContext context, LuisResult result)
{
    context.Call(new GreetingDialog(), Callback);
}
[LuisIntent("")]
public async Task None(IDialogContext context, LuisResult result)
{
    await context.PostAsync("I'm sorry I don't know what you mean."); 
    context.Wait(MessageReceived);
}

I have not set up any utterances for the None intent.

Below shows that the result is a Greeting Intent in the debugger:

in the debugger

The exported .json is as follows

    {
  "luis_schema_version": "3.0.0",
  "versionId": "0.1",
  "name": "sbdbotapp",
  "desc": "",
  "culture": "en-us",
  "intents": [
    {
      "name": "GreetingIntent"
    },
    {
      "name": "NewBugReportIntent"
    },
    {
      "name": "None"
    },
    {
      "name": "QueryBugType"
    }
  ],
  "entities": [
    {
      "name": "BugType",
      "roles": []
    }
  ],
  "composites": [],
  "closedLists": [],
  "patternAnyEntities": [],
  "regex_entities": [],
  "prebuiltEntities": [
    {
      "name": "email",
      "roles": []
    }
  ],
  "model_features": [],
  "regex_features": [],
  "patterns": [],
  "utterances": [
    {
      "text": "bug report",
      "intent": "NewBugReportIntent",
      "entities": []
    },
    {
      "text": "can you check whether foo is a bugtype?",
      "intent": "QueryBugType",
      "entities": [
        {
          "entity": "BugType",
          "startPos": 22,
          "endPos": 24
        }
      ]
    },
    {
      "text": "create bug",
      "intent": "NewBugReportIntent",
      "entities": []
    },
    {
      "text": "good afternoon",
      "intent": "GreetingIntent",
      "entities": []
    },
    {
      "text": "good evening",
      "intent": "GreetingIntent",
      "entities": []
    },
    {
      "text": "good morning",
      "intent": "GreetingIntent",
      "entities": []
    },
    {
      "text": "hello",
      "intent": "GreetingIntent",
      "entities": []
    },
    {
      "text": "hey",
      "intent": "GreetingIntent",
      "entities": []
    },
    {
      "text": "hi",
      "intent": "GreetingIntent",
      "entities": []
    },
    {
      "text": "hi there",
      "intent": "GreetingIntent",
      "entities": []
    },
    {
      "text": "i have a problem",
      "intent": "NewBugReportIntent",
      "entities": []
    },
    {
      "text": "is security a bug type?",
      "intent": "QueryBugType",
      "entities": [
        {
          "entity": "BugType",
          "startPos": 3,
          "endPos": 10
        }
      ]
    },
    {
      "text": "something doesnt work",
      "intent": "NewBugReportIntent",
      "entities": []
    },
    {
      "text": "yo",
      "intent": "GreetingIntent",
      "entities": []
    }
  ]
}

[Update]

From DFBerry's help and re-looking at the course, I see the course is using the SDK, where as the Doc's tutorial uses a Web App Bot.

Upvotes: 0

Views: 78

Answers (1)

Matt
Matt

Reputation: 394

it's because the name of your intent is "greetingIntent" and in your code you have it labeled as just "greeting". Change your code to be "greetingIntent" and it should work.

Upvotes: 1

Related Questions