In recent months, I have been given a chance to share my knowledge about creating bot, Artificial Intelligence and Machine Learning. This time you will learn how to build an interactive QnA bot with the Cognitive Services of Microsoft. In this sharing, you would expect to take away on how you can build a Question & Answer Bot. This type of bots is able to answer questions based on predefined answers or a Q&A sheet/page.
You may read some other topics about Microsoft Cognitive Service, including Bot Framework & Machine Learning below:
What You’ll Need
We will need a Microsoft Account for today’s learning, and of course a Web Browser. That’s it!!! Everything can be setup using a browser, cool? Definitely!
What’s So Good about Microsoft QnA Maker?
It is all about speed, scaleability and how easy to integrate to your website!
17 Simple Steps to Build! Let’s Beginnnnnnnnnn!
We are going to build with bot in 17 steps with the QnA Maker of Microsoft.
Step 1: Login to QnAMaker.ai
Go to https://qnamaker.ai and log on with your Microsoft Account. You may have to give the app several permission before you can start.
Step 2: Create a Knowledge Base After Login
Step 3: Create a new QnA service in Azure.
Click “Create a QnA service” button and it should redirect you to Azure Portal.
After clicking on Create, your bot will be created, and you will be guided to the Knowledge Base.
Step 4: Create Question & Answer pairs.
Enter all necessary details for the subscription and service creation.
Step 5: Create QnA Service and Give Knowledge Base a Name
You would need to select the Azure’s QnA service that we have just created on Azure Portal and name your knowledge base so you can refer to it later.
Step 6: Insert QnA’s Location or Upload a QnA Sheet
You may insert your QnA page url or you may upload a QnA sheet. In this tutorial, we will use the Singapore Airlines’s QnA Page. For your info, I am not promoting for SIA.
Step 7: Tick… Tock… Tick… Tock…
What you need to do is… wait for the KB to be created.
Step 8: Save and Train
It should list all the questions and answers from your QnA page/sheet. You can also add alternative phrasings of the questions.
Step 9: Test the Knowledge with the Test Bot
On the right top, you should see “Test” button, just click to slide the blade of chatbot. Now, try to ask some questions from the QnA to ensure it answers correctly.
Step 10: Publish to Finalize Your Knowledge Base
Step 11: Remember to Take Note of These Three Info.
Write and Save these three information: QnAKnowledgeBaseId, QnAEndPointHostName and QnAAuthKey.
Step 12: Time to Create a Web App Bot, Search in Azure.
In the Azure Portal, search for Web App Bot. By creating Web App Bot, we can link the bot to the knowledge base and provide the interactive chatbot services on your website, Skype, Cortana, mobile app and many other channels.
Step 13: Create QnA Chat Bot
You are required to fill up all the necessary details, Bot name, Subscription, Resource group, Location, Pricing tier, App name. It may be familiar to the previous learning of “Intelligent Bot on Cloud With Microsoft Bot Framework & Azure“. However, this time around, we will pick Question and Answer setup template.
Step 14: Give It a Trial
Before going little bit further, test it first and make sure it works.
Step 15: Configuration for QnA Bot is Mandatory
When you try to test the bot, it will now prompt you to do the necessary configuration and to link with your KB.
Step 16: Set Application Settings
In order to test your bot in Web Chat, you have to set the Application setting, using your Hostname, KBId and Authkey (from step 11).
Step 17: Test the Bot Again! It should works.
Lastly, test by asking some questions from the QnA KB. Your bot should give you the right answer.
By completing this lab, you have created your own Question & Answer Bot. We hope you would enjoy! Check out how to insert this bot to your website by following “Intelligent Bot on Cloud With Microsoft Bot Framework & Azure“.