A slight departure from the usual testing related stuff, awhile ago I made a chat bot service in Azure in a fleeting attempt to dip my toes into AI based tech. The below is a hopefully faithful recreation of how I did it, I really wish I documented it at the time.
Make a QNA Service in Azure
To get started, log into Azure Portal and make a Resource Group.
Add the resource QnA Maker, search market for QnA maker and create it.
Setup the KnowledgeBase
Go to https://www.qnamaker.ai/Create to begin setting up the knowledgebase, you should see your QNA resource listed that you just setup in the Azure Portal, once it has deployed.
You can populate it here by scraping pages, pdfs, text files and whatnot. You can also add some generalist conversation patterns in a predetermined guise (Witty, friendly, professional etc).
You can always create an empty one and add stuff to it later. Once setup is done, you will see all the pre loaded QnA pairs (if any) – with an option to add one. Lets do that:
Hit save and train and let’s test it out!
Lumping all Questions and Answers into one file might make things tricky to maintain later, so it’s a good idea to split topics out with different files.
So after we hit publish… Then what?
Let’s embed the bot service into a HTML page, so it can be seen by an end user and embedded into your site.
Go to your resource group and add a Web Chat Bot, you can change the settings as you wish, I chose the basic C# template bot.
Once you have your web app bot, click it and go to the channels blade in Azure Portal on the Web App Bot and some embed code will be generated for you:
Make sure to put one of the secret keys into the YOUR_SECRET_HERE part.
You now have a useable AI cognitive service for your product/ project FAQ section (for example) that you can embed.
If you expect your bot to get heavy usage you can enable Application Insights in order to extract some useful metrics from the service.
NOTE: Your first message may take awhile to process! This is because Azure is spinning up the necessary stuff after a long idle period. It is possible to set this to always on.