[LUIS] How to handle unknown input using LUIS recognizer?
Bot Info
- SDK Platform: Node.js
- SDK Version: 3.10.2
- Active Channels: Direct Line
- Deployment Environment: ngrok, Azure App Service, other
Issue Description
I can't seem to understand how to have a fallback for unrecognized intents. I'm building a dialog that is pretty free form in that it doesn't necessarily follow a water fall structure. So the user enters the dialog and then can start various dialog actions within that dialog. I'm trying to understand how I can have some fallback logic if they say something that is not recognized as an intent. Right now if that happens the dialog just restarts. Here is a simple example of what my dialog sort of looks like.
Code Example
var builder = require('botbuilder');
var lib = new builder.Library('my-sample-dialog');
lib.dialog('/', [
function (session, args, next) {
session.send({
text: "Ok, welcome to this sample dialog."
});
},
]).triggerAction({
matches: 'StartSampleDialog',
onInterrupted: function (session) {
session.endDialog();
}
}).beginDialogAction('FindContentImageAction', 'FindContentImage', { matches: 'FindContentImage' })
.beginDialogAction('SelectExperienceAction', 'SelectExperience', { matches: 'SelectExperience' })
.beginDialogAction('SelectImageAction', 'SelectImage', { matches: 'SelectImage' });
.... Definitions for FindContentImage, SelectExperience and SelectImage Dialogs
So if the user input doesn't map to any of these beginDialogAction intents I want to say something like "I don't understand" instead of it restarting the dialog and saying ""Ok, welcome to this sample dialog" again. Any ideas on how to do this?
When I register my luis recognizer it's done like this var recognizer = new builder.LuisRecognizer(process.env.LUIS_MODEL_URL); bot.recognizer(recognizer);
I've seen examples that use IntentDialog and onDefault but the documentation or samples for this at Node.js docs seem to be missing. That led me to the assumption that this is an older approach.
All applications come with the predefined intent, "None". You should teach it to recognize user statements that are irrelevant to the app.
Correct - you need to train the "None" intent in your LUIS model. When your IntentRecognizer returns the "None" intent, then you can send a custom message to the user.
Example:
.beginDialogAction('HandleNoneIntentAction', 'HandleNoneIntent', { matches: 'None' })
Relates to:
- https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-concept-intent
- https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-recognize-intent-luis
LUIS Bot Example Code:
- https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/intelligence-LUIS