Share via


AuthoringClient Class

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

Constructor

AuthoringClient(endpoint: str, credential: AzureKeyCredential | TokenCredential, **kwargs: Any)

Parameters

Name Description
endpoint
Required
str

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

credential
Required

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 identity.

Keyword-Only Parameters

Name Description
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.

Methods

add_feedback

Update Active Learning feedback.

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

begin_delete_project

Delete the project.

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

begin_deploy_project

Deploy project to production.

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

begin_export

Export project metadata and assets.

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

begin_import_assets

Import project assets.

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

begin_update_qnas

Updates the QnAs of a project.

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

begin_update_sources

Updates the sources of a project.

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

close
create_project

Create or update a project.

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

get_project_details

Get the requested project metadata.

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

list_deployments

List all deployments of a project.

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

list_projects

Gets all projects for a user.

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

list_qnas

Gets all the QnAs of a project.

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

list_sources

Gets all the sources of a project.

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

list_synonyms

Gets all the synonyms of a project.

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

send_request

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 = client.send_request(request)
<HttpResponse: 200 OK>

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

update_synonyms

Updates all the synonyms of a project.

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

add_feedback

Update Active Learning feedback.

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

add_feedback(project_name: str, feedback: MutableMapping[str, Any] | IO, **kwargs: Any) -> None

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

feedback
Required
<xref:JSON> or IO

Feedback for Active Learning. Is either a model type or a IO type. Required.

Keyword-Only Parameters

Name Description
content_type
str

Body Parameter content-type. Known values are: 'application/json'. Default value is None.

Returns

Type Description

None

Exceptions

Type Description

begin_delete_project

Delete the project.

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

begin_delete_project(project_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

Keyword-Only Parameters

Name Description
continuation_token
str

A continuation token to restart a poller from a saved state.

polling

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

Type Description

An instance of LROPoller that returns None

Exceptions

Type Description

begin_deploy_project

Deploy project to production.

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

begin_deploy_project(project_name: str, deployment_name: str, **kwargs: Any) -> LROPoller[MutableMapping[str, Any]]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

deployment_name
Required
str

The name of the specific deployment of the project to use. Required.

Keyword-Only Parameters

Name Description
continuation_token
str

A continuation token to restart a poller from a saved state.

polling

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

Type Description
LROPoller[<xref:JSON>]

An instance of LROPoller that returns JSON object

Exceptions

Type Description

Examples


   # 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.
   }

begin_export

Export project metadata and assets.

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

begin_export(project_name: str, *, file_format: str = 'json', asset_kind: str | None = None, **kwargs: Any) -> LROPoller[MutableMapping[str, Any]]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

Keyword-Only Parameters

Name Description
file_format
str

Knowledge base Import or Export format. Known values are: "json", "tsv", and "excel". Default value is "json".

Default value: json
asset_kind
str

Kind of the asset of the project. Known values are: "qnas" and "synonyms". Default value is None.

Default value: None
continuation_token
str

A continuation token to restart a poller from a saved state.

polling

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

Type Description
LROPoller[<xref:JSON>]

An instance of LROPoller that returns JSON object

Exceptions

Type Description

Examples


   # 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.
   }

begin_import_assets

Import project assets.

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

begin_import_assets(project_name: str, options: MutableMapping[str, Any] | IO | None = None, *, file_format: str = 'json', asset_kind: str | None = None, **kwargs: Any) -> LROPoller[MutableMapping[str, Any]]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

options
<xref:JSON> or IO

Project assets the needs to be imported. Is either a model type or a IO type. Default value is None.

Default value: None

Keyword-Only Parameters

Name Description
file_format
str

Knowledge base Import or Export format. Known values are: "json", "tsv", and "excel". Default value is "json".

Default value: json
asset_kind
str

Kind of the asset of the project. Known values are: "qnas" and "synonyms". Default value is None.

Default value: 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

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

Type Description
LROPoller[<xref:JSON>]

An instance of LROPoller that returns JSON object

Exceptions

Type Description

Examples


   # 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.
   }

begin_update_qnas

Updates the QnAs of a project.

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

begin_update_qnas(project_name: str, qnas: List[MutableMapping[str, Any]] | IO, **kwargs: Any) -> LROPoller[Iterable[MutableMapping[str, Any]]]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

qnas
Required
list[<xref:JSON>] or IO

Update QnAs parameters of a project. Is either a list type or a IO type. Required.

Keyword-Only Parameters

Name Description
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

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

Type Description
LROPoller[ItemPaged[<xref:JSON>]]

An instance of LROPoller that returns an iterator like instance of JSON object

Exceptions

Type Description

Examples


   # 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 .
   }

begin_update_sources

Updates the sources of a project.

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

begin_update_sources(project_name: str, sources: List[MutableMapping[str, Any]] | IO, **kwargs: Any) -> LROPoller[Iterable[MutableMapping[str, Any]]]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

sources
Required
list[<xref:JSON>] or IO

