azure.ai.language.questionanswering.authoring.aio package

class azure.ai.language.questionanswering.authoring.aio.AuthoringClient(endpoint: str, credential: Union[azure.core.credentials.AzureKeyCredential, azure.core.credentials_async.AsyncTokenCredential], **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 https://learn.microsoft.com/azure/cognitive-services/language-service/overview

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

  • credential (AzureKeyCredential or AsyncTokenCredential) – Credential needed for the client to connect to Azure. This can be the an instance of AzureKeyCredential if using a Language API key or a token credential from azure.identity.

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.

async add_feedback(project_name: str, feedback: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any)None

Update Active Learning feedback.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/add-feedback for more information.

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

  • feedback (JSON or IO) – Feedback for Active Learning. Is either a model type or a IO type. Required.

Keyword Arguments

content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.

Returns

None

Return type

None

Raises

HttpResponseError

async begin_delete_project(project_name: str, **kwargs: Any)azure.core.polling._async_poller.AsyncLROPoller[None]

Delete the project.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/delete-project for more information.

Parameters

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

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

  • polling (bool or AsyncPollingMethod) – By default, your polling method will be AsyncLROBasePolling. 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 AsyncLROPoller that returns None

Return type

AsyncLROPoller[None]

Raises

HttpResponseError

async begin_deploy_project(project_name: str, deployment_name: str, **kwargs: Any)azure.core.polling._async_poller.AsyncLROPoller[collections.abc.MutableMapping[str, Any]]

Deploy project to production.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/deploy-project for more information.

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

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

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

  • polling (bool or AsyncPollingMethod) – By default, your polling method will be AsyncLROBasePolling. 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 AsyncLROPoller that returns JSON object

Return type

AsyncLROPoller[JSON]

Raises

HttpResponseError

Example

# response body for status code(s): 200
response == {
    "deploymentName": "str",  # Optional. Name of the deployment.
    "lastDeployedDateTime": "2020-02-20 00:00:00"  # Optional. Represents the
      project last deployment date-time.
}
async begin_export(project_name: str, *, file_format: str = 'json', asset_kind: Optional[str] = None, **kwargs: Any)azure.core.polling._async_poller.AsyncLROPoller[collections.abc.MutableMapping[str, Any]]

Export project metadata and assets.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/export for more information.

Parameters

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

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

  • asset_kind (str) – Kind of the asset of the project. Known values are: “qnas” and “synonyms”. Default value is None.

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

  • polling (bool or AsyncPollingMethod) – By default, your polling method will be AsyncLROBasePolling. 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 AsyncLROPoller that returns JSON object

Return type

AsyncLROPoller[JSON]

Raises

HttpResponseError

Example

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

Import project assets.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/import for more information.

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

  • options (JSON or IO) – Project assets the needs to be imported. Is either a model type or a IO type. Default value is None.

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

  • asset_kind (str) – Kind of the asset of the project. Known values are: “qnas” and “synonyms”. Default value is None.

  • content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.

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

  • polling (bool or AsyncPollingMethod) – By default, your polling method will be AsyncLROBasePolling. 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 AsyncLROPoller that returns JSON object

Return type

AsyncLROPoller[JSON]

Raises

HttpResponseError

Example

# response body for status code(s): 200
response == {
    "createdDateTime": "2020-02-20 00:00:00",  # Required.
    "jobId": "str",  # Required.
    "lastUpdatedDateTime": "2020-02-20 00:00:00",  # Required.
    "status": "str",  # Job Status. Required. Known values are: "notStarted",
      "running", "succeeded", "failed", "cancelled", "cancelling", and
      "partiallyCompleted".
    "errors": [
        {
            "code": "str",  # One of a server-defined set of error codes.
              Required. Known values are: "InvalidRequest", "InvalidArgument",
              "Unauthorized", "Forbidden", "NotFound", "ProjectNotFound",
              "OperationNotFound", "AzureCognitiveSearchNotFound",
              "AzureCognitiveSearchIndexNotFound", "TooManyRequests",
              "AzureCognitiveSearchThrottling",
              "AzureCognitiveSearchIndexLimitReached", "InternalServerError", and
              "ServiceUnavailable".
            "message": "str",  # A human-readable representation of the
              error. Required.
            "details": [
                ...
            ],
            "innererror": {
                "code": "str",  # One of a server-defined set of
                  error codes. Required. Known values are: "InvalidRequest",
                  "InvalidParameterValue", "KnowledgeBaseNotFound",
                  "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", and
                  "ExtractionFailure".
                "message": "str",  # Error message. Required.
                "details": {
                    "str": "str"  # Optional. Error details.
                },
                "innererror": ...,
                "target": "str"  # Optional. Error target.
            },
            "target": "str"  # Optional. The target of the error.
        }
    ],
    "expirationDateTime": "2020-02-20 00:00:00"  # Optional.
}
async begin_update_qnas(project_name: str, qnas: Union[List[collections.abc.MutableMapping[str, Any]], IO], **kwargs: Any)azure.core.polling._async_poller.AsyncLROPoller[AsyncIterable[collections.abc.MutableMapping[str, Any]]]

Updates the QnAs of a project.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/update-qnas for more information.

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

  • qnas (list[JSON] or IO) – Update QnAs parameters of a project. Is either a list type or a IO type. Required.

Keyword Arguments
  • content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.

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

  • polling (bool or AsyncPollingMethod) – By default, your polling method will be AsyncLROBasePolling. 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 an iterator like instance of JSON object

Return type

AsyncLROPoller[AsyncItemPaged[JSON]]

Raises

HttpResponseError

Example

# response body for status code(s): 200, 202
response == {
    "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 .
}
async begin_update_sources(project_name: str, sources: Union[List[collections.abc.MutableMapping[str, Any]], IO], **kwargs: Any)azure.core.polling._async_poller.AsyncLROPoller[AsyncIterable[collections.abc.MutableMapping[str, Any]]]

Updates the sources of a project.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/update-sources for more information.

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

  • sources (list[JSON] or IO) – Update sources parameters of a project. Is either a list type or a IO type. Required.

Keyword Arguments
  • content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.

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

  • polling (bool or AsyncPollingMethod) – By default, your polling method will be AsyncLROBasePolling. 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 an iterator like instance of JSON object

Return type

AsyncLROPoller[AsyncItemPaged[JSON]]

Raises

HttpResponseError

Example

# response body for status code(s): 200, 202
response == {
    "sourceKind": "str",  # Supported source types. Required. Known values are:
      "file" and "url".
    "sourceUri": "str",  # URI location for the file or url. Required.
    "contentStructureKind": "str",  # Optional. Content structure type for
      sources. "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.
}
async close()None[source]
async create_project(project_name: str, options: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any)collections.abc.MutableMapping[str, Any]

Create or update a project.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/create-project for more information.

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

  • options (JSON or IO) – Parameters needed to create the project. Is either a model type or a IO type. Required.

Keyword Arguments

content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.

Returns

JSON object

Return type

JSON

Raises

HttpResponseError

Example

# response body for status code(s): 200, 201
response == {
    "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.
    }
}
async get_project_details(project_name: str, **kwargs: Any)collections.abc.MutableMapping[str, Any]

