Build your Bot
Workshop Setup and Instruction Guide
In most of our Microsoft Data Science meetup, hosted by i.e. Infi, InSpark, Winvision, Macaw, among others, we organize workshops. This time you will learn how to build a bot with the Cognitive Services of Microsoft. In this workshop you wil build a Question & Answer Bot. This type of bots is able to answer questions based on predefined answers.
The point of this workshop is to introduce you to the basics of creating a simple bot, and it is not intended to be a deep-dive into bot development. If you want to learn more, please check out the Microsoft Bot Framework.
What You’ll Need
To perform the tasks, you will need the following:
- A Windows, Linux, or Mac OSX
- A web browser and Internet
- A Windows Live ID
Build your Bot
We are going to build with bot in 10 steps with the QnA Maker of Microsoft. You will need a Windows Live ID to logon.
Step 1: Start the QnA Maker
Go to https://qnamaker.ai and log on with your Windows Live ID. You will have to give the app several permission before you can start.
Step 2: Agree with the Cognitive Services Terms.
Step 3: Create a new QnA service.
Here you can give your bot a name (SERVICE NAME) and click on Create to create your bot.
After clicking on Create, your bot will be created, and you will be guided to the Knowledge Base.
Step 4: Create Question & Answer pairs.
In the Knowledge Base, you can create question-and-answer pairs.
Step 5: Save and Retrain your model
When you have created enough questions-and-answer pairs, you can save and retrain your model.
Step 6: Test your Model
Now your bot is ready to test. If you go to the menu item Test (under Knowledge Base), and start testing your bot by typing questions in the dialog box.
You can also add alternative phrasings of the questions.
If you discover new questions, for which you had not defined answers, you can go back to step 4 and 5 and create new questions-and-answer pairs, followed by retraining your model.
Step 7: Publish your Model
Finally you can publish your model.
After publishing, you will be provided with an knowledge base id and an key, with which you will be able to use your bot around different channels.
Step 8: Create Azure Web Bot
In order to use your bot around different channels, you have to create an Web App Bot. There you would need a (free) Azure account.
After selection to create a Web App bot, you have fill out a Bot name, Subscription, Resource group, Location, Pricing tier, App name, Bot template (select the Question and Answer option), App service plan, Azure Storage, Application insights, etc., and click on Create.
Step 9: Configure channels
You have various channels to deploy your bot to. For now, we stick with the web chat channel. Here you can also get the code to embed your bot in your website later on.
Step 10: Test your bot in Web Chat
In order to test your bot in Web Chat, you have to set the Application setting, using your knowledge base id and key (from step 7).
Save the data, and you will be ready to go to Test in Web Chat.
You can now embed this bot in your website.
By completing this lab, you have created your own Question & Answer Bot. We hope you enjoyed this introductory lab and that you will build many more bots! If you would like to know more about building bots, then check out our Developing Intelligent Apps and Bot course, delivered by DataChangers.