0

I am using Luis and QnA maker, qna maker is now interupting a waterfall prompt. I have disabled the Luis prompt with code below, how can I to do same for the qna recognizer?

var recognizer = new 
builder.LuisRecognizer(LuisModelUrl).onEnabled(function (context, 
callback) {
     var enabled = context.dialogStack().length == 0;
     callback(null, enabled);
    });
bot.recognizer(recognizer);
bot.recognizer(qnaRecognizer);
console.log(recognizer);

eg: What part of the toilet is broken? (1. Cistern, 2. Pipe, or 3. Seat)

Anything except an exact match gets picked up by qna sentiment which replaces the dialog stack

Thanks

singzzz
  • 21
  • 4

1 Answers1

0

You shouldn't have to disable either one for the code to work. I suspect the problem is in your dialog flow. Below is an example of how to construct the dialog portion of your bot. When I ran this, the logger middleware shows QnA is matching on the inputs I feed, but the bot is dictating the conversation because of the code.

var luisrecognizer = new builder.LuisRecognizer(LuisModelUrl);

var qnarecognizer = new cognitiveservices.QnAMakerRecognizer({
    knowledgeBaseId: process.env.QnAKnowledgebaseId,
    authKey: process.env.QnAAuthKey || process.env.QnASubscriptionKey,
    endpointHostName: process.env.QnAEndpointHostName
});

var basicQnAMakerDialog = new cognitiveservices.QnAMakerDialog({
    recognizers: [qnarecognizer],
    defaultMessage: 'No match! Try changing the query terms!',
    qnaThreshold: 0.3
});

bot.recognizer(luisrecognizer);
bot.recognizer(basicQnAMakerDialog);

bot.dialog('/', basicQnAMakerDialog);


bot.dialog('GreetingDialog',[
    (session) => {
        session.send('You reached the Greeting intent. You said \'%s\'.', 
session.message.text);
        builder.Prompts.text(session, "What is your name?");
    },
    (session, results) => {
        session.userData.name = results.response;
        session.send("Glad you could make it, " + session.userData.name);

        builder.Prompts.text(session, "Ask me something!");
    },
    (session, results) => {
        session.conversationData.question = results.response;
        session.send(session.conversationData.question + " is an interesting topic!")
        session.endDialog();
    }
]).triggerAction({
    matches: 'Greeting'
})

In the following image, LUIS brings me to the Greeting intent when I type "I'm happy [to be here]" which I have trained in the LUIS app. The bot dialog takes over asking me questions and storing the answers. Even though I'm making statements that QnA or LUIS should respond to neither is doing so. The conversation follows the code.

Had Qna taken over it would have responded to "What are you" with some text about QnA Maker. Similarly, "help" would have produced responses from either QnA or LUIS as I have topics/intents for both, respectively.

enter image description here

Steven Kanberg
  • 6,078
  • 2
  • 16
  • 35