Some time ago I published a blog post about creating chatbots using Azure Bot Service. Today I would like to describe how to develop possibilities of your chatbot by using QnA Maker. It is another Cognitive Service that increases the intelligence of the Bot Framework. What is it about? How can you build it and then use it? I will try to answer these questions in this article.
As I mentioned earlier, it is one of the Cognitive Services that allows extracting question-answer pairs from content such as guidelines. The model improves over time thanks to Active Learning – it improves the quality of your knowledge base by suggesting alternative questions. QnA Maker suits perfectly the Bot Framework and improves the capacity to respond to questions that are getting by your chatbot.
Options to build QnA Maker
- Data sources:
getting data from various sources such as documents or public web pages.
creating the questions and answers manually. It is mostly used when you have to create the new KB (knowledge base) from scratch.
creating some chit-chat content that is not related to the main topic of QnA. Thanks to that you can have a little bit more personal knowledge.
Now We can move to Microsoft Azure. First, make sure you have an Azure subscription, then start creating a resource. In the Marketplace box, type ‘QnA Maker’ and click ‘Create’:
You should see a form with configuration settings:
Provide the name, choose your subscription and resource group. Choose a location that is the closest to your place. Select a pricing tier and write an App name (this is the name of the service that will be hosting your QnA Maker logic). Then pick Azure Search details and App Service details. I recommend choosing the same location as before, it is the optimal solution. For demo purpose, I’ve chosen a free option for the Azure Search pricing tier. After all the settings, you can click Create.
After 1-2 minutes your service will be created, then you can go to the resource. You should see the view below:
Now you can go to qnamaker.ai and select the ‘Create a knowledge base’ button:
In the second step, you can connect your QnA service to your knowledge base:
So select there your Azure ID, the subscription name, the QnA service you have just created and English as the language. Then provide the name of your KB and the link of your question-and-answer pairs. I chose sample interview questions and answers for that. This is a job interview, so a good idea is to select ‘Professional’ from the options available in Chit-chat. After all settings, you can finally click ‘Create’.
You should now see a view with the questions and answers loaded. The next step is to start the publishing process. Before that, you can click the ‘Test’ button and provide there some questions from your knowledge base:
Ok, after the model is published, you should see the ‘Create Bot’ button. Let’s click on it and you will get back to the Azure Portal.
Leave there everything as default apart from the Pricing Tier (a free option is cheaper :)) and Application Insight Location. I assume that the choice of the SDK language may seem unnecessary to you. Of course, you did not need a single line of code to create a chatbot and QnA Maker, but in the future, you may want to add some changes and it’s worth choosing a language that we know better.
After some minutes your service will be created, then you can go to the resource and select Test in Web Chat from the left navigation. You can test your chatbot there as before when configuring QnA Maker:
The next step from here would be to create the chat channel where you would use your chatbot. So you can always choose ‘Channels’ from the left navigation and then select communicators such as Slack or Skype to integrate that. Maybe it will be a topic for another blog post. I hope you found this one useful and interesting.