Tutorial: Create a QnA Bot with Azure Bot Service v4
Create a QnA chat bot from the Publish page for an existing knowledge base. This bot uses the Bot Framework SDK v4. You do not need to write any code to build the bot, all the code is provided for you.
In this tutorial, you learn how to:
- Create an Azure Bot Service from an existing knowledge base
- Chat with the bot to verify the code is working
You need to have a published knowledge base for this tutorial. If you do not have one, follow the steps in Create and answer from KB tutorial to create a QnA Maker knowledge base with questions and answers.
Create a QnA Bot
Create a bot as a client application for the knowledge base.
In the QnA Maker portal, go to the Publish page, and publish your knowledge base. Select Create Bot.
The Azure portal opens with the bot creation configuration.
Enter the settings to create the bot:
Setting Value Purpose Bot handle
This is the Azure resource name for the bot. Subscription See purpose. Select the same subscription as you used to create the QnA Maker resources. Resource group
The resource group used for all the bot-related Azure resources. Location
The bot's Azure resource location. Pricing tier
The free tier for the Azure bot service. App name
This is a web app to support your bot only. This should not be the same app name as your QnA Maker service is already using. Sharing QnA Maker's web app with any other resource is not supported. SDK Language C# This is the underlying programming language used by the bot framework SDK. Your choices are C# or Node.js. QnA Auth Key Do not change This value is filled in for you. App service plan/Location Do not change For this tutorial, the location is not important. Application Insights Do not change Logging is sent to Application Insights. Microsoft App ID Do not change Active directory user and password is required.
Wait a couple of minutes until the bot creation process notification reports success.
Chat with the Bot
In the Azure portal, open the new bot resource from the notification.
From Bot management, select Test in Web Chat and enter:
How large can my KB be?. The bot will respond with:
The size of the knowledge base depends on the SKU of Azure search you choose when creating the QnA Maker service. Read [here](https://docs.microsoft.com/azure/cognitive-services/qnamaker/tutorials/choosing-capacity-qnamaker-deployment)for more details.
For more information about Azure Bots, see Use QnA Maker to answer questions
Clean up resources
When you are done with this tutorial's bot, remove the bot in the Azure portal.
If you created a new resource group for the bot's resources, delete the resource group.
If you didn't create a new resource group, you need to find the resources associated with the bot. The easiest way is to search by the name of the bot and bot app. The bot resources include:
- The App Service plan
- The Search service
- The Cognitive service
- The App service
- Optionally, it may also include the application insights service and storage for the application insights data
Related to QnA Maker bots
More information about bots
For more information about using this service with bots, begin with the following resources:
|Azure Bot service||The Azure Bot service provides a complete cloud-hosted web service with a bot endpoint. The services uses Bot framework, which is available in several languages.|
|Bot Framework||The Microsoft Bot Framework is a comprehensive platform for building enterprise-grade conversational AI experiences.|
|Bot Framework Emulator||The Bot Framework Emulator is a cross-platform desktop application that allows bot developers to test and debug bots built using the Bot Framework SDK. You can use the Bot Framework Emulator to test bots running locally on your machine or to connect to bots running remotely.|
|Bot tools||The Bot Framework tools are a collection of cross-platform command line tools designed to cover end-to-end bot development workflow.|
|Bot builder samples||Full-developed bot samples are designed to illustrate scenarios you'll need to implement to build great bots.|