I am currently using the Enterprise Bot Template with Luis to route the intent to the correct QnAMaker knowledge base. The QnAMaker knowledge base endpoints are stored in the bot file. I have a request to enable multiprompt: https://github.com/microsoft/BotBuilder-Samples/tree/master/experimental/qnamaker-prompting/csharp_dotnetcore
In the example provided, the QnAMaker knowledge base endpoint is in the appsettings.json and I can't figure out how to either add additional knowledge base endpoints to the appsettings and have the intent get sent to the appropriate knowledge base or to have the multiprompt dialog pull the endpoint information from the bot file instead.
In the example, the knowledge base is set at start up
BotBuilder-Samples-master\BotBuilder-Samples-master\experimental\qnamaker-prompting\csharp_dotnetcore\Helpers\QnAService.cs:
private static (QnAMakerOptions options, QnAMakerEndpoint endpoint) InitQnAService(IConfiguration configuration)
{
var options = new QnAMakerOptions
{
Top = 3
};
var hostname = configuration["QnAEndpointHostName"];
if (!hostname.StartsWith("https://"))
{
hostname = string.Concat("https://", hostname);
}
if (!hostname.EndsWith("/qnamaker"))
{
hostname = string.Concat(hostname, "/qnamaker");
}
var endpoint = new QnAMakerEndpoint
{
KnowledgeBaseId = configuration["QnAKnowledgebaseId"],
EndpointKey = configuration["QnAEndpointKey"],
Host = hostname
};
return (options, endpoint);
}
BotBuilder-Samples-master\BotBuilder-Samples-master\experimental\qnamaker-prompting\csharp_dotnetcore\Startup.cs:
// Helper code that makes the actual HTTP calls to QnA Maker. It is injectable for local unit testing.
services.AddHttpClient<IQnAService, QnAService>();
Here is my setup without any modifications to the example code:
From the main dialog:
else if (intent == Dispatch.Intent.q_RJH_Test_multiprompt)
{
_services.QnAServices.TryGetValue("RJH_Test_multiprompt", out var qnaService);
if (qnaService == null)
{
throw new Exception("The specified QnA Maker Service could not be found in your Bot Services configuration.");
}
else
{
QnABotState newState = null;
var query = dc.Context.Activity.Text;
var qnaResult = await _qnaService.QueryQnAServiceAsync(query, newState);
if (qnaResult != null && qnaResult.Count() > 0)
{
// start QnAPrompt dialog
await dc.BeginDialogAsync(nameof(QnADialog));
}
else
{
await _responder.ReplyWith(dc.Context, MainResponses.ResponseIds.Confused);
}
}
}
The dialog launches correctly and the multiprompt works if the endpoint is provided in the InitQnAService method - but I have not been able to figure out how to use multiple knowledge bases with this setup.