{"id":130,"date":"2018-03-15T21:56:00","date_gmt":"2018-03-15T20:56:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/2018\/03\/15\/bot-framework-tutorial-4-creating-a-question-and-answerqna-bot\/"},"modified":"2020-11-05T14:09:22","modified_gmt":"2020-11-05T13:09:22","slug":"bot-framework-tutorial-4-creating-a-question-and-answerqna-bot","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/bot-framework-tutorial-4-creating-a-question-and-answerqna-bot\/","title":{"rendered":"Bot Framework Tutorial 4: Creating a Question and Answer(Qna) Bot"},"content":{"rendered":"<div style=\"color: #555555; font-size: 18px; line-height: 30px; text-align: justify;\">\n<div style=\"font-family: 'segoe ui';\">In the <a href=\"https:\/\/kindsonthegenius.com\/blog\/bot-framework-tutorial-2-create-your-first-chat-bot-in-azurestep-by-step\/\" target=\"_blank\" rel=\"noopener noreferrer\">Tutorial 2<\/a>, we learnt how to create a basic bot in Azure. In this  lesson, we would take it a step further and learn how to create  a  question and answer bot.<\/p>\n<p><b>Content<\/b><\/p>\n<hr \/>\n<ol>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#whatis\">What is a Question and Answer Bot<\/a><\/li>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#luis\">Understanding LUIS<\/a><\/li>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#qna\">The QnaMaker<\/a><\/li>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#steps\">Steps Build a QnA Bot<\/a><\/li>\n<ul>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#step1\">Step 1: Create the Question and Answer Knowledgebase<\/a> <\/li>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#step2\">Step 2: Create New Qna Service<\/a><\/li>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#step3\">Step 3: Create&nbsp; a Question and Answer Bot<\/a><\/li>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#step4\">Step 4: Link the QnA Bot to the QnA Service<\/a><\/li>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#step5\">Step 5: Test The Bot<\/a><\/li>\n<\/ul>\n<li><a href=\"http:\/\/kindsonthegenius.blogspot.com\/#final\">Final Notes and Next Step<\/a><\/li>\n<\/ol>\n<h3><b>1. What is a Question and Answer Bot?<\/b><\/h3>\n<hr \/>\n<p>This a bot that makes use of a question and answer databases to provide interactions with users by provided responses to user questions.<\/p>\n<p>A question and answer bot allows you to discuss with it and while you ask questions, it provides you with relevant answers based on the content of the knowledgebase. <\/p>\n<h3><b>2. Understanding LUIS<\/b><\/h3>\n<hr \/>\n<p> LUIS stands for Lanuguage Understanding Intelligent Service offers a fast and effect way of adding language understanding to applications. Using LUIS, you can use pre-existing models to create Bots that can interact with users in a more natural way.<\/p>\n<p>LUIS allows your application to understand what someone wants in their own words. It makes use of machine learning algorithms to allows developers to build applications taht can recieve input from user in a natural language and then deduce the intended meaning. <\/p>\n<p>Learn more about LUIS from <a href=\"https:\/\/kindsonthegenius.com\/blog\/what-is-luis-language-understanding-intelligent-service\/\" target=\"_blank\" rel=\"noopener noreferrer\">What is LUIS (Language Understanding Intelligent Service) <\/a><\/p>\n<p> <\/p>\n<h3><b>3. Understanding The QnaMaker<\/b><\/h3>\n<hr \/>\n<p>One of the key features of a Bot is to be able to seed it with a list of questions and answers. This list could be in a spreadsheet, document file, pdf, web page etc.<\/p>\n<p>The QnaMaker is a free and easy to use REST API&nbsp; that trains AI to respond to users&#8217; question in a more human and conversational way.<\/p>\n<p>With QnA Maker you can have a list of predefined questions and answers you have created. Then you can load this data to the service to create a knowledgebase and then trains it to respond to cetain variations of the question in the knowledgebase.<\/p>\n<p>In this tutorial, we would create a Qna Service in QnaMaker and then use this service in the Question and Answer bot we would be creating.<\/p>\n<p>You can read more about QnaMaker from the Qna Documentation <a href=\"https:\/\/qnamaker.ai\/Documentation\">https:\/\/qnamaker.ai\/Documentation<\/a><\/p>\n<p>Figure 1 Illustrate how QnaMaker integrates with Bot Framework.<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/2.bp.blogspot.com\/-gTfFglPCauc\/WqrnB7RfvNI\/AAAAAAAABZw\/Yx-pv83r7aEbwA_HBDKqwGL_lvt6LBHLQCLcBGAs\/s1600\/BotFramework%2Band%2BQna.png\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"666\" data-original-width=\"910\" height=\"292\" src=\"https:\/\/2.bp.blogspot.com\/-gTfFglPCauc\/WqrnB7RfvNI\/AAAAAAAABZw\/Yx-pv83r7aEbwA_HBDKqwGL_lvt6LBHLQCLcBGAs\/s400\/BotFramework%2Band%2BQna.png\" width=\"400\" \/>&nbsp;<\/a><\/div>\n<div style=\"clear: both; text-align: center;\">Figure 1: Photo taken from https:\/\/qnamaker.ai\/Documentation <\/div>\n<h3><b>4. Steps to Create a QnA Bot<\/b><\/h3>\n<hr \/>\n<p>Take the following easy steps to complete the process of creating a Qna Bot<\/p>\n<p><span style=\"color: #0c343d;\"><b><i><\/p>\n<h3>Step 1: Create the QnA KnowledgeBase<\/h3>\n<p><\/i><\/b><\/span><br \/>You will create a list of questions and answers that would be used by the bot.You will do this in Microsoft Word or any other text editor you have. Create the question and answers using the format shown in Figure 1.<\/p>\n<p>Save the file with a name. We will upload this file to QnaMaker<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/3.bp.blogspot.com\/-9nS5q-W_sHg\/WqrNj-EJazI\/AAAAAAAABXw\/RygGCGEfTmgYhYia07Pb7E-L0eIYJIB-wCLcBGAs\/s1600\/QnaFormat.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"796\" data-original-width=\"1461\" height=\"347\" src=\"https:\/\/3.bp.blogspot.com\/-9nS5q-W_sHg\/WqrNj-EJazI\/AAAAAAAABXw\/RygGCGEfTmgYhYia07Pb7E-L0eIYJIB-wCLcBGAs\/s640\/QnaFormat.jpg\" width=\"640\" \/><\/a><\/div>\n<div style=\"clear: both; text-align: center;\"><\/div>\n<p><span style=\"color: #0c343d;\"><b><i><\/p>\n<h3>Step 2: Create a new QnA Service<\/h3>\n<p><\/i><\/b><\/span><br \/>Go to https:\/\/qnamaker.ai\/<br \/>Login using your Microsoft Account<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/1.bp.blogspot.com\/-m1WWmQHRVV8\/WqrO8nx6e2I\/AAAAAAAABYA\/lSMiusYgCy4G4SgsRG1ZaqKZlFqew3pegCLcBGAs\/s1600\/qnaMakerai.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"723\" data-original-width=\"1147\" height=\"401\" src=\"https:\/\/1.bp.blogspot.com\/-m1WWmQHRVV8\/WqrO8nx6e2I\/AAAAAAAABYA\/lSMiusYgCy4G4SgsRG1ZaqKZlFqew3pegCLcBGAs\/s640\/qnaMakerai.jpg\" width=\"640\" \/><\/a><\/div>\n<p>Click on Create new Service.<br \/>The new qnaService creation form opens as shown in the Figure.<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/3.bp.blogspot.com\/-c2FRjSBq65U\/WqrQnV5VXcI\/AAAAAAAABYM\/9QxthdKiT54MiM2d3OUSiyeOOSV7_4bVACLcBGAs\/s1600\/QnaService.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"761\" data-original-width=\"1239\" height=\"392\" src=\"https:\/\/3.bp.blogspot.com\/-c2FRjSBq65U\/WqrQnV5VXcI\/AAAAAAAABYM\/9QxthdKiT54MiM2d3OUSiyeOOSV7_4bVACLcBGAs\/s640\/QnaService.jpg\" width=\"640\" \/><\/a><\/div>\n<p>Enter a name you would like to give to the service<br \/>Leave the URL field bland<\/p>\n<p>Scroll down to the Upload File section.<br \/>Click Select File and select the file you created in step 1.<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/4.bp.blogspot.com\/-krmJCmPsFJo\/WqrRJgq9EnI\/AAAAAAAABYU\/pgQA1L5CpWkj3EjLwwpUL6fxaKmKHRSrACLcBGAs\/s1600\/qnaServiceUploadFile.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"756\" data-original-width=\"1413\" height=\"340\" src=\"https:\/\/4.bp.blogspot.com\/-krmJCmPsFJo\/WqrRJgq9EnI\/AAAAAAAABYU\/pgQA1L5CpWkj3EjLwwpUL6fxaKmKHRSrACLcBGAs\/s640\/qnaServiceUploadFile.jpg\" width=\"640\" \/><\/a><\/div>\n<p>After the file have uploaded, click on Create<br \/>The window below is displayed. It takes a few seconds to process the request.<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/1.bp.blogspot.com\/-VUQNSk-RXrg\/WqrRxzahcpI\/AAAAAAAABYc\/ZYaqznGSLZgpBkOLUtV7VjK70F5jQUiaQCLcBGAs\/s1600\/Processing%2BNew%2BService.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"811\" data-original-width=\"1421\" height=\"363\" src=\"https:\/\/1.bp.blogspot.com\/-VUQNSk-RXrg\/WqrRxzahcpI\/AAAAAAAABYc\/ZYaqznGSLZgpBkOLUtV7VjK70F5jQUiaQCLcBGAs\/s640\/Processing%2BNew%2BService.jpg\" width=\"640\" \/><\/a><\/div>\n<p>When the processing is completed, the next page is displayed<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/3.bp.blogspot.com\/-tScAQPA-2Ic\/WqrTeOZGbOI\/AAAAAAAABYw\/WeuQ_uclR2E1jFxnZeVMdtD2Bzks8Ly4wCLcBGAs\/s1600\/qnaComplete.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"793\" data-original-width=\"1435\" height=\"352\" src=\"https:\/\/3.bp.blogspot.com\/-tScAQPA-2Ic\/WqrTeOZGbOI\/AAAAAAAABYw\/WeuQ_uclR2E1jFxnZeVMdtD2Bzks8Ly4wCLcBGAs\/s640\/qnaComplete.jpg\" width=\"640\" \/><\/a><\/div>\n<div style=\"clear: both; text-align: center;\"><\/div>\n<p>To test the Service, Click on Test on the left side of the page.<br \/>Enter &#8216;Hi&#8217; to see the response<br \/>Enter a question&nbsp; and see if it responds with the correct answer<br \/>After testing, you then click on Publish to publish the qna Service<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/4.bp.blogspot.com\/-tUEohw8E8As\/WqrUw9G2JQI\/AAAAAAAABY4\/Hsxn0hG_OsQcqB6ginlmZHtFGUJRUY-BACLcBGAs\/s1600\/publishqna.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"795\" data-original-width=\"1443\" height=\"352\" src=\"https:\/\/4.bp.blogspot.com\/-tUEohw8E8As\/WqrUw9G2JQI\/AAAAAAAABY4\/Hsxn0hG_OsQcqB6ginlmZHtFGUJRUY-BACLcBGAs\/s640\/publishqna.jpg\" width=\"640\" \/><\/a><\/div>\n<p>Click on Publish again the complete the deployment process<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/3.bp.blogspot.com\/-KnJdrycd6sM\/WqrU7si_xWI\/AAAAAAAABY8\/T7LCpbTRNuUSID6TIe6dFO2A6z8HwuSJQCLcBGAs\/s1600\/qnaFinal.jpg\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"802\" data-original-width=\"1446\" height=\"353\" src=\"https:\/\/3.bp.blogspot.com\/-KnJdrycd6sM\/WqrU7si_xWI\/AAAAAAAABY8\/T7LCpbTRNuUSID6TIe6dFO2A6z8HwuSJQCLcBGAs\/s640\/qnaFinal.jpg\" width=\"640\" \/><\/a><\/div>\n<p>Then note donw the KnowledgeBase Id&nbsp; and the Subcription Key as highlighted in the figure<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/4.bp.blogspot.com\/-zCEz-eZHkAI\/WqrV-2oFhhI\/AAAAAAAABZQ\/ljMBcwbfQ44wxT8rq3s4Zhl1W4u8ps5CwCLcBGAs\/s1600\/KnowledgebaseID%2Band%2BSubscription%2BKey.JPG\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"212\" data-original-width=\"740\" height=\"113\" src=\"https:\/\/4.bp.blogspot.com\/-zCEz-eZHkAI\/WqrV-2oFhhI\/AAAAAAAABZQ\/ljMBcwbfQ44wxT8rq3s4Zhl1W4u8ps5CwCLcBGAs\/s400\/KnowledgebaseID%2Band%2BSubscription%2BKey.JPG\" width=\"400\" \/><\/a><\/div>\n<p>Congratulations!<br \/>You have successfully created a qna Service ready to be used in your bot in Microsoft Azure. You can go ahead to close the Window and login to Microsoft Azure<\/p>\n<p><span style=\"color: #0c343d;\"><b><i><\/p>\n<h3>Step 3: Create a Question and Answer Bot in Azure<\/h3>\n<p><\/i><\/b><\/span><br \/>Visite <a href=\"http:\/\/portal.azure.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">portal.azure.com <\/a><br \/>Follow the bot create process to create a Question and Answer bot in Azure.<br \/><a href=\"https:\/\/kindsonthegenius.com\/blog\/bot-framework-tutorial-2-create-your-first-chat-bot-in-azurestep-by-step\/\" target=\"_blank\" rel=\"noopener noreferrer\">See how to create a bot here<\/a><\/p>\n<p><span style=\"color: #cc0000;\">Important<\/span>: In the Bot Template, you must Choos Question and Answer<\/p>\n<p><span style=\"color: #0c343d;\"><b><i><\/p>\n<h3>Step 4: Link the QnA Bot to the Qna Service<\/h3>\n<p><\/i><\/b><\/span><br \/>Go to the Application Setting. This is under App Service Setting<br \/>Scroll down to find QnaKnowledgeBaseID and QnaSubscription Key<\/p>\n<div style=\"clear: both; text-align: center;\"><\/div>\n<div style=\"clear: both; text-align: center;\"><a href=\"https:\/\/4.bp.blogspot.com\/-pq4yGd8tvQI\/WqrZYIyCEgI\/AAAAAAAABZc\/HNcw08cPX9Uy61f79-TuV1hqnLpZy5HlgCLcBGAs\/s1600\/QnaKey%2Band%2BID.JPG\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" data-original-height=\"510\" data-original-width=\"933\" height=\"347\" src=\"https:\/\/4.bp.blogspot.com\/-pq4yGd8tvQI\/WqrZYIyCEgI\/AAAAAAAABZc\/HNcw08cPX9Uy61f79-TuV1hqnLpZy5HlgCLcBGAs\/s640\/QnaKey%2Band%2BID.JPG\" width=\"640\" \/><\/a><\/div>\n<div style=\"clear: both; text-align: center;\"><\/div>\n<p>Now you need to enter the KnowledgebaseID and Subscription key you got from Step 2<\/p>\n<p>When you are done, click on the Save button at the upper part of the window.<br \/>Now, you are ready to roll!<\/p>\n<p>So let&#8217;s now test our Question and Answer Bot<\/p>\n<p><span style=\"color: #0c343d;\"><b><i><\/p>\n<h3>Step 5: Test thet Bot<\/h3>\n<p><\/i><\/b><\/span><br \/>Under Bot Managment, Click on Test in Web Chat<br \/>Enter one of the questions defined in the Question and Answer file we created<br \/>Try some other question<br \/>Try entering a question that is not there.\ud83d\ude03\ud83d\ude04<\/p>\n<p> <\/p>\n<h3><b>5. Final Notes <\/b><\/h3>\n<hr \/>\n<p>If you have completed this lessons successfully, thumbs up to you! If you have challenges along the line, you can let me know at the form by the left of this page that says, &#8216;Your Opinion Matters&#8217;.<br \/>I would also like to tell you&nbsp; that if you did this successfull, then almost every other aspect of bot framework would not be a bid deal for you.<br \/>Let&#8217;t now move on to the next steps,&nbsp; where we would learn how to configure channels for out bot. <\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In the Tutorial 2, we learnt how to create a basic bot in Azure. In this lesson, we would take it a step further and &hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[195],"tags":[],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/130"}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":3,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/130\/revisions"}],"predecessor-version":[{"id":1749,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/130\/revisions\/1749"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}