I
InsightNexus

azure.ai.language.questionanswering.projects package — Azure SDK for Python 2.0.0 documentation

Author

Emma Terry

Published Feb 16, 2026

class azure.ai.language.questionanswering.projects.QuestionAnsweringProjectsClient(endpoint: str, credential: AzureKeyCredential, **kwargs: Any)[source]

The language service API is a suite of natural language processing (NLP) skills built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and question answering. Further documentation can be found in <ahref="">.

Parameters
  • endpoint (str) – Supported Cognitive Services endpoint (e.g.,https://<resource-name>.api.cognitiveservices.azure.com).

  • credential (AzureKeyCredential) – Credential needed for the client to connect to Azure.

Keyword Arguments
  • api_version (str) – Api Version. The default value is “2021-10-01”. Note that overriding this default value may result in unsupported behavior.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

add_feedback(project_name: str, feedback: JSONType, **kwargs: Any)None

Update Active Learning feedback.

Update Active Learning feedback.

Parameters
  • project_name (str) – The name of the project to use.

  • feedback (JSONType) – Feedback for Active Learning.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

Example

# JSON input template you can fill out and use as your body input.feedback = { "records": [ { "qnaId": 0, # Optional. Unique ID of the QnA. "userId": "str", # Optional. Unique identifier of the user. "userQuestion": "str" # Optional. User suggested question for the QnA. } ]}
begin_delete_project(project_name: str, **kwargs: Any)LROPoller[None]

Delete the project.

Delete the project.

Parameters

project_name (str) – The name of the project to use.

Keyword Arguments
  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – By default, your polling method will be LROBasePolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

An instance of LROPoller that returns None

Return type

LROPoller[None]

Raises

~azure.core.exceptions.HttpResponseError

begin_deploy_project(project_name: str, deployment_name: str, **kwargs: Any)LROPoller[None]

Deploy project to production.

Deploy project to production.

Parameters
  • project_name (str) – The name of the project to use.

  • deployment_name (str) – The name of the specific deployment of the project to use.

Keyword Arguments
  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – By default, your polling method will be LROBasePolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

An instance of LROPoller that returns None

Return type

LROPoller[None]

Raises

~azure.core.exceptions.HttpResponseError

begin_export(project_name: str, **kwargs: Any)LROPoller[JSONType]

Export project metadata and assets.

Export project metadata and assets.

Parameters

project_name (str) – The name of the project to use.

Keyword Arguments
  • format (str) – Knowledge base Import or Export format. Possible values are: “json”, “tsv”, and “excel”.

  • asset_kind (str) – Kind of the asset of the project. Possible values are: “qnas” or “synonyms”.

  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – By default, your polling method will be LROBasePolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

An instance of LROPoller that returns JSON object

Return type

LROPoller[JSONType]

Raises

~azure.core.exceptions.HttpResponseError

Example

# response body for status code(s): 200response.json() == { "createdDateTime": "2020-02-20 00:00:00", # Required. "errors": [ { "code": "str", # Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound", "ProjectNotFound", "OperationNotFound", "AzureCognitiveSearchNotFound", "AzureCognitiveSearchIndexNotFound", "TooManyRequests", "AzureCognitiveSearchThrottling", "AzureCognitiveSearchIndexLimitReached", "InternalServerError", "ServiceUnavailable". "details": [ ... ], "innererror": { "code": "str", # Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidParameterValue", "KnowledgeBaseNotFound", "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", "ExtractionFailure". "details": { "str": "str" # Optional. Error details. }, "innererror": ..., "message": "str", # Required. Error message. "target": "str" # Optional. Error target. }, "message": "str", # Required. A human-readable representation of the error. "target": "str" # Optional. The target of the error. } ], "expirationDateTime": "2020-02-20 00:00:00", # Optional. "jobId": "str", # Required. "lastUpdatedDateTime": "2020-02-20 00:00:00", # Required. "resultUrl": "str", # Required. URL to download the result of the Export Job. "status": "str" # Required. Job Status. Possible values include: "notStarted", "running", "succeeded", "failed", "cancelled", "cancelling", "partiallyCompleted".}
begin_import_assets(project_name: str, options: JSONType = None, **kwargs: Any)LROPoller[None]

Import project assets.

Import project assets.

Parameters
  • project_name (str) – The name of the project to use.

  • options (JSONType) – Project assets the needs to be imported.

Keyword Arguments
  • format (str) – Knowledge base Import or Export format. Possible values are: “json”, “tsv”, and “excel”.

  • asset_kind (str) – Kind of the asset of the project. Possible values are: “qnas” or “synonyms”.

  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – By default, your polling method will be LROBasePolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

An instance of LROPoller that returns None

Return type

LROPoller[None]

Raises

~azure.core.exceptions.HttpResponseError

Example

# JSON input template you can fill out and use as your body input.options = { "assets": { "qnas": [ { "activeLearningSuggestions": [ { "clusterHead": "str", # Optional. Question chosen as the head of suggested questions cluster by Active Learning clustering algorithm. "suggestedQuestions": [ { "autoSuggestedCount": 0, # Optional. The number of times the question was suggested automatically by the Active Learning algorithm. "question": "str", # Optional. Question suggested by the Active Learning feature. "userSuggestedCount": 0 # Optional. The number of times the question was suggested explicitly by the user. } ] } ], "answer": "str", # Optional. Answer text. "dialog": { "isContextOnly": bool, # Optional. To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as answer for queries without context; otherwise, ignores context and includes this QnA in answers. "prompts": [ { "displayOrder": 0, # Optional. Index of the prompt. It is used for ordering of the prompts. "displayText": "str", # Optional. Text displayed to represent a follow up question prompt. "qna": {"activeLearningSuggestions": [ {"clusterHead": "str", # Optional. Question chosen as the head of suggested questions cluster by Active Learning clustering algorithm."suggestedQuestions": [{"autoSuggestedCount": 0, # Optional. The number of times the question was suggested automatically by the Active Learning algorithm."question": "str", # Optional. Question suggested by the Active Learning feature."userSuggestedCount": 0 # Optional. The number of times the question was suggested explicitly by the user.} ] } ], "answer": "str", # Optional. Answer text. "dialog": ..., "id": 0, # Optional. Unique ID for the QnA. "metadata": { "str": "str" # Optional. Metadata associated with the answer, useful to categorize or filter question answers. }, "questions": [ "str" # Optional. List of questions associated with the answer. ], "source": "str" # Optional. Source from which QnA was indexed e.g. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . }, "qnaId": 0 # Optional. ID of the QnA corresponding to the prompt. } ] }, "id": 0, # Optional. Unique ID for the QnA. "lastUpdatedDateTime": "2020-02-20 00:00:00", # Optional. Date-time when the QnA was last updated. "metadata": { "str": "str" # Optional. Metadata associated with the answer, useful to categorize or filter question answers. }, "questions": [ "str" # Optional. List of questions associated with the answer. ], "source": "str", # Optional. Source from which QnA was indexed e.g. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . "sourceDisplayName": "str" # Optional. Friendly name of the Source. } ], "synonyms": [ { "alterations": [ "str" # Required. Collection of word alterations. ] } ] }, "fileUri": "str", # Optional. Import data File URI. "metadata": { "description": "str", # Optional. Description of the project. "language": "str", # Required. Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. "multilingualResource": bool, # Optional. Set to true to enable creating knowledgebases in different languages for the same resource. "settings": { "defaultAnswer": "str" # Optional. Default Answer response when no good match is found in the knowledge base. } }}
begin_update_qnas(project_name: str, qnas: List[JSONType], **kwargs: Any)LROPoller[None]

Updates the QnAs of a project.

Updates the QnAs of a project.

Parameters
  • project_name (str) – The name of the project to use.

  • qnas (list[JSONType]) – Update QnAs parameters of a project.

Keyword Arguments
  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – By default, your polling method will be LROBasePolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

An instance of LROPoller that returns None

Return type

LROPoller[None]

Raises

~azure.core.exceptions.HttpResponseError

Example

# JSON input template you can fill out and use as your body input.qnas = [ { "op": "str", # Required. Update operation type for assets. Possible values include: "add", "delete", "replace". "value": { "activeLearningSuggestions": [ { "clusterHead": "str", # Optional. Question chosen as the head of suggested questions cluster by Active Learning clustering algorithm. "suggestedQuestions": [ { "autoSuggestedCount": 0, # Optional. The number of times the question was suggested automatically by the Active Learning algorithm. "question": "str", # Optional. Question suggested by the Active Learning feature. "userSuggestedCount": 0 # Optional. The number of times the question was suggested explicitly by the user. } ] } ], "answer": "str", # Optional. Answer text. "dialog": { "isContextOnly": bool, # Optional. To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as answer for queries without context; otherwise, ignores context and includes this QnA in answers. "prompts": [ { "displayOrder": 0, # Optional. Index of the prompt. It is used for ordering of the prompts. "displayText": "str", # Optional. Text displayed to represent a follow up question prompt. "qna": ..., "qnaId": 0 # Optional. ID of the QnA corresponding to the prompt. } ] }, "id": 0, # Optional. Unique ID for the QnA. "metadata": { "str": "str" # Optional. Metadata associated with the answer, useful to categorize or filter question answers. }, "questions": [ "str" # Optional. List of questions associated with the answer. ], "source": "str" # Optional. Source from which QnA was indexed e.g. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . } }]
begin_update_sources(project_name: str, sources: List[JSONType], **kwargs: Any)LROPoller[None]

Updates the sources of a project.

Updates the sources of a project.

Parameters
  • project_name (str) – The name of the project to use.

  • sources (list[JSONType]) – Update sources parameters of a project.

Keyword Arguments
  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – By default, your polling method will be LROBasePolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

An instance of LROPoller that returns None

Return type

LROPoller[None]

Raises

~azure.core.exceptions.HttpResponseError

Example

# JSON input template you can fill out and use as your body input.sources = [ { "op": "str", # Required. Update operation type for assets. Possible values include: "add", "delete", "replace". "value": { "contentStructureKind": "unstructured", # Optional. Default value is "unstructured". Content structure type for sources. Possible values include: "unstructured". "displayName": "str", # Optional. Friendly name of the Source. "refresh": bool, # Optional. Boolean flag used to refresh data from the Source. "source": "str", # Optional. Unique source identifier. Name of the file if it's a 'file' source; otherwise, the complete URL if it's a 'url' source. "sourceKind": "str", # Required. Supported source types. Possible values include: "file", "url". "sourceUri": "str" # Required. URI location for the file or url. } }]
close()None[source]
create_project(project_name: str, options: JSONType, **kwargs: Any)JSONType

Create or update a project.

Create or update a project.

Parameters
  • project_name (str) – The name of the project to use.

  • options (JSONType) – Parameters needed to create the project.

Returns

JSON object

Return type

JSONType

Raises

~azure.core.exceptions.HttpResponseError

Example

# JSON input template you can fill out and use as your body input.options = { "description": "str", # Optional. Description of the project. "language": "str", # Required. Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. "multilingualResource": bool, # Optional. Set to true to enable creating knowledgebases in different languages for the same resource. "settings": { "defaultAnswer": "str" # Optional. Default Answer response when no good match is found in the knowledge base. }}# response body for status code(s): 200, 201response.json() == { "createdDateTime": "2020-02-20 00:00:00", # Optional. Project creation date-time. "description": "str", # Optional. Description of the project. "language": "str", # Optional. Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. "lastDeployedDateTime": "2020-02-20 00:00:00", # Optional. Represents the project last deployment date-time. "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. Represents the project last modified date-time. "multilingualResource": bool, # Optional. Resource enabled for multiple languages across projects or not. "projectName": "str", # Optional. Name of the project. "settings": { "defaultAnswer": "str" # Optional. Default Answer response when no good match is found in the knowledge base. }}
get_project_details(project_name: str, **kwargs: Any)JSONType

Get the requested project metadata.

Get the requested project metadata.

Parameters

project_name (str) – The name of the project to use.

Returns

JSON object

Return type

JSONType

Raises

~azure.core.exceptions.HttpResponseError

Example

# response body for status code(s): 200response.json() == { "createdDateTime": "2020-02-20 00:00:00", # Optional. Project creation date-time. "description": "str", # Optional. Description of the project. "language": "str", # Optional. Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. "lastDeployedDateTime": "2020-02-20 00:00:00", # Optional. Represents the project last deployment date-time. "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. Represents the project last modified date-time. "multilingualResource": bool, # Optional. Resource enabled for multiple languages across projects or not. "projectName": "str", # Optional. Name of the project. "settings": { "defaultAnswer": "str" # Optional. Default Answer response when no good match is found in the knowledge base. }}
list_deployments(project_name: str, **kwargs: Any)Iterable[JSONType]

List all deployments of a project.

List all deployments of a project.

Parameters

project_name (str) – The name of the project to use.

Keyword Arguments
  • top (int) – The maximum number of resources to return from the collection.

  • skip (int) – An offset into the collection of the first resource to be returned.

  • maxpagesize (int) – The maximum number of resources to include in a single response.

Returns

An iterator like instance of JSON object

Return type

ItemPaged[JSONType]

Raises

~azure.core.exceptions.HttpResponseError

Example

# response body for status code(s): 200response.json() == { "nextLink": "str", # Optional. "value": [ { "deploymentName": "str", # Optional. Name of the deployment. "lastDeployedDateTime": "2020-02-20 00:00:00" # Optional. Represents the project last deployment date-time. } ]}
list_projects(**kwargs: Any)Iterable[JSONType]

Gets all projects for a user.

Gets all projects for a user.

Keyword Arguments
  • top (int) – The maximum number of resources to return from the collection.

  • skip (int) – An offset into the collection of the first resource to be returned.

  • maxpagesize (int) – The maximum number of resources to include in a single response.

Returns

An iterator like instance of JSON object

Return type

ItemPaged[JSONType]

Raises

~azure.core.exceptions.HttpResponseError

Example

# response body for status code(s): 200response.json() == { "nextLink": "str", # Optional. "value": [ { "createdDateTime": "2020-02-20 00:00:00", # Optional. Project creation date-time. "description": "str", # Optional. Description of the project. "language": "str", # Optional. Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. "lastDeployedDateTime": "2020-02-20 00:00:00", # Optional. Represents the project last deployment date-time. "lastModifiedDateTime": "2020-02-20 00:00:00", # Optional. Represents the project last modified date-time. "multilingualResource": bool, # Optional. Resource enabled for multiple languages across projects or not. "projectName": "str", # Optional. Name of the project. "settings": { "defaultAnswer": "str" # Optional. Default Answer response when no good match is found in the knowledge base. } } ]}
list_qnas(project_name: str, **kwargs: Any)Iterable[JSONType]

Gets all the QnAs of a project.

Gets all the QnAs of a project.

Parameters

project_name (str) – The name of the project to use.

Keyword Arguments
  • source (str) – Source of the QnA.

  • top (int) – The maximum number of resources to return from the collection.

  • skip (int) – An offset into the collection of the first resource to be returned.

  • maxpagesize (int) – The maximum number of resources to include in a single response.

Returns

An iterator like instance of JSON object

Return type

ItemPaged[JSONType]

Raises

~azure.core.exceptions.HttpResponseError

Example

# response body for status code(s): 200response.json() == { "nextLink": "str", # Optional. "value": [ { "activeLearningSuggestions": [ { "clusterHead": "str", # Optional. Question chosen as the head of suggested questions cluster by Active Learning clustering algorithm. "suggestedQuestions": [ { "autoSuggestedCount": 0, # Optional. The number of times the question was suggested automatically by the Active Learning algorithm. "question": "str", # Optional. Question suggested by the Active Learning feature. "userSuggestedCount": 0 # Optional. The number of times the question was suggested explicitly by the user. } ] } ], "answer": "str", # Optional. Answer text. "dialog": { "isContextOnly": bool, # Optional. To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as answer for queries without context; otherwise, ignores context and includes this QnA in answers. "prompts": [ { "displayOrder": 0, # Optional. Index of the prompt. It is used for ordering of the prompts. "displayText": "str", # Optional. Text displayed to represent a follow up question prompt. "qna": { "activeLearningSuggestions": [ {"clusterHead": "str", # Optional. Question chosen as the head of suggested questions cluster by Active Learning clustering algorithm."suggestedQuestions": [ {"autoSuggestedCount": 0, # Optional. The number of times the question was suggested automatically by the Active Learning algorithm."question": "str", # Optional. Question suggested by the Active Learning feature."userSuggestedCount": 0 # Optional. The number of times the question was suggested explicitly by the user. } ] } ], "answer": "str", # Optional. Answer text. "dialog": ..., "id": 0, # Optional. Unique ID for the QnA. "metadata": { "str": "str" # Optional. Metadata associated with the answer, useful to categorize or filter question answers. }, "questions": [ "str" # Optional. List of questions associated with the answer. ], "source": "str" # Optional. Source from which QnA was indexed e.g. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . }, "qnaId": 0 # Optional. ID of the QnA corresponding to the prompt. } ] }, "id": 0, # Optional. Unique ID for the QnA. "lastUpdatedDateTime": "2020-02-20 00:00:00", # Optional. Date-time when the QnA was last updated. "metadata": { "str": "str" # Optional. Metadata associated with the answer, useful to categorize or filter question answers. }, "questions": [ "str" # Optional. List of questions associated with the answer. ], "source": "str" # Optional. Source from which QnA was indexed e.g. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . } ]}
list_sources(project_name: str, **kwargs: Any)Iterable[JSONType]

Gets all the sources of a project.

Gets all the sources of a project.

Parameters

project_name (str) – The name of the project to use.

Keyword Arguments
  • top (int) – The maximum number of resources to return from the collection.

  • skip (int) – An offset into the collection of the first resource to be returned.

  • maxpagesize (int) – The maximum number of resources to include in a single response.

Returns

An iterator like instance of JSON object

Return type

ItemPaged[JSONType]

Raises

~azure.core.exceptions.HttpResponseError

Example

# response body for status code(s): 200response.json() == { "nextLink": "str", # Optional. "value": [ { "contentStructureKind": "unstructured", # Optional. Default value is "unstructured". Content structure type for sources. Possible values include: "unstructured". "displayName": "str", # Optional. Friendly name of the Source. "lastUpdatedDateTime": "2020-02-20 00:00:00", # Optional. Date-time when the QnA was last updated. "source": "str", # Optional. Unique source identifier. Name of the file if it's a 'file' source; otherwise, the complete URL if it's a 'url' source. "sourceKind": "str", # Required. Supported source types. Possible values include: "file", "url". "sourceUri": "str" # Required. URI location for the file or url. } ]}
list_synonyms(project_name: str, **kwargs: Any)Iterable[JSONType]

Gets all the synonyms of a project.

Gets all the synonyms of a project.

Parameters

project_name (str) – The name of the project to use.

Keyword Arguments
  • top (int) – The maximum number of resources to return from the collection.

  • skip (int) – An offset into the collection of the first resource to be returned.

  • maxpagesize (int) – The maximum number of resources to include in a single response.

Returns

An iterator like instance of JSON object

Return type

ItemPaged[JSONType]

Raises

~azure.core.exceptions.HttpResponseError

Example

# response body for status code(s): 200response.json() == { "nextLink": "str", # Optional. "value": [ { "alterations": [ "str" # Required. Collection of word alterations. ] } ]}
send_request(request: HttpRequest, **kwargs: Any)HttpResponse[source]

Runs the network request through the client’s chained policies.

>>> from azure.core.rest import HttpRequest>>> request = HttpRequest("GET", "")<HttpRequest [GET], url: '>>> response = client.send_request(request)<HttpResponse: 200 OK>

For more information on this code flow, see

Parameters

request (HttpRequest) – The network request you want to make. Required.

Keyword Arguments

stream (bool) – Whether the response payload will be streamed. Defaults to False.

Returns

The response of your network call. Does not do error handling on your response.

Return type

HttpResponse

update_synonyms(project_name: str, synonyms: JSONType, **kwargs: Any)None

Updates all the synonyms of a project.

Updates all the synonyms of a project.

Parameters
  • project_name (str) – The name of the project to use.

  • synonyms (JSONType) – All the synonyms of a project.

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

Example

# JSON input template you can fill out and use as your body input.synonyms = { "nextLink": "str", # Optional. "value": [ { "alterations": [ "str" # Required. Collection of word alterations. ] } ]}

Subpackages¶