I'm creating a new bot using the Bot Composer and QnA Maker. The general set-up is pretty straight forward and the bot now answers questions from the QnA Maker knowledgebase. However it's looking like there are some limitations that I can't find reference to in the documentation. Specifically:
We have an existing qna knowledgebase that is used with a custom coded bot. It's updated by various scripts and custom user interfaces. To use this knowledgebase in the composer I seem to need to connect to it so it creates a local copy within composer. At this point I can only update it via composer?
Using the QnA intent recognised trigger with the pre-configured actions doesn't seem to offer any customisable parameters, such as accuracy threshold and metadata filtering?
Using the QnA intent recognised trigger with the pre-configured actions doesn't seem to offer the users alternative answers (if multiple results are returned from qna maker) or allow any form of user feedback to qna maker.
Please can anyone confirm that these points are correct or if I'm missing something. I have attempted to use the 'QnA Maker dialog' action which enabled you to add various parameters etc. but can't see any documentation on how to process questions and answers with it.
Thanks
Related
Sorry if this is a stupid question. I just installed Bot Composer v2 and want to connect the bot to a QnAMaker knowledgebase. This is what I have done:
Provision the necessary resources on Azure.
In the QnAMaker website, (www.qnamaker.ai), create a knowledge base
Upload a File and have it populates the QnA pairs. Save and publish (not sure if publish is necessary).
Create a new bot with the "Core bot with QnA" template.
Configure the bot to use the existing resource.
However, after doing the five steps, it doesn't give me the option to connect to an existing knowledgebase. The only option I have is to create a new knowledge base, and the only option I have to populate the QnA pair is via a public URL - which is not a preferable option.
Since it doesn't work, I was trying to work the other direction by
Create a new bot with the "Core bot with QnA" template.
Configure the bot to use the existing resource.
Create a new Knowledge base with nothing in it.
Test the bot.
I checked QnAMaker website and realized the new empty knowledge base has been added. I try to upload files to it - but it won't let me (Oops something went wrong)
The use case I am trying to do is to manage my knowledge (add new files etc) through the QnAMaker website, so content owner can manage their own content. As a developer I will simply connect to the knowledge base. However it seems that I can only manage the knowledgebase directly in the Bot Composer with reduced functionality (e.g. no direct import of a file).
Follow this https://learn.microsoft.com/en-us/composer/how-to-add-qna-to-bot?tabs=v2x
to Add Existing QnA Maker KB to Bot Composer
From what I am understanding the bing spellcheck api via azure can be integrated with LUIS queries but not qna queries on their own. However, when you use the dispatch multi-model pattern with a parent LUIS app and child apps the overall query or top level query coming from luis can run the bing spellcheck api.
Is this the suggested method for assuring some spellchecking is applied to a qna knowledge base?
Yes, you can do this with Dispatch Bot. When you get the results back from the recognizer, there will be an alteredText value if spell check made a correction. What you're wanting to do is replace the original text with this new value.
const recognizerResult = await this.dispatchRecognizer.recognize(context);
if (recognizerResult.alteredText) {
context.activity.text = recognizerResult.alteredText;
}
<code to select intent>
var processResult = await this.qnaDialog.processAsync(userDialog.qnaState, context.activity)
QnA Maker should now receive the query with the altered text. I don't have this implementation exactly but I had to do something similar where I modified context.activity.text and removed or # mentions from Teams, which were affecting intent identification and QnA answers.
As billoverton mentioned, if you integrate Bing Spell Check with LUIS then you can access the spellchecked utterance in the alteredQuery property of the LUIS results. If you don't have a LUIS model that you're passing utterances through before they reach QnA Maker, you can always call the Bing Spell Check API directly with HTTP requests or using an Azure SDK.
Once you have the spellchecked utterance, you can pass it along to QnA Maker through a QnA dialog by modifying the turn context's activity like billoverton suggested, or again you can call the API directly. There's plenty of information in the QnA Maker documentation about generating answers with the REST API or an SDK.
I want to add cards in my QnA Maker. I my QnA maker if anyone asks about "what services we provide?" Bot should answer (for example: We provide following services /n/n 1: Bot Development /n/n 2: Web Development /n/n 3: Documentation). In this example bot should reply it with the card and if user clicks on any of the above mentioned services than it should gives details about that.
Thanks in advance...
QnA Maker has just released a new feature called multi-turn conversations whcih does exactly what you are looking for.
Once you have added some multi-turn conversations to your knowledge base you can try this out by downloading the BotBuilder-Samples repo and opening the qnamaker-prompting sample (C# and NodeJS provided) then you can plug your knowledge base details into the appsettings.json (C#) or .env (NodeJS) file and test the functionality locally using the Bot Framework Emulator.
The key part is this method which checks to see if the result contains any prompts and returns the response accordingly - it is called inside the controller.
This should give you a good idea of how to get started.
Can someone please provide the solution for integrate LUIS with multiple QnA KB.
You would basically create a LUIS app, then for each intent have it call the appropriate QnA KB. Tutorial on how to do this is here, "Integrate QnA Maker and LUIS to distribute your knowledge base".
I am searching for documentation on the integration of QnA Maker API with LUIS in Azure BOT Framework. But after a lot of research, I couldn't find any such document.
If anyone came across the same scenario, please post your efforts.
I am using C# as scripting here.
There are several general ways to do it, but it's ultimately up to you as the Bot developer to decide how to structure it.
A general overview is provided in the docs here, but if you want a more code oriented sample, this blog post should help you -
Dialog management with QnA, Luis, and Scorables
In the sample, the LuisDialog acts as a kind of message controller, which guides the user to a certain kind of dialog based on intent. This also can be used to direct a user to a QnA dialog ->
[Serializable]
[LuisModel("YourLuisAppID", "YourLuisSubscriptionKey")]
public class LuisDialog : LuisDialog<object>
{
// methods to handle LUIS intents
[LuisIntent("")]
[LuisIntent("None")]
public async Task None(IDialogContext context, LuisResult result)
{
// You can forward to QnA Dialog, and let Qna Maker handle the user's
query if no intent is found
await context.Forward(new QnaDialog(), ResumeAfterQnaDialog,
context.Activity, CancellationToken.None);
}
[LuisIntent("Some-Intent-Like-Get-Weather")]
public async Task GetWeather(IDialogContext context, LuisResult result)
{
....
// some tasks, forward to other dialog, etc
}
}
This is one way to do it, and a popular one. In this setup, if there is no intent that LUIS can detect, it'll route the user's query to a QnA dialog for the Qna Service (which you train) to answer.
Alternatively, you can create specifically a "Question intent" and try to forward it to QnA that way, if the user's intent was to ask a question. This is trickier however, as this method requires you to manually create custom code to manage the 'scores' of the responses.
Hope this was enough to help you get to what you need!
EDIT - Apologies, fixed the first link.
In addition, I'll just paste 3 common scenarios listed from the docs as ways you can use LUIS + QnA:
1) 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.
2) 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."
3)Call QnA Maker first, and if no answer meets a specific threshold score, then call LUIS.