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 ?
2 Answers
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);
}
}

- 1
- 1

- 16,564
- 2
- 22
- 45
-
If we use QnA and LUIS, then the feeding of lessons, should be done twice. Once on QnA, and again for LUIS ? Please correct my understanding. – ZEE Dec 11 '17 at 04:49
-
1@ZEE, they're different service, you can directly send message to those two services in the same time and check the result, or you can go through them one by another. For example, if user query from QnA first and the answer is found, there is no need to call LUIS further. – Grace Feng Dec 11 '17 at 05:12
-
Thank you for a clear response, but my main worry is whether i have to train twice, i.e once to QnA and again to LUIS, so that if first option results under a certain score, i then proceed to call 2nd one. – ZEE Dec 11 '17 at 05:27
-
1@ZEE, I think it's up to you to decide whether to call LUIS again after calling QnA. And if you find this answer helpful, could you please mark this answer? – Grace Feng Dec 11 '17 at 05:32
-
2@ZEE, I think so you have misunderstood both QnA and Luis, consider QnA as just a knowledge base, wherein there is a fixed set of question and answer, while Luis is like a human interpreter, it understands your intention and your entities. Secondly, QnA will answer, even if question is asked in a different way than the one trained to QnA maker if there are matches, but it's better if you train by add multiple questions to your answer. Thirdly, ideally you **shouldn't** train both luis and qna with **same questions** (What's the point of using both then?) – Ashwin Kumar Dec 30 '17 at 07:02
-
I believe @ZEE is asking right question, if we feed in same question and answer to both QnA maker and LUIS. it is twice uploading and training the model. So what is the basic difference between LUIS and QnA Maker then. – Vinod kumar G Jan 03 '20 at 11:40
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).

- 664
- 5
- 13
-
There is one issue in using dispatch tool, each time we add or update the KB , we need to create new dispatch model again and use it. – Vinod kumar G Jan 06 '20 at 06:05
-
You do not need to create a new model again, you can run dispatch refresh in the same folder where your .dispatch file is located. This will update the LUIS dispatch app with all the published changes in your child LUIS apps / KBs. – Pieter Heemeryck Jan 07 '20 at 14:10