solaire
solaire

Reputation: 505

How can I get confidence level value in ms bot framework?

I want to access the confidence level from luis with the middleware so I can route low confidence level responses to humans instead of the bot.

The value I am looking for is this one (gets logged with emulator):

Library("*")recognize() recognized: Hallo(0.8215488)

Is this even possible in the middleware or does that happen afterwards?

I tried finding it in the "session" but didn't find it yet.

Upvotes: 0

Views: 359

Answers (1)

Manu
Manu

Reputation: 186

When using an IntentDialog from the botbuilder library, you could specify the intentThreshold property which will set the minimum score needed to trigger the recognition of an intent. Check following link for reference: https://docs.botframework.com/en-us/node/builder/chat-reference/interfaces/_botbuilder_d_.iintentdialogoptions.html#intentthreshold

If the user's input is not recognised by your LUIS models or the score value is below that intentThreshold value, the onDefault method from the IntentDialog will handle it. So, it's in here where you could add your logic to hand over the customer conversation from a bot to a human:

let recognizer = new builder.LuisRecognizer(models);
let minimumScore = 0.3;
let intentArgs = {};

intentArgs.recognizers = [recognizer];
intentArgs.intentThreshold = minimumScore;

var intents = new builder.IntentDialog(intentArgs)
.onBegin()
.onDefault(
    // Add logic to handle conversation to human
);

library.dialog('options', intents);

Upvotes: 1

Related Questions