Hi,
Is it possible to integrate both LUIS and QNA maker in single application can you please provide some details on this.
Thanks
Yes it is, use Microsoft.Bot.Builder.Luis for LUIS, for the QnA maker, it is a normal rest API call
https://westus.api.cognitive.microsoft.com/qnamaker/v2.0/knowledgebases/{SubscriptionKey}/generateAnswer
You have to add your SubscriptionKey
Does this help? You can get tutorials online for integrating LUIS
Regards Michael
Sent from Mail for Windows 10
From: ne00346536
Sent: 09 May 2017 07:33
To: Microsoft/BotBuilder
Cc: Subscribed
Subject: [Microsoft/BotBuilder] Integration of LUIS and QNA maker in singleapp. (#2726)
Hi,
Is it possible to integrate both LUIS and QNA maker in single application can you please provide some details on this.
Thanks
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
@michaelhutchful thanks for your reply . I know about LUIS and QNA maker working independently. While creating the bot need to select the template either QNA Maker OR LUIS but we dont have option to combine both.
For suppose I will give a query to match my QNA maker same application also need to handle LUIS intent match. Can you please let me know is there any way combining both LUIS and QNAMaker integration in single bot.
Thanks
How are you creating the BOT? I am talking about using BOT builder for .net with visual studio. I did it manually.
Regards Michael
Sent from Mail for Windows 10
From: ne00346536
Sent: 09 May 2017 09:10
To: Microsoft/BotBuilder
Cc: michaelhutchful; Mention
Subject: Re: [Microsoft/BotBuilder] Integration of LUIS and QNA maker insingle app. (#2726)
@michaelhutchful thanks for your reply . I know about LUIS and QNA maker working independently. While creating the bot need to select the template either QNA Maker OR LUIS but we dont have option to combine both.
For suppose I will give a query to match my QNA maker same application also need to handle LUIS intent match. Can you please let me know is there any way combing both LUIS and QNAMaker integration.
Thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
@michaelhutchful I am talking about bot builder for Node JS.
Thanks.
Both LUIS and QnA are rest API calls, so you can manually combine them without using the wizard
Regards Michael
Sent from Mail for Windows 10
From: ne00346536
Sent: 09 May 2017 09:38
To: Microsoft/BotBuilder
Cc: michaelhutchful; Mention
Subject: Re: [Microsoft/BotBuilder] Integration of LUIS and QNA maker insingle app. (#2726)
@michaelhutchful I am talking about bot builder for Node JS.
Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
@michaelhutchful OK thanks for your reply let me try this option.
See this: https://github.com/Microsoft/BotBuilder-CognitiveServices/tree/master/Node/samples
Example of using multiple recognizers in the IntentDialog.
@pchoudhari thanks for the details its working fine able to integrate both LUIS and QNA in single bot.
Thanks.
As the question has been answered I'm closing this issue.
Dang, I'm a day late to the party but it'd be super neat to get more info on using LUIS with bots built in qnamaker and added as bot services.
This is tantalising .... am I right in thinking they're integrated by default? (pic from botframework.com)

They are not integrated by default, but share some underlying technologies. We are looking at a closer integration.
The example above shows how to use LUIS intent to invoke QnMaker service. Other considerations for a knowledge bot are here: https://docs.microsoft.com/en-us/bot-framework/bot-design-pattern-knowledge-base
Thanks for the info @pchoudhari
I have tried integrating LUIS into QnAmaker based bot.
LUIS functionality is able to fetch the right intent, but I'm not able to call the dialog for QnAmaker.
Can anyone please guide me to invoke the QnADialog feature when
[LuisIntent("")]
[LuisIntent("None")] , is pinged.
Hi Aritro
Here is a code sample of how you can do this:
[LuisIntent("")]
public async Task None(IDialogContext context, LuisResult result)
{
try
{
var activity = (Activity)context.MakeMessage();
activity.Text = result.Query;
var subscriptionKey = System.Configuration.ConfigurationManager.AppSettings["QnASubscriptionKey"];
var knowledgeBaseId = System.Configuration.ConfigurationManager.AppSettings["QnAKnowledgeBaseId"];
var response = new QnAMakerDialog.QnAMakerDialog().GetQnAMakerResponse(result.Query, subscriptionKey, knowledgeBaseId);
var responseAns = response.answers.FirstOrDefault();
if (responseAns != null &&
responseAns.score >= double.Parse(System.Configuration.ConfigurationManager.AppSettings["QnAScore"]))
{
await context.PostAsync(responseAns.answer);
context.Done(result);
}
else
{
// add your code to handle no intent triggered and no QnA response
}
}
catch (Exception ex)
{
await HandleException(context, ex);
}
}
[Serializable]
public class QnAMakerDialog
{
public QnAMakerResult GetQnAMakerResponse(string query, string subscriptionKey, string knowledgeBaseId)
{
var responseString = string.Empty;
//Build the URI
var builder =
new UriBuilder(
$"https://westus.api.cognitive.microsoft.com/qnamaker/v2.0/knowledgebases/{knowledgeBaseId}/generateAnswer");
//Add the question as part of the body
var postBody = $"{{\"question\": \"{query}\"}}";
//Send the POST request
using (WebClient client = new WebClient())
{
//Set the encoding to UTF8
client.Encoding = System.Text.Encoding.UTF8;
//Add the subscription key header
client.Headers.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
client.Headers.Add("Content-Type", "application/json");
responseString = client.UploadString(builder.Uri, postBody);
}
//De-serialize the response
QnAMakerResult response;
try
{
var test = JsonConvert.DeserializeObject(responseString);
response = JsonConvert.DeserializeObject<QnAMakerResult>(responseString);
return response;
}
catch
{
throw new Exception("Unable to deserialize QnA Maker response string.");
}
}
}
public class QnAMakerResult
{
public Answer[] answers { get; set; }
}
public class Answer
{
[JsonProperty(PropertyName = "answer")]
public string answer { get; set; }
[JsonProperty(PropertyName = "score")]
public double score { get; set; }
}
Thanks @seca23 .
Can you share any email id, wherein i can share the bot-code. There are a couple of instances i'm facing issues with.
Most helpful comment
Both LUIS and QnA are rest API calls, so you can manually combine them without using the wizard
Regards Michael
Sent from Mail for Windows 10
From: ne00346536
Sent: 09 May 2017 09:38
To: Microsoft/BotBuilder
Cc: michaelhutchful; Mention
Subject: Re: [Microsoft/BotBuilder] Integration of LUIS and QNA maker insingle app. (#2726)
@michaelhutchful I am talking about bot builder for Node JS.
Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.