Registry / azure / azure-cognitiveservices-knowledge-qnamaker

azure-cognitiveservices-knowledge-qnamaker

JSON →
library0.3.1pypypi✓ verified 84d ago

Microsoft Azure QnA Maker Client Library for Python enables programmatic management of QnA Maker knowledge bases and endpoints. Current version 0.3.1 is stable but in maintenance mode; Azure recommends migrating to the newer question answering service via azure-ai-language-questionanswering. Release cadence is low.

pip install azure-cognitiveservices-knowledge-qnamaker
INSTALL
IMPORT
SIG · AZURE-COGNITIVESER
A
azure-cognitiveservices-knowledge-qnamaker
azurepythonv0.3.1
Install
2.9s avg
Import
1078ms
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.142s · 26.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.9s · import 1.014s · 27MB
25MB installed
● package 25MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QnAMakerClient
from azure.cognitiveservices.knowledge.qnamaker import QnAMakerClient
from azure.cognitiveservices.knowledge.qnamaker.qn_amaker_client import QnAMakerClient
Wrong path: QnAMakerClient is directly under the package, not a submodule.
QnAMakerRuntimeClient
from azure.cognitiveservices.knowledge.qnamaker.runtime import QnAMakerRuntimeClient
from azure.cognitiveservices.knowledge.qnamaker import QnAMakerRuntimeClient
Runtime client is in a separate 'runtime' subpackage.
models
from azure.cognitiveservices.knowledge.qnamaker import models

Authenticate and list QnA Maker knowledge bases.

import os from azure.cognitiveservices.knowledge.qnamaker import QnAMakerClient from azure.cognitiveservices.knowledge.qnamaker.models import QnADTO from msrest.authentication import CognitiveServicesCredentials subscription_key = os.environ.get('QNAMAKER_SUBSCRIPTION_KEY', '') endpoint = os.environ.get('QNAMAKER_ENDPOINT', 'https://<your-resource-name>.cognitiveservices.azure.com') credentials = CognitiveServicesCredentials(subscription_key) client = QnAMakerClient(endpoint, credentials) # List all knowledge bases kbs = client.knowledgebase.list() for kb in kbs.knowledgebases: print(kb.name, kb.id)
Debug
Known issues
deprecatedQnA Maker service is being retired. Azure recommends using the newer question answering service via the 'azure-ai-language-questionanswering' package.
fix
Migrate to azure-ai-language-questionanswering (pip install azure-ai-language-questionanswering)
affects: all
gotchaThe runtime client (QnAMakerRuntimeClient) is imported from a different subpackage ('runtime') than the management client.
fix
Use 'from azure.cognitiveservices.knowledge.qnamaker.runtime import QnAMakerRuntimeClient' for runtime operations.
affects: all
breakingIn version 0.3.0, the 'QnAMakerClient' constructor changed: 'endpoint' is now required and the 'base_url' parameter was removed.
fix
Pass 'endpoint' as first argument: QnAMakerClient(endpoint, credentials).
affects: 0.3.0+
Errors
Common errors & fixes
ImportError: cannot import name 'QnAMakerClient' from 'azure.cognitiveservices.knowledge.qnamaker'
Often caused by incomplete installation or using a very old version (pre-0.2.0).
fix
Upgrade to the latest: pip install --upgrade azure-cognitiveservices-knowledge-qnamaker
AttributeError: 'QnAMakerClient' object has no attribute 'knowledgebase'
Using the runtime client instead of the management client. The runtime client does not have knowledgebase operations.
fix
Use QnAMakerClient (not QnAMakerRuntimeClient) for knowledge base management.
Upgrade
Version history
0.3.1latest on PyPI · released Aug 14, 2024
Audit
Dependencies
msrestrequiredRequired for REST client operations
azure-commonrequiredCommon Azure SDK utilities
Agent activity
39 hits · last 30 days
node
32
OpenAI (training)
1
Resources
azure-cognitiveservices-knowledge-qnamaker — pip install azure-cognitiveservices-knowledge-qnamaker · libregistry