From 5f06ca1ebd3b58e36eb9e9c618dfbf20d1980467 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Mon, 10 Nov 2025 07:16:53 +0000 Subject: [PATCH] Configurations: 'specification/cognitiveservices/data-plane/LanguageAnalyzeConversationsAuthoring/tspconfig.yaml', API Version: 2025-11-15-preview, SDK Release Type: beta, and CommitSHA: 'd8f039ebd965e40471a082c547b103dd5dc9a33b' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5552628 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../_metadata.json | 6 +- .../apiview-properties.json | 5 +- .../conversations/authoring/_client.py | 12 +- .../conversations/authoring/_configuration.py | 8 +- .../conversations/authoring/_patch.py | 166 +--- .../authoring/_utils/model_base.py | 60 +- .../authoring/_utils/serialization.py | 26 +- .../conversations/authoring/aio/_client.py | 12 +- .../authoring/aio/_configuration.py | 8 +- .../conversations/authoring/aio/_patch.py | 162 +--- .../aio/operations/_deployment_op_patch.py | 276 ------ .../operations/_exported_model_op_patch.py | 177 ---- .../authoring/aio/operations/_operations.py | 742 +++++--------- .../authoring/aio/operations/_patch.py | 11 +- .../aio/operations/_project_op_patch.py | 913 ----------------- .../aio/operations/_trained_model_op_patch.py | 288 ------ .../authoring/models/__init__.py | 6 - .../conversations/authoring/models/_models.py | 296 +++--- .../conversations/authoring/models/_patch.py | 371 +------ .../operations/_deployment_op_patch.py | 266 ----- .../operations/_exported_model_op_patch.py | 173 ---- .../authoring/operations/_operations.py | 882 ++++++----------- .../authoring/operations/_patch.py | 11 +- .../authoring/operations/_project_op_patch.py | 918 ------------------ .../operations/_trained_model_op_patch.py | 287 ------ .../successful_cancel_training_job.py | 34 + .../successful_create_project.py | 40 + .../successful_delete_model.py | 33 + .../successful_get_deployment.py | 34 + .../successful_get_exported_model.py | 34 + .../successful_get_model.py | 34 + .../successful_get_model_evaluation.py | 36 + ...successful_get_model_evaluation_summary.py | 35 + .../successful_get_project.py | 33 + .../successful_get_supported_languages.py | 34 + ...cessful_get_supported_prebuilt_entities.py | 33 + ..._get_supported_training_config_versions.py | 35 + ...sful_list_assigned_resource_deployments.py | 33 + .../successful_list_deployments.py | 33 + .../successful_list_exported_models.py | 33 + .../successful_list_models.py | 33 + .../successful_list_project_resources.py | 33 + .../successful_list_projects.py | 32 + .../successful_list_training_jobs.py | 33 + .../generated_tests/conftest.py | 70 ++ .../test_conversation_authoring.py | 93 ++ .../test_conversation_authoring_async.py | 94 ++ ...authoring_project_deployment_operations.py | 24 + ...ing_project_deployment_operations_async.py | 25 + ...oring_project_exported_model_operations.py | 24 + ...project_exported_model_operations_async.py | 25 + ...on_authoring_project_project_operations.py | 69 ++ ...horing_project_project_operations_async.py | 72 ++ ...horing_project_trained_model_operations.py | 58 ++ ..._project_trained_model_operations_async.py | 59 ++ .../generated_tests/testpreparer.py | 46 + .../generated_tests/testpreparer_async.py | 34 + .../pyproject.toml | 44 +- ...ample_assign_deployment_resources_async.py | 2 + .../async/sample_cancel_training_job_async.py | 2 + .../async/sample_create_project_async.py | 3 + .../async/sample_delete_deployment_async.py | 6 +- .../async/sample_delete_project_async.py | 2 + .../sample_delete_trained_model_async.py | 2 + .../async/sample_deploy_project_async.py | 2 + .../async/sample_export_project_async.py | 2 + .../async/sample_get_deployment_async.py | 2 + ...mple_get_model_evaluation_results_async.py | 2 + ...mple_get_model_evaluation_summary_async.py | 10 +- .../samples/async/sample_get_project_async.py | 2 + .../async/sample_import_project_async.py | 2 + .../async/sample_load_snapshot_async.py | 2 + .../async/sample_swap_deployments_async.py | 2 + .../samples/async/sample_train_async.py | 2 + ...ple_unassign_deployment_resources_async.py | 3 + .../sample_assign_deployment_resources.py | 1 + .../samples/sample_cancel_training_job.py | 5 +- .../samples/sample_create_project.py | 1 + .../samples/sample_delete_deployment.py | 5 +- .../samples/sample_delete_project.py | 1 + .../samples/sample_delete_trained_model.py | 1 + .../samples/sample_deploy_project.py | 2 + .../samples/sample_export_project.py | 1 + .../samples/sample_get_deployment.py | 1 + .../sample_get_model_evaluation_results.py | 1 + .../sample_get_model_evaluation_summary.py | 11 +- .../samples/sample_get_project.py | 1 + .../samples/sample_import_project.py | 1 + .../samples/sample_load_snapshot.py | 1 + .../samples/sample_swap_deployments.py | 1 + .../samples/sample_train.py | 1 + .../sample_unassign_deployment_resources.py | 1 + .../sdk_packaging.toml | 2 - .../tests/test_cancel_training_job.py | 6 +- .../tests/test_cancel_training_job_async.py | 4 +- .../tests/test_delete_deployment.py | 6 +- .../tests/test_delete_deployment_async.py | 4 +- .../tests/test_delete_project.py | 2 +- .../tests/test_export_project.py | 1 + .../test_get_model_evaluation_summary.py | 2 +- .../tests/test_swap_deployments.py | 4 +- .../tsp-location.yaml | 4 +- 102 files changed, 2211 insertions(+), 5372 deletions(-) delete mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_deployment_op_patch.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_exported_model_op_patch.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_project_op_patch.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_trained_model_op_patch.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_deployment_op_patch.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_exported_model_op_patch.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_project_op_patch.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_trained_model_op_patch.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_cancel_training_job.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_create_project.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_delete_model.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_deployment.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_exported_model.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model_evaluation.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model_evaluation_summary.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_project.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_languages.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_prebuilt_entities.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_training_config_versions.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_assigned_resource_deployments.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_deployments.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_exported_models.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_models.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_project_resources.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_projects.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_training_jobs.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/conftest.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_async.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_deployment_operations.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_deployment_operations_async.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_exported_model_operations.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_exported_model_operations_async.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_project_operations.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_project_operations_async.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_trained_model_operations.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_trained_model_operations_async.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/testpreparer.py create mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/testpreparer_async.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-conversations-authoring/sdk_packaging.toml diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/_metadata.json b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/_metadata.json index 253921f335be..6b454632cfc2 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/_metadata.json +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/_metadata.json @@ -1,3 +1,7 @@ { - "apiVersion": "2025-05-15-preview" + "apiVersion": "2025-11-15-preview", + "commit": "d8f039ebd965e40471a082c547b103dd5dc9a33b", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/cognitiveservices/data-plane/LanguageAnalyzeConversationsAuthoring", + "emitterVersion": "0.53.1" } \ No newline at end of file diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/apiview-properties.json b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/apiview-properties.json index 928a1a27ef3b..d5e8477103ba 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/apiview-properties.json +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/apiview-properties.json @@ -1,14 +1,12 @@ { "CrossLanguagePackageId": "Language.Conversations.Authoring", "CrossLanguageDefinitionId": { - "azure.ai.language.conversations.authoring.models.AssignedDeploymentResource": "Language.Conversations.Authoring.AnalyzeConversationAuthoringAssignedDeploymentResource", + "azure.ai.language.conversations.authoring.models.AssignedDeploymentResource": "Language.Conversations.Authoring.AnalyzeConversationAuthoringProjectResourceInfo", "azure.ai.language.conversations.authoring.models.AssignedProjectDeploymentMetadata": "Language.Conversations.Authoring.AnalyzeConversationAuthoringAssignedProjectDeploymentMetadata", "azure.ai.language.conversations.authoring.models.AssignedProjectDeploymentsMetadata": "Language.Conversations.Authoring.AnalyzeConversationAuthoringAssignedProjectDeploymentsMetadata", "azure.ai.language.conversations.authoring.models.ConfusionMatrixCell": "Language.Conversations.Authoring.AnalyzeConversationAuthoringConfusionMatrixCell", "azure.ai.language.conversations.authoring.models.ConfusionMatrixRow": "Language.Conversations.Authoring.AnalyzeConversationAuthoringConfusionMatrixRow", "azure.ai.language.conversations.authoring.models.CreateProjectOptions": "Language.Conversations.Authoring.AnalyzeConversationAuthoringCreateProjectOptions", - "azure.ai.language.conversations.authoring.models.DataGenerationConnectionInfo": "Language.Conversations.Authoring.AnalyzeConversationAuthoringDataGenerationConnectionInfo", - "azure.ai.language.conversations.authoring.models.DeploymentResource": "Language.Conversations.Authoring.AnalyzeConversationAuthoringDeploymentResource", "azure.ai.language.conversations.authoring.models.EntitiesEvaluationSummary": "Language.Conversations.Authoring.AnalyzeConversationAuthoringEntitiesEvaluationSummary", "azure.ai.language.conversations.authoring.models.EntityEvaluationSummary": "Language.Conversations.Authoring.AnalyzeConversationAuthoringEntityEvaluationSummary", "azure.ai.language.conversations.authoring.models.EvalSummary": "Language.Conversations.Authoring.AnalyzeConversationAuthoringEvaluationSummary", @@ -32,7 +30,6 @@ "azure.ai.language.conversations.authoring.models.UtteranceIntentsEvaluationResult": "Language.Conversations.Authoring.AnalyzeConversationAuthoringUtteranceIntentsEvaluationResult", "azure.ai.language.conversations.authoring.models.ProjectKind": "Language.Conversations.Authoring.ProjectKind", "azure.ai.language.conversations.authoring.models.OperationStatus": "Language.Conversations.Authoring.JobStatus", - "azure.ai.language.conversations.authoring.models.DataGenerationConnectionKind": "Language.Conversations.Authoring.AnalyzeConversationAuthoringDataGenerationConnectionKind", "azure.ai.language.conversations.authoring.models.TrainingMode": "Language.Conversations.Authoring.TrainingMode", "azure.ai.language.conversations.authoring.models.StringIndexType": "Language.Conversations.Authoring.StringIndexType", "azure.ai.language.conversations.authoring.models.EvaluationKind": "Language.Conversations.Authoring.EvaluationKind", diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_client.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_client.py index df30f7302ba1..047b4a6db134 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_client.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_client.py @@ -40,7 +40,7 @@ class ConversationAuthoringClient(_ConversationAuthoringClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2025-05-15-preview". Note that overriding this default value may result in unsupported + "2025-11-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -132,7 +132,7 @@ class ConversationAuthoringProjectClient: :param project_name: Required. :type project_name: str :keyword api_version: The API version to use for this operation. Default value is - "2025-05-15-preview". Note that overriding this default value may result in unsupported + "2025-11-15-preview". 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 @@ -169,10 +169,10 @@ def __init__( self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.deployment = DeploymentOperations(self._client, self._config, self._serialize, self._deserialize) # type: ignore # pylint: disable=line-too-long - self.project = ProjectOperations(self._client, self._config, self._serialize, self._deserialize) # type: ignore # pylint: disable=line-too-long - self.exported_model = ExportedModelOperations(self._client, self._config, self._serialize, self._deserialize) # type: ignore # pylint: disable=line-too-long - self.trained_model = TrainedModelOperations(self._client, self._config, self._serialize, self._deserialize) # type: ignore # pylint: disable=line-too-long + self.deployment = DeploymentOperations(self._client, self._config, self._serialize, self._deserialize) + self.project = ProjectOperations(self._client, self._config, self._serialize, self._deserialize) + self.exported_model = ExportedModelOperations(self._client, self._config, self._serialize, self._deserialize) + self.trained_model = TrainedModelOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_configuration.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_configuration.py index 46a2a0ab56ee..ce35f7820738 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_configuration.py @@ -31,13 +31,13 @@ class ConversationAuthoringClientConfiguration: # pylint: disable=too-many-inst :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2025-05-15-preview". Note that overriding this default value may result in unsupported + "2025-11-15-preview". 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: - api_version: str = kwargs.pop("api_version", "2025-05-15-preview") + api_version: str = kwargs.pop("api_version", "2025-11-15-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -89,7 +89,7 @@ class ConversationAuthoringProjectClientConfiguration: # pylint: disable=too-ma :param project_name: Required. :type project_name: str :keyword api_version: The API version to use for this operation. Default value is - "2025-05-15-preview". Note that overriding this default value may result in unsupported + "2025-11-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -97,7 +97,7 @@ class ConversationAuthoringProjectClientConfiguration: # pylint: disable=too-ma def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], project_name: str, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-05-15-preview") + api_version: str = kwargs.pop("api_version", "2025-11-15-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_patch.py index 454e5bb430f6..87676c65a8f0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_patch.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,169 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from collections.abc import MutableMapping # pylint:disable=import-error -from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, TypeVar, Union -from azure.core import PipelineClient -from azure.core.credentials import AzureKeyCredential -from azure.core.pipeline import PipelineResponse, policies -from azure.core.polling import LROPoller -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from ._client import ( - ConversationAuthoringClient as AuthoringClientGenerated, - ConversationAuthoringProjectClient as AuthoringProjectClientGenerated, -) -from ._configuration import ConversationAuthoringProjectClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations._patch import ( - DeploymentOperations, - ExportedModelOperations, - ProjectOperations, - TrainedModelOperations, -) - -if TYPE_CHECKING: - from azure.core.credentials import TokenCredential - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - -class ConversationAuthoringProjectClient(AuthoringProjectClientGenerated): - - #: Deployment operations group - deployment: DeploymentOperations - #: Exported model operations group - exported_model: ExportedModelOperations - #: Project operations group - project: ProjectOperations - #: Trained model operations group - trained_model: TrainedModelOperations - - def __init__( # pylint: disable=super-init-not-called - self, - endpoint: str, - credential: Union[AzureKeyCredential, "TokenCredential"], - *, - api_version: Optional[str] = None, - project_name: str, - **kwargs: Any, - ) -> None: - """ - Initialize a ConversationAuthoringProjectClient. - - :param str endpoint: Supported Cognitive Services endpoint, e.g. - ``https://.cognitiveservices.azure.com``. - :param credential: Credential used to authenticate requests to the service. - :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential - :keyword str api_version: The API version to use for this operation. - Default value is ``2025-05-15-preview``. - Note that overriding this default value may result in unsupported behavior. - :keyword str project_name: The name of the project to scope operations. **Required**. - """ - self._project_name = project_name - _endpoint = f"{endpoint}/language" - - if api_version is not None: - kwargs["api_version"] = api_version - - # Build configuration - self._config = ConversationAuthoringProjectClientConfiguration( - endpoint=endpoint, credential=credential, project_name=project_name, **kwargs - ) - - # Build policies - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - - # Build pipeline client - self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - # Setup serializers - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - # Assign patched operation groups with project_name - self.deployment = DeploymentOperations( - self._client, self._config, self._serialize, self._deserialize, project_name=project_name - ) - self.project = ProjectOperations( - self._client, self._config, self._serialize, self._deserialize, project_name=project_name - ) - self.exported_model = ExportedModelOperations( - self._client, self._config, self._serialize, self._deserialize, project_name=project_name - ) - self.trained_model = TrainedModelOperations( - self._client, self._config, self._serialize, self._deserialize, project_name=project_name - ) - - -class ConversationAuthoringClient(AuthoringClientGenerated): - - def __init__( - self, - endpoint: str, - credential: Union[AzureKeyCredential, "TokenCredential"], - *, - api_version: Optional[str] = None, - **kwargs: Any, - ) -> None: - """ - Create a ConversationAuthoringClient. - - :param str endpoint: Supported Cognitive Services endpoint, e.g. - ``https://.api.cognitiveservices.azure.com``. - :param credential: Key or token credential. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials.TokenCredential - :keyword str api_version: The API version to use for this operation. - Default value is ``2025-05-15-preview``. - Note that overriding this default value may result in unsupported behavior. - """ - if api_version is not None: - kwargs["api_version"] = api_version - super().__init__(endpoint=endpoint, credential=credential, **kwargs) - - def get_project_client(self, project_name: str) -> ConversationAuthoringProjectClient: - return ConversationAuthoringProjectClient( - endpoint=self._config.endpoint, - credential=self._config.credential, - project_name=project_name, - ) - - @distributed_trace - def begin_delete_project(self, project_name: str, **kwargs: Any) -> LROPoller[None]: # pylint: disable=delete-operation-wrong-return-type - """Deletes a project. - - :param project_name: The name of the project to delete. Required. - :type project_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_delete_project( - project_name=project_name, **kwargs - ) +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): @@ -180,6 +19,3 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ - - -__all__ = ["ConversationAuthoringProjectClient", "ConversationAuthoringClient"] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_utils/model_base.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_utils/model_base.py index 2acbba293ae8..12926fa98dcf 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_utils/model_base.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_utils/model_base.py @@ -22,7 +22,7 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET -from collections.abc import MutableMapping # pylint:disable=import-error +from collections.abc import MutableMapping from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -346,7 +346,7 @@ def _get_model(module_name: str, model_name: str): class _MyMutableMapping(MutableMapping[str, typing.Any]): - def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + def __init__(self, data: dict[str, typing.Any]) -> None: self._data = data def __contains__(self, key: typing.Any) -> bool: @@ -426,7 +426,7 @@ def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: return self._data.pop(key) return self._data.pop(key, default) - def popitem(self) -> typing.Tuple[str, typing.Any]: + def popitem(self) -> tuple[str, typing.Any]: """ Removes and returns some (key, value) pair :returns: The (key, value) pair. @@ -514,9 +514,7 @@ def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-m return o -def _get_rest_field( - attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str -) -> typing.Optional["_RestField"]: +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: try: return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) except StopIteration: @@ -539,7 +537,7 @@ class Model(_MyMutableMapping): _is_model = True # label whether current class's _attr_to_rest_field has been calculated # could not see _attr_to_rest_field directly because subclass inherits it from parent class - _calculated: typing.Set[str] = set() + _calculated: set[str] = set() def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ @@ -624,7 +622,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order - attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") } annotations = { @@ -639,10 +637,10 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) if not rf._rest_name_input: rf._rest_name_input = attr - cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint:disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: @@ -681,7 +679,7 @@ def _deserialize(cls, data, exist_discriminators): mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member return mapped_cls._deserialize(data, exist_discriminators) - def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: """Return a dict that can be turned into json using json.dump. :keyword bool exclude_readonly: Whether to remove the readonly properties. @@ -741,7 +739,7 @@ def _deserialize_with_union(deserializers, obj): def _deserialize_dict( value_deserializer: typing.Optional[typing.Callable], module: typing.Optional[str], - obj: typing.Dict[typing.Any, typing.Any], + obj: dict[typing.Any, typing.Any], ): if obj is None: return obj @@ -751,7 +749,7 @@ def _deserialize_dict( def _deserialize_multiple_sequence( - entry_deserializers: typing.List[typing.Optional[typing.Callable]], + entry_deserializers: list[typing.Optional[typing.Callable]], module: typing.Optional[str], obj, ): @@ -772,14 +770,14 @@ def _deserialize_sequence( return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) -def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: return sorted( types, key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), ) -def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches annotation: typing.Any, module: typing.Optional[str], rf: typing.Optional["_RestField"] = None, @@ -844,7 +842,10 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur return functools.partial(_deserialize_with_union, deserializers) try: - if annotation._name == "Dict": # pyright: ignore + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": value_deserializer = _get_deserialize_callable_from_annotation( annotation.__args__[1], module, rf # pyright: ignore ) @@ -857,7 +858,10 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur except (AttributeError, IndexError): pass try: - if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: if len(annotation.__args__) > 1: # pyright: ignore entry_deserializers = [ _get_deserialize_callable_from_annotation(dt, module, rf) @@ -975,11 +979,11 @@ def __init__( name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin is_discriminator: bool = False, - visibility: typing.Optional[typing.List[str]] = None, + visibility: typing.Optional[list[str]] = None, default: typing.Any = _UNSET, format: typing.Optional[str] = None, is_multipart_file_input: bool = False, - xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, ): self._type = type self._rest_name_input = name @@ -1037,11 +1041,11 @@ def rest_field( *, name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[typing.List[str]] = None, + visibility: typing.Optional[list[str]] = None, default: typing.Any = _UNSET, format: typing.Optional[str] = None, is_multipart_file_input: bool = False, - xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, ) -> typing.Any: return _RestField( name=name, @@ -1058,8 +1062,8 @@ def rest_discriminator( *, name: typing.Optional[str] = None, type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin - visibility: typing.Optional[typing.List[str]] = None, - xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, ) -> typing.Any: return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) @@ -1078,9 +1082,9 @@ def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: def _get_element( o: typing.Any, exclude_readonly: bool = False, - parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, wrapped_element: typing.Optional[ET.Element] = None, -) -> typing.Union[ET.Element, typing.List[ET.Element]]: +) -> typing.Union[ET.Element, list[ET.Element]]: if _is_model(o): model_meta = getattr(o, "_xml", {}) @@ -1169,7 +1173,7 @@ def _get_element( def _get_wrapped_element( v: typing.Any, exclude_readonly: bool, - meta: typing.Optional[typing.Dict[str, typing.Any]], + meta: typing.Optional[dict[str, typing.Any]], ) -> ET.Element: wrapped_element = _create_xml_element( meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None @@ -1212,7 +1216,7 @@ def _deserialize_xml( def _convert_element(e: ET.Element): # dict case if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: - dict_result: typing.Dict[str, typing.Any] = {} + dict_result: dict[str, typing.Any] = {} for child in e: if dict_result.get(child.tag) is not None: if isinstance(dict_result[child.tag], list): @@ -1225,7 +1229,7 @@ def _convert_element(e: ET.Element): return dict_result # array case if len(e) > 0: - array_result: typing.List[typing.Any] = [] + array_result: list[typing.Any] = [] for child in e: array_result.append(_convert_element(child)) return array_result diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_utils/serialization.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_utils/serialization.py index eb86ea23c965..45a3e44e45cb 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_utils/serialization.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/_utils/serialization.py @@ -21,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -31,7 +30,6 @@ Mapping, Callable, MutableMapping, - List, ) try: @@ -229,12 +227,12 @@ class Model: serialization and deserialization. """ - _subtype_map: Dict[str, Dict[str, Any]] = {} - _attribute_map: Dict[str, Dict[str, Any]] = {} - _validation: Dict[str, Dict[str, Any]] = {} + _subtype_map: dict[str, dict[str, Any]] = {} + _attribute_map: dict[str, dict[str, Any]] = {} + _validation: dict[str, dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Optional[Dict[str, Any]] = {} + self.additional_properties: Optional[dict[str, Any]] = {} for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -311,7 +309,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -380,7 +378,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: def from_dict( cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, ) -> Self: """Parse a dict using given key extractor return a model. @@ -414,7 +412,7 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod @@ -528,7 +526,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -579,7 +577,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -789,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -1184,7 +1182,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1386,7 +1384,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_client.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_client.py index f35486776a1a..2857b302e5db 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_client.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_client.py @@ -40,7 +40,7 @@ class ConversationAuthoringClient(_ConversationAuthoringClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2025-05-15-preview". Note that overriding this default value may result in unsupported + "2025-11-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -137,7 +137,7 @@ class ConversationAuthoringProjectClient: :param project_name: Required. :type project_name: str :keyword api_version: The API version to use for this operation. Default value is - "2025-05-15-preview". Note that overriding this default value may result in unsupported + "2025-11-15-preview". 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 @@ -178,10 +178,10 @@ def __init__( self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.deployment = DeploymentOperations(self._client, self._config, self._serialize, self._deserialize) # type: ignore # pylint: disable=line-too-long - self.project = ProjectOperations(self._client, self._config, self._serialize, self._deserialize) # type: ignore # pylint: disable=line-too-long - self.exported_model = ExportedModelOperations(self._client, self._config, self._serialize, self._deserialize) # type: ignore # pylint: disable=line-too-long - self.trained_model = TrainedModelOperations(self._client, self._config, self._serialize, self._deserialize) # type: ignore # pylint: disable=line-too-long + self.deployment = DeploymentOperations(self._client, self._config, self._serialize, self._deserialize) + self.project = ProjectOperations(self._client, self._config, self._serialize, self._deserialize) + self.exported_model = ExportedModelOperations(self._client, self._config, self._serialize, self._deserialize) + self.trained_model = TrainedModelOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_configuration.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_configuration.py index de5c6b140182..1e8010a7e763 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_configuration.py @@ -31,7 +31,7 @@ class ConversationAuthoringClientConfiguration: # pylint: disable=too-many-inst :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2025-05-15-preview". Note that overriding this default value may result in unsupported + "2025-11-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -39,7 +39,7 @@ class ConversationAuthoringClientConfiguration: # pylint: disable=too-many-inst def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-05-15-preview") + api_version: str = kwargs.pop("api_version", "2025-11-15-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -91,7 +91,7 @@ class ConversationAuthoringProjectClientConfiguration: # pylint: disable=too-ma :param project_name: Required. :type project_name: str :keyword api_version: The API version to use for this operation. Default value is - "2025-05-15-preview". Note that overriding this default value may result in unsupported + "2025-11-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -103,7 +103,7 @@ def __init__( project_name: str, **kwargs: Any, ) -> None: - api_version: str = kwargs.pop("api_version", "2025-05-15-preview") + api_version: str = kwargs.pop("api_version", "2025-11-15-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_patch.py index a25eaffd3677..87676c65a8f0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/_patch.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,165 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from collections.abc import MutableMapping # pylint: disable=import-error -from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, TypeVar, Union -from azure.core import AsyncPipelineClient -from azure.core.credentials import AzureKeyCredential -from azure.core.pipeline import PipelineResponse, policies -from azure.core.polling import AsyncLROPoller -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator_async import distributed_trace_async -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ConversationAuthoringProjectClientConfiguration -from ._client import ( - ConversationAuthoringClient as AuthoringClientGenerated, - ConversationAuthoringProjectClient as AuthoringProjectClientGenerated, -) -from .operations._patch import ( - DeploymentOperations, - ExportedModelOperations, - ProjectOperations, - TrainedModelOperations, -) -if TYPE_CHECKING: - from azure.core.credentials_async import AsyncTokenCredential - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - - -class ConversationAuthoringProjectClient(AuthoringProjectClientGenerated): - - #: Deployment operations group - deployment: DeploymentOperations - #: Exported model operations group - exported_model: ExportedModelOperations - #: Project operations group - project: ProjectOperations - #: Trained model operations group - trained_model: TrainedModelOperations - - def __init__( # pylint: disable=super-init-not-called - self, - endpoint: str, - credential: Union[AzureKeyCredential, "AsyncTokenCredential"], - *, - api_version: Optional[str] = None, - project_name: str, - **kwargs: Any, - ) -> None: - """Initialize a ConversationAuthoringProjectClient. - - :param str endpoint: Supported Cognitive Services endpoint, e.g. - "https://.cognitiveservices.azure.com". - :param credential: Credential used to authenticate requests to the service. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword str api_version: The API version to use for this operation. - Default value is ``2025-05-15-preview``. - Note that overriding this default value may result in unsupported behavior. - :keyword str project_name: The name of the project to scope operations. Required. - """ - self._project_name = project_name - _endpoint = "{Endpoint}/language" - - if api_version is not None: - kwargs["api_version"] = api_version - - self._config = ConversationAuthoringProjectClientConfiguration( - endpoint=endpoint, credential=credential, project_name=project_name, **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - # Assign patched operation groups with project_name - self.deployment = DeploymentOperations( - self._client, self._config, self._serialize, self._deserialize, project_name=project_name - ) - self.project = ProjectOperations( - self._client, self._config, self._serialize, self._deserialize, project_name=project_name - ) - self.exported_model = ExportedModelOperations( - self._client, self._config, self._serialize, self._deserialize, project_name=project_name - ) - self.trained_model = TrainedModelOperations( - self._client, self._config, self._serialize, self._deserialize, project_name=project_name - ) - - -class ConversationAuthoringClient(AuthoringClientGenerated): - - def __init__( - self, - endpoint: str, - credential: Union[AzureKeyCredential, "AsyncTokenCredential"], - *, - api_version: Optional[str] = None, - **kwargs: Any, - ) -> None: - """ - Create a ConversationAuthoringClient. - - :param str endpoint: Supported Cognitive Services endpoint, e.g. - ``https://.api.cognitiveservices.azure.com``. - :param credential: Key or token credential. - :type credential: ~azure.core.credentials.AzureKeyCredential or - ~azure.core.credentials_async.AsyncTokenCredential - :keyword str api_version: The API version to use for this operation. - Default value is ``2025-05-15-preview``. - Note that overriding this default value may result in unsupported behavior. - """ - if api_version is not None: - kwargs["api_version"] = api_version - super().__init__(endpoint=endpoint, credential=credential, **kwargs) - - def get_project_client(self, project_name: str) -> ConversationAuthoringProjectClient: - return ConversationAuthoringProjectClient( - endpoint=self._config.endpoint, - credential=self._config.credential, - project_name=project_name, - ) - - @distributed_trace_async - async def begin_delete_project(self, project_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """ - Delete a project. - - :param project_name: The name of the project to delete. Required. - :type project_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_delete_project( - project_name=project_name, **kwargs - ) +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): @@ -176,6 +19,3 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ - - -__all__ = ["ConversationAuthoringProjectClient", "ConversationAuthoringClient"] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_deployment_op_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_deployment_op_patch.py deleted file mode 100644 index a5f99977cdb3..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_deployment_op_patch.py +++ /dev/null @@ -1,276 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from collections.abc import MutableMapping # pylint:disable=import-error -from typing import IO, Any, Callable, Dict, Optional, TypeVar, Union, overload - -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async - -from ...models import ( - CreateDeploymentDetails, - DeleteDeploymentDetails, - DeploymentDeleteFromResourcesState, - DeploymentState, - ProjectDeployment, -) -from ._operations import DeploymentOperations as DeploymentOperationsGenerated - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - - -class DeploymentOperations(DeploymentOperationsGenerated): - - def __init__(self, *args, project_name: str, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._project_name = project_name - - @distributed_trace_async - async def begin_delete_deployment( - self, - deployment_name: str, - **kwargs: Any, - ) -> AsyncLROPoller[None]: - """Deletes a project deployment. - - :param deployment_name: The deployment name. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_delete_deployment( - project_name=self._project_name, deployment_name=deployment_name, **kwargs - ) - - @overload - async def begin_delete_deployment_from_resources( - self, - deployment_name: str, - body: DeleteDeploymentDetails, - *, - content_type: str = "application/json", - **kwargs: Any, - ) -> AsyncLROPoller[None]: - """Deletes a project deployment from the specified assigned resources. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The options for deleting the deployment. Required. - :type body: ~azure.ai.language.conversations.authoring.models.DeleteDeploymentDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_delete_deployment_from_resources( - self, deployment_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a project deployment from the specified assigned resources. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The options for deleting the deployment. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_delete_deployment_from_resources( - self, deployment_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a project deployment from the specified assigned resources. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The options for deleting the deployment. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @distributed_trace_async - async def begin_delete_deployment_from_resources( - self, deployment_name: str, body: Union[DeleteDeploymentDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a project deployment from the specified assigned resources. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The options for deleting the deployment. Required. - :type body: ~azure.ai.language.conversations.authoring.models.DeleteDeploymentDetails or JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - return await super()._begin_delete_deployment_from_resources( - project_name=self._project_name, - deployment_name=deployment_name, - body=body, - content_type=content_type, - **kwargs, - ) - - @overload - async def begin_deploy_project( - self, - deployment_name: str, - body: CreateDeploymentDetails, - *, - content_type: str = "application/json", - **kwargs: Any, - ) -> AsyncLROPoller[None]: - """Creates a new deployment or replaces an existing one. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The new deployment info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.CreateDeploymentDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_deploy_project( - self, deployment_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates a new deployment or replaces an existing one. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The new deployment info. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_deploy_project( - self, deployment_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates a new deployment or replaces an existing one. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The new deployment info. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @distributed_trace_async - async def begin_deploy_project( - self, deployment_name: str, body: Union[CreateDeploymentDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates a new deployment or replaces an existing one. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The new deployment info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.CreateDeploymentDetails or JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - return await super()._begin_deploy_project( - project_name=self._project_name, - deployment_name=deployment_name, - body=body, - content_type=content_type, - **kwargs, - ) - - @distributed_trace - async def get_deployment(self, deployment_name: str, **kwargs: Any) -> ProjectDeployment: # type: ignore[override] - """Gets the details of a deployment. - - :param deployment_name: Represents deployment name. Required. - :type deployment_name: str - :return: ProjectDeployment. The ProjectDeployment is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.ProjectDeployment - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super().get_deployment(project_name=self._project_name, deployment_name=deployment_name, **kwargs) - - @distributed_trace - async def _get_deployment_delete_from_resources_status( # type: ignore[override] - self, deployment_name: str, job_id: str, **kwargs: Any - ) -> DeploymentDeleteFromResourcesState: - """Gets the status of an existing delete deployment from specific resources job. - - :param deployment_name: Represents deployment name. Required. - :type deployment_name: str - :param job_id: The job ID. Required. - :type job_id: str - :return: DeploymentDeleteFromResourcesState. The DeploymentDeleteFromResourcesState is - compatible with MutableMapping - :rtype: - ~azure.ai.language.conversations.authoring.models._models.DeploymentDeleteFromResourcesState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_deployment_delete_from_resources_status( - project_name=self._project_name, deployment_name=deployment_name, job_id=job_id, **kwargs - ) - - @distributed_trace - async def _get_deployment_status( # type: ignore[override] - self, deployment_name: str, job_id: str, **kwargs: Any - ) -> DeploymentState: - """Gets the status of an existing deployment job. - - :param deployment_name: Represents deployment name. Required. - :type deployment_name: str - :param job_id: The job ID. Required. - :type job_id: str - :return: DeploymentState. The DeploymentState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.DeploymentState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_deployment_status( - project_name=self._project_name, deployment_name=deployment_name, job_id=job_id, **kwargs - ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_exported_model_op_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_exported_model_op_patch.py deleted file mode 100644 index cd4ecd43907f..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_exported_model_op_patch.py +++ /dev/null @@ -1,177 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from collections.abc import MutableMapping # pylint:disable=import-error -from typing import IO, Any, Callable, Dict, Optional, TypeVar, Union, overload - -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async - -from ...models import ( - ExportedModelDetails, - ExportedModelState, - ExportedTrainedModel, -) -from ._operations import ExportedModelOperations as ExportedModelOperationsGenerated - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - - -class ExportedModelOperations(ExportedModelOperationsGenerated): - - def __init__(self, *args, project_name: str, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._project_name = project_name - - @overload - async def begin_create_or_update_exported_model( - self, - exported_model_name: str, - body: ExportedModelDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates a new exported model or replaces an existing one. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param body: The exported model info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.ExportedModelDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update_exported_model( - self, exported_model_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates a new exported model or replaces an existing one. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param body: The exported model info. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update_exported_model( - self, exported_model_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates a new exported model or replaces an existing one. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param body: The exported model info. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update_exported_model( - self, exported_model_name: str, body: Union[ExportedModelDetails, JSON, IO[bytes]], *, content_type: str = "application/json",**kwargs: Any - ) -> AsyncLROPoller[None]: - """Creates a new exported model or replaces an existing one. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param body: The exported model info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.ExportedModelDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_create_or_update_exported_model( - project_name=self._project_name, - exported_model_name=exported_model_name, - body=body, - content_type=content_type, - **kwargs, - ) - - @distributed_trace_async - async def begin_delete_exported_model( - self, exported_model_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing exported model. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_delete_exported_model( - project_name=self._project_name, - exported_model_name=exported_model_name, - **kwargs, - ) - - @distributed_trace - async def get_exported_model( # type: ignore[override] - self, exported_model_name: str, **kwargs: Any - ) -> ExportedTrainedModel: - """Gets the details of an exported model. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :return: ExportedTrainedModel. The ExportedTrainedModel is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.ExportedTrainedModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super().get_exported_model( - project_name=self._project_name, - exported_model_name=exported_model_name, - **kwargs, - ) - - @distributed_trace - async def _get_exported_model_job_status( # type: ignore[override] - self, exported_model_name: str, job_id: str, **kwargs: Any - ) -> ExportedModelState: - """Gets the status for an existing job to create or update an exported model. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param job_id: The job ID. Required. - :type job_id: str - :return: ExportedModelState. The ExportedModelState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.ExportedModelState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_exported_model_job_status( - project_name=self._project_name, - exported_model_name=exported_model_name, - job_id=job_id, - **kwargs, - ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_operations.py index a3e76ff24ccd..768de454d6e2 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_operations.py @@ -6,10 +6,10 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint:disable=import-error +from collections.abc import MutableMapping from io import IOBase import json -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -93,7 +93,7 @@ JSON = MutableMapping[str, Any] T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] _Unset: Any = object() @@ -120,7 +120,7 @@ def list_projects( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.ProjectDetails]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.ProjectDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -172,7 +172,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProjectDetails], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.ProjectDetails], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -221,7 +221,7 @@ def list_supported_languages( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.SupportedLanguage]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.SupportedLanguage]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -274,7 +274,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SupportedLanguage], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.SupportedLanguage], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -298,9 +298,9 @@ async def get_next(next_link=None): @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "top", "skip", "maxpagesize", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "top", "skip", "maxpagesize", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def list_assigned_resource_deployments( self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any @@ -322,7 +322,7 @@ def list_assigned_resource_deployments( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.AssignedProjectDeploymentsMetadata]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.AssignedProjectDeploymentsMetadata]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -374,7 +374,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AssignedProjectDeploymentsMetadata], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.AssignedProjectDeploymentsMetadata], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -428,7 +428,7 @@ def list_supported_prebuilt_entities( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.PrebuiltEntity]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.PrebuiltEntity]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -482,7 +482,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.PrebuiltEntity], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.PrebuiltEntity], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -531,7 +531,7 @@ def list_training_config_versions( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.TrainingConfigVersion]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.TrainingConfigVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -584,7 +584,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TrainingConfigVersion], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.TrainingConfigVersion], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1056,11 +1056,9 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get_deployment(self, project_name: str, deployment_name: str, **kwargs: Any) -> _models.ProjectDeployment: + async def get_deployment(self, deployment_name: str, **kwargs: Any) -> _models.ProjectDeployment: """Gets the details of a deployment. - :param project_name: The new project name. Required. - :type project_name: str :param deployment_name: Represents deployment name. Required. :type deployment_name: str :return: ProjectDeployment. The ProjectDeployment is compatible with MutableMapping @@ -1081,8 +1079,8 @@ async def get_deployment(self, project_name: str, deployment_name: str, **kwargs cls: ClsType[_models.ProjectDeployment] = kwargs.pop("cls", None) _request = build_deployment_get_deployment_request( - project_name=project_name, deployment_name=deployment_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1119,11 +1117,7 @@ async def get_deployment(self, project_name: str, deployment_name: str, **kwargs return deserialized # type: ignore async def _deploy_project_initial( - self, - project_name: str, - deployment_name: str, - body: Union[_models._models.CreateDeploymentDetails, JSON, IO[bytes]], - **kwargs: Any + self, deployment_name: str, body: Union[_models._models.CreateDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1147,8 +1141,8 @@ async def _deploy_project_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_deployment_deploy_project_request( - project_name=project_name, deployment_name=deployment_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -1188,7 +1182,6 @@ async def _deploy_project_initial( @overload async def _begin_deploy_project( self, - project_name: str, deployment_name: str, body: _models._models.CreateDeploymentDetails, *, @@ -1197,37 +1190,19 @@ async def _begin_deploy_project( ) -> AsyncLROPoller[None]: ... @overload async def _begin_deploy_project( - self, - project_name: str, - deployment_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any + self, deployment_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_deploy_project( - self, - project_name: str, - deployment_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any + self, deployment_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @distributed_trace_async async def _begin_deploy_project( - self, - project_name: str, - deployment_name: str, - body: Union[_models._models.CreateDeploymentDetails, JSON, IO[bytes]], - **kwargs: Any + self, deployment_name: str, body: Union[_models._models.CreateDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Creates a new deployment or replaces an existing one. - :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 body: The new deployment info. Is one of the following types: CreateDeploymentDetails, @@ -1248,7 +1223,6 @@ async def _begin_deploy_project( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._deploy_project_initial( - project_name=project_name, deployment_name=deployment_name, body=body, content_type=content_type, @@ -1286,9 +1260,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_deployment_initial( - self, project_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + async def _delete_deployment_initial(self, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1303,8 +1275,8 @@ async def _delete_deployment_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_deployment_delete_deployment_request( - project_name=project_name, deployment_name=deployment_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1340,13 +1312,9 @@ async def _delete_deployment_initial( return deserialized # type: ignore @distributed_trace_async - async def _begin_delete_deployment( - self, project_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + async def _begin_delete_deployment(self, deployment_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes a project deployment. - :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: An instance of AsyncLROPoller that returns None @@ -1362,12 +1330,7 @@ async def _begin_delete_deployment( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_deployment_initial( - project_name=project_name, - deployment_name=deployment_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + deployment_name=deployment_name, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -1399,16 +1362,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "deployment_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "deployment_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) async def _delete_deployment_from_resources_initial( # pylint: disable=name-too-long - self, - project_name: str, - deployment_name: str, - body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], - **kwargs: Any + self, deployment_name: str, body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1432,8 +1391,8 @@ async def _delete_deployment_from_resources_initial( # pylint: disable=name-too _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_deployment_delete_deployment_from_resources_request( - project_name=project_name, deployment_name=deployment_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -1473,7 +1432,6 @@ async def _delete_deployment_from_resources_initial( # pylint: disable=name-too @overload async def _begin_delete_deployment_from_resources( self, - project_name: str, deployment_name: str, body: _models._models.DeleteDeploymentDetails, *, @@ -1482,46 +1440,29 @@ async def _begin_delete_deployment_from_resources( ) -> AsyncLROPoller[None]: ... @overload async def _begin_delete_deployment_from_resources( - self, - project_name: str, - deployment_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any + self, deployment_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_delete_deployment_from_resources( - self, - project_name: str, - deployment_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any + self, deployment_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "deployment_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "deployment_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) async def _begin_delete_deployment_from_resources( - self, - project_name: str, - deployment_name: str, - body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], - **kwargs: Any + self, deployment_name: str, body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a project deployment from the specified assigned resources. + """Deletes a deployment from the specified project-assigned resources. - :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 body: The options for deleting the deployment. Is one of the following types: - DeleteDeploymentDetails, JSON, IO[bytes] Required. + :param body: The Language or AIService resource list for deleting the deployment.\\r\\n + The deployment will only be deleted from the specified resources, and will remain for the rest. + Is one of the following types: DeleteDeploymentDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.DeleteDeploymentDetails or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None @@ -1538,7 +1479,6 @@ async def _begin_delete_deployment_from_resources( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_deployment_from_resources_initial( - project_name=project_name, deployment_name=deployment_name, body=body, content_type=content_type, @@ -1578,17 +1518,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "deployment_name", "job_id", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "deployment_name", "job_id", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) async def _get_deployment_delete_from_resources_status( # pylint: disable=name-too-long - self, project_name: str, deployment_name: str, job_id: str, **kwargs: Any + self, deployment_name: str, job_id: str, **kwargs: Any ) -> _models._models.DeploymentDeleteFromResourcesState: """Gets the status of an existing delete deployment from specific resources job. - :param project_name: The new project name. Required. - :type project_name: str :param deployment_name: Represents deployment name. Required. :type deployment_name: str :param job_id: The job ID. Required. @@ -1613,9 +1551,9 @@ async def _get_deployment_delete_from_resources_status( # pylint: disable=name- cls: ClsType[_models._models.DeploymentDeleteFromResourcesState] = kwargs.pop("cls", None) _request = build_deployment_get_deployment_delete_from_resources_status_request( - project_name=project_name, deployment_name=deployment_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1655,12 +1593,10 @@ async def _get_deployment_delete_from_resources_status( # pylint: disable=name- @distributed_trace_async async def _get_deployment_status( - self, project_name: str, deployment_name: str, job_id: str, **kwargs: Any + self, deployment_name: str, job_id: str, **kwargs: Any ) -> _models._models.DeploymentState: """Gets the status of an existing deployment job. - :param project_name: The new project name. Required. - :type project_name: str :param deployment_name: Represents deployment name. Required. :type deployment_name: str :param job_id: The job ID. Required. @@ -1683,9 +1619,9 @@ async def _get_deployment_status( cls: ClsType[_models._models.DeploymentState] = kwargs.pop("cls", None) _request = build_deployment_get_deployment_status_request( - project_name=project_name, deployment_name=deployment_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1745,12 +1681,10 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list_trained_models( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> AsyncItemPaged["_models.ProjectTrainedModel"]: """Lists the trained models belonging to a project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -1764,7 +1698,7 @@ def list_trained_models( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.ProjectTrainedModel]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.ProjectTrainedModel]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1778,7 +1712,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_trained_models_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -1817,7 +1751,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProjectTrainedModel], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.ProjectTrainedModel], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1841,12 +1775,10 @@ async def get_next(next_link=None): @distributed_trace def list_training_jobs( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> AsyncItemPaged["_models.TrainingState"]: """Lists the non-expired training jobs created for a project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -1860,7 +1792,7 @@ def list_training_jobs( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.TrainingState]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.TrainingState]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1874,7 +1806,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_training_jobs_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -1913,7 +1845,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TrainingState], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.TrainingState], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1937,17 +1869,15 @@ async def get_next(next_link=None): @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "top", "skip", "maxpagesize", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "top", "skip", "maxpagesize", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def list_deployment_resources( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> AsyncItemPaged["_models.AssignedDeploymentResource"]: - """Lists the deployments resources assigned to the project. + """Lists the Language or AIService resources assigned to the project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -1961,7 +1891,7 @@ def list_deployment_resources( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.AssignedDeploymentResource]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.AssignedDeploymentResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1975,7 +1905,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_deployment_resources_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -2014,7 +1944,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AssignedDeploymentResource], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.AssignedDeploymentResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2038,12 +1968,10 @@ async def get_next(next_link=None): @distributed_trace def list_deployments( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> AsyncItemPaged["_models.ProjectDeployment"]: """Lists the deployments belonging to a project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -2057,7 +1985,7 @@ def list_deployments( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.ProjectDeployment]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.ProjectDeployment]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2071,7 +1999,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_deployments_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -2110,7 +2038,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProjectDeployment], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.ProjectDeployment], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2134,17 +2062,15 @@ async def get_next(next_link=None): @distributed_trace @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "top", "skip", "maxpagesize", "accept"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "top", "skip", "maxpagesize", "accept"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def list_exported_models( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> AsyncItemPaged["_models.ExportedTrainedModel"]: """Lists the exported models belonging to a project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -2158,7 +2084,7 @@ def list_exported_models( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.ExportedTrainedModel]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.ExportedTrainedModel]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2172,7 +2098,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_exported_models_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -2211,7 +2137,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ExportedTrainedModel], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.ExportedTrainedModel], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2234,15 +2160,12 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) async def _assign_deployment_resources_initial( - self, - project_name: str, - body: Union[_models._models.AssignDeploymentResourcesDetails, JSON, IO[bytes]], - **kwargs: Any + self, body: Union[_models._models.AssignDeploymentResourcesDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2266,7 +2189,7 @@ async def _assign_deployment_resources_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_assign_deployment_resources_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -2306,7 +2229,6 @@ async def _assign_deployment_resources_initial( @overload async def _begin_assign_deployment_resources( self, - project_name: str, body: _models._models.AssignDeploymentResourcesDetails, *, content_type: str = "application/json", @@ -2314,34 +2236,29 @@ async def _begin_assign_deployment_resources( ) -> AsyncLROPoller[None]: ... @overload async def _begin_assign_deployment_resources( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_assign_deployment_resources( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) async def _begin_assign_deployment_resources( - self, - project_name: str, - body: Union[_models._models.AssignDeploymentResourcesDetails, JSON, IO[bytes]], - **kwargs: Any + self, body: Union[_models._models.AssignDeploymentResourcesDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. This API is - available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, check here: + """Assign new Language or AIService Azure resources to a project to allowing deployment to them. + This API is available only via AAD authentication and not supported via subscription key + authentication. For more details about AAD authentication, check here: `https://learn.microsoft.com/en-us/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory `_. - :param project_name: The name of the project to use. Required. - :type project_name: str - :param body: The new project resources info. Is one of the following types: + :param body: The new project resources to be assigned. Is one of the following types: AssignDeploymentResourcesDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.AssignDeploymentResourcesDetails or @@ -2360,13 +2277,7 @@ async def _begin_assign_deployment_resources( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._assign_deployment_resources_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -2398,15 +2309,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) async def _unassign_deployment_resources_initial( - self, - project_name: str, - body: Union[_models._models.UnassignDeploymentResourcesDetails, JSON, IO[bytes]], - **kwargs: Any + self, body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2430,7 +2338,7 @@ async def _unassign_deployment_resources_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_unassign_deployment_resources_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -2469,44 +2377,32 @@ async def _unassign_deployment_resources_initial( @overload async def _begin_unassign_deployment_resources( - self, - project_name: str, - body: _models._models.UnassignDeploymentResourcesDetails, - *, - content_type: str = "application/json", - **kwargs: Any + self, body: _models._models.DeleteDeploymentDetails, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_unassign_deployment_resources( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_unassign_deployment_resources( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) async def _begin_unassign_deployment_resources( - self, - project_name: str, - body: Union[_models._models.UnassignDeploymentResourcesDetails, JSON, IO[bytes]], - **kwargs: Any + self, body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. + """Unassign resources from a project. This disallows deployment to these resources. - :param project_name: The name of the project to use. Required. - :type project_name: str - :param body: The info for the deployment resources to be deleted. Is one of the following - types: UnassignDeploymentResourcesDetails, JSON, IO[bytes] Required. - :type body: - ~azure.ai.language.conversations.authoring.models._models.UnassignDeploymentResourcesDetails or - JSON or IO[bytes] + :param body: The list of Language or AIService Azure resource IDs to be unassigned. Is one of + the following types: DeleteDeploymentDetails, JSON, IO[bytes] Required. + :type body: ~azure.ai.language.conversations.authoring.models._models.DeleteDeploymentDetails + or JSON or IO[bytes] :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2521,13 +2417,7 @@ async def _begin_unassign_deployment_resources( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._unassign_deployment_resources_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -2560,17 +2450,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "job_id", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "job_id", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) async def _get_assign_deployment_resources_status( - self, project_name: str, job_id: str, **kwargs: Any + self, job_id: str, **kwargs: Any ) -> _models._models.DeploymentResourcesState: - """Gets the status of an existing assign deployment resources job. + """Gets the status of an existing assign project resources job. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: DeploymentResourcesState. The DeploymentResourcesState is compatible with @@ -2592,8 +2480,8 @@ async def _get_assign_deployment_resources_status( cls: ClsType[_models._models.DeploymentResourcesState] = kwargs.pop("cls", None) _request = build_project_get_assign_deployment_resources_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2633,17 +2521,15 @@ async def _get_assign_deployment_resources_status( @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "job_id", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "job_id", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) async def _get_unassign_deployment_resources_status( # pylint: disable=name-too-long - self, project_name: str, job_id: str, **kwargs: Any + self, job_id: str, **kwargs: Any ) -> _models._models.DeploymentResourcesState: - """Gets the status of an existing unassign deployment resources job. + """Gets the status of an existing unassign project resources job. - :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: DeploymentResourcesState. The DeploymentResourcesState is compatible with @@ -2665,8 +2551,8 @@ async def _get_unassign_deployment_resources_status( # pylint: disable=name-too cls: ClsType[_models._models.DeploymentResourcesState] = kwargs.pop("cls", None) _request = build_project_get_unassign_deployment_resources_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2705,7 +2591,7 @@ async def _get_unassign_deployment_resources_status( # pylint: disable=name-too return deserialized # type: ignore async def _swap_deployments_initial( - self, project_name: str, body: Union[_models._models.SwapDeploymentsDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.SwapDeploymentsDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2729,7 +2615,7 @@ async def _swap_deployments_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_swap_deployments_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -2768,30 +2654,23 @@ async def _swap_deployments_initial( @overload async def _begin_swap_deployments( - self, - project_name: str, - body: _models._models.SwapDeploymentsDetails, - *, - content_type: str = "application/json", - **kwargs: Any + self, body: _models._models.SwapDeploymentsDetails, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_swap_deployments( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_swap_deployments( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @distributed_trace_async async def _begin_swap_deployments( - self, project_name: str, body: Union[_models._models.SwapDeploymentsDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.SwapDeploymentsDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Swaps two existing deployments with each other. - :param project_name: The name of the project to use. Required. - :type project_name: str :param body: The job object to swap two deployments. Is one of the following types: SwapDeploymentsDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.SwapDeploymentsDetails or @@ -2810,13 +2689,7 @@ async def _begin_swap_deployments( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._swap_deployments_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -2848,13 +2721,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async - async def _get_swap_deployments_status( - self, project_name: str, job_id: str, **kwargs: Any - ) -> _models._models.SwapDeploymentsState: + async def _get_swap_deployments_status(self, job_id: str, **kwargs: Any) -> _models._models.SwapDeploymentsState: """Gets the status of an existing swap deployment job. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: SwapDeploymentsState. The SwapDeploymentsState is compatible with MutableMapping @@ -2875,8 +2744,8 @@ async def _get_swap_deployments_status( cls: ClsType[_models._models.SwapDeploymentsState] = kwargs.pop("cls", None) _request = build_project_get_swap_deployments_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2915,11 +2784,9 @@ async def _get_swap_deployments_status( return deserialized # type: ignore @distributed_trace_async - async def _get_project(self, project_name: str, **kwargs: Any) -> _models.ProjectDetails: + async def _get_project(self, **kwargs: Any) -> _models.ProjectDetails: """Gets the details of a project. - :param project_name: The new project name. Required. - :type project_name: str :return: ProjectDetails. The ProjectDetails is compatible with MutableMapping :rtype: ~azure.ai.language.conversations.authoring.models.ProjectDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -2938,7 +2805,7 @@ async def _get_project(self, project_name: str, **kwargs: Any) -> _models.Projec cls: ClsType[_models.ProjectDetails] = kwargs.pop("cls", None) _request = build_project_get_project_request( - project_name=project_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3038,7 +2905,6 @@ async def _get_project_deletion_status(self, job_id: str, **kwargs: Any) -> _mod async def _import_method_initial( self, - project_name: str, body: Union[_models._models.ExportedProject, JSON, IO[bytes]], *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -3066,7 +2932,7 @@ async def _import_method_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_import_method_request( - project_name=project_name, + project_name=self._config.project_name, exported_project_format=exported_project_format, content_type=content_type, api_version=self._config.api_version, @@ -3107,7 +2973,6 @@ async def _import_method_initial( @overload async def _begin_import_method( self, - project_name: str, body: _models._models.ExportedProject, *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -3117,7 +2982,6 @@ async def _begin_import_method( @overload async def _begin_import_method( self, - project_name: str, body: JSON, *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -3127,7 +2991,6 @@ async def _begin_import_method( @overload async def _begin_import_method( self, - project_name: str, body: IO[bytes], *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -3138,7 +3001,6 @@ async def _begin_import_method( @distributed_trace_async async def _begin_import_method( self, - project_name: str, body: Union[_models._models.ExportedProject, JSON, IO[bytes]], *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -3147,8 +3009,6 @@ async def _begin_import_method( """Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - :param project_name: The name of the project to use. Required. - :type project_name: str :param body: The project data to import. Is one of the following types: ExportedProject, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.ExportedProject or JSON @@ -3171,7 +3031,6 @@ async def _begin_import_method( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._import_method_initial( - project_name=project_name, body=body, exported_project_format=exported_project_format, content_type=content_type, @@ -3211,7 +3070,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _export_initial( self, - project_name: str, *, string_index_type: Union[str, _models.StringIndexType], exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -3233,7 +3091,7 @@ async def _export_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_project_export_request( - project_name=project_name, + project_name=self._config.project_name, string_index_type=string_index_type, exported_project_format=exported_project_format, asset_kind=asset_kind, @@ -3275,7 +3133,6 @@ async def _export_initial( @distributed_trace_async async def _begin_export( self, - project_name: str, *, string_index_type: Union[str, _models.StringIndexType], exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -3285,8 +3142,6 @@ async def _begin_export( ) -> AsyncLROPoller[None]: """Triggers a job to export a project's data. - :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 `_. Known values are: "Utf16CodeUnit", "Utf8CodeUnit", @@ -3315,7 +3170,6 @@ async def _begin_export( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._export_initial( - project_name=project_name, string_index_type=string_index_type, exported_project_format=exported_project_format, asset_kind=asset_kind, @@ -3355,13 +3209,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async - async def _get_export_status( - self, project_name: str, job_id: str, **kwargs: Any - ) -> _models._models.ExportProjectState: + async def _get_export_status(self, job_id: str, **kwargs: Any) -> _models._models.ExportProjectState: """Gets the status of an export job. Once job completes, returns the project metadata, and assets. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: ExportProjectState. The ExportProjectState is compatible with MutableMapping @@ -3382,8 +3232,8 @@ async def _get_export_status( cls: ClsType[_models._models.ExportProjectState] = kwargs.pop("cls", None) _request = build_project_get_export_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3424,7 +3274,6 @@ async def _get_export_status( @overload async def _copy_project_authorization( self, - project_name: str, *, project_kind: Union[str, _models.ProjectKind], content_type: str = "application/json", @@ -3434,22 +3283,21 @@ async def _copy_project_authorization( ) -> _models._models.CopyProjectDetails: ... @overload async def _copy_project_authorization( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models._models.CopyProjectDetails: ... @overload async def _copy_project_authorization( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models._models.CopyProjectDetails: ... @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "content_type", "accept"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) async def _copy_project_authorization( self, - project_name: str, body: Union[JSON, IO[bytes]] = _Unset, *, project_kind: Union[str, _models.ProjectKind] = _Unset, @@ -3459,8 +3307,6 @@ async def _copy_project_authorization( ) -> _models._models.CopyProjectDetails: """Generates a copy project operation authorization to the current target Azure resource. - :param project_name: The new project name. Required. - :type project_name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] :keyword project_kind: Represents the project kind. Known values are: "Conversation", @@ -3507,7 +3353,7 @@ async def _copy_project_authorization( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_copy_project_authorization_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3548,12 +3394,12 @@ async def _copy_project_authorization( return deserialized # type: ignore @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) async def _copy_project_initial( - self, project_name: str, body: Union[_models._models.CopyProjectDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.CopyProjectDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3577,7 +3423,7 @@ async def _copy_project_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_copy_project_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3616,35 +3462,28 @@ async def _copy_project_initial( @overload async def _begin_copy_project( - self, - project_name: str, - body: _models._models.CopyProjectDetails, - *, - content_type: str = "application/json", - **kwargs: Any + self, body: _models._models.CopyProjectDetails, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_copy_project( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_copy_project( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) async def _begin_copy_project( - self, project_name: str, body: Union[_models._models.CopyProjectDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.CopyProjectDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Copies an existing project to another Azure resource. - :param project_name: The name of the project to use. Required. - :type project_name: str :param body: The copy project info. Is one of the following types: CopyProjectDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.CopyProjectDetails or @@ -3663,13 +3502,7 @@ async def _begin_copy_project( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._copy_project_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -3702,17 +3535,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "job_id", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "job_id", "accept"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) - async def _get_copy_project_status( - self, project_name: str, job_id: str, **kwargs: Any - ) -> _models._models.CopyProjectState: + async def _get_copy_project_status(self, job_id: str, **kwargs: Any) -> _models._models.CopyProjectState: """Gets the status of an existing copy project job. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: CopyProjectState. The CopyProjectState is compatible with MutableMapping @@ -3733,8 +3562,8 @@ async def _get_copy_project_status( cls: ClsType[_models._models.CopyProjectState] = kwargs.pop("cls", None) _request = build_project_get_copy_project_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3773,7 +3602,7 @@ async def _get_copy_project_status( return deserialized # type: ignore async def _train_initial( - self, project_name: str, body: Union[_models._models.TrainingJobDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.TrainingJobDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3797,7 +3626,7 @@ async def _train_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_train_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3836,30 +3665,23 @@ async def _train_initial( @overload async def _begin_train( - self, - project_name: str, - body: _models._models.TrainingJobDetails, - *, - content_type: str = "application/json", - **kwargs: Any + self, body: _models._models.TrainingJobDetails, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.TrainingJobResult]: ... @overload async def _begin_train( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.TrainingJobResult]: ... @overload async def _begin_train( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.TrainingJobResult]: ... @distributed_trace_async async def _begin_train( - self, project_name: str, body: Union[_models._models.TrainingJobDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.TrainingJobDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.TrainingJobResult]: """Triggers a training job for a project. - :param project_name: The name of the project to use. Required. - :type project_name: str :param body: The training input parameters. Is one of the following types: TrainingJobDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.TrainingJobDetails or @@ -3880,13 +3702,7 @@ async def _begin_train( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._train_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -3928,11 +3744,9 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def _get_training_status(self, project_name: str, job_id: str, **kwargs: Any) -> _models.TrainingState: + async def _get_training_status(self, job_id: str, **kwargs: Any) -> _models.TrainingState: """Gets the status for a training job. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: TrainingState. The TrainingState is compatible with MutableMapping @@ -3953,8 +3767,8 @@ async def _get_training_status(self, project_name: str, job_id: str, **kwargs: A cls: ClsType[_models.TrainingState] = kwargs.pop("cls", None) _request = build_project_get_training_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3990,7 +3804,7 @@ async def _get_training_status(self, project_name: str, job_id: str, **kwargs: A return deserialized # type: ignore - async def _cancel_training_job_initial(self, project_name: str, job_id: str, **kwargs: Any) -> AsyncIterator[bytes]: + async def _cancel_training_job_initial(self, job_id: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4005,8 +3819,8 @@ async def _cancel_training_job_initial(self, project_name: str, job_id: str, **k cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_project_cancel_training_job_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4042,13 +3856,9 @@ async def _cancel_training_job_initial(self, project_name: str, job_id: str, **k return deserialized # type: ignore @distributed_trace_async - async def _begin_cancel_training_job( - self, project_name: str, job_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.TrainingJobResult]: + async def begin_cancel_training_job(self, job_id: str, **kwargs: Any) -> AsyncLROPoller[_models.TrainingJobResult]: """Triggers a cancellation for a running training job. - :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: An instance of AsyncLROPoller that returns TrainingJobResult. The TrainingJobResult is @@ -4066,12 +3876,7 @@ async def _begin_cancel_training_job( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._cancel_training_job_initial( - project_name=project_name, - job_id=job_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + job_id=job_id, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -4134,17 +3939,13 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name", "accept"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name", "accept"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) - async def get_exported_model( - self, project_name: str, exported_model_name: str, **kwargs: Any - ) -> _models.ExportedTrainedModel: + async def get_exported_model(self, exported_model_name: str, **kwargs: Any) -> _models.ExportedTrainedModel: """Gets the details of an exported model. - :param project_name: The new project name. Required. - :type project_name: str :param exported_model_name: The exported model name. Required. :type exported_model_name: str :return: ExportedTrainedModel. The ExportedTrainedModel is compatible with MutableMapping @@ -4165,8 +3966,8 @@ async def get_exported_model( cls: ClsType[_models.ExportedTrainedModel] = kwargs.pop("cls", None) _request = build_exported_model_get_exported_model_request( - project_name=project_name, exported_model_name=exported_model_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4203,13 +4004,11 @@ async def get_exported_model( return deserialized # type: ignore @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) - async def _delete_exported_model_initial( - self, project_name: str, exported_model_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + async def _delete_exported_model_initial(self, exported_model_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4224,8 +4023,8 @@ async def _delete_exported_model_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_exported_model_delete_exported_model_request( - project_name=project_name, exported_model_name=exported_model_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4262,17 +4061,13 @@ async def _delete_exported_model_initial( @distributed_trace_async @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) - async def _begin_delete_exported_model( - self, project_name: str, exported_model_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + async def _begin_delete_exported_model(self, exported_model_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an existing exported model. - :param project_name: The name of the project to use. Required. - :type project_name: str :param exported_model_name: The exported model name. Required. :type exported_model_name: str :return: An instance of AsyncLROPoller that returns None @@ -4288,7 +4083,6 @@ async def _begin_delete_exported_model( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_exported_model_initial( - project_name=project_name, exported_model_name=exported_model_name, cls=lambda x, y, z: x, headers=_headers, @@ -4325,13 +4119,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name", "content_type"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) async def _create_or_update_exported_model_initial( self, - project_name: str, exported_model_name: str, body: Union[_models._models.ExportedModelDetails, JSON, IO[bytes]], **kwargs: Any @@ -4358,8 +4151,8 @@ async def _create_or_update_exported_model_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_exported_model_create_or_update_exported_model_request( - project_name=project_name, exported_model_name=exported_model_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -4399,7 +4192,6 @@ async def _create_or_update_exported_model_initial( @overload async def _begin_create_or_update_exported_model( self, - project_name: str, exported_model_name: str, body: _models._models.ExportedModelDetails, *, @@ -4408,42 +4200,27 @@ async def _begin_create_or_update_exported_model( ) -> AsyncLROPoller[None]: ... @overload async def _begin_create_or_update_exported_model( - self, - project_name: str, - exported_model_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any + self, exported_model_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @overload async def _begin_create_or_update_exported_model( - self, - project_name: str, - exported_model_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any + self, exported_model_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @distributed_trace_async @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name", "content_type"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) async def _begin_create_or_update_exported_model( self, - project_name: str, exported_model_name: str, body: Union[_models._models.ExportedModelDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Creates a new exported model or replaces an existing one. - :param project_name: The name of the project to use. Required. - :type project_name: str :param exported_model_name: The exported model name. Required. :type exported_model_name: str :param body: The exported model info. Is one of the following types: ExportedModelDetails, @@ -4464,7 +4241,6 @@ async def _begin_create_or_update_exported_model( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_exported_model_initial( - project_name=project_name, exported_model_name=exported_model_name, body=body, content_type=content_type, @@ -4504,19 +4280,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async @api_version_validation( - method_added_on="2024-11-15-preview", + method_added_on="2025-05-15-preview", params_added_on={ - "2024-11-15-preview": ["api_version", "project_name", "exported_model_name", "job_id", "accept"] + "2025-05-15-preview": ["api_version", "project_name", "exported_model_name", "job_id", "accept"] }, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) async def _get_exported_model_job_status( - self, project_name: str, exported_model_name: str, job_id: str, **kwargs: Any + self, exported_model_name: str, job_id: str, **kwargs: Any ) -> _models._models.ExportedModelState: """Gets the status for an existing job to create or update an exported model. - :param project_name: The new project name. Required. - :type project_name: str :param exported_model_name: The exported model name. Required. :type exported_model_name: str :param job_id: The job ID. Required. @@ -4539,9 +4313,9 @@ async def _get_exported_model_job_status( cls: ClsType[_models._models.ExportedModelState] = kwargs.pop("cls", None) _request = build_exported_model_get_exported_model_job_status_request( - project_name=project_name, exported_model_name=exported_model_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4600,13 +4374,9 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get_trained_model( - self, project_name: str, trained_model_label: str, **kwargs: Any - ) -> _models.ProjectTrainedModel: + async def get_trained_model(self, trained_model_label: str, **kwargs: Any) -> _models.ProjectTrainedModel: """Gets the details of a trained model. - :param project_name: The new project name. Required. - :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str :return: ProjectTrainedModel. The ProjectTrainedModel is compatible with MutableMapping @@ -4627,8 +4397,8 @@ async def get_trained_model( cls: ClsType[_models.ProjectTrainedModel] = kwargs.pop("cls", None) _request = build_trained_model_get_trained_model_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4665,11 +4435,9 @@ async def get_trained_model( return deserialized # type: ignore @distributed_trace_async - async def delete_trained_model(self, project_name: str, trained_model_label: str, **kwargs: Any) -> None: + async def delete_trained_model(self, trained_model_label: str, **kwargs: Any) -> None: """Deletes an existing trained model. - :param project_name: The new project name. Required. - :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str :return: None @@ -4690,8 +4458,8 @@ async def delete_trained_model(self, project_name: str, trained_model_label: str cls: ClsType[None] = kwargs.pop("cls", None) _request = build_trained_model_delete_trained_model_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4716,16 +4484,12 @@ async def delete_trained_model(self, project_name: str, trained_model_label: str return cls(pipeline_response, None, {}) # type: ignore @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "trained_model_label", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "trained_model_label", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) async def _evaluate_model_initial( - self, - project_name: str, - trained_model_label: str, - body: Union[_models.EvaluationDetails, JSON, IO[bytes]], - **kwargs: Any + self, trained_model_label: str, body: Union[_models.EvaluationDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4749,8 +4513,8 @@ async def _evaluate_model_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_trained_model_evaluate_model_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -4790,7 +4554,6 @@ async def _evaluate_model_initial( @overload async def _begin_evaluate_model( self, - project_name: str, trained_model_label: str, body: _models.EvaluationDetails, *, @@ -4799,42 +4562,24 @@ async def _begin_evaluate_model( ) -> AsyncLROPoller[_models._models.EvaluationJobResult]: ... @overload async def _begin_evaluate_model( - self, - project_name: str, - trained_model_label: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any + self, trained_model_label: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models._models.EvaluationJobResult]: ... @overload async def _begin_evaluate_model( - self, - project_name: str, - trained_model_label: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any + self, trained_model_label: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models._models.EvaluationJobResult]: ... @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "trained_model_label", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "trained_model_label", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) async def _begin_evaluate_model( - self, - project_name: str, - trained_model_label: str, - body: Union[_models.EvaluationDetails, JSON, IO[bytes]], - **kwargs: Any + self, trained_model_label: str, body: Union[_models.EvaluationDetails, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models._models.EvaluationJobResult]: """Triggers evaluation operation on a trained model. - :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 :param body: The training input parameters. Is one of the following types: EvaluationDetails, @@ -4857,7 +4602,6 @@ async def _begin_evaluate_model( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._evaluate_model_initial( - project_name=project_name, trained_model_label=trained_model_label, body=body, content_type=content_type, @@ -4898,19 +4642,17 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models._models.EvaluationJobResult].from_continuation_token( # pylint:disable=protected-access + return AsyncLROPoller[_models._models.EvaluationJobResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models._models.EvaluationJobResult]( # pylint:disable=protected-access + return AsyncLROPoller[_models._models.EvaluationJobResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _load_snapshot_initial( - self, project_name: str, trained_model_label: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + async def _load_snapshot_initial(self, trained_model_label: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4925,8 +4667,8 @@ async def _load_snapshot_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_trained_model_load_snapshot_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4962,13 +4704,9 @@ async def _load_snapshot_initial( return deserialized # type: ignore @distributed_trace_async - async def _begin_load_snapshot( - self, project_name: str, trained_model_label: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + async def _begin_load_snapshot(self, trained_model_label: str, **kwargs: Any) -> AsyncLROPoller[None]: """Restores the snapshot of this trained model to be the current working directory of the project. - :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: An instance of AsyncLROPoller that returns None @@ -4984,7 +4722,6 @@ async def _begin_load_snapshot( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._load_snapshot_initial( - project_name=project_name, trained_model_label=trained_model_label, cls=lambda x, y, z: x, headers=_headers, @@ -5022,19 +4759,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async @api_version_validation( - method_added_on="2023-04-15-preview", + method_added_on="2025-05-15-preview", params_added_on={ - "2023-04-15-preview": ["api_version", "project_name", "trained_model_label", "job_id", "accept"] + "2025-05-15-preview": ["api_version", "project_name", "trained_model_label", "job_id", "accept"] }, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) async def _get_evaluation_status( - self, project_name: str, trained_model_label: str, job_id: str, **kwargs: Any + self, trained_model_label: str, job_id: str, **kwargs: Any ) -> _models._models.EvaluationState: """Gets the status for an evaluation job. - :param project_name: The new project name. Required. - :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str :param job_id: The job ID. Required. @@ -5057,9 +4792,9 @@ async def _get_evaluation_status( cls: ClsType[_models._models.EvaluationState] = kwargs.pop("cls", None) _request = build_trained_model_get_evaluation_status_request( - project_name=project_name, trained_model_label=trained_model_label, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5100,7 +4835,6 @@ async def _get_evaluation_status( @distributed_trace def get_model_evaluation_results( self, - project_name: str, trained_model_label: str, *, string_index_type: Union[str, _models.StringIndexType], @@ -5111,8 +4845,6 @@ def get_model_evaluation_results( """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. - :param project_name: The new project name. 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 @@ -5134,7 +4866,7 @@ def get_model_evaluation_results( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.UtteranceEvaluationResult]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.UtteranceEvaluationResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5148,8 +4880,8 @@ def prepare_request(next_link=None): if not next_link: _request = build_trained_model_get_model_evaluation_results_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, string_index_type=string_index_type, top=top, skip=skip, @@ -5189,7 +4921,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.UtteranceEvaluationResult], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.UtteranceEvaluationResult], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -5212,14 +4944,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_model_evaluation_summary( - self, project_name: str, trained_model_label: str, **kwargs: Any - ) -> _models.EvalSummary: + async def get_model_evaluation_summary(self, trained_model_label: str, **kwargs: Any) -> _models.EvalSummary: """Gets the evaluation summary of a trained model. The summary includes high level performance measurements of the model e.g., F1, Precision, Recall, etc. - :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: EvalSummary. The EvalSummary is compatible with MutableMapping @@ -5240,8 +4968,8 @@ async def get_model_evaluation_summary( cls: ClsType[_models.EvalSummary] = kwargs.pop("cls", None) _request = build_trained_model_get_model_evaluation_summary_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5279,12 +5007,10 @@ async def get_model_evaluation_summary( @distributed_trace_async async def _get_load_snapshot_status( - self, project_name: str, trained_model_label: str, job_id: str, **kwargs: Any + self, trained_model_label: str, job_id: str, **kwargs: Any ) -> _models._models.LoadSnapshotState: """Gets the status for loading a snapshot. - :param project_name: The new project name. Required. - :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str :param job_id: The job ID. Required. @@ -5307,9 +5033,9 @@ async def _get_load_snapshot_status( cls: ClsType[_models._models.LoadSnapshotState] = kwargs.pop("cls", None) _request = build_trained_model_get_load_snapshot_status_request( - project_name=project_name, trained_model_label=trained_model_label, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_patch.py index 43cd6bc6524b..87676c65a8f0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_patch.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,10 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from ._project_op_patch import ProjectOperations -from ._trained_model_op_patch import TrainedModelOperations -from ._deployment_op_patch import DeploymentOperations -from ._exported_model_op_patch import ExportedModelOperations + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): @@ -21,6 +19,3 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ - - -__all__ = ["ProjectOperations", "DeploymentOperations", "ExportedModelOperations", "TrainedModelOperations"] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_project_op_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_project_op_patch.py deleted file mode 100644 index d796a038c888..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_project_op_patch.py +++ /dev/null @@ -1,913 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from collections.abc import MutableMapping # pylint:disable=import-error -from typing import IO, Any, Callable, Dict, Optional, TypeVar, Union, cast, overload - -from azure.core.async_paging import AsyncItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async - -from ..._utils.model_base import _deserialize -from ...models._patch import _AsyncJobsPollingMethod -from ...models import ( - AssignedDeploymentResource, - AssignDeploymentResourcesDetails, - CopyProjectDetails, - CopyProjectState, - DeploymentResourcesState, - ExportProjectState, - ExportedProject, - ExportedProjectFormat, - ExportedTrainedModel, - ProjectDeletionState, - ProjectDeployment, - ProjectDetails, - ProjectKind, - ProjectTrainedModel, - StringIndexType, - SwapDeploymentsDetails, - SwapDeploymentsState, - TrainingJobDetails, - TrainingJobResult, - TrainingState, - UnassignDeploymentResourcesDetails, -) -from ._operations import ProjectOperations as ProjectOperationsGenerated - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -_Unset: Any = object() -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - - -class ProjectOperations(ProjectOperationsGenerated): - """Patched ProjectOperationsOperations that auto-injects project_name.""" - - def __init__(self, *args, project_name: str, **kwargs: Any): - super().__init__(*args, **kwargs) - self._project_name = project_name - - @overload - async def begin_import( - self, - body: ExportedProject, - *, - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """ - Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - - :param body: The project data to import. Required. - :type body: ~azure.ai.language.conversations.authoring.models.ExportedProject - :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 or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_import( - self, - body: JSON, - *, - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """ - Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - - :param body: The project data to import. Required. - :type body: JSON - :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 or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_import( - self, - body: IO[bytes], - *, - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """ - Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - - :param body: The project data to import. Required. - :type body: IO[bytes] - :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 or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @distributed_trace_async - async def begin_import( - self, - body: Union[ExportedProject, JSON, IO[bytes]], - *, - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """ - Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - - :param body: The project data to import. Required. - :type body: ~azure.ai.language.conversations.authoring.models.ExportedProject or JSON or IO[bytes] - :keyword exported_project_format: The format of the exported project file to use. Known values are: "Conversation" and "Luis". - :paramtype exported_project_format: str or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - return await super()._begin_import_method( - project_name=self._project_name, - body=body, - exported_project_format=exported_project_format, - content_type=content_type, - **kwargs, - ) - - @overload - async def begin_assign_deployment_resources( - self, body: AssignDeploymentResourcesDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. This API is - available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, check here: - `https://learn.microsoft.com/en-us/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory - `_. - - :param body: The new project resources info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.AssignDeploymentResourcesDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_assign_deployment_resources( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. This API is - available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, check here: - `https://learn.microsoft.com/en-us/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory - `_. - - :param body: The new project resources info. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_assign_deployment_resources( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. This API is - available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, check here: - `https://learn.microsoft.com/en-us/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory - `_. - - :param body: The new project resources info. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_assign_deployment_resources( - self, body: Union[AssignDeploymentResourcesDetails, JSON, IO[bytes]], *, content_type: str = "application/json",**kwargs: Any - ) -> AsyncLROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. - This API is available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, see: - https://learn.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory - - :param body: The new project resources info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.AssignDeploymentResourcesDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_assign_deployment_resources( - project_name=self._project_name, body=body, content_type=content_type, **kwargs - ) - - @overload - async def begin_swap_deployments( - self, body: SwapDeploymentsDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Swaps two existing deployments with each other. - - :param body: The job object to swap two deployments. Required. - :type body: ~azure.ai.language.conversations.authoring.models.SwapDeploymentsDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_swap_deployments( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Swaps two existing deployments with each other. - - :param body: The job object to swap two deployments. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_swap_deployments( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Swaps two existing deployments with each other. - - :param body: The job object to swap two deployments. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_swap_deployments( - self, body: Union[SwapDeploymentsDetails, JSON, IO[bytes]], *, content_type: str = "application/json",**kwargs: Any - ) -> AsyncLROPoller[None]: - """Swaps two existing deployments with each other. - - :param body: The job object to swap two deployments. Required. - :type body: ~azure.ai.language.conversations.authoring.models.SwapDeploymentsDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_swap_deployments( - project_name=self._project_name, body=body, content_type=content_type, **kwargs - ) - - @overload - async def begin_unassign_deployment_resources( - self, body: UnassignDeploymentResourcesDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. - - :param body: The info for the deployment resources to be deleted. Required. - :type body: ~azure.ai.language.conversations.authoring.models.UnassignDeploymentResourcesDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_unassign_deployment_resources( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. - - :param body: The info for the deployment resources to be deleted. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_unassign_deployment_resources( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. - - :param body: The info for the deployment resources to be deleted. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_unassign_deployment_resources( - self, body: Union[UnassignDeploymentResourcesDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. - - :param body: The info for the deployment resources to be deleted. Required. - :type body: ~azure.ai.language.conversations.authoring.models.UnassignDeploymentResourcesDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_unassign_deployment_resources( - project_name=self._project_name, body=body, content_type=content_type, **kwargs - ) - - @distributed_trace_async - async def begin_cancel_training_job( # type: ignore[override] - self, - job_id: str, - **kwargs: Any - ) -> AsyncLROPoller[TrainingJobResult]: - """ - Cancel a training job. - - :param job_id: The identifier of the training job to cancel. Required. - :type job_id: str - :return: An instance of AsyncLROPoller that returns TrainingJobResult. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[TrainingJobResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - - if cont_token is None: - # Fire the initial cancel request; keep PipelineResponse for the poller - initial = await self._cancel_training_job_initial( # returns PipelineResponse - project_name=self._project_name, - job_id=job_id, - cls=lambda x, y, z: x, # passthrough PipelineResponse - headers=_headers, - params=_params, - **kwargs, - ) - await initial.http_response.read() # type: ignore[attr-defined] - kwargs.pop("error_map", None) - - # Deserialization callback: map the nested "result" object to TrainingJobResult - def get_long_running_output(pipeline_response): - body = pipeline_response.http_response.json() or {} - result_dict = body.get("result", {}) or {} - obj = _deserialize(TrainingJobResult, result_dict) - if cls: - return cls(pipeline_response, obj, {}) # type: ignore[misc] - return obj - - path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - _AsyncJobsPollingMethod( - polling_interval=lro_delay, - path_format_arguments=path_format_arguments, - ), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - - if cont_token: - return AsyncLROPoller[TrainingJobResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - - return AsyncLROPoller[TrainingJobResult]( - self._client, - initial, # type: ignore - get_long_running_output, - polling_method, # type: ignore[arg-type] - ) - - @overload - async def begin_copy_project( - self, body: CopyProjectDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Copies an existing project to another Azure resource. - - :param body: The copy project info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_copy_project( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Copies an existing project to another Azure resource. - - :param body: The copy project info. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_copy_project( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Copies an existing project to another Azure resource. - - :param body: The copy project info. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @distributed_trace_async - async def begin_copy_project( - self, body: Union[CopyProjectDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Copies an existing project to another Azure resource. - - :param body: The copy project info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails or JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - return await super()._begin_copy_project( - project_name=self._project_name, body=body, content_type=content_type, **kwargs - ) - - @overload - async def begin_train( - self, body: TrainingJobDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[TrainingJobResult]: - """ - Triggers a training job for a project. - - :param body: The training input parameters. Required. - :type body: ~azure.ai.language.conversations.authoring.models.TrainingJobDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns TrainingJobResult. The TrainingJobResult is compatible with MutableMapping. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_train( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[TrainingJobResult]: - """ - Triggers a training job for a project. - - :param body: The training input parameters. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns TrainingJobResult. The TrainingJobResult is compatible with MutableMapping. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - async def begin_train( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[TrainingJobResult]: - """ - Triggers a training job for a project. - - :param body: The training input parameters. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns TrainingJobResult. The TrainingJobResult is compatible with MutableMapping. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @distributed_trace_async - async def begin_train( # type: ignore[override] - self, body: Union[TrainingJobDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[TrainingJobResult]: - """ - Triggers a training job for a project. - - :param body: The training job request payload. - :type body: ~azure.ai.language.conversations.authoring.models.TrainingJobDetails or JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON or binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns TrainingJobResult. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - return await super()._begin_train( - project_name=self._project_name, body=body, content_type=content_type, **kwargs - ) - - @distributed_trace_async - async def begin_export( - self, - *, - string_index_type: Union[str, StringIndexType], - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - asset_kind: Optional[str] = None, - trained_model_label: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Triggers a job to export a project's data. - - :keyword string_index_type: Specifies the method used to interpret string offsets. See - https://aka.ms/text-analytics-offsets. Known values: "Utf16CodeUnit", "Utf8CodeUnit", - "Utf32CodeUnit". Required. - :paramtype string_index_type: str or ~azure.ai.language.conversations.authoring.models.StringIndexType - :keyword exported_project_format: The export format. Known values: "Conversation", "Luis". - :paramtype exported_project_format: str or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword asset_kind: Kind of asset to export. - :paramtype asset_kind: str - :keyword trained_model_label: Trained model label to export. If None, exports the working copy. - :paramtype trained_model_label: str - :return: An instance of AsyncLROPoller that returns None. - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_export( - project_name=self._project_name, - asset_kind=asset_kind, - exported_project_format=exported_project_format, - string_index_type=string_index_type, - trained_model_label=trained_model_label, - **kwargs, - ) - - @overload - async def copy_project_authorization( - self, - *, - project_kind: Union[str, ProjectKind], - content_type: str = "application/json", - storage_input_container_name: Optional[str] = None, - allow_overwrite: Optional[bool] = None, - **kwargs: Any - ) -> CopyProjectDetails: - """Generates a copy project operation authorization to the current target Azure resource. - - :keyword project_kind: Represents the project kind. Known values are: "Conversation", - "Orchestration", and "CustomConversationSummarization". Required. - :paramtype project_kind: str or ~azure.ai.language.conversations.authoring.models.ProjectKind - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword storage_input_container_name: The name of the storage container. Default value is - None. - :paramtype storage_input_container_name: str - :keyword allow_overwrite: Whether to allow an existing project to be overwritten using the - resulting copy authorization. Default value is None. - :paramtype allow_overwrite: bool - :return: CopyProjectDetails. The CopyProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def copy_project_authorization( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> CopyProjectDetails: - """Generates a copy project operation authorization to the current target Azure resource. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CopyProjectDetails. The CopyProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def copy_project_authorization( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> CopyProjectDetails: - """Generates a copy project operation authorization to the current target Azure resource. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CopyProjectDetails. The CopyProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def copy_project_authorization( # type: ignore[override] - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - allow_overwrite: Optional[bool] = _Unset, - project_kind: Union[str, Any] = _Unset, - storage_input_container_name: Optional[str] = _Unset, - **kwargs: Any - ) -> CopyProjectDetails: - """Generates a copy project operation authorization to the current target Azure resource. - - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword project_kind: Represents the project kind. Known values are: "Conversation", - "Orchestration", and "CustomConversationSummarization". Required. - :paramtype project_kind: str or ~azure.ai.language.conversations.authoring.models.ProjectKind - :keyword storage_input_container_name: The name of the storage container. Default value is - None. - :paramtype storage_input_container_name: str - :keyword allow_overwrite: Whether to allow an existing project to be overwritten using the - resulting copy authorization. Default value is None. - :paramtype allow_overwrite: bool - :return: CopyProjectDetails. The CopyProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.CopyProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._copy_project_authorization( - project_name=self._project_name, - body=body, - allow_overwrite=allow_overwrite, - project_kind=project_kind, - storage_input_container_name=storage_input_container_name, - **kwargs, - ) - - @distributed_trace_async - async def _get_assign_deployment_resources_status( # type: ignore[override] - self, job_id: str, **kwargs: Any - ) -> DeploymentResourcesState: - """Gets the status of an existing assign deployment resources job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: DeploymentResourcesState. The DeploymentResourcesState is compatible with - MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.DeploymentResourcesState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_assign_deployment_resources_status( - project_name=self._project_name, job_id=job_id, **kwargs - ) - - @distributed_trace_async - async def _get_copy_project_status(self, job_id: str, **kwargs: Any) -> CopyProjectState: # type: ignore[override] - """Gets the status of an existing copy project job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: CopyProjectState. The CopyProjectState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.CopyProjectState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_copy_project_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace_async - async def _get_export_status(self, job_id: str, **kwargs: Any) -> ExportProjectState: # type: ignore[override] - """Gets the status of an export job. Once job completes, returns the project metadata, and assets. - - :param job_id: The job ID. Required. - :type job_id: str - :return: ExportProjectState. The ExportProjectState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.ExportProjectState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_export_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace_async - async def get_project(self, **kwargs: Any) -> ProjectDetails: # type: ignore[override] - """Gets the details of a project. - - :return: ProjectDetails. The ProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.ProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_project(project_name=self._project_name, **kwargs) - - @distributed_trace_async - async def _get_project_deletion_status(self, job_id: str, **kwargs: Any) -> ProjectDeletionState: # type: ignore[override] - """Gets the status for a project deletion job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: ProjectDeletionState. The ProjectDeletionState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.ProjectDeletionState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_project_deletion_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace_async - async def _get_swap_deployments_status(self, job_id: str, **kwargs: Any) -> SwapDeploymentsState: # type: ignore[override] - """Gets the status of an existing swap deployment job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: SwapDeploymentsState. The SwapDeploymentsState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.SwapDeploymentsState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_swap_deployments_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace_async - async def _get_training_status(self, job_id: str, **kwargs: Any) -> TrainingState: # type: ignore[override] - """Gets the status for a training job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: TrainingState. The TrainingState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.TrainingState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_training_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace_async - async def _get_unassign_deployment_resources_status( # type: ignore[override] - self, job_id: str, **kwargs: Any - ) -> DeploymentResourcesState: - """Gets the status of an existing unassign deployment resources job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: DeploymentResourcesState. The DeploymentResourcesState is compatible with - MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.DeploymentResourcesState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_unassign_deployment_resources_status( - project_name=self._project_name, job_id=job_id, **kwargs - ) - - @distributed_trace - def list_deployment_resources( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> AsyncItemPaged[AssignedDeploymentResource]: - """Lists the deployments resources assigned to the project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of AssignedDeploymentResource - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.language.conversations.authoring.models.AssignedDeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_deployment_resources(project_name=self._project_name, skip=skip, top=top, **kwargs) - - @distributed_trace - def list_deployments( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> AsyncItemPaged[ProjectDeployment]: - """Lists the deployments belonging to a project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of ProjectDeployment - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.language.conversations.authoring.models.ProjectDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_deployments(project_name=self._project_name, skip=skip, top=top, **kwargs) - - @distributed_trace - def list_exported_models( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> AsyncItemPaged[ExportedTrainedModel]: - """Lists the exported models belonging to a project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of ExportedTrainedModel - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.language.conversations.authoring.models.ExportedTrainedModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_exported_models(project_name=self._project_name, skip=skip, top=top, **kwargs) - - @distributed_trace - def list_trained_models( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> AsyncItemPaged[ProjectTrainedModel]: - """Lists the trained models belonging to a project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of ProjectTrainedModel - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.language.conversations.authoring.models.ProjectTrainedModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_trained_models(project_name=self._project_name, skip=skip, top=top, **kwargs) - - @distributed_trace - def list_training_jobs( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> AsyncItemPaged[TrainingState]: - """Lists the non-expired training jobs created for a project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of TrainingState - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.language.conversations.authoring.models.TrainingState] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_training_jobs(project_name=self._project_name, skip=skip, top=top, **kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_trained_model_op_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_trained_model_op_patch.py deleted file mode 100644 index 77812219d78e..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/aio/operations/_trained_model_op_patch.py +++ /dev/null @@ -1,288 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -from collections.abc import MutableMapping # pylint:disable=import-error -from typing import IO, Any, Callable, Dict, Optional, TypeVar, Union, overload - -from azure.core.async_paging import AsyncItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async - -from ...models import ( - EvalSummary, - EvaluationDetails, - EvaluationJobResult, - EvaluationState, - LoadSnapshotState, - ProjectTrainedModel, - StringIndexType, - UtteranceEvaluationResult, -) -from ._operations import TrainedModelOperations as TrainedModelOperationsGenerated - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - - -class TrainedModelOperations(TrainedModelOperationsGenerated): - - def __init__(self, *args, project_name: str, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._project_name = project_name - - @overload - async def begin_evaluate_model( - self, - trained_model_label: str, - body: EvaluationDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[EvaluationJobResult]: - """Triggers evaluation operation on a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param body: The training input parameters. Required. - :type body: ~azure.ai.language.conversations.authoring.models.EvaluationDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns EvaluationJobResult. The EvaluationJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.ai.language.conversations.authoring.models.EvaluationJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_evaluate_model( - self, trained_model_label: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[EvaluationJobResult]: - """Triggers evaluation operation on a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param body: The training input parameters. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns EvaluationJobResult. The EvaluationJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.ai.language.conversations.authoring.models.EvaluationJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_evaluate_model( - self, trained_model_label: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[EvaluationJobResult]: - """Triggers evaluation operation on a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param body: The training input parameters. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns EvaluationJobResult. The EvaluationJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.ai.language.conversations.authoring.models.EvaluationJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - async def begin_evaluate_model( # type: ignore[override] - self, - trained_model_label: str, - body: Union[EvaluationDetails, JSON, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[EvaluationJobResult]: - """Triggers evaluation operation on a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param body: The training input parameters. Is one of the following types: EvaluationDetails, - JSON, IO[bytes] Required. - :type body: ~azure.ai.language.conversations.authoring.models.EvaluationDetails or JSON or - IO[bytes] - :return: An instance of AsyncLROPoller that returns EvaluationJobResult. The - EvaluationJobResult is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.ai.language.conversations.authoring.models._models.EvaluationJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_evaluate_model( - project_name=self._project_name, - trained_model_label=trained_model_label, - body=body, - **kwargs, - ) - - @distributed_trace_async - async def begin_load_snapshot(self, trained_model_label: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Restores the snapshot of this trained model to be the current working directory of the project. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._begin_load_snapshot( - project_name=self._project_name, - trained_model_label=trained_model_label, - **kwargs, - ) - - @distributed_trace_async - async def delete_trained_model(self, trained_model_label: str, **kwargs: Any) -> None: # type: ignore[override] - """Deletes an existing trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super().delete_trained_model( - project_name=self._project_name, - trained_model_label=trained_model_label, - **kwargs, - ) - - @distributed_trace_async - async def _get_evaluation_status( # type: ignore[override] - self, trained_model_label: str, job_id: str, **kwargs: Any - ) -> EvaluationState: - """Gets the status for an evaluation job. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param job_id: The job ID. Required. - :type job_id: str - :return: EvaluationState. The EvaluationState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.EvaluationState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_evaluation_status( - project_name=self._project_name, - trained_model_label=trained_model_label, - job_id=job_id, - **kwargs, - ) - - @distributed_trace_async - async def _get_load_snapshot_status( # type: ignore[override] - self, trained_model_label: str, job_id: str, **kwargs: Any - ) -> LoadSnapshotState: - """Gets the status for loading a snapshot. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param job_id: The job ID. Required. - :type job_id: str - :return: LoadSnapshotState. The LoadSnapshotState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.LoadSnapshotState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super()._get_load_snapshot_status( - project_name=self._project_name, - trained_model_label=trained_model_label, - job_id=job_id, - **kwargs, - ) - - @distributed_trace - def get_model_evaluation_results( # type: ignore[override] - self, - trained_model_label: str, - *, - skip: Optional[int] = None, - string_index_type: Union[str, StringIndexType], - top: Optional[int] = None, - **kwargs: Any - ) -> AsyncItemPaged[UtteranceEvaluationResult]: - """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. - - :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 - `_. Known values are: "Utf16CodeUnit", "Utf8CodeUnit", - and "Utf32CodeUnit". Required. - :paramtype string_index_type: str or - ~azure.ai.language.conversations.authoring.models.StringIndexType - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of UtteranceEvaluationResult - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.language.conversations.authoring.models.UtteranceEvaluationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().get_model_evaluation_results( - project_name=self._project_name, - trained_model_label=trained_model_label, - skip=skip, - string_index_type=string_index_type, - top=top, - **kwargs, - ) - - @distributed_trace_async - async def get_model_evaluation_summary( # type: ignore[override] - self, trained_model_label: str, **kwargs: Any - ) -> EvalSummary: - """Gets the evaluation summary of a trained model. The summary includes high level performance - measurements of the model e.g., F1, Precision, Recall, etc. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :return: EvalSummary. The EvalSummary is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.EvalSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super().get_model_evaluation_summary( - project_name=self._project_name, - trained_model_label=trained_model_label, - **kwargs, - ) - - @distributed_trace_async - async def get_trained_model( # type: ignore[override] - self, trained_model_label: str, **kwargs: Any - ) -> ProjectTrainedModel: - """Gets the details of a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :return: ProjectTrainedModel. The ProjectTrainedModel is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.ProjectTrainedModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - return await super().get_trained_model( - project_name=self._project_name, - trained_model_label=trained_model_label, - **kwargs, - ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/__init__.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/__init__.py index dace41355e12..6115d15497a5 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/__init__.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/__init__.py @@ -20,8 +20,6 @@ ConfusionMatrixCell, ConfusionMatrixRow, CreateProjectOptions, - DataGenerationConnectionInfo, - DeploymentResource, EntitiesEvaluationSummary, EntityEvaluationSummary, EvalSummary, @@ -46,7 +44,6 @@ ) from ._enums import ( # type: ignore - DataGenerationConnectionKind, EvaluationKind, OperationStatus, ProjectKind, @@ -64,8 +61,6 @@ "ConfusionMatrixCell", "ConfusionMatrixRow", "CreateProjectOptions", - "DataGenerationConnectionInfo", - "DeploymentResource", "EntitiesEvaluationSummary", "EntityEvaluationSummary", "EvalSummary", @@ -87,7 +82,6 @@ "UtteranceEntityEvaluationResult", "UtteranceEvaluationResult", "UtteranceIntentsEvaluationResult", - "DataGenerationConnectionKind", "EvaluationKind", "OperationStatus", "ProjectKind", diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_models.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_models.py index a05f16c35078..588388782d2a 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_models.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_models.py @@ -9,7 +9,7 @@ # pylint: disable=useless-super-delegation import datetime -from typing import Any, Dict, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload +from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload from azure.core.exceptions import ODataV4Format @@ -21,23 +21,23 @@ class AssignDeploymentResourcesDetails(_Model): - """Represents the options for assigning Azure resources to a project. + """Represents the payload for assigning Azure resources to a project. - :ivar metadata: Represents the metadata for the resources to be assigned. Required. + :ivar metadata: Represents the metadata for the project resources to be assigned. Required. :vartype metadata: list[~azure.ai.language.conversations.authoring.models._models.ResourceMetadata] """ - metadata: List["_models._models.ResourceMetadata"] = rest_field( - name="resourcesMetadata", visibility=["read", "create", "update", "delete", "query"] + metadata: list["_models._models.ResourceMetadata"] = rest_field( + name="projectResources", visibility=["read", "create", "update", "delete", "query"] ) - """Represents the metadata for the resources to be assigned. Required.""" + """Represents the metadata for the project resources to be assigned. Required.""" @overload def __init__( self, *, - metadata: List["_models._models.ResourceMetadata"], + metadata: list["_models._models.ResourceMetadata"], ) -> None: ... @overload @@ -52,18 +52,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class AssignedDeploymentResource(_Model): - """Represents the assigned deployment resource. + """Represents the assigned project resource. - :ivar resource_id: The resource ID. Required. + :ivar resource_id: The Azure resource ID of the language or AI resource. Required. :vartype resource_id: str - :ivar region: The resource region. Required. + :ivar region: The Azure resource region. Required. :vartype region: str """ resource_id: str = rest_field(name="azureResourceId", visibility=["read"]) - """The resource ID. Required.""" + """The Azure resource ID of the language or AI resource. Required.""" region: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The resource region. Required.""" + """The Azure resource region. Required.""" @overload def __init__( @@ -137,7 +137,7 @@ class AssignedProjectDeploymentsMetadata(_Model): project_name: str = rest_field(name="projectName", visibility=["read"]) """Represents the project name. Required.""" - deployments_metadata: List["_models.AssignedProjectDeploymentMetadata"] = rest_field( + deployments_metadata: list["_models.AssignedProjectDeploymentMetadata"] = rest_field( name="deploymentsMetadata", visibility=["read", "create", "update", "delete", "query"] ) """Represents the resource region. Required.""" @@ -146,7 +146,7 @@ class AssignedProjectDeploymentsMetadata(_Model): def __init__( self, *, - deployments_metadata: List["_models.AssignedProjectDeploymentMetadata"], + deployments_metadata: list["_models.AssignedProjectDeploymentMetadata"], ) -> None: ... @overload @@ -265,7 +265,7 @@ class ConversationExportedEntity(_Model): visibility=["read", "create", "update", "delete", "query"] ) """The list component of the entity.""" - prebuilts: Optional[List["_models._models.ExportedPrebuiltEntity"]] = rest_field( + prebuilts: Optional[list["_models._models.ExportedPrebuiltEntity"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The prebuilt entities components.""" @@ -273,7 +273,7 @@ class ConversationExportedEntity(_Model): visibility=["read", "create", "update", "delete", "query"] ) """The regex component of the entity.""" - required_components: Optional[List[str]] = rest_field( + required_components: Optional[list[str]] = rest_field( name="requiredComponents", visibility=["read", "create", "update", "delete", "query"] ) """The required components. Allowed values are 'learned', 'list', 'prebuilts' and 'regex'.""" @@ -286,9 +286,9 @@ def __init__( description: Optional[str] = None, composition_mode: Optional[Union[str, "_models._enums.CompositionMode"]] = None, entities: Optional["_models._models.ExportedEntityList"] = None, - prebuilts: Optional[List["_models._models.ExportedPrebuiltEntity"]] = None, + prebuilts: Optional[list["_models._models.ExportedPrebuiltEntity"]] = None, regex: Optional["_models._models.ExportedEntityRegex"] = None, - required_components: Optional[List[str]] = None, + required_components: Optional[list[str]] = None, ) -> None: ... @overload @@ -318,7 +318,7 @@ class ConversationExportedIntent(_Model): """The intent category. Required.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The intent description.""" - associated_entities: Optional[List["_models._models.ConversationExportedAssociatedEntityLabel"]] = rest_field( + associated_entities: Optional[list["_models._models.ConversationExportedAssociatedEntityLabel"]] = rest_field( name="associatedEntities", visibility=["read", "create", "update", "delete", "query"] ) """The list of associated entities.""" @@ -329,7 +329,7 @@ def __init__( *, category: str, description: Optional[str] = None, - associated_entities: Optional[List["_models._models.ConversationExportedAssociatedEntityLabel"]] = None, + associated_entities: Optional[list["_models._models.ConversationExportedAssociatedEntityLabel"]] = None, ) -> None: ... @overload @@ -354,7 +354,7 @@ class ExportedProjectAsset(_Model): :vartype project_kind: str or ~azure.ai.language.conversations.authoring.models.ProjectKind """ - __mapping__: Dict[str, _Model] = {} + __mapping__: dict[str, _Model] = {} project_kind: str = rest_discriminator( name="projectKind", visibility=["read", "create", "update", "delete", "query"] ) @@ -396,15 +396,15 @@ class ConversationExportedProjectAsset(ExportedProjectAsset, discriminator="Conv :vartype project_kind: str or ~azure.ai.language.conversations.authoring.models.CONVERSATION """ - intents: Optional[List["_models._models.ConversationExportedIntent"]] = rest_field( + intents: Optional[list["_models._models.ConversationExportedIntent"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The intents defined in the project.""" - entities: Optional[List["_models._models.ConversationExportedEntity"]] = rest_field( + entities: Optional[list["_models._models.ConversationExportedEntity"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The entities defined in the project.""" - utterances: Optional[List["_models._models.ConversationExportedUtterance"]] = rest_field( + utterances: Optional[list["_models._models.ConversationExportedUtterance"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The utterances defined in the project.""" @@ -416,9 +416,9 @@ class ConversationExportedProjectAsset(ExportedProjectAsset, discriminator="Conv def __init__( self, *, - intents: Optional[List["_models._models.ConversationExportedIntent"]] = None, - entities: Optional[List["_models._models.ConversationExportedEntity"]] = None, - utterances: Optional[List["_models._models.ConversationExportedUtterance"]] = None, + intents: Optional[list["_models._models.ConversationExportedIntent"]] = None, + entities: Optional[list["_models._models.ConversationExportedEntity"]] = None, + utterances: Optional[list["_models._models.ConversationExportedUtterance"]] = None, ) -> None: ... @overload @@ -429,7 +429,8 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, project_kind=ProjectKind.CONVERSATION, **kwargs) + super().__init__(*args, **kwargs) + self.project_kind = ProjectKind.CONVERSATION # type: ignore class ConversationExportedUtterance(_Model): @@ -450,7 +451,7 @@ class ConversationExportedUtterance(_Model): :vartype dataset: str or ~azure.ai.language.conversations.authoring.models.DatasetType """ - entities: Optional[List["_models._models.ExportedUtteranceEntityLabel"]] = rest_field( + entities: Optional[list["_models._models.ExportedUtteranceEntityLabel"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """Represents the entity labels of the utterance.""" @@ -473,7 +474,7 @@ def __init__( *, text: str, intent: str, - entities: Optional[List["_models._models.ExportedUtteranceEntityLabel"]] = None, + entities: Optional[list["_models._models.ExportedUtteranceEntityLabel"]] = None, language: Optional[str] = None, dataset: Optional[Union[str, "_models._enums.DatasetType"]] = None, ) -> None: ... @@ -593,9 +594,9 @@ class CopyProjectState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" @overload @@ -606,8 +607,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -630,14 +631,14 @@ class CreateDeploymentDetails(_Model): provided, the deployment will be rolled out to the resources provided here as well as the original resource in which the project is created. :vartype assigned_resources: - list[~azure.ai.language.conversations.authoring.models.DeploymentResource] + list[~azure.ai.language.conversations.authoring.models._models.DeploymentResource] """ trained_model_label: str = rest_field( name="trainedModelLabel", visibility=["read", "create", "update", "delete", "query"] ) """Represents the trained model label. Required.""" - assigned_resources: Optional[List["_models.DeploymentResource"]] = rest_field( + assigned_resources: Optional[list["_models._models.DeploymentResource"]] = rest_field( name="assignedResources", visibility=["read", "create", "update", "delete", "query"] ) """Represents the resources to be assigned to the deployment. If provided, the deployment will be @@ -649,7 +650,7 @@ def __init__( self, *, trained_model_label: str, - assigned_resources: Optional[List["_models.DeploymentResource"]] = None, + assigned_resources: Optional[list["_models._models.DeploymentResource"]] = None, ) -> None: ... @overload @@ -747,7 +748,7 @@ class DataGenerationConnectionInfo(_Model): :vartype resource_id: str """ - kind: Union[str, "_models.DataGenerationConnectionKind"] = rest_field( + kind: Union[str, "_models._enums.DataGenerationConnectionKind"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """Connection type for data generation settings. Currently only supports Azure OpenAI. Required. @@ -764,7 +765,7 @@ class DataGenerationConnectionInfo(_Model): def __init__( self, *, - kind: Union[str, "_models.DataGenerationConnectionKind"], + kind: Union[str, "_models._enums.DataGenerationConnectionKind"], deployment_name: str, resource_id: Optional[str] = None, ) -> None: ... @@ -789,14 +790,14 @@ class DataGenerationSettings(_Model): :ivar data_generation_connection_info: Must be filled out to enable data generation to augment training data. Required. :vartype data_generation_connection_info: - ~azure.ai.language.conversations.authoring.models.DataGenerationConnectionInfo + ~azure.ai.language.conversations.authoring.models._models.DataGenerationConnectionInfo """ enable_data_generation: bool = rest_field( name="enableDataGeneration", visibility=["read", "create", "update", "delete", "query"] ) """Must be explicitly set to True to enable data generation to augment training data. Required.""" - data_generation_connection_info: "_models.DataGenerationConnectionInfo" = rest_field( + data_generation_connection_info: "_models._models.DataGenerationConnectionInfo" = rest_field( name="dataGenerationConnectionInfo", visibility=["read", "create", "update", "delete", "query"] ) """Must be filled out to enable data generation to augment training data. Required.""" @@ -806,7 +807,7 @@ def __init__( self, *, enable_data_generation: bool, - data_generation_connection_info: "_models.DataGenerationConnectionInfo", + data_generation_connection_info: "_models._models.DataGenerationConnectionInfo", ) -> None: ... @overload @@ -821,27 +822,24 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class DeleteDeploymentDetails(_Model): - """Represents the options for deleting a project deployment. + """Represents the payload for deleting a project deployment. - :ivar assigned_resource_ids: Represents the resource IDs to delete the deployment from. If not - provided, the deployment will be rolled out from all the resources it is deployed to. If - provided, it will delete the deployment only from the specified assigned resources, and leave - it for the rest. + :ivar assigned_resource_ids: Represents the Language or AIService resource IDs to unassign from + the project or delete the deployment from. :vartype assigned_resource_ids: list[str] """ - assigned_resource_ids: Optional[List[str]] = rest_field( + assigned_resource_ids: Optional[list[str]] = rest_field( name="assignedResourceIds", visibility=["read", "create", "update", "delete", "query"] ) - """Represents the resource IDs to delete the deployment from. If not provided, the deployment will - be rolled out from all the resources it is deployed to. If provided, it will delete the - deployment only from the specified assigned resources, and leave it for the rest.""" + """Represents the Language or AIService resource IDs to unassign from the project or delete the + deployment from.""" @overload def __init__( self, *, - assigned_resource_ids: Optional[List[str]] = None, + assigned_resource_ids: Optional[list[str]] = None, ) -> None: ... @overload @@ -894,9 +892,9 @@ class DeploymentDeleteFromResourcesState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" @overload @@ -907,8 +905,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -931,14 +929,14 @@ class DeploymentResource(_Model): :vartype region: str :ivar assigned_aoai_resource: Represents the AOAI resource assigned for data generation. :vartype assigned_aoai_resource: - ~azure.ai.language.conversations.authoring.models.DataGenerationConnectionInfo + ~azure.ai.language.conversations.authoring.models._models.DataGenerationConnectionInfo """ resource_id: str = rest_field(name="resourceId", visibility=["read", "create", "update", "delete", "query"]) """Represents the Azure resource Id. Required.""" region: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Represents the resource region. Required.""" - assigned_aoai_resource: Optional["_models.DataGenerationConnectionInfo"] = rest_field( + assigned_aoai_resource: Optional["_models._models.DataGenerationConnectionInfo"] = rest_field( name="assignedAoaiResource", visibility=["read", "create", "update", "delete", "query"] ) """Represents the AOAI resource assigned for data generation.""" @@ -949,7 +947,7 @@ def __init__( *, resource_id: str, region: str, - assigned_aoai_resource: Optional["_models.DataGenerationConnectionInfo"] = None, + assigned_aoai_resource: Optional["_models._models.DataGenerationConnectionInfo"] = None, ) -> None: ... @overload @@ -964,7 +962,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class DeploymentResourcesState(_Model): - """Represents the state of a deployment resources job. + """Represents the state of a project resources job. :ivar job_id: The job ID. Required. :vartype job_id: str @@ -1002,9 +1000,9 @@ class DeploymentResourcesState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" @overload @@ -1015,8 +1013,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -1069,9 +1067,9 @@ class DeploymentState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" @overload @@ -1082,8 +1080,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -1128,12 +1126,12 @@ class EntitiesEvaluationSummary(_Model): :vartype macro_recall: float """ - confusion_matrix: Dict[str, "_models.ConfusionMatrixRow"] = rest_field( + confusion_matrix: dict[str, "_models.ConfusionMatrixRow"] = rest_field( name="confusionMatrix", visibility=["read", "create", "update", "delete", "query"] ) """Represents the confusion matrix between two entities (the two entities can be the same). The matrix is between the entity that was labelled and the entity that was predicted. Required.""" - entities: Dict[str, "_models.EntityEvaluationSummary"] = rest_field( + entities: dict[str, "_models.EntityEvaluationSummary"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """Represents the entities evaluation summary. Required.""" @@ -1158,8 +1156,8 @@ class EntitiesEvaluationSummary(_Model): def __init__( self, *, - confusion_matrix: Dict[str, "_models.ConfusionMatrixRow"], - entities: Dict[str, "_models.EntityEvaluationSummary"], + confusion_matrix: dict[str, "_models.ConfusionMatrixRow"], + entities: dict[str, "_models.EntityEvaluationSummary"], micro_f1: float, micro_precision: float, micro_recall: float, @@ -1433,9 +1431,9 @@ class EvaluationState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" result: "_models._models.EvaluationJobResult" = rest_field( visibility=["read", "create", "update", "delete", "query"] @@ -1451,8 +1449,8 @@ def __init__( status: Union[str, "_models.OperationStatus"], result: "_models._models.EvaluationJobResult", expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -1512,7 +1510,7 @@ class ExportedOrchestrationDetails(_Model): ~azure.ai.language.conversations.authoring.models.OrchestrationTargetProjectKind """ - __mapping__: Dict[str, _Model] = {} + __mapping__: dict[str, _Model] = {} target_project_kind: str = rest_discriminator( name="targetProjectKind", visibility=["read", "create", "update", "delete", "query"] ) @@ -1569,7 +1567,8 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, target_project_kind=OrchestrationTargetProjectKind.CONVERSATION, **kwargs) + super().__init__(*args, **kwargs) + self.target_project_kind = OrchestrationTargetProjectKind.CONVERSATION # type: ignore class ExportedEntityList(_Model): @@ -1580,7 +1579,7 @@ class ExportedEntityList(_Model): list[~azure.ai.language.conversations.authoring.models._models.ExportedEntitySublist] """ - sublists: Optional[List["_models._models.ExportedEntitySublist"]] = rest_field( + sublists: Optional[list["_models._models.ExportedEntitySublist"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The sub-lists of the list component.""" @@ -1589,7 +1588,7 @@ class ExportedEntityList(_Model): def __init__( self, *, - sublists: Optional[List["_models._models.ExportedEntitySublist"]] = None, + sublists: Optional[list["_models._models.ExportedEntitySublist"]] = None, ) -> None: ... @overload @@ -1616,7 +1615,7 @@ class ExportedEntityListSynonym(_Model): language: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Represents the language of the synonyms. This is BCP-47 representation of a language. For example, use \"en\" for English, \"en-gb\" for English (UK), \"es\" for Spanish etc.""" - synonyms: Optional[List[str]] = rest_field( + synonyms: Optional[list[str]] = rest_field( name="values", visibility=["read", "create", "update", "delete", "query"] ) """The list of synonyms.""" @@ -1626,7 +1625,7 @@ def __init__( self, *, language: Optional[str] = None, - synonyms: Optional[List[str]] = None, + synonyms: Optional[list[str]] = None, ) -> None: ... @overload @@ -1651,7 +1650,7 @@ class ExportedEntityRegex(_Model): list[~azure.ai.language.conversations.authoring.models._models.ExportedEntityRegexExpression] """ - expressions: Optional[List["_models._models.ExportedEntityRegexExpression"]] = rest_field( + expressions: Optional[list["_models._models.ExportedEntityRegexExpression"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The regex expressions of the regex component. These expressions follow the .NET regex syntax. @@ -1663,7 +1662,7 @@ class ExportedEntityRegex(_Model): def __init__( self, *, - expressions: Optional[List["_models._models.ExportedEntityRegexExpression"]] = None, + expressions: Optional[list["_models._models.ExportedEntityRegexExpression"]] = None, ) -> None: ... @overload @@ -1735,7 +1734,7 @@ class ExportedEntitySublist(_Model): list_key: Optional[str] = rest_field(name="listKey", visibility=["read", "create", "update", "delete", "query"]) """The key of the sub-list.""" - synonyms: Optional[List["_models._models.ExportedEntityListSynonym"]] = rest_field( + synonyms: Optional[list["_models._models.ExportedEntityListSynonym"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The phrases of that correspond to the sub-list.""" @@ -1745,7 +1744,7 @@ def __init__( self, *, list_key: Optional[str] = None, - synonyms: Optional[List["_models._models.ExportedEntityListSynonym"]] = None, + synonyms: Optional[list["_models._models.ExportedEntityListSynonym"]] = None, ) -> None: ... @overload @@ -1831,7 +1830,8 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, target_project_kind=OrchestrationTargetProjectKind.LUIS, **kwargs) + super().__init__(*args, **kwargs) + self.target_project_kind = OrchestrationTargetProjectKind.LUIS # type: ignore class ExportedModelDetails(_Model): @@ -1903,9 +1903,9 @@ class ExportedModelState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" @overload @@ -1916,8 +1916,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -2077,7 +2077,8 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, target_project_kind=OrchestrationTargetProjectKind.QUESTION_ANSWERING, **kwargs) + super().__init__(*args, **kwargs) + self.target_project_kind = OrchestrationTargetProjectKind.QUESTION_ANSWERING # type: ignore class ExportedTrainedModel(_Model): @@ -2219,9 +2220,9 @@ class ExportProjectState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" result_uri: Optional[str] = rest_field(name="resultUrl", visibility=["read", "create", "update", "delete", "query"]) """The URL to use in order to download the exported project.""" @@ -2234,8 +2235,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, result_uri: Optional[str] = None, ) -> None: ... @@ -2289,9 +2290,9 @@ class ImportProjectState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" @overload @@ -2302,8 +2303,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -2414,12 +2415,12 @@ class IntentsEvaluationSummary(_Model): :vartype macro_recall: float """ - confusion_matrix: Dict[str, "_models.ConfusionMatrixRow"] = rest_field( + confusion_matrix: dict[str, "_models.ConfusionMatrixRow"] = rest_field( name="confusionMatrix", visibility=["read", "create", "update", "delete", "query"] ) """Represents the confusion matrix between two intents (the two intents can be the same). The matrix is between the intent that was labelled and the intent that was predicted. Required.""" - intents: Dict[str, "_models.IntentEvaluationSummary"] = rest_field( + intents: dict[str, "_models.IntentEvaluationSummary"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """Represents the intents evaluation summary. Required.""" @@ -2444,8 +2445,8 @@ class IntentsEvaluationSummary(_Model): def __init__( self, *, - confusion_matrix: Dict[str, "_models.ConfusionMatrixRow"], - intents: Dict[str, "_models.IntentEvaluationSummary"], + confusion_matrix: dict[str, "_models.ConfusionMatrixRow"], + intents: dict[str, "_models.IntentEvaluationSummary"], micro_f1: float, micro_precision: float, micro_recall: float, @@ -2504,9 +2505,9 @@ class LoadSnapshotState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" @overload @@ -2517,8 +2518,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -2588,11 +2589,11 @@ class OrchestrationExportedProjectAsset(ExportedProjectAsset, discriminator="Orc :vartype project_kind: str or ~azure.ai.language.conversations.authoring.models.ORCHESTRATION """ - intents: Optional[List["_models._models.OrchestrationExportedIntent"]] = rest_field( + intents: Optional[list["_models._models.OrchestrationExportedIntent"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """Represents the intents of the project.""" - utterances: Optional[List["_models._models.OrchestrationExportedUtterance"]] = rest_field( + utterances: Optional[list["_models._models.OrchestrationExportedUtterance"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """Represents the utterances of the project.""" @@ -2604,8 +2605,8 @@ class OrchestrationExportedProjectAsset(ExportedProjectAsset, discriminator="Orc def __init__( self, *, - intents: Optional[List["_models._models.OrchestrationExportedIntent"]] = None, - utterances: Optional[List["_models._models.OrchestrationExportedUtterance"]] = None, + intents: Optional[list["_models._models.OrchestrationExportedIntent"]] = None, + utterances: Optional[list["_models._models.OrchestrationExportedUtterance"]] = None, ) -> None: ... @overload @@ -2616,7 +2617,8 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, project_kind=ProjectKind.ORCHESTRATION, **kwargs) + super().__init__(*args, **kwargs) + self.project_kind = ProjectKind.ORCHESTRATION # type: ignore class OrchestrationExportedUtterance(_Model): @@ -2740,9 +2742,9 @@ class ProjectDeletionState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" @overload @@ -2753,8 +2755,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -2785,7 +2787,7 @@ class ProjectDeployment(_Model): :vartype model_training_config_version: str :ivar assigned_resources: Represents the metadata of the assigned Azure resources. Required. :vartype assigned_resources: - list[~azure.ai.language.conversations.authoring.models.DeploymentResource] + list[~azure.ai.language.conversations.authoring.models.AssignedDeploymentResource] """ deployment_name: str = rest_field(name="deploymentName", visibility=["read"]) @@ -2808,7 +2810,7 @@ class ProjectDeployment(_Model): name="modelTrainingConfigVersion", visibility=["read", "create", "update", "delete", "query"] ) """Represents model training config version. Required.""" - assigned_resources: List["_models.DeploymentResource"] = rest_field( + assigned_resources: list["_models.AssignedDeploymentResource"] = rest_field( name="assignedResources", visibility=["read", "create", "update", "delete", "query"] ) """Represents the metadata of the assigned Azure resources. Required.""" @@ -2822,7 +2824,7 @@ def __init__( last_deployed_on: datetime.datetime, deployment_expired_on: datetime.date, model_training_config_version: str, - assigned_resources: List["_models.DeploymentResource"], + assigned_resources: list["_models.AssignedDeploymentResource"], ) -> None: ... @overload @@ -3234,9 +3236,9 @@ class SwapDeploymentsState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" @overload @@ -3247,8 +3249,8 @@ def __init__( last_updated_on: datetime.datetime, status: Union[str, "_models.OperationStatus"], expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -3474,9 +3476,9 @@ class TrainingState(_Model): ) """The job status. Required. Known values are: \"notStarted\", \"running\", \"succeeded\", \"failed\", \"cancelled\", \"cancelling\", and \"partiallyCompleted\".""" - warnings: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + warnings: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The warnings that were encountered while executing the job.""" - errors: Optional[List[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + errors: Optional[list[ODataV4Format]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The errors encountered while executing the job.""" result: "_models.TrainingJobResult" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Represents training tasks detailed result. Required.""" @@ -3490,38 +3492,8 @@ def __init__( status: Union[str, "_models.OperationStatus"], result: "_models.TrainingJobResult", expires_on: Optional[datetime.datetime] = None, - warnings: Optional[List[ODataV4Format]] = None, - errors: Optional[List[ODataV4Format]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class UnassignDeploymentResourcesDetails(_Model): - """Represents the options to unassign Azure resources from a project. - - :ivar assigned_resource_ids: Represents the assigned resource IDs to be unassigned. Required. - :vartype assigned_resource_ids: list[str] - """ - - assigned_resource_ids: List[str] = rest_field( - name="assignedResourceIds", visibility=["read", "create", "update", "delete", "query"] - ) - """Represents the assigned resource IDs to be unassigned. Required.""" - - @overload - def __init__( - self, - *, - assigned_resource_ids: List[str], + warnings: Optional[list[ODataV4Format]] = None, + errors: Optional[list[ODataV4Format]] = None, ) -> None: ... @overload @@ -3546,11 +3518,11 @@ class UtteranceEntitiesEvaluationResult(_Model): list[~azure.ai.language.conversations.authoring.models.UtteranceEntityEvaluationResult] """ - expected_entities: List["_models.UtteranceEntityEvaluationResult"] = rest_field( + expected_entities: list["_models.UtteranceEntityEvaluationResult"] = rest_field( name="expectedEntities", visibility=["read", "create", "update", "delete", "query"] ) """Represents the expected entity labels. Required.""" - predicted_entities: List["_models.UtteranceEntityEvaluationResult"] = rest_field( + predicted_entities: list["_models.UtteranceEntityEvaluationResult"] = rest_field( name="predictedEntities", visibility=["read", "create", "update", "delete", "query"] ) """Represents the predicted entity labels. Required.""" @@ -3559,8 +3531,8 @@ class UtteranceEntitiesEvaluationResult(_Model): def __init__( self, *, - expected_entities: List["_models.UtteranceEntityEvaluationResult"], - predicted_entities: List["_models.UtteranceEntityEvaluationResult"], + expected_entities: list["_models.UtteranceEntityEvaluationResult"], + predicted_entities: list["_models.UtteranceEntityEvaluationResult"], ) -> None: ... @overload diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_patch.py index f140af6701f0..87676c65a8f0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_patch.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,342 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from collections.abc import MutableMapping, Awaitable # pylint:disable=import-error -from typing import Any, Callable, Optional, Tuple, TypeVar, cast -import base64 -import functools -import time -from azure.core.exceptions import ResourceNotFoundError -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncPollingMethod, PollingMethod -from azure.core.polling.base_polling import ( - BadResponse, - LongRunningOperation, - OperationFailed, -) -from azure.core.rest import HttpRequest - -from ._enums import ExportedProjectFormat -from ._models import ( - AssignDeploymentResourcesDetails, - CopyProjectDetails, - CopyProjectState, - ConversationExportedEntity, - ConversationExportedIntent, - ConversationExportedProjectAsset, - ConversationExportedUtterance, - CreateDeploymentDetails, - DeleteDeploymentDetails, - DeploymentDeleteFromResourcesState, - DeploymentResourcesState, - DeploymentState, - EvaluationJobResult, - EvaluationState, - ExportProjectState, - ExportedModelDetails, - ExportedModelState, - ExportedProject, - ExportedUtteranceEntityLabel, - ImportProjectState, - LoadSnapshotState, - ProjectDeletionState, - ResourceMetadata, - SwapDeploymentsDetails, - SwapDeploymentsState, - TrainingJobDetails, - UnassignDeploymentResourcesDetails, -) - -JSON = MutableMapping[str, Any] -T = TypeVar("T") - - - -class _JobsStrategy(LongRunningOperation): - """Interprets job-status responses and tells the poller which URL to use.""" - - def __init__(self, async_url: str): - self._async_url = async_url - - # We can poll if we have an operation-location URL - def can_poll(self, pipeline_response: PipelineResponse) -> bool: # noqa: D401 - return bool(self._async_url) - - # Always poll the jobs URL from operation-location - def get_polling_url(self) -> str: # noqa: D401 - return self._async_url - - # Initial status after the first call (202→InProgress, 200 could be immediate success) - def set_initial_status(self, pipeline_response: PipelineResponse) -> str: # noqa: D401 - sc = pipeline_response.http_response.status_code - if sc in (200, 201): - return "InProgress" # job hasn’t finished yet; service will report status on poll - if sc in (202, 204): - return "InProgress" - raise OperationFailed("Operation failed or canceled") - - # Map service statuses to core strings - def get_status(self, pipeline_response: JSON) -> str: # type: ignore - raw = str(pipeline_response.get("status", "")).lower() - if raw in ("succeeded",): - return "Succeeded" - if raw in ("failed",): - return "Failed" - if raw in ("cancelled", "canceled"): - return "Canceled" - # notstarted, running, cancelling, partiallycompleted → still in progress - return "InProgress" - - # Force the final GET to also come from operation-location (or return None to use last body) - def get_final_get_url(self, pipeline_response: PipelineResponse) -> Optional[str]: # noqa: D401 - return self._async_url - - -class _JobsPollingMethod(PollingMethod): - def __init__(self, polling_interval: float = 30.0, *, path_format_arguments: Optional[dict] = None, **kwargs: Any): - self._polling_interval = polling_interval - self._kwargs = kwargs - self._path_format_arguments = path_format_arguments or {} - - # predeclare attributes to satisfy pylint W0201 - self._client: Any = None - self._initial_response: Optional[PipelineResponse] = None - self._deserialization_callback: Optional[Callable] = None - self._resource: Optional[PipelineResponse] = None - self._status: str = "NotStarted" - self._operation: Any = None # or a concrete type if available - self._command: Optional[Callable[[], PipelineResponse]] = None - - # ---- LRO lifecycle ---- - def initialize(self, client: Any, initial_response: PipelineResponse, deserialization_callback: Callable) -> None: - self._client = client - self._initial_response = initial_response - self._deserialization_callback = deserialization_callback - self._resource = None - self._status = "InProgress" - - # Extract operation-location (case-insensitive) - headers = initial_response.http_response.headers - op_loc = headers.get("Operation-Location") or headers.get("operation-location") - if not op_loc: - raise BadResponse("Missing Operation-Location header for job polling") - - # Resolve {Endpoint} etc. - if self._path_format_arguments: - op_loc = self._client.format_url(op_loc, **self._path_format_arguments) - - # Strategy: always use jobs URL - self._operation = _JobsStrategy(op_loc) - if not self._operation.can_poll(initial_response): - raise BadResponse("Cannot poll: no jobs URL") - - # Command to GET status from jobs URL - self._command = functools.partial(self._do_get, self._operation.get_polling_url()) - - # Initial status - self._status = self._operation.set_initial_status(initial_response) - - def run(self) -> None: - while not self.finished(): - self.update_status() - if not self.finished(): - time.sleep(self._polling_interval) - - # Final GET (via jobs URL) if strategy asks for it - final_url = self._operation.get_final_get_url(self._initial_response) - if final_url: - self._resource = self._do_get(final_url) - - def finished(self) -> bool: - return self._status in ("Succeeded", "Failed", "Canceled") - - def status(self) -> str: - return self._status - - def resource(self) -> Any: - if self._deserialization_callback is None or self._initial_response is None: - raise RuntimeError("Polling method not initialized; call initialize() first.") - # Return typed object using provided callback (expects PipelineResponse) - return self._deserialization_callback(self._resource or self._initial_response) - - def update_status(self) -> None: - if self._command is None: - raise RuntimeError("Polling method not initialized; call initialize() first.") - - try: - self._resource = self._command() - except ResourceNotFoundError: - # Treat as transient if your service uses 404-before-ready semantics - self._resource = None - - body: JSON = {} - if self._resource is not None: - try: - body = cast(JSON, self._resource.http_response.json()) - except Exception as exc: - raise BadResponse("Polling response is not JSON") from exc - self._status = self._operation.get_status(body) - - # ---- Helpers ---- - def _do_get(self, url: str) -> PipelineResponse: - # REST pipeline path (new core) - if hasattr(self._client, "send_request"): - req = HttpRequest("GET", url) - return cast( - PipelineResponse, self._client.send_request(req, _return_pipeline_response=True, **self._kwargs) - ) - # Legacy pipeline fallback - request = self._client.get(url) - return cast( - PipelineResponse, self._client._pipeline.run(request, stream=False, **self._kwargs) # pylint: disable=protected-access - ) - - # ---- Continuation token support (doc pattern) ---- - def get_continuation_token(self) -> str: - import pickle - - return base64.b64encode(pickle.dumps(self._initial_response)).decode("ascii") - - @classmethod - def from_continuation_token(cls, continuation_token: str, **kwargs: Any) -> Tuple[Any, PipelineResponse, Callable]: - import pickle - - client = kwargs["client"] - deserialization_callback = kwargs["deserialization_callback"] - initial_response = pickle.loads(base64.b64decode(continuation_token)) # nosec - return client, initial_response, deserialization_callback - - -class _AsyncJobsPollingMethod(AsyncPollingMethod): - def __init__( - self, - polling_interval: float = 30.0, - *, - path_format_arguments: Optional[dict] = None, - **kwargs: Any, - ): - self._polling_interval = polling_interval - self._kwargs = kwargs - self._path_format_arguments = path_format_arguments or {} - - # Predeclare all attributes to satisfy pylint W0201 - self._client: Any = None - self._initial_response: Optional[PipelineResponse] = None - self._deserialization_callback: Optional[Callable] = None - self._resource: Optional[PipelineResponse] = None - self._status: str = "NotStarted" - self._operation: Any = None - self._command: Optional[Callable[[], Awaitable[PipelineResponse]]] = None - - # ---- LRO lifecycle ---- - def initialize(self, client: Any, initial_response: PipelineResponse, deserialization_callback: Callable) -> None: - self._client = client - self._initial_response = initial_response - self._deserialization_callback = deserialization_callback - self._resource = None # no type annotation here - self._status = "InProgress" # no type annotation here - - # Operation-Location (case-insensitive) - headers = initial_response.http_response.headers - op_loc = headers.get("Operation-Location") or headers.get("operation-location") - if not op_loc: - raise BadResponse("Missing Operation-Location header for job polling") - - if self._path_format_arguments: - op_loc = self._client.format_url(op_loc, **self._path_format_arguments) - - self._operation = _JobsStrategy(op_loc) - if not self._operation.can_poll(initial_response): - raise BadResponse("Cannot poll: no jobs URL") - - # async GET command bound to jobs URL - self._command = functools.partial(self._do_get_async, self._operation.get_polling_url()) - - # Seed initial status from first response - self._status = self._operation.set_initial_status(initial_response) - - async def run(self) -> None: - while not self.finished(): - await self.update_status() - if not self.finished(): - await self._sleep(self._polling_interval) - - final_url = self._operation.get_final_get_url(self._initial_response) - if final_url: - self._resource = await self._do_get_async(final_url) - - async def _sleep(self, seconds: float) -> None: - # Prefer the Azure Core transport's sleep (fast/no-op in playback) - transport = getattr(self._client, "_transport", None) or getattr( - getattr(self._client, "_pipeline", None), "_transport", None - ) - if transport and hasattr(transport, "sleep"): - await transport.sleep(seconds) - return - # Fallback for non-Azure transports (allowed per rule text) - import asyncio # pylint: disable=import-outside-toplevel, do-not-import-asyncio - await asyncio.sleep(seconds) - - def finished(self) -> bool: - return self._status in ("Succeeded", "Failed", "Canceled") - - def status(self) -> str: - return self._status - - def resource(self) -> Any: - if self._deserialization_callback is None or self._initial_response is None: - raise RuntimeError("Polling method not initialized; call initialize() first.") - return self._deserialization_callback(self._resource or self._initial_response) - - async def update_status(self) -> None: - if self._command is None: - raise RuntimeError("Polling method not initialized; call initialize() first.") - - try: - self._resource = await self._command() - except ResourceNotFoundError: - self._resource = None - - body: dict = {} - if self._resource is not None: - try: - body = cast(dict, self._resource.http_response.json()) - except Exception as exc: # be explicit so pylint sees the chain - raise BadResponse("Polling response is not JSON") from exc - self._status = self._operation.get_status(body) - - # ---- Helpers ---- - async def _do_get_async(self, url: str) -> PipelineResponse: - # New core: async pipeline client has async send_request - if hasattr(self._client, "send_request"): - req = HttpRequest("GET", url) - return cast( - PipelineResponse, - await self._client.send_request(req, _return_pipeline_response=True, **self._kwargs), - ) - # Legacy fallback (unlikely in modern azure-core) - request = self._client.get(url) - return cast( - PipelineResponse, - await self._client._pipeline.run(request, stream=False, **self._kwargs), # pylint: disable=protected-access - ) - - # ---- Continuation token ---- - def get_continuation_token(self) -> str: - import pickle - - return base64.b64encode(pickle.dumps(self._initial_response)).decode("ascii") - - @classmethod - def from_continuation_token(cls, continuation_token: str, **kwargs: Any) -> Tuple[Any, PipelineResponse, Callable]: - import pickle - - client = kwargs["client"] - deserialization_callback = kwargs["deserialization_callback"] - initial_response = pickle.loads(base64.b64decode(continuation_token)) # nosec - return client, initial_response, deserialization_callback +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): @@ -353,38 +19,3 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ - - -__all__ = [ - "AssignDeploymentResourcesDetails", - "UnassignDeploymentResourcesDetails", - "SwapDeploymentsDetails", - "DeploymentResourcesState", - "CopyProjectState", - "ExportProjectState", - "SwapDeploymentsState", - "DeploymentResourcesState", - "DeleteDeploymentDetails", - "CreateDeploymentDetails", - "DeploymentDeleteFromResourcesState", - "DeploymentState", - "ExportedModelDetails", - "ExportedModelState", - "LoadSnapshotState", - "DeploymentResourcesState", - "ProjectDeletionState", - "ExportedProjectFormat", - "ExportedProject", - "ImportProjectState", - "CopyProjectDetails", - "TrainingJobDetails", - "CopyProjectDetails", - "EvaluationJobResult", - "EvaluationState", - "ConversationExportedProjectAsset", - "ConversationExportedIntent", - "ConversationExportedEntity", - "ConversationExportedUtterance", - "ExportedUtteranceEntityLabel", - "ResourceMetadata", -] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_deployment_op_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_deployment_op_patch.py deleted file mode 100644 index b2ead6979686..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_deployment_op_patch.py +++ /dev/null @@ -1,266 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from collections.abc import MutableMapping # pylint:disable=import-error -from typing import IO, Any, Callable, Dict, Optional, TypeVar, Union, overload - -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace - -from ..models import ( - CreateDeploymentDetails, - DeleteDeploymentDetails, - DeploymentDeleteFromResourcesState, - DeploymentState, - ProjectDeployment, -) -from ._operations import DeploymentOperations as DeploymentOperationsGenerated - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - -class DeploymentOperations(DeploymentOperationsGenerated): - - def __init__(self, *args, project_name: str, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._project_name = project_name - - @distributed_trace - def begin_delete_deployment(self, deployment_name: str, **kwargs: Any) -> LROPoller[None]: # type: ignore[override] - """Deletes a project deployment. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_delete_deployment( - project_name=self._project_name, deployment_name=deployment_name, **kwargs - ) - - @overload - def begin_delete_deployment_from_resources( - self, - deployment_name: str, - body: DeleteDeploymentDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deletes a project deployment from the specified assigned resources. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The options for deleting the deployment. Required. - :type body: ~azure.ai.language.conversations.authoring.models.DeleteDeploymentDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_delete_deployment_from_resources( - self, deployment_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Deletes a project deployment from the specified assigned resources. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The options for deleting the deployment. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_delete_deployment_from_resources( - self, deployment_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Deletes a project deployment from the specified assigned resources. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The options for deleting the deployment. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_delete_deployment_from_resources( - self, deployment_name: str, body: Union[DeleteDeploymentDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Deletes a project deployment from the specified assigned resources. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The options for deleting the deployment. Required. - :type body: ~azure.ai.language.conversations.authoring.models.DeleteDeploymentDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_delete_deployment_from_resources( - project_name=self._project_name, - deployment_name=deployment_name, - body=body, - content_type=content_type, - **kwargs, - ) - - @overload - def begin_deploy_project( - self, - deployment_name: str, - body: CreateDeploymentDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Creates a new deployment or replaces an existing one. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The new deployment info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.CreateDeploymentDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_deploy_project( - self, deployment_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates a new deployment or replaces an existing one. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The new deployment info. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_deploy_project( - self, deployment_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates a new deployment or replaces an existing one. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The new deployment info. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_deploy_project( - self, deployment_name: str, body: Union[CreateDeploymentDetails, JSON, IO[bytes]],*, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates a new deployment or replaces an existing one. - - :param deployment_name: The name of the specific deployment of the project to use. Required. - :type deployment_name: str - :param body: The new deployment info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.CreateDeploymentDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_deploy_project( - project_name=self._project_name, - deployment_name=deployment_name, - body=body, - content_type=content_type, - **kwargs, - ) - - @distributed_trace - def get_deployment(self, deployment_name: str, **kwargs: Any) -> ProjectDeployment: # type: ignore[override] - """Gets the details of a deployment. - - :param deployment_name: Represents deployment name. Required. - :type deployment_name: str - :return: ProjectDeployment. The ProjectDeployment is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.ProjectDeployment - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().get_deployment(project_name=self._project_name, deployment_name=deployment_name, **kwargs) - - @distributed_trace - def _get_deployment_delete_from_resources_status( # type: ignore[override] - self, deployment_name: str, job_id: str, **kwargs: Any - ) -> DeploymentDeleteFromResourcesState: - """Gets the status of an existing delete deployment from specific resources job. - - :param deployment_name: Represents deployment name. Required. - :type deployment_name: str - :param job_id: The job ID. Required. - :type job_id: str - :return: DeploymentDeleteFromResourcesState. The DeploymentDeleteFromResourcesState is - compatible with MutableMapping - :rtype: - ~azure.ai.language.conversations.authoring.models._models.DeploymentDeleteFromResourcesState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_deployment_delete_from_resources_status( - project_name=self._project_name, deployment_name=deployment_name, job_id=job_id, **kwargs - ) - - @distributed_trace - def _get_deployment_status( # type: ignore[override] - self, deployment_name: str, job_id: str, **kwargs: Any - ) -> DeploymentState: - """Gets the status of an existing deployment job. - - :param deployment_name: Represents deployment name. Required. - :type deployment_name: str - :param job_id: The job ID. Required. - :type job_id: str - :return: DeploymentState. The DeploymentState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.DeploymentState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_deployment_status( - project_name=self._project_name, deployment_name=deployment_name, job_id=job_id, **kwargs - ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_exported_model_op_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_exported_model_op_patch.py deleted file mode 100644 index be9ad6e5c38b..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_exported_model_op_patch.py +++ /dev/null @@ -1,173 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from collections.abc import MutableMapping # pylint:disable=import-error -from typing import IO, Any, Callable, Dict, Optional, TypeVar, Union, overload - -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace - -from ..models import ( - ExportedModelDetails, - ExportedModelState, - ExportedTrainedModel, -) -from ._operations import ExportedModelOperations as ExportedModelOperationsGenerated - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - -class ExportedModelOperations(ExportedModelOperationsGenerated): - - def __init__(self, *args, project_name: str, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._project_name = project_name - - @overload - def begin_create_or_update_exported_model( - self, - exported_model_name: str, - body: ExportedModelDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Creates a new exported model or replaces an existing one. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param body: The exported model info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.ExportedModelDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update_exported_model( - self, exported_model_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates a new exported model or replaces an existing one. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param body: The exported model info. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update_exported_model( - self, exported_model_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates a new exported model or replaces an existing one. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param body: The exported model info. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update_exported_model( - self, exported_model_name: str, body: Union[ExportedModelDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Creates a new exported model or replaces an existing one. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param body: The exported model info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.ExportedModelDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_create_or_update_exported_model( - project_name=self._project_name, - exported_model_name=exported_model_name, - body=body, - content_type=content_type, - **kwargs, - ) - - @distributed_trace - def begin_delete_exported_model(self, exported_model_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes an existing exported model. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_delete_exported_model( - project_name=self._project_name, - exported_model_name=exported_model_name, - **kwargs, - ) - - @distributed_trace - def get_exported_model( # type: ignore[override] - self, exported_model_name: str, **kwargs: Any - ) -> ExportedTrainedModel: - """Gets the details of an exported model. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :return: ExportedTrainedModel. The ExportedTrainedModel is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.ExportedTrainedModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().get_exported_model( - project_name=self._project_name, - exported_model_name=exported_model_name, - **kwargs, - ) - - @distributed_trace - def _get_exported_model_job_status( # type: ignore[override] - self, exported_model_name: str, job_id: str, **kwargs: Any - ) -> ExportedModelState: - """Gets the status for an existing job to create or update an exported model. - - :param exported_model_name: The exported model name. Required. - :type exported_model_name: str - :param job_id: The job ID. Required. - :type job_id: str - :return: ExportedModelState. The ExportedModelState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.ExportedModelState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_exported_model_job_status( - project_name=self._project_name, - exported_model_name=exported_model_name, - job_id=job_id, - **kwargs, - ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_operations.py index 696f9a6ecff3..fd8cab17d697 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_operations.py @@ -6,10 +6,10 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint:disable=import-error +from collections.abc import MutableMapping from io import IOBase import json -from typing import Any, Callable, Dict, IO, Iterator, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -40,7 +40,7 @@ JSON = MutableMapping[str, Any] T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] _Unset: Any = object() _SERIALIZER = Serializer() @@ -53,7 +53,7 @@ def build_conversation_authoring_list_projects_request( # pylint: disable=name- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_conversation_authoring_list_supported_languages_request( # pylint: di _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +113,7 @@ def build_conversation_authoring_list_assigned_resource_deployments_request( # _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +146,7 @@ def build_conversation_authoring_list_supported_prebuilt_entities_request( # py _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +182,7 @@ def build_conversation_authoring_list_training_config_versions_request( # pylin _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +211,7 @@ def build_conversation_authoring_create_project_request( # pylint: disable=name _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +239,7 @@ def build_conversation_authoring_get_project_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -264,7 +264,7 @@ def build_conversation_authoring_delete_project_request( # pylint: disable=name ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}" path_format_arguments = { @@ -285,7 +285,7 @@ def build_conversation_authoring_get_export_status_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -312,7 +312,7 @@ def build_conversation_authoring_get_import_status_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -333,11 +333,11 @@ def build_conversation_authoring_get_import_status_request( # pylint: disable=n return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployment_get_deployment_request(project_name: str, deployment_name: str, **kwargs: Any) -> HttpRequest: +def build_deployment_get_deployment_request(deployment_name: str, project_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -358,12 +358,12 @@ def build_deployment_get_deployment_request(project_name: str, deployment_name: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployment_deploy_project_request(project_name: str, deployment_name: str, **kwargs: Any) -> HttpRequest: +def build_deployment_deploy_project_request(deployment_name: str, project_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/deployments/{deploymentName}" path_format_arguments = { @@ -384,11 +384,11 @@ def build_deployment_deploy_project_request(project_name: str, deployment_name: def build_deployment_delete_deployment_request( # pylint: disable=name-too-long - project_name: str, deployment_name: str, **kwargs: Any + deployment_name: str, project_name: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/deployments/{deploymentName}" path_format_arguments = { @@ -405,13 +405,13 @@ def build_deployment_delete_deployment_request( # pylint: disable=name-too-long def build_deployment_delete_deployment_from_resources_request( # pylint: disable=name-too-long - project_name: str, deployment_name: str, **kwargs: Any + deployment_name: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/deployments/{deploymentName}/:delete-from-resources" path_format_arguments = { @@ -432,12 +432,12 @@ def build_deployment_delete_deployment_from_resources_request( # pylint: disabl def build_deployment_get_deployment_delete_from_resources_status_request( # pylint: disable=name-too-long - project_name: str, deployment_name: str, job_id: str, **kwargs: Any + deployment_name: str, job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -460,12 +460,12 @@ def build_deployment_get_deployment_delete_from_resources_status_request( # pyl def build_deployment_get_deployment_status_request( # pylint: disable=name-too-long - project_name: str, deployment_name: str, job_id: str, **kwargs: Any + deployment_name: str, job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -498,7 +498,7 @@ def build_project_list_trained_models_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -535,7 +535,7 @@ def build_project_list_training_jobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -572,7 +572,7 @@ def build_project_list_deployment_resources_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -609,7 +609,7 @@ def build_project_list_deployments_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -646,7 +646,7 @@ def build_project_list_exported_models_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -679,7 +679,7 @@ def build_project_assign_deployment_resources_request( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/resources/:assign" path_format_arguments = { @@ -705,7 +705,7 @@ def build_project_unassign_deployment_resources_request( # pylint: disable=name _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/resources/:unassign" path_format_arguments = { @@ -725,12 +725,12 @@ def build_project_unassign_deployment_resources_request( # pylint: disable=name def build_project_get_assign_deployment_resources_status_request( # pylint: disable=name-too-long - project_name: str, job_id: str, **kwargs: Any + job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -752,12 +752,12 @@ def build_project_get_assign_deployment_resources_status_request( # pylint: dis def build_project_get_unassign_deployment_resources_status_request( # pylint: disable=name-too-long - project_name: str, job_id: str, **kwargs: Any + job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -783,7 +783,7 @@ def build_project_swap_deployments_request(project_name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/deployments/:swap" path_format_arguments = { @@ -803,12 +803,12 @@ def build_project_swap_deployments_request(project_name: str, **kwargs: Any) -> def build_project_get_swap_deployments_status_request( # pylint: disable=name-too-long - project_name: str, job_id: str, **kwargs: Any + job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -833,7 +833,7 @@ def build_project_get_project_request(project_name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -859,7 +859,7 @@ def build_project_get_project_deletion_status_request( # pylint: disable=name-t _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -889,7 +889,7 @@ def build_project_import_method_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/:import" path_format_arguments = { @@ -921,7 +921,7 @@ def build_project_export_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/:export" path_format_arguments = { @@ -943,11 +943,11 @@ def build_project_export_request( return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_project_get_export_status_request(project_name: str, job_id: str, **kwargs: Any) -> HttpRequest: +def build_project_get_export_status_request(job_id: str, project_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -975,7 +975,7 @@ def build_project_copy_project_authorization_request( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1002,7 +1002,7 @@ def build_project_copy_project_request(project_name: str, **kwargs: Any) -> Http _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/:copy" path_format_arguments = { @@ -1022,12 +1022,12 @@ def build_project_copy_project_request(project_name: str, **kwargs: Any) -> Http def build_project_get_copy_project_status_request( # pylint: disable=name-too-long - project_name: str, job_id: str, **kwargs: Any + job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1053,7 +1053,7 @@ def build_project_train_request(project_name: str, **kwargs: Any) -> HttpRequest _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/:train" path_format_arguments = { @@ -1073,12 +1073,12 @@ def build_project_train_request(project_name: str, **kwargs: Any) -> HttpRequest def build_project_get_training_status_request( # pylint: disable=name-too-long - project_name: str, job_id: str, **kwargs: Any + job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1100,11 +1100,11 @@ def build_project_get_training_status_request( # pylint: disable=name-too-long def build_project_cancel_training_job_request( # pylint: disable=name-too-long - project_name: str, job_id: str, **kwargs: Any + job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/train/jobs/{jobId}/:cancel" path_format_arguments = { @@ -1121,12 +1121,12 @@ def build_project_cancel_training_job_request( # pylint: disable=name-too-long def build_exported_model_get_exported_model_request( # pylint: disable=name-too-long - project_name: str, exported_model_name: str, **kwargs: Any + exported_model_name: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1148,11 +1148,11 @@ def build_exported_model_get_exported_model_request( # pylint: disable=name-too def build_exported_model_delete_exported_model_request( # pylint: disable=name-too-long - project_name: str, exported_model_name: str, **kwargs: Any + exported_model_name: str, project_name: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/exported-models/{exportedModelName}" path_format_arguments = { @@ -1169,13 +1169,13 @@ def build_exported_model_delete_exported_model_request( # pylint: disable=name- def build_exported_model_create_or_update_exported_model_request( # pylint: disable=name-too-long - project_name: str, exported_model_name: str, **kwargs: Any + exported_model_name: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/exported-models/{exportedModelName}" path_format_arguments = { @@ -1196,12 +1196,12 @@ def build_exported_model_create_or_update_exported_model_request( # pylint: dis def build_exported_model_get_exported_model_job_status_request( # pylint: disable=name-too-long - project_name: str, exported_model_name: str, job_id: str, **kwargs: Any + exported_model_name: str, job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1224,12 +1224,12 @@ def build_exported_model_get_exported_model_job_status_request( # pylint: disab def build_trained_model_get_trained_model_request( # pylint: disable=name-too-long - project_name: str, trained_model_label: str, **kwargs: Any + trained_model_label: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1251,11 +1251,11 @@ def build_trained_model_get_trained_model_request( # pylint: disable=name-too-l def build_trained_model_delete_trained_model_request( # pylint: disable=name-too-long - project_name: str, trained_model_label: str, **kwargs: Any + trained_model_label: str, project_name: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/models/{trainedModelLabel}" path_format_arguments = { @@ -1272,13 +1272,13 @@ def build_trained_model_delete_trained_model_request( # pylint: disable=name-to def build_trained_model_evaluate_model_request( # pylint: disable=name-too-long - project_name: str, trained_model_label: str, **kwargs: Any + trained_model_label: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/models/{trainedModelLabel}/:evaluate" path_format_arguments = { @@ -1299,11 +1299,11 @@ def build_trained_model_evaluate_model_request( # pylint: disable=name-too-long def build_trained_model_load_snapshot_request( # pylint: disable=name-too-long - project_name: str, trained_model_label: str, **kwargs: Any + trained_model_label: str, project_name: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) # Construct URL _url = "/authoring/analyze-conversations/projects/{projectName}/models/{trainedModelLabel}/:load-snapshot" path_format_arguments = { @@ -1320,12 +1320,12 @@ def build_trained_model_load_snapshot_request( # pylint: disable=name-too-long def build_trained_model_get_evaluation_status_request( # pylint: disable=name-too-long - project_name: str, trained_model_label: str, job_id: str, **kwargs: Any + trained_model_label: str, job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1348,8 +1348,8 @@ def build_trained_model_get_evaluation_status_request( # pylint: disable=name-t def build_trained_model_get_model_evaluation_results_request( # pylint: disable=name-too-long - project_name: str, trained_model_label: str, + project_name: str, *, string_index_type: Union[str, _models.StringIndexType], top: Optional[int] = None, @@ -1360,7 +1360,7 @@ def build_trained_model_get_model_evaluation_results_request( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1389,12 +1389,12 @@ def build_trained_model_get_model_evaluation_results_request( # pylint: disable def build_trained_model_get_model_evaluation_summary_request( # pylint: disable=name-too-long - project_name: str, trained_model_label: str, **kwargs: Any + trained_model_label: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1418,12 +1418,12 @@ def build_trained_model_get_model_evaluation_summary_request( # pylint: disable def build_trained_model_get_load_snapshot_status_request( # pylint: disable=name-too-long - project_name: str, trained_model_label: str, job_id: str, **kwargs: Any + trained_model_label: str, job_id: str, project_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1470,7 +1470,7 @@ def list_projects( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.ProjectDetails]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.ProjectDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1522,7 +1522,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProjectDetails], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.ProjectDetails], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1571,7 +1571,7 @@ def list_supported_languages( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.SupportedLanguage]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.SupportedLanguage]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1624,7 +1624,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.SupportedLanguage], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.SupportedLanguage], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1648,9 +1648,9 @@ def get_next(next_link=None): @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "top", "skip", "maxpagesize", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "top", "skip", "maxpagesize", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def list_assigned_resource_deployments( self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any @@ -1672,7 +1672,7 @@ def list_assigned_resource_deployments( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.AssignedProjectDeploymentsMetadata]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.AssignedProjectDeploymentsMetadata]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1724,7 +1724,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AssignedProjectDeploymentsMetadata], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.AssignedProjectDeploymentsMetadata], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1778,7 +1778,7 @@ def list_supported_prebuilt_entities( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.PrebuiltEntity]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.PrebuiltEntity]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1832,7 +1832,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.PrebuiltEntity], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.PrebuiltEntity], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1881,7 +1881,7 @@ def list_training_config_versions( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.TrainingConfigVersion]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.TrainingConfigVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1934,7 +1934,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TrainingConfigVersion], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.TrainingConfigVersion], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -2401,11 +2401,9 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get_deployment(self, project_name: str, deployment_name: str, **kwargs: Any) -> _models.ProjectDeployment: + def get_deployment(self, deployment_name: str, **kwargs: Any) -> _models.ProjectDeployment: """Gets the details of a deployment. - :param project_name: The new project name. Required. - :type project_name: str :param deployment_name: Represents deployment name. Required. :type deployment_name: str :return: ProjectDeployment. The ProjectDeployment is compatible with MutableMapping @@ -2426,8 +2424,8 @@ def get_deployment(self, project_name: str, deployment_name: str, **kwargs: Any) cls: ClsType[_models.ProjectDeployment] = kwargs.pop("cls", None) _request = build_deployment_get_deployment_request( - project_name=project_name, deployment_name=deployment_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2464,11 +2462,7 @@ def get_deployment(self, project_name: str, deployment_name: str, **kwargs: Any) return deserialized # type: ignore def _deploy_project_initial( - self, - project_name: str, - deployment_name: str, - body: Union[_models._models.CreateDeploymentDetails, JSON, IO[bytes]], - **kwargs: Any + self, deployment_name: str, body: Union[_models._models.CreateDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2492,8 +2486,8 @@ def _deploy_project_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_deployment_deploy_project_request( - project_name=project_name, deployment_name=deployment_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -2533,7 +2527,6 @@ def _deploy_project_initial( @overload def _begin_deploy_project( self, - project_name: str, deployment_name: str, body: _models._models.CreateDeploymentDetails, *, @@ -2542,37 +2535,19 @@ def _begin_deploy_project( ) -> LROPoller[None]: ... @overload def _begin_deploy_project( - self, - project_name: str, - deployment_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any + self, deployment_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_deploy_project( - self, - project_name: str, - deployment_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any + self, deployment_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @distributed_trace def _begin_deploy_project( - self, - project_name: str, - deployment_name: str, - body: Union[_models._models.CreateDeploymentDetails, JSON, IO[bytes]], - **kwargs: Any + self, deployment_name: str, body: Union[_models._models.CreateDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Creates a new deployment or replaces an existing one. - :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 body: The new deployment info. Is one of the following types: CreateDeploymentDetails, @@ -2593,7 +2568,6 @@ def _begin_deploy_project( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._deploy_project_initial( - project_name=project_name, deployment_name=deployment_name, body=body, content_type=content_type, @@ -2630,7 +2604,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_deployment_initial(self, project_name: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: + def _delete_deployment_initial(self, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2645,8 +2619,8 @@ def _delete_deployment_initial(self, project_name: str, deployment_name: str, ** cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_deployment_delete_deployment_request( - project_name=project_name, deployment_name=deployment_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2682,11 +2656,9 @@ def _delete_deployment_initial(self, project_name: str, deployment_name: str, ** return deserialized # type: ignore @distributed_trace - def _begin_delete_deployment(self, project_name: str, deployment_name: str, **kwargs: Any) -> LROPoller[None]: + def _begin_delete_deployment(self, deployment_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a project deployment. - :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: An instance of LROPoller that returns None @@ -2702,12 +2674,7 @@ def _begin_delete_deployment(self, project_name: str, deployment_name: str, **kw cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_deployment_initial( - project_name=project_name, - deployment_name=deployment_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + deployment_name=deployment_name, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -2738,16 +2705,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "deployment_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "deployment_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def _delete_deployment_from_resources_initial( # pylint: disable=name-too-long - self, - project_name: str, - deployment_name: str, - body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], - **kwargs: Any + self, deployment_name: str, body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2771,8 +2734,8 @@ def _delete_deployment_from_resources_initial( # pylint: disable=name-too-long _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_deployment_delete_deployment_from_resources_request( - project_name=project_name, deployment_name=deployment_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -2812,7 +2775,6 @@ def _delete_deployment_from_resources_initial( # pylint: disable=name-too-long @overload def _begin_delete_deployment_from_resources( self, - project_name: str, deployment_name: str, body: _models._models.DeleteDeploymentDetails, *, @@ -2821,46 +2783,29 @@ def _begin_delete_deployment_from_resources( ) -> LROPoller[None]: ... @overload def _begin_delete_deployment_from_resources( - self, - project_name: str, - deployment_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any + self, deployment_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_delete_deployment_from_resources( - self, - project_name: str, - deployment_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any + self, deployment_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "deployment_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "deployment_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def _begin_delete_deployment_from_resources( - self, - project_name: str, - deployment_name: str, - body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], - **kwargs: Any + self, deployment_name: str, body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: - """Deletes a project deployment from the specified assigned resources. + """Deletes a deployment from the specified project-assigned resources. - :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 body: The options for deleting the deployment. Is one of the following types: - DeleteDeploymentDetails, JSON, IO[bytes] Required. + :param body: The Language or AIService resource list for deleting the deployment.\\r\\n + The deployment will only be deleted from the specified resources, and will remain for the rest. + Is one of the following types: DeleteDeploymentDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.DeleteDeploymentDetails or JSON or IO[bytes] :return: An instance of LROPoller that returns None @@ -2877,7 +2822,6 @@ def _begin_delete_deployment_from_resources( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_deployment_from_resources_initial( - project_name=project_name, deployment_name=deployment_name, body=body, content_type=content_type, @@ -2916,17 +2860,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "deployment_name", "job_id", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "deployment_name", "job_id", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def _get_deployment_delete_from_resources_status( # pylint: disable=name-too-long - self, project_name: str, deployment_name: str, job_id: str, **kwargs: Any + self, deployment_name: str, job_id: str, **kwargs: Any ) -> _models._models.DeploymentDeleteFromResourcesState: """Gets the status of an existing delete deployment from specific resources job. - :param project_name: The new project name. Required. - :type project_name: str :param deployment_name: Represents deployment name. Required. :type deployment_name: str :param job_id: The job ID. Required. @@ -2951,9 +2893,9 @@ def _get_deployment_delete_from_resources_status( # pylint: disable=name-too-lo cls: ClsType[_models._models.DeploymentDeleteFromResourcesState] = kwargs.pop("cls", None) _request = build_deployment_get_deployment_delete_from_resources_status_request( - project_name=project_name, deployment_name=deployment_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2993,12 +2935,10 @@ def _get_deployment_delete_from_resources_status( # pylint: disable=name-too-lo @distributed_trace def _get_deployment_status( - self, project_name: str, deployment_name: str, job_id: str, **kwargs: Any + self, deployment_name: str, job_id: str, **kwargs: Any ) -> _models._models.DeploymentState: """Gets the status of an existing deployment job. - :param project_name: The new project name. Required. - :type project_name: str :param deployment_name: Represents deployment name. Required. :type deployment_name: str :param job_id: The job ID. Required. @@ -3021,9 +2961,9 @@ def _get_deployment_status( cls: ClsType[_models._models.DeploymentState] = kwargs.pop("cls", None) _request = build_deployment_get_deployment_status_request( - project_name=project_name, deployment_name=deployment_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3083,12 +3023,10 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list_trained_models( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> ItemPaged["_models.ProjectTrainedModel"]: """Lists the trained models belonging to a project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -3102,7 +3040,7 @@ def list_trained_models( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.ProjectTrainedModel]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.ProjectTrainedModel]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3116,7 +3054,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_trained_models_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -3155,7 +3093,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProjectTrainedModel], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.ProjectTrainedModel], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -3179,12 +3117,10 @@ def get_next(next_link=None): @distributed_trace def list_training_jobs( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> ItemPaged["_models.TrainingState"]: """Lists the non-expired training jobs created for a project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -3198,7 +3134,7 @@ def list_training_jobs( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.TrainingState]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.TrainingState]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3212,7 +3148,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_training_jobs_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -3251,7 +3187,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TrainingState], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.TrainingState], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -3275,17 +3211,15 @@ def get_next(next_link=None): @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "top", "skip", "maxpagesize", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "top", "skip", "maxpagesize", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def list_deployment_resources( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> ItemPaged["_models.AssignedDeploymentResource"]: - """Lists the deployments resources assigned to the project. + """Lists the Language or AIService resources assigned to the project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -3299,7 +3233,7 @@ def list_deployment_resources( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.AssignedDeploymentResource]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.AssignedDeploymentResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3313,7 +3247,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_deployment_resources_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -3352,7 +3286,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AssignedDeploymentResource], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.AssignedDeploymentResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -3376,12 +3310,10 @@ def get_next(next_link=None): @distributed_trace def list_deployments( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> ItemPaged["_models.ProjectDeployment"]: """Lists the deployments belonging to a project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -3395,7 +3327,7 @@ def list_deployments( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.ProjectDeployment]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.ProjectDeployment]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3409,7 +3341,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_deployments_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -3448,7 +3380,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ProjectDeployment], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.ProjectDeployment], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -3472,17 +3404,15 @@ def get_next(next_link=None): @distributed_trace @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "top", "skip", "maxpagesize", "accept"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "top", "skip", "maxpagesize", "accept"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def list_exported_models( - self, project_name: str, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any + self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any ) -> ItemPaged["_models.ExportedTrainedModel"]: """Lists the exported models belonging to a project. - :param project_name: The new project name. Required. - :type project_name: str :keyword top: The number of result items to return. Default value is None. :paramtype top: int :keyword skip: The number of result items to skip. Default value is None. @@ -3496,7 +3426,7 @@ def list_exported_models( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.ExportedTrainedModel]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.ExportedTrainedModel]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3510,7 +3440,7 @@ def prepare_request(next_link=None): if not next_link: _request = build_project_list_exported_models_request( - project_name=project_name, + project_name=self._config.project_name, top=top, skip=skip, maxpagesize=maxpagesize, @@ -3549,7 +3479,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.ExportedTrainedModel], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.ExportedTrainedModel], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -3572,15 +3502,12 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def _assign_deployment_resources_initial( - self, - project_name: str, - body: Union[_models._models.AssignDeploymentResourcesDetails, JSON, IO[bytes]], - **kwargs: Any + self, body: Union[_models._models.AssignDeploymentResourcesDetails, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3604,7 +3531,7 @@ def _assign_deployment_resources_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_assign_deployment_resources_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3644,7 +3571,6 @@ def _assign_deployment_resources_initial( @overload def _begin_assign_deployment_resources( self, - project_name: str, body: _models._models.AssignDeploymentResourcesDetails, *, content_type: str = "application/json", @@ -3652,34 +3578,29 @@ def _begin_assign_deployment_resources( ) -> LROPoller[None]: ... @overload def _begin_assign_deployment_resources( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_assign_deployment_resources( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def _begin_assign_deployment_resources( - self, - project_name: str, - body: Union[_models._models.AssignDeploymentResourcesDetails, JSON, IO[bytes]], - **kwargs: Any + self, body: Union[_models._models.AssignDeploymentResourcesDetails, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. This API is - available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, check here: + """Assign new Language or AIService Azure resources to a project to allowing deployment to them. + This API is available only via AAD authentication and not supported via subscription key + authentication. For more details about AAD authentication, check here: `https://learn.microsoft.com/en-us/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory `_. - :param project_name: The name of the project to use. Required. - :type project_name: str - :param body: The new project resources info. Is one of the following types: + :param body: The new project resources to be assigned. Is one of the following types: AssignDeploymentResourcesDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.AssignDeploymentResourcesDetails or @@ -3698,13 +3619,7 @@ def _begin_assign_deployment_resources( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._assign_deployment_resources_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -3735,15 +3650,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def _unassign_deployment_resources_initial( - self, - project_name: str, - body: Union[_models._models.UnassignDeploymentResourcesDetails, JSON, IO[bytes]], - **kwargs: Any + self, body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3767,7 +3679,7 @@ def _unassign_deployment_resources_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_unassign_deployment_resources_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3806,44 +3718,32 @@ def _unassign_deployment_resources_initial( @overload def _begin_unassign_deployment_resources( - self, - project_name: str, - body: _models._models.UnassignDeploymentResourcesDetails, - *, - content_type: str = "application/json", - **kwargs: Any + self, body: _models._models.DeleteDeploymentDetails, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_unassign_deployment_resources( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_unassign_deployment_resources( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def _begin_unassign_deployment_resources( - self, - project_name: str, - body: Union[_models._models.UnassignDeploymentResourcesDetails, JSON, IO[bytes]], - **kwargs: Any + self, body: Union[_models._models.DeleteDeploymentDetails, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. + """Unassign resources from a project. This disallows deployment to these resources. - :param project_name: The name of the project to use. Required. - :type project_name: str - :param body: The info for the deployment resources to be deleted. Is one of the following - types: UnassignDeploymentResourcesDetails, JSON, IO[bytes] Required. - :type body: - ~azure.ai.language.conversations.authoring.models._models.UnassignDeploymentResourcesDetails or - JSON or IO[bytes] + :param body: The list of Language or AIService Azure resource IDs to be unassigned. Is one of + the following types: DeleteDeploymentDetails, JSON, IO[bytes] Required. + :type body: ~azure.ai.language.conversations.authoring.models._models.DeleteDeploymentDetails + or JSON or IO[bytes] :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -3858,13 +3758,7 @@ def _begin_unassign_deployment_resources( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._unassign_deployment_resources_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -3896,17 +3790,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "job_id", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "job_id", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def _get_assign_deployment_resources_status( - self, project_name: str, job_id: str, **kwargs: Any + self, job_id: str, **kwargs: Any ) -> _models._models.DeploymentResourcesState: - """Gets the status of an existing assign deployment resources job. + """Gets the status of an existing assign project resources job. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: DeploymentResourcesState. The DeploymentResourcesState is compatible with @@ -3928,8 +3820,8 @@ def _get_assign_deployment_resources_status( cls: ClsType[_models._models.DeploymentResourcesState] = kwargs.pop("cls", None) _request = build_project_get_assign_deployment_resources_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3969,17 +3861,15 @@ def _get_assign_deployment_resources_status( @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "job_id", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-11-01", + params_added_on={"2025-11-01": ["api_version", "project_name", "job_id", "accept"]}, + api_versions_list=["2025-11-01", "2025-05-15-preview", "2025-11-15-preview"], ) def _get_unassign_deployment_resources_status( # pylint: disable=name-too-long - self, project_name: str, job_id: str, **kwargs: Any + self, job_id: str, **kwargs: Any ) -> _models._models.DeploymentResourcesState: - """Gets the status of an existing unassign deployment resources job. + """Gets the status of an existing unassign project resources job. - :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: DeploymentResourcesState. The DeploymentResourcesState is compatible with @@ -4001,8 +3891,8 @@ def _get_unassign_deployment_resources_status( # pylint: disable=name-too-long cls: ClsType[_models._models.DeploymentResourcesState] = kwargs.pop("cls", None) _request = build_project_get_unassign_deployment_resources_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4041,7 +3931,7 @@ def _get_unassign_deployment_resources_status( # pylint: disable=name-too-long return deserialized # type: ignore def _swap_deployments_initial( - self, project_name: str, body: Union[_models._models.SwapDeploymentsDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.SwapDeploymentsDetails, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4065,7 +3955,7 @@ def _swap_deployments_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_swap_deployments_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -4104,30 +3994,23 @@ def _swap_deployments_initial( @overload def _begin_swap_deployments( - self, - project_name: str, - body: _models._models.SwapDeploymentsDetails, - *, - content_type: str = "application/json", - **kwargs: Any + self, body: _models._models.SwapDeploymentsDetails, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_swap_deployments( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_swap_deployments( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @distributed_trace def _begin_swap_deployments( - self, project_name: str, body: Union[_models._models.SwapDeploymentsDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.SwapDeploymentsDetails, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Swaps two existing deployments with each other. - :param project_name: The name of the project to use. Required. - :type project_name: str :param body: The job object to swap two deployments. Is one of the following types: SwapDeploymentsDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.SwapDeploymentsDetails or @@ -4146,13 +4029,7 @@ def _begin_swap_deployments( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._swap_deployments_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -4183,13 +4060,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def _get_swap_deployments_status( - self, project_name: str, job_id: str, **kwargs: Any - ) -> _models._models.SwapDeploymentsState: + def _get_swap_deployments_status(self, job_id: str, **kwargs: Any) -> _models._models.SwapDeploymentsState: """Gets the status of an existing swap deployment job. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: SwapDeploymentsState. The SwapDeploymentsState is compatible with MutableMapping @@ -4210,8 +4083,8 @@ def _get_swap_deployments_status( cls: ClsType[_models._models.SwapDeploymentsState] = kwargs.pop("cls", None) _request = build_project_get_swap_deployments_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4250,11 +4123,9 @@ def _get_swap_deployments_status( return deserialized # type: ignore @distributed_trace - def _get_project(self, project_name: str, **kwargs: Any) -> _models.ProjectDetails: + def _get_project(self, **kwargs: Any) -> _models.ProjectDetails: """Gets the details of a project. - :param project_name: The new project name. Required. - :type project_name: str :return: ProjectDetails. The ProjectDetails is compatible with MutableMapping :rtype: ~azure.ai.language.conversations.authoring.models.ProjectDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -4273,7 +4144,7 @@ def _get_project(self, project_name: str, **kwargs: Any) -> _models.ProjectDetai cls: ClsType[_models.ProjectDetails] = kwargs.pop("cls", None) _request = build_project_get_project_request( - project_name=project_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4373,7 +4244,6 @@ def _get_project_deletion_status(self, job_id: str, **kwargs: Any) -> _models._m def _import_method_initial( self, - project_name: str, body: Union[_models._models.ExportedProject, JSON, IO[bytes]], *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -4401,7 +4271,7 @@ def _import_method_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_import_method_request( - project_name=project_name, + project_name=self._config.project_name, exported_project_format=exported_project_format, content_type=content_type, api_version=self._config.api_version, @@ -4442,7 +4312,6 @@ def _import_method_initial( @overload def _begin_import_method( self, - project_name: str, body: _models._models.ExportedProject, *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -4452,7 +4321,6 @@ def _begin_import_method( @overload def _begin_import_method( self, - project_name: str, body: JSON, *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -4462,7 +4330,6 @@ def _begin_import_method( @overload def _begin_import_method( self, - project_name: str, body: IO[bytes], *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -4473,7 +4340,6 @@ def _begin_import_method( @distributed_trace def _begin_import_method( self, - project_name: str, body: Union[_models._models.ExportedProject, JSON, IO[bytes]], *, exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -4482,8 +4348,6 @@ def _begin_import_method( """Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - :param project_name: The name of the project to use. Required. - :type project_name: str :param body: The project data to import. Is one of the following types: ExportedProject, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.ExportedProject or JSON @@ -4506,7 +4370,6 @@ def _begin_import_method( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._import_method_initial( - project_name=project_name, body=body, exported_project_format=exported_project_format, content_type=content_type, @@ -4545,7 +4408,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _export_initial( self, - project_name: str, *, string_index_type: Union[str, _models.StringIndexType], exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -4567,7 +4429,7 @@ def _export_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_project_export_request( - project_name=project_name, + project_name=self._config.project_name, string_index_type=string_index_type, exported_project_format=exported_project_format, asset_kind=asset_kind, @@ -4609,7 +4471,6 @@ def _export_initial( @distributed_trace def _begin_export( self, - project_name: str, *, string_index_type: Union[str, _models.StringIndexType], exported_project_format: Optional[Union[str, _models._enums.ExportedProjectFormat]] = None, @@ -4619,8 +4480,6 @@ def _begin_export( ) -> LROPoller[None]: """Triggers a job to export a project's data. - :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 `_. Known values are: "Utf16CodeUnit", "Utf8CodeUnit", @@ -4649,7 +4508,6 @@ def _begin_export( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._export_initial( - project_name=project_name, string_index_type=string_index_type, exported_project_format=exported_project_format, asset_kind=asset_kind, @@ -4688,11 +4546,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def _get_export_status(self, project_name: str, job_id: str, **kwargs: Any) -> _models._models.ExportProjectState: + def _get_export_status(self, job_id: str, **kwargs: Any) -> _models._models.ExportProjectState: """Gets the status of an export job. Once job completes, returns the project metadata, and assets. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: ExportProjectState. The ExportProjectState is compatible with MutableMapping @@ -4713,8 +4569,8 @@ def _get_export_status(self, project_name: str, job_id: str, **kwargs: Any) -> _ cls: ClsType[_models._models.ExportProjectState] = kwargs.pop("cls", None) _request = build_project_get_export_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4755,7 +4611,6 @@ def _get_export_status(self, project_name: str, job_id: str, **kwargs: Any) -> _ @overload def _copy_project_authorization( self, - project_name: str, *, project_kind: Union[str, _models.ProjectKind], content_type: str = "application/json", @@ -4765,22 +4620,21 @@ def _copy_project_authorization( ) -> _models._models.CopyProjectDetails: ... @overload def _copy_project_authorization( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> _models._models.CopyProjectDetails: ... @overload def _copy_project_authorization( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models._models.CopyProjectDetails: ... @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "content_type", "accept"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def _copy_project_authorization( self, - project_name: str, body: Union[JSON, IO[bytes]] = _Unset, *, project_kind: Union[str, _models.ProjectKind] = _Unset, @@ -4790,8 +4644,6 @@ def _copy_project_authorization( ) -> _models._models.CopyProjectDetails: """Generates a copy project operation authorization to the current target Azure resource. - :param project_name: The new project name. Required. - :type project_name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] :keyword project_kind: Represents the project kind. Known values are: "Conversation", @@ -4838,7 +4690,7 @@ def _copy_project_authorization( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_copy_project_authorization_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -4879,12 +4731,12 @@ def _copy_project_authorization( return deserialized # type: ignore @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def _copy_project_initial( - self, project_name: str, body: Union[_models._models.CopyProjectDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.CopyProjectDetails, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4908,7 +4760,7 @@ def _copy_project_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_copy_project_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -4947,35 +4799,28 @@ def _copy_project_initial( @overload def _begin_copy_project( - self, - project_name: str, - body: _models._models.CopyProjectDetails, - *, - content_type: str = "application/json", - **kwargs: Any + self, body: _models._models.CopyProjectDetails, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_copy_project( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_copy_project( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def _begin_copy_project( - self, project_name: str, body: Union[_models._models.CopyProjectDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.CopyProjectDetails, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Copies an existing project to another Azure resource. - :param project_name: The name of the project to use. Required. - :type project_name: str :param body: The copy project info. Is one of the following types: CopyProjectDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.CopyProjectDetails or @@ -4994,13 +4839,7 @@ def _begin_copy_project( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._copy_project_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -5032,17 +4871,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "job_id", "accept"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "job_id", "accept"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) - def _get_copy_project_status( - self, project_name: str, job_id: str, **kwargs: Any - ) -> _models._models.CopyProjectState: + def _get_copy_project_status(self, job_id: str, **kwargs: Any) -> _models._models.CopyProjectState: """Gets the status of an existing copy project job. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: CopyProjectState. The CopyProjectState is compatible with MutableMapping @@ -5063,8 +4898,8 @@ def _get_copy_project_status( cls: ClsType[_models._models.CopyProjectState] = kwargs.pop("cls", None) _request = build_project_get_copy_project_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5103,7 +4938,7 @@ def _get_copy_project_status( return deserialized # type: ignore def _train_initial( - self, project_name: str, body: Union[_models._models.TrainingJobDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.TrainingJobDetails, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5127,7 +4962,7 @@ def _train_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_project_train_request( - project_name=project_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -5166,30 +5001,23 @@ def _train_initial( @overload def _begin_train( - self, - project_name: str, - body: _models._models.TrainingJobDetails, - *, - content_type: str = "application/json", - **kwargs: Any + self, body: _models._models.TrainingJobDetails, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.TrainingJobResult]: ... @overload def _begin_train( - self, project_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.TrainingJobResult]: ... @overload def _begin_train( - self, project_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.TrainingJobResult]: ... @distributed_trace def _begin_train( - self, project_name: str, body: Union[_models._models.TrainingJobDetails, JSON, IO[bytes]], **kwargs: Any + self, body: Union[_models._models.TrainingJobDetails, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.TrainingJobResult]: """Triggers a training job for a project. - :param project_name: The name of the project to use. Required. - :type project_name: str :param body: The training input parameters. Is one of the following types: TrainingJobDetails, JSON, IO[bytes] Required. :type body: ~azure.ai.language.conversations.authoring.models._models.TrainingJobDetails or @@ -5210,13 +5038,7 @@ def _begin_train( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._train_initial( - project_name=project_name, - body=body, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -5257,11 +5079,9 @@ def get_long_running_output(pipeline_response): ) @distributed_trace - def _get_training_status(self, project_name: str, job_id: str, **kwargs: Any) -> _models.TrainingState: + def _get_training_status(self, job_id: str, **kwargs: Any) -> _models.TrainingState: """Gets the status for a training job. - :param project_name: The new project name. Required. - :type project_name: str :param job_id: The job ID. Required. :type job_id: str :return: TrainingState. The TrainingState is compatible with MutableMapping @@ -5282,8 +5102,8 @@ def _get_training_status(self, project_name: str, job_id: str, **kwargs: Any) -> cls: ClsType[_models.TrainingState] = kwargs.pop("cls", None) _request = build_project_get_training_status_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5319,7 +5139,7 @@ def _get_training_status(self, project_name: str, job_id: str, **kwargs: Any) -> return deserialized # type: ignore - def _cancel_training_job_initial(self, project_name: str, job_id: str, **kwargs: Any) -> Iterator[bytes]: + def _cancel_training_job_initial(self, job_id: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5334,8 +5154,8 @@ def _cancel_training_job_initial(self, project_name: str, job_id: str, **kwargs: cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_project_cancel_training_job_request( - project_name=project_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5371,13 +5191,9 @@ def _cancel_training_job_initial(self, project_name: str, job_id: str, **kwargs: return deserialized # type: ignore @distributed_trace - def _begin_cancel_training_job( - self, project_name: str, job_id: str, **kwargs: Any - ) -> LROPoller[_models.TrainingJobResult]: + def begin_cancel_training_job(self, job_id: str, **kwargs: Any) -> LROPoller[_models.TrainingJobResult]: """Triggers a cancellation for a running training job. - :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: An instance of LROPoller that returns TrainingJobResult. The TrainingJobResult is @@ -5395,12 +5211,7 @@ def _begin_cancel_training_job( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._cancel_training_job_initial( - project_name=project_name, - job_id=job_id, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + job_id=job_id, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) @@ -5462,17 +5273,13 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name", "accept"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name", "accept"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) - def get_exported_model( - self, project_name: str, exported_model_name: str, **kwargs: Any - ) -> _models.ExportedTrainedModel: + def get_exported_model(self, exported_model_name: str, **kwargs: Any) -> _models.ExportedTrainedModel: """Gets the details of an exported model. - :param project_name: The new project name. Required. - :type project_name: str :param exported_model_name: The exported model name. Required. :type exported_model_name: str :return: ExportedTrainedModel. The ExportedTrainedModel is compatible with MutableMapping @@ -5493,8 +5300,8 @@ def get_exported_model( cls: ClsType[_models.ExportedTrainedModel] = kwargs.pop("cls", None) _request = build_exported_model_get_exported_model_request( - project_name=project_name, exported_model_name=exported_model_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5531,13 +5338,11 @@ def get_exported_model( return deserialized # type: ignore @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) - def _delete_exported_model_initial( - self, project_name: str, exported_model_name: str, **kwargs: Any - ) -> Iterator[bytes]: + def _delete_exported_model_initial(self, exported_model_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5552,8 +5357,8 @@ def _delete_exported_model_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_exported_model_delete_exported_model_request( - project_name=project_name, exported_model_name=exported_model_name, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5590,17 +5395,13 @@ def _delete_exported_model_initial( @distributed_trace @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) - def _begin_delete_exported_model( - self, project_name: str, exported_model_name: str, **kwargs: Any - ) -> LROPoller[None]: + def _begin_delete_exported_model(self, exported_model_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes an existing exported model. - :param project_name: The name of the project to use. Required. - :type project_name: str :param exported_model_name: The exported model name. Required. :type exported_model_name: str :return: An instance of LROPoller that returns None @@ -5616,7 +5417,6 @@ def _begin_delete_exported_model( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_exported_model_initial( - project_name=project_name, exported_model_name=exported_model_name, cls=lambda x, y, z: x, headers=_headers, @@ -5652,13 +5452,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name", "content_type"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def _create_or_update_exported_model_initial( self, - project_name: str, exported_model_name: str, body: Union[_models._models.ExportedModelDetails, JSON, IO[bytes]], **kwargs: Any @@ -5685,8 +5484,8 @@ def _create_or_update_exported_model_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_exported_model_create_or_update_exported_model_request( - project_name=project_name, exported_model_name=exported_model_name, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -5726,7 +5525,6 @@ def _create_or_update_exported_model_initial( @overload def _begin_create_or_update_exported_model( self, - project_name: str, exported_model_name: str, body: _models._models.ExportedModelDetails, *, @@ -5735,42 +5533,27 @@ def _begin_create_or_update_exported_model( ) -> LROPoller[None]: ... @overload def _begin_create_or_update_exported_model( - self, - project_name: str, - exported_model_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any + self, exported_model_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @overload def _begin_create_or_update_exported_model( - self, - project_name: str, - exported_model_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any + self, exported_model_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: ... @distributed_trace @api_version_validation( - method_added_on="2024-11-15-preview", - params_added_on={"2024-11-15-preview": ["api_version", "project_name", "exported_model_name", "content_type"]}, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "exported_model_name", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def _begin_create_or_update_exported_model( self, - project_name: str, exported_model_name: str, body: Union[_models._models.ExportedModelDetails, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Creates a new exported model or replaces an existing one. - :param project_name: The name of the project to use. Required. - :type project_name: str :param exported_model_name: The exported model name. Required. :type exported_model_name: str :param body: The exported model info. Is one of the following types: ExportedModelDetails, @@ -5791,7 +5574,6 @@ def _begin_create_or_update_exported_model( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_exported_model_initial( - project_name=project_name, exported_model_name=exported_model_name, body=body, content_type=content_type, @@ -5830,19 +5612,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace @api_version_validation( - method_added_on="2024-11-15-preview", + method_added_on="2025-05-15-preview", params_added_on={ - "2024-11-15-preview": ["api_version", "project_name", "exported_model_name", "job_id", "accept"] + "2025-05-15-preview": ["api_version", "project_name", "exported_model_name", "job_id", "accept"] }, - api_versions_list=["2024-11-15-preview", "2025-05-15-preview"], + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def _get_exported_model_job_status( - self, project_name: str, exported_model_name: str, job_id: str, **kwargs: Any + self, exported_model_name: str, job_id: str, **kwargs: Any ) -> _models._models.ExportedModelState: """Gets the status for an existing job to create or update an exported model. - :param project_name: The new project name. Required. - :type project_name: str :param exported_model_name: The exported model name. Required. :type exported_model_name: str :param job_id: The job ID. Required. @@ -5865,9 +5645,9 @@ def _get_exported_model_job_status( cls: ClsType[_models._models.ExportedModelState] = kwargs.pop("cls", None) _request = build_exported_model_get_exported_model_job_status_request( - project_name=project_name, exported_model_name=exported_model_name, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5926,13 +5706,9 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get_trained_model( - self, project_name: str, trained_model_label: str, **kwargs: Any - ) -> _models.ProjectTrainedModel: + def get_trained_model(self, trained_model_label: str, **kwargs: Any) -> _models.ProjectTrainedModel: """Gets the details of a trained model. - :param project_name: The new project name. Required. - :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str :return: ProjectTrainedModel. The ProjectTrainedModel is compatible with MutableMapping @@ -5953,8 +5729,8 @@ def get_trained_model( cls: ClsType[_models.ProjectTrainedModel] = kwargs.pop("cls", None) _request = build_trained_model_get_trained_model_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5992,12 +5768,10 @@ def get_trained_model( @distributed_trace def delete_trained_model( # pylint: disable=inconsistent-return-statements - self, project_name: str, trained_model_label: str, **kwargs: Any + self, trained_model_label: str, **kwargs: Any ) -> None: """Deletes an existing trained model. - :param project_name: The new project name. Required. - :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str :return: None @@ -6018,8 +5792,8 @@ def delete_trained_model( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) _request = build_trained_model_delete_trained_model_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6044,16 +5818,12 @@ def delete_trained_model( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "trained_model_label", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "trained_model_label", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def _evaluate_model_initial( - self, - project_name: str, - trained_model_label: str, - body: Union[_models.EvaluationDetails, JSON, IO[bytes]], - **kwargs: Any + self, trained_model_label: str, body: Union[_models.EvaluationDetails, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6077,8 +5847,8 @@ def _evaluate_model_initial( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_trained_model_evaluate_model_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -6118,7 +5888,6 @@ def _evaluate_model_initial( @overload def _begin_evaluate_model( self, - project_name: str, trained_model_label: str, body: _models.EvaluationDetails, *, @@ -6127,42 +5896,24 @@ def _begin_evaluate_model( ) -> LROPoller[_models._models.EvaluationJobResult]: ... @overload def _begin_evaluate_model( - self, - project_name: str, - trained_model_label: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any + self, trained_model_label: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models._models.EvaluationJobResult]: ... @overload def _begin_evaluate_model( - self, - project_name: str, - trained_model_label: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any + self, trained_model_label: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models._models.EvaluationJobResult]: ... @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", - params_added_on={"2023-04-15-preview": ["api_version", "project_name", "trained_model_label", "content_type"]}, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + method_added_on="2025-05-15-preview", + params_added_on={"2025-05-15-preview": ["api_version", "project_name", "trained_model_label", "content_type"]}, + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def _begin_evaluate_model( - self, - project_name: str, - trained_model_label: str, - body: Union[_models.EvaluationDetails, JSON, IO[bytes]], - **kwargs: Any + self, trained_model_label: str, body: Union[_models.EvaluationDetails, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models._models.EvaluationJobResult]: """Triggers evaluation operation on a trained model. - :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 :param body: The training input parameters. Is one of the following types: EvaluationDetails, @@ -6185,7 +5936,6 @@ def _begin_evaluate_model( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._evaluate_model_initial( - project_name=project_name, trained_model_label=trained_model_label, body=body, content_type=content_type, @@ -6225,17 +5975,17 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models._models.EvaluationJobResult].from_continuation_token( # pylint:disable=protected-access + return LROPoller[_models._models.EvaluationJobResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models._models.EvaluationJobResult]( # pylint:disable=protected-access + return LROPoller[_models._models.EvaluationJobResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _load_snapshot_initial(self, project_name: str, trained_model_label: str, **kwargs: Any) -> Iterator[bytes]: + def _load_snapshot_initial(self, trained_model_label: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6250,8 +6000,8 @@ def _load_snapshot_initial(self, project_name: str, trained_model_label: str, ** cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_trained_model_load_snapshot_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6287,11 +6037,9 @@ def _load_snapshot_initial(self, project_name: str, trained_model_label: str, ** return deserialized # type: ignore @distributed_trace - def _begin_load_snapshot(self, project_name: str, trained_model_label: str, **kwargs: Any) -> LROPoller[None]: + def _begin_load_snapshot(self, trained_model_label: str, **kwargs: Any) -> LROPoller[None]: """Restores the snapshot of this trained model to be the current working directory of the project. - :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: An instance of LROPoller that returns None @@ -6307,7 +6055,6 @@ def _begin_load_snapshot(self, project_name: str, trained_model_label: str, **kw cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._load_snapshot_initial( - project_name=project_name, trained_model_label=trained_model_label, cls=lambda x, y, z: x, headers=_headers, @@ -6344,19 +6091,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace @api_version_validation( - method_added_on="2023-04-15-preview", + method_added_on="2025-05-15-preview", params_added_on={ - "2023-04-15-preview": ["api_version", "project_name", "trained_model_label", "job_id", "accept"] + "2025-05-15-preview": ["api_version", "project_name", "trained_model_label", "job_id", "accept"] }, - api_versions_list=["2023-04-15-preview", "2024-11-15-preview", "2025-05-15-preview"], + api_versions_list=["2025-05-15-preview", "2025-11-15-preview"], ) def _get_evaluation_status( - self, project_name: str, trained_model_label: str, job_id: str, **kwargs: Any + self, trained_model_label: str, job_id: str, **kwargs: Any ) -> _models._models.EvaluationState: """Gets the status for an evaluation job. - :param project_name: The new project name. Required. - :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str :param job_id: The job ID. Required. @@ -6379,9 +6124,9 @@ def _get_evaluation_status( cls: ClsType[_models._models.EvaluationState] = kwargs.pop("cls", None) _request = build_trained_model_get_evaluation_status_request( - project_name=project_name, trained_model_label=trained_model_label, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6422,7 +6167,6 @@ def _get_evaluation_status( @distributed_trace def get_model_evaluation_results( self, - project_name: str, trained_model_label: str, *, string_index_type: Union[str, _models.StringIndexType], @@ -6433,8 +6177,6 @@ def get_model_evaluation_results( """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. - :param project_name: The new project name. 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 @@ -6456,7 +6198,7 @@ def get_model_evaluation_results( _params = kwargs.pop("params", {}) or {} maxpagesize = kwargs.pop("maxpagesize", None) - cls: ClsType[List[_models.UtteranceEvaluationResult]] = kwargs.pop("cls", None) + cls: ClsType[list[_models.UtteranceEvaluationResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6470,8 +6212,8 @@ def prepare_request(next_link=None): if not next_link: _request = build_trained_model_get_model_evaluation_results_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, string_index_type=string_index_type, top=top, skip=skip, @@ -6511,7 +6253,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.UtteranceEvaluationResult], deserialized.get("value", [])) + list_of_elem = _deserialize(list[_models.UtteranceEvaluationResult], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6534,14 +6276,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_model_evaluation_summary( - self, project_name: str, trained_model_label: str, **kwargs: Any - ) -> _models.EvalSummary: + def get_model_evaluation_summary(self, trained_model_label: str, **kwargs: Any) -> _models.EvalSummary: """Gets the evaluation summary of a trained model. The summary includes high level performance measurements of the model e.g., F1, Precision, Recall, etc. - :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: EvalSummary. The EvalSummary is compatible with MutableMapping @@ -6562,8 +6300,8 @@ def get_model_evaluation_summary( cls: ClsType[_models.EvalSummary] = kwargs.pop("cls", None) _request = build_trained_model_get_model_evaluation_summary_request( - project_name=project_name, trained_model_label=trained_model_label, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6601,12 +6339,10 @@ def get_model_evaluation_summary( @distributed_trace def _get_load_snapshot_status( - self, project_name: str, trained_model_label: str, job_id: str, **kwargs: Any + self, trained_model_label: str, job_id: str, **kwargs: Any ) -> _models._models.LoadSnapshotState: """Gets the status for loading a snapshot. - :param project_name: The new project name. Required. - :type project_name: str :param trained_model_label: The trained model label. Required. :type trained_model_label: str :param job_id: The job ID. Required. @@ -6629,9 +6365,9 @@ def _get_load_snapshot_status( cls: ClsType[_models._models.LoadSnapshotState] = kwargs.pop("cls", None) _request = build_trained_model_get_load_snapshot_status_request( - project_name=project_name, trained_model_label=trained_model_label, job_id=job_id, + project_name=self._config.project_name, api_version=self._config.api_version, headers=_headers, params=_params, diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_patch.py index 43cd6bc6524b..87676c65a8f0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_patch.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,10 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from ._project_op_patch import ProjectOperations -from ._trained_model_op_patch import TrainedModelOperations -from ._deployment_op_patch import DeploymentOperations -from ._exported_model_op_patch import ExportedModelOperations + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): @@ -21,6 +19,3 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ - - -__all__ = ["ProjectOperations", "DeploymentOperations", "ExportedModelOperations", "TrainedModelOperations"] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_project_op_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_project_op_patch.py deleted file mode 100644 index 30621495f13d..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_project_op_patch.py +++ /dev/null @@ -1,918 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from collections.abc import MutableMapping # pylint:disable=import-error -from typing import IO, Any, Callable, Dict, Optional, TypeVar, Union, cast, overload - -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace - -from .._utils.model_base import _deserialize -from ..models._patch import _JobsPollingMethod -from ..models import ( - AssignedDeploymentResource, - AssignDeploymentResourcesDetails, - CopyProjectDetails, - CopyProjectState, - DeploymentResourcesState, - ExportProjectState, - ExportedProject, - ExportedProjectFormat, - ExportedTrainedModel, - ProjectDeletionState, - ProjectDeployment, - ProjectDetails, - ProjectKind, - ProjectTrainedModel, - StringIndexType, - SwapDeploymentsDetails, - SwapDeploymentsState, - TrainingJobDetails, - TrainingJobResult, - TrainingState, - UnassignDeploymentResourcesDetails, -) -from ._operations import ProjectOperations as ProjectOperationsGenerated - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -_Unset: Any = object() -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - - -class ProjectOperations(ProjectOperationsGenerated): - """Patched ProjectOperationsOperations that auto-injects project_name.""" - - def __init__(self, *args, project_name: str, **kwargs: Any): - super().__init__(*args, **kwargs) - self._project_name = project_name - - @overload - def begin_import( - self, - body: ExportedProject, - *, - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """ - Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - - :param body: The project data to import. Required. - :type body: ~azure.ai.language.conversations.authoring.models.ExportedProject - :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 or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - def begin_import( - self, - body: JSON, - *, - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """ - Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - - :param body: The project data to import. Required. - :type body: JSON - :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 or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @overload - def begin_import( - self, - body: IO[bytes], - *, - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """ - Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - - :param body: The project data to import. Required. - :type body: IO[bytes] - :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 or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - - @distributed_trace - def begin_import( - self, - body: Union[ExportedProject, JSON, IO[bytes]], - *, - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """ - Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - - :param body: The project data to import. Required. - :type body: ~azure.ai.language.conversations.authoring.models.ExportedProject or JSON or IO[bytes] - :keyword exported_project_format: The format of the exported project file to use. Known values are: "Conversation" and "Luis". - :paramtype exported_project_format: str or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - - """ - return super()._begin_import_method( - project_name=self._project_name, - body=body, - exported_project_format=exported_project_format, - content_type=content_type, - **kwargs, - ) - - @overload - def begin_assign_deployment_resources( - self, body: AssignDeploymentResourcesDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. This API is - available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, check here: - `https://learn.microsoft.com/en-us/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory - `_. - - :param body: The new project resources info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.AssignDeploymentResourcesDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_assign_deployment_resources( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. This API is - available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, check here: - `https://learn.microsoft.com/en-us/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory - `_. - - :param body: The new project resources info. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_assign_deployment_resources( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. This API is - available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, check here: - `https://learn.microsoft.com/en-us/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory - `_. - - :param body: The new project resources info. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_assign_deployment_resources( - self, body: Union[AssignDeploymentResourcesDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Assign new Azure resources to a project to allow deploying new deployments to them. - This API is available only via AAD authentication and not supported via subscription key authentication. - For more details about AAD authentication, see: - https://learn.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory - - :param body: The new project resources info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.AssignDeploymentResourcesDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_assign_deployment_resources( - project_name=self._project_name, body=body, content_type=content_type, **kwargs - ) - - @overload - def begin_swap_deployments( - self, body: SwapDeploymentsDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Swaps two existing deployments with each other. - - :param body: The job object to swap two deployments. Required. - :type body: ~azure.ai.language.conversations.authoring.models.SwapDeploymentsDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_swap_deployments( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Swaps two existing deployments with each other. - - :param body: The job object to swap two deployments. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_swap_deployments( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Swaps two existing deployments with each other. - - :param body: The job object to swap two deployments. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_swap_deployments( - self, body: Union[SwapDeploymentsDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Swaps two existing deployments with each other. - - :param body: The job object to swap two deployments. Required. - :type body: ~azure.ai.language.conversations.authoring.models.SwapDeploymentsDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_swap_deployments( - project_name=self._project_name, body=body, content_type=content_type, **kwargs - ) - - @overload - def begin_unassign_deployment_resources( - self, body: UnassignDeploymentResourcesDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. - - :param body: The info for the deployment resources to be deleted. Required. - :type body: ~azure.ai.language.conversations.authoring.models.UnassignDeploymentResourcesDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_unassign_deployment_resources( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. - - :param body: The info for the deployment resources to be deleted. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_unassign_deployment_resources( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. - - :param body: The info for the deployment resources to be deleted. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_unassign_deployment_resources( - self, body: Union[UnassignDeploymentResourcesDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Unassign resources from a project. This disallows deploying new deployments to these resources, - and deletes existing deployments assigned to them. - - :param body: The info for the deployment resources to be deleted. Required. - :type body: ~azure.ai.language.conversations.authoring.models.UnassignDeploymentResourcesDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_unassign_deployment_resources( - project_name=self._project_name, body=body, content_type=content_type, **kwargs - ) - - @distributed_trace - def begin_cancel_training_job( # pylint: disable=function-redefined - self, - job_id: str, - **kwargs: Any - ) -> LROPoller[TrainingJobResult]: - """ - Cancel a training job without requiring project_name explicitly. - - :param job_id: The identifier of the training job to cancel. Required. - :type job_id: str - :return: An instance of LROPoller that returns TrainingJobResult. - :rtype: ~azure.core.polling.LROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[TrainingJobResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - - if cont_token is None: - # 1) Send initial cancel request; keep PipelineResponse for the poller - initial = self._cancel_training_job_initial( - project_name=self._project_name, - job_id=job_id, - cls=lambda x, y, z: x, # return PipelineResponse unchanged - headers=_headers, - params=_params, - **kwargs, - ) - initial.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - # 2) Deserializer: extract nested "result" as TrainingJobResult - def get_long_running_output(pipeline_response): - body = pipeline_response.http_response.json() or {} - result_dict = body.get("result", {}) or {} - obj = _deserialize(TrainingJobResult, result_dict) - if cls: - return cls(pipeline_response, obj, {}) # type: ignore - return obj - - # 3) Resolve {Endpoint} in Operation-Location for your poller - path_format_arguments = { - "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - - # 4) Choose polling method: your JobsPollingMethod by default - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, - _JobsPollingMethod( - polling_interval=lro_delay, - path_format_arguments=path_format_arguments, - # any extra kwargs your poller needs - ), - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - - # 5) Continuation-token path - if cont_token: - return LROPoller[TrainingJobResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - - # 6) Return the poller - return LROPoller[TrainingJobResult]( - self._client, - initial, # type: ignore - get_long_running_output, - polling_method, # type: ignore - ) - # return super()._begin_cancel_training_job( - # project_name=self._project_name, job_id=job_id, **kwargs - # ) - - @overload - def begin_copy_project( - self, body: CopyProjectDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Copies an existing project to another Azure resource. - - :param body: The copy project info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_copy_project( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Copies an existing project to another Azure resource. - - :param body: The copy project info. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_copy_project( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Copies an existing project to another Azure resource. - - :param body: The copy project info. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_copy_project( - self, body: Union[CopyProjectDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Copies an existing project to another Azure resource. - - :param body: The copy project info. Required. - :type body: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails or JSON or IO[bytes] - :keyword str content_type: Media type of the request body. Default is "application/json". - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_copy_project( - project_name=self._project_name, body=body, content_type=content_type, **kwargs - ) - - @overload - def begin_train( - self, body: TrainingJobDetails, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[TrainingJobResult]: - """Triggers a training job for a project. - - :param body: The training input parameters. Required. - :type body: ~azure.ai.language.conversations.authoring.models.TrainingJobDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns TrainingJobResult. The TrainingJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_train( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[TrainingJobResult]: - """Triggers a training job for a project. - - :param body: The training input parameters. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns TrainingJobResult. The TrainingJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_train( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[TrainingJobResult]: - """Triggers a training job for a project. - - :param body: The training input parameters. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns TrainingJobResult. The TrainingJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_train( # type: ignore[override] - self, body: Union[TrainingJobDetails, JSON, IO[bytes]], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[TrainingJobResult]: - """Triggers a training job for a project. - - :param body: The training input parameters. Required. - :type body: Union[TrainingJobDetails, JSON, IO[bytes]] - :keyword content_type: Body Parameter content-type. Content type parameter for the request body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns TrainingJobResult. The TrainingJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.ai.language.conversations.authoring.models.TrainingJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_train(project_name=self._project_name, body=body, content_type=content_type, **kwargs) - - @distributed_trace - def begin_export( - self, - *, - string_index_type: Union[str, StringIndexType], - exported_project_format: Optional[Union[str, ExportedProjectFormat]] = None, - asset_kind: Optional[str] = None, - trained_model_label: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Triggers a job to export a project's data. - - :keyword string_index_type: Specifies the method used to interpret string offsets. See - https://aka.ms/text-analytics-offsets. Known values: "Utf16CodeUnit", "Utf8CodeUnit", - "Utf32CodeUnit". Required. - :paramtype string_index_type: str or ~azure.ai.language.conversations.authoring.models.StringIndexType - :keyword exported_project_format: The export format. Known values: "Conversation", "Luis". - :paramtype exported_project_format: str or ~azure.ai.language.conversations.authoring.models.ExportedProjectFormat - :keyword asset_kind: Kind of asset to export. - :paramtype asset_kind: str - :keyword trained_model_label: Trained model label to export. If None, exports the working copy. - :paramtype trained_model_label: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_export( - project_name=self._project_name, - asset_kind=asset_kind, - exported_project_format=exported_project_format, - string_index_type=string_index_type, - trained_model_label=trained_model_label, - **kwargs, - ) - - @overload - def copy_project_authorization( - self, - *, - project_kind: Union[str, ProjectKind], - content_type: str = "application/json", - storage_input_container_name: Optional[str] = None, - allow_overwrite: Optional[bool] = None, - **kwargs: Any - ) -> CopyProjectDetails: - """Generates a copy project operation authorization to the current target Azure resource. - - :keyword project_kind: Represents the project kind. Known values are: "Conversation", - "Orchestration", and "CustomConversationSummarization". Required. - :paramtype project_kind: str or ~azure.ai.language.conversations.authoring.models.ProjectKind - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword storage_input_container_name: The name of the storage container. Default value is - None. - :paramtype storage_input_container_name: str - :keyword allow_overwrite: Whether to allow an existing project to be overwritten using the - resulting copy authorization. Default value is None. - :paramtype allow_overwrite: bool - :return: CopyProjectDetails. The CopyProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def copy_project_authorization( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> CopyProjectDetails: - """Generates a copy project operation authorization to the current target Azure resource. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CopyProjectDetails. The CopyProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def copy_project_authorization( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> CopyProjectDetails: - """Generates a copy project operation authorization to the current target Azure resource. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CopyProjectDetails. The CopyProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.CopyProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def copy_project_authorization( # type: ignore[override] - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - allow_overwrite: Optional[bool] = _Unset, - project_kind: Union[str, Any] = _Unset, - storage_input_container_name: Optional[str] = _Unset, - **kwargs: Any - ) -> CopyProjectDetails: - """Generates a copy project operation authorization to the current target Azure resource. - - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword project_kind: Represents the project kind. Known values are: "Conversation", - "Orchestration", and "CustomConversationSummarization". Required. - :paramtype project_kind: str or ~azure.ai.language.conversations.authoring.models.ProjectKind - :keyword storage_input_container_name: The name of the storage container. Default value is - None. - :paramtype storage_input_container_name: str - :keyword allow_overwrite: Whether to allow an existing project to be overwritten using the - resulting copy authorization. Default value is None. - :paramtype allow_overwrite: bool - :return: CopyProjectDetails. The CopyProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.CopyProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._copy_project_authorization( - project_name=self._project_name, - body=body, - allow_overwrite=allow_overwrite, - project_kind=project_kind, - storage_input_container_name=storage_input_container_name, - **kwargs, - ) - - @distributed_trace - def _get_assign_deployment_resources_status( # type: ignore[override] - self, job_id: str, **kwargs: Any - ) -> DeploymentResourcesState: - """Gets the status of an existing assign deployment resources job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: DeploymentResourcesState. The DeploymentResourcesState is compatible with - MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.DeploymentResourcesState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_assign_deployment_resources_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace - def _get_copy_project_status(self, job_id: str, **kwargs: Any) -> CopyProjectState: # type: ignore[override] - """Gets the status of an existing copy project job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: CopyProjectState. The CopyProjectState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.CopyProjectState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_copy_project_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace - def _get_export_status(self, job_id: str, **kwargs: Any) -> ExportProjectState: # type: ignore[override] - """Gets the status of an export job. Once job completes, returns the project metadata, and assets. - - :param job_id: The job ID. Required. - :type job_id: str - :return: ExportProjectState. The ExportProjectState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.ExportProjectState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_export_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace - def get_project(self, **kwargs: Any) -> ProjectDetails: # type: ignore[override] - """Gets the details of a project. - - :return: ProjectDetails. The ProjectDetails is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.ProjectDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_project(project_name=self._project_name, **kwargs) - - @distributed_trace - def _get_project_deletion_status(self, job_id: str, **kwargs: Any) -> ProjectDeletionState: # type: ignore[override] - """Gets the status for a project deletion job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: ProjectDeletionState. The ProjectDeletionState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.ProjectDeletionState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_project_deletion_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace - def _get_swap_deployments_status(self, job_id: str, **kwargs: Any) -> SwapDeploymentsState: # type: ignore[override] - """Gets the status of an existing swap deployment job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: SwapDeploymentsState. The SwapDeploymentsState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.SwapDeploymentsState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_swap_deployments_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace - def _get_training_status(self, job_id: str, **kwargs: Any) -> TrainingState: # type: ignore[override] - """Gets the status for a training job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: TrainingState. The TrainingState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.TrainingState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_training_status(project_name=self._project_name, job_id=job_id, **kwargs) - - @distributed_trace - def _get_unassign_deployment_resources_status( # type: ignore[override] - self, job_id: str, **kwargs: Any - ) -> DeploymentResourcesState: - """Gets the status of an existing unassign deployment resources job. - - :param job_id: The job ID. Required. - :type job_id: str - :return: DeploymentResourcesState. The DeploymentResourcesState is compatible with - MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.DeploymentResourcesState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_unassign_deployment_resources_status( - project_name=self._project_name, job_id=job_id, **kwargs - ) - - @distributed_trace - def list_deployment_resources( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> ItemPaged[AssignedDeploymentResource]: - """Lists the deployments resources assigned to the project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of AssignedDeploymentResource - :rtype: - ~azure.core.paging.ItemPaged[~azure.ai.language.conversations.authoring.models.AssignedDeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_deployment_resources(project_name=self._project_name, skip=skip, top=top, **kwargs) - - @distributed_trace - def list_deployments( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> ItemPaged[ProjectDeployment]: - """Lists the deployments belonging to a project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of ProjectDeployment - :rtype: - ~azure.core.paging.ItemPaged[~azure.ai.language.conversations.authoring.models.ProjectDeployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_deployments(project_name=self._project_name, skip=skip, top=top, **kwargs) - - @distributed_trace - def list_exported_models( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> ItemPaged[ExportedTrainedModel]: - """Lists the exported models belonging to a project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of ExportedTrainedModel - :rtype: - ~azure.core.paging.ItemPaged[~azure.ai.language.conversations.authoring.models.ExportedTrainedModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_exported_models(project_name=self._project_name, skip=skip, top=top, **kwargs) - - @distributed_trace - def list_trained_models( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> ItemPaged[ProjectTrainedModel]: - """Lists the trained models belonging to a project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of ProjectTrainedModel - :rtype: - ~azure.core.paging.ItemPaged[~azure.ai.language.conversations.authoring.models.ProjectTrainedModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_trained_models(project_name=self._project_name, skip=skip, top=top, **kwargs) - - @distributed_trace - def list_training_jobs( # type: ignore[override] - self, *, skip: Optional[int] = _Unset, top: Optional[int] = _Unset, **kwargs: Any - ) -> ItemPaged[TrainingState]: - """Lists the non-expired training jobs created for a project. - - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of TrainingState - :rtype: - ~azure.core.paging.ItemPaged[~azure.ai.language.conversations.authoring.models.TrainingState] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().list_training_jobs(project_name=self._project_name, skip=skip, top=top, **kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_trained_model_op_patch.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_trained_model_op_patch.py deleted file mode 100644 index 644a12e7f32e..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/operations/_trained_model_op_patch.py +++ /dev/null @@ -1,287 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -from collections.abc import MutableMapping # pylint:disable=import-error -from typing import IO, Any, Callable, Dict, Optional, TypeVar, Union, overload - -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace - -from ..models import ( - EvalSummary, - EvaluationDetails, - EvaluationJobResult, - EvaluationState, - LoadSnapshotState, - ProjectTrainedModel, - StringIndexType, - UtteranceEvaluationResult, -) -from ._operations import TrainedModelOperations as TrainedModelOperationsGenerated - -JSON = MutableMapping[str, Any] -T = TypeVar("T") -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] -] - - -class TrainedModelOperations(TrainedModelOperationsGenerated): - - def __init__(self, *args, project_name: str, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self._project_name = project_name - - @overload - def begin_evaluate_model( - self, - trained_model_label: str, - body: EvaluationDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[EvaluationJobResult]: - """Triggers evaluation operation on a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param body: The training input parameters. Required. - :type body: ~azure.ai.language.conversations.authoring.models.EvaluationDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns EvaluationJobResult. The EvaluationJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.ai.language.conversations.authoring.models.EvaluationJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_evaluate_model( - self, trained_model_label: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[EvaluationJobResult]: - """Triggers evaluation operation on a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param body: The training input parameters. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns EvaluationJobResult. The EvaluationJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.ai.language.conversations.authoring.models.EvaluationJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_evaluate_model( - self, trained_model_label: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[EvaluationJobResult]: - """Triggers evaluation operation on a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param body: The training input parameters. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns EvaluationJobResult. The EvaluationJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.ai.language.conversations.authoring.models.EvaluationJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_evaluate_model( - self, - trained_model_label: str, - body: Union[EvaluationDetails, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[EvaluationJobResult]: - """Triggers evaluation operation on a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param body: The training input parameters. Is one of the following types: EvaluationDetails, - JSON, IO[bytes] Required. - :type body: ~azure.ai.language.conversations.authoring.models.EvaluationDetails or JSON or - IO[bytes] - :return: An instance of LROPoller that returns EvaluationJobResult. The EvaluationJobResult is - compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.ai.language.conversations.authoring.models._models.EvaluationJobResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_evaluate_model( - project_name=self._project_name, - trained_model_label=trained_model_label, - body=body, - **kwargs, - ) - - @distributed_trace - def begin_load_snapshot(self, trained_model_label: str, **kwargs: Any) -> LROPoller[None]: - """Restores the snapshot of this trained model to be the current working directory of the project. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :return: An instance of LROPoller that returns None. - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._begin_load_snapshot( - project_name=self._project_name, - trained_model_label=trained_model_label, - **kwargs, - ) - - @distributed_trace - def delete_trained_model(self, trained_model_label: str, **kwargs: Any) -> None: # type: ignore[override] - """Deletes an existing trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().delete_trained_model( - project_name=self._project_name, - trained_model_label=trained_model_label, - **kwargs, - ) - - @distributed_trace - def _get_evaluation_status( # type: ignore[override] - self, trained_model_label: str, job_id: str, **kwargs: Any - ) -> EvaluationState: - """Gets the status for an evaluation job. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param job_id: The job ID. Required. - :type job_id: str - :return: EvaluationState. The EvaluationState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.EvaluationState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_evaluation_status( - project_name=self._project_name, - trained_model_label=trained_model_label, - job_id=job_id, - **kwargs, - ) - - @distributed_trace - def _get_load_snapshot_status( # type: ignore[override] - self, trained_model_label: str, job_id: str, **kwargs: Any - ) -> LoadSnapshotState: - """Gets the status for loading a snapshot. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :param job_id: The job ID. Required. - :type job_id: str - :return: LoadSnapshotState. The LoadSnapshotState is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models._models.LoadSnapshotState - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super()._get_load_snapshot_status( - project_name=self._project_name, - trained_model_label=trained_model_label, - job_id=job_id, - **kwargs, - ) - - @distributed_trace - def get_model_evaluation_results( # type: ignore[override] - self, - trained_model_label: str, - *, - skip: Optional[int] = None, - string_index_type: Union[str, StringIndexType], - top: Optional[int] = None, - **kwargs: Any - ) -> ItemPaged[UtteranceEvaluationResult]: - """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. - - :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 - `_. Known values are: "Utf16CodeUnit", "Utf8CodeUnit", - and "Utf32CodeUnit". Required. - :paramtype string_index_type: str or - ~azure.ai.language.conversations.authoring.models.StringIndexType - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int - :return: An iterator like instance of UtteranceEvaluationResult - :rtype: - ~azure.core.paging.ItemPaged[~azure.ai.language.conversations.authoring.models.UtteranceEvaluationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().get_model_evaluation_results( - project_name=self._project_name, - trained_model_label=trained_model_label, - skip=skip, - string_index_type=string_index_type, - top=top, - **kwargs, - ) - - @distributed_trace - def get_model_evaluation_summary( # type: ignore[override] - self, trained_model_label: str, **kwargs: Any - ) -> EvalSummary: - """Gets the evaluation summary of a trained model. The summary includes high level performance - measurements of the model e.g., F1, Precision, Recall, etc. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :return: EvalSummary. The EvalSummary is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.EvalSummary - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().get_model_evaluation_summary( - project_name=self._project_name, - trained_model_label=trained_model_label, - **kwargs, - ) - - @distributed_trace - def get_trained_model( # type: ignore[override] - self, trained_model_label: str, **kwargs: Any - ) -> ProjectTrainedModel: - """Gets the details of a trained model. - - :param trained_model_label: The trained model label. Required. - :type trained_model_label: str - :return: ProjectTrainedModel. The ProjectTrainedModel is compatible with MutableMapping - :rtype: ~azure.ai.language.conversations.authoring.models.ProjectTrainedModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - return super().get_trained_model( - project_name=self._project_name, - trained_model_label=trained_model_label, - **kwargs, - ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_cancel_training_job.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_cancel_training_job.py new file mode 100644 index 000000000000..64b796531561 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_cancel_training_job.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_cancel_training_job.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.project.begin_cancel_training_job( + job_id="8ccf2ffe-e758-4d04-a44a-31512918c7e8_637858368000000000", + ).result() + print(response) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulCancelTrainingJob.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_create_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_create_project.py new file mode 100644 index 000000000000..434c4ce3b770 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_create_project.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_create_project.py +""" + + +def main(): + client = ConversationAuthoringClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.create_project( + project_name="myproject", + body={ + "description": "This is a sample conversation project.", + "language": "en", + "multilingual": False, + "projectKind": "Conversation", + "projectName": "myproject", + }, + ) + print(response) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulCreateProject.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_delete_model.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_delete_model.py new file mode 100644 index 000000000000..47fe1222936d --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_delete_model.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_delete_model.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + client.trained_model.delete_trained_model( + trained_model_label="model2", + ) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulDeleteModel.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_deployment.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_deployment.py new file mode 100644 index 000000000000..393173b40f95 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_deployment.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_get_deployment.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.deployment.get_deployment( + deployment_name="staging", + ) + print(response) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulGetDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_exported_model.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_exported_model.py new file mode 100644 index 000000000000..e6531a51798b --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_exported_model.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_get_exported_model.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.exported_model.get_exported_model( + exported_model_name="exported-model1", + ) + print(response) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulGetExportedModel.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model.py new file mode 100644 index 000000000000..4e23af22bf50 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_get_model.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.trained_model.get_trained_model( + trained_model_label="model1", + ) + print(response) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulGetModel.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model_evaluation.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model_evaluation.py new file mode 100644 index 000000000000..74e1c9063e96 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model_evaluation.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_get_model_evaluation.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.trained_model.get_model_evaluation_results( + trained_model_label="model1", + string_index_type="Utf16CodeUnit", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulGetModelEvaluation.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model_evaluation_summary.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model_evaluation_summary.py new file mode 100644 index 000000000000..cc084290e391 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_model_evaluation_summary.py @@ -0,0 +1,35 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_get_model_evaluation_summary.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.trained_model.get_model_evaluation_summary( + trained_model_label="model1", + ) + print(response) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulGetModelEvaluationSummary.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_project.py new file mode 100644 index 000000000000..933c778cafdb --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_project.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_get_project.py +""" + + +def main(): + client = ConversationAuthoringClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.get_project( + project_name="myproject", + ) + print(response) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulGetProject.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_languages.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_languages.py new file mode 100644 index 000000000000..5bf717f0b238 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_languages.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_get_supported_languages.py +""" + + +def main(): + client = ConversationAuthoringClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.list_supported_languages( + project_kind="Conversation", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulGetSupportedLanguages.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_prebuilt_entities.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_prebuilt_entities.py new file mode 100644 index 000000000000..15d1e93ec000 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_prebuilt_entities.py @@ -0,0 +1,33 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_get_supported_prebuilt_entities.py +""" + + +def main(): + client = ConversationAuthoringClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.list_supported_prebuilt_entities() + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulGetSupportedPrebuiltEntities.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_training_config_versions.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_training_config_versions.py new file mode 100644 index 000000000000..1f6380d34231 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_get_supported_training_config_versions.py @@ -0,0 +1,35 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_get_supported_training_config_versions.py +""" + + +def main(): + client = ConversationAuthoringClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.list_training_config_versions( + project_kind="Conversation", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulGetSupportedTrainingConfigVersions.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_assigned_resource_deployments.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_assigned_resource_deployments.py new file mode 100644 index 000000000000..ec7f0cc0a3aa --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_assigned_resource_deployments.py @@ -0,0 +1,33 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_list_assigned_resource_deployments.py +""" + + +def main(): + client = ConversationAuthoringClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.list_assigned_resource_deployments() + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulListAssignedResourceDeployments.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_deployments.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_deployments.py new file mode 100644 index 000000000000..9e92bb86abf9 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_deployments.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_list_deployments.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.project.list_deployments() + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulListDeployments.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_exported_models.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_exported_models.py new file mode 100644 index 000000000000..4bee465500da --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_exported_models.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_list_exported_models.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.project.list_exported_models() + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulListExportedModels.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_models.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_models.py new file mode 100644 index 000000000000..bfc6a3c51207 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_models.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_list_models.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.project.list_trained_models() + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulListModels.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_project_resources.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_project_resources.py new file mode 100644 index 000000000000..8c47b3751596 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_project_resources.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_list_project_resources.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.project.list_deployment_resources() + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulListProjectResources.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_projects.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_projects.py new file mode 100644 index 000000000000..90e73d9e0edc --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_projects.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_list_projects.py +""" + + +def main(): + client = ConversationAuthoringClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + ) + + response = client.list_projects() + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulListProjects.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_training_jobs.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_training_jobs.py new file mode 100644 index 000000000000..d7f22d96e4cc --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_samples/analyzeconversationsauthoring/successful_list_training_jobs.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.ai.language.conversations.authoring import ConversationAuthoringProjectClient + +""" +# PREREQUISITES + pip install azure-ai-language-conversations-authoring +# USAGE + python successful_list_training_jobs.py +""" + + +def main(): + client = ConversationAuthoringProjectClient( + endpoint="{Endpoint}", + credential="CREDENTIAL", + project_name="PROJECT_NAME", + ) + + response = client.project.list_training_jobs() + for item in response: + print(item) + + +# x-ms-original-file: 2025-11-15-preview/examples/analyzeconversations-authoring/SuccessfulListTrainingJobs.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/conftest.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/conftest.py new file mode 100644 index 000000000000..8253891081c6 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/conftest.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + conversationauthoring_subscription_id = os.environ.get( + "CONVERSATIONAUTHORING_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + conversationauthoring_tenant_id = os.environ.get( + "CONVERSATIONAUTHORING_TENANT_ID", "00000000-0000-0000-0000-000000000000" + ) + conversationauthoring_client_id = os.environ.get( + "CONVERSATIONAUTHORING_CLIENT_ID", "00000000-0000-0000-0000-000000000000" + ) + conversationauthoring_client_secret = os.environ.get( + "CONVERSATIONAUTHORING_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=conversationauthoring_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=conversationauthoring_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=conversationauthoring_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=conversationauthoring_client_secret, value="00000000-0000-0000-0000-000000000000") + + conversationauthoringproject_subscription_id = os.environ.get( + "CONVERSATIONAUTHORINGPROJECT_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + conversationauthoringproject_tenant_id = os.environ.get( + "CONVERSATIONAUTHORINGPROJECT_TENANT_ID", "00000000-0000-0000-0000-000000000000" + ) + conversationauthoringproject_client_id = os.environ.get( + "CONVERSATIONAUTHORINGPROJECT_CLIENT_ID", "00000000-0000-0000-0000-000000000000" + ) + conversationauthoringproject_client_secret = os.environ.get( + "CONVERSATIONAUTHORINGPROJECT_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=conversationauthoringproject_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=conversationauthoringproject_tenant_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=conversationauthoringproject_client_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=conversationauthoringproject_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring.py new file mode 100644 index 000000000000..d15fa71b9b76 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import ConversationAuthoringClientTestBase, ConversationAuthoringPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoring(ConversationAuthoringClientTestBase): + @ConversationAuthoringPreparer() + @recorded_by_proxy + def test_list_projects(self, conversationauthoring_endpoint): + client = self.create_client(endpoint=conversationauthoring_endpoint) + response = client.list_projects() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy + def test_list_supported_languages(self, conversationauthoring_endpoint): + client = self.create_client(endpoint=conversationauthoring_endpoint) + response = client.list_supported_languages( + project_kind="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy + def test_list_assigned_resource_deployments(self, conversationauthoring_endpoint): + client = self.create_client(endpoint=conversationauthoring_endpoint) + response = client.list_assigned_resource_deployments() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy + def test_list_supported_prebuilt_entities(self, conversationauthoring_endpoint): + client = self.create_client(endpoint=conversationauthoring_endpoint) + response = client.list_supported_prebuilt_entities() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy + def test_list_training_config_versions(self, conversationauthoring_endpoint): + client = self.create_client(endpoint=conversationauthoring_endpoint) + response = client.list_training_config_versions( + project_kind="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy + def test_create_project(self, conversationauthoring_endpoint): + client = self.create_client(endpoint=conversationauthoring_endpoint) + response = client.create_project( + project_name="str", + body={ + "language": "str", + "projectKind": "str", + "projectName": "str", + "description": "str", + "multilingual": bool, + "settings": {"confidenceThreshold": 0.0}, + "storageInputContainerName": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy + def test_get_project(self, conversationauthoring_endpoint): + client = self.create_client(endpoint=conversationauthoring_endpoint) + response = client.get_project( + project_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_async.py new file mode 100644 index 000000000000..d3a2ba2fe254 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_async.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import ConversationAuthoringPreparer +from testpreparer_async import ConversationAuthoringClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoringAsync(ConversationAuthoringClientTestBaseAsync): + @ConversationAuthoringPreparer() + @recorded_by_proxy_async + async def test_list_projects(self, conversationauthoring_endpoint): + client = self.create_async_client(endpoint=conversationauthoring_endpoint) + response = client.list_projects() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy_async + async def test_list_supported_languages(self, conversationauthoring_endpoint): + client = self.create_async_client(endpoint=conversationauthoring_endpoint) + response = client.list_supported_languages( + project_kind="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy_async + async def test_list_assigned_resource_deployments(self, conversationauthoring_endpoint): + client = self.create_async_client(endpoint=conversationauthoring_endpoint) + response = client.list_assigned_resource_deployments() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy_async + async def test_list_supported_prebuilt_entities(self, conversationauthoring_endpoint): + client = self.create_async_client(endpoint=conversationauthoring_endpoint) + response = client.list_supported_prebuilt_entities() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy_async + async def test_list_training_config_versions(self, conversationauthoring_endpoint): + client = self.create_async_client(endpoint=conversationauthoring_endpoint) + response = client.list_training_config_versions( + project_kind="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy_async + async def test_create_project(self, conversationauthoring_endpoint): + client = self.create_async_client(endpoint=conversationauthoring_endpoint) + response = await client.create_project( + project_name="str", + body={ + "language": "str", + "projectKind": "str", + "projectName": "str", + "description": "str", + "multilingual": bool, + "settings": {"confidenceThreshold": 0.0}, + "storageInputContainerName": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @ConversationAuthoringPreparer() + @recorded_by_proxy_async + async def test_get_project(self, conversationauthoring_endpoint): + client = self.create_async_client(endpoint=conversationauthoring_endpoint) + response = await client.get_project( + project_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_deployment_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_deployment_operations.py new file mode 100644 index 000000000000..ae9a2624f56c --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_deployment_operations.py @@ -0,0 +1,24 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import ConversationAuthoringProjectClientTestBase, ConversationAuthoringProjectPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoringProjectDeploymentOperations(ConversationAuthoringProjectClientTestBase): + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_deployment_get_deployment(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.deployment.get_deployment( + deployment_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_deployment_operations_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_deployment_operations_async.py new file mode 100644 index 000000000000..0a9beabdd667 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_deployment_operations_async.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import ConversationAuthoringProjectPreparer +from testpreparer_async import ConversationAuthoringProjectClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoringProjectDeploymentOperationsAsync(ConversationAuthoringProjectClientTestBaseAsync): + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_deployment_get_deployment(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = await client.deployment.get_deployment( + deployment_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_exported_model_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_exported_model_operations.py new file mode 100644 index 000000000000..9c78511492a8 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_exported_model_operations.py @@ -0,0 +1,24 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import ConversationAuthoringProjectClientTestBase, ConversationAuthoringProjectPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoringProjectExportedModelOperations(ConversationAuthoringProjectClientTestBase): + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_exported_model_get_exported_model(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.exported_model.get_exported_model( + exported_model_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_exported_model_operations_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_exported_model_operations_async.py new file mode 100644 index 000000000000..235c6d63fccc --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_exported_model_operations_async.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import ConversationAuthoringProjectPreparer +from testpreparer_async import ConversationAuthoringProjectClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoringProjectExportedModelOperationsAsync(ConversationAuthoringProjectClientTestBaseAsync): + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_exported_model_get_exported_model(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = await client.exported_model.get_exported_model( + exported_model_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_project_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_project_operations.py new file mode 100644 index 000000000000..53ad7487f073 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_project_operations.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import ConversationAuthoringProjectClientTestBase, ConversationAuthoringProjectPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoringProjectProjectOperations(ConversationAuthoringProjectClientTestBase): + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_project_list_trained_models(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_trained_models() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_project_list_training_jobs(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_training_jobs() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_project_list_deployment_resources(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_deployment_resources() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_project_list_deployments(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_deployments() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_project_list_exported_models(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_exported_models() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_project_begin_cancel_training_job(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.begin_cancel_training_job( + job_id="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_project_operations_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_project_operations_async.py new file mode 100644 index 000000000000..044b716282e4 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_project_operations_async.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import ConversationAuthoringProjectPreparer +from testpreparer_async import ConversationAuthoringProjectClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoringProjectProjectOperationsAsync(ConversationAuthoringProjectClientTestBaseAsync): + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_project_list_trained_models(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_trained_models() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_project_list_training_jobs(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_training_jobs() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_project_list_deployment_resources(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_deployment_resources() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_project_list_deployments(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_deployments() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_project_list_exported_models(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = client.project.list_exported_models() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_project_begin_cancel_training_job(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = await ( + await client.project.begin_cancel_training_job( + job_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_trained_model_operations.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_trained_model_operations.py new file mode 100644 index 000000000000..454412910ebc --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_trained_model_operations.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import ConversationAuthoringProjectClientTestBase, ConversationAuthoringProjectPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoringProjectTrainedModelOperations(ConversationAuthoringProjectClientTestBase): + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_trained_model_get_trained_model(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.trained_model.get_trained_model( + trained_model_label="str", + ) + + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_trained_model_delete_trained_model(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.trained_model.delete_trained_model( + trained_model_label="str", + ) + + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_trained_model_get_model_evaluation_results(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.trained_model.get_model_evaluation_results( + trained_model_label="str", + string_index_type="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy + def test_trained_model_get_model_evaluation_summary(self, conversationauthoringproject_endpoint): + client = self.create_client(endpoint=conversationauthoringproject_endpoint) + response = client.trained_model.get_model_evaluation_summary( + trained_model_label="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_trained_model_operations_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_trained_model_operations_async.py new file mode 100644 index 000000000000..8cde0e938802 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/test_conversation_authoring_project_trained_model_operations_async.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import ConversationAuthoringProjectPreparer +from testpreparer_async import ConversationAuthoringProjectClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestConversationAuthoringProjectTrainedModelOperationsAsync(ConversationAuthoringProjectClientTestBaseAsync): + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_trained_model_get_trained_model(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = await client.trained_model.get_trained_model( + trained_model_label="str", + ) + + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_trained_model_delete_trained_model(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = await client.trained_model.delete_trained_model( + trained_model_label="str", + ) + + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_trained_model_get_model_evaluation_results(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = client.trained_model.get_model_evaluation_results( + trained_model_label="str", + string_index_type="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @ConversationAuthoringProjectPreparer() + @recorded_by_proxy_async + async def test_trained_model_get_model_evaluation_summary(self, conversationauthoringproject_endpoint): + client = self.create_async_client(endpoint=conversationauthoringproject_endpoint) + response = await client.trained_model.get_model_evaluation_summary( + trained_model_label="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/testpreparer.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/testpreparer.py new file mode 100644 index 000000000000..7b37dc00dccd --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/testpreparer.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.ai.language.conversations.authoring import ConversationAuthoringClient, ConversationAuthoringProjectClient +from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer +import functools + + +class ConversationAuthoringClientTestBase(AzureRecordedTestCase): + + def create_client(self, endpoint): + credential = self.get_credential(ConversationAuthoringClient) + return self.create_client_from_credential( + ConversationAuthoringClient, + credential=credential, + endpoint=endpoint, + ) + + +ConversationAuthoringPreparer = functools.partial( + PowerShellPreparer, + "conversationauthoring", + conversationauthoring_endpoint="https://fake_conversationauthoring_endpoint.com", +) + + +class ConversationAuthoringProjectClientTestBase(AzureRecordedTestCase): + + def create_client(self, endpoint): + credential = self.get_credential(ConversationAuthoringProjectClient) + return self.create_client_from_credential( + ConversationAuthoringProjectClient, + credential=credential, + endpoint=endpoint, + ) + + +ConversationAuthoringProjectPreparer = functools.partial( + PowerShellPreparer, + "conversationauthoringproject", + conversationauthoringproject_endpoint="https://fake_conversationauthoringproject_endpoint.com", +) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/testpreparer_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/testpreparer_async.py new file mode 100644 index 000000000000..35cae060b9ed --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/generated_tests/testpreparer_async.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.ai.language.conversations.authoring.aio import ( + ConversationAuthoringClient, + ConversationAuthoringProjectClient, +) +from devtools_testutils import AzureRecordedTestCase + + +class ConversationAuthoringClientTestBaseAsync(AzureRecordedTestCase): + + def create_async_client(self, endpoint): + credential = self.get_credential(ConversationAuthoringClient, is_async=True) + return self.create_client_from_credential( + ConversationAuthoringClient, + credential=credential, + endpoint=endpoint, + ) + + +class ConversationAuthoringProjectClientTestBaseAsync(AzureRecordedTestCase): + + def create_async_client(self, endpoint): + credential = self.get_credential(ConversationAuthoringProjectClient, is_async=True) + return self.create_client_from_credential( + ConversationAuthoringProjectClient, + credential=credential, + endpoint=endpoint, + ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/pyproject.toml b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/pyproject.toml index 2a5b1729759e..71f28fbbb24c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/pyproject.toml +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/pyproject.toml @@ -1,18 +1,14 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - [build-system] -requires = ["setuptools>=77.0.3", "wheel"] +requires = [ + "setuptools>=77.0.3", + "wheel", +] build-backend = "setuptools.build_meta" [project] name = "azure-ai-language-conversations-authoring" authors = [ - { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, ] description = "Microsoft Corporation Azure Ai Language Conversations Authoring Client Library for Python" license = "MIT" @@ -28,8 +24,10 @@ classifiers = [ "Programming Language :: Python :: 3.13", ] requires-python = ">=3.9" -keywords = ["azure", "azure sdk"] - +keywords = [ + "azure", + "azure sdk", +] dependencies = [ "isodate>=0.6.1", "azure-core>=1.35.0", @@ -37,20 +35,29 @@ dependencies = [ "azure-ai-language-conversations>=2.0.0b1", ] dynamic = [ -"version", "readme" + "version", + "readme", ] [project.urls] repository = "https://github.com/Azure/azure-sdk-for-python" -[tool.setuptools.dynamic] -version = {attr = "azure.ai.language.conversations.authoring._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} +[tool.setuptools.dynamic.version] +attr = "azure.ai.language.conversations.authoring._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" [tool.setuptools.packages.find] exclude = [ "tests*", + "generated_tests*", "samples*", + "generated_samples*", "doc*", "azure", "azure.ai", @@ -59,4 +66,9 @@ exclude = [ ] [tool.setuptools.package-data] -pytyped = ["py.typed"] +pytyped = [ + "py.typed", +] + +[packaging] +auto_update = false diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_assign_deployment_resources_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_assign_deployment_resources_async.py index 7e23c8126482..c1b89349bd1e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_assign_deployment_resources_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_assign_deployment_resources_async.py @@ -75,8 +75,10 @@ async def sample_assign_deployment_resources_async(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_assign_deployment_resources_async] + async def main(): await sample_assign_deployment_resources_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_cancel_training_job_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_cancel_training_job_async.py index 2a931d073988..d481a65812d9 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_cancel_training_job_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_cancel_training_job_async.py @@ -63,8 +63,10 @@ async def sample_cancel_training_job_async(): print(f"Evaluation %: {result.evaluation_status.percent_complete}") print(f"Estimated End: {result.estimated_end_on}") + # [END conversation_authoring_cancel_training_job_async] + async def main(): await sample_cancel_training_job_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_create_project_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_create_project_async.py index 29a86d2b97b3..ef752d3844a2 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_create_project_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_create_project_async.py @@ -36,6 +36,7 @@ ProjectKind, ) + async def sample_create_project_async(): # settings endpoint = os.environ["AZURE_CONVERSATIONS_AUTHORING_ENDPOINT"] @@ -63,8 +64,10 @@ async def sample_create_project_async(): print(f"Multilingual: {result.multilingual}") print(f"Description: {result.description}") + # [END conversation_authoring_create_project_async] + async def main(): await sample_create_project_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_deployment_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_deployment_async.py index 9de6c5a4d6fa..1b86815373b6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_deployment_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_deployment_async.py @@ -46,9 +46,7 @@ async def sample_delete_deployment_async(): project_client = client.get_project_client(project_name) # start delete (async long-running operation) - poller = await project_client.deployment.begin_delete_deployment( - deployment_name=deployment_name - ) + poller = await project_client.deployment.begin_delete_deployment(deployment_name=deployment_name) try: await poller.result() @@ -59,8 +57,10 @@ async def sample_delete_deployment_async(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_delete_deployment_async] + async def main(): await sample_delete_deployment_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_project_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_project_async.py index d6f4397ed093..8b2c4d4218b8 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_project_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_project_async.py @@ -53,8 +53,10 @@ async def sample_delete_project_async(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_delete_project_async] + async def main(): await sample_delete_project_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_trained_model_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_trained_model_async.py index b4c37a888db9..7efe692f5ad0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_trained_model_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_trained_model_async.py @@ -60,8 +60,10 @@ def capture_response(pipeline_response): status = captured.get("status_code") print(f"Delete Trained Model Response Status: {status}") + # [END conversation_authoring_delete_trained_model_async] + async def main(): await sample_delete_trained_model_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_deploy_project_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_deploy_project_async.py index 05ec9f3fc687..0b14aabae08b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_deploy_project_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_deploy_project_async.py @@ -67,8 +67,10 @@ async def sample_deploy_project_async(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_deploy_project_async] + async def main(): await sample_deploy_project_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_export_project_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_export_project_async.py index e9d2acaeb002..1276a3791417 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_export_project_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_export_project_async.py @@ -59,8 +59,10 @@ async def sample_export_project_async(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_export_project_async] + async def main(): await sample_export_project_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_deployment_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_deployment_async.py index 7bbd8c93a68c..add2ef1cfdae 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_deployment_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_deployment_async.py @@ -66,8 +66,10 @@ async def sample_get_deployment_async(): print(f"AOAI Resource ID: {aoai.resource_id}") print(f"AOAI Deployment Name: {aoai.deployment_name}") + # [END conversation_authoring_get_deployment_async] + async def main(): await sample_get_deployment_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_results_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_results_async.py index 1692d90e4a35..5112ada9d5ac 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_results_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_results_async.py @@ -78,8 +78,10 @@ async def sample_get_model_evaluation_results_async(): print(f"Total Results: {seen}") + # [END conversation_authoring_get_model_evaluation_results_async] + async def main(): await sample_get_model_evaluation_results_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_summary_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_summary_async.py index f3173208d9d6..1c6cd354bda6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_summary_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_summary_async.py @@ -68,7 +68,9 @@ async def sample_get_model_evaluation_summary_async(): # Per-entity details ent_map = entities_summary.entities or {} for entity_name, entity_summary in ent_map.items(): - print(f"Entity '{entity_name}': F1 = {entity_summary.f1}, Precision = {entity_summary.precision}, Recall = {entity_summary.recall}") + print( + f"Entity '{entity_name}': F1 = {entity_summary.f1}, Precision = {entity_summary.precision}, Recall = {entity_summary.recall}" + ) print( f" True Positives: {entity_summary.true_positive_count}, " f"True Negatives: {entity_summary.true_negative_count}" @@ -95,7 +97,9 @@ async def sample_get_model_evaluation_summary_async(): # Per-intent details intent_map = intents_summary.intents or {} for intent_name, intent_summary in intent_map.items(): - print(f"Intent '{intent_name}': F1 = {intent_summary.f1}, Precision = {intent_summary.precision}, Recall = {intent_summary.recall}") + print( + f"Intent '{intent_name}': F1 = {intent_summary.f1}, Precision = {intent_summary.precision}, Recall = {intent_summary.recall}" + ) print( f" True Positives: {intent_summary.true_positive_count}, " f"True Negatives: {intent_summary.true_negative_count}" @@ -105,8 +109,10 @@ async def sample_get_model_evaluation_summary_async(): f"False Negatives: {intent_summary.false_negative_count}" ) + # [END conversation_authoring_get_model_evaluation_summary_async] + async def main(): await sample_get_model_evaluation_summary_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_project_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_project_async.py index 60b078348479..5d64097e01c9 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_project_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_project_async.py @@ -55,8 +55,10 @@ async def sample_get_project_async(): print(f"Description: {details.description}") print(f"Language: {details.language}") + # [END conversation_authoring_get_project_async] + async def main(): await sample_get_project_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_import_project_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_import_project_async.py index 10efbcb05ebf..6a7140876791 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_import_project_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_import_project_async.py @@ -130,8 +130,10 @@ async def sample_import_project_async(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_import_project_async] + async def main(): await sample_import_project_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_load_snapshot_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_load_snapshot_async.py index b467503f7d94..ad06737aef7d 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_load_snapshot_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_load_snapshot_async.py @@ -57,8 +57,10 @@ async def sample_load_snapshot_async(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_load_snapshot_async] + async def main(): await sample_load_snapshot_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_swap_deployments_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_swap_deployments_async.py index add3a7b772ec..b46fba1e3824 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_swap_deployments_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_swap_deployments_async.py @@ -66,8 +66,10 @@ async def sample_swap_deployments_async(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_swap_deployments_async] + async def main(): await sample_swap_deployments_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_train_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_train_async.py index dc33be92f4fa..65a8c734b840 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_train_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_train_async.py @@ -78,8 +78,10 @@ async def sample_train_async(): print(f"Evaluation Status: {result.evaluation_status}") print(f"Estimated End: {result.estimated_end_on}") + # [END conversation_authoring_train_async] + async def main(): await sample_train_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_unassign_deployment_resources_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_unassign_deployment_resources_async.py index ef7ab0556bd5..abc1a95127e7 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_unassign_deployment_resources_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_unassign_deployment_resources_async.py @@ -37,6 +37,7 @@ UnassignDeploymentResourcesDetails, ) + async def sample_unassign_deployment_resources_async(): # settings endpoint = os.environ["AZURE_CONVERSATIONS_AUTHORING_ENDPOINT"] @@ -63,8 +64,10 @@ async def sample_unassign_deployment_resources_async(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_unassign_deployment_resources_async] + async def main(): await sample_unassign_deployment_resources_async() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_assign_deployment_resources.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_assign_deployment_resources.py index 848467a78c8e..7c2d936157c0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_assign_deployment_resources.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_assign_deployment_resources.py @@ -75,6 +75,7 @@ def sample_assign_deployment_resources(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_assign_deployment_resources] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_cancel_training_job.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_cancel_training_job.py index 6633163e8bcd..064c83485c0f 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_cancel_training_job.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_cancel_training_job.py @@ -45,8 +45,8 @@ def sample_cancel_training_job(): project_client = client.get_project_client(project_name) poller = project_client.project.begin_cancel_training_job( - job_id=job_id, - ) + job_id=job_id, + ) result = poller.result() # TrainingJobResult print(f"Model Label: {result.model_label}") @@ -63,6 +63,7 @@ def sample_cancel_training_job(): print(f"Evaluation %: {result.evaluation_status.percent_complete}") print(f"Estimated End: {result.estimated_end_on}") + # [END conversation_authoring_cancel_training_job] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_create_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_create_project.py index 33cfd1ec3393..f76148301887 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_create_project.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_create_project.py @@ -65,6 +65,7 @@ def sample_create_project(): print(f"Multilingual: {result.multilingual}") print(f"Description: {result.description}") + # [END conversation_authoring_create_project] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_deployment.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_deployment.py index 683483b44b9e..d8b7697eceef 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_deployment.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_deployment.py @@ -46,9 +46,7 @@ def sample_delete_deployment(): project_client = client.get_project_client(project_name) # start delete (long-running operation) - poller = project_client.deployment.begin_delete_deployment( - deployment_name=deployment_name - ) + poller = project_client.deployment.begin_delete_deployment(deployment_name=deployment_name) try: poller.result() @@ -59,6 +57,7 @@ def sample_delete_deployment(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_delete_deployment] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_project.py index 2a4ce13768b1..814e08ffd34f 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_project.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_project.py @@ -54,6 +54,7 @@ def sample_delete_project(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_delete_project] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_trained_model.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_trained_model.py index cac4e84f39a0..390542a3517c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_trained_model.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_trained_model.py @@ -60,6 +60,7 @@ def capture_response(pipeline_response): status = captured.get("status_code") print(f"Delete Trained Model Response Status: {status}") + # [END conversation_authoring_delete_trained_model] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_deploy_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_deploy_project.py index 4d44244641d4..a08f132454d6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_deploy_project.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_deploy_project.py @@ -66,6 +66,8 @@ def sample_deploy_project(): except HttpResponseError as e: print(f"Operation failed: {e.message}") print(e.error) + + # [END conversation_authoring_deploy_project] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_export_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_export_project.py index 571b80927337..0f1d5ea28d4a 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_export_project.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_export_project.py @@ -61,6 +61,7 @@ def sample_export_project(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_export_project] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_deployment.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_deployment.py index d1199b969930..bc0571f90919 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_deployment.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_deployment.py @@ -66,6 +66,7 @@ def sample_get_deployment(): print(f"AOAI Resource ID: {aoai.resource_id}") print(f"AOAI Deployment Name: {aoai.deployment_name}") + # [END conversation_authoring_get_deployment] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_results.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_results.py index 50037890a143..5c2cca926638 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_results.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_results.py @@ -76,6 +76,7 @@ def sample_get_model_evaluation_results(): print(f"Total Results: {seen}") + # [END conversation_authoring_get_model_evaluation_results] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_summary.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_summary.py index 3e99be7dade6..9fbf68dc9e92 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_summary.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_summary.py @@ -51,7 +51,7 @@ def sample_get_model_evaluation_summary(): print("=== Model Evaluation Summary ===") - # ----- Entities evaluation (micro/macro) ----- + # ----- Entities evaluation (micro/macro) ----- entities_summary = eval_summary.entities_evaluation if entities_summary is not None: print( @@ -68,7 +68,9 @@ def sample_get_model_evaluation_summary(): # Per-entity details ent_map = entities_summary.entities or {} for entity_name, entity_summary in ent_map.items(): - print(f"Entity '{entity_name}': F1 = {entity_summary.f1}, Precision = {entity_summary.precision}, Recall = {entity_summary.recall}") + print( + f"Entity '{entity_name}': F1 = {entity_summary.f1}, Precision = {entity_summary.precision}, Recall = {entity_summary.recall}" + ) print( f" True Positives: {entity_summary.true_positive_count}, " f"True Negatives: {entity_summary.true_negative_count}" @@ -95,7 +97,9 @@ def sample_get_model_evaluation_summary(): # Per-intent details intent_map = intents_summary.intents or {} for intent_name, intent_summary in intent_map.items(): - print(f"Intent '{intent_name}': F1 = {intent_summary.f1}, Precision = {intent_summary.precision}, Recall = {intent_summary.recall}") + print( + f"Intent '{intent_name}': F1 = {intent_summary.f1}, Precision = {intent_summary.precision}, Recall = {intent_summary.recall}" + ) print( f" True Positives: {intent_summary.true_positive_count}, " f"True Negatives: {intent_summary.true_negative_count}" @@ -105,6 +109,7 @@ def sample_get_model_evaluation_summary(): f"False Negatives: {intent_summary.false_negative_count}" ) + # [END conversation_authoring_get_model_evaluation_summary] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_project.py index 48b40125c24f..ae6e2ef03b77 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_project.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_project.py @@ -56,6 +56,7 @@ def sample_get_project(): print(f"Description: {details.description}") print(f"Language: {details.language}") + # [END conversation_authoring_get_project] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_import_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_import_project.py index 62e834478b64..d71be8f0fbaf 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_import_project.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_import_project.py @@ -129,6 +129,7 @@ def sample_import_project(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_import_project] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_load_snapshot.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_load_snapshot.py index 1536e9affea9..7a51e4904909 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_load_snapshot.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_load_snapshot.py @@ -57,6 +57,7 @@ def sample_load_snapshot(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_load_snapshot] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_swap_deployments.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_swap_deployments.py index a5348595fdd0..45ddde5719d4 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_swap_deployments.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_swap_deployments.py @@ -66,6 +66,7 @@ def sample_swap_deployments(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_swap_deployments] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_train.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_train.py index 455df49debd8..bad9fc8b9421 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_train.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_train.py @@ -77,6 +77,7 @@ def sample_train(): print(f"Evaluation Status: {result.evaluation_status}") print(f"Estimated End: {result.estimated_end_on}") + # [END conversation_authoring_train] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_unassign_deployment_resources.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_unassign_deployment_resources.py index 3ee5a5bd5f85..59c39cd0b552 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_unassign_deployment_resources.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_unassign_deployment_resources.py @@ -66,6 +66,7 @@ def sample_unassign_deployment_resources(): print(f"Operation failed: {e.message}") print(e.error) + # [END conversation_authoring_unassign_deployment_resources] diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/sdk_packaging.toml b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/sdk_packaging.toml deleted file mode 100644 index e7687fdae93b..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/sdk_packaging.toml +++ /dev/null @@ -1,2 +0,0 @@ -[packaging] -auto_update = false \ No newline at end of file diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_cancel_training_job.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_cancel_training_job.py index dadbe352c237..3e0954e58e75 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_cancel_training_job.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_cancel_training_job.py @@ -27,7 +27,7 @@ def test_cancel_training_job(self, authoring_endpoint, authoring_key): client = self.create_client(authoring_endpoint, authoring_key) project_client = client.get_project_client("Test-data-labels") - job_id="e097b8e7-5cef-491a-aba6-24a82580973e_638919360000000000" + job_id = "e097b8e7-5cef-491a-aba6-24a82580973e_638919360000000000" poller = project_client.project.begin_cancel_training_job( job_id=job_id, @@ -35,7 +35,9 @@ def test_cancel_training_job(self, authoring_endpoint, authoring_key): result = poller.result() # TrainingJobResult - assert result.training_status.status == "cancelled", f"Cancellation failed with status: {result.training_status.status}" + assert ( + result.training_status.status == "cancelled" + ), f"Cancellation failed with status: {result.training_status.status}" print(f"Model Label: {result.model_label}") print(f"Training Config Version: {result.training_config_version}") print(f"Training Mode: {result.training_mode}") diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_cancel_training_job_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_cancel_training_job_async.py index 5a4287587924..419fa1a1463e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_cancel_training_job_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_cancel_training_job_async.py @@ -38,7 +38,9 @@ async def test_cancel_training_job_async(self, authoring_endpoint, authoring_key result = await poller.result() # TrainingJobResult - assert result.training_status.status == "cancelled", f"Cancellation failed with status: {result.training_status.status}" + assert ( + result.training_status.status == "cancelled" + ), f"Cancellation failed with status: {result.training_status.status}" print(f"Model Label: {result.model_label}") print(f"Training Config Version: {result.training_config_version}") diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_deployment.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_deployment.py index 700ad75a0c85..fc38f4a9a8b6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_deployment.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_deployment.py @@ -33,13 +33,13 @@ def test_delete_deployment(self, authoring_endpoint, authoring_key): # Act: begin delete and wait for completion poller = project_client.deployment.begin_delete_deployment(deployment_name=deployment_name) - + try: poller.result() except HttpResponseError as e: print(f"Operation failed: {e.message}") print(e.error) raise - + # If we get here, the delete succeeded - print(f"Delete completed. done={poller.done()} status={poller.status()}") \ No newline at end of file + print(f"Delete completed. done={poller.done()} status={poller.status()}") diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_deployment_async.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_deployment_async.py index 3848db3c01b2..d345f504bace 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_deployment_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_deployment_async.py @@ -35,9 +35,7 @@ async def test_delete_deployment_async(self, authoring_endpoint, authoring_key): project_client = client.get_project_client(project_name) # Begin delete; Async poller now returns None on success - poller = await project_client.deployment.begin_delete_deployment( - deployment_name=deployment_name - ) + poller = await project_client.deployment.begin_delete_deployment(deployment_name=deployment_name) try: await poller.result() diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_project.py index 65248922c8f5..3ae39d8aee9b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_project.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_delete_project.py @@ -38,6 +38,6 @@ def test_delete_project(self, authoring_endpoint, authoring_key): print(f"Operation failed: {e.message}") print(e.error) raise - + # If we get here, the delete succeeded print(f"Delete completed. done={poller.done()} status={poller.status()}") diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_export_project.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_export_project.py index 487bcc2140ed..3b9abfa48634 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_export_project.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_export_project.py @@ -22,6 +22,7 @@ class TestConversations(AzureRecordedTestCase): def create_client(self, endpoint, key): return ConversationAuthoringClient(endpoint, AzureKeyCredential(key)) + class TestConversationsExportCase(TestConversations): @ConversationsPreparer() @recorded_by_proxy diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_get_model_evaluation_summary.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_get_model_evaluation_summary.py index 7a8caa9b606c..cc628e43be1c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_get_model_evaluation_summary.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_get_model_evaluation_summary.py @@ -35,7 +35,7 @@ def test_get_model_evaluation_summary(self, authoring_endpoint, authoring_key): # Basic assertion the call returned something shaped like a summary assert eval_summary is not None - # ----- Entities evaluation (micro/macro) ----- + # ----- Entities evaluation (micro/macro) ----- entities_summary = eval_summary.entities_evaluation if entities_summary is not None: print( diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_swap_deployments.py b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_swap_deployments.py index 981f44161893..ad2a9253a794 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_swap_deployments.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tests/test_swap_deployments.py @@ -6,7 +6,7 @@ from azure.ai.language.conversations.authoring import ConversationAuthoringClient from azure.ai.language.conversations.authoring.models import ( SwapDeploymentsDetails, -) +) ConversationsPreparer = functools.partial( EnvironmentVariableLoader, @@ -47,4 +47,4 @@ def test_swap_deployments(self, authoring_endpoint, authoring_key): raise # Success -> poller completed - print(f"Swap deployments completed. done={poller.done()} status={poller.status()}") \ No newline at end of file + print(f"Swap deployments completed. done={poller.done()} status={poller.status()}") diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tsp-location.yaml b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tsp-location.yaml index 12524fd66290..2571974fb43c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tsp-location.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/tsp-location.yaml @@ -1,4 +1,4 @@ -directory: specification/cognitiveservices/Language.AnalyzeConversations-authoring -commit: c349a7a66f40b75502a4706cd15be50a26ee49ef +directory: specification/cognitiveservices/data-plane/LanguageAnalyzeConversationsAuthoring +commit: d8f039ebd965e40471a082c547b103dd5dc9a33b repo: Azure/azure-rest-api-specs additionalDirectories: