Azure-Samples / search-qna-maker-accelerator

Cognitive Search Question Answering Solution Accelerator
Other
36 stars 16 forks source link

Cognitive Search Question Answering Solution Accelerator

An integrated search solution leveraging Azure Cognitive Search and QnA Maker to provide instant answers to common questions. Learn more about the repo in this blog post.

Screenshot of sample web app

Features

This solution accelerator leverages the power of Azure Cognitive Search together with QnA Maker to find answers to your questions in a similar way to how Bing and Google suggest relevant answers to queries.

Ordinarily, Azure Cognitive Search returns the most relevant documents for your search query but together with QnA Maker integration, it can not only find the most relevant documents but also pull questions and answers out of the document and suggest the most relevant answers. During Cognitive Search data ingestion, a custom skill sends the document to QnA Maker for processing.

Please note that not all documents support the question/answer format required by QnA Maker. By default, the logic in the Search service indexer also ingests only the following file types: .pdf,.docx,.doc,.xlsx,.xls,.html,.rtf,.txt,.tsv. You can change this by modifying the indexedFileNameExtensions property in the Indexer.json.

This solution accelerator contains the following artifacts:

Cognitive Search QnA Maker Solution Architecture

Demo

You can view a live demo of this repo at the following link:

https://qna-ui-i3iohrgwgujpo.azurewebsites.net/

Getting Started

Prerequisites

1. Deploy Resources

The services and components needed for the solution are packaged in the repo's ARM template. Click the Deploy to Azure button to get started:

Deploy to Azure

If you want to use the latest version of QnA Maker: QnA Maker managed (currently in public preview) which includes new features such as precise answering, click the Deploy to Azure button given below:

Deploy to Azure QnA Maker Managed

The following resources will be deployed:

  1. Azure Cognitive Search
  2. QnA Maker Cognitive Service (this will always be deployed to the West US region, but your data is not stored here - see here)
  3. Azure App Service, App Service Plan
  4. Azure App Service, Website for Qna Maker
  5. Azure App Service, Website to host the UI
  6. Storage Account
  7. Azure Function App
  8. Cognitive Services All-in-one resource
  9. Application Insights

The deployment may take several minutes. Once the deployment finishes, navigate over to the Outputs tab:

Deployment screenshot

Copy the value of the HTTP Trigger. You'll use this value in the next step.

URL to copy

2. Initialize the solution

Open up a new browser tab and paste the URL into the browser. This will run for about a minute and then you'll see a message indicating success or failure.

Initialize solution accelerator

3. Upload documents

Navigate to the storage account in the resource group you just created. Find the container named qna-container and upload your documents into the container.

Sample documents are available in the SampleDocuments folder.


NOTE: if you would prefer to pull data from a different, pre-existing blob storage account, you may instead change the data source in your Search service to point to a container in a different blob storage account. Just change the connection string and container name in the data source in the Search service.


4. Go to the UI

As part of the ARM template, a UI is deployed to https://{prefix}-ui-{randomString}.azurewebsites.net similar to the screenshot below. Keep in mind it will take a few minutes for the documents to become available in the search index after adding them to storage.

Screenshot of sample web app


NOTE: At this point, you should consider adding authentication to the web app in the Azure portal to secure your data.


The UI is a React-based Web App available in the SearchUI folder. Navigate to SearchUI/README.md for more details on the web app.

Frequently Asked Questions (FAQ)

How is this solution utilizing QnaMaker different from the new semantic search functionality in Cognitive Search?

The semantic search question answering does have a functional overlap with this solution accelerator using QnA Maker. Here's what you need to know.

However, the two options are not mutually exclusive and can be used together. The recommendation to customers is to use the QnA Maker solution for the head queries (high precision, curated), and fallback to the semantic search QnA when there is no good match in QnA Maker. Specifically:

Disclaimer

This repo has been tested with document sets as big as 2,000 documents. If you have a larger dataset or run into any issues with this repo, please open an issue and we will get back to you.

Resources

Legal