One of the basic requirements in writing a Bot service is to seed it with questions and answers. In many cases, the questions and answers already exist in content like FAQ URLs or documents.
In this blog post we will discuss how bot makers can leverage the QnA Maker Cognitive Service to bootstrap their bots.
Microsoft Cognitive Services QnA Maker
As announced on the Bot Framework Blog, the Microsoft Cognitive Services QnA Maker, is a free, easy-to-use, REST API- and web-based service that trains AI to respond to users’ questions in a conversational way. This acts as an additional FAQ data source to use in your Bot code.
Bot Makers determine the source of their knowledge base content and, by extracting semi-structured data in the form of questions and answers in an FAQ document or webpage, the QnA Maker Service can create a knowledge base within a matter of minutes.
QnA Maker works in three steps: extraction, training, and publishing. To start, feed it anything from existing FAQ URLs to documents and editorial content. In the documentation there is an 8-minute video that includes a quick feature overview and outlines the steps to creating your first knowledge base. Below we will walk you through the process of extraction, training and publishing.
1. Extraction: Creating your Knowledge Base
Creating your knowledge base (KB) is as simple as pointing the tool to the existing content, and ingesting the QnA content.
Currently the tool can auto-extract question and answer pairs from most FAQ URLs and documents. If we are not able auto-extract, there is an option to editorially add QnA pairs later.
Follow the below steps to create a new KB.
Click on Create new service on the page here
Add sources for your KB
Click on Create
That’s it, your knowledge base has been created. QnA Maker extracts all possible pairs of questions and answers, and through the easy-to-use web interface you can edit, remove, or add any pairs, as well as test and train the knowledge base.
Follow the detailed guide for more information on how to update the knowledge base.
2. Training your knowledge base:
The relevance of the responses is the most important part of your QnA service. The train feature lets you evaluate the correctness of the responses and correct them and re-train the knowledge base.
There are two ways you can improve the relevance of the responses.
Chat with your KB
Chat with your knowledge base, to see the relevance of the responses. You can add a variation to an existing question as well as choose a different answer for a question.
Make sure you press Save and retrain, to reflect any changes/inputs you have provided.
Replay live chat logs
A very useful feature is to see what responses the service returns for live traffic, and then train it appropriately. You can download the live chat traffic hitting your published end-point by clicking on Download chat logs. This downloads all the questions hitting your end-point in descending order of frequency. Looking at the chat logs, you can decide which questions you want to test and train your knowledge base on, as described in the above section.
Once you’re satisfied with the scope of responses, you can publish your knowledge base as an API endpoint.
Follow the detailed guide for more information on how to train the knowledge base.
Before the final publish, you can preview the changes that will affect the knowledge base on final publish. Download the diff file to see what changes will be published.
Once satisfied with the preview, click on Publish.
Each published QnA Maker service is exposed as an HTTP endpoint that will take in a question and respond back with the best matched answer and a confidence score. Follow the detailed guide for more information on how to access the knowledge base.
QnA Maker is also seamlessly integrated into Azure Bot Service as a Question and Answer template. You can light up the QnA Bot in Skype in a few clicks, and then share it with anyone. QnA Maker service is another example how we at Microsoft are continuing to offer solutions to help make it easier for you to build smart bots.
If you have feedback or questions about the service, share your comments by going to https://qnamaker.ai/ and clicking on “Feedback” in the top navigation.
Also, to learn more about Microsoft Cognitive Services, go to https://www.microsoft.com/cognitive-services.
- Prashant Choudhari