Microsoft Azure

How to create a ChatBot with Microsoft Azure and the QnA Maker service

Hello

Let’s see a tutorial that consists of creating a chatbot the Azure Portal and QNA Maker to be able to solve questions that a person asks.

Create a new knowledge base

  1. Sign into to the QnA Maker portal with your Azure credentials and select Create a knowledge base.

  2. If you have not already created a QnA Maker service, select Create a QnA service.

  3. Select your Azure tenant, Azure subscription name, and Azure resource name associated with the QnA Maker service from the lists in Step 2 in the QnA Maker portal. Select the Azure QnA Maker service that will host the Knowledge Base.

    Setup QnA service

  4. Enter the name of your knowledge base and the data sources for the new knowledge base.

    Set data sources

    • Give your service a name. Duplicate names and special characters are supported.
    • Add URLs for data you want extracted. See more information on the types of sources supported here.
    • Upload files for data you want extracted. See the pricing information to see how many documents you can add.
    • If you want to manually add QnAs, you can skip Step 4 shown in the preceding image.
  5. Add Chit-chat to your KB. Choose to add chit-chat support for your bot, by choosing from one of the 3 personalities.

    Add chit-chat to KB

  6. Select Create your KB.

    Create KB

  7. It takes a few minutes for data to be extracted.

    Extraction

  8. When your Knowledge Base is successfully created, you are redirected to the Knowledge base page.

Create a QnA Bot

  1. In the Azure portal, select Create a resource.

    bot service creation

  2. In the search box, search for Web App Bot.

    bot service selection

  3. In Bot Service, provide the required information:

    • Set App name to your bot’s name. The name is used as the subdomain when your bot is deployed to the cloud (for example, mynotesbot.azurewebsites.net).
    • Select the subscription, resource group, App service plan, and location.
  4. To use the v3 templates, select SDK version of SDK v3 and SDK language of C# or Node.js.

    bot sdk settings

  5. Select the Question and Answer template for the Bot template field, then save the template settings by selecting Select.

    save bot service template selection

  6. Review your settings, then select Create. This creates and deploys the bot service with to Azure.

    create bot

  7. Confirm that the bot service has been deployed.

    • Select Notifications (the bell icon that is located along the top edge of the Azure portal). The notification will change from Deployment started to Deployment succeeded.
    • After the notification changes to Deployment succeeded, select Go to resource on that notification.

Chat with the Bot

Selecting Go to resource takes you to the bot’s resource.

Select Test in Web Chat to open the Web Chat pane. Type “hi” in Web Chat.

QnA bot web chat

The bot responds with “Please set QnAKnowledgebaseId and QnASubscriptionKey in App Settings. This response confirms that your QnA Bot has received the message, but there is no QnA Maker knowledge base associated with it yet.

Connect your QnA Maker knowledge base to the bot

  1. Open Application Settings and edit the QnAKnowledgebaseId, QnAAuthKey, and the QnAEndpointHostName fields to contain the values of your QnA Maker knowledge base.

    app settings

  2. Get your knowledge base ID, host url, and the endpoint key from the settings tab of your knowledge base in the QnA Maker portal.

    • Sign in to QnA Maker

    • Go to your knowledge base

    • Select the Settings tab

    • Publish your knowledge base, if not already done so

      QnA Maker values

Test the bot

In the Azure portal, select Test in Web Chat to test the bot.

QnA Maker bot

Your QnA Bot answers from your knowledge base.

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Check this Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Check this
Guest
Check this

Thanks to the excellent guide