Friday 9 June 2017

MS BotBuilder: User utterance does not hit LUIS on first attempt

Nodejs project is setup as a webapp. (Node version: 4.2.6)

The chatbot is being tested using a channel emulator. The conversation is initiated as shown below (U: user, B: Bot):

U: Hello

B: Tell me your name

U: Testuser

B: Hi Testuser, how you doing ?

U: Iam good

At this point, the control goes to the dialog handle, that hits the LUIS to obtain the intent classification of the utterance "Iam good". However, nothing happens on the first time. It hits the LUIS only when the user repeats the utterance for the second time.

From logging, it appears that the control moves to luis dialog handle at the very first time itself, but never goes on to hit the LUIS for intent classification. Please find the relevant log traces below:

Log trace when the user utters "Iam good" for the first time:

ChatConnector: message received.
UniversalBot("*") routing "Iam good" from "emulator"
Library("BotBuilder").findRoutes() explanation:
        ActiveDialog(0.5)
...BotBuilder:prompt-text - Prompt.returning(Iam good)
...BotBuilder:prompt-text - Session.endDialogWithResult()
../startSession - waterfall() step 2 of 2
../startSession - Session.beginDialog(/luis)
.../luis - Session.sendBatch() sending 0 message(s)

Log trace when the user utters "Iam good" for the second time:

ChatConnector: message received.
UniversalBot("*") routing "Iam good" from "emulator"
Library("*").findRoutes() explanation:
        ActiveDialog(0.4968815062675876)
.../luis - IntentDialog.matches(Good)
.../luis - Session.beginDialog(/userGood)
..../userGood - waterfall() step 1 of 1
..../userGood - Session.beginDialog(/userExisting)
...../userExisting - waterfall() step 1 of 2
...../userExisting - Session.beginDialog(BotBuilder:prompt-text)
......BotBuilder:prompt-text - Session.send()
......BotBuilder:prompt-text - Session.sendBatch() sending 1 message(s)

Code Example

var recognizer = new builder.LuisRecognizer(config.model);

var luisDialog = new builder.IntentDialog({ recognizers: [recognizer] });

var connector = new builder.ChatConnector({

    appId: config.BOTFRAMEWORK_APPID, 
    appPassword: config.BOTFRAMEWORK_APPSECRET

});

//code initiating conversation

/* User: Hello
Bot: Tell me your name
User: Testuser
Bot: Hi Testuser, how you doing ?
User: Iam good*/

// When the user says "I'm good", the control is passed to the dialog 'luis'

session.beginDialog('/luis');

// at the 'luis' dialog

academyDialog.dialog('/luis', 
luisDialog.onDefault(builder.DialogAction.send(prompts.default_response)));
luisDialog.matches('Good', '/userGood');

LUIS receives the user utterance for intent classification only on the second time. Although the control reaches the "luis" handle in the nodejs code, it never proceeds further in the first attempt.



via Sailesh

No comments:

Post a Comment