Create A Conversational Bot Using Azure QnA Maker Cognitive Service🙂

Introduction

 
In this article, I am going to explain how to create a conversational bot with zero lines of coding using QnA Maker- Azure Cognitive Service. 
 

What is Bot?

 
Bot stands for Build OperateTransfer. It is used to interact with humans conversationally. They automate the process of interacting with people on websites and social media.
 

QnA Maker 

 
QnA maker is a cloud-based API that is used to create a conversational bot using the data you provided in your knowledge base. It will extract the questions along with all possible answers from the data provided so that the chatbot manages the question from the user by giving them a correct answer.
 
Let's get started.
 
Step 1 
 
Create a new resource on the Azure portal as QnA maker.
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Step 2 
 
Sign in to myQnA portal link, this is officially launched by Microsoft for creating a conversational bot. Once you have signed, you will get a screen as given below.
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Step 3 
 
Click "Create a knowledge base" in QnA portal. It will take you to follow five steps.
  • Create a QnA Service. It is already done in the Azure portal, so you can skip to the next step.

    Create A Conversational Bot Using Azure QnA Maker Cognitive Service
  • Connect your QnA service to your KB. In this step, just provide the details of your Azure subscription and Azure service that you created on the Azure portal.

    Create A Conversational Bot Using Azure QnA Maker Cognitive Service
  • Name your KB. This is the name of your bot.

    Create A Conversational Bot Using Azure QnA Maker Cognitive Service
  • Populate your KB. You can extract the questions and answers from any of your files. Supported formats are .doc, .docx , .pdf, .xlsx etc. In this example, I have given a URL to extract questions and answer. Add chit-chat by choosing one of the five pre-build personalities.

    Create A Conversational Bot Using Azure QnA Maker Cognitive Service

  • Create your KB. Once done, click "Create".

    Create A Conversational Bot Using Azure QnA Maker Cognitive Service
Step 4
 
After clicking Create, you will find the screen as given below. In this example, I've given the URL of my document from that it extracted the questions as well as the answers.
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Step 5 
 
You can test your bot manually. I have added the chit-chat as friendly. 
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Step 6 
 
Publish your KB. Before that, you can add your own question and answers pairs. You can modify the existing pairs also. Click "Publish" and it will take you to the interface showing "Create Bot". 
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Step 7
 
After clicking that, it will automatically redirect to Azure QnA Service. Give credentials like application name and so on. Mostly all fields are auto-filled, you need to provide the app name only. Once done, click "Create". You can see a web app bot in your Azure portal.
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Step 8 
 
You can plan, build, test, and publish your web app in the Azure portal. Go to Channels, you can find skype, Teamcenter etc. You can configure your bot to any of your channels.
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Step 9 
 
Test your bot in the web chat. It will give the same output as you got in the QnA Maker.
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Step 10
 
Go to build and download the source code. Open the file in Visual Studio.
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Run the code in Visual Studio. It will ask you to download the emulator for bot framework.
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 
Download the emulator and connect with the localhost. The output will be obtained in the emulator, as shown in the screenshot below.
 
Create A Conversational Bot Using Azure QnA Maker Cognitive Service
 

Summary 

 
Thanks for reading. If you have any doubts, post it as a comment. Have a nice day!!!!