Reputation: 391
I am planning to use QnA maker, but does it use LUIS in the background ? If the questions are asked in a different way than the one trained to QnA maker, will it respond ?
Upvotes: 2
Views: 3386
Reputation: 683
QnA does not use LUIS or intent recognition, rather it uses n-grams to detect similarity as the documentation used to state.
Since MS Build 2018, you can use a LUIS dispatch app. It allows you to incorporate multiple LUIS apps and QnA knowledge bases into a single dispatch app. This means sending user input to both LUIS & QnA, or in a particular order depending on the confidence score should be a thing of the past.
The first call you do is directed towards the LUIS dispatch app. The result will tell you if you need to contact a child luis app, or rather a QnA knowledge base. It can do this because the utterances of the LUIS dispatch app are filled with utterances from the QnA knowledge base. You can add multiple LUIS apps and/or QnA knowledge bases to this dispatch.
I suggest looking into the Bot Builder dispatch tool (CLI).
Upvotes: 1
Reputation: 16652
does it use LUIS in the background ?
No, but you can Combining Search, QnA Maker, and/or LUIS.
According to the document, the following three ways are suggested to implement QnA together with LUIS.
Call both QnA Maker and LUIS at the same time, and respond to the user by using information from the first one that returns a score of a specific threshold.
Call LUIS first, and if no intent meets a specific threshold score, i.e., "None" intent is triggered, then call QnA Maker. Alternatively, create a LUIS intent for QnA Maker, feeding your LUIS model with example QnA questions that map to "QnAIntent."
Call QnA Maker first, and if no answer meets a specific threshold score, then call LUIS.
Here I post a code sample just for the third approach wrote in C#.
In MessagesController
call QnA Maker first:
if (activity.Type == ActivityTypes.Message)
{
await Conversation.SendAsync(activity, () => new Dialogs.MyQnADialog());
}
In MyQnADialog
, see if there is matched answer, if not, call LUIS:
[QnAMakerAttribute("QnASubscriptionKey", "QnAKnowledgebaseId", "No Answer in Knowledgebase, seraching in Luis...", 0.5)]
[Serializable]
public class MyQnADialog : QnAMakerDialog
{
protected override async Task DefaultWaitNextMessageAsync(IDialogContext context, IMessageActivity message, QnAMakerResults result)
{
if (result.Answers.Count == 0)
{
await context.Forward(new MyLuisDialog(), this.ResumeAfterNewOrderDialog, message, CancellationToken.None);
}
context.Wait(this.MessageReceivedAsync);
//return base.DefaultWaitNextMessageAsync(context, message, result);
}
private async Task ResumeAfterNewOrderDialog(IDialogContext context, IAwaitable<object> result)
{
var resultfromnewdialog = await result;
context.Wait(this.MessageReceivedAsync);
}
}
Upvotes: 4