Registry /
azure / azure-cognitiveservices-knowledge-qnamaker
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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.142s · 26.7MB
glibcpy 3.10–3.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)
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).
fixUpgrade 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.
fixUse 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