Create your own Covid-19 assistant with Azure Q&A maker
Who can be vaccinated now? How many confirmed cases of Covid-19 are there in France and around the world? What measures should employers take to protect the health of their employees? Can the employer monitor the activity of teleworking employees? What solutions for childcare and vulnerable people? What help is there for students in difficulty? Faced with the epidemic, you have many questions. False information is circulating. Where can you find official answers to your questions about daily life, curfews, health, the health situation, work, housing, travel, education and transport? Service-Public.fr has compiled the frequently asked questions and answers on government sites for you.
However, looking through them all may represent a certain challenge to some of us. Moreover, on the 19th of may the gouvernment will soften the measure, thus we need to be attentive even more than before. Fortunately, we've got our friend AI with us, so let's use for good.
In this article we will try to create a chat bot who will reply to all our questions concerning the last gouvernmental measure with (almost) no code. And a bonus : we'll be able to use the resource right in the end of the article : the bot is fully functional. Up we go!
What is Azure QnA Maker?
QnA Maker is a Natural Language Processing (NLP) cloud service that helps you to overlay your data with a natural conversational layer. It's used to find the best response from your personalized knowledge base (KB) of information with every feedback.
Conversational client applications, such as social media apps, chat bots, and speech-enabled desktop apps, are typically built with QnA Maker. Customer information is not stored by QnA Creator. The area in which the customer deploys the contingent service instances stores all customer data (question answers and chatlogs).
Where to take the info from?
For this tutorial we've used the FAQ provided by the Ministry of National Affairs. However, you can use multiple sources. The only thing to mention is that a knowledge base consists of question and answer pairs brought in by public URLs and files. Content is brought into a knowledge base from a data source. Data source locations are public URLs or files, which do not require authentication. Please refer to this page to get the allowed data formats.
Create your QnA Maker knowledge base
For this part we will refer to the official documentation.
Sign in to the QnAMaker.ai portal with your Azure credentials.
In the QnA Maker portal, select Create a knowledge base.
On the Create page, skip Step 1 if you already have your QnA Maker resource. If you haven't created the resource yet, select Create a QnA service. You are directed to the Azure portal to set up a QnA Maker service in your subscription. Remember your Azure Active Directory ID, Subscription, QnA resource name you selected when you created the resource. When you are done creating the resource in the Azure portal, return to the QnA Maker portal, refresh the browser page, and continue to Step 2.
In Step 2, select your Active directory, subscription, service (resource), and the language for all knowledge bases created in the service.
n Step 3, name your knowledge base My Sample QnA KB.
In Step 4, configure the settings:
Enable multi-turn extraction from URLs, .pdf or .docx files. : Checked
Multi-turn default text: Select an option
+ Add URL
Chit-chat: Select Professional
In Step 5, Select Create your KB.
Reading the text and identifying questions and responses takes a few moments during the extraction process. The Knowledge base page appears after QnA Maker has effectively created the knowledge base. On this tab, you can make changes to the knowledge base's contents.
After the Knowledge Base is created you need to to Save and Train your chatbot and finally Publish it. After publishing the knowledge base the portal promts you to create a bot. You select the language (Node.js or C#) and voilà, you've got your bot up and running.
The source code is available here. If for any reason you have not succeeded to create your own bot service, don't worry, you can use mine, that's alright:
Let's give our bot a try. Enter the following question:
Quels sont les justificatifs à fournir pour se déplacer entre 21h et 6h dans les territoires soumis au couvre-feu ?
And the answer of the bot is:
And this correct!
To test the service, here's the code snippet you can embed in your application
<iframe src='https://webchat.botframework.com/embed/covidqanda?s=HQ0RDQ5pXfI._x_1rrH8-vZQMByQbB1RJIoix2P1Xsa5CMXzOjJY6eY' style='min-width: 400px; width: 100%; min-height: 500px;'> </iframe>
Hope this was useful!