{"id":26764,"library":"azure-ai-language-questionanswering","title":"Azure AI Language Question Answering","description":"Microsoft Azure Question Answering client library for Python, enabling extraction of answers from custom knowledge bases or FAQ data. Version 1.1.0 supports both custom and prebuilt question answering, with synchronous and asynchronous clients. Released monthly as part of Azure SDK.","status":"active","version":"1.1.0","language":"python","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-python","tags":["azure","question-answering","nlp","qna-maker","cognitive-services"],"install":[{"cmd":"pip install azure-ai-language-questionanswering","lang":"bash","label":"Install"}],"dependencies":[{"reason":"HTTP pipeline and authentication","package":"azure-core","optional":false},{"reason":"DefaultAzureCredential for auth","package":"azure-identity","optional":true}],"imports":[{"note":"Client class is in the top-level module, not models","wrong":"from azure.ai.language.questionanswering.models import QuestionAnsweringClient","symbol":"QuestionAnsweringClient","correct":"from azure.ai.language.questionanswering import QuestionAnsweringClient"},{"note":"Model classes are under .models","wrong":"from azure.ai.language.questionanswering import AnswersFromTextOptions","symbol":"AnswersFromTextOptions","correct":"from azure.ai.language.questionanswering.models import AnswersFromTextOptions"},{"note":"","wrong":"","symbol":"AnswersOptions","correct":"from azure.ai.language.questionanswering.models import AnswersOptions"}],"quickstart":{"code":"import os\nfrom azure.ai.language.questionanswering import QuestionAnsweringClient\nfrom azure.core.credentials import AzureKeyCredential\n\nendpoint = os.environ.get('AZURE_QA_ENDPOINT', '')\ncredential = AzureKeyCredential(os.environ.get('AZURE_QA_KEY', ''))\nclient = QuestionAnsweringClient(endpoint, credential)\n\nresponse = client.get_answers(\n    question=\"What is a good pet?\",\n    project_name=\"SampleProject\",\n    deployment_name=\"production\"\n)\nif response.answers:\n    print(response.answers[0].answer)","lang":"python","description":"Authenticate using endpoint and key, then query a knowledge base."},"warnings":[{"fix":"Update calls to use new parameter names.","message":"In version 1.1.0, the `get_answers` method signature changed: `top` parameter renamed to `top_answers` and `confidence_threshold` renamed to `confidence_score_threshold`.","severity":"breaking","affected_versions":"<1.1.0 -> 1.1.0"},{"fix":"Use `AnswersFromTextOptions` model to pass text documents.","message":"The `text_documents` parameter in `get_answers_from_text` is deprecated in favor of `text_documents` as part of `AnswersFromTextOptions`.","severity":"deprecated","affected_versions":"<=1.1.0"},{"fix":"Ensure both parameters are provided when querying a project.","message":"Both `project_name` and `deployment_name` are required for custom QnA (non-text queries). Missing them results in a ResourceNotFound error.","severity":"gotcha","affected_versions":"all"},{"fix":"Import `TextDocument` from models and wrap strings: `from azure.ai.language.questionanswering.models import TextDocument`.","message":"When using `get_answers_from_text`, the `text_documents` parameter expects a list of `TextDocument` objects, not raw strings.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Upgrade to version 1.1.0 and use `get_answers` method.","cause":"Using an older version of the library (<1.0.0) where method was `query_knowledgebase`","error":"AttributeError: 'QuestionAnsweringClient' object has no attribute 'get_answers'"},{"fix":"Ensure both parameters are provided and match exactly the names in Azure AI Language resource.","cause":"`project_name` or `deployment_name` missing or incorrect","error":"azure.core.exceptions.ResourceNotFoundError: (NotFound) The specified project does not exist."},{"fix":"Replace `top` with `top_answers` in the call.","cause":"Using `top` parameter which was renamed to `top_answers` in version 1.1.0","error":"TypeError: get_answers() got an unexpected keyword argument 'top'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}