I'm creating a chatbot using the MS Bot Framework with LUIS in node js. I have created a couple of intents called "Book" and "Pending" and an entity called "Annual Leave" in LUIS. I have added the LUIS URL to my chatbot code and when I test it in my console, I see that certain utterances get a response while some don't.
For example when I say "How do I check my remaining annual leave?", I get a response saying "You can find your remaining A/L here". But when I say "How can I check my pending annual leave?", I get no reply.
My Git Bash response for the working utterance
ChatConnector: message received.
session.beginDialog(/)
/ - session.sendBatch() sending 0 messages
/ - IntentDialog.matches(Pending)
/ - waterfall() step 1 of 1
/ - session.beginDialog(BotBuilder:Prompts)
.Prompts.text - session.send()
.Prompts.text - session.sendBatch() sending 1 messages
My Git Bash response for the non-working utterance
ChatConnector: message received.
.Prompts.text - session.endDialogWithResult()
/ - session.endDialogWithResult()
session.sendBatch() sending 0 messages
But when I test the exact same utterances on LUIS, it detects the intent and entity with a high confidence score.
This is happening with a lot of utterances. I can't figure out what's causing this issue.
My Chatbot code
var restify = require('restify');
var builder = require('botbuilder');
//=========================================================
// Bot Setup
//=========================================================
// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
// Create chat bot
var connector = new builder.ChatConnector({
appId: 'MY_APP_ID',
appPassword: 'MY_APP_PASSWORD'
});
var bot = new builder.UniversalBot(connector);
server.post('/api/messages', connector.listen());
server.get('/', restify.serveStatic({
directory: __dirname,
default: '/index.html'
}));
//=========================================================
// Bots Dialogs
//=========================================================
var recognizer = new builder.LuisRecognizer('MY_LUIS_URL');
var intents = new builder.IntentDialog({ recognizers: [recognizer] });
bot.dialog('/', intents);
intents.matches('Book', [
function (session, args, next) {
var task = builder.EntityRecognizer.findEntity(args.entities, 'Annual Leave');
builder.Prompts.text(session, "You can book your A/L here.");
}
]),
intents.matches('Pending', [
function (session, args, next) {
var task = builder.EntityRecognizer.findEntity(args.entities, 'Annual Leave');
builder.Prompts.text(session, "You can find your remaining A/L here.");
}
]);
via Anish
No comments:
Post a Comment