Get the requested project metadata.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/get-project-details for more information.

Parameters

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

Returns

JSON object

Return type

JSON

Raises

HttpResponseError

Example

# response body for status code(s): 200
response == {
    "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, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any)AsyncIterable[collections.abc.MutableMapping[str, Any]]

List all deployments of a project.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/list-deployments for more information.

Parameters

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

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

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

Returns

An iterator like instance of JSON object

Return type

AsyncItemPaged[JSON]

Raises

HttpResponseError

Example

# response body for status code(s): 200
response == {
    "deploymentName": "str",  # Optional. Name of the deployment.
    "lastDeployedDateTime": "2020-02-20 00:00:00"  # Optional. Represents the
      project last deployment date-time.
}
list_projects(*, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any)AsyncIterable[collections.abc.MutableMapping[str, Any]]

Gets all projects for a user.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/list-projects for more information.

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

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

Returns

An iterator like instance of JSON object

Return type

AsyncItemPaged[JSON]

Raises

HttpResponseError

Example

# response body for status code(s): 200
response == {
    "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, *, source: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any)AsyncIterable[collections.abc.MutableMapping[str, Any]]

Gets all the QnAs of a project.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/get-qnas for more information.

Parameters

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

Keyword Arguments
  • source (str) – Source of the QnA. Default value is None.

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

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

Returns

An iterator like instance of JSON object

Return type

AsyncItemPaged[JSON]

Raises

HttpResponseError

Example

# response body for status code(s): 200
response == {
    "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, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any)AsyncIterable[collections.abc.MutableMapping[str, Any]]

Gets all the sources of a project.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/get-sources for more information.

Parameters

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

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

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

Returns

An iterator like instance of JSON object

Return type

AsyncItemPaged[JSON]

Raises

HttpResponseError

Example

# response body for status code(s): 200
response == {
    "sourceKind": "str",  # Supported source types. Required. Known values are:
      "file" and "url".
    "sourceUri": "str",  # URI location for the file or url. Required.
    "contentStructureKind": "str",  # Optional. Content structure type for
      sources. "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.
}
list_synonyms(project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any)AsyncIterable[collections.abc.MutableMapping[str, Any]]

Gets all the synonyms of a project.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/get-synonyms for more information.

Parameters

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

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

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

Returns

An iterator like instance of JSON object

Return type

AsyncItemPaged[JSON]

Raises

HttpResponseError

Example

# response body for status code(s): 200
response == {
    "alterations": [
        "str"  # Collection of word alterations. Required.
    ]
}
send_request(request: azure.core.rest._rest_py3.HttpRequest, **kwargs: Any)Awaitable[azure.core.rest._rest_py3.AsyncHttpResponse][source]

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

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

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

AsyncHttpResponse

async update_synonyms(project_name: str, synonyms: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any)None

Updates all the synonyms of a project.

See https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering-projects/update-synonyms for more information.

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

  • synonyms (JSON or IO) – All the synonyms of a project. Is either a model type or a IO type. Required.

Keyword Arguments

content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.

Returns

None

Return type

None

Raises

HttpResponseError