QnA Maker Reference
Azure QnA Maker is a cloud-based service that uses machine learning to build a sophisticated question-and-answer knowledge base from your product or service content.
Key Concepts
Knowledge Base
A knowledge base is a collection of question-and-answer pairs. QnA Maker can extract structured and unstructured content from various sources to create a knowledge base. Supported sources include:
- URLs of web pages (e.g., FAQs, product manuals)
- Files (e.g., PDF, DOC, TXT)
- Chit-chat data
- Existing knowledge bases
Question-Answer Pairs
Each item in the knowledge base is a question-and-answer pair. You can define multiple ways to ask the same question to improve the accuracy of responses. Each pair can also have optional metadata for filtering and routing.
Active Learning
QnA Maker uses active learning to suggest potential improvements to your knowledge base. This helps you maintain a high-quality and accurate set of answers.
APIs and SDKs
QnA Maker provides robust APIs and SDKs to integrate its functionality into your applications. The primary APIs include:
- REST API: For managing knowledge bases, querying for answers, and training models.
- SDKs: Available for popular programming languages like Python, .NET, and Java.
REST API Endpoints
Some common REST API endpoints include:
POST /knowledgebases/create: To create a new knowledge base.POST /knowledgebases/{knowledgeBaseId}/query: To get an answer to a question.PUT /knowledgebases/{knowledgeBaseId}: To update a knowledge base.
Example: Querying for an Answer
Here's a conceptual example of how you might query QnA Maker using its REST API:
POST https://{your-endpoint-hostname}/qnamaker/v5.0/knowledgebases/{knowledgeBaseId}/query
Content-Type: application/json
{
"question": "What is Azure?",
"top": 3,
"scoreThreshold": 0.2,
"context": {
"promptSuggestions": true,
"િસ્: [optional_previous_turn_context]
}
}
Important Note
QnA Maker is transitioning to Azure Cognitive Service for Language's Custom question answering feature. While QnA Maker is still supported, we recommend exploring the new capabilities within the Azure AI Language service for future development.
Learn about Custom question answeringGetting Started
To get started with QnA Maker:
- Create a QnA Maker Resource: In the Azure portal, create a QnA Maker resource and associate it with an Azure Cognitive Search resource.
- Create a Knowledge Base: Use the QnA Maker portal or the REST API to create your first knowledge base from your content sources.
- Test and Publish: Test your knowledge base to ensure accuracy and then publish it to make it available for consumption.
- Integrate: Integrate the published knowledge base into your applications using the SDKs or REST APIs.