Create AI Chatbot using Microsoft Bot Framework

Gartner Summits projects that more than 85% of customer interactions will be managed without a human by 2020. Chatbots are expected to be the number one consumer application of AI over the next five years according to TechEmergence. There are well-known platforms for building chatbot, such as IBM Watson, Microsoft Bot Framework, LUIS, Wit.ai, Api.ai, Chatfuel, and others.

Microsoft Bot Framework has its own Bot Builder SDK that includes .NET SDK and Node.js SDK. The entire system consists of three parts: Bot Connector, Developer Portal, and Bot Directory. The framework provides the Direct Line REST API, which can be used to host a bot in an application or website. It is open source and available to all on Github, and it supports automatic translation to more than 30 languages.

Microsoft Bot Framework understands users’ intents. It is possible to incorporate LUIS for natural language understanding, Cortana for voice, and the Bing APIs for search.

We are going to use Azure Bot Service which provides an integrated environment that is purpose-built for bot development, enabling us to build, connect, test, deploy, and manage bots, all from one place. It is powered by Microsoft Bot Framework and Azure Functions, which means that bot will run in a server-less environment on Azure that will scale based upon demand.

Following is what we are going to do :

  1. Create Q&A knowledge base.
  2. Create Azure service bot.
  3. Enable Web chat channel on the bot.
  4. Embed the web chat on the website.

For creating Q&A knowledge base,we are going to use Microsoft QnA Maker ,it s a free, easy-to-use, REST API and web-based service that trains AI to respond to user’s questions in a more natural, conversational way. Compatible across development platforms, hosting services, and channels.

Microsoft QnA Maker Launch Page

QnA Maker is primarily meant to provide a FAQ data source which can be queried from either Bot/Application. QnA Maker is offered as one of several templates in Azure Bot Service which enables rapid intelligent bot development powered by Microsoft Bot Framework, and run in a server less environment, scales based on demand.Also note currently there is a limit of a 20MB knowledge base.

Pre-requisites:

  1. Microsoft Account for generating AppID for your bot.
  2. Microsoft Azure subscription to use Azure Bot service

We will head over to Microsoft QnA Maker to create Q&A knowledge base.

  1. Once you login,click ‘Create new service’ to create new knowledge base.
  2. On the Next page, check if the questions,answers are proper.If you want to edit answers / questions,you can do it in this step.

    Check if the uploaded questions,answers are proper
  3. Click on ‘Test’ section on the left to test/train the Q&A model you’ve created.Check if the service is able to retrieve the correct answer for particular question.If its not able to retrieve,choose the correct answer from the alternatives given.If you want to provide alternative phrasing for the same question,there is an option on the right.Once you’re done with testing,choose ‘Save and retrain’.
    Check the boxed portions,this where we test,train & add alternative phrasing to the question
    Lets test it with the questions we have uploaded
    Add multiple phrasing to the same question
    Test if we get the same answer for the alternate we added
    Check if the questions we have added is updated to QnA knowledge base
    Now lets check for negative scenarios by giving some irrelevant questions.Correct the response appropriately

    Correct the answer appropriately
  4. Visit the ‘Settings’ tab to check if all of them are proper.

    Review the settings
  5. Once verified,click on ‘Publish’ button
    Click on ‘Publish’ button

    Congratulations! we have published service

Now that we have published service,next step is to create bot which we will see in the next post.

If you’ve any questions,please post it in the comments section.

Leave a Reply

Your email address will not be published. Required fields are marked *