From 985f0df4d42cba87a2fec27efccc1f5bed45fc03 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 22 Jun 2022 16:26:12 -0700 Subject: [PATCH 1/8] add aad support, docs, samples, tests --- .../CHANGELOG.md | 1 + .../azure-ai-language-conversations/README.md | 38 ++++++++++++ .../ai/language/conversations/_client.py | 7 ++- .../language/conversations/_configuration.py | 16 +++-- .../azure/ai/language/conversations/_patch.py | 55 ++++++++++++++++++ .../ai/language/conversations/aio/_client.py | 9 +-- .../conversations/aio/_configuration.py | 16 +++-- .../ai/language/conversations/aio/_patch.py | 58 +++++++++++++++++++ .../conversations/authoring/_client.py | 7 ++- .../conversations/authoring/_configuration.py | 16 +++-- .../conversations/authoring/_patch.py | 54 ++++++++++++++++- .../conversations/authoring/aio/_client.py | 7 ++- .../authoring/aio/_configuration.py | 16 +++-- .../conversations/authoring/aio/_patch.py | 57 +++++++++++++++++- .../async/sample_authentication_async.py | 18 +++++- .../samples/sample_authentication.py | 20 ++++++- .../swagger/README.md | 3 +- .../async/test_conversation_app_async.py | 48 +++++++++++++++ .../tests/test_conversation_app.py | 48 +++++++++++++++ 19 files changed, 448 insertions(+), 46 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md index afe7789bb6a3..26a690eae17a 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md @@ -13,6 +13,7 @@ ## 1.0.0 (Unreleased) ### Features Added +* AAD authentication support * Added more resolution types for entities * Added support for authoring operations with `ConversationAuthoringClient` under the `azure.ai.language.conversations.authoring` namespace. diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md index fe7445d33d2c..ca59c96526ee 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md @@ -67,6 +67,36 @@ credential = AzureKeyCredential("") client = ConversationAuthoringClient(endpoint, credential) ``` +#### Create a client with an Azure Active Directory Credential + +To use an [Azure Active Directory (AAD) token credential][cognitive_authentication_aad], +provide an instance of the desired credential type obtained from the +[azure-identity][azure_identity_credentials] library. +Note that regional endpoints do not support AAD authentication. Create a [custom subdomain][custom_subdomain] +name for your resource in order to use this type of authentication. + +Authentication with AAD requires some initial setup: + +- [Install azure-identity][install_azure_identity] +- [Register a new AAD application][register_aad_app] +- [Grant access][grant_role_access] to the Language service by assigning the `"Cognitive Services User"` role to your service principal. + +After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. +As an example, [DefaultAzureCredential][default_azure_credential] +can be used to authenticate the client: + +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: +AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET + +Use the returned token credential to authenticate the client: + +```python +from azure.ai.textanalytics import ConversationAnalysisClient +from azure.identity import DefaultAzureCredential + +credential = DefaultAzureCredential() +client = ConversationAnalysisClient(endpoint="https://.cognitiveservices.azure.com/", credential=credential) +``` ## Key concepts @@ -358,4 +388,12 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [conversationauthoring_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-conversations/latest/azure.ai.language.conversations.html#azure.ai.language.conversations.ConversationAuthoringClient [azure_core_exceptions]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md [azure_language_portal]: https://language.cognitive.azure.com/home +[cognitive_authentication_aad]: https://docs.microsoft.com/azure/cognitive-services/authentication#authenticate-with-azure-active-directory +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials +[custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain +[install_azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#install-the-package +[register_aad_app]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal +[grant_role_access]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal +[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential + ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftemplate%2Fazure-template%2FREADME.png) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_client.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_client.py index 215509c3dfbf..f263c7ed9fe5 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_client.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_client.py @@ -10,7 +10,6 @@ from typing import Any, TYPE_CHECKING from azure.core import PipelineClient -from azure.core.credentials import AzureKeyCredential from azure.core.rest import HttpRequest, HttpResponse from ._configuration import ConversationAnalysisClientConfiguration @@ -21,6 +20,8 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict + from azure.core.credentials import TokenCredential + class ConversationAnalysisClient( ConversationAnalysisClientOperationsMixin @@ -40,13 +41,13 @@ class ConversationAnalysisClient( https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: _endpoint = "{Endpoint}/language" self._config = ConversationAnalysisClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_configuration.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_configuration.py index 9cf0aecd54a9..11796b51befe 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_configuration.py @@ -6,14 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration -from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies from ._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + class ConversationAnalysisClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ConversationAnalysisClient. @@ -25,13 +28,13 @@ class ConversationAnalysisClientConfiguration(Configuration): # pylint: disable https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: super(ConversationAnalysisClientConfiguration, self).__init__(**kwargs) api_version = kwargs.pop("api_version", "2022-05-01") # type: str @@ -43,6 +46,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) self.endpoint = endpoint self.credential = credential self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "ai-language-conversations/{}".format(VERSION)) self._configure(**kwargs) @@ -60,6 +64,6 @@ def _configure( self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AzureKeyCredentialPolicy( - self.credential, "Ocp-Apim-Subscription-Key", **kwargs + self.authentication_policy = policies.BearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_patch.py index f99e77fef986..0e9370da6c7c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_patch.py @@ -27,5 +27,60 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + +from typing import List, Union, Any +from azure.core.credentials import AzureKeyCredential, TokenCredential +from azure.core.pipeline.policies import AzureKeyCredentialPolicy +from ._client import ConversationAnalysisClient as GeneratedConversationAnalysisClient + + +def _authentication_policy(credential): + authentication_policy = None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if isinstance(credential, AzureKeyCredential): + authentication_policy = AzureKeyCredentialPolicy( + name="Ocp-Apim-Subscription-Key", credential=credential + ) + elif credential is not None and not hasattr(credential, "get_token"): + raise TypeError( + "Unsupported credential: {}. Use an instance of AzureKeyCredential " + "or a token credential from azure.identity".format(type(credential)) + ) + return authentication_policy + + +class ConversationAnalysisClient(GeneratedConversationAnalysisClient): # pylint: disable=client-accepts-api-version-keyword + """The language service conversations API is a suite of natural language processing (NLP) skills + that can be used to analyze structured conversations (textual or spoken). The synchronous API + in this suite accepts a request and mediates among multiple language projects, such as LUIS + Generally Available, Question Answering, Conversational Language Understanding, and then calls + the best candidate service to handle the request. At last, it returns a response with the + candidate service's response as a payload. + + :param endpoint: Supported Cognitive Services endpoint (e.g., + https://:code:``.cognitiveservices.azure.com). Required. + :type endpoint: str + :param credential: 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 :mod:`azure.identity`. + :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, TokenCredential], **kwargs: Any) -> None: + super().__init__( + endpoint=endpoint, + credential=credential, + authentication_policy=kwargs.pop("authentication_policy", _authentication_policy(credential)), + **kwargs + ) + + +__all__: List[str] = ["ConversationAnalysisClient"] + + def patch_sdk(): pass diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_client.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_client.py index f38d55c6b1eb..56d1bc39f334 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_client.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_client.py @@ -10,7 +10,6 @@ from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient -from azure.core.credentials import AzureKeyCredential from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer @@ -21,6 +20,8 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict + from azure.core.credentials_async import AsyncTokenCredential + class ConversationAnalysisClient( ConversationAnalysisClientOperationsMixin @@ -32,7 +33,7 @@ class ConversationAnalysisClient( the best candidate service to handle the request. At last, it returns a response with the candidate service's response as a payload. - In some cases, this API needs to forward requests and responses between the caller and an + In some cases, this API needs to forward requests and responses between the caller and an upstream service. The asynchronous APIs in this suite enable tasks like Conversation Summarization and Conversational PII detection. @@ -40,13 +41,13 @@ class ConversationAnalysisClient( https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: _endpoint = "{Endpoint}/language" self._config = ConversationAnalysisClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_configuration.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_configuration.py index de7d11c03f0a..9039d9b3f87e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_configuration.py @@ -6,14 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration -from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies from .._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class ConversationAnalysisClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ConversationAnalysisClient. @@ -25,13 +28,13 @@ class ConversationAnalysisClientConfiguration(Configuration): # pylint: disable https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(ConversationAnalysisClientConfiguration, self).__init__(**kwargs) api_version = kwargs.pop("api_version", "2022-05-01") # type: str @@ -43,6 +46,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) self.endpoint = endpoint self.credential = credential self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "ai-language-conversations/{}".format(VERSION)) self._configure(**kwargs) @@ -57,6 +61,6 @@ def _configure(self, **kwargs: Any) -> None: self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AzureKeyCredentialPolicy( - self.credential, "Ocp-Apim-Subscription-Key", **kwargs + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_patch.py index f99e77fef986..8f0bc1962e94 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_patch.py @@ -27,5 +27,63 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + +from typing import List, Union, Any +from azure.core.credentials import AzureKeyCredential +from azure.core.credentials_async import AsyncTokenCredential +from azure.core.pipeline.policies import AzureKeyCredentialPolicy +from ._client import ConversationAnalysisClient as GeneratedConversationAnalysisClient + + +def _authentication_policy(credential): + authentication_policy = None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if isinstance(credential, AzureKeyCredential): + authentication_policy = AzureKeyCredentialPolicy( + name="Ocp-Apim-Subscription-Key", credential=credential + ) + elif credential is not None and not hasattr(credential, "get_token"): + raise TypeError( + "Unsupported credential: {}. Use an instance of AzureKeyCredential " + "or a token credential from azure.identity".format(type(credential)) + ) + return authentication_policy + + +class ConversationAnalysisClient(GeneratedConversationAnalysisClient): # pylint: disable=client-accepts-api-version-keyword + """The language service conversations API is a suite of natural language processing (NLP) skills + that can be used to analyze structured conversations (textual or spoken). The synchronous API + in this suite accepts a request and mediates among multiple language projects, such as LUIS + Generally Available, Question Answering, Conversational Language Understanding, and then calls + the best candidate service to handle the request. At last, it returns a response with the + candidate service's response as a payload. + + :param endpoint: Supported Cognitive Services endpoint (e.g., + https://:code:``.cognitiveservices.azure.com). Required. + :type endpoint: str + :param credential: 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 :mod:`azure.identity`. + :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, endpoint: str, credential: Union[AzureKeyCredential, AsyncTokenCredential], **kwargs: Any + ) -> None: + super().__init__( + endpoint=endpoint, + credential=credential, + authentication_policy=kwargs.pop("authentication_policy", _authentication_policy(credential)), + **kwargs + ) + + +__all__: List[str] = ["ConversationAnalysisClient"] + + def patch_sdk(): pass diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_client.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_client.py index 9ef213b45b8e..542fc9a09ac2 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_client.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_client.py @@ -10,7 +10,6 @@ from typing import Any, TYPE_CHECKING from azure.core import PipelineClient -from azure.core.credentials import AzureKeyCredential from azure.core.rest import HttpRequest, HttpResponse from ._configuration import ConversationAuthoringClientConfiguration @@ -21,6 +20,8 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict + from azure.core.credentials import TokenCredential + class ConversationAuthoringClient( ConversationAuthoringClientOperationsMixin @@ -35,7 +36,7 @@ class ConversationAuthoringClient( https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -43,7 +44,7 @@ class ConversationAuthoringClient( Retry-After header is present. """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: _endpoint = "{Endpoint}/language" self._config = ConversationAuthoringClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_configuration.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_configuration.py index 7e13b1178905..3e7b104f4881 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_configuration.py @@ -6,14 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration -from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies from ._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + class ConversationAuthoringClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ConversationAuthoringClient. @@ -25,13 +28,13 @@ class ConversationAuthoringClientConfiguration(Configuration): # pylint: disabl https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential + :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: super(ConversationAuthoringClientConfiguration, self).__init__(**kwargs) api_version = kwargs.pop("api_version", "2022-05-01") # type: str @@ -43,6 +46,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) self.endpoint = endpoint self.credential = credential self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "ai-language-conversations/{}".format(VERSION)) self._configure(**kwargs) @@ -60,6 +64,6 @@ def _configure( self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AzureKeyCredentialPolicy( - self.credential, "Ocp-Apim-Subscription-Key", **kwargs + self.authentication_policy = policies.BearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_patch.py index f7dd32510333..096e41764eb2 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_patch.py @@ -6,9 +6,59 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List +from typing import List, Union, Any +from azure.core.credentials import AzureKeyCredential, TokenCredential +from azure.core.pipeline.policies import AzureKeyCredentialPolicy +from ._client import ConversationAuthoringClient as GeneratedConversationAuthoringClient -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def _authentication_policy(credential): + authentication_policy = None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if isinstance(credential, AzureKeyCredential): + authentication_policy = AzureKeyCredentialPolicy( + name="Ocp-Apim-Subscription-Key", credential=credential + ) + elif credential is not None and not hasattr(credential, "get_token"): + raise TypeError( + "Unsupported credential: {}. Use an instance of AzureKeyCredential " + "or a token credential from azure.identity".format(type(credential)) + ) + return authentication_policy + + +class ConversationAuthoringClient(GeneratedConversationAuthoringClient): # pylint: disable=client-accepts-api-version-keyword + """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://docs.microsoft.com/en-us/azure/cognitive-services/language-service/overview. + + :param endpoint: Supported Cognitive Services endpoint (e.g., + https://:code:``.cognitiveservices.azure.com). Required. + :type endpoint: str + :param credential: 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 :mod:`azure.identity`. + :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, TokenCredential], **kwargs: Any) -> None: + super().__init__( + endpoint=endpoint, + credential=credential, + authentication_policy=kwargs.pop("authentication_policy", _authentication_policy(credential)), + **kwargs + ) + + +__all__: List[str] = ["ConversationAuthoringClient"] def patch_sdk(): diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_client.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_client.py index 2cc96d634792..7c572cf273f6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_client.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_client.py @@ -10,7 +10,6 @@ from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient -from azure.core.credentials import AzureKeyCredential from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer @@ -21,6 +20,8 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict + from azure.core.credentials_async import AsyncTokenCredential + class ConversationAuthoringClient( ConversationAuthoringClientOperationsMixin @@ -35,7 +36,7 @@ class ConversationAuthoringClient( https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str @@ -43,7 +44,7 @@ class ConversationAuthoringClient( Retry-After header is present. """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: _endpoint = "{Endpoint}/language" self._config = ConversationAuthoringClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_configuration.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_configuration.py index 2206b4607a58..1b5b5a3b8e8d 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_configuration.py @@ -6,14 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration -from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies from .._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class ConversationAuthoringClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ConversationAuthoringClient. @@ -25,13 +28,13 @@ class ConversationAuthoringClientConfiguration(Configuration): # pylint: disabl https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.AzureKeyCredential + :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(ConversationAuthoringClientConfiguration, self).__init__(**kwargs) api_version = kwargs.pop("api_version", "2022-05-01") # type: str @@ -43,6 +46,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) self.endpoint = endpoint self.credential = credential self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "ai-language-conversations/{}".format(VERSION)) self._configure(**kwargs) @@ -57,6 +61,6 @@ def _configure(self, **kwargs: Any) -> None: self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AzureKeyCredentialPolicy( - self.credential, "Ocp-Apim-Subscription-Key", **kwargs + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy( + self.credential, *self.credential_scopes, **kwargs ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_patch.py index f7dd32510333..5d4f461e3ac6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_patch.py @@ -6,9 +6,62 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List +from typing import List, Union, Any +from azure.core.credentials import AzureKeyCredential +from azure.core.credentials_async import AsyncTokenCredential +from azure.core.pipeline.policies import AzureKeyCredentialPolicy +from ._client import ConversationAuthoringClient as GeneratedConversationAuthoringClient -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def _authentication_policy(credential): + authentication_policy = None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if isinstance(credential, AzureKeyCredential): + authentication_policy = AzureKeyCredentialPolicy( + name="Ocp-Apim-Subscription-Key", credential=credential + ) + elif credential is not None and not hasattr(credential, "get_token"): + raise TypeError( + "Unsupported credential: {}. Use an instance of AzureKeyCredential " + "or a token credential from azure.identity".format(type(credential)) + ) + return authentication_policy + + +class ConversationAuthoringClient(GeneratedConversationAuthoringClient): # pylint: disable=client-accepts-api-version-keyword + """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://docs.microsoft.com/en-us/azure/cognitive-services/language-service/overview. + + :param endpoint: Supported Cognitive Services endpoint (e.g., + https://:code:``.cognitiveservices.azure.com). Required. + :type endpoint: str + :param credential: 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 :mod:`azure.identity`. + :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, endpoint: str, credential: Union[AzureKeyCredential, AsyncTokenCredential], **kwargs: Any + ) -> None: + super().__init__( + endpoint=endpoint, + credential=credential, + authentication_policy=kwargs.pop("authentication_policy", _authentication_policy(credential)), + **kwargs + ) + + +__all__: List[str] = ["ConversationAuthoringClient"] def patch_sdk(): diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_authentication_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_authentication_async.py index 15652abaaead..17412d8823c6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_authentication_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_authentication_async.py @@ -10,7 +10,8 @@ DESCRIPTION: This sample demonstrates how to authenticate to the Conversational Language Understanding service. - We authenticate using an AzureKeyCredential from azure.core.credentials. + We authenticate using an AzureKeyCredential from azure.core.credentials or a token credential from the + azure-identity client library. See more details about authentication here: https://docs.microsoft.com/azure/cognitive-services/authentication @@ -42,8 +43,23 @@ async def sample_authentication_api_key_async(): # [END create_clu_client_with_key_async] +async def sample_authentication_with_azure_active_directory(): + """DefaultAzureCredential will use the values from these environment + variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET + """ + print("\n.. authentication_with_azure_active_directory") + from azure.ai.language.conversations.aio import ConversationAnalysisClient + from azure.identity.aio import DefaultAzureCredential + + endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"] + credential = DefaultAzureCredential() + + clu_client = ConversationAnalysisClient(endpoint, credential=credential) + + async def main(): await sample_authentication_api_key_async() + await sample_authentication_with_azure_active_directory() if __name__ == '__main__': loop = asyncio.get_event_loop() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_authentication.py b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_authentication.py index 132bab214f5b..510453368721 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_authentication.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/samples/sample_authentication.py @@ -11,7 +11,8 @@ DESCRIPTION: This sample demonstrates how to authenticate to the Conversational Language Understanding service. - We authenticate using an AzureKeyCredential from azure.core.credentials. + We authenticate using an AzureKeyCredential from azure.core.credentials or a token credential from the + azure-identity client library. See more details about authentication here: https://docs.microsoft.com/azure/cognitive-services/authentication @@ -35,12 +36,27 @@ def sample_authentication_api_key(): from azure.core.credentials import AzureKeyCredential from azure.ai.language.conversations import ConversationAnalysisClient - endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"] key = os.environ["AZURE_CONVERSATIONS_KEY"] clu_client = ConversationAnalysisClient(endpoint, AzureKeyCredential(key)) # [END create_clu_client_with_key] + +def sample_authentication_with_azure_active_directory(): + """DefaultAzureCredential will use the values from these environment + variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET + """ + print("\n.. authentication_with_azure_active_directory") + from azure.ai.language.conversations import ConversationAnalysisClient + from azure.identity import DefaultAzureCredential + + endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"] + credential = DefaultAzureCredential() + + clu_client = ConversationAnalysisClient(endpoint, credential=credential) + + if __name__ == '__main__': sample_authentication_api_key() + sample_authentication_with_azure_active_directory() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/swagger/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/swagger/README.md index f05153d6de69..76c8d7a3570b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/swagger/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/swagger/README.md @@ -31,8 +31,7 @@ openapi-type: data-plane version-tolerant: true package-version: 1.0.0 add-credential: true -credential-default-policy-type: AzureKeyCredentialPolicy -credential-key-header-name: Ocp-Apim-Subscription-Key +credential-scopes: https://cognitiveservices.azure.com/.default black: true modelerfour: lenient-model-deduplication: true diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/async/test_conversation_app_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/async/test_conversation_app_async.py index ac4ee401e22f..6dbe4630c416 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/async/test_conversation_app_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/async/test_conversation_app_async.py @@ -63,3 +63,51 @@ async def test_conversation_app(self, endpoint, key, conv_project_name, conv_dep assert result["result"]["prediction"]["entities"][0]["category"] == 'Contact' assert result["result"]["prediction"]["entities"][0]["text"] == 'Carol' assert result["result"]["prediction"]["entities"][0]["confidenceScore"] > 0 + + @pytest.mark.live_test_only + @GlobalConversationAccountPreparer() + async def test_conversation_app_aad_auth(self, endpoint, conv_project_name, conv_deployment_name): + token = self.get_credential(ConversationAnalysisClient, is_async=True) + client = ConversationAnalysisClient(endpoint, token) + async with client: + query = "Send an email to Carol about the tomorrow's demo" + result = await client.analyze_conversation( + task={ + "kind": "Conversation", + "analysisInput": { + "conversationItem": { + "participantId": "1", + "id": "1", + "modality": "text", + "language": "en", + "text": query + }, + "isLoggingEnabled": False + }, + "parameters": { + "projectName": conv_project_name, + "deploymentName": conv_deployment_name, + "verbose": True + } + } + ) + + # assert - main object + assert not result is None + assert result["kind"] == "ConversationResult" + + # assert - prediction type + assert result["result"]["query"] == query + assert result["result"]["prediction"]["projectKind"] == 'Conversation' + + # assert - top intent + assert result["result"]["prediction"]["topIntent"] == 'Setup' + assert len(result["result"]["prediction"]["intents"]) > 0 + assert result["result"]["prediction"]["intents"][0]["category"] == 'Setup' + assert result["result"]["prediction"]["intents"][0]["confidenceScore"] > 0 + + # assert - entities + assert len(result["result"]["prediction"]["entities"]) > 0 + assert result["result"]["prediction"]["entities"][0]["category"] == 'Contact' + assert result["result"]["prediction"]["entities"][0]["text"] == 'Carol' + assert result["result"]["prediction"]["entities"][0]["confidenceScore"] > 0 \ No newline at end of file diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conversation_app.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conversation_app.py index 296734f806bb..c1724dd3653b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conversation_app.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conversation_app.py @@ -63,3 +63,51 @@ def test_conversation_app(self, endpoint, key, conv_project_name, conv_deploymen assert result["result"]["prediction"]["entities"][0]["category"] == 'Contact' assert result["result"]["prediction"]["entities"][0]["text"] == 'Carol' assert result["result"]["prediction"]["entities"][0]["confidenceScore"] > 0 + + @pytest.mark.live_test_only + @GlobalConversationAccountPreparer() + def test_conversation_app_aad_auth(self, endpoint, key, conv_project_name, conv_deployment_name): + token = self.get_credential(ConversationAnalysisClient) + client = ConversationAnalysisClient(endpoint, token) + with client: + query = "Send an email to Carol about the tomorrow's demo" + result = client.analyze_conversation( + task={ + "kind": "Conversation", + "analysisInput": { + "conversationItem": { + "participantId": "1", + "id": "1", + "modality": "text", + "language": "en", + "text": query + }, + "isLoggingEnabled": False + }, + "parameters": { + "projectName": conv_project_name, + "deploymentName": conv_deployment_name, + "verbose": True + } + } + ) + + # assert - main object + assert not result is None + assert result["kind"] == "ConversationResult" + + # assert - prediction type + assert result["result"]["query"] == query + assert result["result"]["prediction"]["projectKind"] == 'Conversation' + + # assert - top intent + assert result["result"]["prediction"]["topIntent"] == 'Setup' + assert len(result["result"]["prediction"]["intents"]) > 0 + assert result["result"]["prediction"]["intents"][0]["category"] == 'Setup' + assert result["result"]["prediction"]["intents"][0]["confidenceScore"] > 0 + + # assert - entities + assert len(result["result"]["prediction"]["entities"]) > 0 + assert result["result"]["prediction"]["entities"][0]["category"] == 'Contact' + assert result["result"]["prediction"]["entities"][0]["text"] == 'Carol' + assert result["result"]["prediction"]["entities"][0]["confidenceScore"] > 0 From 3a067ece82aafaa628491702f92341c253e7fbdb Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 23 Jun 2022 12:46:31 -0700 Subject: [PATCH 2/8] add aad test for authoring --- .../tests/async/test_authoring_async.py | 24 +++++++++++++++++ .../tests/test_authoring.py | 26 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations/tests/async/test_authoring_async.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_authoring.py diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/async/test_authoring_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/async/test_authoring_async.py new file mode 100644 index 000000000000..d681f4e474a2 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/async/test_authoring_async.py @@ -0,0 +1,24 @@ +# coding=utf-8 +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +import pytest + +from testcase import ( + ConversationTest, + GlobalConversationAccountPreparer +) +from azure.ai.language.conversations.authoring.aio import ConversationAuthoringClient + +class TestConversationAuthoringAsync(ConversationTest): + + @pytest.mark.live_test_only + @GlobalConversationAccountPreparer() + async def test_authoring_aad(self, endpoint): + token = self.get_credential(ConversationAuthoringClient, is_async=True) + client = ConversationAuthoringClient(endpoint, token) + entities = client.list_supported_prebuilt_entities(language="en") + async for entity in entities: + assert entity diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_authoring.py b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_authoring.py new file mode 100644 index 000000000000..e149e99f93b6 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_authoring.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +import pytest + +from azure.core.exceptions import HttpResponseError, ClientAuthenticationError +from azure.core.credentials import AzureKeyCredential +from testcase import ( + ConversationTest, + GlobalConversationAccountPreparer +) +from azure.ai.language.conversations.authoring import ConversationAuthoringClient + +class TestConversationAuthoring(ConversationTest): + + @pytest.mark.live_test_only + @GlobalConversationAccountPreparer() + def test_authoring_aad(self, endpoint, key, conv_project_name, conv_deployment_name): + token = self.get_credential(ConversationAuthoringClient) + client = ConversationAuthoringClient(endpoint, token) + entities = client.list_supported_prebuilt_entities(language="en") + for entity in entities: + assert entity From 5d68bec71704d259a2f3e7a26d4e862a0f8a7853 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 23 Jun 2022 13:31:18 -0700 Subject: [PATCH 3/8] feedback --- .../azure-ai-language-conversations/CHANGELOG.md | 2 +- .../azure-ai-language-conversations/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md index 26a690eae17a..77db106c0a55 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md @@ -13,7 +13,7 @@ ## 1.0.0 (Unreleased) ### Features Added -* AAD authentication support +* Added Azure Active Directory (AAD) authentication support * Added more resolution types for entities * Added support for authoring operations with `ConversationAuthoringClient` under the `azure.ai.language.conversations.authoring` namespace. diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md index ca59c96526ee..d012ee4ee71a 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md @@ -79,14 +79,14 @@ Authentication with AAD requires some initial setup: - [Install azure-identity][install_azure_identity] - [Register a new AAD application][register_aad_app] -- [Grant access][grant_role_access] to the Language service by assigning the `"Cognitive Services User"` role to your service principal. +- [Grant access][grant_role_access] to the Language service by assigning the "Cognitive Services User" role to your service principal. After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client: Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: -AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET +`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` Use the returned token credential to authenticate the client: From a57db391c71c329fa59bec3722dfc9a9d5509aff Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 23 Jun 2022 18:22:17 -0700 Subject: [PATCH 4/8] update docstrings to have rest api links --- .../CHANGELOG.md | 2 +- .../conversations/_operations/_patch.py | 5 +- .../azure/ai/language/conversations/_patch.py | 3 + .../conversations/aio/_operations/_patch.py | 3 + .../ai/language/conversations/aio/_patch.py | 3 + .../authoring/_operations/_patch.py | 1514 ++++++++++++++++- .../conversations/authoring/_patch.py | 3 + .../authoring/aio/_operations/_patch.py | 1477 +++++++++++++++- .../conversations/authoring/aio/_patch.py | 3 + 9 files changed, 2977 insertions(+), 36 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md index 77db106c0a55..27df0c1385e7 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/CHANGELOG.md @@ -10,7 +10,7 @@ * Client now uses python dictionaries for method parameters and results instead of classes. * Many input and result parameter name changes in `analyze_conversation()` method -## 1.0.0 (Unreleased) +## 1.0.0 (2022-06-27) ### Features Added * Added Azure Active Directory (AAD) authentication support diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_operations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_operations/_patch.py index 95aa5faa6fd9..2107d1a319df 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_operations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_operations/_patch.py @@ -12,7 +12,10 @@ ConversationAnalysisClientOperationsMixinGenerated.analyze_conversation.__doc__ = \ """Analyzes the input conversation utterance. - + + See https://docs.microsoft.com/rest/api/language/conversation-analysis-runtime/analyze-conversation + for more information. + :param task: A single conversational task to execute. Is either a model type or a IO type. Required. :type task: JSON or IO diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_patch.py index 0e9370da6c7c..3154f8334295 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/_patch.py @@ -58,6 +58,9 @@ class ConversationAnalysisClient(GeneratedConversationAnalysisClient): # pylint: the best candidate service to handle the request. At last, it returns a response with the candidate service's response as a payload. + See https://docs.microsoft.com/rest/api/language/conversation-analysis-runtime/ for more information about + requests and responses you can pass to this client. + :param endpoint: Supported Cognitive Services endpoint (e.g., https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_operations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_operations/_patch.py index 69b44ab22905..3bc737bf7619 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_operations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_operations/_patch.py @@ -13,6 +13,9 @@ ConversationAnalysisClientOperationsMixinGenerated.analyze_conversation.__doc__ = \ """Analyzes the input conversation utterance. + See https://docs.microsoft.com/rest/api/language/conversation-analysis-runtime/analyze-conversation + for more information. + :param task: A single conversational task to execute. Is either a model type or a IO type. Required. :type task: JSON or IO diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_patch.py index 8f0bc1962e94..afa748c6178f 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/aio/_patch.py @@ -59,6 +59,9 @@ class ConversationAnalysisClient(GeneratedConversationAnalysisClient): # pylint: the best candidate service to handle the request. At last, it returns a response with the candidate service's response as a payload. + See https://docs.microsoft.com/rest/api/language/conversation-analysis-runtime/ for more information about + requests and responses you can pass to this client. + :param endpoint: Supported Cognitive Services endpoint (e.g., https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_operations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_operations/_patch.py index fe9e6234e3ae..ed03213e35cf 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_operations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_operations/_patch.py @@ -10,8 +10,58 @@ from ._operations import ConversationAuthoringClientOperationsMixin as ConversationAuthoringClientOperationsMixinGenerated +ConversationAuthoringClientOperationsMixinGenerated.list_projects.__doc__ = \ + """Lists the existing projects. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-projects + for more information. + + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # Represents the project creation + datetime. Required. + "description": "str", # Optional. The project description. + "language": "str", # The project language. This is BCP-47 representation of + a language. For example, use "en" for English, "en-gb" for English (UK), "es" for + Spanish etc. Required. + "lastDeployedDateTime": "2020-02-20 00:00:00", # Optional. Represents the + project last deployed datetime. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Represents the project + creation datetime. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # Optional. Represents the + project last trained datetime. + "multilingual": bool, # Optional. Whether the project would be used for + multiple languages or not. + "projectKind": "str", # Represents the project kind. Required. Known values + are: "Conversation" and "Orchestration". + "projectName": "str", # The new project name. Required. + "settings": { + "confidenceThreshold": 0.0 # The threshold of the intent with the + highest confidence, at which the prediction will automatically be changed to + "None". Required. + } + } + """ + + ConversationAuthoringClientOperationsMixinGenerated.create_project.__doc__ = \ """Creates a new project or updates an existing one. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/create-project + for more information. :param project_name: The name of the project to use. Required. :type project_name: str @@ -72,9 +122,222 @@ } """ + +ConversationAuthoringClientOperationsMixinGenerated.get_project.__doc__ = \ + """Gets the details of a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-project for + more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # Represents the project creation + datetime. Required. + "description": "str", # Optional. The project description. + "language": "str", # The project language. This is BCP-47 representation of + a language. For example, use "en" for English, "en-gb" for English (UK), "es" for + Spanish etc. Required. + "lastDeployedDateTime": "2020-02-20 00:00:00", # Optional. Represents the + project last deployed datetime. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Represents the project + creation datetime. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # Optional. Represents the + project last trained datetime. + "multilingual": bool, # Optional. Whether the project would be used for + multiple languages or not. + "projectKind": "str", # Represents the project kind. Required. Known values + are: "Conversation" and "Orchestration". + "projectName": "str", # The new project name. Required. + "settings": { + "confidenceThreshold": 0.0 # The threshold of the intent with the + highest confidence, at which the prediction will automatically be changed to + "None". Required. + } + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.begin_delete_project.__doc__ = \ + """Deletes a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/delete-project + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns JSON object + :rtype: ~azure.core.polling.LROPoller[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.begin_export_project.__doc__ = \ + """Triggers a job to export a project's data. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/export for more + information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :keyword string_index_type: Specifies the method used to interpret string offsets. For + additional information see https://aka.ms/text-analytics-offsets. "Utf16CodeUnit" Required. + :paramtype string_index_type: str + :keyword exported_project_format: The format of the exported project file to use. Known values + are: "Conversation" and "Luis". Default value is None. + :paramtype exported_project_format: str + :keyword asset_kind: Kind of asset to export. Default value is None. + :paramtype asset_kind: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns JSON object + :rtype: ~azure.core.polling.LROPoller[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "resultUrl": "str", # Optional. The URL to use in order to download the + exported project. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + + ConversationAuthoringClientOperationsMixinGenerated.begin_import_project.__doc__ = \ """Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/import for more + information. :param project_name: The name of the project to use. Required. :type project_name: str @@ -183,7 +446,10 @@ ConversationAuthoringClientOperationsMixinGenerated.begin_train.__doc__ = \ """Triggers a training job for a project. - + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/train for more + information. + :param project_name: The name of the project to use. Required. :type project_name: str :param configuration: The training input parameters. Is either a model type or a IO type. @@ -316,35 +582,74 @@ } """ -ConversationAuthoringClientOperationsMixinGenerated.begin_swap_deployments.__doc__ = \ - """Swaps two existing deployments with each other. - +ConversationAuthoringClientOperationsMixinGenerated.list_deployments.__doc__ = \ + """Lists the deployments belonging to a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-deployments + for more information. + :param project_name: The name of the project to use. Required. :type project_name: str - :param deployments: The job object to swap two deployments. Is either a model type or a IO - type. Required. - :type deployments: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword 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. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns JSON object - :rtype: ~azure.core.polling.LROPoller[JSON] + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[JSON] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - - # JSON input template you can fill out and use as your body input. - deployments = { - "firstDeploymentName": "str", # Represents the first deployment name. - Required. + + # response body for status code(s): 200 + response == { + "deploymentExpirationDate": "2020-02-20", # Represents deployment expiration + date in the runtime. Required. + "deploymentName": "str", # Represents deployment name. Required. + "lastDeployedDateTime": "2020-02-20 00:00:00", # Represents deployment last + deployed time. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # Represents deployment last + trained time. Required. + "modelId": "str", # Represents deployment modelId. Required. + "modelTrainingConfigVersion": "str" # Represents model training config + version. Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.begin_swap_deployments.__doc__ = \ + """Swaps two existing deployments with each other. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/swap-deployments + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param deployments: The job object to swap two deployments. Is either a model type or a IO + type. Required. + :type deployments: JSON or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns JSON object + :rtype: ~azure.core.polling.LROPoller[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + deployments = { + "firstDeploymentName": "str", # Represents the first deployment name. + Required. "secondDeploymentName": "str" # Represents the second deployment name. Required. } @@ -405,9 +710,44 @@ } """ +ConversationAuthoringClientOperationsMixinGenerated.get_deployment.__doc__ = \ + """Gets the details of a deployment. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-deployment + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param deployment_name: The name of the specific deployment of the project to use. Required. + :type deployment_name: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deploymentExpirationDate": "2020-02-20", # Represents deployment expiration + date in the runtime. Required. + "deploymentName": "str", # Represents deployment name. Required. + "lastDeployedDateTime": "2020-02-20 00:00:00", # Represents deployment last + deployed time. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # Represents deployment last + trained time. Required. + "modelId": "str", # Represents deployment modelId. Required. + "modelTrainingConfigVersion": "str" # Represents model training config + version. Required. + } + """ + ConversationAuthoringClientOperationsMixinGenerated.begin_deploy_project.__doc__ = \ """Creates a new deployment or replaces an existing one. - + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/deploy-project + for more information. + :param project_name: The name of the project to use. Required. :type project_name: str :param deployment_name: The name of the specific deployment of the project to use. Required. @@ -451,6 +791,1130 @@ } """ +ConversationAuthoringClientOperationsMixinGenerated.begin_delete_deployment.__doc__ = \ + """Deletes a project deployment. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/delete-deployment + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param deployment_name: The name of the specific deployment of the project to use. Required. + :type deployment_name: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns JSON object + :rtype: ~azure.core.polling.LROPoller[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_deployment_job_status.__doc__ = \ + """Gets the status of an existing deployment job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-deployment-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param deployment_name: The name of the specific deployment of the project to use. Required. + :type deployment_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_swap_deployments_job_status.__doc__ = \ + """Gets the status of an existing swap deployment job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-swap-deployments-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_export_project_job_status.__doc__ = \ + """Gets the status of an export job. Once job completes, returns the project metadata, and assets. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-export-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "resultUrl": "str", # Optional. The URL to use in order to download the + exported project. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_import_project_job_status.__doc__ = \ + """Gets the status for an import. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-import-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_trained_models.__doc__ = \ + """Lists the trained models belonging to a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-trained-models + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "label": "str", # The trained model label. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # The last trained date time + of the model. Required. + "lastTrainingDurationInSeconds": 0, # The duration of the model's last + training request in seconds. Required. + "modelExpirationDate": "2020-02-20", # The model expiration date. Required. + "modelId": "str", # The model ID. Required. + "modelTrainingConfigVersion": "str" # The model training config version. + Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_trained_model.__doc__ = \ + """Gets the details of a trained model. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-trained-model + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param trained_model_label: The trained model label. Required. + :type trained_model_label: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "label": "str", # The trained model label. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # The last trained date time + of the model. Required. + "lastTrainingDurationInSeconds": 0, # The duration of the model's last + training request in seconds. Required. + "modelExpirationDate": "2020-02-20", # The model expiration date. Required. + "modelId": "str", # The model ID. Required. + "modelTrainingConfigVersion": "str" # The model training config version. + Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.delete_trained_model.__doc__ = \ + """Deletes an existing trained model. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/delete-trained-model + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param trained_model_label: The trained model label. Required. + :type trained_model_label: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_model_evaluation_results.__doc__ = \ + """Gets the detailed results of the evaluation for a trained model. This includes the raw + inference results for the data included in the evaluation process. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-model-evaluation-results + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param trained_model_label: The trained model label. Required. + :type trained_model_label: str + :keyword string_index_type: Specifies the method used to interpret string offsets. For + additional information see https://aka.ms/text-analytics-offsets. "Utf16CodeUnit" Required. + :paramtype string_index_type: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "entitiesResult": { + "expectedEntities": [ + { + "category": "str", # Represents the entity category. + Required. + "length": 0, # Represents the entity length. + Required. + "offset": 0 # Represents the entity offset index + relative to the original text. Required. + } + ], + "predictedEntities": [ + { + "category": "str", # Represents the entity category. + Required. + "length": 0, # Represents the entity length. + Required. + "offset": 0 # Represents the entity offset index + relative to the original text. Required. + } + ] + }, + "intentsResult": { + "expectedIntent": "str", # Represents the utterance's expected + intent. Required. + "predictedIntent": "str" # Represents the utterance's predicted + intent. Required. + }, + "language": "str", # Represents the utterance language. This is BCP-47 + representation of a language. For example, use "en" for English, "en-gb" for + English (UK), "es" for Spanish etc. Required. + "text": "str" # Represents the utterance text. Required. + } + """ + + +ConversationAuthoringClientOperationsMixinGenerated.get_model_evaluation_summary.__doc__ = \ + """Gets the evaluation summary of a trained model. The summary includes high level performance + measurements of the model e.g., F1, Precision, Recall, etc. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-model-evaluation-summary + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param trained_model_label: The trained model label. Required. + :type trained_model_label: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "entitiesEvaluation": { + "confusionMatrix": { + "str": { + "str": { + "normalizedValue": 0.0, # Represents + normalized value in percentages. Required. + "rawValue": 0.0 # Represents raw value. + Required. + } + } + }, + "entities": { + "str": { + "f1": 0.0, # Represents the model precision. + Required. + "falseNegativeCount": 0, # Represents the count of + false negative. Required. + "falsePositiveCount": 0, # Represents the count of + false positive. Required. + "precision": 0.0, # Represents the model recall. + Required. + "recall": 0.0, # Represents the model F1 score. + Required. + "trueNegativeCount": 0, # Represents the count of + true negative. Required. + "truePositiveCount": 0 # Represents the count of + true positive. Required. + } + }, + "macroF1": 0.0, # Represents the macro F1. Required. + "macroPrecision": 0.0, # Represents the macro precision. Required. + "macroRecall": 0.0, # Represents the macro recall. Required. + "microF1": 0.0, # Represents the micro F1. Required. + "microPrecision": 0.0, # Represents the micro precision. Required. + "microRecall": 0.0 # Represents the micro recall. Required. + }, + "evaluationOptions": { + "kind": "str", # Optional. Represents the evaluation kind. By + default, the evaluation kind is set to percentage. Known values are: + "percentage" and "manual". + "testingSplitPercentage": 0, # Optional. Represents the testing + dataset split percentage. Only needed in case the evaluation kind is + percentage. + "trainingSplitPercentage": 0 # Optional. Represents the training + dataset split percentage. Only needed in case the evaluation kind is + percentage. + }, + "intentsEvaluation": { + "confusionMatrix": { + "str": { + "str": { + "normalizedValue": 0.0, # Represents + normalized value in percentages. Required. + "rawValue": 0.0 # Represents raw value. + Required. + } + } + }, + "intents": { + "str": { + "f1": 0.0, # Represents the model precision. + Required. + "falseNegativeCount": 0, # Represents the count of + false negative. Required. + "falsePositiveCount": 0, # Represents the count of + false positive. Required. + "precision": 0.0, # Represents the model recall. + Required. + "recall": 0.0, # Represents the model F1 score. + Required. + "trueNegativeCount": 0, # Represents the count of + true negative. Required. + "truePositiveCount": 0 # Represents the count of + true positive. Required. + } + }, + "macroF1": 0.0, # Represents the macro F1. Required. + "macroPrecision": 0.0, # Represents the macro precision. Required. + "macroRecall": 0.0, # Represents the macro recall. Required. + "microF1": 0.0, # Represents the micro F1. Required. + "microPrecision": 0.0, # Represents the micro precision. Required. + "microRecall": 0.0 # Represents the micro recall. Required. + } + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_training_jobs.__doc__ = \ + """Lists the non-expired training jobs created for a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-training-jobs + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "result": { + "estimatedEndDateTime": "2020-02-20 00:00:00", # Optional. + Represents the estimated end date time for training and evaluation. + "evaluationStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + }, + "modelLabel": "str", # Represents trained model label. Required. + "trainingConfigVersion": "str", # Represents training config + version. Required. + "trainingMode": "str", # Optional. Represents the mode of the + training operation. Known values are: "advanced" and "standard". + "trainingStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + } + }, + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_training_job_status.__doc__ = \ + """Gets the status for a training job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-training-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "result": { + "estimatedEndDateTime": "2020-02-20 00:00:00", # Optional. + Represents the estimated end date time for training and evaluation. + "evaluationStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + }, + "modelLabel": "str", # Represents trained model label. Required. + "trainingConfigVersion": "str", # Represents training config + version. Required. + "trainingMode": "str", # Optional. Represents the mode of the + training operation. Known values are: "advanced" and "standard". + "trainingStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + } + }, + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.begin_cancel_training_job.__doc__ = \ + """Triggers a cancellation for a running training job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/cancel-training-job + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns JSON object + :rtype: ~azure.core.polling.LROPoller[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "result": { + "estimatedEndDateTime": "2020-02-20 00:00:00", # Optional. + Represents the estimated end date time for training and evaluation. + "evaluationStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + }, + "modelLabel": "str", # Represents trained model label. Required. + "trainingConfigVersion": "str", # Represents training config + version. Required. + "trainingMode": "str", # Optional. Represents the mode of the + training operation. Known values are: "advanced" and "standard". + "trainingStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + } + }, + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_project_deletion_job_status.__doc__ = \ + """Gets the status for a project deletion job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-project-deletion-status + for more information. + + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_supported_languages.__doc__ = \ + """Lists the supported languages for the given project type. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-supported-languages + for more information. + + :keyword project_kind: The project kind. Known values are: "Conversation" and "Orchestration". + Required. + :paramtype project_kind: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "languageCode": "str", # The language code. This is BCP-47 representation of + a language. For example, "en" for English, "en-gb" for English (UK), "es" for + Spanish etc. Required. + "languageName": "str" # The language name. Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_supported_prebuilt_entities.__doc__ = \ + """Lists the supported prebuilt entities that can be used while creating composed entities. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-supported-prebuilt-entities + for more information. + + :keyword language: The language to get supported prebuilt entities for. Required if + multilingual is false. This is BCP-47 representation of a language. For example, use "en" for + English, "en-gb" for English (UK), "es" for Spanish etc. Default value is None. + :paramtype language: str + :keyword multilingual: Whether to get the support prebuilt entities for multilingual or + monolingual projects. If true, the language parameter is ignored. Default value is None. + :paramtype multilingual: bool + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "category": "str", # The prebuilt entity category. Required. + "description": "str", # The description. Required. + "examples": "str" # English examples for the entity. Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_training_config_versions.__doc__ = \ + """Lists the support training config version for a given project type. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-training-config-versions + for more information. + + :keyword project_kind: The project kind. Known values are: "Conversation" and "Orchestration". + Required. + :paramtype project_kind: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "modelExpirationDate": "2020-02-20", # Represents the training config + version expiration date. Required. + "trainingConfigVersion": "str" # Represents the version of the config. + Required. + } + """ + class ConversationAuthoringClientOperationsMixin(ConversationAuthoringClientOperationsMixinGenerated): ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_patch.py index 096e41764eb2..d3bace64d6b9 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/_patch.py @@ -35,6 +35,9 @@ class ConversationAuthoringClient(GeneratedConversationAuthoringClient): # pylin detection and question answering. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/language-service/overview. + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring for more information about + requests and responses you can pass to this client. + :param endpoint: Supported Cognitive Services endpoint (e.g., https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_operations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_operations/_patch.py index 50eeaf40fcc2..19ffdbff12ad 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_operations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_operations/_patch.py @@ -10,10 +10,58 @@ from ._operations import \ ConversationAuthoringClientOperationsMixin as ConversationAuthoringClientOperationsMixinGenerated +ConversationAuthoringClientOperationsMixinGenerated.list_projects.__doc__ = \ + """Lists the existing projects. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-projects + for more information. + + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # Represents the project creation + datetime. Required. + "description": "str", # Optional. The project description. + "language": "str", # The project language. This is BCP-47 representation of + a language. For example, use "en" for English, "en-gb" for English (UK), "es" for + Spanish etc. Required. + "lastDeployedDateTime": "2020-02-20 00:00:00", # Optional. Represents the + project last deployed datetime. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Represents the project + creation datetime. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # Optional. Represents the + project last trained datetime. + "multilingual": bool, # Optional. Whether the project would be used for + multiple languages or not. + "projectKind": "str", # Represents the project kind. Required. Known values + are: "Conversation" and "Orchestration". + "projectName": "str", # The new project name. Required. + "settings": { + "confidenceThreshold": 0.0 # The threshold of the intent with the + highest confidence, at which the prediction will automatically be changed to + "None". Required. + } + } + """ ConversationAuthoringClientOperationsMixinGenerated.create_project.__doc__ = \ """Creates a new project or updates an existing one. + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/create-project + for more information. + :param project_name: The name of the project to use. Required. :type project_name: str :param project: The project parameters. Is either a model type or a IO type. Required. @@ -73,10 +121,221 @@ } """ +ConversationAuthoringClientOperationsMixinGenerated.get_project.__doc__ = \ + """Gets the details of a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-project for + more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # Represents the project creation + datetime. Required. + "description": "str", # Optional. The project description. + "language": "str", # The project language. This is BCP-47 representation of + a language. For example, use "en" for English, "en-gb" for English (UK), "es" for + Spanish etc. Required. + "lastDeployedDateTime": "2020-02-20 00:00:00", # Optional. Represents the + project last deployed datetime. + "lastModifiedDateTime": "2020-02-20 00:00:00", # Represents the project + creation datetime. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # Optional. Represents the + project last trained datetime. + "multilingual": bool, # Optional. Whether the project would be used for + multiple languages or not. + "projectKind": "str", # Represents the project kind. Required. Known values + are: "Conversation" and "Orchestration". + "projectName": "str", # The new project name. Required. + "settings": { + "confidenceThreshold": 0.0 # The threshold of the intent with the + highest confidence, at which the prediction will automatically be changed to + "None". Required. + } + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.begin_delete_project.__doc__ = \ + """Deletes a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/delete-project + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns JSON object + :rtype: ~azure.core.polling.AsyncLROPoller[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.begin_export_project.__doc__ = \ + """Triggers a job to export a project's data. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/export for more + information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :keyword string_index_type: Specifies the method used to interpret string offsets. For + additional information see https://aka.ms/text-analytics-offsets. "Utf16CodeUnit" Required. + :paramtype string_index_type: str + :keyword exported_project_format: The format of the exported project file to use. Known values + are: "Conversation" and "Luis". Default value is None. + :paramtype exported_project_format: str + :keyword asset_kind: Kind of asset to export. Default value is None. + :paramtype asset_kind: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns JSON object + :rtype: ~azure.core.polling.AsyncLROPoller[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "resultUrl": "str", # Optional. The URL to use in order to download the + exported project. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + ConversationAuthoringClientOperationsMixinGenerated.begin_import_project.__doc__ = \ """Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/import for more + information. + :param project_name: The name of the project to use. Required. :type project_name: str :param project: The project data to import. Is either a model type or a IO type. Required. @@ -185,6 +444,9 @@ ConversationAuthoringClientOperationsMixinGenerated.begin_train.__doc__ = \ """Triggers a training job for a project. + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/train for more + information. + :param project_name: The name of the project to use. Required. :type project_name: str :param configuration: The training input parameters. Is either a model type or a IO type. @@ -317,9 +579,48 @@ } """ +ConversationAuthoringClientOperationsMixinGenerated.list_deployments.__doc__ = \ + """Lists the deployments belonging to a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-deployments + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deploymentExpirationDate": "2020-02-20", # Represents deployment expiration + date in the runtime. Required. + "deploymentName": "str", # Represents deployment name. Required. + "lastDeployedDateTime": "2020-02-20 00:00:00", # Represents deployment last + deployed time. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # Represents deployment last + trained time. Required. + "modelId": "str", # Represents deployment modelId. Required. + "modelTrainingConfigVersion": "str" # Represents model training config + version. Required. + } + """ + ConversationAuthoringClientOperationsMixinGenerated.begin_swap_deployments.__doc__ = \ """Swaps two existing deployments with each other. + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/swap-deployments + for more information. + :param project_name: The name of the project to use. Required. :type project_name: str :param deployments: The job object to swap two deployments. Is either a model type or a IO @@ -406,20 +707,55 @@ } """ -ConversationAuthoringClientOperationsMixinGenerated.begin_deploy_project.__doc__ = \ - """Creates a new deployment or replaces an existing one. +ConversationAuthoringClientOperationsMixinGenerated.get_deployment.__doc__ = \ + """Gets the details of a deployment. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-deployment + for more information. :param project_name: The name of the project to use. Required. :type project_name: str :param deployment_name: The name of the specific deployment of the project to use. Required. :type deployment_name: str - :param deployment: The new deployment info. Is either a model type or a IO type. Required. - :type deployment: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncLROBasePolling. Pass in False + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deploymentExpirationDate": "2020-02-20", # Represents deployment expiration + date in the runtime. Required. + "deploymentName": "str", # Represents deployment name. Required. + "lastDeployedDateTime": "2020-02-20 00:00:00", # Represents deployment last + deployed time. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # Represents deployment last + trained time. Required. + "modelId": "str", # Represents deployment modelId. Required. + "modelTrainingConfigVersion": "str" # Represents model training config + version. Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.begin_deploy_project.__doc__ = \ + """Creates a new deployment or replaces an existing one. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/deploy-project + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param deployment_name: The name of the specific deployment of the project to use. Required. + :type deployment_name: str + :param deployment: The new deployment info. Is either a model type or a IO type. Required. + :type deployment: JSON or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod @@ -452,6 +788,1129 @@ } """ +ConversationAuthoringClientOperationsMixinGenerated.begin_delete_deployment.__doc__ = \ + """Deletes a project deployment. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/delete-deployment + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param deployment_name: The name of the specific deployment of the project to use. Required. + :type deployment_name: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns JSON object + :rtype: ~azure.core.polling.AsyncLROPoller[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_deployment_job_status.__doc__ = \ + """Gets the status of an existing deployment job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-deployment-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param deployment_name: The name of the specific deployment of the project to use. Required. + :type deployment_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_swap_deployments_job_status.__doc__ = \ + """Gets the status of an existing swap deployment job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-swap-deployments-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_export_project_job_status.__doc__ = \ + """Gets the status of an export job. Once job completes, returns the project metadata, and assets. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-export-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "resultUrl": "str", # Optional. The URL to use in order to download the + exported project. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_import_project_job_status.__doc__ = \ + """Gets the status for an import. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-import-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_trained_models.__doc__ = \ + """Lists the trained models belonging to a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-trained-models + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "label": "str", # The trained model label. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # The last trained date time + of the model. Required. + "lastTrainingDurationInSeconds": 0, # The duration of the model's last + training request in seconds. Required. + "modelExpirationDate": "2020-02-20", # The model expiration date. Required. + "modelId": "str", # The model ID. Required. + "modelTrainingConfigVersion": "str" # The model training config version. + Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_trained_model.__doc__ = \ + """Gets the details of a trained model. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-trained-model + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param trained_model_label: The trained model label. Required. + :type trained_model_label: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "label": "str", # The trained model label. Required. + "lastTrainedDateTime": "2020-02-20 00:00:00", # The last trained date time + of the model. Required. + "lastTrainingDurationInSeconds": 0, # The duration of the model's last + training request in seconds. Required. + "modelExpirationDate": "2020-02-20", # The model expiration date. Required. + "modelId": "str", # The model ID. Required. + "modelTrainingConfigVersion": "str" # The model training config version. + Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.delete_trained_model.__doc__ = \ + """Deletes an existing trained model. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/delete-trained-model + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param trained_model_label: The trained model label. Required. + :type trained_model_label: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_model_evaluation_results.__doc__ = \ + """Gets the detailed results of the evaluation for a trained model. This includes the raw + inference results for the data included in the evaluation process. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-model-evaluation-results + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param trained_model_label: The trained model label. Required. + :type trained_model_label: str + :keyword string_index_type: Specifies the method used to interpret string offsets. For + additional information see https://aka.ms/text-analytics-offsets. "Utf16CodeUnit" Required. + :paramtype string_index_type: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "entitiesResult": { + "expectedEntities": [ + { + "category": "str", # Represents the entity category. + Required. + "length": 0, # Represents the entity length. + Required. + "offset": 0 # Represents the entity offset index + relative to the original text. Required. + } + ], + "predictedEntities": [ + { + "category": "str", # Represents the entity category. + Required. + "length": 0, # Represents the entity length. + Required. + "offset": 0 # Represents the entity offset index + relative to the original text. Required. + } + ] + }, + "intentsResult": { + "expectedIntent": "str", # Represents the utterance's expected + intent. Required. + "predictedIntent": "str" # Represents the utterance's predicted + intent. Required. + }, + "language": "str", # Represents the utterance language. This is BCP-47 + representation of a language. For example, use "en" for English, "en-gb" for + English (UK), "es" for Spanish etc. Required. + "text": "str" # Represents the utterance text. Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_model_evaluation_summary.__doc__ = \ + """Gets the evaluation summary of a trained model. The summary includes high level performance + measurements of the model e.g., F1, Precision, Recall, etc. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-model-evaluation-summary + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param trained_model_label: The trained model label. Required. + :type trained_model_label: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "entitiesEvaluation": { + "confusionMatrix": { + "str": { + "str": { + "normalizedValue": 0.0, # Represents + normalized value in percentages. Required. + "rawValue": 0.0 # Represents raw value. + Required. + } + } + }, + "entities": { + "str": { + "f1": 0.0, # Represents the model precision. + Required. + "falseNegativeCount": 0, # Represents the count of + false negative. Required. + "falsePositiveCount": 0, # Represents the count of + false positive. Required. + "precision": 0.0, # Represents the model recall. + Required. + "recall": 0.0, # Represents the model F1 score. + Required. + "trueNegativeCount": 0, # Represents the count of + true negative. Required. + "truePositiveCount": 0 # Represents the count of + true positive. Required. + } + }, + "macroF1": 0.0, # Represents the macro F1. Required. + "macroPrecision": 0.0, # Represents the macro precision. Required. + "macroRecall": 0.0, # Represents the macro recall. Required. + "microF1": 0.0, # Represents the micro F1. Required. + "microPrecision": 0.0, # Represents the micro precision. Required. + "microRecall": 0.0 # Represents the micro recall. Required. + }, + "evaluationOptions": { + "kind": "str", # Optional. Represents the evaluation kind. By + default, the evaluation kind is set to percentage. Known values are: + "percentage" and "manual". + "testingSplitPercentage": 0, # Optional. Represents the testing + dataset split percentage. Only needed in case the evaluation kind is + percentage. + "trainingSplitPercentage": 0 # Optional. Represents the training + dataset split percentage. Only needed in case the evaluation kind is + percentage. + }, + "intentsEvaluation": { + "confusionMatrix": { + "str": { + "str": { + "normalizedValue": 0.0, # Represents + normalized value in percentages. Required. + "rawValue": 0.0 # Represents raw value. + Required. + } + } + }, + "intents": { + "str": { + "f1": 0.0, # Represents the model precision. + Required. + "falseNegativeCount": 0, # Represents the count of + false negative. Required. + "falsePositiveCount": 0, # Represents the count of + false positive. Required. + "precision": 0.0, # Represents the model recall. + Required. + "recall": 0.0, # Represents the model F1 score. + Required. + "trueNegativeCount": 0, # Represents the count of + true negative. Required. + "truePositiveCount": 0 # Represents the count of + true positive. Required. + } + }, + "macroF1": 0.0, # Represents the macro F1. Required. + "macroPrecision": 0.0, # Represents the macro precision. Required. + "macroRecall": 0.0, # Represents the macro recall. Required. + "microF1": 0.0, # Represents the micro F1. Required. + "microPrecision": 0.0, # Represents the micro precision. Required. + "microRecall": 0.0 # Represents the micro recall. Required. + } + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_training_jobs.__doc__ = \ + """Lists the non-expired training jobs created for a project. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-training-jobs + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "result": { + "estimatedEndDateTime": "2020-02-20 00:00:00", # Optional. + Represents the estimated end date time for training and evaluation. + "evaluationStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + }, + "modelLabel": "str", # Represents trained model label. Required. + "trainingConfigVersion": "str", # Represents training config + version. Required. + "trainingMode": "str", # Optional. Represents the mode of the + training operation. Known values are: "advanced" and "standard". + "trainingStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + } + }, + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_training_job_status.__doc__ = \ + """Gets the status for a training job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-training-status + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "result": { + "estimatedEndDateTime": "2020-02-20 00:00:00", # Optional. + Represents the estimated end date time for training and evaluation. + "evaluationStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + }, + "modelLabel": "str", # Represents trained model label. Required. + "trainingConfigVersion": "str", # Represents training config + version. Required. + "trainingMode": "str", # Optional. Represents the mode of the + training operation. Known values are: "advanced" and "standard". + "trainingStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + } + }, + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.begin_cancel_training_job.__doc__ = \ + """Triggers a cancellation for a running training job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/cancel-training-job + for more information. + + :param project_name: The name of the project to use. Required. + :type project_name: str + :param job_id: The job ID. Required. + :type job_id: str + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns JSON object + :rtype: ~azure.core.polling.AsyncLROPoller[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "result": { + "estimatedEndDateTime": "2020-02-20 00:00:00", # Optional. + Represents the estimated end date time for training and evaluation. + "evaluationStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + }, + "modelLabel": "str", # Represents trained model label. Required. + "trainingConfigVersion": "str", # Represents training config + version. Required. + "trainingMode": "str", # Optional. Represents the mode of the + training operation. Known values are: "advanced" and "standard". + "trainingStatus": { + "endDateTime": "2020-02-20 00:00:00", # Optional. Represents + the end date time. + "percentComplete": 0, # Represents progress percentage. + Required. + "startDateTime": "2020-02-20 00:00:00", # Optional. + Represents the start date time. + "status": "str" # Represents the status of the + sub-operation. Required. Known values are: "notStarted", "running", + "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + } + }, + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.get_project_deletion_job_status.__doc__ = \ + """Gets the status for a project deletion job. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-project-deletion-status + for more information. + + :param job_id: The job ID. Required. + :type job_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "createdDateTime": "2020-02-20 00:00:00", # The creation date time of the + job. Required. + "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", + "ServiceUnavailable", "Timeout", "QuotaExceeded", "Conflict", and + "Warning". + "details": [ + ... + ], + "innererror": { + "code": "str", # One of a server-defined set of + error codes. Required. Known values are: "InvalidRequest", + "InvalidParameterValue", "KnowledgeBaseNotFound", + "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", + "ExtractionFailure", "InvalidRequestBodyFormat", "EmptyRequest", + "MissingInputDocuments", "InvalidDocument", "ModelVersionIncorrect", + "InvalidDocumentBatch", "UnsupportedLanguageCode", and + "InvalidCountryHint". + "details": { + "str": "str" # Optional. Error details. + }, + "innererror": ..., + "message": "str", # Error message. Required. + "target": "str" # Optional. Error target. + }, + "message": "str", # A human-readable representation of the + error. Required. + "target": "str" # Optional. The target of the error. + } + ], + "expirationDateTime": "2020-02-20 00:00:00", # Optional. The expiration date + time of the job. + "jobId": "str", # The job ID. Required. + "lastUpdatedDateTime": "2020-02-20 00:00:00", # The last date time the job + was updated. Required. + "status": "str", # The job status. Required. Known values are: "notStarted", + "running", "succeeded", "failed", "cancelled", "cancelling", and + "partiallyCompleted". + "warnings": [ + { + "code": "str", # The warning code. Required. + "message": "str" # The warning message. Required. + } + ] + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_supported_languages.__doc__ = \ + """Lists the supported languages for the given project type. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-supported-languages + for more information. + + :keyword project_kind: The project kind. Known values are: "Conversation" and "Orchestration". + Required. + :paramtype project_kind: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "languageCode": "str", # The language code. This is BCP-47 representation of + a language. For example, "en" for English, "en-gb" for English (UK), "es" for + Spanish etc. Required. + "languageName": "str" # The language name. Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_supported_prebuilt_entities.__doc__ = \ + """Lists the supported prebuilt entities that can be used while creating composed entities. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/get-supported-prebuilt-entities + for more information. + + :keyword language: The language to get supported prebuilt entities for. Required if + multilingual is false. This is BCP-47 representation of a language. For example, use "en" for + English, "en-gb" for English (UK), "es" for Spanish etc. Default value is None. + :paramtype language: str + :keyword multilingual: Whether to get the support prebuilt entities for multilingual or + monolingual projects. If true, the language parameter is ignored. Default value is None. + :paramtype multilingual: bool + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "category": "str", # The prebuilt entity category. Required. + "description": "str", # The description. Required. + "examples": "str" # English examples for the entity. Required. + } + """ + +ConversationAuthoringClientOperationsMixinGenerated.list_training_config_versions.__doc__ = \ + """Lists the support training config version for a given project type. + + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring/list-training-config-versions + for more information. + + :keyword project_kind: The project kind. Known values are: "Conversation" and "Orchestration". + Required. + :paramtype project_kind: str + :keyword top: The maximum number of resources to return from the collection. Default value is + None. + :paramtype top: int + :keyword skip: An offset into the collection of the first resource to be returned. Default + value is None. + :paramtype skip: int + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[JSON] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "modelExpirationDate": "2020-02-20", # Represents the training config + version expiration date. Required. + "trainingConfigVersion": "str" # Represents the version of the config. + Required. + } + """ + class ConversationAuthoringClientOperationsMixin(ConversationAuthoringClientOperationsMixinGenerated): ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_patch.py index 5d4f461e3ac6..c27fe2408c05 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/azure/ai/language/conversations/authoring/aio/_patch.py @@ -36,6 +36,9 @@ class ConversationAuthoringClient(GeneratedConversationAuthoringClient): # pylin detection and question answering. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/language-service/overview. + See https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring for more information about + requests and responses you can pass to this client. + :param endpoint: Supported Cognitive Services endpoint (e.g., https://:code:``.cognitiveservices.azure.com). Required. :type endpoint: str From eefac809284116c8fca34363cbfff2ca8b41db4f Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 23 Jun 2022 18:24:16 -0700 Subject: [PATCH 5/8] add rest docs to readme --- .../azure-ai-language-conversations/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md index fa0951052ce3..203668ac8144 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md @@ -6,7 +6,7 @@ Conversational Language Understanding - aka **CLU** for short - is a cloud-based - Workflow app: Acts like an orchestrator to select the best candidate to analyze conversations to get best response from apps like Qna, Luis, and Conversation App -[Source code][conversationallanguage_client_src] | [Package (PyPI)][conversationallanguage_pypi_package] | [API reference documentation][api_reference_documentation] | [Product documentation][conversationallanguage_docs] | [Samples][conversationallanguage_samples] +[Source code][conversationallanguage_client_src] | [Package (PyPI)][conversationallanguage_pypi_package] | [API reference documentation][api_reference_documentation] | [Samples][conversationallanguage_samples] | [Product documentation][conversationallanguage_docs] | [Analysis REST API documentation][conversationanalysis_restdocs] | [Authoring REST API documentation][conversationanalysis_restdocs_authoring] ## _Disclaimer_ @@ -370,7 +370,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [azure_cli]: https://docs.microsoft.com/cli/azure/ [azure_portal]: https://portal.azure.com/ [azure_subscription]: https://azure.microsoft.com/free/ - +[conversationanalysis_restdocs]: https://docs.microsoft.com/rest/api/language/conversation-analysis-runtime/ +[conversationanalysis_restdocs_authoring]: https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring [cla]: https://cla.microsoft.com [coc_contact]: mailto:opencode@microsoft.com [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ From 540f44970fa5a7a821d4e75173f173c4470b6449 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 23 Jun 2022 18:26:36 -0700 Subject: [PATCH 6/8] formatting --- sdk/cognitivelanguage/azure-ai-language-conversations/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md index 203668ac8144..154779dbf080 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md @@ -6,7 +6,7 @@ Conversational Language Understanding - aka **CLU** for short - is a cloud-based - Workflow app: Acts like an orchestrator to select the best candidate to analyze conversations to get best response from apps like Qna, Luis, and Conversation App -[Source code][conversationallanguage_client_src] | [Package (PyPI)][conversationallanguage_pypi_package] | [API reference documentation][api_reference_documentation] | [Samples][conversationallanguage_samples] | [Product documentation][conversationallanguage_docs] | [Analysis REST API documentation][conversationanalysis_restdocs] | [Authoring REST API documentation][conversationanalysis_restdocs_authoring] +[Source code][conversationallanguage_client_src] | [Package (PyPI)][conversationallanguage_pypi_package] | [API reference documentation][api_reference_documentation] | [Samples][conversationallanguage_samples] | [Product documentation][conversationallanguage_docs] | [Analysis REST API][conversationanalysis_restdocs] | [Authoring REST API][conversationanalysis_restdocs_authoring] ## _Disclaimer_ From 3ce0ecfaeeaeb42ba3401ea31a05a7680f588e34 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 27 Jun 2022 08:57:47 -0700 Subject: [PATCH 7/8] feedback --- .../azure-ai-language-conversations/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md index 154779dbf080..4bb4a0bfeff9 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md @@ -6,7 +6,7 @@ Conversational Language Understanding - aka **CLU** for short - is a cloud-based - Workflow app: Acts like an orchestrator to select the best candidate to analyze conversations to get best response from apps like Qna, Luis, and Conversation App -[Source code][conversationallanguage_client_src] | [Package (PyPI)][conversationallanguage_pypi_package] | [API reference documentation][api_reference_documentation] | [Samples][conversationallanguage_samples] | [Product documentation][conversationallanguage_docs] | [Analysis REST API][conversationanalysis_restdocs] | [Authoring REST API][conversationanalysis_restdocs_authoring] +[Source code][conversationallanguage_client_src] | [Package (PyPI)][conversationallanguage_pypi_package] | [API reference documentation][api_reference_documentation] | [Samples][conversationallanguage_samples] | [Product documentation][conversationallanguage_docs] | [Analysis REST API][conversationallanguage_restdocs] | [Authoring REST API][conversationallanguage_restdocs_authoring] ## _Disclaimer_ @@ -31,7 +31,7 @@ pip install azure-ai-language-conversations ``` ### Authenticate the client -In order to interact with the CLU service, you'll need to create an instance of the [ConversationAnalysisClient][conversationanalysis_client_class] class, or [ConversationAuthoringClient][conversationauthoring_client_class] class. You will need an **endpoint**, and an **API key** to instantiate a client object. For more information regarding authenticating with Cognitive Services, see [Authenticate requests to Azure Cognitive Services][cognitive_auth]. +In order to interact with the CLU service, you'll need to create an instance of the [ConversationAnalysisClient][conversationanalysisclient_class] class, or [ConversationAuthoringClient][conversationauthoringclient_class] class. You will need an **endpoint**, and an **API key** to instantiate a client object. For more information regarding authenticating with Cognitive Services, see [Authenticate requests to Azure Cognitive Services][cognitive_auth]. #### Get an API key You can get the **endpoint** and an **API key** from the Cognitive Services resource in the [Azure Portal][azure_portal]. @@ -370,8 +370,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [azure_cli]: https://docs.microsoft.com/cli/azure/ [azure_portal]: https://portal.azure.com/ [azure_subscription]: https://azure.microsoft.com/free/ -[conversationanalysis_restdocs]: https://docs.microsoft.com/rest/api/language/conversation-analysis-runtime/ -[conversationanalysis_restdocs_authoring]: https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring [cla]: https://cla.microsoft.com [coc_contact]: mailto:opencode@microsoft.com [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ @@ -389,8 +387,10 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [conversationallanguage_refdocs]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations [conversationallanguage_docs]: https://docs.microsoft.com/azure/cognitive-services/language-service/conversational-language-understanding/overview [conversationallanguage_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md -[conversationanalysis_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-conversations/latest/azure.ai.language.conversations.html#azure.ai.language.conversations.ConversationAnalysisClient -[conversationauthoring_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-conversations/latest/azure.ai.language.conversations.html#azure.ai.language.conversations.ConversationAuthoringClient +[conversationallanguage_restdocs]: https://docs.microsoft.com/rest/api/language/conversation-analysis-runtime/ +[conversationallanguage_restdocs_authoring]: https://docs.microsoft.com/rest/api/language/conversational-analysis-authoring +[conversationanalysisclient_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-conversations/latest/azure.ai.language.conversations.html#azure.ai.language.conversations.ConversationAnalysisClient +[conversationauthoringclient_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-conversations/latest/azure.ai.language.conversations.html#azure.ai.language.conversations.ConversationAuthoringClient [azure_core_exceptions]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md [azure_language_portal]: https://language.cognitive.azure.com/home [cognitive_authentication_aad]: https://docs.microsoft.com/azure/cognitive-services/authentication#authenticate-with-azure-active-directory From faa886fe06d4cdd6c98482bc3efaba7c93627813 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 27 Jun 2022 08:59:04 -0700 Subject: [PATCH 8/8] fix --- .../azure-ai-language-conversations/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md index 4bb4a0bfeff9..1831e87071a8 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/README.md @@ -101,10 +101,10 @@ client = ConversationAnalysisClient(endpoint="https://.cogn ## Key concepts ### ConversationAnalysisClient -The [ConversationAnalysisClient][conversationanalysis_client_class] is the primary interface for making predictions using your deployed Conversations models. For asynchronous operations, an async `ConversationAnalysisClient` is in the `azure.ai.language.conversation.aio` namespace. +The [ConversationAnalysisClient][conversationanalysisclient_class] is the primary interface for making predictions using your deployed Conversations models. For asynchronous operations, an async `ConversationAnalysisClient` is in the `azure.ai.language.conversation.aio` namespace. ### ConversationAnalysisClient -You can use the [ConversationAuthoringClient][conversationauthoring_client_class] to interface with the [Azure Language Portal][azure_language_portal] to carry out authoring operations on your language resource/project. For example, you can use it to create a project, populate with training data, train, test, and deploy. For asynchronous operations, an async `ConversationAnalysisClient` is in the `azure.ai.language.conversation.authoring.aio` namespace. +You can use the [ConversationAuthoringClient][conversationauthoringclient_class] to interface with the [Azure Language Portal][azure_language_portal] to carry out authoring operations on your language resource/project. For example, you can use it to create a project, populate with training data, train, test, and deploy. For asynchronous operations, an async `ConversationAnalysisClient` is in the `azure.ai.language.conversation.authoring.aio` namespace. ## Examples The `azure-ai-language-conversation` client library provides both synchronous and asynchronous APIs.