Sdílet prostřednictvím


Extend your healthcare agent service with Question Answering

Question answering provides cloud-based Natural Language Processing (NLP) that allows you to create a natural conversational layer over your data. It's used to find the most appropriate answer for any input from your custom knowledge base (KB) of information.

Question answering is commonly used to build conversational client applications, which include social media applications, chat bots, and speech-enabled desktop applications.

When creating a Question Answering model, you'll need a Cognitive Service for Language account. For more info on how to connect your Question Answering resource to the healthcare agent service, you can read more here

Important

This tutorial gives you a high level overview on how to create your first Question Answering project. For a full and extended tutorial you can find more info here

Create your first Question Answering project

  1. Sign in to the Language Studio with your Azure credentials.

  2. Go to Understand questions and conversational language tab and select Open custom question answering.

  3. Choose a language resource. You can select an existing Azure subscription or create a free account and then refresh. After creating select the Language resource.

Screenshot of the language studio, language resource

  1. Select Connect to Azure Search

Screenshot of the language studio, connect to azure search

  1. The knowledge base created from your content is stored in an Azure Search index in your Azure subscription, Create Azure Search.

Screenshot of the language studio, create azure search

  1. Return to the Understand questions and conversational language tab. You may need to refresh this page to register the change to your resource.

  2. Select Create a new project.

  3. Choose the option I want to set the language for all projects created in this resource, select English and hit Next.

  4. Enter the project name of Covid-19, a description of My first question answering project, and leave the default answer with a setting of No answer found.

  5. Review your choices and select Create project.

  6. From the Manage sources page, select Add source > URLS.

  7. Select Add URL : https://www.cdc.gov/coronavirus/2019-ncov/vaccines/faq.html.

Screenshot of the language studio, adding url for question answering

  1. The extraction process takes a few moments to read the document and identify questions and answers.

  2. After successfully adding the source, you can then edit the source contents to add more custom question answer sets.

Test your project

  1. Select the link to your source, this opens the edit knowledge base page.

  2. Select Test from the menu bar and Enter the question What are the risks to getting a booster? An answer will be generated based on the question answer pairs that were automatically identified and extracted from your source URL:

Screenshot of the language studio, testing model

  1. If you check the box to include a short answer response you will also see a precise answer, if available, along with the answer passage in the test pane when you ask a question.

  2. Select Inspect to examine the response in more detail. The test window is used to test your changes to your project before deploying your project.

  3. From the Inspect interface, you can see the level of confidence that this response answers the question and directly edit a given question and answer response pair.

Deploy your project

  1. Select the Deploy knowledge base icon to enter the deploy knowledge base menu.

Screenshot of the language studio, deploying model for question answering

  1. When you deploy a project, the contents of your project move from the test index to a prod index in Azure Search.

  2. Select Deploy and then when prompted select Deploy again.

Screenshot of the language studio, deployed model for question answering

  1. Your project is now successfully deployed. You can use the endpoint to answer questions in your own custom application to answer or in a bot.

  2. Select Get prediction URL save the Prediction URL

Go to your healthcare agent service

  1. Go to Language -> Models -> Add New Language Model¨

  2. Select the Question Answering method

Screenshot of the healthcare agent service linking to the Question Answer Model

  1. Copy all the Prediction URL parameters.
  • Method: Question Answering
  • Endpoint: The endpoint of your instance
  • Subscription: Your Subscription Key
  • Project Name: The name of your Question Answer Project
  • Deployment Name: The name of your deployment
  • Api Version: The Api version of your deployment.
  1. Validate question answering settings.

  2. Enter intent mapping -> covid with /builtin/questionAnswering and hit Create

  3. See your new Question answering model on Language Models page.

Screenshot of the healthcare agent service linked to the Question Answer Model

  1. Test your chat – ask the one of the questions from your Knowledge Base like: If we need a booster, are the vaccines working?

Screenshot of the healthcare agent service, verify chat message

Next steps

Language Models