Update sources parameters of a project. Is either a list type or a IO type. Required.

Keyword-Only Parameters

Name Description
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

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

Type Description
LROPoller[ItemPaged[<xref:JSON>]]

An instance of LROPoller that returns an iterator like instance of JSON object

Exceptions

Type Description

Examples


   # 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.
   }

close

close() -> None

create_project

Create or update a project.

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

create_project(project_name: str, options: MutableMapping[str, Any] | IO, **kwargs: Any) -> MutableMapping[str, Any]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

options
Required
<xref:JSON> or IO

Parameters needed to create the project. Is either a model type or a IO type. Required.

Keyword-Only Parameters

Name Description
content_type
str

Body Parameter content-type. Known values are: 'application/json'. Default value is None.

Returns

Type Description
<xref:JSON>

JSON object

Exceptions

Type Description

Examples


   # 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.
       }
   }

get_project_details

Get the requested project metadata.

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

get_project_details(project_name: str, **kwargs: Any) -> MutableMapping[str, Any]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

Returns

Type Description
<xref:JSON>

JSON object

Exceptions

Type Description

Examples


   # 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

List all deployments of a project.

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

list_deployments(project_name: str, *, top: int | None = None, skip: int | None = None, **kwargs: Any) -> Iterable[MutableMapping[str, Any]]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

Keyword-Only Parameters

Name Description
top
int

The maximum number of resources to return from the collection. Default value is None.

Default value: None
skip
int

An offset into the collection of the first resource to be returned. Default value is None.

Default value: None

Returns

Type Description
ItemPaged[<xref:JSON>]

An iterator like instance of JSON object

Exceptions

Type Description

Examples


   # 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

Gets all projects for a user.

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

list_projects(*, top: int | None = None, skip: int | None = None, **kwargs: Any) -> Iterable[MutableMapping[str, Any]]

Keyword-Only Parameters

Name Description
top
int

The maximum number of resources to return from the collection. Default value is None.

Default value: None
skip
int

An offset into the collection of the first resource to be returned. Default value is None.

Default value: None

Returns

Type Description
ItemPaged[<xref:JSON>]

An iterator like instance of JSON object

Exceptions

Type Description

Examples


   # 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

Gets all the QnAs of a project.

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

list_qnas(project_name: str, *, source: str | None = None, top: int | None = None, skip: int | None = None, **kwargs: Any) -> Iterable[MutableMapping[str, Any]]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

Keyword-Only Parameters

Name Description
source
str

Source of the QnA. Default value is None.

Default value: None
top
int

The maximum number of resources to return from the collection. Default value is None.

Default value: None
skip
int

An offset into the collection of the first resource to be returned. Default value is None.

Default value: None

Returns

Type Description
ItemPaged[<xref:JSON>]

An iterator like instance of JSON object

Exceptions

Type Description

Examples


   # 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

Gets all the sources of a project.

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

list_sources(project_name: str, *, top: int | None = None, skip: int | None = None, **kwargs: Any) -> Iterable[MutableMapping[str, Any]]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

Keyword-Only Parameters

Name Description
top
int

The maximum number of resources to return from the collection. Default value is None.

Default value: None
skip
int

An offset into the collection of the first resource to be returned. Default value is None.

Default value: None

Returns

Type Description
ItemPaged[<xref:JSON>]

An iterator like instance of JSON object

Exceptions

Type Description

Examples


   # 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

Gets all the synonyms of a project.

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

list_synonyms(project_name: str, *, top: int | None = None, skip: int | None = None, **kwargs: Any) -> Iterable[MutableMapping[str, Any]]

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

Keyword-Only Parameters

Name Description
top
int

The maximum number of resources to return from the collection. Default value is None.

Default value: None
skip
int

An offset into the collection of the first resource to be returned. Default value is None.

Default value: None

Returns

Type Description
ItemPaged[<xref:JSON>]

An iterator like instance of JSON object

Exceptions

Type Description

Examples


   # response body for status code(s): 200
   response == {
       "alterations": [
           "str"  # Collection of word alterations. Required.
       ]
   }

send_request

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 = client.send_request(request)
<HttpResponse: 200 OK>

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

send_request(request: HttpRequest, **kwargs: Any) -> HttpResponse

Parameters

Name Description
request
Required

The network request you want to make. Required.

Keyword-Only Parameters

Name Description
stream

Whether the response payload will be streamed. Defaults to False.

Returns

Type Description

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

update_synonyms

Updates all the synonyms of a project.

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

update_synonyms(project_name: str, synonyms: MutableMapping[str, Any] | IO, **kwargs: Any) -> None

Parameters

Name Description
project_name
Required
str

The name of the project to use. Required.

synonyms
Required
<xref:JSON> or IO

All the synonyms of a project. Is either a model type or a IO type. Required.

Keyword-Only Parameters

Name Description
content_type
str

Body Parameter content-type. Known values are: 'application/json'. Default value is None.

Returns

Type Description

None

Exceptions

Type Description