Learn about QnA Maker and how to integrate it with a bot
In this module, you will:
Let’s create a QnA Maker knowledge base (KB).
Go to the QnA Maker portal.
Select Sign in in the upper-right corner and sign in with your Azure credentials.
Unless you already have a knowledge base (KB), the portal will point out that you don’t have any.
In the menu at the top of the portal, select Create a knowledge base.
Select Create a QnA service. Selecting this button takes you to the Azure portal and signs you in with the credentials you used earlier. You create the QnA Maker service and the associated Azure app service that will host it in this portal. You can also create a QnA Maker service in the Azure portal before you create a knowledge base.
After a brief deployment process, your resource will be created for the service.
Return to the QnA Maker web portal tab and refresh the page.
The page will refresh. Scroll down to Step 2.
The entries under Step 2 won’t be filled in, but a link to the account information will be populated.
Select your Azure Directory ID, subscription name, and the name of the new QnA service you created earlier.
In Step 3, give your knowledge base a name. We’ll use the Microsoft Bot FAQ, so you can name it BotFAQ.
We need some data for our KB. We’ll use an existing FAQ as a sample.
Download the Microsoft Bot FAQ zip file and extract it to your local computer.
In Step 4 of the QnA web portal process, select Add file, locate the Word document that you extracted in the previous step, and add the document as a source to populate your KB.
Under Chit-chat, select The Professional to add a predefined personality to your KB. Chit-chat adds responses for messages like hello and goodbye.
Select Create your KB.
After a short time, your KB will be created and the Edit page will load.
To get an idea of how a bot might respond to questions, select Test in the upper-right corner.
A test panel opens, ready for a question.
Enter Hello and select the Enter key. QnA will respond with “Hello.”
Enter when will v3 retire? and select Enter. QnA will respond with a message about v3 updates and release information.
Enter what is included in v4? and press Enter. Read the response.
You can continue to test the interaction by asking questions and evaluating the responses to get an idea of how the QnA KB is polled for answers.
Now that you’ve created a QnA knowledge base, it’s time to publish it so you can access it from a client application.
On the QnA Maker Knowledge base page, where you were testing in the previous exercise, select PUBLISH in the menu at the top of the page.
Read the message on the next page. It indicates that your KB will move from test to production. It also points out that your KB will be available as an endpoint that you can use in apps and bots.
Select Publish.
After a short time, a success message will appear (if no errors occur).
Note the URL information that appears. You can use the information provided to test the KB with Postman or curl.
If you need to, you can select Edit Service to go back to the KB and make edits.
Now that you’ve created and published your QnA knowledge base, it’s time to learn how to integrate it with a bot. In this exercise, you’ll create a chatbot on the Azure to integrate with the QnA Maker knowledge base you created earlier.
In the QnA Maker portal, go to the Publish page, and publish your knowledge base, if it is not already published.
Select Create Bot. The Azure portal opens with the bot creation configuration.
In the Azure portal, open the new bot resource from the notification.
From Bot management, select Test in Web Chat and test the QnA by asking the bot questions