Creating a Chatbot on Azure
The course is part of these learning paths
The ‘Building a Chatbot on Azure’ course will allow team members to learn how to automate basic support tasks by using chatbots to answer typical questions about their products and/or services.
In this course, you will learn how to create a chatbot to answer support questions about specific products and services. Along with this, you will learn how to combine the Azure Bot Service and Azure QnA Maker and to add speech input and output capabilities to help customers on mobile devices and those with impaired sight.
This course is made up of 5 lectures that will require some previous knowledge of Azure and coding.
- Create and configure an Azure QnA Maker knowledge base
- Create an Azure Bot Service chatbot that answers questions
- Enable speech recognition and synthesis on an Azure chatbot
- Those interested in artificial intelligence services on Azure, especially chatbots
- Previous experience using Azure
- Previous experience with writing code
The GitHub repository for this course is at https://github.com/cloudacademy/azure-chatbot.
You might think that our first step would be to create a bot. We could do that, but it probably makes more sense to build a knowledge base first and then create a bot that uses it. As I mentioned earlier, we can use QnA Maker to do that.
In the Azure portal, click “Create a resource” and search for “qna”. There’s QnA Maker. Click on it and click “Create”. You can call it anything, but you probably want the name and the app name to be the same, and the app name has to be globally unique, so start there. I’m going to call mine “qnaforbot”. You’ll have to choose something else. Then copy it to the Name field.
There are two pricing tiers available. Choose the free one. You also have to choose a pricing tier for the search service. That’s because QnA Maker automatically creates an Azure Search service for you. Choose free again.
It also creates an App Service app for you, but you can’t change the pricing tier from here. You have to go to the App Service and change it once it’s created.
This last part is to enable Application Insights, which is a performance analysis tool for apps. If we were building a production app, then I’d probably enable it, but since it’s just a demo, I’m going to disable it. Then click “Create”. It takes a little while to create everything, so I’ll fast forward.
OK, it’s done. Now go to “All resources” and search for the name you used. You can see that it created 4 resources: QnA Maker under Cognitive Services, an App Service app and its associated plan, and a Search service. Now that everything is ready, we need to create a knowledge base.
Like all of the cognitive services, QnA Maker is accessed by using an API. The documentation gives example code for C#, Java, Node.js, Python, and Go. But it’s also possible to create a knowledge base using the QnA Maker portal, which is at qnamaker.ai. So much for my theory that Cognitive Services is only for task-oriented tools. QnA Maker is starting to look like a full system.
Click on “Create a knowledge base”. You can see that we could have created the QnA service from here, but it would have just taken us to the portal and we would have gone through the same steps anyway.
Since we already created a QnA service, we have to specify it here. Pick the tenant in Azure Active Directory. I only have one, so that’s easy. Then choose the subscription. You might only have one in your list. Now the QnA service you just created should show up in this dropdown.
Give your knowledge base a name. I’ll call mine “KB for bot”.
Here’s where we finally tell it which questions and answers to put in the knowledge base. We’re going to add the FAQ for QnA Maker itself, which is kind of meta, don’t you think? You can find the URL in the github readme file I showed you earlier. If you have questions and answers in files, then you can add them here.
Alright, now click “Create your KB”. I’ll fast forward again.
You can see that it extracted the questions and answers from the FAQs. You can also add questions and answers manually if you want, but we’re not going to do that.
You can test the knowledge base very easily by clicking “Test”. Now type something in and see what it comes back with. Let’s try “pricing”. Hmmm, it didn’t find anything about pricing in the knowledge base. How about seeing what languages are supported in QnA Maker. Now it came back with something.
OK, it seems to be working, so click “Save and train”. You can get rid of the test window by clicking “Test” again. Alright, now we need to publish it so we can connect it up to a bot. Click the “Publish” button.
That was fairly quick. It came back with a sample HTTP request to send a question to the QnA service. We’re going to need this information when we create the bot, so don’t close this browser tab.
OK, if you’re ready to create the bot, then go to the next video.
Guy launched his first training website in 1995 and he's been helping people learn IT technologies ever since. He has been a sysadmin, instructor, sales engineer, IT manager, and entrepreneur. In his most recent venture, he founded and led a cloud-based training infrastructure company that provided virtual labs for some of the largest software vendors in the world. Guy’s passion is making complex technology easy to understand. His activities outside of work have included riding an elephant and skydiving (although not at the same time).