For this guide we will be create an FAQ chat-bot using Azure bot services and QnA Maker for the knowledge base. The bot will then be integrated into a web page in part 2.
First step is to create our knowledge base. Head over to QnA Maker and sign in with a Microsoft account. Create a new service at the menu bar. QnA allows you to add the URL of your existing FAQ web page and automatically import them in to your knowledge base, that’s if they are well formatted. In this case we`ll leave that blank and add our question pairs later.
You should now be presented with your knowledge base. As mentioned earlier QnA allows us to automatically extract question and answer pairs using URL’s or a variety of document types (.docx, .doc, .pdf, .xlsx, and .tsv). You can also manually add these directly into the knowledge base. Click Add new QnA pair in the top right.
In the left hand side of the table, the question column, this is where you`ll input your questions, phrased in a way users would be asking your bot for example. “How do I book an appointment” or “How do I request a demo” . In the Answer box, the exact answer you want your bot to reply back to the user. You don’t need to add every possible phrasing your users may ask your bot for the same answer, the bot will handle that after we train it. By matching the keywords of your question to your user’s input the bot will suggest the closest match. Go ahead and enter more QnA pairs then save and retrain your bot and then publish. You will be redirected to a page showing you a summary of changes you have made to the bot , select publish one more time.
Your bot is now successfully deployed, you will be presented with instructions on how to make a post request to test your bot but we don’t need to worry about that for now, QnA maker allows you test your bot directly in the service. In the menu bar, head to My Services and click the edit icon on your bot. You will be back to a familiar screen, the knowledge base,you can always add new question pairs but for the moment we want to navigate to the Test section on the left sidebar.
You can go ahead and test your chatbot. You can throw different types of questions to see how well your bot matches it to your answers. If it fails you can always add in more alternate phrasing questions to your knowledge base.. Remember to always save retraining and publish your bot every time you make any changes.
That’s it for this guide, in part 2 we will connect our QnA knowledge base to azure bot services, which will allow us to embed and chat bot to many different services such as Facebook messenger, Twilio and directly onto a web page. Enjoy playing with your bot for now!