From 5c6fa2bf76d640643c5d52eab1d6d73ac86dc4f5 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Wed, 17 Jun 2026 15:27:04 -0700 Subject: [PATCH 01/12] First --- sdk/ai/azure-ai-projects/PostEmitter.ps1 | 24 - .../azure-ai-projects/apiview-properties.json | 92 +- .../azure/ai/projects/_client.py | 4 + .../azure/ai/projects/aio/_client.py | 4 + .../ai/projects/aio/operations/__init__.py | 2 + .../ai/projects/aio/operations/_operations.py | 6385 +++++++------ .../azure/ai/projects/models/_enums.py | 8 - .../azure/ai/projects/models/_patch.py | 4 - .../azure/ai/projects/operations/__init__.py | 2 + .../ai/projects/operations/_operations.py | 8003 ++++++++--------- sdk/ai/azure-ai-projects/docs/subclients.md | 60 +- .../sample_toolboxes_with_search_preview.py | 5 +- ...ple_toolboxes_with_search_preview_async.py | 5 +- .../hosted_agents/sample_agent_endpoint.py | 6 +- .../sample_agent_endpoint_async.py | 6 +- .../sample_create_hosted_agent_from_code.py | 4 +- ...ple_create_hosted_agent_from_code_async.py | 4 +- .../sample_session_log_stream.py | 10 +- .../sample_session_log_stream_async.py | 10 +- .../hosted_agents/sample_sessions_crud.py | 16 +- .../sample_sessions_crud_async.py | 16 +- .../sample_sessions_files_upload_download.py | 16 +- ...le_sessions_files_upload_download_async.py | 16 +- .../hosted_agents/sample_skill_in_toolbox.py | 9 +- .../hosted_agents/sample_toolboxes_crud.py | 24 +- .../sample_toolboxes_crud_async.py | 24 +- .../foundry_features_header_test_base.py | 3 +- sdk/ai/azure-ai-projects/tsp-location.yaml | 2 +- 28 files changed, 7387 insertions(+), 7377 deletions(-) diff --git a/sdk/ai/azure-ai-projects/PostEmitter.ps1 b/sdk/ai/azure-ai-projects/PostEmitter.ps1 index d39c14548824..ae2878e9a845 100644 --- a/sdk/ai/azure-ai-projects/PostEmitter.ps1 +++ b/sdk/ai/azure-ai-projects/PostEmitter.ps1 @@ -17,30 +17,6 @@ # See GitHub issue: https://github.com/microsoft/typespec/issues/10311 git restore pyproject.toml - -# Edit both _operations.py files to fix missing Foundry-Features HTTP request header in continued list paging calls. Add: -# headers=_headers -# to the end of each of these lines in the BetaXxxOperations classes (do not do this in GA operations classes!) -# "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params -# In emitted code, these first 7 of those lines are associated with GA operations, so start the replacement -# from the 8th occurrence onward. -$gaCount = 7 -$old = [char]34 + 'GET' + [char]34 + ', urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params' -$new = $old + ', headers=_headers' -foreach ($f in 'azure\ai\projects\aio\operations\_operations.py', 'azure\ai\projects\operations\_operations.py') { - $c = Get-Content $f -Raw - $parts = $c -split [regex]::Escape($old) - $r = $parts[0] - for ($i = 1; $i -lt $parts.Length; $i++) { - if ($i -le $gaCount) { - $r += $old + $parts[$i] - } else { - $r += $new + $parts[$i] - } - } - Set-Content $f $r -NoNewline -} - # Force streaming in get_session_log_stream for both sync and async operations. $files = 'azure\ai\projects\operations\_operations.py', 'azure\ai\projects\aio\operations\_operations.py' foreach ($f in $files) { diff --git a/sdk/ai/azure-ai-projects/apiview-properties.json b/sdk/ai/azure-ai-projects/apiview-properties.json index 56060921e407..699506d9a4d0 100644 --- a/sdk/ai/azure-ai-projects/apiview-properties.json +++ b/sdk/ai/azure-ai-projects/apiview-properties.json @@ -340,8 +340,7 @@ "azure.ai.projects.models.WeeklyRecurrenceSchedule": "Azure.AI.Projects.WeeklyRecurrenceSchedule", "azure.ai.projects.models.WorkflowAgentDefinition": "Azure.AI.Projects.WorkflowAgentDefinition", "azure.ai.projects.models.WorkIQPreviewTool": "Azure.AI.Projects.WorkIQPreviewTool", - "azure.ai.projects.models.AgentObjectType": "Azure.AI.Projects.AgentObjectType", - "azure.ai.projects.models.AgentKind": "Azure.AI.Projects.AgentKind", + "azure.ai.projects.models.EvaluationTaxonomyInputType": "Azure.AI.Projects.EvaluationTaxonomyInputType", "azure.ai.projects.models.ToolType": "OpenAI.ToolType", "azure.ai.projects.models.AzureAISearchQueryType": "Azure.AI.Projects.AzureAISearchQueryType", "azure.ai.projects.models.ContainerMemoryLimit": "OpenAI.ContainerMemoryLimit", @@ -358,36 +357,17 @@ "azure.ai.projects.models.ToolSearchExecutionType": "OpenAI.ToolSearchExecutionType", "azure.ai.projects.models.SearchContextSize": "OpenAI.SearchContextSize", "azure.ai.projects.models.SearchContentType": "OpenAI.SearchContentType", - "azure.ai.projects.models.AgentProtocol": "Azure.AI.Projects.AgentProtocol", - "azure.ai.projects.models.CodeDependencyResolution": "Azure.AI.Projects.CodeDependencyResolution", - "azure.ai.projects.models.TelemetryEndpointKind": "Azure.AI.Projects.TelemetryEndpointKind", - "azure.ai.projects.models.TelemetryDataKind": "Azure.AI.Projects.TelemetryDataKind", - "azure.ai.projects.models.TelemetryEndpointAuthType": "Azure.AI.Projects.TelemetryEndpointAuthType", - "azure.ai.projects.models.TelemetryTransportProtocol": "Azure.AI.Projects.TelemetryTransportProtocol", - "azure.ai.projects.models.ToolChoiceParamType": "OpenAI.ToolChoiceParamType", - "azure.ai.projects.models.TextResponseFormatConfigurationType": "OpenAI.TextResponseFormatConfigurationType", - "azure.ai.projects.models.AgentVersionStatus": "Azure.AI.Projects.AgentVersionStatus", - "azure.ai.projects.models.AgentBlueprintReferenceType": "Azure.AI.Projects.AgentBlueprintReferenceType", - "azure.ai.projects.models.VersionSelectorType": "Azure.AI.Projects.VersionSelectorType", - "azure.ai.projects.models.AgentEndpointProtocol": "Azure.AI.Projects.AgentEndpointProtocol", - "azure.ai.projects.models.AgentEndpointAuthorizationSchemeType": "Azure.AI.Projects.AgentEndpointAuthorizationSchemeType", - "azure.ai.projects.models.IsolationKeySourceKind": "Azure.AI.Projects.IsolationKeySourceKind", - "azure.ai.projects.models.VersionIndicatorType": "Azure.AI.Projects.VersionIndicatorType", - "azure.ai.projects.models.AgentSessionStatus": "Azure.AI.Projects.AgentSessionStatus", - "azure.ai.projects.models.PageOrder": "Azure.AI.Projects.PageOrder", - "azure.ai.projects.models.SessionLogEventType": "Azure.AI.Projects.SessionLogEventType", - "azure.ai.projects.models.OptimizationDatasetInputType": "Azure.AI.Projects.OptimizationDatasetInputType", - "azure.ai.projects.models.EvaluationLevel": "Azure.AI.Projects.EvaluationLevel", - "azure.ai.projects.models.JobStatus": "Azure.AI.Projects.JobStatus", - "azure.ai.projects.models.EvaluationTaxonomyInputType": "Azure.AI.Projects.EvaluationTaxonomyInputType", "azure.ai.projects.models.RiskCategory": "Azure.AI.Projects.RiskCategory", "azure.ai.projects.models.EvaluatorType": "Azure.AI.Projects.EvaluatorType", "azure.ai.projects.models.EvaluatorCategory": "Azure.AI.Projects.EvaluatorCategory", + "azure.ai.projects.models.EvaluationLevel": "Azure.AI.Projects.EvaluationLevel", "azure.ai.projects.models.EvaluatorDefinitionType": "Azure.AI.Projects.EvaluatorDefinitionType", "azure.ai.projects.models.EvaluatorMetricType": "Azure.AI.Projects.EvaluatorMetricType", "azure.ai.projects.models.EvaluatorMetricDirection": "Azure.AI.Projects.EvaluatorMetricDirection", "azure.ai.projects.models.PendingUploadType": "Azure.AI.Projects.PendingUploadType", "azure.ai.projects.models.EvaluatorGenerationJobSourceType": "Azure.AI.Projects.EvaluatorGenerationJobSourceType", + "azure.ai.projects.models.JobStatus": "Azure.AI.Projects.JobStatus", + "azure.ai.projects.models.PageOrder": "Azure.AI.Projects.PageOrder", "azure.ai.projects.models.OperationState": "Azure.Core.Foundations.OperationState", "azure.ai.projects.models.InsightType": "Azure.AI.Projects.InsightType", "azure.ai.projects.models.SampleType": "Azure.AI.Projects.SampleType", @@ -418,6 +398,26 @@ "azure.ai.projects.models.SimpleQnAFineTuningQuestionType": "Azure.AI.Projects.SimpleQnAFineTuningQuestionType", "azure.ai.projects.models.DataGenerationJobScenario": "Azure.AI.Projects.DataGenerationJobScenario", "azure.ai.projects.models.DataGenerationJobOutputType": "Azure.AI.Projects.DataGenerationJobOutputType", + "azure.ai.projects.models.OptimizationDatasetInputType": "Azure.AI.Projects.OptimizationDatasetInputType", + "azure.ai.projects.models.AgentObjectType": "Azure.AI.Projects.AgentObjectType", + "azure.ai.projects.models.AgentKind": "Azure.AI.Projects.AgentKind", + "azure.ai.projects.models.AgentProtocol": "Azure.AI.Projects.AgentProtocol", + "azure.ai.projects.models.CodeDependencyResolution": "Azure.AI.Projects.CodeDependencyResolution", + "azure.ai.projects.models.TelemetryEndpointKind": "Azure.AI.Projects.TelemetryEndpointKind", + "azure.ai.projects.models.TelemetryDataKind": "Azure.AI.Projects.TelemetryDataKind", + "azure.ai.projects.models.TelemetryEndpointAuthType": "Azure.AI.Projects.TelemetryEndpointAuthType", + "azure.ai.projects.models.TelemetryTransportProtocol": "Azure.AI.Projects.TelemetryTransportProtocol", + "azure.ai.projects.models.ToolChoiceParamType": "OpenAI.ToolChoiceParamType", + "azure.ai.projects.models.TextResponseFormatConfigurationType": "OpenAI.TextResponseFormatConfigurationType", + "azure.ai.projects.models.AgentVersionStatus": "Azure.AI.Projects.AgentVersionStatus", + "azure.ai.projects.models.AgentBlueprintReferenceType": "Azure.AI.Projects.AgentBlueprintReferenceType", + "azure.ai.projects.models.VersionSelectorType": "Azure.AI.Projects.VersionSelectorType", + "azure.ai.projects.models.AgentEndpointProtocol": "Azure.AI.Projects.AgentEndpointProtocol", + "azure.ai.projects.models.AgentEndpointAuthorizationSchemeType": "Azure.AI.Projects.AgentEndpointAuthorizationSchemeType", + "azure.ai.projects.models.IsolationKeySourceKind": "Azure.AI.Projects.IsolationKeySourceKind", + "azure.ai.projects.models.VersionIndicatorType": "Azure.AI.Projects.VersionIndicatorType", + "azure.ai.projects.models.AgentSessionStatus": "Azure.AI.Projects.AgentSessionStatus", + "azure.ai.projects.models.SessionLogEventType": "Azure.AI.Projects.SessionLogEventType", "azure.ai.projects.models.EvaluationRuleActionType": "Azure.AI.Projects.EvaluationRuleActionType", "azure.ai.projects.models.EvaluationRuleEventType": "Azure.AI.Projects.EvaluationRuleEventType", "azure.ai.projects.models.ConnectionType": "Azure.AI.Projects.ConnectionType", @@ -442,6 +442,30 @@ "azure.ai.projects.aio.operations.AgentsOperations.delete_version": "Azure.AI.Projects.Agents.deleteAgentVersion", "azure.ai.projects.operations.AgentsOperations.list_versions": "Azure.AI.Projects.Agents.listAgentVersions", "azure.ai.projects.aio.operations.AgentsOperations.list_versions": "Azure.AI.Projects.Agents.listAgentVersions", + "azure.ai.projects.operations.AgentsOperations.patch_agent_details": "Azure.AI.Projects.Agents.patchAgentObject", + "azure.ai.projects.aio.operations.AgentsOperations.patch_agent_details": "Azure.AI.Projects.Agents.patchAgentObject", + "azure.ai.projects.operations.AgentsOperations.create_version_from_code": "Azure.AI.Projects.Agents.createAgentVersionFromCode", + "azure.ai.projects.aio.operations.AgentsOperations.create_version_from_code": "Azure.AI.Projects.Agents.createAgentVersionFromCode", + "azure.ai.projects.operations.AgentsOperations.download_code": "Azure.AI.Projects.Agents.downloadAgentCode", + "azure.ai.projects.aio.operations.AgentsOperations.download_code": "Azure.AI.Projects.Agents.downloadAgentCode", + "azure.ai.projects.operations.AgentsOperations.create_session": "Azure.AI.Projects.Agents.createSession", + "azure.ai.projects.aio.operations.AgentsOperations.create_session": "Azure.AI.Projects.Agents.createSession", + "azure.ai.projects.operations.AgentsOperations.get_session": "Azure.AI.Projects.Agents.getSession", + "azure.ai.projects.aio.operations.AgentsOperations.get_session": "Azure.AI.Projects.Agents.getSession", + "azure.ai.projects.operations.AgentsOperations.delete_session": "Azure.AI.Projects.Agents.deleteSession", + "azure.ai.projects.aio.operations.AgentsOperations.delete_session": "Azure.AI.Projects.Agents.deleteSession", + "azure.ai.projects.operations.AgentsOperations.stop_session": "Azure.AI.Projects.Agents.stopSession", + "azure.ai.projects.aio.operations.AgentsOperations.stop_session": "Azure.AI.Projects.Agents.stopSession", + "azure.ai.projects.operations.AgentsOperations.list_sessions": "Azure.AI.Projects.Agents.listSessions", + "azure.ai.projects.aio.operations.AgentsOperations.list_sessions": "Azure.AI.Projects.Agents.listSessions", + "azure.ai.projects.operations.AgentsOperations.get_session_log_stream": "Azure.AI.Projects.Agents.getSessionLogStream", + "azure.ai.projects.aio.operations.AgentsOperations.get_session_log_stream": "Azure.AI.Projects.Agents.getSessionLogStream", + "azure.ai.projects.operations.AgentsOperations.download_session_file": "Azure.AI.Projects.AgentSessionFiles.downloadSessionFile", + "azure.ai.projects.aio.operations.AgentsOperations.download_session_file": "Azure.AI.Projects.AgentSessionFiles.downloadSessionFile", + "azure.ai.projects.operations.AgentsOperations.list_session_files": "Azure.AI.Projects.AgentSessionFiles.listSessionFiles", + "azure.ai.projects.aio.operations.AgentsOperations.list_session_files": "Azure.AI.Projects.AgentSessionFiles.listSessionFiles", + "azure.ai.projects.operations.AgentsOperations.delete_session_file": "Azure.AI.Projects.AgentSessionFiles.deleteSessionFile", + "azure.ai.projects.aio.operations.AgentsOperations.delete_session_file": "Azure.AI.Projects.AgentSessionFiles.deleteSessionFile", "azure.ai.projects.operations.EvaluationRulesOperations.get": "Azure.AI.Projects.EvaluationRules.get", "azure.ai.projects.aio.operations.EvaluationRulesOperations.get": "Azure.AI.Projects.EvaluationRules.get", "azure.ai.projects.operations.EvaluationRulesOperations.delete": "Azure.AI.Projects.EvaluationRules.delete", @@ -479,7 +503,23 @@ "azure.ai.projects.operations.IndexesOperations.delete": "Azure.AI.Projects.Indexes.deleteVersion", "azure.ai.projects.aio.operations.IndexesOperations.delete": "Azure.AI.Projects.Indexes.deleteVersion", "azure.ai.projects.operations.IndexesOperations.create_or_update": "Azure.AI.Projects.Indexes.createOrUpdateVersion", - "azure.ai.projects.aio.operations.IndexesOperations.create_or_update": "Azure.AI.Projects.Indexes.createOrUpdateVersion" + "azure.ai.projects.aio.operations.IndexesOperations.create_or_update": "Azure.AI.Projects.Indexes.createOrUpdateVersion", + "azure.ai.projects.operations.ToolboxesOperations.create_version": "Azure.AI.Projects.Toolboxes.createToolboxVersion", + "azure.ai.projects.aio.operations.ToolboxesOperations.create_version": "Azure.AI.Projects.Toolboxes.createToolboxVersion", + "azure.ai.projects.operations.ToolboxesOperations.get": "Azure.AI.Projects.Toolboxes.getToolbox", + "azure.ai.projects.aio.operations.ToolboxesOperations.get": "Azure.AI.Projects.Toolboxes.getToolbox", + "azure.ai.projects.operations.ToolboxesOperations.list": "Azure.AI.Projects.Toolboxes.listToolboxes", + "azure.ai.projects.aio.operations.ToolboxesOperations.list": "Azure.AI.Projects.Toolboxes.listToolboxes", + "azure.ai.projects.operations.ToolboxesOperations.list_versions": "Azure.AI.Projects.Toolboxes.listToolboxVersions", + "azure.ai.projects.aio.operations.ToolboxesOperations.list_versions": "Azure.AI.Projects.Toolboxes.listToolboxVersions", + "azure.ai.projects.operations.ToolboxesOperations.get_version": "Azure.AI.Projects.Toolboxes.getToolboxVersion", + "azure.ai.projects.aio.operations.ToolboxesOperations.get_version": "Azure.AI.Projects.Toolboxes.getToolboxVersion", + "azure.ai.projects.operations.ToolboxesOperations.update": "Azure.AI.Projects.Toolboxes.updateToolbox", + "azure.ai.projects.aio.operations.ToolboxesOperations.update": "Azure.AI.Projects.Toolboxes.updateToolbox", + "azure.ai.projects.operations.ToolboxesOperations.delete": "Azure.AI.Projects.Toolboxes.deleteToolbox", + "azure.ai.projects.aio.operations.ToolboxesOperations.delete": "Azure.AI.Projects.Toolboxes.deleteToolbox", + "azure.ai.projects.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion", + "azure.ai.projects.aio.operations.ToolboxesOperations.delete_version": "Azure.AI.Projects.Toolboxes.deleteToolboxVersion" }, - "CrossLanguageVersion": "54953c829a31" + "CrossLanguageVersion": "a252b3ce0280" } \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py index 5a5f3b9e1d1d..508fbc18d9cd 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_client.py @@ -24,6 +24,7 @@ DeploymentsOperations, EvaluationRulesOperations, IndexesOperations, + ToolboxesOperations, ) if sys.version_info >= (3, 11): @@ -52,6 +53,8 @@ class AIProjectClient: # pylint: disable=too-many-instance-attributes :vartype deployments: azure.ai.projects.operations.DeploymentsOperations :ivar indexes: IndexesOperations operations :vartype indexes: azure.ai.projects.operations.IndexesOperations + :ivar toolboxes: ToolboxesOperations operations + :vartype toolboxes: azure.ai.projects.operations.ToolboxesOperations :param endpoint: Foundry Project endpoint in the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you only have one Project in your Foundry Hub, or to target the default Project in your Hub, use @@ -108,6 +111,7 @@ def __init__( self.datasets = DatasetsOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.indexes = IndexesOperations(self._client, self._config, self._serialize, self._deserialize) + self.toolboxes = ToolboxesOperations(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/ai/azure-ai-projects/azure/ai/projects/aio/_client.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py index 217df480ea3a..c195fb690de2 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py @@ -24,6 +24,7 @@ DeploymentsOperations, EvaluationRulesOperations, IndexesOperations, + ToolboxesOperations, ) if sys.version_info >= (3, 11): @@ -52,6 +53,8 @@ class AIProjectClient: # pylint: disable=too-many-instance-attributes :vartype deployments: azure.ai.projects.aio.operations.DeploymentsOperations :ivar indexes: IndexesOperations operations :vartype indexes: azure.ai.projects.aio.operations.IndexesOperations + :ivar toolboxes: ToolboxesOperations operations + :vartype toolboxes: azure.ai.projects.aio.operations.ToolboxesOperations :param endpoint: Foundry Project endpoint in the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you only have one Project in your Foundry Hub, or to target the default Project in your Hub, use @@ -108,6 +111,7 @@ def __init__( self.datasets = DatasetsOperations(self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) self.indexes = IndexesOperations(self._client, self._config, self._serialize, self._deserialize) + self.toolboxes = ToolboxesOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py index 1a1c0ffec86c..d6cf67b4d8cf 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/__init__.py @@ -19,6 +19,7 @@ from ._operations import DatasetsOperations # type: ignore from ._operations import DeploymentsOperations # type: ignore from ._operations import IndexesOperations # type: ignore +from ._operations import ToolboxesOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -32,6 +33,7 @@ "DatasetsOperations", "DeploymentsOperations", "IndexesOperations", + "ToolboxesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py index 6d72581d3585..eb7342c68ebc 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py @@ -37,32 +37,32 @@ from ..._utils.serialization import Deserializer, Serializer from ..._utils.utils import prepare_multipart_form_data from ...operations._operations import ( + build_agents_create_session_request, + build_agents_create_version_from_code_request, build_agents_create_version_from_manifest_request, build_agents_create_version_request, build_agents_delete_request, + build_agents_delete_session_file_request, + build_agents_delete_session_request, build_agents_delete_version_request, + build_agents_download_code_request, + build_agents_download_session_file_request, build_agents_get_request, + build_agents_get_session_log_stream_request, + build_agents_get_session_request, build_agents_get_version_request, build_agents_list_request, + build_agents_list_session_files_request, + build_agents_list_sessions_request, build_agents_list_versions_request, + build_agents_patch_agent_details_request, + build_agents_stop_session_request, + build_agents_upload_session_file_request, build_beta_agents_cancel_optimization_job_request, build_beta_agents_create_optimization_job_request, - build_beta_agents_create_session_request, - build_beta_agents_create_version_from_code_request, build_beta_agents_delete_optimization_job_request, - build_beta_agents_delete_session_file_request, - build_beta_agents_delete_session_request, - build_beta_agents_download_code_request, - build_beta_agents_download_session_file_request, build_beta_agents_get_optimization_job_request, - build_beta_agents_get_session_log_stream_request, - build_beta_agents_get_session_request, build_beta_agents_list_optimization_jobs_request, - build_beta_agents_list_session_files_request, - build_beta_agents_list_sessions_request, - build_beta_agents_patch_agent_details_request, - build_beta_agents_stop_session_request, - build_beta_agents_upload_session_file_request, build_beta_datasets_cancel_generation_job_request, build_beta_datasets_create_generation_job_request, build_beta_datasets_delete_generation_job_request, @@ -138,14 +138,6 @@ build_beta_skills_list_request, build_beta_skills_list_versions_request, build_beta_skills_update_request, - build_beta_toolboxes_create_version_request, - build_beta_toolboxes_delete_request, - build_beta_toolboxes_delete_version_request, - build_beta_toolboxes_get_request, - build_beta_toolboxes_get_version_request, - build_beta_toolboxes_list_request, - build_beta_toolboxes_list_versions_request, - build_beta_toolboxes_update_request, build_connections_get_request, build_connections_get_with_credentials_request, build_connections_list_request, @@ -167,6 +159,14 @@ build_indexes_get_request, build_indexes_list_request, build_indexes_list_versions_request, + build_toolboxes_create_version_request, + build_toolboxes_delete_request, + build_toolboxes_delete_version_request, + build_toolboxes_get_request, + build_toolboxes_get_version_request, + build_toolboxes_list_request, + build_toolboxes_list_versions_request, + build_toolboxes_update_request, ) from .._configuration import AIProjectClientConfiguration @@ -194,7 +194,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) self.evaluation_taxonomies = BetaEvaluationTaxonomiesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -205,12 +204,12 @@ def __init__(self, *args, **kwargs) -> None: self.red_teams = BetaRedTeamsOperations(self._client, self._config, self._serialize, self._deserialize) self.routines = BetaRoutinesOperations(self._client, self._config, self._serialize, self._deserialize) self.schedules = BetaSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.toolboxes = BetaToolboxesOperations(self._client, self._config, self._serialize, self._deserialize) self.skills = BetaSkillsOperations(self._client, self._config, self._serialize, self._deserialize) self.datasets = BetaDatasetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) -class AgentsOperations: +class AgentsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -1143,34 +1142,98 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) + @overload + async def patch_agent_details( + self, + agent_name: str, + *, + content_type: str = "application/merge-patch+json", + agent_endpoint: Optional[_models.AgentEndpointConfig] = None, + agent_card: Optional[_models.AgentCard] = None, + **kwargs: Any + ) -> _models.AgentDetails: + """Update an agent endpoint. -class EvaluationRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + Applies a merge-patch update to the specified agent endpoint configuration. - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`evaluation_rules` attribute. - """ + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. + :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :keyword agent_card: Optional agent card for the agent. Default value is None. + :paramtype agent_card: ~azure.ai.projects.models.AgentCard + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def patch_agent_details( + self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.AgentDetails: + """Update an agent endpoint. + + Applies a merge-patch update to the specified agent endpoint configuration. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch_agent_details( + self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.AgentDetails: + """Update an agent endpoint. + + Applies a merge-patch update to the specified agent endpoint configuration. + + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: - """Get an evaluation rule. + async def patch_agent_details( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + agent_endpoint: Optional[_models.AgentEndpointConfig] = None, + agent_card: Optional[_models.AgentCard] = None, + **kwargs: Any + ) -> _models.AgentDetails: + """Update an agent endpoint. - Retrieves the specified evaluation rule and its configuration. + Applies a merge-patch update to the specified agent endpoint configuration. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. + :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :keyword agent_card: Optional agent card for the agent. Default value is None. + :paramtype agent_card: ~azure.ai.projects.models.AgentCard + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1181,14 +1244,27 @@ async def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) - _request = build_evaluation_rules_get_request( - id=id, + if body is _Unset: + body = {"agent_card": agent_card, "agent_endpoint": agent_endpoint} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agents_patch_agent_details_request( + agent_name=agent_name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -1212,28 +1288,113 @@ async def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) + deserialized = _deserialize(_models.AgentDetails, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + async def create_version_from_code( + self, + agent_name: str, + content: _models.CreateAgentVersionFromCodeContent, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create an agent version from code. + + Creates a new agent version from code. Uploads the code zip and creates a new version for an + existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` + header for integrity and dedup. The request body is multipart/form-data with a JSON metadata + part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_version_from_code( + self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create an agent version from code. + + Creates a new agent version from code. Uploads the code zip and creates a new version for an + existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` + header for integrity and dedup. The request body is multipart/form-data with a JSON metadata + part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. + + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def delete(self, id: str, **kwargs: Any) -> None: - """Delete an evaluation rule. + async def create_version_from_code( + self, + agent_name: str, + content: Union[_models.CreateAgentVersionFromCodeContent, JSON], + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create an agent version from code. - Removes the specified evaluation rule from the project. + Creates a new agent version from code. Uploads the code zip and creates a new version for an + existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` + header for integrity and dedup. The request body is multipart/form-data with a JSON metadata + part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :return: None - :rtype: None + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1247,11 +1408,18 @@ async def delete(self, id: str, **kwargs: Any) -> None: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) - _request = build_evaluation_rules_delete_request( - id=id, + _body = content.as_dict() if isinstance(content, _Model) else content + _file_fields: list[str] = ["code"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_agents_create_version_from_code_request( + agent_name=agent_name, + code_zip_sha256=code_zip_sha256, api_version=self._config.api_version, + files=_files, headers=_headers, params=_params, ) @@ -1260,95 +1428,246 @@ async def delete(self, id: str, **kwargs: Any) -> None: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def download_code( + self, agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: + """Download agent code. + + Downloads the code zip for a code-based hosted agent. + Returns the previously-uploaded zip (``application/zip``). + + If ``agent_version`` is supplied, returns that version's code zip; otherwise + returns the latest version's code zip. + + The SHA-256 digest of the returned bytes matches the ``content_hash`` on the + resolved version's ``code_configuration``. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :keyword agent_version: The version of the agent whose code zip should be downloaded. + If omitted, the latest version's code zip is returned. Default value is None. + :paramtype agent_version: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_agents_download_code_request( + agent_name=agent_name, + agent_version=agent_version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["x-ms-agent-version"] = self._deserialize("str", response.headers.get("x-ms-agent-version")) + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - async def create_or_update( - self, id: str, evaluation_rule: _models.EvaluationRule, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + async def create_session( + self, + agent_name: str, + *, + version_indicator: _models.VersionIndicator, + user_isolation_key: Optional[str] = None, + content_type: str = "application/json", + agent_session_id: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentSessionResource: + """Create a session. - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Required. - :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :keyword version_indicator: Determines which agent version backs the session. Required. + :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique + within the agent endpoint. Auto-generated if omitted. Default value is None. + :paramtype agent_session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( - self, id: str, evaluation_rule: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + async def create_session( + self, + agent_name: str, + body: JSON, + *, + user_isolation_key: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentSessionResource: + """Create a session. - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Required. - :type evaluation_rule: JSON + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :param body: Required. + :type body: JSON + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( - self, id: str, evaluation_rule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + async def create_session( + self, + agent_name: str, + body: IO[bytes], + *, + user_isolation_key: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentSessionResource: + """Create a session. - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Required. - :type evaluation_rule: IO[bytes] + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( - self, id: str, evaluation_rule: Union[_models.EvaluationRule, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + async def create_session( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + version_indicator: _models.VersionIndicator = _Unset, + user_isolation_key: Optional[str] = None, + agent_session_id: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentSessionResource: + """Create a session. - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Is one of the following types: - EvaluationRule, JSON, IO[bytes] Required. - :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule or JSON or IO[bytes] - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword version_indicator: Determines which agent version backs the session. Required. + :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique + within the agent endpoint. Auto-generated if omitted. Default value is None. + :paramtype agent_session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1363,17 +1682,23 @@ async def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + if body is _Unset: + if version_indicator is _Unset: + raise TypeError("missing required argument: version_indicator") + body = {"agent_session_id": agent_session_id, "version_indicator": version_indicator} + body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None - if isinstance(evaluation_rule, (IOBase, bytes)): - _content = evaluation_rule + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(evaluation_rule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_evaluation_rules_create_or_update_request( - id=id, + _request = build_agents_create_session_request( + agent_name=agent_name, + user_isolation_key=user_isolation_key, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -1393,55 +1718,48 @@ async def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [201]: if _stream: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) + deserialized = _deserialize(_models.AgentSessionResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, - *, - action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, - agent_name: Optional[str] = None, - enabled: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluationRule"]: - """List evaluation rules. + @distributed_trace_async + async def get_session( + self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any + ) -> _models.AgentSessionResource: + """Get a session. - Returns the evaluation rules configured for the project, optionally filtered by action type, - agent name, or enabled state. + Retrieves the details of a hosted agent session by agent name and session identifier. - :keyword action_type: Filter by the type of evaluation rule. Known values are: - "continuousEvaluation" and "humanEvaluationPreview". Default value is None. - :paramtype action_type: str or ~azure.ai.projects.models.EvaluationRuleActionType - :keyword agent_name: Filter by the agent name. Default value is None. - :paramtype agent_name: str - :keyword enabled: Filter by the enabled status. Default value is None. - :paramtype enabled: bool - :return: An iterator like instance of EvaluationRule - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluationRule] + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session identifier. Required. + :type session_id: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.EvaluationRule]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1450,105 +1768,73 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_evaluation_rules_list_request( - action_type=action_type, - agent_name=agent_name, - enabled=enabled, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) - return _request + _request = build_agents_get_session_request( + agent_name=agent_name, + session_id=session_id, + user_isolation_key=user_isolation_key, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluationRule], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - + raise HttpResponseError(response=response, model=error) -class ConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentSessionResource, response.json()) - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`connections` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore @distributed_trace_async - async def _get(self, name: str, **kwargs: Any) -> _models.Connection: - """Get a connection. + async def delete_session( + self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any + ) -> None: + """Delete a session. - Retrieves the specified connection and its configuration details without including credential - values. + Deletes a session synchronously. Returns 204 No Content when the session is deleted or does not + exist. - :param name: The friendly name of the connection, provided by the user. Required. - :type name: str - :return: Connection. The Connection is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Connection + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session identifier. Required. + :type session_id: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1562,10 +1848,12 @@ async def _get(self, name: str, **kwargs: Any) -> _models.Connection: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_connections_get_request( - name=name, + _request = build_agents_delete_session_request( + agent_name=agent_name, + session_id=session_id, + user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1575,48 +1863,37 @@ async def _get(self, name: str, **kwargs: Any) -> _models.Connection: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Connection, response.json()) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: - """Get a connection with credentials. + async def stop_session(self, agent_name: str, session_id: str, **kwargs: Any) -> None: + """Stop a session. - Retrieves the specified connection together with its credential values. + Terminates the specified hosted agent session and returns 204 No Content when the request + succeeds. - :param name: The friendly name of the connection, provided by the user. Required. - :type name: str - :return: Connection. The Connection is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Connection + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session identifier. Required. + :type session_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1630,10 +1907,11 @@ async def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Conne _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_connections_get_with_credentials_request( - name=name, + _request = build_agents_stop_session_request( + agent_name=agent_name, + session_id=session_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1643,66 +1921,66 @@ async def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Conne } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Connection, response.json()) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list( + def list_sessions( self, + agent_name: str, *, - connection_type: Optional[Union[str, _models.ConnectionType]] = None, - default_connection: Optional[bool] = None, + user_isolation_key: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Connection"]: - """List connections. + ) -> AsyncItemPaged["_models.AgentSessionResource"]: + """List sessions for an agent. - Returns the connections available in the current project, optionally filtered by type or - default status. + Returns a paged collection of sessions associated with the specified agent endpoint. - :keyword connection_type: Lists connections of this specific type. Known values are: - "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", - "AppConfig", "AppInsights", "CustomKeys", and "RemoteTool_Preview". Default value is None. - :paramtype connection_type: str or ~azure.ai.projects.models.ConnectionType - :keyword default_connection: Lists connections that are default connections. Default value is - None. - :paramtype default_connection: bool - :return: An iterator like instance of Connection - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Connection] + :param agent_name: The name of the agent. Required. + :type agent_name: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of AgentSessionResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.AgentSessionResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1712,60 +1990,37 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_connections_list_request( - connection_type=connection_type, - default_connection=default_connection, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + def prepare_request(_continuation_token=None): + _request = build_agents_list_sessions_request( + agent_name=agent_name, + user_isolation_key=user_isolation_key, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) return _request async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.Connection], - deserialized.get("value", []), + List[_models.AgentSessionResource], + deserialized.get("data", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + return deserialized.get("last_id") or None, AsyncList(list_of_elem) - async def get_next(next_link=None): - _request = prepare_request(next_link) + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access @@ -1775,47 +2030,59 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) return pipeline_response return AsyncItemPaged(get_next, extract_data) + @distributed_trace_async + async def get_session_log_stream( + self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any + ) -> _models.SessionLogEvent: + """Stream console logs for a hosted agent session. -class DatasetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + Streams console logs (stdout / stderr) for a specific hosted agent session + as a Server-Sent Events (SSE) stream. - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`datasets` attribute. - """ + Each SSE frame contains: - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + * `event`: always `"log"` + * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) - @distributed_trace - def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.DatasetVersion"]: - """List versions. + Example SSE frames: - List all versions of the given DatasetVersion. + .. code-block:: - :param name: The name of the resource. Required. - :type name: str - :return: An iterator like instance of DatasetVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.DatasetVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + event: log + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + event: log + data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} + + event: log + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + + event: log + data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} + + The stream remains open until the client disconnects or the server + terminates the connection. Clients should handle reconnection as needed. + :param agent_name: The name of the hosted agent. Required. + :type agent_name: str + :param agent_version: The version of the agent. Required. + :type agent_version: str + :param session_id: The session ID (maps to an ADC sandbox). Required. + :type session_id: str + :return: SessionLogEvent. The SessionLogEvent is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionLogEvent + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1824,177 +2091,88 @@ def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.Dat } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_datasets_list_versions_request( - name=name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) - return _request + _request = build_agents_get_session_log_stream_request( + agent_name=agent_name, + agent_version=agent_version, + session_id=session_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.DatasetVersion], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DatasetVersion"]: - """List latest versions. - - List the latest version of each DatasetVersion. - - :return: An iterator like instance of DatasetVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.DatasetVersion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_datasets_list_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - return _request + response = pipeline_response.http_response - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.DatasetVersion], - deserialized.get("value", []), + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) + raise HttpResponseError(response=response, model=error) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SessionLogEvent, response.text()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace_async - async def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: - """Get a version. + async def _upload_session_file( + self, + agent_name: str, + agent_session_id: str, + content: bytes, + *, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> _models.SessionFileWriteResult: + """Upload a session file. - Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the - DatasetVersion does not exist. + Uploads binary file content to the specified path in the session sandbox. The service stores + the file relative to the session home directory and rejects payloads larger than 50 MB. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to retrieve. Required. - :type version: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :param content: Required. + :type content: bytes + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -2005,15 +2183,22 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVe } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[_models.SessionFileWriteResult] = kwargs.pop("cls", None) - _request = build_datasets_get_request( - name=name, - version=version, + _content = content + + _request = build_agents_upload_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -2030,19 +2215,23 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVe response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) + deserialized = _deserialize(_models.SessionFileWriteResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2050,18 +2239,32 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVe return deserialized # type: ignore @distributed_trace_async - async def delete(self, name: str, version: str, **kwargs: Any) -> None: - """Delete a version. + async def download_session_file( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Download a session file. - Delete the specific version of the DatasetVersion. The service returns 204 No Content if the - DatasetVersion was deleted successfully or if the DatasetVersion does not exist. + Downloads the file at the specified sandbox path as a binary stream. The path is resolved + relative to the session home directory. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the DatasetVersion to delete. Required. - :type version: str - :return: None - :rtype: None + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The file path to download from the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -2075,11 +2278,13 @@ async def delete(self, name: str, version: str, **kwargs: Any) -> None: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_datasets_delete_request( - name=name, - version=version, + _request = build_agents_download_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2089,121 +2294,178 @@ async def delete(self, name: str, version: str, **kwargs: Any) -> None: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_or_update( - self, - name: str, - version: str, - dataset_version: _models.DatasetVersion, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.DatasetVersion: - """Create or update a version. + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) - Create a new or update an existing DatasetVersion with the given version id. + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Required. - :type dataset_version: ~azure.ai.projects.models.DatasetVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - @overload - async def create_or_update( + return deserialized # type: ignore + + @distributed_trace + def list_session_files( self, - name: str, - version: str, - dataset_version: JSON, + agent_name: str, + agent_session_id: str, *, - content_type: str = "application/merge-patch+json", + path: Optional[str] = None, + user_isolation_key: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> _models.DatasetVersion: - """Create or update a version. + ) -> AsyncItemPaged["_models.SessionDirectoryEntry"]: + """List session files. - Create a new or update an existing DatasetVersion with the given version id. + Returns files and directories at the specified path in the session sandbox. The response + includes only the immediate children of the target directory and defaults to the session home + directory when no path is supplied. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Required. - :type dataset_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The directory path to list, relative to the session home directory. Defaults to + the home directory if not provided. Default value is None. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of SessionDirectoryEntry + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.SessionDirectoryEntry] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def create_or_update( - self, - name: str, - version: str, - dataset_version: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.DatasetVersion: - """Create or update a version. + cls: ClsType[List[_models.SessionDirectoryEntry]] = kwargs.pop("cls", None) - Create a new or update an existing DatasetVersion with the given version id. + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Required. - :type dataset_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + def prepare_request(_continuation_token=None): + + _request = build_agents_list_session_files_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SessionDirectoryEntry], + deserialized.get("entries", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) + + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def create_or_update( - self, name: str, version: str, dataset_version: Union[_models.DatasetVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DatasetVersion: - """Create or update a version. + async def delete_session_file( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + recursive: Optional[bool] = None, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> None: + """Delete a session file. - Create a new or update an existing DatasetVersion with the given version id. + Deletes the specified file or directory from the session sandbox. When ``recursive`` is false, + deleting a non-empty directory returns 409 Conflict. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Is one of the following types: - DatasetVersion, JSON, IO[bytes] Required. - :type dataset_version: ~azure.ai.projects.models.DatasetVersion or JSON or IO[bytes] - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The file or directory path to delete, relative to the session home directory. + Required. + :paramtype path: str + :keyword recursive: Whether to recursively delete directory contents. The service defaults to + ``false`` if a value is not specified by the caller. Default value is None. + :paramtype recursive: bool + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -2214,25 +2476,18 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) - - content_type = content_type or "application/merge-patch+json" - _content = None - if isinstance(dataset_version, (IOBase, bytes)): - _content = dataset_version - else: - _content = json.dumps(dataset_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_datasets_create_or_update_request( - name=name, - version=version, - content_type=content_type, + _request = build_agents_delete_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + recursive=recursive, + user_isolation_key=user_isolation_key, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -2241,139 +2496,52 @@ async def create_or_update( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: _models.PendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResponse: - """Start a pending upload. - - Initiates a new pending upload or retrieves an existing one for the specified dataset version. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Required. - :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResponse: - """Start a pending upload. - - Initiates a new pending upload or retrieves an existing one for the specified dataset version. + return cls(pipeline_response, None, {}) # type: ignore - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Required. - :type pending_upload_request: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResponse: - """Start a pending upload. +class EvaluationRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - Initiates a new pending upload or retrieves an existing one for the specified dataset version. + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`evaluation_rules` attribute. + """ - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Required. - :type pending_upload_request: 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: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.PendingUploadResponse: - """Start a pending upload. + async def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: + """Get an evaluation rule. - Initiates a new pending upload or retrieves an existing one for the specified dataset version. + Retrieves the specified evaluation rule and its configuration. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Is one of the following - types: PendingUploadRequest, JSON, IO[bytes] Required. - :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or - IO[bytes] - :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResponse + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -2384,25 +2552,14 @@ async def pending_upload( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PendingUploadResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(pending_upload_request, (IOBase, bytes)): - _content = pending_upload_request - else: - _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) - _request = build_datasets_pending_upload_request( - name=name, - version=version, - content_type=content_type, + _request = build_evaluation_rules_get_request( + id=id, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -2431,7 +2588,7 @@ async def pending_upload( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PendingUploadResponse, response.json()) + deserialized = _deserialize(_models.EvaluationRule, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2439,17 +2596,15 @@ async def pending_upload( return deserialized # type: ignore @distributed_trace_async - async def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.DatasetCredential: - """Get dataset credentials. + async def delete(self, id: str, **kwargs: Any) -> None: + """Delete an evaluation rule. - Gets the SAS credential to access the storage account associated with a Dataset version. + Removes the specified evaluation rule from the project. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -2463,11 +2618,10 @@ async def get_credentials(self, name: str, version: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_datasets_get_credentials_request( - name=name, - version=version, + _request = build_evaluation_rules_delete_request( + id=id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2477,79 +2631,123 @@ async def get_credentials(self, name: str, version: str, **kwargs: Any) -> _mode } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DatasetCredential, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`deployments` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.Deployment: - """Get a deployment. + @overload + async def create_or_update( + self, id: str, evaluation_rule: _models.EvaluationRule, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. - Gets a deployed model. + Creates a new evaluation rule, or replaces the existing rule when the identifier matches. - :param name: Name of the deployment. Required. - :type name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Deployment + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Required. + :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + @overload + async def create_or_update( + self, id: str, evaluation_rule: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + Creates a new evaluation rule, or replaces the existing rule when the identifier matches. - _request = build_deployments_get_request( - name=name, + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Required. + :type evaluation_rule: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, id: str, evaluation_rule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. + + Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Required. + :type evaluation_rule: 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: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, id: str, evaluation_rule: Union[_models.EvaluationRule, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. + + Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Is one of the following types: + EvaluationRule, JSON, IO[bytes] Required. + :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule or JSON or IO[bytes] + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(evaluation_rule, (IOBase, bytes)): + _content = evaluation_rule + else: + _content = json.dumps(evaluation_rule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_evaluation_rules_create_or_update_request( + id=id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -2566,7 +2764,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.Deployment: response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -2575,18 +2773,13 @@ async def get(self, name: str, **kwargs: Any) -> _models.Deployment: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Deployment, response.json()) + deserialized = _deserialize(_models.EvaluationRule, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @@ -2594,32 +2787,31 @@ async def get(self, name: str, **kwargs: Any) -> _models.Deployment: def list( self, *, - model_publisher: Optional[str] = None, - model_name: Optional[str] = None, - deployment_type: Optional[Union[str, _models.DeploymentType]] = None, + action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, + agent_name: Optional[str] = None, + enabled: Optional[bool] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Deployment"]: - """List deployments. + ) -> AsyncItemPaged["_models.EvaluationRule"]: + """List evaluation rules. - Returns the deployed models available in the current project, optionally filtered by publisher, - model name, or deployment type. + Returns the evaluation rules configured for the project, optionally filtered by action type, + agent name, or enabled state. - :keyword model_publisher: Model publisher to filter models by. Default value is None. - :paramtype model_publisher: str - :keyword model_name: Model name (the publisher specific name) to filter models by. Default - value is None. - :paramtype model_name: str - :keyword deployment_type: Type of deployment to filter list by. "ModelDeployment" Default value - is None. - :paramtype deployment_type: str or ~azure.ai.projects.models.DeploymentType - :return: An iterator like instance of Deployment - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Deployment] + :keyword action_type: Filter by the type of evaluation rule. Known values are: + "continuousEvaluation" and "humanEvaluationPreview". Default value is None. + :paramtype action_type: str or ~azure.ai.projects.models.EvaluationRuleActionType + :keyword agent_name: Filter by the agent name. Default value is None. + :paramtype agent_name: str + :keyword enabled: Filter by the enabled status. Default value is None. + :paramtype enabled: bool + :return: An iterator like instance of EvaluationRule + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluationRule] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.EvaluationRule]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2632,10 +2824,10 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_deployments_list_request( - model_publisher=model_publisher, - model_name=model_name, - deployment_type=deployment_type, + _request = build_evaluation_rules_list_request( + action_type=action_type, + agent_name=agent_name, + enabled=enabled, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2675,7 +2867,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.Deployment], + List[_models.EvaluationRule], deserialized.get("value", []), ) if cls: @@ -2700,14 +2892,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class IndexesOperations: +class ConnectionsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`indexes` attribute. + :attr:`connections` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -2717,23 +2909,19 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.Index"]: - """List versions. + @distributed_trace_async + async def _get(self, name: str, **kwargs: Any) -> _models.Connection: + """Get a connection. - List all versions of the given Index. + Retrieves the specified connection and its configuration details without including credential + values. - :param name: The name of the resource. Required. + :param name: The friendly name of the connection, provided by the user. Required. :type name: str - :return: An iterator like instance of Index - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Index] + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2742,88 +2930,150 @@ def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.Ind } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_indexes_list_versions_request( - name=name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_connections_get_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Index], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + response = pipeline_response.http_response - async def get_next(next_link=None): - _request = prepare_request(next_link) + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Index"]: - """List latest versions. + @distributed_trace_async + async def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: + """Get a connection with credentials. - List the latest version of each Index. + Retrieves the specified connection together with its credential values. - :return: An iterator like instance of Index - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Index] + :param name: The friendly name of the connection, provided by the user. Required. + :type name: str + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + + _request = build_connections_get_with_credentials_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + *, + connection_type: Optional[Union[str, _models.ConnectionType]] = None, + default_connection: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Connection"]: + """List connections. + + Returns the connections available in the current project, optionally filtered by type or + default status. + + :keyword connection_type: Lists connections of this specific type. Known values are: + "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", + "AppConfig", "AppInsights", "CustomKeys", and "RemoteTool_Preview". Default value is None. + :paramtype connection_type: str or ~azure.ai.projects.models.ConnectionType + :keyword default_connection: Lists connections that are default connections. Default value is + None. + :paramtype default_connection: bool + :return: An iterator like instance of Connection + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Connection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2836,7 +3086,9 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Index"]: def prepare_request(next_link=None): if not next_link: - _request = build_indexes_list_request( + _request = build_connections_list_request( + connection_type=connection_type, + default_connection=default_connection, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2876,7 +3128,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.Index], + List[_models.Connection], deserialized.get("value", []), ) if cls: @@ -2900,21 +3152,41 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: - """Get a version. - Get the specific version of the Index. The service returns 404 Not Found error if the Index - does not exist. +class DatasetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`datasets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.DatasetVersion"]: + """List versions. + + List all versions of the given DatasetVersion. :param name: The name of the resource. Required. :type name: str - :param version: The specific version id of the Index to retrieve. Required. - :type version: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index + :return: An iterator like instance of DatasetVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2923,65 +3195,89 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.Index] = kwargs.pop("cls", None) + _request = build_datasets_list_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_indexes_get_request( - name=name, - version=version, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DatasetVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + async def get_next(next_link=None): + _request = prepare_request(next_link) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Index, response.json()) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - return deserialized # type: ignore + return pipeline_response - @distributed_trace_async - async def delete(self, name: str, version: str, **kwargs: Any) -> None: - """Delete a version. + return AsyncItemPaged(get_next, extract_data) - Delete the specific version of the Index. The service returns 204 No Content if the Index was - deleted successfully or if the Index does not exist. + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DatasetVersion"]: + """List latest versions. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the Index to delete. Required. - :type version: str - :return: None - :rtype: None + List the latest version of each DatasetVersion. + + :return: An iterator like instance of DatasetVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2990,12 +3286,169 @@ async def delete(self, name: str, version: str, **kwargs: Any) -> None: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_indexes_delete_request( + _request = build_datasets_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DatasetVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: + """Get a version. + + Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the + DatasetVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to retrieve. Required. + :type version: str + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) + + _request = build_datasets_get_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DatasetVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, name: str, version: str, **kwargs: Any) -> None: + """Delete a version. + + Delete the specific version of the DatasetVersion. The service returns 204 No Content if the + DatasetVersion was deleted successfully or if the DatasetVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the DatasetVersion to delete. Required. + :type version: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_datasets_delete_request( name=name, version=version, api_version=self._config.api_version, @@ -3026,48 +3479,54 @@ async def create_or_update( self, name: str, version: str, - index: _models.Index, + dataset_version: _models.DatasetVersion, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.Index: + ) -> _models.DatasetVersion: """Create or update a version. - Create a new or update an existing Index with the given version id. + Create a new or update an existing DatasetVersion with the given version id. :param name: The name of the resource. Required. :type name: str - :param version: The specific version id of the Index to create or update. Required. + :param version: The specific version id of the DatasetVersion to create or update. Required. :type version: str - :param index: The Index to create or update. Required. - :type index: ~azure.ai.projects.models.Index + :param dataset_version: The DatasetVersion to create or update. Required. + :type dataset_version: ~azure.ai.projects.models.DatasetVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/merge-patch+json". :paramtype content_type: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def create_or_update( - self, name: str, version: str, index: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.Index: + self, + name: str, + version: str, + dataset_version: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.DatasetVersion: """Create or update a version. - Create a new or update an existing Index with the given version id. + Create a new or update an existing DatasetVersion with the given version id. :param name: The name of the resource. Required. :type name: str - :param version: The specific version id of the Index to create or update. Required. + :param version: The specific version id of the DatasetVersion to create or update. Required. :type version: str - :param index: The Index to create or update. Required. - :type index: JSON + :param dataset_version: The DatasetVersion to create or update. Required. + :type dataset_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/merge-patch+json". :paramtype content_type: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: """ @@ -3076,46 +3535,46 @@ async def create_or_update( self, name: str, version: str, - index: IO[bytes], + dataset_version: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.Index: + ) -> _models.DatasetVersion: """Create or update a version. - Create a new or update an existing Index with the given version id. + Create a new or update an existing DatasetVersion with the given version id. :param name: The name of the resource. Required. :type name: str - :param version: The specific version id of the Index to create or update. Required. + :param version: The specific version id of the DatasetVersion to create or update. Required. :type version: str - :param index: The Index to create or update. Required. - :type index: IO[bytes] + :param dataset_version: The DatasetVersion to create or update. Required. + :type dataset_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/merge-patch+json". :paramtype content_type: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def create_or_update( - self, name: str, version: str, index: Union[_models.Index, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Index: + self, name: str, version: str, dataset_version: Union[_models.DatasetVersion, JSON, IO[bytes]], **kwargs: Any + ) -> _models.DatasetVersion: """Create or update a version. - Create a new or update an existing Index with the given version id. + Create a new or update an existing DatasetVersion with the given version id. :param name: The name of the resource. Required. :type name: str - :param version: The specific version id of the Index to create or update. Required. + :param version: The specific version id of the DatasetVersion to create or update. Required. :type version: str - :param index: The Index to create or update. Is one of the following types: Index, JSON, - IO[bytes] Required. - :type index: ~azure.ai.projects.models.Index or JSON or IO[bytes] - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index + :param dataset_version: The DatasetVersion to create or update. Is one of the following types: + DatasetVersion, JSON, IO[bytes] Required. + :type dataset_version: ~azure.ai.projects.models.DatasetVersion or JSON or IO[bytes] + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3130,16 +3589,16 @@ async def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Index] = kwargs.pop("cls", None) + cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) content_type = content_type or "application/merge-patch+json" _content = None - if isinstance(index, (IOBase, bytes)): - _content = index + if isinstance(dataset_version, (IOBase, bytes)): + _content = dataset_version else: - _content = json.dumps(index, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(dataset_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_indexes_create_or_update_request( + _request = build_datasets_create_or_update_request( name=name, version=version, content_type=content_type, @@ -3173,123 +3632,119 @@ async def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Index, response.json()) + deserialized = _deserialize(_models.DatasetVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: _models.PendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResponse: + """Start a pending upload. -class BetaAgentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`agents` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def patch_agent_details( - self, - agent_name: str, - *, - content_type: str = "application/merge-patch+json", - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, - **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. - - Applies a merge-patch update to the specified agent endpoint configuration. + Initiates a new pending upload or retrieves an existing one for the specified dataset version. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig - :keyword agent_card: Optional agent card for the agent. Default value is None. - :paramtype agent_card: ~azure.ai.projects.models.AgentCard - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def patch_agent_details( - self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResponse: + """Start a pending upload. - Applies a merge-patch update to the specified agent endpoint configuration. + Initiates a new pending upload or retrieves an existing one for the specified dataset version. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Required. - :type body: JSON + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def patch_agent_details( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResponse: + """Start a pending upload. - Applies a merge-patch update to the specified agent endpoint configuration. + Initiates a new pending upload or retrieves an existing one for the specified dataset version. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". + Default value is "application/json". :paramtype content_type: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def patch_agent_details( + async def pending_upload( self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, + name: str, + version: str, + pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. + ) -> _models.PendingUploadResponse: + """Start a pending upload. - Applies a merge-patch update to the specified agent endpoint configuration. + Initiates a new pending upload or retrieves an existing one for the specified dataset version. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig - :keyword agent_card: Optional agent card for the agent. Default value is None. - :paramtype agent_card: ~azure.ai.projects.models.AgentCard - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Is one of the following + types: PendingUploadRequest, JSON, IO[bytes] Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or + IO[bytes] + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3304,20 +3759,18 @@ async def patch_agent_details( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.PendingUploadResponse] = kwargs.pop("cls", None) - if body is _Unset: - body = {"agent_card": agent_card, "agent_endpoint": agent_endpoint} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/merge-patch+json" + content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(pending_upload_request, (IOBase, bytes)): + _content = pending_upload_request else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_patch_agent_details_request( - agent_name=agent_name, + _request = build_datasets_pending_upload_request( + name=name, + version=version, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -3344,145 +3797,56 @@ async def patch_agent_details( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentDetails, response.json()) + deserialized = _deserialize(_models.PendingUploadResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def create_version_from_code( - self, - agent_name: str, - content: _models.CreateAgentVersionFromCodeContent, - *, - code_zip_sha256: str, - **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version from code. - - Creates a new agent version from code. Uploads the code zip and creates a new version for an - existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` - header for integrity and dedup. The request body is multipart/form-data with a JSON metadata - part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. + @distributed_trace_async + async def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.DatasetCredential: + """Get dataset credentials. - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + Gets the SAS credential to access the storage account associated with a Dataset version. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - async def create_version_from_code( - self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version from code. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Creates a new agent version from code. Uploads the code zip and creates a new version for an - existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` - header for integrity and dedup. The request body is multipart/form-data with a JSON metadata - part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. + cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. - - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_version_from_code( - self, - agent_name: str, - content: Union[_models.CreateAgentVersionFromCodeContent, JSON], - *, - code_zip_sha256: str, - **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version from code. - - Creates a new agent version from code. Uploads the code zip and creates a new version for an - existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` - header for integrity and dedup. The request body is multipart/form-data with a JSON metadata - part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. - - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. - - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) - - _body = content.as_dict() if isinstance(content, _Model) else content - _file_fields: list[str] = ["code"] - _data_fields: list[str] = ["metadata"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) - - _request = build_beta_agents_create_version_from_code_request( - agent_name=agent_name, - code_zip_sha256=code_zip_sha256, - api_version=self._config.api_version, - files=_files, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_datasets_get_credentials_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) @@ -3499,44 +3863,46 @@ async def create_version_from_code( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + deserialized = _deserialize(_models.DatasetCredential, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def download_code( - self, agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - """Download agent code. - Downloads the code zip for a code-based hosted agent. - Returns the previously-uploaded zip (``application/zip``). +class DeploymentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - If ``agent_version`` is supplied, returns that version's code zip; otherwise - returns the latest version's code zip. + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`deployments` attribute. + """ - The SHA-256 digest of the returned bytes matches the ``content_hash`` on the - resolved version's ``code_configuration``. + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - :param agent_name: The name of the agent. Required. - :type agent_name: str - :keyword agent_version: The version of the agent whose code zip should be downloaded. - If omitted, the latest version's code zip is returned. Default value is None. - :paramtype agent_version: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + @distributed_trace_async + async def get(self, name: str, **kwargs: Any) -> _models.Deployment: + """Get a deployment. + + Gets a deployed model. + + :param name: Name of the deployment. Required. + :type name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3550,11 +3916,10 @@ async def download_code( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - _request = build_beta_agents_download_code_request( - agent_name=agent_name, - agent_version=agent_version, + _request = build_deployments_get_request( + name=name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3565,7 +3930,7 @@ async def download_code( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -3579,243 +3944,258 @@ async def download_code( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) response_headers = {} - response_headers["x-ms-agent-version"] = self._deserialize("str", response.headers.get("x-ms-agent-version")) - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Deployment, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def create_session( + @distributed_trace + def list( self, - agent_name: str, *, - version_indicator: _models.VersionIndicator, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", - agent_session_id: Optional[str] = None, + model_publisher: Optional[str] = None, + model_name: Optional[str] = None, + deployment_type: Optional[Union[str, _models.DeploymentType]] = None, **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + ) -> AsyncItemPaged["_models.Deployment"]: + """List deployments. - Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + Returns the deployed models available in the current project, optionally filtered by publisher, + model name, or deployment type. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique - within the agent endpoint. Auto-generated if omitted. Default value is None. - :paramtype agent_session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :keyword model_publisher: Model publisher to filter models by. Default value is None. + :paramtype model_publisher: str + :keyword model_name: Model name (the publisher specific name) to filter models by. Default + value is None. + :paramtype model_name: str + :keyword deployment_type: Type of deployment to filter list by. "ModelDeployment" Default value + is None. + :paramtype deployment_type: str or ~azure.ai.projects.models.DeploymentType + :return: An iterator like instance of Deployment + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def create_session( - self, - agent_name: str, - body: JSON, - *, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Required. - :type body: JSON - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + def prepare_request(next_link=None): + if not next_link: - @overload - async def create_session( - self, - agent_name: str, - body: IO[bytes], - *, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + _request = build_deployments_list_request( + model_publisher=model_publisher, + model_name=model_name, + deployment_type=deployment_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + return _request - @distributed_trace_async - async def create_session( - self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - version_indicator: _models.VersionIndicator = _Unset, - user_isolation_key: Optional[str] = None, - agent_session_id: Optional[str] = None, - **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Deployment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + async def get_next(next_link=None): + _request = prepare_request(next_link) - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique - within the agent endpoint. Auto-generated if omitted. Default value is None. - :paramtype agent_session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class IndexesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`indexes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.Index"]: + """List versions. + + List all versions of the given Index. + + :param name: The name of the resource. Required. + :type name: str + :return: An iterator like instance of Index + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Index] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) - - if body is _Unset: - if version_indicator is _Unset: - raise TypeError("missing required argument: version_indicator") - body = {"agent_session_id": agent_session_id, "version_indicator": version_indicator} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_beta_agents_create_session_request( - agent_name=agent_name, - user_isolation_key=user_isolation_key, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + 304: ResourceNotModifiedError, } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def prepare_request(next_link=None): + if not next_link: - response = pipeline_response.http_response + _request = build_indexes_list_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if response.status_code not in [201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Index], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + async def get_next(next_link=None): + _request = prepare_request(next_link) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - return deserialized # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - @distributed_trace_async - async def get_session( - self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: - """Get a session. + return pipeline_response - Retrieves the details of a hosted agent session by agent name and session identifier. + return AsyncItemPaged(get_next, extract_data) - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Index"]: + """List latest versions. + + List the latest version of each Index. + + :return: An iterator like instance of Index + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Index] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3824,73 +4204,86 @@ async def get_session( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + _request = build_indexes_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_agents_get_session_request( - agent_name=agent_name, - session_id=session_id, - user_isolation_key=user_isolation_key, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Index], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def delete_session( - self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any - ) -> None: - """Delete a session. + async def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: + """Get a version. - Deletes a session synchronously. Returns 204 No Content when the session is deleted or does not - exist. + Get the specific version of the Index. The service returns 404 Not Found error if the Index + does not exist. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: None - :rtype: None + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to retrieve. Required. + :type version: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3904,12 +4297,11 @@ async def delete_session( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Index] = kwargs.pop("cls", None) - _request = build_beta_agents_delete_session_request( - agent_name=agent_name, - session_id=session_id, - user_isolation_key=user_isolation_key, + _request = build_indexes_get_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3919,35 +4311,44 @@ async def delete_session( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Index, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def stop_session(self, agent_name: str, session_id: str, **kwargs: Any) -> None: - """Stop a session. + async def delete(self, name: str, version: str, **kwargs: Any) -> None: + """Delete a version. - Terminates the specified hosted agent session and returns 204 No Content when the request - succeeds. + Delete the specific version of the Index. The service returns 204 No Content if the Index was + deleted successfully or if the Index does not exist. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the Index to delete. Required. + :type version: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -3965,9 +4366,9 @@ async def stop_session(self, agent_name: str, session_id: str, **kwargs: Any) -> cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_stop_session_request( - agent_name=agent_name, - session_id=session_id, + _request = build_indexes_delete_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3986,157 +4387,106 @@ async def stop_session(self, agent_name: str, session_id: str, **kwargs: Any) -> if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if cls: return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def list_sessions( + @overload + async def create_or_update( self, - agent_name: str, + name: str, + version: str, + index: _models.Index, *, - user_isolation_key: Optional[str] = None, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> AsyncItemPaged["_models.AgentSessionResource"]: - """List sessions for an agent. + ) -> _models.Index: + """Create or update a version. - Returns a paged collection of sessions associated with the specified agent endpoint. + Create a new or update an existing Index with the given version id. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of AgentSessionResource - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.AgentSessionResource] + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Required. + :type index: ~azure.ai.projects.models.Index + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(_continuation_token=None): - - _request = build_beta_agents_list_sessions_request( - agent_name=agent_name, - user_isolation_key=user_isolation_key, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.AgentSessionResource], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, AsyncList(list_of_elem) + @overload + async def create_or_update( + self, name: str, version: str, index: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.Index: + """Create or update a version. - async def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + Create a new or update an existing Index with the given version id. - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Required. + :type index: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index + :raises ~azure.core.exceptions.HttpResponseError: + """ - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + @overload + async def create_or_update( + self, + name: str, + version: str, + index: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.Index: + """Create or update a version. - return pipeline_response + Create a new or update an existing Index with the given version id. - return AsyncItemPaged(get_next, extract_data) + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Required. + :type index: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get_session_log_stream( - self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any - ) -> _models.SessionLogEvent: - """Stream console logs for a hosted agent session. - - Streams console logs (stdout / stderr) for a specific hosted agent session - as a Server-Sent Events (SSE) stream. - - Each SSE frame contains: - - * `event`: always `"log"` - * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) - - Example SSE frames: - - .. code-block:: - - event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} - - event: log - data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} - - event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} - - event: log - data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} + async def create_or_update( + self, name: str, version: str, index: Union[_models.Index, JSON, IO[bytes]], **kwargs: Any + ) -> _models.Index: + """Create or update a version. - The stream remains open until the client disconnects or the server - terminates the connection. Clients should handle reconnection as needed. + Create a new or update an existing Index with the given version id. - :param agent_name: The name of the hosted agent. Required. - :type agent_name: str - :param agent_version: The version of the agent. Required. - :type agent_version: str - :param session_id: The session ID (maps to an ADC sandbox). Required. - :type session_id: str - :return: SessionLogEvent. The SessionLogEvent is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SessionLogEvent + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Is one of the following types: Index, JSON, + IO[bytes] Required. + :type index: ~azure.ai.projects.models.Index or JSON or IO[bytes] + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4147,16 +4497,25 @@ async def get_session_log_stream( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Index] = kwargs.pop("cls", None) - _request = build_beta_agents_get_session_log_stream_request( - agent_name=agent_name, - agent_version=agent_version, - session_id=session_id, + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(index, (IOBase, bytes)): + _content = index + else: + _content = json.dumps(index, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_indexes_create_or_update_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -4166,69 +4525,170 @@ async def get_session_log_stream( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionLogEvent, response.text()) + deserialized = _deserialize(_models.Index, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + +class ToolboxesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`toolboxes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def create_version( + self, + name: str, + *, + tools: List[_models.Tool], + content_type: str = "application/json", + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + skills: Optional[List[_models.ToolboxSkill]] = None, + policies: Optional[_models.ToolboxPolicies] = None, + **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. + + Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :keyword tools: The list of tools to include in this version. Required. + :paramtype tools: list[~azure.ai.projects.models.Tool] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword description: A human-readable description of the toolbox. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is + None. + :paramtype metadata: dict[str, str] + :keyword skills: The list of skill sources to include in this version. A skill reference + specifies a skill name and optionally a version. If version is omitted, the skill's default + version is used. Default value is None. + :paramtype skills: list[~azure.ai.projects.models.ToolboxSkill] + :keyword policies: Policy configuration for this toolbox version. Default value is None. + :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_version( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. + + Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :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: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_version( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. + + Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :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: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def _upload_session_file( + async def create_version( self, - agent_name: str, - agent_session_id: str, - content: bytes, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, *, - path: str, - user_isolation_key: Optional[str] = None, + tools: List[_models.Tool] = _Unset, + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + skills: Optional[List[_models.ToolboxSkill]] = None, + policies: Optional[_models.ToolboxPolicies] = None, **kwargs: Any - ) -> _models.SessionFileWriteResult: - """Upload a session file. + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. - Uploads binary file content to the specified path in the session sandbox. The service stores - the file relative to the session home directory and rejects payloads larger than 50 MB. + Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :param content: Required. - :type content: bytes - :keyword path: The destination file path within the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SessionFileWriteResult + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword tools: The list of tools to include in this version. Required. + :paramtype tools: list[~azure.ai.projects.models.Tool] + :keyword description: A human-readable description of the toolbox. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is + None. + :paramtype metadata: dict[str, str] + :keyword skills: The list of skill sources to include in this version. A skill reference + specifies a skill name and optionally a version. If version is omitted, the skill's default + version is used. Default value is None. + :paramtype skills: list[~azure.ai.projects.models.ToolboxSkill] + :keyword policies: Policy configuration for this toolbox version. Default value is None. + :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4242,16 +4702,29 @@ async def _upload_session_file( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[_models.SessionFileWriteResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) - _content = content + if body is _Unset: + if tools is _Unset: + raise TypeError("missing required argument: tools") + body = { + "description": description, + "metadata": metadata, + "policies": policies, + "skills": skills, + "tools": tools, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_upload_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + _request = build_toolboxes_create_version_request( + name=name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -4271,7 +4744,7 @@ async def _upload_session_file( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -4287,7 +4760,7 @@ async def _upload_session_file( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionFileWriteResult, response.json()) + deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4295,32 +4768,15 @@ async def _upload_session_file( return deserialized # type: ignore @distributed_trace_async - async def download_session_file( - self, - agent_name: str, - agent_session_id: str, - *, - path: str, - user_isolation_key: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - """Download a session file. + async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: + """Retrieve a toolbox. - Downloads the file at the specified sandbox path as a binary stream. The path is resolved - relative to the session home directory. + Retrieves the specified toolbox and its current configuration. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The file path to download from the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :param name: The name of the toolbox to retrieve. Required. + :type name: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4334,13 +4790,10 @@ async def download_session_file( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) - _request = build_beta_agents_download_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + _request = build_toolboxes_get_request( + name=name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4351,7 +4804,7 @@ async def download_session_file( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -4371,7 +4824,10 @@ async def download_session_file( ) raise HttpResponseError(response=response, model=error) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ToolboxObject, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4379,34 +4835,18 @@ async def download_session_file( return deserialized # type: ignore @distributed_trace - def list_session_files( + def list( self, - agent_name: str, - agent_session_id: str, *, - path: Optional[str] = None, - user_isolation_key: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SessionDirectoryEntry"]: - """List session files. + ) -> AsyncItemPaged["_models.ToolboxObject"]: + """List toolboxes. - Returns files and directories at the specified path in the session sandbox. The response - includes only the immediate children of the target directory and defaults to the session home - directory when no path is supplied. + Returns the toolboxes available in the current project. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The directory path to list, relative to the session home directory. Defaults to - the home directory if not provided. Default value is None. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -4421,15 +4861,14 @@ def list_session_files( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of SessionDirectoryEntry - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.SessionDirectoryEntry] + :return: An iterator like instance of ToolboxObject + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ToolboxObject] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SessionDirectoryEntry]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4441,11 +4880,7 @@ def list_session_files( def prepare_request(_continuation_token=None): - _request = build_beta_agents_list_session_files_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + _request = build_toolboxes_list_request( limit=limit, order=order, after=_continuation_token, @@ -4463,8 +4898,8 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SessionDirectoryEntry], - deserialized.get("entries", []), + List[_models.ToolboxObject], + deserialized.get("data", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4491,39 +4926,45 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def delete_session_file( + @distributed_trace + def list_versions( self, - agent_name: str, - agent_session_id: str, + name: str, *, - path: str, - recursive: Optional[bool] = None, - user_isolation_key: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> None: - """Delete a session file. + ) -> AsyncItemPaged["_models.ToolboxVersionObject"]: + """List toolbox versions. - Deletes the specified file or directory from the session sandbox. When ``recursive`` is false, - deleting a non-empty directory returns 409 Conflict. + Returns the available versions for the specified toolbox. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The file or directory path to delete, relative to the session home directory. - Required. - :paramtype path: str - :keyword recursive: Whether to recursively delete directory contents. The service defaults to - ``false`` if a value is not specified by the caller. Default value is None. - :paramtype recursive: bool - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: None - :rtype: None + :param name: The name of the toolbox to list versions for. Required. + :type name: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of ToolboxVersionObject + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ToolboxVersionObject] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4532,137 +4973,67 @@ async def delete_session_file( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_beta_agents_delete_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - recursive=recursive, - user_isolation_key=user_isolation_key, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + def prepare_request(_continuation_token=None): - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + _request = build_toolboxes_list_versions_request( + name=name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, ) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_optimization_job( - self, - job: _models.OptimizationJob, - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.OptimizationJob: - """Creates an agent optimization job. - - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. - - :param job: The job to create. Required. - :type job: ~azure.ai.projects.models.OptimizationJob - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - @overload - async def create_optimization_job( - self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.OptimizationJob: - """Creates an agent optimization job. + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ToolboxVersionObject], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, AsyncList(list_of_elem) - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. + async def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) - :param job: The job to create. Required. - :type job: JSON - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - @overload - async def create_optimization_job( - self, - job: IO[bytes], - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.OptimizationJob: - """Creates an agent optimization job. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. + return pipeline_response - :param job: The job to create. Required. - :type job: IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def create_optimization_job( - self, job: Union[_models.OptimizationJob, JSON, IO[bytes]], *, operation_id: Optional[str] = None, **kwargs: Any - ) -> _models.OptimizationJob: - """Creates an agent optimization job. - - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. - - :param job: The job to create. Is one of the following types: OptimizationJob, JSON, IO[bytes] - Required. - :type job: ~azure.ai.projects.models.OptimizationJob or JSON or IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob + async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.ToolboxVersionObject: + """Retrieve a specific version of a toolbox. + + Retrieves the specified version of a toolbox by name and version identifier. + + :param name: The name of the toolbox. Required. + :type name: str + :param version: The version identifier to retrieve. Required. + :type version: str + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4673,24 +5044,15 @@ async def create_optimization_job( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(job, (IOBase, bytes)): - _content = job - else: - _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) - _request = build_beta_agents_create_optimization_job_request( - operation_id=operation_id, - content_type=content_type, + _request = build_toolboxes_get_version_request( + name=name, + version=version, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -4707,7 +5069,7 @@ async def create_optimization_job( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -4720,30 +5082,94 @@ async def create_optimization_job( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) + deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + async def update( + self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + Updates the toolbox's default version pointer to the specified version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :keyword default_version: The version identifier that the toolbox should point to. When set, + the toolbox's default version will resolve to this version instead of the latest. Required. + :paramtype default_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + Updates the toolbox's default version pointer to the specified version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :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: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + Updates the toolbox's default version pointer to the specified version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :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: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: - """Get info about an agent optimization job. + async def update( + self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. - Get an optimization job by id. + Updates the toolbox's default version pointer to the specified version. - :param job_id: The ID of the job. Required. - :type job_id: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob + :param name: The name of the toolbox to update. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword default_version: The version identifier that the toolbox should point to. When set, + the toolbox's default version will resolve to this version instead of the latest. Required. + :paramtype default_version: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4754,14 +5180,29 @@ async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Opti } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) - _request = build_beta_agents_get_optimization_job_request( - job_id=job_id, + if body is _Unset: + if default_version is _Unset: + raise TypeError("missing required argument: default_version") + body = {"default_version": default_version} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_toolboxes_update_request( + name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -4791,132 +5232,26 @@ async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Opti ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) + deserialized = _deserialize(_models.ToolboxObject, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_optimization_jobs( - self, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - status: Optional[Union[str, _models.JobStatus]] = None, - agent_name: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.OptimizationJobListItem"]: - """Returns a list of agent optimization jobs. - - List optimization jobs. Supports cursor pagination and optional status / agent_name filters. - - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :keyword status: Filter to jobs in this lifecycle state. Known values are: "queued", - "in_progress", "succeeded", "failed", and "cancelled". Default value is None. - :paramtype status: str or ~azure.ai.projects.models.JobStatus - :keyword agent_name: Filter to jobs targeting this agent name. Default value is None. - :paramtype agent_name: str - :return: An iterator like instance of OptimizationJobListItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.OptimizationJobListItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.OptimizationJobListItem]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(_continuation_token=None): - - _request = build_beta_agents_list_optimization_jobs_request( - limit=limit, - order=order, - after=_continuation_token, - before=before, - status=status, - agent_name=agent_name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.OptimizationJobListItem], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, AsyncList(list_of_elem) - - async def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: - """Cancels an agent optimization job. + async def delete(self, name: str, **kwargs: Any) -> None: + """Delete a toolbox. - Request cancellation of a running or queued job. Returns an error if the job is already in a - terminal state. + Removes the specified toolbox along with all of its versions. - :param job_id: The ID of the job to cancel. Required. - :type job_id: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob + :param name: The name of the toolbox to delete. Required. + :type name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4930,10 +5265,10 @@ async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.O _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_cancel_optimization_job_request( - job_id=job_id, + _request = build_toolboxes_delete_request( + name=name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4943,20 +5278,14 @@ async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.O } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -4964,24 +5293,19 @@ async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.O ) raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def delete_optimization_job(self, job_id: str, **kwargs: Any) -> None: - """Deletes an agent optimization job. + async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: + """Delete a specific version of a toolbox. - Delete the job and its candidate artifacts. Cancels first if non-terminal. + Removes the specified version of a toolbox. - :param job_id: The ID of the job to delete. Required. - :type job_id: str + :param name: The name of the toolbox. Required. + :type name: str + :param version: The version identifier to delete. Required. + :type version: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -4999,8 +5323,9 @@ async def delete_optimization_job(self, job_id: str, **kwargs: Any) -> None: cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_delete_optimization_job_request( - job_id=job_id, + _request = build_toolboxes_delete_version_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -11783,231 +12108,33 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class BetaToolboxesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`toolboxes` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_version( - self, - name: str, - *, - tools: List[_models.Tool], - content_type: str = "application/json", - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - skills: Optional[List[_models.ToolboxSkill]] = None, - policies: Optional[_models.ToolboxPolicies] = None, - **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. - - Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword description: A human-readable description of the toolbox. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is - None. - :paramtype metadata: dict[str, str] - :keyword skills: The list of skill sources to include in this version. A skill reference - specifies a skill name and optionally a version. If version is omitted, the skill's default - version is used. Default value is None. - :paramtype skills: list[~azure.ai.projects.models.ToolboxSkill] - :keyword policies: Policy configuration for this toolbox version. Default value is None. - :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_version( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. - - Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :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: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_version( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. - - Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :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: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_version( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - tools: List[_models.Tool] = _Unset, - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - skills: Optional[List[_models.ToolboxSkill]] = None, - policies: Optional[_models.ToolboxPolicies] = None, - **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. - - Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] - :keyword description: A human-readable description of the toolbox. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is - None. - :paramtype metadata: dict[str, str] - :keyword skills: The list of skill sources to include in this version. A skill reference - specifies a skill name and optionally a version. If version is omitted, the skill's default - version is used. Default value is None. - :paramtype skills: list[~azure.ai.projects.models.ToolboxSkill] - :keyword policies: Policy configuration for this toolbox version. Default value is None. - :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) - - if body is _Unset: - if tools is _Unset: - raise TypeError("missing required argument: tools") - body = { - "description": description, - "metadata": metadata, - "policies": policies, - "skills": skills, - "tools": tools, - } - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_beta_toolboxes_create_version_request( - name=name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) +class BetaSkillsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`skills` attribute. + """ - return deserialized # type: ignore + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: - """Retrieve a toolbox. + async def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: + """Retrieve a skill. - Retrieves the specified toolbox and its current configuration. + Retrieves the specified skill and its current configuration. - :param name: The name of the toolbox to retrieve. Required. + :param name: The unique name of the skill. Required. :type name: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12021,9 +12148,9 @@ async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + cls: ClsType[_models.SkillDetails] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_get_request( + _request = build_beta_skills_get_request( name=name, api_version=self._config.api_version, headers=_headers, @@ -12058,7 +12185,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + deserialized = _deserialize(_models.SkillDetails, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12073,106 +12200,11 @@ def list( order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ToolboxObject"]: - """List toolboxes. - - Returns the toolboxes available in the current project. - - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of ToolboxObject - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ToolboxObject] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(_continuation_token=None): - - _request = build_beta_toolboxes_list_request( - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ToolboxObject], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, AsyncList(list_of_elem) - - async def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_versions( - self, - name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.ToolboxVersionObject"]: - """List toolbox versions. + ) -> AsyncItemPaged["_models.SkillDetails"]: + """List skills. - Returns the available versions for the specified toolbox. + Returns the skills available in the current project. - :param name: The name of the toolbox to list versions for. Required. - :type name: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -12187,14 +12219,14 @@ def list_versions( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of ToolboxVersionObject - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ToolboxVersionObject] + :return: An iterator like instance of SkillDetails + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.SkillDetails] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SkillDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12206,8 +12238,7 @@ def list_versions( def prepare_request(_continuation_token=None): - _request = build_beta_toolboxes_list_versions_request( - name=name, + _request = build_beta_skills_list_request( limit=limit, order=order, after=_continuation_token, @@ -12225,7 +12256,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ToolboxVersionObject], + List[_models.SkillDetails], deserialized.get("data", []), ) if cls: @@ -12253,154 +12284,84 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.ToolboxVersionObject: - """Retrieve a specific version of a toolbox. - - Retrieves the specified version of a toolbox by name and version identifier. - - :param name: The name of the toolbox. Required. - :type name: str - :param version: The version identifier to retrieve. Required. - :type version: str - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) - - _request = build_beta_toolboxes_get_version_request( - name=name, - version=version, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @overload async def update( self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + ) -> _models.SkillDetails: + """Update a skill. - Updates the toolbox's default version pointer to the specified version. + Modifies the specified skill's configuration. - :param name: The name of the toolbox to update. Required. + :param name: The name of the skill to update. Required. :type name: str - :keyword default_version: The version identifier that the toolbox should point to. When set, - the toolbox's default version will resolve to this version instead of the latest. Required. + :keyword default_version: The version identifier that the skill should point to. When set, the + skill's default version will resolve to this version instead of the latest. Required. :paramtype default_version: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def update( self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + ) -> _models.SkillDetails: + """Update a skill. - Updates the toolbox's default version pointer to the specified version. + Modifies the specified skill's configuration. - :param name: The name of the toolbox to update. Required. + :param name: The name of the skill to update. Required. :type name: str :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: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def update( self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + ) -> _models.SkillDetails: + """Update a skill. - Updates the toolbox's default version pointer to the specified version. + Modifies the specified skill's configuration. - :param name: The name of the toolbox to update. Required. + :param name: The name of the skill to update. Required. :type name: str :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: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def update( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any + ) -> _models.SkillDetails: + """Update a skill. - Updates the toolbox's default version pointer to the specified version. + Modifies the specified skill's configuration. - :param name: The name of the toolbox to update. Required. + :param name: The name of the skill to update. Required. :type name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword default_version: The version identifier that the toolbox should point to. When set, - the toolbox's default version will resolve to this version instead of the latest. Required. + :keyword default_version: The version identifier that the skill should point to. When set, the + skill's default version will resolve to this version instead of the latest. Required. :paramtype default_version: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12415,7 +12376,7 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + cls: ClsType[_models.SkillDetails] = kwargs.pop("cls", None) if body is _Unset: if default_version is _Unset: @@ -12429,7 +12390,7 @@ async def update( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_toolboxes_update_request( + _request = build_beta_skills_update_request( name=name, content_type=content_type, api_version=self._config.api_version, @@ -12466,7 +12427,7 @@ async def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + deserialized = _deserialize(_models.SkillDetails, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12474,15 +12435,15 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete(self, name: str, **kwargs: Any) -> None: - """Delete a toolbox. + async def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: + """Delete a skill. - Removes the specified toolbox along with all of its versions. + Removes the specified skill and its associated versions. - :param name: The name of the toolbox to delete. Required. + :param name: The unique name of the skill. Required. :type name: str - :return: None - :rtype: None + :return: DeleteSkillResult. The DeleteSkillResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteSkillResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12496,9 +12457,9 @@ async def delete(self, name: str, **kwargs: Any) -> None: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.DeleteSkillResult] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_delete_request( + _request = build_beta_skills_delete_request( name=name, api_version=self._config.api_version, headers=_headers, @@ -12509,14 +12470,20 @@ async def delete(self, name: str, **kwargs: Any) -> None: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -12524,21 +12491,110 @@ async def delete(self, name: str, **kwargs: Any) -> None: ) raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DeleteSkillResult, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + name: str, + *, + content_type: str = "application/json", + inline_content: Optional[_models.SkillInlineContent] = None, + default: Optional[bool] = None, + **kwargs: Any + ) -> _models.SkillVersion: + """Create a new version of a skill. + + Creates a new version of a skill. If the skill does not exist, it will be created. + + :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :type name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword inline_content: Inline skill content for simple skills without file uploads. + Foundry-specific extension. Default value is None. + :paramtype inline_content: ~azure.ai.projects.models.SkillInlineContent + :keyword default: Whether to set this version as the default. Default value is None. + :paramtype default: bool + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SkillVersion: + """Create a new version of a skill. + + Creates a new version of a skill. If the skill does not exist, it will be created. + + :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :type name: str + :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: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SkillVersion: + """Create a new version of a skill. + + Creates a new version of a skill. If the skill does not exist, it will be created. + + :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :type name: str + :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: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: - """Delete a specific version of a toolbox. + async def create( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + inline_content: Optional[_models.SkillInlineContent] = None, + default: Optional[bool] = None, + **kwargs: Any + ) -> _models.SkillVersion: + """Create a new version of a skill. - Removes the specified version of a toolbox. + Creates a new version of a skill. If the skill does not exist, it will be created. - :param name: The name of the toolbox. Required. + :param name: The name of the skill. If the skill does not exist, it will be created. Required. :type name: str - :param version: The version identifier to delete. Required. - :type version: str - :return: None - :rtype: None + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword inline_content: Inline skill content for simple skills without file uploads. + Foundry-specific extension. Default value is None. + :paramtype inline_content: ~azure.ai.projects.models.SkillInlineContent + :keyword default: Whether to set this version as the default. Default value is None. + :paramtype default: bool + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12549,15 +12605,27 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) + + if body is _Unset: + body = {"default": default, "inline_content": inline_content} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_toolboxes_delete_version_request( + _request = build_beta_skills_create_request( name=name, - version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -12566,14 +12634,20 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -12581,37 +12655,62 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: ) raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SkillVersion, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized # type: ignore -class BetaSkillsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @overload + async def create_from_files( + self, name: str, content: _models.CreateSkillVersionFromFilesBody, **kwargs: Any + ) -> _models.SkillVersion: + """Create a skill version from uploaded files. - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`skills` attribute. - """ + Creates a new version of a skill from uploaded files via multipart form data. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param name: The name of the skill. Required. + :type name: str + :param content: Required. + :type content: ~azure.ai.projects.models.CreateSkillVersionFromFilesBody + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_from_files(self, name: str, content: JSON, **kwargs: Any) -> _models.SkillVersion: + """Create a skill version from uploaded files. + + Creates a new version of a skill from uploaded files via multipart form data. + + :param name: The name of the skill. Required. + :type name: str + :param content: Required. + :type content: JSON + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: - """Retrieve a skill. + async def create_from_files( + self, name: str, content: Union[_models.CreateSkillVersionFromFilesBody, JSON], **kwargs: Any + ) -> _models.SkillVersion: + """Create a skill version from uploaded files. - Retrieves the specified skill and its current configuration. + Creates a new version of a skill from uploaded files via multipart form data. - :param name: The unique name of the skill. Required. + :param name: The name of the skill. Required. :type name: str - :return: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails + :param content: Is either a CreateSkillVersionFromFilesBody type or a JSON type. Required. + :type content: ~azure.ai.projects.models.CreateSkillVersionFromFilesBody or JSON + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12625,11 +12724,17 @@ async def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) - _request = build_beta_skills_get_request( + _body = content.as_dict() if isinstance(content, _Model) else content + _file_fields: list[str] = ["files"] + _data_fields: list[str] = ["default"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_beta_skills_create_from_files_request( name=name, api_version=self._config.api_version, + files=_files, headers=_headers, params=_params, ) @@ -12662,7 +12767,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillDetails, response.json()) + deserialized = _deserialize(_models.SkillVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12670,18 +12775,21 @@ async def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: return deserialized # type: ignore @distributed_trace - def list( + def list_versions( self, + name: str, *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SkillDetails"]: - """List skills. + ) -> AsyncItemPaged["_models.SkillVersion"]: + """List skill versions. - Returns the skills available in the current project. + Returns the available versions for the specified skill. + :param name: The name of the skill to list versions for. Required. + :type name: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -12696,14 +12804,14 @@ def list( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of SkillDetails - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.SkillDetails] + :return: An iterator like instance of SkillVersion + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.SkillVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SkillDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SkillVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12715,7 +12823,8 @@ def list( def prepare_request(_continuation_token=None): - _request = build_beta_skills_list_request( + _request = build_beta_skills_list_versions_request( + name=name, limit=limit, order=order, after=_continuation_token, @@ -12733,7 +12842,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SkillDetails], + List[_models.SkillVersion], deserialized.get("data", []), ) if cls: @@ -12761,84 +12870,18 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) - @overload - async def update( - self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: - """Update a skill. - - Modifies the specified skill's configuration. - - :param name: The name of the skill to update. Required. - :type name: str - :keyword default_version: The version identifier that the skill should point to. When set, the - skill's default version will resolve to this version instead of the latest. Required. - :paramtype default_version: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: - """Update a skill. - - Modifies the specified skill's configuration. - - :param name: The name of the skill to update. Required. - :type name: str - :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: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: - """Update a skill. - - Modifies the specified skill's configuration. - - :param name: The name of the skill to update. Required. - :type name: str - :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: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def update( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.SkillDetails: - """Update a skill. + async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVersion: + """Retrieve a specific version of a skill. - Modifies the specified skill's configuration. + Retrieves the specified version of a skill by name and version identifier. - :param name: The name of the skill to update. Required. + :param name: The name of the skill. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword default_version: The version identifier that the skill should point to. When set, the - skill's default version will resolve to this version instead of the latest. Required. - :paramtype default_version: str - :return: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails + :param version: The version identifier to retrieve. Required. + :type version: str + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12849,29 +12892,15 @@ async def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SkillDetails] = kwargs.pop("cls", None) - - if body is _Unset: - if default_version is _Unset: - raise TypeError("missing required argument: default_version") - body = {"default_version": default_version} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) - _request = build_beta_skills_update_request( + _request = build_beta_skills_get_version_request( name=name, - content_type=content_type, + version=version, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -12904,7 +12933,7 @@ async def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillDetails, response.json()) + deserialized = _deserialize(_models.SkillVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12912,15 +12941,15 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: - """Delete a skill. + async def download(self, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + """Download the zip content for the default version of a skill. - Removes the specified skill and its associated versions. + Downloads the zip content for the default version of a skill. - :param name: The unique name of the skill. Required. + :param name: The name of the skill. Required. :type name: str - :return: DeleteSkillResult. The DeleteSkillResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteSkillResult + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12934,9 +12963,9 @@ async def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteSkillResult] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_skills_delete_request( + _request = build_beta_skills_download_request( name=name, api_version=self._config.api_version, headers=_headers, @@ -12948,7 +12977,7 @@ async def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -12968,110 +12997,99 @@ async def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: ) raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DeleteSkillResult, response.json()) + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def create( - self, - name: str, - *, - content_type: str = "application/json", - inline_content: Optional[_models.SkillInlineContent] = None, - default: Optional[bool] = None, - **kwargs: Any - ) -> _models.SkillVersion: - """Create a new version of a skill. + @distributed_trace_async + async def download_version(self, name: str, version: str, **kwargs: Any) -> AsyncIterator[bytes]: + """Download the zip content for a specific version of a skill. - Creates a new version of a skill. If the skill does not exist, it will be created. + Downloads the zip content for a specific version of a skill. - :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :param name: The name of the skill. Required. :type name: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword inline_content: Inline skill content for simple skills without file uploads. - Foundry-specific extension. Default value is None. - :paramtype inline_content: ~azure.ai.projects.models.SkillInlineContent - :keyword default: Whether to set this version as the default. Default value is None. - :paramtype default: bool - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion + :param version: The version to download content for. Required. + :type version: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - async def create( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillVersion: - """Create a new version of a skill. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Creates a new version of a skill. If the skill does not exist, it will be created. + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - :param name: The name of the skill. If the skill does not exist, it will be created. Required. - :type name: str - :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: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + _request = build_beta_skills_download_version_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - @overload - async def create( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillVersion: - """Create a new version of a skill. + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - Creates a new version of a skill. If the skill does not exist, it will be created. + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - :param name: The name of the skill. If the skill does not exist, it will be created. Required. - :type name: str - :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: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def create( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - inline_content: Optional[_models.SkillInlineContent] = None, - default: Optional[bool] = None, - **kwargs: Any - ) -> _models.SkillVersion: - """Create a new version of a skill. + async def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.DeleteSkillVersionResult: + """Delete a specific version of a skill. - Creates a new version of a skill. If the skill does not exist, it will be created. + Removes the specified version of a skill. - :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :param name: The name of the skill. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword inline_content: Inline skill content for simple skills without file uploads. - Foundry-specific extension. Default value is None. - :paramtype inline_content: ~azure.ai.projects.models.SkillInlineContent - :keyword default: Whether to set this version as the default. Default value is None. - :paramtype default: bool - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion + :param version: The version identifier to delete. Required. + :type version: str + :return: DeleteSkillVersionResult. The DeleteSkillVersionResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.DeleteSkillVersionResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13082,27 +13100,15 @@ async def create( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) - - if body is _Unset: - body = {"default": default, "inline_content": inline_content} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.DeleteSkillVersionResult] = kwargs.pop("cls", None) - _request = build_beta_skills_create_request( + _request = build_beta_skills_delete_version_request( name=name, - content_type=content_type, + version=version, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -13135,59 +13141,41 @@ async def create( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillVersion, response.json()) + deserialized = _deserialize(_models.DeleteSkillVersionResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def create_from_files( - self, name: str, content: _models.CreateSkillVersionFromFilesBody, **kwargs: Any - ) -> _models.SkillVersion: - """Create a skill version from uploaded files. - - Creates a new version of a skill from uploaded files via multipart form data. - - :param name: The name of the skill. Required. - :type name: str - :param content: Required. - :type content: ~azure.ai.projects.models.CreateSkillVersionFromFilesBody - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create_from_files(self, name: str, content: JSON, **kwargs: Any) -> _models.SkillVersion: - """Create a skill version from uploaded files. +class BetaDatasetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - Creates a new version of a skill from uploaded files via multipart form data. + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`datasets` attribute. + """ - :param name: The name of the skill. Required. - :type name: str - :param content: Required. - :type content: JSON - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def create_from_files( - self, name: str, content: Union[_models.CreateSkillVersionFromFilesBody, JSON], **kwargs: Any - ) -> _models.SkillVersion: - """Create a skill version from uploaded files. + async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: + """Get a data generation job. - Creates a new version of a skill from uploaded files via multipart form data. + Retrieves the specified data generation job and its current status. - :param name: The name of the skill. Required. - :type name: str - :param content: Is either a CreateSkillVersionFromFilesBody type or a JSON type. Required. - :type content: ~azure.ai.projects.models.CreateSkillVersionFromFilesBody or JSON - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion + :param job_id: The ID of the job. Required. + :type job_id: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13201,17 +13189,11 @@ async def create_from_files( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) - - _body = content.as_dict() if isinstance(content, _Model) else content - _file_fields: list[str] = ["files"] - _data_fields: list[str] = ["default"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_skills_create_from_files_request( - name=name, + _request = build_beta_datasets_get_generation_job_request( + job_id=job_id, api_version=self._config.api_version, - files=_files, headers=_headers, params=_params, ) @@ -13241,32 +13223,32 @@ async def create_from_files( ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillVersion, response.json()) + deserialized = _deserialize(_models.DataGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_versions( + def list_generation_jobs( self, - name: str, *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SkillVersion"]: - """List skill versions. + ) -> AsyncItemPaged["_models.DataGenerationJob"]: + """List data generation jobs. - Returns the available versions for the specified skill. + Returns a list of data generation jobs. - :param name: The name of the skill to list versions for. Required. - :type name: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -13281,14 +13263,14 @@ def list_versions( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of SkillVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.SkillVersion] + :return: An iterator like instance of DataGenerationJob + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.DataGenerationJob] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SkillVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DataGenerationJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13300,8 +13282,7 @@ def list_versions( def prepare_request(_continuation_token=None): - _request = build_beta_skills_list_versions_request( - name=name, + _request = build_beta_datasets_list_generation_jobs_request( limit=limit, order=order, after=_continuation_token, @@ -13319,7 +13300,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SkillVersion], + List[_models.DataGenerationJob], deserialized.get("data", []), ) if cls: @@ -13347,18 +13328,99 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) + @overload + async def create_generation_job( + self, + job: _models.DataGenerationJob, + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataGenerationJob: + """Create a data generation job. + + Submits a new data generation job for asynchronous execution. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.DataGenerationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_generation_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.DataGenerationJob: + """Create a data generation job. + + Submits a new data generation job for asynchronous execution. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_generation_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataGenerationJob: + """Create a data generation job. + + Submits a new data generation job for asynchronous execution. + + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVersion: - """Retrieve a specific version of a skill. + async def create_generation_job( + self, + job: Union[_models.DataGenerationJob, JSON, IO[bytes]], + *, + operation_id: Optional[str] = None, + **kwargs: Any + ) -> _models.DataGenerationJob: + """Create a data generation job. - Retrieves the specified version of a skill by name and version identifier. + Submits a new data generation job for asynchronous execution. - :param name: The name of the skill. Required. - :type name: str - :param version: The version identifier to retrieve. Required. - :type version: str - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion + :param job: The job to create. Is one of the following types: DataGenerationJob, JSON, + IO[bytes] Required. + :type job: ~azure.ai.projects.models.DataGenerationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13369,15 +13431,24 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.S } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_skills_get_version_request( - name=name, - version=version, + content_type = content_type or "application/json" + _content = None + if isinstance(job, (IOBase, bytes)): + _content = job + else: + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_datasets_create_generation_job_request( + operation_id=operation_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -13394,7 +13465,7 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.S response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -13407,26 +13478,30 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.S ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillVersion, response.json()) + deserialized = _deserialize(_models.DataGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def download(self, name: str, **kwargs: Any) -> AsyncIterator[bytes]: - """Download the zip content for the default version of a skill. + async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: + """Cancel a data generation job. - Downloads the zip content for the default version of a skill. + Cancels the specified data generation job if it is still in progress. - :param name: The name of the skill. Required. - :type name: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :param job_id: The ID of the job to cancel. Required. + :type job_id: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13440,10 +13515,10 @@ async def download(self, name: str, **kwargs: Any) -> AsyncIterator[bytes]: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_skills_download_request( - name=name, + _request = build_beta_datasets_cancel_generation_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -13454,7 +13529,7 @@ async def download(self, name: str, **kwargs: Any) -> AsyncIterator[bytes]: _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -13474,28 +13549,26 @@ async def download(self, name: str, **kwargs: Any) -> AsyncIterator[bytes]: ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def download_version(self, name: str, version: str, **kwargs: Any) -> AsyncIterator[bytes]: - """Download the zip content for a specific version of a skill. + async def delete_generation_job(self, job_id: str, **kwargs: Any) -> None: + """Delete a data generation job. - Downloads the zip content for a specific version of a skill. + Removes the specified data generation job and its associated output. - :param name: The name of the skill. Required. - :type name: str - :param version: The version to download content for. Required. - :type version: str - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] + :param job_id: The ID of the job to delete. Required. + :type job_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13509,11 +13582,10 @@ async def download_version(self, name: str, version: str, **kwargs: Any) -> Asyn _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_skills_download_version_request( - name=name, - version=version, + _request = build_beta_datasets_delete_generation_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -13523,20 +13595,14 @@ async def download_version(self, name: str, version: str, **kwargs: Any) -> Asyn } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -13544,29 +13610,120 @@ async def download_version(self, name: str, version: str, **kwargs: Any) -> Asyn ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + if cls: + return cls(pipeline_response, None, {}) # type: ignore - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore +class BetaAgentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - return deserialized # type: ignore + Instead, you should access the following operations through + :class:`~azure.ai.projects.aio.AIProjectClient`'s + :attr:`agents` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def create_optimization_job( + self, + job: _models.OptimizationJob, + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.OptimizationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_optimization_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_optimization_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.DeleteSkillVersionResult: - """Delete a specific version of a skill. + async def create_optimization_job( + self, job: Union[_models.OptimizationJob, JSON, IO[bytes]], *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. - Removes the specified version of a skill. + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. - :param name: The name of the skill. Required. - :type name: str - :param version: The version identifier to delete. Required. - :type version: str - :return: DeleteSkillVersionResult. The DeleteSkillVersionResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.DeleteSkillVersionResult + :param job: The job to create. Is one of the following types: OptimizationJob, JSON, IO[bytes] + Required. + :type job: ~azure.ai.projects.models.OptimizationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13577,15 +13734,24 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> _model } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteSkillVersionResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) - _request = build_beta_skills_delete_version_request( - name=name, - version=version, + content_type = content_type or "application/json" + _content = None + if isinstance(job, (IOBase, bytes)): + _content = job + else: + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_agents_create_optimization_job_request( + operation_id=operation_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -13602,7 +13768,7 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> _model response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: await response.read() # Load the body in memory and close the socket @@ -13615,44 +13781,30 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> _model ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteSkillVersionResult, response.json()) + deserialized = _deserialize(_models.OptimizationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - -class BetaDatasetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`datasets` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: - """Get a data generation job. + async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + """Get info about an agent optimization job. - Retrieves the specified data generation job and its current status. + Get an optimization job by id. :param job_id: The ID of the job. Required. :type job_id: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13666,9 +13818,9 @@ async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGe _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) - _request = build_beta_datasets_get_generation_job_request( + _request = build_beta_agents_get_optimization_job_request( job_id=job_id, api_version=self._config.api_version, headers=_headers, @@ -13706,7 +13858,7 @@ async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGe if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) + deserialized = _deserialize(_models.OptimizationJob, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -13714,17 +13866,19 @@ async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGe return deserialized # type: ignore @distributed_trace - def list_generation_jobs( + def list_optimization_jobs( self, *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, + status: Optional[Union[str, _models.JobStatus]] = None, + agent_name: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.DataGenerationJob"]: - """List data generation jobs. + ) -> AsyncItemPaged["_models.OptimizationJobListItem"]: + """Returns a list of agent optimization jobs. - Returns a list of data generation jobs. + List optimization jobs. Supports cursor pagination and optional status / agent_name filters. :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the @@ -13740,14 +13894,20 @@ def list_generation_jobs( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of DataGenerationJob - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.DataGenerationJob] + :keyword status: Filter to jobs in this lifecycle state. Known values are: "queued", + "in_progress", "succeeded", "failed", and "cancelled". Default value is None. + :paramtype status: str or ~azure.ai.projects.models.JobStatus + :keyword agent_name: Filter to jobs targeting this agent name. Default value is None. + :paramtype agent_name: str + :return: An iterator like instance of OptimizationJobListItem + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.OptimizationJobListItem] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DataGenerationJob]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OptimizationJobListItem]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13759,11 +13919,13 @@ def list_generation_jobs( def prepare_request(_continuation_token=None): - _request = build_beta_datasets_list_generation_jobs_request( + _request = build_beta_agents_list_optimization_jobs_request( limit=limit, order=order, after=_continuation_token, before=before, + status=status, + agent_name=agent_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -13777,7 +13939,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.DataGenerationJob], + List[_models.OptimizationJobListItem], deserialized.get("data", []), ) if cls: @@ -13805,180 +13967,17 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) - @overload - async def create_generation_job( - self, - job: _models.DataGenerationJob, - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataGenerationJob: - """Create a data generation job. - - Submits a new data generation job for asynchronous execution. - - :param job: The job to create. Required. - :type job: ~azure.ai.projects.models.DataGenerationJob - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_generation_job( - self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.DataGenerationJob: - """Create a data generation job. - - Submits a new data generation job for asynchronous execution. - - :param job: The job to create. Required. - :type job: JSON - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_generation_job( - self, - job: IO[bytes], - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataGenerationJob: - """Create a data generation job. - - Submits a new data generation job for asynchronous execution. - - :param job: The job to create. Required. - :type job: IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_generation_job( - self, - job: Union[_models.DataGenerationJob, JSON, IO[bytes]], - *, - operation_id: Optional[str] = None, - **kwargs: Any - ) -> _models.DataGenerationJob: - """Create a data generation job. - - Submits a new data generation job for asynchronous execution. - - :param job: The job to create. Is one of the following types: DataGenerationJob, JSON, - IO[bytes] Required. - :type job: ~azure.ai.projects.models.DataGenerationJob or JSON or IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(job, (IOBase, bytes)): - _content = job - else: - _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_beta_datasets_create_generation_job_request( - operation_id=operation_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - @distributed_trace_async - async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: - """Cancel a data generation job. + async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + """Cancels an agent optimization job. - Cancels the specified data generation job if it is still in progress. + Request cancellation of a running or queued job. Returns an error if the job is already in a + terminal state. :param job_id: The ID of the job to cancel. Required. :type job_id: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13992,9 +13991,9 @@ async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Dat _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) - _request = build_beta_datasets_cancel_generation_job_request( + _request = build_beta_agents_cancel_optimization_job_request( job_id=job_id, api_version=self._config.api_version, headers=_headers, @@ -14029,7 +14028,7 @@ async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Dat if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) + deserialized = _deserialize(_models.OptimizationJob, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14037,10 +14036,10 @@ async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Dat return deserialized # type: ignore @distributed_trace_async - async def delete_generation_job(self, job_id: str, **kwargs: Any) -> None: - """Delete a data generation job. + async def delete_optimization_job(self, job_id: str, **kwargs: Any) -> None: + """Deletes an agent optimization job. - Removes the specified data generation job and its associated output. + Delete the job and its candidate artifacts. Cancels first if non-terminal. :param job_id: The ID of the job to delete. Required. :type job_id: str @@ -14061,7 +14060,7 @@ async def delete_generation_job(self, job_id: str, **kwargs: Any) -> None: cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_datasets_delete_generation_job_request( + _request = build_beta_agents_delete_optimization_job_request( job_id=job_id, api_version=self._config.api_version, headers=_headers, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py index 53716def91a6..a6ee0f86eca2 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py @@ -14,14 +14,8 @@ class _AgentDefinitionOptInKeys(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Feature opt-in keys for agent definition operations supporting hosted or workflow agents.""" - HOSTED_AGENTS_V1_PREVIEW = "HostedAgents=V1Preview" - """HOSTED_AGENTS_V1_PREVIEW.""" WORKFLOW_AGENTS_V1_PREVIEW = "WorkflowAgents=V1Preview" """WORKFLOW_AGENTS_V1_PREVIEW.""" - AGENT_ENDPOINT_V1_PREVIEW = "AgentEndpoints=V1Preview" - """AGENT_ENDPOINT_V1_PREVIEW.""" - CODE_AGENTS_V1_PREVIEW = "CodeAgents=V1Preview" - """CODE_AGENTS_V1_PREVIEW.""" EXTERNAL_AGENTS_V1_PREVIEW = "ExternalAgents=V1Preview" """EXTERNAL_AGENTS_V1_PREVIEW.""" @@ -41,8 +35,6 @@ class _FoundryFeaturesOptInKeys(str, Enum, metaclass=CaseInsensitiveEnumMeta): """MEMORY_STORES_V1_PREVIEW.""" ROUTINES_V1_PREVIEW = "Routines=V1Preview" """ROUTINES_V1_PREVIEW.""" - TOOLBOXES_V1_PREVIEW = "Toolboxes=V1Preview" - """TOOLBOXES_V1_PREVIEW.""" SKILLS_V1_PREVIEW = "Skills=V1Preview" """SKILLS_V1_PREVIEW.""" DATA_GENERATION_JOBS_V1_PREVIEW = "DataGenerationJobs=V1Preview" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py index 532e98b62daf..421eea460685 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py @@ -47,10 +47,7 @@ ) _AGENT_OPERATION_FEATURE_HEADERS: Final[str] = ",".join( [ - _AgentDefinitionOptInKeys.HOSTED_AGENTS_V1_PREVIEW.value, _AgentDefinitionOptInKeys.WORKFLOW_AGENTS_V1_PREVIEW.value, - _AgentDefinitionOptInKeys.AGENT_ENDPOINT_V1_PREVIEW.value, - _AgentDefinitionOptInKeys.CODE_AGENTS_V1_PREVIEW.value, _AgentDefinitionOptInKeys.EXTERNAL_AGENTS_V1_PREVIEW.value, _FoundryFeaturesOptInKeys.AGENTS_OPTIMIZATION_V2_PREVIEW.value, ] @@ -65,7 +62,6 @@ "red_teams": _FoundryFeaturesOptInKeys.RED_TEAMS_V1_PREVIEW.value, "routines": _FoundryFeaturesOptInKeys.ROUTINES_V1_PREVIEW.value, "schedules": _FoundryFeaturesOptInKeys.SCHEDULES_V1_PREVIEW.value, - "toolboxes": _FoundryFeaturesOptInKeys.TOOLBOXES_V1_PREVIEW.value, "skills": _FoundryFeaturesOptInKeys.SKILLS_V1_PREVIEW.value, "datasets": _FoundryFeaturesOptInKeys.DATA_GENERATION_JOBS_V1_PREVIEW.value, "agents": _AGENT_OPERATION_FEATURE_HEADERS, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py index 1a1c0ffec86c..d6cf67b4d8cf 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/__init__.py @@ -19,6 +19,7 @@ from ._operations import DatasetsOperations # type: ignore from ._operations import DeploymentsOperations # type: ignore from ._operations import IndexesOperations # type: ignore +from ._operations import ToolboxesOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -32,6 +33,7 @@ "DatasetsOperations", "DeploymentsOperations", "IndexesOperations", + "ToolboxesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py index 2ca2deb79964..af32fd3d4cd9 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py @@ -286,17 +286,18 @@ def build_agents_list_versions_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_evaluation_rules_get_request(id: str, **kwargs: Any) -> HttpRequest: +def build_agents_patch_agent_details_request(agent_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", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluationrules/{id}" + _url = "/agents/{agent_name}" path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -305,19 +306,26 @@ def build_evaluation_rules_get_request(id: str, **kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_evaluation_rules_delete_request(id: str, **kwargs: Any) -> HttpRequest: +def build_agents_create_version_from_code_request( # pylint: disable=name-too-long + agent_name: str, *, code_zip_sha256: 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", "v1")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/evaluationrules/{id}" + _url = "/agents/{agent_name}/versions" path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -325,70 +333,75 @@ def build_evaluation_rules_delete_request(id: str, **kwargs: Any) -> HttpRequest # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["x-ms-code-zip-sha256"] = _SERIALIZER.header("code_zip_sha256", code_zip_sha256, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_evaluation_rules_create_or_update_request( # pylint: disable=name-too-long - id: str, **kwargs: Any + +def build_agents_download_code_request( + agent_name: str, *, agent_version: Optional[str] = None, **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", "v1")) - accept = _headers.pop("Accept", "application/json") + accept = _headers.pop("Accept", "application/zip") # Construct URL - _url = "/evaluationrules/{id}" + _url = "/agents/{agent_name}/code:download" path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if agent_version is not None: + _params["agent_version"] = _SERIALIZER.query("agent_version", agent_version, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_evaluation_rules_list_request( - *, - action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, - agent_name: Optional[str] = None, - enabled: Optional[bool] = None, - **kwargs: Any +def build_agents_create_session_request( + agent_name: str, *, user_isolation_key: Optional[str] = None, **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", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/evaluationrules" + _url = "/agents/{agent_name}/endpoint/sessions" + path_format_arguments = { + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if action_type is not None: - _params["actionType"] = _SERIALIZER.query("action_type", action_type, "str") - if agent_name is not None: - _params["agentName"] = _SERIALIZER.query("agent_name", agent_name, "str") - if enabled is not None: - _params["enabled"] = _SERIALIZER.query("enabled", enabled, "bool") # Construct headers + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_connections_get_request(name: str, **kwargs: Any) -> HttpRequest: +def build_agents_get_session_request( + agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -396,9 +409,10 @@ def build_connections_get_request(name: str, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/connections/{name}" + _url = "/agents/{agent_name}/endpoint/sessions/{session_id}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "session_id": _SERIALIZER.url("session_id", session_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -407,24 +421,25 @@ def build_connections_get_request(name: str, **kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_connections_get_with_credentials_request( # pylint: disable=name-too-long - name: str, **kwargs: Any +def build_agents_delete_session_request( + agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **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", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/connections/{name}/getConnectionWithCredentials" + _url = "/agents/{agent_name}/endpoint/sessions/{session_id}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "session_id": _SERIALIZER.url("session_id", session_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -433,40 +448,41 @@ def build_connections_get_with_credentials_request( # pylint: disable=name-too- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_connections_list_request( - *, - connection_type: Optional[Union[str, _models.ConnectionType]] = None, - default_connection: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) +def build_agents_stop_session_request(agent_name: str, session_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/connections" + _url = "/agents/{agent_name}/endpoint/sessions/{session_id}:stop" + path_format_arguments = { + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "session_id": _SERIALIZER.url("session_id", session_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if connection_type is not None: - _params["connectionType"] = _SERIALIZER.query("connection_type", connection_type, "str") - if default_connection is not None: - _params["defaultConnection"] = _SERIALIZER.query("default_connection", default_connection, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_datasets_list_versions_request(name: str, **kwargs: Any) -> HttpRequest: +def build_agents_list_sessions_request( + agent_name: str, + *, + user_isolation_key: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -474,31 +490,50 @@ def build_datasets_list_versions_request(name: str, **kwargs: Any) -> HttpReques accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/datasets/{name}/versions" + _url = "/agents/{agent_name}/endpoint/sessions" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_datasets_list_request(**kwargs: Any) -> HttpRequest: +def build_agents_get_session_log_stream_request( # pylint: disable=name-too-long + agent_name: str, agent_version: str, session_id: 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", "v1")) - accept = _headers.pop("Accept", "application/json") + accept = _headers.pop("Accept", "text/event-stream") # Construct URL - _url = "/datasets" + _url = "/agents/{agent_name}/versions/{agent_version}/sessions/{session_id}:logstream" + path_format_arguments = { + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "agent_version": _SERIALIZER.url("agent_version", agent_version, "str"), + "session_id": _SERIALIZER.url("session_id", session_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -509,107 +544,152 @@ def build_datasets_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_datasets_get_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_agents_upload_session_file_request( + agent_name: str, agent_session_id: str, *, path: str, user_isolation_key: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: str = kwargs.pop("content_type") api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/datasets/{name}/versions/{version}" + _url = "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "agent_session_id": _SERIALIZER.url("agent_session_id", agent_session_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["path"] = _SERIALIZER.query("path", path, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_datasets_delete_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_agents_download_session_file_request( # pylint: disable=name-too-long + agent_name: str, agent_session_id: str, *, path: str, user_isolation_key: Optional[str] = None, **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", "v1")) + accept = _headers.pop("Accept", "application/octet-stream") + # Construct URL - _url = "/datasets/{name}/versions/{version}" + _url = "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "agent_session_id": _SERIALIZER.url("agent_session_id", agent_session_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["path"] = _SERIALIZER.query("path", path, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_datasets_create_or_update_request(name: str, version: str, **kwargs: Any) -> HttpRequest: + +def build_agents_list_session_files_request( + agent_name: str, + agent_session_id: str, + *, + path: Optional[str] = None, + user_isolation_key: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + **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", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/datasets/{name}/versions/{version}" + _url = "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "agent_session_id": _SERIALIZER.url("agent_session_id", agent_session_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if path is not None: + _params["path"] = _SERIALIZER.query("path", path, "str") + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_datasets_pending_upload_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_agents_delete_session_file_request( + agent_name: str, + agent_session_id: str, + *, + path: str, + recursive: Optional[bool] = None, + user_isolation_key: Optional[str] = None, + **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", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/datasets/{name}/versions/{version}/startPendingUpload" + _url = "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), + "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "agent_session_id": _SERIALIZER.url("agent_session_id", agent_session_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["path"] = _SERIALIZER.query("path", path, "str") + if recursive is not None: + _params["recursive"] = _SERIALIZER.query("recursive", recursive, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if user_isolation_key is not None: + _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_datasets_get_credentials_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_evaluation_rules_get_request(id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -617,10 +697,9 @@ def build_datasets_get_credentials_request(name: str, version: str, **kwargs: An accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/datasets/{name}/versions/{version}/credentials" + _url = "/evaluationrules/{id}" path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), + "id": _SERIALIZER.url("id", id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -631,18 +710,96 @@ def build_datasets_get_credentials_request(name: str, version: str, **kwargs: An # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_get_request(name: str, **kwargs: Any) -> HttpRequest: +def build_evaluation_rules_delete_request(id: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + # Construct URL + _url = "/evaluationrules/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_evaluation_rules_create_or_update_request( # pylint: disable=name-too-long + id: 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", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/deployments/{name}" + _url = "/evaluationrules/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_evaluation_rules_list_request( + *, + action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, + agent_name: Optional[str] = None, + enabled: Optional[bool] = None, + **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", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/evaluationrules" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if action_type is not None: + _params["actionType"] = _SERIALIZER.query("action_type", action_type, "str") + if agent_name is not None: + _params["agentName"] = _SERIALIZER.query("agent_name", agent_name, "str") + if enabled is not None: + _params["enabled"] = _SERIALIZER.query("enabled", enabled, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connections_get_request(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", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/connections/{name}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), } @@ -658,11 +815,36 @@ def build_deployments_get_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_deployments_list_request( +def build_connections_get_with_credentials_request( # pylint: disable=name-too-long + 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", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/connections/{name}/getConnectionWithCredentials" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connections_list_request( *, - model_publisher: Optional[str] = None, - model_name: Optional[str] = None, - deployment_type: Optional[Union[str, _models.DeploymentType]] = None, + connection_type: Optional[Union[str, _models.ConnectionType]] = None, + default_connection: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -672,16 +854,14 @@ def build_deployments_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/deployments" + _url = "/connections" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if model_publisher is not None: - _params["modelPublisher"] = _SERIALIZER.query("model_publisher", model_publisher, "str") - if model_name is not None: - _params["modelName"] = _SERIALIZER.query("model_name", model_name, "str") - if deployment_type is not None: - _params["deploymentType"] = _SERIALIZER.query("deployment_type", deployment_type, "str") + if connection_type is not None: + _params["connectionType"] = _SERIALIZER.query("connection_type", connection_type, "str") + if default_connection is not None: + _params["defaultConnection"] = _SERIALIZER.query("default_connection", default_connection, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -689,7 +869,7 @@ def build_deployments_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_indexes_list_versions_request(name: str, **kwargs: Any) -> HttpRequest: +def build_datasets_list_versions_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -697,7 +877,7 @@ def build_indexes_list_versions_request(name: str, **kwargs: Any) -> HttpRequest accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/indexes/{name}/versions" + _url = "/datasets/{name}/versions" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), } @@ -713,7 +893,7 @@ def build_indexes_list_versions_request(name: str, **kwargs: Any) -> HttpRequest return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_indexes_list_request(**kwargs: Any) -> HttpRequest: +def build_datasets_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -721,7 +901,7 @@ def build_indexes_list_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/indexes" + _url = "/datasets" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -732,7 +912,7 @@ def build_indexes_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_indexes_get_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_datasets_get_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -740,7 +920,7 @@ def build_indexes_get_request(name: str, version: str, **kwargs: Any) -> HttpReq accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/indexes/{name}/versions/{version}" + _url = "/datasets/{name}/versions/{version}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), "version": _SERIALIZER.url("version", version, "str"), @@ -757,12 +937,12 @@ def build_indexes_get_request(name: str, version: str, **kwargs: Any) -> HttpReq return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_indexes_delete_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_datasets_delete_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) # Construct URL - _url = "/indexes/{name}/versions/{version}" + _url = "/datasets/{name}/versions/{version}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), "version": _SERIALIZER.url("version", version, "str"), @@ -776,7 +956,7 @@ def build_indexes_delete_request(name: str, version: str, **kwargs: Any) -> Http return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_indexes_create_or_update_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_datasets_create_or_update_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -785,7 +965,7 @@ def build_indexes_create_or_update_request(name: str, version: str, **kwargs: An accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/indexes/{name}/versions/{version}" + _url = "/datasets/{name}/versions/{version}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), "version": _SERIALIZER.url("version", version, "str"), @@ -804,9 +984,7 @@ def build_indexes_create_or_update_request(name: str, version: str, **kwargs: An return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_patch_agent_details_request( # pylint: disable=name-too-long - agent_name: str, **kwargs: Any -) -> HttpRequest: +def build_datasets_pending_upload_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -815,9 +993,10 @@ def build_beta_agents_patch_agent_details_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}" + _url = "/datasets/{name}/versions/{version}/startPendingUpload" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -830,12 +1009,10 @@ def build_beta_agents_patch_agent_details_request( # pylint: disable=name-too-l _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_create_version_from_code_request( # pylint: disable=name-too-long - agent_name: str, *, code_zip_sha256: str, **kwargs: Any -) -> HttpRequest: +def build_datasets_get_credentials_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -843,9 +1020,10 @@ def build_beta_agents_create_version_from_code_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/versions" + _url = "/datasets/{name}/versions/{version}/credentials" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -854,32 +1032,27 @@ def build_beta_agents_create_version_from_code_request( # pylint: disable=name- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["x-ms-code-zip-sha256"] = _SERIALIZER.header("code_zip_sha256", code_zip_sha256, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_download_code_request( - agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_deployments_get_request(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", "v1")) - accept = _headers.pop("Accept", "application/zip") + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/code:download" + _url = "/deployments/{name}" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if agent_version is not None: - _params["agent_version"] = _SERIALIZER.query("agent_version", agent_version, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -888,40 +1061,38 @@ def build_beta_agents_download_code_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_create_session_request( - agent_name: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any +def build_deployments_list_request( + *, + model_publisher: Optional[str] = None, + model_name: Optional[str] = None, + deployment_type: Optional[Union[str, _models.DeploymentType]] = None, + **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", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/sessions" - path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/deployments" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if model_publisher is not None: + _params["modelPublisher"] = _SERIALIZER.query("model_publisher", model_publisher, "str") + if model_name is not None: + _params["modelName"] = _SERIALIZER.query("model_name", model_name, "str") + if deployment_type is not None: + _params["deploymentType"] = _SERIALIZER.query("deployment_type", deployment_type, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_get_session_request( - agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_indexes_list_versions_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -929,10 +1100,9 @@ def build_beta_agents_get_session_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/sessions/{session_id}" + _url = "/indexes/{name}/versions" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "session_id": _SERIALIZER.url("session_id", session_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -941,48 +1111,42 @@ def build_beta_agents_get_session_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_delete_session_request( - agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_indexes_list_request(**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", "v1")) - # Construct URL - _url = "/agents/{agent_name}/endpoint/sessions/{session_id}" - path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "session_id": _SERIALIZER.url("session_id", session_id, "str"), - } + accept = _headers.pop("Accept", "application/json") - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct URL + _url = "/indexes" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_stop_session_request(agent_name: str, session_id: str, **kwargs: Any) -> HttpRequest: +def build_indexes_get_request(name: str, version: 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", "v1")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/agents/{agent_name}/endpoint/sessions/{session_id}:stop" + _url = "/indexes/{name}/versions/{version}" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "session_id": _SERIALIZER.url("session_id", session_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -990,67 +1154,44 @@ def build_beta_agents_stop_session_request(agent_name: str, session_id: str, **k # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_list_sessions_request( - agent_name: str, - *, - user_isolation_key: Optional[str] = None, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + +def build_indexes_delete_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/agents/{agent_name}/endpoint/sessions" + _url = "/indexes/{name}/versions/{version}" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if limit is not None: - _params["limit"] = _SERIALIZER.query("limit", limit, "int") - if order is not None: - _params["order"] = _SERIALIZER.query("order", order, "str") - if after is not None: - _params["after"] = _SERIALIZER.query("after", after, "str") - if before is not None: - _params["before"] = _SERIALIZER.query("before", before, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_agents_get_session_log_stream_request( # pylint: disable=name-too-long - agent_name: str, agent_version: str, session_id: str, **kwargs: Any -) -> HttpRequest: +def build_indexes_create_or_update_request(name: str, version: 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", "v1")) - accept = _headers.pop("Accept", "text/event-stream") + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/versions/{agent_version}/sessions/{session_id}:logstream" + _url = "/indexes/{name}/versions/{version}" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "agent_version": _SERIALIZER.url("agent_version", agent_version, "str"), - "session_id": _SERIALIZER.url("session_id", session_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1059,79 +1200,66 @@ def build_beta_agents_get_session_log_stream_request( # pylint: disable=name-to _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_upload_session_file_request( # pylint: disable=name-too-long - agent_name: str, agent_session_id: str, *, path: str, user_isolation_key: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_toolboxes_create_version_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content" + _url = "/toolboxes/{name}/versions" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "agent_session_id": _SERIALIZER.url("agent_session_id", agent_session_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["path"] = _SERIALIZER.query("path", path, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_download_session_file_request( # pylint: disable=name-too-long - agent_name: str, agent_session_id: str, *, path: str, user_isolation_key: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_toolboxes_get_request(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", "v1")) - accept = _headers.pop("Accept", "application/octet-stream") + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content" + _url = "/toolboxes/{name}" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "agent_session_id": _SERIALIZER.url("agent_session_id", agent_session_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["path"] = _SERIALIZER.query("path", path, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_list_session_files_request( # pylint: disable=name-too-long - agent_name: str, - agent_session_id: str, +def build_toolboxes_list_request( *, - path: Optional[str] = None, - user_isolation_key: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, after: Optional[str] = None, @@ -1145,17 +1273,9 @@ def build_beta_agents_list_session_files_request( # pylint: disable=name-too-lo accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files" - path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "agent_session_id": _SERIALIZER.url("agent_session_id", agent_session_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/toolboxes" # Construct parameters - if path is not None: - _params["path"] = _SERIALIZER.query("path", path, "str") if limit is not None: _params["limit"] = _SERIALIZER.query("limit", limit, "int") if order is not None: @@ -1167,77 +1287,52 @@ def build_beta_agents_list_session_files_request( # pylint: disable=name-too-lo _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_delete_session_file_request( # pylint: disable=name-too-long - agent_name: str, - agent_session_id: str, +def build_toolboxes_list_versions_request( + name: str, *, - path: str, - recursive: Optional[bool] = None, - user_isolation_key: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, **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", "v1")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files" + _url = "/toolboxes/{name}/versions" path_format_arguments = { - "agent_name": _SERIALIZER.url("agent_name", agent_name, "str"), - "agent_session_id": _SERIALIZER.url("agent_session_id", agent_session_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["path"] = _SERIALIZER.query("path", path, "str") - if recursive is not None: - _params["recursive"] = _SERIALIZER.query("recursive", recursive, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if user_isolation_key is not None: - _headers["x-ms-user-isolation-key"] = _SERIALIZER.header("user_isolation_key", user_isolation_key, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_beta_agents_create_optimization_job_request( # pylint: disable=name-too-long - *, operation_id: Optional[str] = None, **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", "v1")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/agent_optimization_jobs" - - # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if operation_id is not None: - _headers["Operation-Id"] = _SERIALIZER.header("operation_id", operation_id, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_get_optimization_job_request( # pylint: disable=name-too-long - job_id: str, **kwargs: Any -) -> HttpRequest: +def build_toolboxes_get_version_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1245,9 +1340,10 @@ def build_beta_agents_get_optimization_job_request( # pylint: disable=name-too- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agent_optimization_jobs/{jobId}" + _url = "/toolboxes/{name}/versions/{version}" path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1261,59 +1357,41 @@ def build_beta_agents_get_optimization_job_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_list_optimization_jobs_request( # pylint: disable=name-too-long - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, - status: Optional[Union[str, _models.JobStatus]] = None, - agent_name: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: +def build_toolboxes_update_request(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", "v1")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/agent_optimization_jobs" + _url = "/toolboxes/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if limit is not None: - _params["limit"] = _SERIALIZER.query("limit", limit, "int") - if order is not None: - _params["order"] = _SERIALIZER.query("order", order, "str") - if after is not None: - _params["after"] = _SERIALIZER.query("after", after, "str") - if before is not None: - _params["before"] = _SERIALIZER.query("before", before, "str") - if status is not None: - _params["status"] = _SERIALIZER.query("status", status, "str") - if agent_name is not None: - _params["agent_name"] = _SERIALIZER.query("agent_name", agent_name, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_agents_cancel_optimization_job_request( # pylint: disable=name-too-long - job_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) +def build_toolboxes_delete_request(name: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - accept = _headers.pop("Accept", "application/json") - # Construct URL - _url = "/agent_optimization_jobs/{jobId}:cancel" + _url = "/toolboxes/{name}" path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1321,22 +1399,18 @@ def build_beta_agents_cancel_optimization_job_request( # pylint: disable=name-t # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_agents_delete_optimization_job_request( # pylint: disable=name-too-long - job_id: str, **kwargs: Any -) -> HttpRequest: +def build_toolboxes_delete_version_request(name: str, version: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) # Construct URL - _url = "/agent_optimization_jobs/{jobId}" + _url = "/toolboxes/{name}/versions/{version}" path_format_arguments = { - "jobId": _SERIALIZER.url("job_id", job_id, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2953,36 +3027,7 @@ def build_beta_schedules_list_runs_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_create_version_request( # pylint: disable=name-too-long - 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", "v1")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/toolboxes/{name}/versions" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_beta_toolboxes_get_request(name: str, **kwargs: Any) -> HttpRequest: +def build_beta_skills_get_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2990,7 +3035,7 @@ def build_beta_toolboxes_get_request(name: str, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/toolboxes/{name}" + _url = "/skills/{name}" path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), } @@ -3006,7 +3051,7 @@ def build_beta_toolboxes_get_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_toolboxes_list_request( +def build_beta_skills_list_request( *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, @@ -3021,196 +3066,7 @@ def build_beta_toolboxes_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/toolboxes" - - # Construct parameters - if limit is not None: - _params["limit"] = _SERIALIZER.query("limit", limit, "int") - if order is not None: - _params["order"] = _SERIALIZER.query("order", order, "str") - if after is not None: - _params["after"] = _SERIALIZER.query("after", after, "str") - if before is not None: - _params["before"] = _SERIALIZER.query("before", before, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_beta_toolboxes_list_versions_request( # pylint: disable=name-too-long - name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, - **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", "v1")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/toolboxes/{name}/versions" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if limit is not None: - _params["limit"] = _SERIALIZER.query("limit", limit, "int") - if order is not None: - _params["order"] = _SERIALIZER.query("order", order, "str") - if after is not None: - _params["after"] = _SERIALIZER.query("after", after, "str") - if before is not None: - _params["before"] = _SERIALIZER.query("before", before, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_beta_toolboxes_get_version_request(name: str, version: 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", "v1")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/toolboxes/{name}/versions/{version}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_beta_toolboxes_update_request(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", "v1")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/toolboxes/{name}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_beta_toolboxes_delete_request(name: str, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - # Construct URL - _url = "/toolboxes/{name}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_beta_toolboxes_delete_version_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) - # Construct URL - _url = "/toolboxes/{name}/versions/{version}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "version": _SERIALIZER.url("version", version, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_beta_skills_get_request(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", "v1")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/skills/{name}" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_beta_skills_list_request( - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - after: Optional[str] = None, - before: Optional[str] = None, - **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", "v1")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/skills" + _url = "/skills" # Construct parameters if limit is not None: @@ -3606,63 +3462,200 @@ def build_beta_datasets_delete_generation_job_request( # pylint: disable=name-t return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -class BetaOperations: # pylint: disable=too-many-instance-attributes - """ - .. warning:: - **DO NOT** instantiate this class directly. +def build_beta_agents_create_optimization_job_request( # pylint: disable=name-too-long + *, operation_id: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`beta` attribute. - """ + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + # Construct URL + _url = "/agent_optimization_jobs" - self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.evaluation_taxonomies = BetaEvaluationTaxonomiesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.evaluators = BetaEvaluatorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.insights = BetaInsightsOperations(self._client, self._config, self._serialize, self._deserialize) - self.memory_stores = BetaMemoryStoresOperations(self._client, self._config, self._serialize, self._deserialize) - self.models = BetaModelsOperations(self._client, self._config, self._serialize, self._deserialize) - self.red_teams = BetaRedTeamsOperations(self._client, self._config, self._serialize, self._deserialize) - self.routines = BetaRoutinesOperations(self._client, self._config, self._serialize, self._deserialize) - self.schedules = BetaSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.toolboxes = BetaToolboxesOperations(self._client, self._config, self._serialize, self._deserialize) - self.skills = BetaSkillsOperations(self._client, self._config, self._serialize, self._deserialize) - self.datasets = BetaDatasetsOperations(self._client, self._config, self._serialize, self._deserialize) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + # Construct headers + if operation_id is not None: + _headers["Operation-Id"] = _SERIALIZER.header("operation_id", operation_id, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") -class AgentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`agents` attribute. - """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") +def build_beta_agents_get_optimization_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @distributed_trace - def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: - """Get an agent. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + accept = _headers.pop("Accept", "application/json") - Retrieves an agent definition by its unique name. + # Construct URL + _url = "/agent_optimization_jobs/{jobId}" + path_format_arguments = { + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } - :param agent_name: The name of the agent to retrieve. Required. + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_agents_list_optimization_jobs_request( # pylint: disable=name-too-long + *, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + after: Optional[str] = None, + before: Optional[str] = None, + status: Optional[Union[str, _models.JobStatus]] = None, + agent_name: Optional[str] = None, + **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", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/agent_optimization_jobs" + + # Construct parameters + if limit is not None: + _params["limit"] = _SERIALIZER.query("limit", limit, "int") + if order is not None: + _params["order"] = _SERIALIZER.query("order", order, "str") + if after is not None: + _params["after"] = _SERIALIZER.query("after", after, "str") + if before is not None: + _params["before"] = _SERIALIZER.query("before", before, "str") + if status is not None: + _params["status"] = _SERIALIZER.query("status", status, "str") + if agent_name is not None: + _params["agent_name"] = _SERIALIZER.query("agent_name", agent_name, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_agents_cancel_optimization_job_request( # pylint: disable=name-too-long + job_id: 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", "v1")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/agent_optimization_jobs/{jobId}:cancel" + path_format_arguments = { + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_beta_agents_delete_optimization_job_request( # pylint: disable=name-too-long + job_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "v1")) + # Construct URL + _url = "/agent_optimization_jobs/{jobId}" + path_format_arguments = { + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +class BetaOperations: # pylint: disable=too-many-instance-attributes + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`beta` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.evaluation_taxonomies = BetaEvaluationTaxonomiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.evaluators = BetaEvaluatorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.insights = BetaInsightsOperations(self._client, self._config, self._serialize, self._deserialize) + self.memory_stores = BetaMemoryStoresOperations(self._client, self._config, self._serialize, self._deserialize) + self.models = BetaModelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.red_teams = BetaRedTeamsOperations(self._client, self._config, self._serialize, self._deserialize) + self.routines = BetaRoutinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.schedules = BetaSchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.skills = BetaSkillsOperations(self._client, self._config, self._serialize, self._deserialize) + self.datasets = BetaDatasetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.agents = BetaAgentsOperations(self._client, self._config, self._serialize, self._deserialize) + + +class AgentsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`agents` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: + """Get an agent. + + Retrieves an agent definition by its unique name. + + :param agent_name: The name of the agent to retrieve. Required. :type agent_name: str :return: AgentDetails. The AgentDetails is compatible with MutableMapping :rtype: ~azure.ai.projects.models.AgentDetails @@ -4570,97 +4563,98 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) + @overload + def patch_agent_details( + self, + agent_name: str, + *, + content_type: str = "application/merge-patch+json", + agent_endpoint: Optional[_models.AgentEndpointConfig] = None, + agent_card: Optional[_models.AgentCard] = None, + **kwargs: Any + ) -> _models.AgentDetails: + """Update an agent endpoint. -class EvaluationRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`evaluation_rules` attribute. - """ + Applies a merge-patch update to the specified agent endpoint configuration. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. + :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :keyword agent_card: Optional agent card for the agent. Default value is None. + :paramtype agent_card: ~azure.ai.projects.models.AgentCard + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ - @distributed_trace - def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: - """Get an evaluation rule. + @overload + def patch_agent_details( + self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.AgentDetails: + """Update an agent endpoint. - Retrieves the specified evaluation rule and its configuration. + Applies a merge-patch update to the specified agent endpoint configuration. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + @overload + def patch_agent_details( + self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.AgentDetails: + """Update an agent endpoint. - cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + Applies a merge-patch update to the specified agent endpoint configuration. - _request = build_evaluation_rules_get_request( - id=id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def delete(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete an evaluation rule. + def patch_agent_details( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + agent_endpoint: Optional[_models.AgentEndpointConfig] = None, + agent_card: Optional[_models.AgentCard] = None, + **kwargs: Any + ) -> _models.AgentDetails: + """Update an agent endpoint. - Removes the specified evaluation rule from the project. + Applies a merge-patch update to the specified agent endpoint configuration. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :return: None - :rtype: None + :param agent_name: The name of the agent to retrieve. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. + :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :keyword agent_card: Optional agent card for the agent. Default value is None. + :paramtype agent_card: ~azure.ai.projects.models.AgentCard + :return: AgentDetails. The AgentDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4671,14 +4665,27 @@ def delete(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsisten } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) - _request = build_evaluation_rules_delete_request( - id=id, + if body is _Unset: + body = {"agent_card": agent_card, "agent_endpoint": agent_endpoint} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agents_patch_agent_details_request( + agent_name=agent_name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -4687,95 +4694,128 @@ def delete(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsisten } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) - @overload - def create_or_update( - self, id: str, evaluation_rule: _models.EvaluationRule, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentDetails, response.json()) - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Required. - :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore @overload - def create_or_update( - self, id: str, evaluation_rule: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + def create_version_from_code( + self, + agent_name: str, + content: _models.CreateAgentVersionFromCodeContent, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create an agent version from code. - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + Creates a new agent version from code. Uploads the code zip and creates a new version for an + existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` + header for integrity and dedup. The request body is multipart/form-data with a JSON metadata + part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Required. - :type evaluation_rule: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( - self, id: str, evaluation_rule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + def create_version_from_code( + self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create an agent version from code. - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + Creates a new agent version from code. Uploads the code zip and creates a new version for an + existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` + header for integrity and dedup. The request body is multipart/form-data with a JSON metadata + part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Required. - :type evaluation_rule: 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: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Required. + :type content: JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( - self, id: str, evaluation_rule: Union[_models.EvaluationRule, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationRule: - """Create or update an evaluation rule. + def create_version_from_code( + self, + agent_name: str, + content: Union[_models.CreateAgentVersionFromCodeContent, JSON], + *, + code_zip_sha256: str, + **kwargs: Any + ) -> _models.AgentVersionDetails: + """Create an agent version from code. - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + Creates a new agent version from code. Uploads the code zip and creates a new version for an + existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` + header for integrity and dedup. The request body is multipart/form-data with a JSON metadata + part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. - :param id: Unique identifier for the evaluation rule. Required. - :type id: str - :param evaluation_rule: Evaluation rule resource. Is one of the following types: - EvaluationRule, JSON, IO[bytes] Required. - :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule or JSON or IO[bytes] - :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationRule + :param agent_name: The unique name that identifies the agent. Name can be used to + retrieve/update/delete the agent. + + * Must start and end with alphanumeric characters, + * Can contain hyphens in the middle + * Must not exceed 63 characters. Required. + :type agent_name: str + :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. + :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON + :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change + detection (dedup) and integrity verification. Required. + :paramtype code_zip_sha256: str + :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4786,24 +4826,21 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(evaluation_rule, (IOBase, bytes)): - _content = evaluation_rule - else: - _content = json.dumps(evaluation_rule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _body = content.as_dict() if isinstance(content, _Model) else content + _file_fields: list[str] = ["code"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) - _request = build_evaluation_rules_create_or_update_request( - id=id, - content_type=content_type, + _request = build_agents_create_version_from_code_request( + agent_name=agent_name, + code_zip_sha256=code_zip_sha256, api_version=self._config.api_version, - content=_content, + files=_files, headers=_headers, params=_params, ) @@ -4820,19 +4857,23 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) + deserialized = _deserialize(_models.AgentVersionDetails, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4840,142 +4881,25 @@ def create_or_update( return deserialized # type: ignore @distributed_trace - def list( - self, - *, - action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, - agent_name: Optional[str] = None, - enabled: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.EvaluationRule"]: - """List evaluation rules. - - Returns the evaluation rules configured for the project, optionally filtered by action type, - agent name, or enabled state. - - :keyword action_type: Filter by the type of evaluation rule. Known values are: - "continuousEvaluation" and "humanEvaluationPreview". Default value is None. - :paramtype action_type: str or ~azure.ai.projects.models.EvaluationRuleActionType - :keyword agent_name: Filter by the agent name. Default value is None. - :paramtype agent_name: str - :keyword enabled: Filter by the enabled status. Default value is None. - :paramtype enabled: bool - :return: An iterator like instance of EvaluationRule - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.EvaluationRule]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_evaluation_rules_list_request( - action_type=action_type, - agent_name=agent_name, - enabled=enabled, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluationRule], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class ConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`connections` attribute. - """ + def download_code(self, agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any) -> Iterator[bytes]: + """Download agent code. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + Downloads the code zip for a code-based hosted agent. + Returns the previously-uploaded zip (``application/zip``). - @distributed_trace - def _get(self, name: str, **kwargs: Any) -> _models.Connection: - """Get a connection. + If ``agent_version`` is supplied, returns that version's code zip; otherwise + returns the latest version's code zip. - Retrieves the specified connection and its configuration details without including credential - values. + The SHA-256 digest of the returned bytes matches the ``content_hash`` on the + resolved version's ``code_configuration``. - :param name: The friendly name of the connection, provided by the user. Required. - :type name: str - :return: Connection. The Connection is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Connection + :param agent_name: The name of the agent. Required. + :type agent_name: str + :keyword agent_version: The version of the agent whose code zip should be downloaded. + If omitted, the latest version's code zip is returned. Default value is None. + :paramtype agent_version: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4989,10 +4913,11 @@ def _get(self, name: str, **kwargs: Any) -> _models.Connection: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_connections_get_request( - name=name, + _request = build_agents_download_code_request( + agent_name=agent_name, + agent_version=agent_version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5003,7 +4928,7 @@ def _get(self, name: str, **kwargs: Any) -> _models.Connection: _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5017,120 +4942,243 @@ def _get(self, name: str, **kwargs: Any) -> _models.Connection: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) + response_headers["x-ms-agent-version"] = self._deserialize("str", response.headers.get("x-ms-agent-version")) + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Connection, response.json()) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: - """Get a connection with credentials. + @overload + def create_session( + self, + agent_name: str, + *, + version_indicator: _models.VersionIndicator, + user_isolation_key: Optional[str] = None, + content_type: str = "application/json", + agent_session_id: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentSessionResource: + """Create a session. - Retrieves the specified connection together with its credential values. + Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - :param name: The friendly name of the connection, provided by the user. Required. - :type name: str - :return: Connection. The Connection is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Connection + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :keyword version_indicator: Determines which agent version backs the session. Required. + :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique + within the agent endpoint. Auto-generated if omitted. Default value is None. + :paramtype agent_session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.Connection] = kwargs.pop("cls", None) + @overload + def create_session( + self, + agent_name: str, + body: JSON, + *, + user_isolation_key: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentSessionResource: + """Create a session. - _request = build_connections_get_with_credentials_request( - name=name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :param body: Required. + :type body: JSON + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_session( + self, + agent_name: str, + body: IO[bytes], + *, + user_isolation_key: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AgentSessionResource: + """Create a session. + + Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. + + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :param body: Required. + :type body: IO[bytes] + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_session( + self, + agent_name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + version_indicator: _models.VersionIndicator = _Unset, + user_isolation_key: Optional[str] = None, + agent_session_id: Optional[str] = None, + **kwargs: Any + ) -> _models.AgentSessionResource: + """Create a session. + + Creates a new session for an agent endpoint. The endpoint resolves the backing agent version + from ``version_indicator`` and enforces session ownership using the provided isolation key for + session-mutating operations. + + :param agent_name: The name of the agent to create a session for. Required. + :type agent_name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword version_indicator: Determines which agent version backs the session. Required. + :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique + within the agent endpoint. Auto-generated if omitted. Default value is None. + :paramtype agent_session_id: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + + if body is _Unset: + if version_indicator is _Unset: + raise TypeError("missing required argument: version_indicator") + body = {"agent_session_id": agent_session_id, "version_indicator": version_indicator} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agents_create_session_request( + agent_name=agent_name, + user_isolation_key=user_isolation_key, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Connection, response.json()) + deserialized = _deserialize(_models.AgentSessionResource, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def list( - self, - *, - connection_type: Optional[Union[str, _models.ConnectionType]] = None, - default_connection: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Connection"]: - """List connections. + def get_session( + self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any + ) -> _models.AgentSessionResource: + """Get a session. - Returns the connections available in the current project, optionally filtered by type or - default status. + Retrieves the details of a hosted agent session by agent name and session identifier. - :keyword connection_type: Lists connections of this specific type. Known values are: - "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", - "AppConfig", "AppInsights", "CustomKeys", and "RemoteTool_Preview". Default value is None. - :paramtype connection_type: str or ~azure.ai.projects.models.ConnectionType - :keyword default_connection: Lists connections that are default connections. Default value is - None. - :paramtype default_connection: bool - :return: An iterator like instance of Connection - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Connection] + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session identifier. Required. + :type session_id: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5139,110 +5187,136 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_connections_list_request( - connection_type=connection_type, - default_connection=default_connection, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_agents_get_session_request( + agent_name=agent_name, + session_id=session_id, + user_isolation_key=user_isolation_key, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Connection], - deserialized.get("value", []), + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + raise HttpResponseError(response=response, model=error) - def get_next(next_link=None): - _request = prepare_request(next_link) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentSessionResource, response.json()) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + return deserialized # type: ignore - return pipeline_response + @distributed_trace + def delete_session( # pylint: disable=inconsistent-return-statements + self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any + ) -> None: + """Delete a session. - return ItemPaged(get_next, extract_data) + Deletes a session synchronously. Returns 204 No Content when the session is deleted or does not + exist. + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session identifier. Required. + :type session_id: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) -class DatasetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`datasets` attribute. - """ + cls: ClsType[None] = kwargs.pop("cls", None) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + _request = build_agents_delete_session_request( + agent_name=agent_name, + session_id=session_id, + user_isolation_key=user_isolation_key, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: - """List versions. + def stop_session( # pylint: disable=inconsistent-return-statements + self, agent_name: str, session_id: str, **kwargs: Any + ) -> None: + """Stop a session. - List all versions of the given DatasetVersion. + Terminates the specified hosted agent session and returns 204 No Content when the request + succeeds. - :param name: The name of the resource. Required. - :type name: str - :return: An iterator like instance of DatasetVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session identifier. Required. + :type session_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5251,88 +5325,83 @@ def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.DatasetV } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_datasets_list_versions_request( - name=name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[None] = kwargs.pop("cls", None) - return _request + _request = build_agents_stop_session_request( + agent_name=agent_name, + session_id=session_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.DatasetVersion], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response + raise HttpResponseError(response=response, model=error) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: - """List latest versions. + def list_sessions( + self, + agent_name: str, + *, + user_isolation_key: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.AgentSessionResource"]: + """List sessions for an agent. - List the latest version of each DatasetVersion. + Returns a paged collection of sessions associated with the specified agent endpoint. - :return: An iterator like instance of DatasetVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] + :param agent_name: The name of the agent. Required. + :type agent_name: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of AgentSessionResource + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentSessionResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5342,58 +5411,37 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_datasets_list_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + def prepare_request(_continuation_token=None): + _request = build_agents_list_sessions_request( + agent_name=agent_name, + user_isolation_key=user_isolation_key, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) return _request def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.DatasetVersion], - deserialized.get("value", []), + List[_models.AgentSessionResource], + deserialized.get("data", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + return deserialized.get("last_id") or None, iter(list_of_elem) - def get_next(next_link=None): - _request = prepare_request(next_link) + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access @@ -5403,25 +5451,57 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) return pipeline_response return ItemPaged(get_next, extract_data) @distributed_trace - def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: - """Get a version. + def get_session_log_stream( + self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any + ) -> _models.SessionLogEvent: + """Stream console logs for a hosted agent session. - Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the - DatasetVersion does not exist. + Streams console logs (stdout / stderr) for a specific hosted agent session + as a Server-Sent Events (SSE) stream. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to retrieve. Required. - :type version: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion + Each SSE frame contains: + + * `event`: always `"log"` + * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) + + Example SSE frames: + + .. code-block:: + + event: log + data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} + + event: log + data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} + + event: log + data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} + + event: log + data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} + + The stream remains open until the client disconnects or the server + terminates the connection. Clients should handle reconnection as needed. + + :param agent_name: The name of the hosted agent. Required. + :type agent_name: str + :param agent_version: The version of the agent. Required. + :type agent_version: str + :param session_id: The session ID (maps to an ADC sandbox). Required. + :type session_id: str + :return: SessionLogEvent. The SessionLogEvent is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionLogEvent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5435,11 +5515,12 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) + cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) - _request = build_datasets_get_request( - name=name, - version=version, + _request = build_agents_get_session_log_stream_request( + agent_name=agent_name, + agent_version=agent_version, + session_id=session_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5450,7 +5531,7 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -5464,31 +5545,55 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) + deserialized = _deserialize(_models.SessionLogEvent, response.text()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete a version. + def _upload_session_file( + self, + agent_name: str, + agent_session_id: str, + content: bytes, + *, + path: str, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> _models.SessionFileWriteResult: + """Upload a session file. - Delete the specific version of the DatasetVersion. The service returns 204 No Content if the - DatasetVersion was deleted successfully or if the DatasetVersion does not exist. + Uploads binary file content to the specified path in the session sandbox. The service stores + the file relative to the session home directory and rejects payloads larger than 50 MB. - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the DatasetVersion to delete. Required. - :type version: str - :return: None - :rtype: None + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :param content: Required. + :type content: bytes + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5499,15 +5604,22 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[_models.SessionFileWriteResult] = kwargs.pop("cls", None) - _request = build_datasets_delete_request( - name=name, - version=version, + _content = content + + _request = build_agents_upload_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -5516,150 +5628,85 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SessionFileWriteResult, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - @overload - def create_or_update( + return deserialized # type: ignore + + @distributed_trace + def download_session_file( self, - name: str, - version: str, - dataset_version: _models.DatasetVersion, + agent_name: str, + agent_session_id: str, *, - content_type: str = "application/merge-patch+json", + path: str, + user_isolation_key: Optional[str] = None, **kwargs: Any - ) -> _models.DatasetVersion: - """Create or update a version. + ) -> Iterator[bytes]: + """Download a session file. - Create a new or update an existing DatasetVersion with the given version id. + Downloads the file at the specified sandbox path as a binary stream. The path is resolved + relative to the session home directory. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Required. - :type dataset_version: ~azure.ai.projects.models.DatasetVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The file path to download from the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def create_or_update( - self, - name: str, - version: str, - dataset_version: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.DatasetVersion: - """Create or update a version. - - Create a new or update an existing DatasetVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Required. - :type dataset_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - name: str, - version: str, - dataset_version: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.DatasetVersion: - """Create or update a version. - - Create a new or update an existing DatasetVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Required. - :type dataset_version: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, name: str, version: str, dataset_version: Union[_models.DatasetVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DatasetVersion: - """Create or update a version. - - Create a new or update an existing DatasetVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to create or update. Required. - :type version: str - :param dataset_version: The DatasetVersion to create or update. Is one of the following types: - DatasetVersion, JSON, IO[bytes] Required. - :type dataset_version: ~azure.ai.projects.models.DatasetVersion or JSON or IO[bytes] - :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) - - content_type = content_type or "application/merge-patch+json" - _content = None - if isinstance(dataset_version, (IOBase, bytes)): - _content = dataset_version - else: - _content = json.dumps(dataset_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_datasets_create_or_update_request( - name=name, - version=version, - content_type=content_type, + _request = build_agents_download_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -5669,140 +5716,85 @@ def create_or_update( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: _models.PendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResponse: - """Start a pending upload. - - Initiates a new pending upload or retrieves an existing one for the specified dataset version. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Required. - :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResponse: - """Start a pending upload. - - Initiates a new pending upload or retrieves an existing one for the specified dataset version. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Required. - :type pending_upload_request: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def pending_upload( + @distributed_trace + def list_session_files( self, - name: str, - version: str, - pending_upload_request: IO[bytes], + agent_name: str, + agent_session_id: str, *, - content_type: str = "application/json", + path: Optional[str] = None, + user_isolation_key: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> _models.PendingUploadResponse: - """Start a pending upload. + ) -> ItemPaged["_models.SessionDirectoryEntry"]: + """List session files. - Initiates a new pending upload or retrieves an existing one for the specified dataset version. + Returns files and directories at the specified path in the session sandbox. The response + includes only the immediate children of the target directory and defaults to the session home + directory when no path is supplied. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Required. - :type pending_upload_request: 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: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResponse + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The directory path to list, relative to the session home directory. Defaults to + the home directory if not provided. Default value is None. + :paramtype path: str + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of SessionDirectoryEntry + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.SessionDirectoryEntry] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @distributed_trace - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.PendingUploadResponse: - """Start a pending upload. - - Initiates a new pending upload or retrieves an existing one for the specified dataset version. + cls: ClsType[List[_models.SessionDirectoryEntry]] = kwargs.pop("cls", None) - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :param pending_upload_request: The pending upload request parameters. Is one of the following - types: PendingUploadRequest, JSON, IO[bytes] Required. - :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or - IO[bytes] - :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.PendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5811,72 +5803,89 @@ def pending_upload( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PendingUploadResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(pending_upload_request, (IOBase, bytes)): - _content = pending_upload_request - else: - _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + def prepare_request(_continuation_token=None): - _request = build_datasets_pending_upload_request( - name=name, - version=version, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_agents_list_session_files_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + user_isolation_key=user_isolation_key, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SessionDirectoryEntry], + deserialized.get("entries", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.PendingUploadResponse, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.DatasetCredential: - """Get dataset credentials. + def delete_session_file( # pylint: disable=inconsistent-return-statements + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + recursive: Optional[bool] = None, + user_isolation_key: Optional[str] = None, + **kwargs: Any + ) -> None: + """Delete a session file. - Gets the SAS credential to access the storage account associated with a Dataset version. + Deletes the specified file or directory from the session sandbox. When ``recursive`` is false, + deleting a non-empty directory returns 409 Conflict. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the DatasetVersion to operate on. Required. - :type version: str - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param agent_session_id: The session ID. Required. + :type agent_session_id: str + :keyword path: The file or directory path to delete, relative to the session home directory. + Required. + :paramtype path: str + :keyword recursive: Whether to recursively delete directory contents. The service defaults to + ``false`` if a value is not specified by the caller. Default value is None. + :paramtype recursive: bool + :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data + (responses, conversations, sessions) to a specific end user. Default value is None. + :paramtype user_isolation_key: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5890,11 +5899,14 @@ def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.Dat _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_datasets_get_credentials_request( - name=name, - version=version, + _request = build_agents_delete_session_file_request( + agent_name=agent_name, + agent_session_id=agent_session_id, + path=path, + recursive=recursive, + user_isolation_key=user_isolation_key, api_version=self._config.api_version, headers=_headers, params=_params, @@ -5904,42 +5916,33 @@ def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.Dat } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DatasetCredential, response.json()) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore -class DeploymentsOperations: +class EvaluationRulesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`deployments` attribute. + :attr:`evaluation_rules` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -5950,15 +5953,15 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.Deployment: - """Get a deployment. + def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: + """Get an evaluation rule. - Gets a deployed model. + Retrieves the specified evaluation rule and its configuration. - :param name: Name of the deployment. Required. - :type name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Deployment + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5972,10 +5975,10 @@ def get(self, name: str, **kwargs: Any) -> _models.Deployment: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) - _request = build_deployments_get_request( - name=name, + _request = build_evaluation_rules_get_request( + id=id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6002,52 +6005,28 @@ def get(self, name: str, **kwargs: Any) -> _models.Deployment: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - response_headers = {} - response_headers["x-ms-client-request-id"] = self._deserialize( - "str", response.headers.get("x-ms-client-request-id") - ) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Deployment, response.json()) + deserialized = _deserialize(_models.EvaluationRule, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def list( - self, - *, - model_publisher: Optional[str] = None, - model_name: Optional[str] = None, - deployment_type: Optional[Union[str, _models.DeploymentType]] = None, - **kwargs: Any - ) -> ItemPaged["_models.Deployment"]: - """List deployments. + def delete(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete an evaluation rule. - Returns the deployed models available in the current project, optionally filtered by publisher, - model name, or deployment type. + Removes the specified evaluation rule from the project. - :keyword model_publisher: Model publisher to filter models by. Default value is None. - :paramtype model_publisher: str - :keyword model_name: Model name (the publisher specific name) to filter models by. Default - value is None. - :paramtype model_name: str - :keyword deployment_type: Type of deployment to filter list by. "ModelDeployment" Default value - is None. - :paramtype deployment_type: str or ~azure.ai.projects.models.DeploymentType - :return: An iterator like instance of Deployment - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Deployment] + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6056,110 +6035,203 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_deployments_list_request( - model_publisher=model_publisher, - model_name=model_name, - deployment_type=deployment_type, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[None] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_evaluation_rules_delete_request( + id=id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Deployment], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + response = pipeline_response.http_response - def get_next(next_link=None): - _request = prepare_request(next_link) + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if cls: + return cls(pipeline_response, None, {}) # type: ignore - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + @overload + def create_or_update( + self, id: str, evaluation_rule: _models.EvaluationRule, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. - return pipeline_response + Creates a new evaluation rule, or replaces the existing rule when the identifier matches. - return ItemPaged(get_next, extract_data) + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Required. + :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + def create_or_update( + self, id: str, evaluation_rule: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. -class IndexesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + Creates a new evaluation rule, or replaces the existing rule when the identifier matches. - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`indexes` attribute. - """ + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Required. + :type evaluation_rule: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def create_or_update( + self, id: str, evaluation_rule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. + + Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Required. + :type evaluation_rule: 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: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.Index"]: - """List versions. + def create_or_update( + self, id: str, evaluation_rule: Union[_models.EvaluationRule, JSON, IO[bytes]], **kwargs: Any + ) -> _models.EvaluationRule: + """Create or update an evaluation rule. - List all versions of the given Index. + Creates a new evaluation rule, or replaces the existing rule when the identifier matches. - :param name: The name of the resource. Required. - :type name: str - :return: An iterator like instance of Index - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] + :param id: Unique identifier for the evaluation rule. Required. + :type id: str + :param evaluation_rule: Evaluation rule resource. Is one of the following types: + EvaluationRule, JSON, IO[bytes] Required. + :type evaluation_rule: ~azure.ai.projects.models.EvaluationRule or JSON or IO[bytes] + :return: EvaluationRule. The EvaluationRule is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.EvaluationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(evaluation_rule, (IOBase, bytes)): + _content = evaluation_rule + else: + _content = json.dumps(evaluation_rule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_evaluation_rules_create_or_update_request( + id=id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluationRule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + *, + action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, + agent_name: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.EvaluationRule"]: + """List evaluation rules. + + Returns the evaluation rules configured for the project, optionally filtered by action type, + agent name, or enabled state. + + :keyword action_type: Filter by the type of evaluation rule. Known values are: + "continuousEvaluation" and "humanEvaluationPreview". Default value is None. + :paramtype action_type: str or ~azure.ai.projects.models.EvaluationRuleActionType + :keyword agent_name: Filter by the agent name. Default value is None. + :paramtype agent_name: str + :keyword enabled: Filter by the enabled status. Default value is None. + :paramtype enabled: bool + :return: An iterator like instance of EvaluationRule + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationRule] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.EvaluationRule]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6172,8 +6244,10 @@ def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.Index"]: def prepare_request(next_link=None): if not next_link: - _request = build_indexes_list_versions_request( - name=name, + _request = build_evaluation_rules_list_request( + action_type=action_type, + agent_name=agent_name, + enabled=enabled, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6213,7 +6287,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.Index], + List[_models.EvaluationRule], deserialized.get("value", []), ) if cls: @@ -6237,109 +6311,35 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Index"]: - """List latest versions. - - List the latest version of each Index. - :return: An iterator like instance of Index - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} +class ConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`connections` attribute. + """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_indexes_list_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", - urllib.parse.urljoin(next_link, _parsed_next_link.path), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Index], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: - """Get a version. + def _get(self, name: str, **kwargs: Any) -> _models.Connection: + """Get a connection. - Get the specific version of the Index. The service returns 404 Not Found error if the Index - does not exist. + Retrieves the specified connection and its configuration details without including credential + values. - :param name: The name of the resource. Required. + :param name: The friendly name of the connection, provided by the user. Required. :type name: str - :param version: The specific version id of the Index to retrieve. Required. - :type version: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6353,11 +6353,10 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Index] = kwargs.pop("cls", None) + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) - _request = build_indexes_get_request( + _request = build_connections_get_request( name=name, - version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6384,29 +6383,31 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Index, response.json()) + deserialized = _deserialize(_models.Connection, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete a version. + def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: + """Get a connection with credentials. - Delete the specific version of the Index. The service returns 204 No Content if the Index was - deleted successfully or if the Index does not exist. + Retrieves the specified connection together with its credential values. - :param name: The name of the resource. Required. + :param name: The friendly name of the connection, provided by the user. Required. :type name: str - :param version: The version of the Index to delete. Required. - :type version: str - :return: None - :rtype: None + :return: Connection. The Connection is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Connection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6420,11 +6421,10 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Connection] = kwargs.pop("cls", None) - _request = build_indexes_delete_request( + _request = build_connections_get_with_credentials_request( name=name, - version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6434,117 +6434,67 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - name: str, - version: str, - index: _models.Index, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.Index: - """Create or update a version. - - Create a new or update an existing Index with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the Index to create or update. Required. - :type version: str - :param index: The Index to create or update. Required. - :type index: ~azure.ai.projects.models.Index - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index - :raises ~azure.core.exceptions.HttpResponseError: - """ + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) - @overload - def create_or_update( - self, name: str, version: str, index: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.Index: - """Create or update a version. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Connection, response.json()) - Create a new or update an existing Index with the given version id. + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the Index to create or update. Required. - :type version: str - :param index: The Index to create or update. Required. - :type index: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore - @overload - def create_or_update( + @distributed_trace + def list( self, - name: str, - version: str, - index: IO[bytes], *, - content_type: str = "application/merge-patch+json", + connection_type: Optional[Union[str, _models.ConnectionType]] = None, + default_connection: Optional[bool] = None, **kwargs: Any - ) -> _models.Index: - """Create or update a version. + ) -> ItemPaged["_models.Connection"]: + """List connections. - Create a new or update an existing Index with the given version id. + Returns the connections available in the current project, optionally filtered by type or + default status. - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the Index to create or update. Required. - :type version: str - :param index: The Index to create or update. Required. - :type index: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index + :keyword connection_type: Lists connections of this specific type. Known values are: + "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", + "AppConfig", "AppInsights", "CustomKeys", and "RemoteTool_Preview". Default value is None. + :paramtype connection_type: str or ~azure.ai.projects.models.ConnectionType + :keyword default_connection: Lists connections that are default connections. Default value is + None. + :paramtype default_connection: bool + :return: An iterator like instance of Connection + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Connection] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @distributed_trace - def create_or_update( - self, name: str, version: str, index: Union[_models.Index, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Index: - """Create or update a version. - - Create a new or update an existing Index with the given version id. + cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the Index to create or update. Required. - :type version: str - :param index: The Index to create or update. Is one of the following types: Index, JSON, - IO[bytes] Required. - :type index: ~azure.ai.projects.models.Index or JSON or IO[bytes] - :return: Index. The Index is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Index - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6553,69 +6503,84 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Index] = kwargs.pop("cls", None) + _request = build_connections_list_request( + connection_type=connection_type, + default_connection=default_connection, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/merge-patch+json" - _content = None - if isinstance(index, (IOBase, bytes)): - _content = index - else: - _content = json.dumps(index, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_indexes_create_or_update_request( - name=name, - version=version, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Connection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Index, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) -class BetaAgentsOperations: +class DatasetsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`agents` attribute. + :attr:`datasets` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -6625,100 +6590,23 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @overload - def patch_agent_details( - self, - agent_name: str, - *, - content_type: str = "application/merge-patch+json", - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, - **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. - - Applies a merge-patch update to the specified agent endpoint configuration. - - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig - :keyword agent_card: Optional agent card for the agent. Default value is None. - :paramtype agent_card: ~azure.ai.projects.models.AgentCard - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def patch_agent_details( - self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. - - Applies a merge-patch update to the specified agent endpoint configuration. - - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def patch_agent_details( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. + @distributed_trace + def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: + """List versions. - Applies a merge-patch update to the specified agent endpoint configuration. + List all versions of the given DatasetVersion. - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails + :param name: The name of the resource. Required. + :type name: str + :return: An iterator like instance of DatasetVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @distributed_trace - def patch_agent_details( - self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, - **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. - - Applies a merge-patch update to the specified agent endpoint configuration. + cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) - :param agent_name: The name of the agent to retrieve. Required. - :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig - :keyword agent_card: Optional agent card for the agent. Default value is None. - :paramtype agent_card: ~azure.ai.projects.models.AgentCard - :return: AgentDetails. The AgentDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6727,157 +6615,177 @@ def patch_agent_details( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + _request = build_datasets_list_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if body is _Unset: - body = {"agent_card": agent_card, "agent_endpoint": agent_endpoint} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/merge-patch+json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_agents_patch_agent_details_request( - agent_name=agent_name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DatasetVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentDetails, response.json()) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - return deserialized # type: ignore + return pipeline_response - @overload - def create_version_from_code( - self, - agent_name: str, - content: _models.CreateAgentVersionFromCodeContent, - *, - code_zip_sha256: str, - **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version from code. + return ItemPaged(get_next, extract_data) - Creates a new agent version from code. Uploads the code zip and creates a new version for an - existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` - header for integrity and dedup. The request body is multipart/form-data with a JSON metadata - part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: + """List latest versions. - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + List the latest version of each DatasetVersion. - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: An iterator like instance of DatasetVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def create_version_from_code( - self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version from code. + cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) - Creates a new agent version from code. Uploads the code zip and creates a new version for an - existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` - header for integrity and dedup. The request body is multipart/form-data with a JSON metadata - part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + def prepare_request(next_link=None): + if not next_link: - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Required. - :type content: JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ + _request = build_datasets_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - @distributed_trace - def create_version_from_code( - self, - agent_name: str, - content: Union[_models.CreateAgentVersionFromCodeContent, JSON], - *, - code_zip_sha256: str, - **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version from code. + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - Creates a new agent version from code. Uploads the code zip and creates a new version for an - existing agent. The SHA-256 hex digest of the zip is provided in the ``x-ms-code-zip-sha256`` - header for integrity and dedup. The request body is multipart/form-data with a JSON metadata - part and a binary code part (part order is irrelevant). Maximum upload size is 250 MB. + return _request - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DatasetVersion], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. Required. - :type agent_name: str - :param content: Is either a CreateAgentVersionFromCodeContent type or a JSON type. Required. - :type content: ~azure.ai.projects.models.CreateAgentVersionFromCodeContent or JSON - :keyword code_zip_sha256: SHA-256 hex digest of the uploaded code zip. Used for change - detection (dedup) and integrity verification. Required. - :paramtype code_zip_sha256: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: + """Get a version. + + Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the + DatasetVersion does not exist. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to retrieve. Required. + :type version: str + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6891,18 +6799,12 @@ def create_version_from_code( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) - - _body = content.as_dict() if isinstance(content, _Model) else content - _file_fields: list[str] = ["code"] - _data_fields: list[str] = ["metadata"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) - _request = build_beta_agents_create_version_from_code_request( - agent_name=agent_name, - code_zip_sha256=code_zip_sha256, + _request = build_datasets_get_request( + name=name, + version=version, api_version=self._config.api_version, - files=_files, headers=_headers, params=_params, ) @@ -6926,16 +6828,12 @@ def create_version_from_code( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentVersionDetails, response.json()) + deserialized = _deserialize(_models.DatasetVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6943,25 +6841,18 @@ def create_version_from_code( return deserialized # type: ignore @distributed_trace - def download_code(self, agent_name: str, *, agent_version: Optional[str] = None, **kwargs: Any) -> Iterator[bytes]: - """Download agent code. + def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a version. - Downloads the code zip for a code-based hosted agent. - Returns the previously-uploaded zip (``application/zip``). + Delete the specific version of the DatasetVersion. The service returns 204 No Content if the + DatasetVersion was deleted successfully or if the DatasetVersion does not exist. - If ``agent_version`` is supplied, returns that version's code zip; otherwise - returns the latest version's code zip. - - The SHA-256 digest of the returned bytes matches the ``content_hash`` on the - resolved version's ``code_configuration``. - - :param agent_name: The name of the agent. Required. - :type agent_name: str - :keyword agent_version: The version of the agent whose code zip should be downloaded. - If omitted, the latest version's code zip is returned. Default value is None. - :paramtype agent_version: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the DatasetVersion to delete. Required. + :type version: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6975,11 +6866,11 @@ def download_code(self, agent_name: str, *, agent_version: Optional[str] = None, _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_download_code_request( - agent_name=agent_name, - agent_version=agent_version, + _request = build_datasets_delete_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -6989,166 +6880,121 @@ def download_code(self, agent_name: str, *, agent_version: Optional[str] = None, } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers["x-ms-agent-version"] = self._deserialize("str", response.headers.get("x-ms-agent-version")) - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + raise HttpResponseError(response=response) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @overload - def create_session( + def create_or_update( self, - agent_name: str, + name: str, + version: str, + dataset_version: _models.DatasetVersion, *, - version_indicator: _models.VersionIndicator, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", - agent_session_id: Optional[str] = None, + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + ) -> _models.DatasetVersion: + """Create or update a version. - Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + Create a new or update an existing DatasetVersion with the given version id. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to create or update. Required. + :type version: str + :param dataset_version: The DatasetVersion to create or update. Required. + :type dataset_version: ~azure.ai.projects.models.DatasetVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str - :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique - within the agent endpoint. Auto-generated if omitted. Default value is None. - :paramtype agent_session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_session( + def create_or_update( self, - agent_name: str, - body: JSON, + name: str, + version: str, + dataset_version: JSON, *, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + ) -> _models.DatasetVersion: + """Create or update a version. - Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + Create a new or update an existing DatasetVersion with the given version id. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Required. - :type body: JSON - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to create or update. Required. + :type version: str + :param dataset_version: The DatasetVersion to create or update. Required. + :type dataset_version: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_session( + def create_or_update( self, - agent_name: str, - body: IO[bytes], + name: str, + version: str, + dataset_version: IO[bytes], *, - user_isolation_key: Optional[str] = None, - content_type: str = "application/json", + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + ) -> _models.DatasetVersion: + """Create or update a version. - Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + Create a new or update an existing DatasetVersion with the given version id. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Required. - :type body: IO[bytes] - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to create or update. Required. + :type version: str + :param dataset_version: The DatasetVersion to create or update. Required. + :type dataset_version: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_session( - self, - agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - version_indicator: _models.VersionIndicator = _Unset, - user_isolation_key: Optional[str] = None, - agent_session_id: Optional[str] = None, - **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + def create_or_update( + self, name: str, version: str, dataset_version: Union[_models.DatasetVersion, JSON, IO[bytes]], **kwargs: Any + ) -> _models.DatasetVersion: + """Create or update a version. - Creates a new session for an agent endpoint. The endpoint resolves the backing agent version - from ``version_indicator`` and enforces session ownership using the provided isolation key for - session-mutating operations. + Create a new or update an existing DatasetVersion with the given version id. - :param agent_name: The name of the agent to create a session for. Required. - :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :keyword agent_session_id: Optional caller-provided session ID. If specified, it must be unique - within the agent endpoint. Auto-generated if omitted. Default value is None. - :paramtype agent_session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to create or update. Required. + :type version: str + :param dataset_version: The DatasetVersion to create or update. Is one of the following types: + DatasetVersion, JSON, IO[bytes] Required. + :type dataset_version: ~azure.ai.projects.models.DatasetVersion or JSON or IO[bytes] + :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7163,84 +7009,613 @@ def create_session( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(dataset_version, (IOBase, bytes)): + _content = dataset_version + else: + _content = json.dumps(dataset_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_datasets_create_or_update_request( + name=name, + version=version, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DatasetVersion, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: _models.PendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResponse: + """Start a pending upload. + + Initiates a new pending upload or retrieves an existing one for the specified dataset version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResponse: + """Start a pending upload. + + Initiates a new pending upload or retrieves an existing one for the specified dataset version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PendingUploadResponse: + """Start a pending upload. + + Initiates a new pending upload or retrieves an existing one for the specified dataset version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Required. + :type pending_upload_request: 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: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: Union[_models.PendingUploadRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PendingUploadResponse: + """Start a pending upload. + + Initiates a new pending upload or retrieves an existing one for the specified dataset version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :param pending_upload_request: The pending upload request parameters. Is one of the following + types: PendingUploadRequest, JSON, IO[bytes] Required. + :type pending_upload_request: ~azure.ai.projects.models.PendingUploadRequest or JSON or + IO[bytes] + :return: PendingUploadResponse. The PendingUploadResponse is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.PendingUploadResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PendingUploadResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(pending_upload_request, (IOBase, bytes)): + _content = pending_upload_request + else: + _content = json.dumps(pending_upload_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_datasets_pending_upload_request( + name=name, + version=version, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PendingUploadResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.DatasetCredential: + """Get dataset credentials. + + Gets the SAS credential to access the storage account associated with a Dataset version. + + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the DatasetVersion to operate on. Required. + :type version: str + :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DatasetCredential + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DatasetCredential] = kwargs.pop("cls", None) + + _request = build_datasets_get_credentials_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DatasetCredential, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DeploymentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`deployments` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, name: str, **kwargs: Any) -> _models.Deployment: + """Get a deployment. + + Gets a deployed model. + + :param name: Name of the deployment. Required. + :type name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Deployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + + _request = build_deployments_get_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["x-ms-client-request-id"] = self._deserialize( + "str", response.headers.get("x-ms-client-request-id") + ) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Deployment, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + *, + model_publisher: Optional[str] = None, + model_name: Optional[str] = None, + deployment_type: Optional[Union[str, _models.DeploymentType]] = None, + **kwargs: Any + ) -> ItemPaged["_models.Deployment"]: + """List deployments. + + Returns the deployed models available in the current project, optionally filtered by publisher, + model name, or deployment type. + + :keyword model_publisher: Model publisher to filter models by. Default value is None. + :paramtype model_publisher: str + :keyword model_name: Model name (the publisher specific name) to filter models by. Default + value is None. + :paramtype model_name: str + :keyword deployment_type: Type of deployment to filter list by. "ModelDeployment" Default value + is None. + :paramtype deployment_type: str or ~azure.ai.projects.models.DeploymentType + :return: An iterator like instance of Deployment + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_request( + model_publisher=model_publisher, + model_name=model_name, + deployment_type=deployment_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Deployment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class IndexesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`indexes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.Index"]: + """List versions. + + List all versions of the given Index. + + :param name: The name of the resource. Required. + :type name: str + :return: An iterator like instance of Index + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_indexes_list_versions_request( + name=name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if body is _Unset: - if version_indicator is _Unset: - raise TypeError("missing required argument: version_indicator") - body = {"agent_session_id": agent_session_id, "version_indicator": version_indicator} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_agents_create_session_request( - agent_name=agent_name, - user_isolation_key=user_isolation_key, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Index], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def get_session( - self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: - """Get a session. + def list(self, **kwargs: Any) -> ItemPaged["_models.Index"]: + """List latest versions. - Retrieves the details of a hosted agent session by agent name and session identifier. + List the latest version of each Index. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: An iterator like instance of Index + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7249,73 +7624,86 @@ def get_session( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + _request = build_indexes_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_beta_agents_get_session_request( - agent_name=agent_name, - session_id=session_id, - user_isolation_key=user_isolation_key, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Index], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def delete_session( # pylint: disable=inconsistent-return-statements - self, agent_name: str, session_id: str, *, user_isolation_key: Optional[str] = None, **kwargs: Any - ) -> None: - """Delete a session. + def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: + """Get a version. - Deletes a session synchronously. Returns 204 No Content when the session is deleted or does not - exist. + Get the specific version of the Index. The service returns 404 Not Found error if the Index + does not exist. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: None - :rtype: None + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to retrieve. Required. + :type version: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7329,12 +7717,11 @@ def delete_session( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Index] = kwargs.pop("cls", None) - _request = build_beta_agents_delete_session_request( - agent_name=agent_name, - session_id=session_id, - user_isolation_key=user_isolation_key, + _request = build_indexes_get_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7344,37 +7731,44 @@ def delete_session( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Index, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def stop_session( # pylint: disable=inconsistent-return-statements - self, agent_name: str, session_id: str, **kwargs: Any - ) -> None: - """Stop a session. + def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a version. - Terminates the specified hosted agent session and returns 204 No Content when the request - succeeds. + Delete the specific version of the Index. The service returns 204 No Content if the Index was + deleted successfully or if the Index does not exist. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session identifier. Required. - :type session_id: str + :param name: The name of the resource. Required. + :type name: str + :param version: The version of the Index to delete. Required. + :type version: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -7392,9 +7786,9 @@ def stop_session( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_stop_session_request( - agent_name=agent_name, - session_id=session_id, + _request = build_indexes_delete_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7413,157 +7807,106 @@ def stop_session( # pylint: disable=inconsistent-return-statements if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if cls: return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def list_sessions( + @overload + def create_or_update( self, - agent_name: str, + name: str, + version: str, + index: _models.Index, *, - user_isolation_key: Optional[str] = None, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, + content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> ItemPaged["_models.AgentSessionResource"]: - """List sessions for an agent. + ) -> _models.Index: + """Create or update a version. - Returns a paged collection of sessions associated with the specified agent endpoint. + Create a new or update an existing Index with the given version id. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of AgentSessionResource - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentSessionResource] + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Required. + :type index: ~azure.ai.projects.models.Index + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(_continuation_token=None): - - _request = build_beta_agents_list_sessions_request( - agent_name=agent_name, - user_isolation_key=user_isolation_key, - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.AgentSessionResource], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, iter(list_of_elem) + @overload + def create_or_update( + self, name: str, version: str, index: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.Index: + """Create or update a version. - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) + Create a new or update an existing Index with the given version id. - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Required. + :type index: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index + :raises ~azure.core.exceptions.HttpResponseError: + """ - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) + @overload + def create_or_update( + self, + name: str, + version: str, + index: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.Index: + """Create or update a version. - return pipeline_response + Create a new or update an existing Index with the given version id. - return ItemPaged(get_next, extract_data) + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Required. + :type index: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get_session_log_stream( - self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any - ) -> _models.SessionLogEvent: - """Stream console logs for a hosted agent session. - - Streams console logs (stdout / stderr) for a specific hosted agent session - as a Server-Sent Events (SSE) stream. - - Each SSE frame contains: - - * `event`: always `"log"` - * `data`: a plain-text log line (currently JSON-formatted, but the schema is not contractual and may include additional keys or change format over time; clients should treat it as an opaque string) - - Example SSE frames: - - .. code-block:: - - event: log - data: {"timestamp":"2026-03-10T09:33:17.121Z","stream":"stdout","message":"Starting FoundryCBAgent server on port 8088"} - - event: log - data: {"timestamp":"2026-03-10T09:33:17.130Z","stream":"stderr","message":"INFO: Application startup complete."} - - event: log - data: {"timestamp":"2026-03-10T09:34:52.714Z","stream":"status","message":"Successfully connected to container"} - - event: log - data: {"timestamp":"2026-03-10T09:35:52.714Z","stream":"status","message":"No logs since last 60 seconds"} + def create_or_update( + self, name: str, version: str, index: Union[_models.Index, JSON, IO[bytes]], **kwargs: Any + ) -> _models.Index: + """Create or update a version. - The stream remains open until the client disconnects or the server - terminates the connection. Clients should handle reconnection as needed. + Create a new or update an existing Index with the given version id. - :param agent_name: The name of the hosted agent. Required. - :type agent_name: str - :param agent_version: The version of the agent. Required. - :type agent_version: str - :param session_id: The session ID (maps to an ADC sandbox). Required. - :type session_id: str - :return: SessionLogEvent. The SessionLogEvent is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SessionLogEvent + :param name: The name of the resource. Required. + :type name: str + :param version: The specific version id of the Index to create or update. Required. + :type version: str + :param index: The Index to create or update. Is one of the following types: Index, JSON, + IO[bytes] Required. + :type index: ~azure.ai.projects.models.Index or JSON or IO[bytes] + :return: Index. The Index is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.Index :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7574,16 +7917,25 @@ def get_session_log_stream( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Index] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(index, (IOBase, bytes)): + _content = index + else: + _content = json.dumps(index, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_get_session_log_stream_request( - agent_name=agent_name, - agent_version=agent_version, - session_id=session_id, + _request = build_indexes_create_or_update_request( + name=name, + version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -7593,69 +7945,170 @@ def get_session_log_stream( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + raise HttpResponseError(response=response) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionLogEvent, response.text()) + deserialized = _deserialize(_models.Index, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + +class ToolboxesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`toolboxes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create_version( + self, + name: str, + *, + tools: List[_models.Tool], + content_type: str = "application/json", + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + skills: Optional[List[_models.ToolboxSkill]] = None, + policies: Optional[_models.ToolboxPolicies] = None, + **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. + + Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :keyword tools: The list of tools to include in this version. Required. + :paramtype tools: list[~azure.ai.projects.models.Tool] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword description: A human-readable description of the toolbox. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is + None. + :paramtype metadata: dict[str, str] + :keyword skills: The list of skill sources to include in this version. A skill reference + specifies a skill name and optionally a version. If version is omitted, the skill's default + version is used. Default value is None. + :paramtype skills: list[~azure.ai.projects.models.ToolboxSkill] + :keyword policies: Policy configuration for this toolbox version. Default value is None. + :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_version( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. + + Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :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: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_version( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. + + Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. + + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :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: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def _upload_session_file( + def create_version( self, - agent_name: str, - agent_session_id: str, - content: bytes, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, *, - path: str, - user_isolation_key: Optional[str] = None, + tools: List[_models.Tool] = _Unset, + description: Optional[str] = None, + metadata: Optional[dict[str, str]] = None, + skills: Optional[List[_models.ToolboxSkill]] = None, + policies: Optional[_models.ToolboxPolicies] = None, **kwargs: Any - ) -> _models.SessionFileWriteResult: - """Upload a session file. + ) -> _models.ToolboxVersionObject: + """Create a new version of a toolbox. - Uploads binary file content to the specified path in the session sandbox. The service stores - the file relative to the session home directory and rejects payloads larger than 50 MB. + Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :param content: Required. - :type content: bytes - :keyword path: The destination file path within the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SessionFileWriteResult + :param name: The name of the toolbox. If the toolbox does not exist, it will be created. + Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword tools: The list of tools to include in this version. Required. + :paramtype tools: list[~azure.ai.projects.models.Tool] + :keyword description: A human-readable description of the toolbox. Default value is None. + :paramtype description: str + :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is + None. + :paramtype metadata: dict[str, str] + :keyword skills: The list of skill sources to include in this version. A skill reference + specifies a skill name and optionally a version. If version is omitted, the skill's default + version is used. Default value is None. + :paramtype skills: list[~azure.ai.projects.models.ToolboxSkill] + :keyword policies: Policy configuration for this toolbox version. Default value is None. + :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7669,16 +8122,29 @@ def _upload_session_file( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[_models.SessionFileWriteResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) - _content = content + if body is _Unset: + if tools is _Unset: + raise TypeError("missing required argument: tools") + body = { + "description": description, + "metadata": metadata, + "policies": policies, + "skills": skills, + "tools": tools, + } + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_agents_upload_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + _request = build_toolboxes_create_version_request( + name=name, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -7698,7 +8164,7 @@ def _upload_session_file( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -7714,7 +8180,7 @@ def _upload_session_file( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionFileWriteResult, response.json()) + deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7722,32 +8188,15 @@ def _upload_session_file( return deserialized # type: ignore @distributed_trace - def download_session_file( - self, - agent_name: str, - agent_session_id: str, - *, - path: str, - user_isolation_key: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - """Download a session file. + def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: + """Retrieve a toolbox. - Downloads the file at the specified sandbox path as a binary stream. The path is resolved - relative to the session home directory. + Retrieves the specified toolbox and its current configuration. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The file path to download from the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param name: The name of the toolbox to retrieve. Required. + :type name: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7761,13 +8210,10 @@ def download_session_file( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) - _request = build_beta_agents_download_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + _request = build_toolboxes_get_request( + name=name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -7778,7 +8224,7 @@ def download_session_file( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -7798,7 +8244,10 @@ def download_session_file( ) raise HttpResponseError(response=response, model=error) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ToolboxObject, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7806,34 +8255,18 @@ def download_session_file( return deserialized # type: ignore @distributed_trace - def list_session_files( + def list( self, - agent_name: str, - agent_session_id: str, *, - path: Optional[str] = None, - user_isolation_key: Optional[str] = None, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.SessionDirectoryEntry"]: - """List session files. + ) -> ItemPaged["_models.ToolboxObject"]: + """List toolboxes. - Returns files and directories at the specified path in the session sandbox. The response - includes only the immediate children of the target directory and defaults to the session home - directory when no path is supplied. + Returns the toolboxes available in the current project. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The directory path to list, relative to the session home directory. Defaults to - the home directory if not provided. Default value is None. - :paramtype path: str - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -7848,14 +8281,14 @@ def list_session_files( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of SessionDirectoryEntry - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.SessionDirectoryEntry] + :return: An iterator like instance of ToolboxObject + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ToolboxObject] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SessionDirectoryEntry]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7867,11 +8300,7 @@ def list_session_files( def prepare_request(_continuation_token=None): - _request = build_beta_agents_list_session_files_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - user_isolation_key=user_isolation_key, + _request = build_toolboxes_list_request( limit=limit, order=order, after=_continuation_token, @@ -7889,8 +8318,8 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SessionDirectoryEntry], - deserialized.get("entries", []), + List[_models.ToolboxObject], + deserialized.get("data", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -7918,38 +8347,44 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) @distributed_trace - def delete_session_file( # pylint: disable=inconsistent-return-statements + def list_versions( self, - agent_name: str, - agent_session_id: str, + name: str, *, - path: str, - recursive: Optional[bool] = None, - user_isolation_key: Optional[str] = None, + limit: Optional[int] = None, + order: Optional[Union[str, _models.PageOrder]] = None, + before: Optional[str] = None, **kwargs: Any - ) -> None: - """Delete a session file. + ) -> ItemPaged["_models.ToolboxVersionObject"]: + """List toolbox versions. - Deletes the specified file or directory from the session sandbox. When ``recursive`` is false, - deleting a non-empty directory returns 409 Conflict. + Returns the available versions for the specified toolbox. - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param agent_session_id: The session ID. Required. - :type agent_session_id: str - :keyword path: The file or directory path to delete, relative to the session home directory. - Required. - :paramtype path: str - :keyword recursive: Whether to recursively delete directory contents. The service defaults to - ``false`` if a value is not specified by the caller. Default value is None. - :paramtype recursive: bool - :keyword user_isolation_key: Opaque per-user isolation key used to scope endpoint-scoped data - (responses, conversations, sessions) to a specific end user. Default value is None. - :paramtype user_isolation_key: str - :return: None - :rtype: None + :param name: The name of the toolbox to list versions for. Required. + :type name: str + :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and + 100, and the + default is 20. Default value is None. + :paramtype limit: int + :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for + ascending order and``desc`` + for descending order. Known values are: "asc" and "desc". Default value is None. + :paramtype order: str or ~azure.ai.projects.models.PageOrder + :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your + place in the list. + For instance, if you make a list request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the previous page of the list. + Default value is None. + :paramtype before: str + :return: An iterator like instance of ToolboxVersionObject + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ToolboxVersionObject] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7958,137 +8393,67 @@ def delete_session_file( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_beta_agents_delete_session_file_request( - agent_name=agent_name, - agent_session_id=agent_session_id, - path=path, - recursive=recursive, - user_isolation_key=user_isolation_key, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response + def prepare_request(_continuation_token=None): - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + _request = build_toolboxes_list_versions_request( + name=name, + limit=limit, + order=order, + after=_continuation_token, + before=before, + api_version=self._config.api_version, + headers=_headers, + params=_params, ) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_optimization_job( - self, - job: _models.OptimizationJob, - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.OptimizationJob: - """Creates an agent optimization job. - - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. - - :param job: The job to create. Required. - :type job: ~azure.ai.projects.models.OptimizationJob - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - @overload - def create_optimization_job( - self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.OptimizationJob: - """Creates an agent optimization job. + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ToolboxVersionObject], + deserialized.get("data", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("last_id") or None, iter(list_of_elem) - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. + def get_next(_continuation_token=None): + _request = prepare_request(_continuation_token) - :param job: The job to create. Required. - :type job: JSON - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - @overload - def create_optimization_job( - self, - job: IO[bytes], - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.OptimizationJob: - """Creates an agent optimization job. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. + return pipeline_response - :param job: The job to create. Required. - :type job: IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + return ItemPaged(get_next, extract_data) @distributed_trace - def create_optimization_job( - self, job: Union[_models.OptimizationJob, JSON, IO[bytes]], *, operation_id: Optional[str] = None, **kwargs: Any - ) -> _models.OptimizationJob: - """Creates an agent optimization job. + def get_version(self, name: str, version: str, **kwargs: Any) -> _models.ToolboxVersionObject: + """Retrieve a specific version of a toolbox. - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. + Retrieves the specified version of a toolbox by name and version identifier. - :param job: The job to create. Is one of the following types: OptimizationJob, JSON, IO[bytes] - Required. - :type job: ~azure.ai.projects.models.OptimizationJob or JSON or IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob + :param name: The name of the toolbox. Required. + :type name: str + :param version: The version identifier to retrieve. Required. + :type version: str + :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8099,24 +8464,15 @@ def create_optimization_job( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(job, (IOBase, bytes)): - _content = job - else: - _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) - _request = build_beta_agents_create_optimization_job_request( - operation_id=operation_id, - content_type=content_type, + _request = build_toolboxes_get_version_request( + name=name, + version=version, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -8133,7 +8489,7 @@ def create_optimization_job( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -8146,30 +8502,94 @@ def create_optimization_job( ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) + deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @overload + def update( + self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + Updates the toolbox's default version pointer to the specified version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :keyword default_version: The version identifier that the toolbox should point to. When set, + the toolbox's default version will resolve to this version instead of the latest. Required. + :paramtype default_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + Updates the toolbox's default version pointer to the specified version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :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: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. + + Updates the toolbox's default version pointer to the specified version. + + :param name: The name of the toolbox to update. Required. + :type name: str + :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: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: - """Get info about an agent optimization job. + def update( + self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any + ) -> _models.ToolboxObject: + """Update a toolbox to point to a specific version. - Get an optimization job by id. + Updates the toolbox's default version pointer to the specified version. - :param job_id: The ID of the job. Required. - :type job_id: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob + :param name: The name of the toolbox to update. Required. + :type name: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword default_version: The version identifier that the toolbox should point to. When set, + the toolbox's default version will resolve to this version instead of the latest. Required. + :paramtype default_version: str + :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8180,14 +8600,29 @@ def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimizati } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) - _request = build_beta_agents_get_optimization_job_request( - job_id=job_id, + if body is _Unset: + if default_version is _Unset: + raise TypeError("missing required argument: default_version") + body = {"default_version": default_version} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_toolboxes_update_request( + name=name, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8217,131 +8652,26 @@ def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimizati ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) + deserialized = _deserialize(_models.ToolboxObject, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def list_optimization_jobs( - self, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - status: Optional[Union[str, _models.JobStatus]] = None, - agent_name: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.OptimizationJobListItem"]: - """Returns a list of agent optimization jobs. - - List optimization jobs. Supports cursor pagination and optional status / agent_name filters. - - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :keyword status: Filter to jobs in this lifecycle state. Known values are: "queued", - "in_progress", "succeeded", "failed", and "cancelled". Default value is None. - :paramtype status: str or ~azure.ai.projects.models.JobStatus - :keyword agent_name: Filter to jobs targeting this agent name. Default value is None. - :paramtype agent_name: str - :return: An iterator like instance of OptimizationJobListItem - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.OptimizationJobListItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.OptimizationJobListItem]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(_continuation_token=None): - - _request = build_beta_agents_list_optimization_jobs_request( - limit=limit, - order=order, - after=_continuation_token, - before=before, - status=status, - agent_name=agent_name, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.OptimizationJobListItem], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, iter(list_of_elem) - - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: - """Cancels an agent optimization job. - - Request cancellation of a running or queued job. Returns an error if the job is already in a - terminal state. + def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Delete a toolbox. - :param job_id: The ID of the job to cancel. Required. - :type job_id: str - :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.OptimizationJob + Removes the specified toolbox along with all of its versions. + + :param name: The name of the toolbox to delete. Required. + :type name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8355,10 +8685,10 @@ def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimiz _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_cancel_optimization_job_request( - job_id=job_id, + _request = build_toolboxes_delete_request( + name=name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -8368,20 +8698,14 @@ def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimiz } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -8389,26 +8713,21 @@ def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimiz ) raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def delete_optimization_job( # pylint: disable=inconsistent-return-statements - self, job_id: str, **kwargs: Any + def delete_version( # pylint: disable=inconsistent-return-statements + self, name: str, version: str, **kwargs: Any ) -> None: - """Deletes an agent optimization job. + """Delete a specific version of a toolbox. - Delete the job and its candidate artifacts. Cancels first if non-terminal. + Removes the specified version of a toolbox. - :param job_id: The ID of the job to delete. Required. - :type job_id: str + :param name: The name of the toolbox. Required. + :type name: str + :param version: The version identifier to delete. Required. + :type version: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -8426,8 +8745,9 @@ def delete_optimization_job( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_agents_delete_optimization_job_request( - job_id=job_id, + _request = build_toolboxes_delete_version_request( + name=name, + version=version, api_version=self._config.api_version, headers=_headers, params=_params, @@ -15204,231 +15524,33 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class BetaToolboxesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`toolboxes` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_version( - self, - name: str, - *, - tools: List[_models.Tool], - content_type: str = "application/json", - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - skills: Optional[List[_models.ToolboxSkill]] = None, - policies: Optional[_models.ToolboxPolicies] = None, - **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. - - Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword description: A human-readable description of the toolbox. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is - None. - :paramtype metadata: dict[str, str] - :keyword skills: The list of skill sources to include in this version. A skill reference - specifies a skill name and optionally a version. If version is omitted, the skill's default - version is used. Default value is None. - :paramtype skills: list[~azure.ai.projects.models.ToolboxSkill] - :keyword policies: Policy configuration for this toolbox version. Default value is None. - :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_version( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. - - Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :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: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_version( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. - - Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :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: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_version( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - tools: List[_models.Tool] = _Unset, - description: Optional[str] = None, - metadata: Optional[dict[str, str]] = None, - skills: Optional[List[_models.ToolboxSkill]] = None, - policies: Optional[_models.ToolboxPolicies] = None, - **kwargs: Any - ) -> _models.ToolboxVersionObject: - """Create a new version of a toolbox. - - Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. - - :param name: The name of the toolbox. If the toolbox does not exist, it will be created. - Required. - :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.Tool] - :keyword description: A human-readable description of the toolbox. Default value is None. - :paramtype description: str - :keyword metadata: Arbitrary key-value metadata to associate with the toolbox. Default value is - None. - :paramtype metadata: dict[str, str] - :keyword skills: The list of skill sources to include in this version. A skill reference - specifies a skill name and optionally a version. If version is omitted, the skill's default - version is used. Default value is None. - :paramtype skills: list[~azure.ai.projects.models.ToolboxSkill] - :keyword policies: Policy configuration for this toolbox version. Default value is None. - :paramtype policies: ~azure.ai.projects.models.ToolboxPolicies - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) - - if body is _Unset: - if tools is _Unset: - raise TypeError("missing required argument: tools") - body = { - "description": description, - "metadata": metadata, - "policies": policies, - "skills": skills, - "tools": tools, - } - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_beta_toolboxes_create_version_request( - name=name, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) +class BetaSkillsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`skills` attribute. + """ - return deserialized # type: ignore + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: - """Retrieve a toolbox. + def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: + """Retrieve a skill. - Retrieves the specified toolbox and its current configuration. + Retrieves the specified skill and its current configuration. - :param name: The name of the toolbox to retrieve. Required. + :param name: The unique name of the skill. Required. :type name: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15442,9 +15564,9 @@ def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + cls: ClsType[_models.SkillDetails] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_get_request( + _request = build_beta_skills_get_request( name=name, api_version=self._config.api_version, headers=_headers, @@ -15479,7 +15601,7 @@ def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + deserialized = _deserialize(_models.SkillDetails, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15494,106 +15616,11 @@ def list( order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ToolboxObject"]: - """List toolboxes. - - Returns the toolboxes available in the current project. - - :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the - default is 20. Default value is None. - :paramtype limit: int - :keyword order: Sort order by the ``created_at`` timestamp of the objects. ``asc`` for - ascending order and``desc`` - for descending order. Known values are: "asc" and "desc". Default value is None. - :paramtype order: str or ~azure.ai.projects.models.PageOrder - :keyword before: A cursor for use in pagination. ``before`` is an object ID that defines your - place in the list. - For instance, if you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page of the list. - Default value is None. - :paramtype before: str - :return: An iterator like instance of ToolboxObject - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ToolboxObject] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(_continuation_token=None): - - _request = build_beta_toolboxes_list_request( - limit=limit, - order=order, - after=_continuation_token, - before=before, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ToolboxObject], - deserialized.get("data", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("last_id") or None, iter(list_of_elem) - - def get_next(_continuation_token=None): - _request = prepare_request(_continuation_token) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_versions( - self, - name: str, - *, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.ToolboxVersionObject"]: - """List toolbox versions. + ) -> ItemPaged["_models.SkillDetails"]: + """List skills. - Returns the available versions for the specified toolbox. + Returns the skills available in the current project. - :param name: The name of the toolbox to list versions for. Required. - :type name: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -15608,14 +15635,14 @@ def list_versions( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of ToolboxVersionObject - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ToolboxVersionObject] + :return: An iterator like instance of SkillDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.SkillDetails] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SkillDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15627,8 +15654,7 @@ def list_versions( def prepare_request(_continuation_token=None): - _request = build_beta_toolboxes_list_versions_request( - name=name, + _request = build_beta_skills_list_request( limit=limit, order=order, after=_continuation_token, @@ -15646,7 +15672,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ToolboxVersionObject], + List[_models.SkillDetails], deserialized.get("data", []), ) if cls: @@ -15674,154 +15700,84 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) - @distributed_trace - def get_version(self, name: str, version: str, **kwargs: Any) -> _models.ToolboxVersionObject: - """Retrieve a specific version of a toolbox. - - Retrieves the specified version of a toolbox by name and version identifier. - - :param name: The name of the toolbox. Required. - :type name: str - :param version: The version identifier to retrieve. Required. - :type version: str - :return: ToolboxVersionObject. The ToolboxVersionObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxVersionObject - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) - - _request = build_beta_toolboxes_get_version_request( - name=name, - version=version, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ToolboxVersionObject, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @overload def update( self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + ) -> _models.SkillDetails: + """Update a skill. - Updates the toolbox's default version pointer to the specified version. + Modifies the specified skill's configuration. - :param name: The name of the toolbox to update. Required. + :param name: The name of the skill to update. Required. :type name: str - :keyword default_version: The version identifier that the toolbox should point to. When set, - the toolbox's default version will resolve to this version instead of the latest. Required. + :keyword default_version: The version identifier that the skill should point to. When set, the + skill's default version will resolve to this version instead of the latest. Required. :paramtype default_version: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload def update( self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + ) -> _models.SkillDetails: + """Update a skill. - Updates the toolbox's default version pointer to the specified version. + Modifies the specified skill's configuration. - :param name: The name of the toolbox to update. Required. + :param name: The name of the skill to update. Required. :type name: str :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: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ @overload def update( self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + ) -> _models.SkillDetails: + """Update a skill. - Updates the toolbox's default version pointer to the specified version. + Modifies the specified skill's configuration. - :param name: The name of the toolbox to update. Required. + :param name: The name of the skill to update. Required. :type name: str :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: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def update( self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.ToolboxObject: - """Update a toolbox to point to a specific version. + ) -> _models.SkillDetails: + """Update a skill. - Updates the toolbox's default version pointer to the specified version. + Modifies the specified skill's configuration. - :param name: The name of the toolbox to update. Required. + :param name: The name of the skill to update. Required. :type name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword default_version: The version identifier that the toolbox should point to. When set, - the toolbox's default version will resolve to this version instead of the latest. Required. + :keyword default_version: The version identifier that the skill should point to. When set, the + skill's default version will resolve to this version instead of the latest. Required. :paramtype default_version: str - :return: ToolboxObject. The ToolboxObject is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ToolboxObject + :return: SkillDetails. The SkillDetails is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15836,7 +15792,7 @@ def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ToolboxObject] = kwargs.pop("cls", None) + cls: ClsType[_models.SkillDetails] = kwargs.pop("cls", None) if body is _Unset: if default_version is _Unset: @@ -15850,7 +15806,7 @@ def update( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_toolboxes_update_request( + _request = build_beta_skills_update_request( name=name, content_type=content_type, api_version=self._config.api_version, @@ -15887,7 +15843,7 @@ def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + deserialized = _deserialize(_models.SkillDetails, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15895,15 +15851,15 @@ def update( return deserialized # type: ignore @distributed_trace - def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Delete a toolbox. + def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: + """Delete a skill. - Removes the specified toolbox along with all of its versions. + Removes the specified skill and its associated versions. - :param name: The name of the toolbox to delete. Required. + :param name: The unique name of the skill. Required. :type name: str - :return: None - :rtype: None + :return: DeleteSkillResult. The DeleteSkillResult is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DeleteSkillResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15917,9 +15873,9 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.DeleteSkillResult] = kwargs.pop("cls", None) - _request = build_beta_toolboxes_delete_request( + _request = build_beta_skills_delete_request( name=name, api_version=self._config.api_version, headers=_headers, @@ -15930,14 +15886,20 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -15945,23 +15907,110 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist ) raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DeleteSkillResult, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + name: str, + *, + content_type: str = "application/json", + inline_content: Optional[_models.SkillInlineContent] = None, + default: Optional[bool] = None, + **kwargs: Any + ) -> _models.SkillVersion: + """Create a new version of a skill. + + Creates a new version of a skill. If the skill does not exist, it will be created. + + :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :type name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword inline_content: Inline skill content for simple skills without file uploads. + Foundry-specific extension. Default value is None. + :paramtype inline_content: ~azure.ai.projects.models.SkillInlineContent + :keyword default: Whether to set this version as the default. Default value is None. + :paramtype default: bool + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SkillVersion: + """Create a new version of a skill. + + Creates a new version of a skill. If the skill does not exist, it will be created. + + :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :type name: str + :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: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SkillVersion: + """Create a new version of a skill. + + Creates a new version of a skill. If the skill does not exist, it will be created. + + :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :type name: str + :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: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def delete_version( # pylint: disable=inconsistent-return-statements - self, name: str, version: str, **kwargs: Any - ) -> None: - """Delete a specific version of a toolbox. + def create( + self, + name: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + inline_content: Optional[_models.SkillInlineContent] = None, + default: Optional[bool] = None, + **kwargs: Any + ) -> _models.SkillVersion: + """Create a new version of a skill. - Removes the specified version of a toolbox. + Creates a new version of a skill. If the skill does not exist, it will be created. - :param name: The name of the toolbox. Required. + :param name: The name of the skill. If the skill does not exist, it will be created. Required. :type name: str - :param version: The version identifier to delete. Required. - :type version: str - :return: None - :rtype: None + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword inline_content: Inline skill content for simple skills without file uploads. + Foundry-specific extension. Default value is None. + :paramtype inline_content: ~azure.ai.projects.models.SkillInlineContent + :keyword default: Whether to set this version as the default. Default value is None. + :paramtype default: bool + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15972,15 +16021,27 @@ def delete_version( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) + + if body is _Unset: + body = {"default": default, "inline_content": inline_content} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_beta_toolboxes_delete_version_request( + _request = build_beta_skills_create_request( name=name, - version=version, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -15989,14 +16050,20 @@ def delete_version( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -16004,37 +16071,62 @@ def delete_version( # pylint: disable=inconsistent-return-statements ) raise HttpResponseError(response=response, model=error) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SkillVersion, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized # type: ignore -class BetaSkillsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @overload + def create_from_files( + self, name: str, content: _models.CreateSkillVersionFromFilesBody, **kwargs: Any + ) -> _models.SkillVersion: + """Create a skill version from uploaded files. - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`skills` attribute. - """ + Creates a new version of a skill from uploaded files via multipart form data. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param name: The name of the skill. Required. + :type name: str + :param content: Required. + :type content: ~azure.ai.projects.models.CreateSkillVersionFromFilesBody + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_from_files(self, name: str, content: JSON, **kwargs: Any) -> _models.SkillVersion: + """Create a skill version from uploaded files. + + Creates a new version of a skill from uploaded files via multipart form data. + + :param name: The name of the skill. Required. + :type name: str + :param content: Required. + :type content: JSON + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: - """Retrieve a skill. + def create_from_files( + self, name: str, content: Union[_models.CreateSkillVersionFromFilesBody, JSON], **kwargs: Any + ) -> _models.SkillVersion: + """Create a skill version from uploaded files. - Retrieves the specified skill and its current configuration. + Creates a new version of a skill from uploaded files via multipart form data. - :param name: The unique name of the skill. Required. + :param name: The name of the skill. Required. :type name: str - :return: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails + :param content: Is either a CreateSkillVersionFromFilesBody type or a JSON type. Required. + :type content: ~azure.ai.projects.models.CreateSkillVersionFromFilesBody or JSON + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16048,11 +16140,17 @@ def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillDetails] = kwargs.pop("cls", None) + cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) - _request = build_beta_skills_get_request( + _body = content.as_dict() if isinstance(content, _Model) else content + _file_fields: list[str] = ["files"] + _data_fields: list[str] = ["default"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_beta_skills_create_from_files_request( name=name, api_version=self._config.api_version, + files=_files, headers=_headers, params=_params, ) @@ -16085,7 +16183,7 @@ def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillDetails, response.json()) + deserialized = _deserialize(_models.SkillVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16093,18 +16191,21 @@ def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: return deserialized # type: ignore @distributed_trace - def list( + def list_versions( self, + name: str, *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.SkillDetails"]: - """List skills. + ) -> ItemPaged["_models.SkillVersion"]: + """List skill versions. - Returns the skills available in the current project. + Returns the available versions for the specified skill. + :param name: The name of the skill to list versions for. Required. + :type name: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -16119,14 +16220,14 @@ def list( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of SkillDetails - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.SkillDetails] + :return: An iterator like instance of SkillVersion + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.SkillVersion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SkillDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SkillVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16138,7 +16239,8 @@ def list( def prepare_request(_continuation_token=None): - _request = build_beta_skills_list_request( + _request = build_beta_skills_list_versions_request( + name=name, limit=limit, order=order, after=_continuation_token, @@ -16156,7 +16258,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SkillDetails], + List[_models.SkillVersion], deserialized.get("data", []), ) if cls: @@ -16184,84 +16286,18 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) - @overload - def update( - self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: - """Update a skill. - - Modifies the specified skill's configuration. - - :param name: The name of the skill to update. Required. - :type name: str - :keyword default_version: The version identifier that the skill should point to. When set, the - skill's default version will resolve to this version instead of the latest. Required. - :paramtype default_version: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: - """Update a skill. - - Modifies the specified skill's configuration. - - :param name: The name of the skill to update. Required. - :type name: str - :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: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: - """Update a skill. - - Modifies the specified skill's configuration. - - :param name: The name of the skill to update. Required. - :type name: str - :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: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def update( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.SkillDetails: - """Update a skill. + def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVersion: + """Retrieve a specific version of a skill. - Modifies the specified skill's configuration. + Retrieves the specified version of a skill by name and version identifier. - :param name: The name of the skill to update. Required. + :param name: The name of the skill. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword default_version: The version identifier that the skill should point to. When set, the - skill's default version will resolve to this version instead of the latest. Required. - :paramtype default_version: str - :return: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails + :param version: The version identifier to retrieve. Required. + :type version: str + :return: SkillVersion. The SkillVersion is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16272,29 +16308,15 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SkillDetails] = kwargs.pop("cls", None) - - if body is _Unset: - if default_version is _Unset: - raise TypeError("missing required argument: default_version") - body = {"default_version": default_version} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) - _request = build_beta_skills_update_request( + _request = build_beta_skills_get_version_request( name=name, - content_type=content_type, + version=version, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -16327,7 +16349,7 @@ def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillDetails, response.json()) + deserialized = _deserialize(_models.SkillVersion, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16335,15 +16357,15 @@ def update( return deserialized # type: ignore @distributed_trace - def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: - """Delete a skill. + def download(self, name: str, **kwargs: Any) -> Iterator[bytes]: + """Download the zip content for the default version of a skill. - Removes the specified skill and its associated versions. + Downloads the zip content for the default version of a skill. - :param name: The unique name of the skill. Required. + :param name: The name of the skill. Required. :type name: str - :return: DeleteSkillResult. The DeleteSkillResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteSkillResult + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16357,9 +16379,9 @@ def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteSkillResult] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_beta_skills_delete_request( + _request = build_beta_skills_download_request( name=name, api_version=self._config.api_version, headers=_headers, @@ -16371,7 +16393,7 @@ def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = kwargs.pop("stream", True) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16391,110 +16413,99 @@ def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: ) raise HttpResponseError(response=response, model=error) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DeleteSkillResult, response.json()) + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def create( - self, - name: str, - *, - content_type: str = "application/json", - inline_content: Optional[_models.SkillInlineContent] = None, - default: Optional[bool] = None, - **kwargs: Any - ) -> _models.SkillVersion: - """Create a new version of a skill. + @distributed_trace + def download_version(self, name: str, version: str, **kwargs: Any) -> Iterator[bytes]: + """Download the zip content for a specific version of a skill. - Creates a new version of a skill. If the skill does not exist, it will be created. + Downloads the zip content for a specific version of a skill. - :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :param name: The name of the skill. Required. :type name: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword inline_content: Inline skill content for simple skills without file uploads. - Foundry-specific extension. Default value is None. - :paramtype inline_content: ~azure.ai.projects.models.SkillInlineContent - :keyword default: Whether to set this version as the default. Default value is None. - :paramtype default: bool - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion + :param version: The version to download content for. Required. + :type version: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def create( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillVersion: - """Create a new version of a skill. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Creates a new version of a skill. If the skill does not exist, it will be created. + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - :param name: The name of the skill. If the skill does not exist, it will be created. Required. - :type name: str - :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: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + _request = build_beta_skills_download_version_request( + name=name, + version=version, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - @overload - def create( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillVersion: - """Create a new version of a skill. + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ApiErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - Creates a new version of a skill. If the skill does not exist, it will be created. + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - :param name: The name of the skill. If the skill does not exist, it will be created. Required. - :type name: str - :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: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def create( - self, - name: str, - body: Union[JSON, IO[bytes]] = _Unset, - *, - inline_content: Optional[_models.SkillInlineContent] = None, - default: Optional[bool] = None, - **kwargs: Any - ) -> _models.SkillVersion: - """Create a new version of a skill. + def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.DeleteSkillVersionResult: + """Delete a specific version of a skill. - Creates a new version of a skill. If the skill does not exist, it will be created. + Removes the specified version of a skill. - :param name: The name of the skill. If the skill does not exist, it will be created. Required. + :param name: The name of the skill. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword inline_content: Inline skill content for simple skills without file uploads. - Foundry-specific extension. Default value is None. - :paramtype inline_content: ~azure.ai.projects.models.SkillInlineContent - :keyword default: Whether to set this version as the default. Default value is None. - :paramtype default: bool - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion + :param version: The version identifier to delete. Required. + :type version: str + :return: DeleteSkillVersionResult. The DeleteSkillVersionResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.DeleteSkillVersionResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16505,27 +16516,15 @@ def create( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) - - if body is _Unset: - body = {"default": default, "inline_content": inline_content} - body = {k: v for k, v in body.items() if v is not None} - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.DeleteSkillVersionResult] = kwargs.pop("cls", None) - _request = build_beta_skills_create_request( + _request = build_beta_skills_delete_version_request( name=name, - content_type=content_type, + version=version, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -16558,59 +16557,41 @@ def create( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillVersion, response.json()) + deserialized = _deserialize(_models.DeleteSkillVersionResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def create_from_files( - self, name: str, content: _models.CreateSkillVersionFromFilesBody, **kwargs: Any - ) -> _models.SkillVersion: - """Create a skill version from uploaded files. - - Creates a new version of a skill from uploaded files via multipart form data. - - :param name: The name of the skill. Required. - :type name: str - :param content: Required. - :type content: ~azure.ai.projects.models.CreateSkillVersionFromFilesBody - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create_from_files(self, name: str, content: JSON, **kwargs: Any) -> _models.SkillVersion: - """Create a skill version from uploaded files. +class BetaDatasetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - Creates a new version of a skill from uploaded files via multipart form data. + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`datasets` attribute. + """ - :param name: The name of the skill. Required. - :type name: str - :param content: Required. - :type content: JSON - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def create_from_files( - self, name: str, content: Union[_models.CreateSkillVersionFromFilesBody, JSON], **kwargs: Any - ) -> _models.SkillVersion: - """Create a skill version from uploaded files. + def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: + """Get a data generation job. - Creates a new version of a skill from uploaded files via multipart form data. + Retrieves the specified data generation job and its current status. - :param name: The name of the skill. Required. - :type name: str - :param content: Is either a CreateSkillVersionFromFilesBody type or a JSON type. Required. - :type content: ~azure.ai.projects.models.CreateSkillVersionFromFilesBody or JSON - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion + :param job_id: The ID of the job. Required. + :type job_id: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16624,17 +16605,11 @@ def create_from_files( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) - - _body = content.as_dict() if isinstance(content, _Model) else content - _file_fields: list[str] = ["files"] - _data_fields: list[str] = ["default"] - _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_skills_create_from_files_request( - name=name, + _request = build_beta_datasets_get_generation_job_request( + job_id=job_id, api_version=self._config.api_version, - files=_files, headers=_headers, params=_params, ) @@ -16664,32 +16639,32 @@ def create_from_files( ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillVersion, response.json()) + deserialized = _deserialize(_models.DataGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_versions( + def list_generation_jobs( self, - name: str, *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.SkillVersion"]: - """List skill versions. + ) -> ItemPaged["_models.DataGenerationJob"]: + """List data generation jobs. - Returns the available versions for the specified skill. + Returns a list of data generation jobs. - :param name: The name of the skill to list versions for. Required. - :type name: str :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. @@ -16704,14 +16679,14 @@ def list_versions( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of SkillVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.SkillVersion] + :return: An iterator like instance of DataGenerationJob + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DataGenerationJob] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SkillVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DataGenerationJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16723,8 +16698,7 @@ def list_versions( def prepare_request(_continuation_token=None): - _request = build_beta_skills_list_versions_request( - name=name, + _request = build_beta_datasets_list_generation_jobs_request( limit=limit, order=order, after=_continuation_token, @@ -16742,7 +16716,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SkillVersion], + List[_models.DataGenerationJob], deserialized.get("data", []), ) if cls: @@ -16770,18 +16744,99 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) + @overload + def create_generation_job( + self, + job: _models.DataGenerationJob, + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataGenerationJob: + """Create a data generation job. + + Submits a new data generation job for asynchronous execution. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.DataGenerationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_generation_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.DataGenerationJob: + """Create a data generation job. + + Submits a new data generation job for asynchronous execution. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_generation_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataGenerationJob: + """Create a data generation job. + + Submits a new data generation job for asynchronous execution. + + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVersion: - """Retrieve a specific version of a skill. + def create_generation_job( + self, + job: Union[_models.DataGenerationJob, JSON, IO[bytes]], + *, + operation_id: Optional[str] = None, + **kwargs: Any + ) -> _models.DataGenerationJob: + """Create a data generation job. - Retrieves the specified version of a skill by name and version identifier. + Submits a new data generation job for asynchronous execution. - :param name: The name of the skill. Required. - :type name: str - :param version: The version identifier to retrieve. Required. - :type version: str - :return: SkillVersion. The SkillVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillVersion + :param job: The job to create. Is one of the following types: DataGenerationJob, JSON, + IO[bytes] Required. + :type job: ~azure.ai.projects.models.DataGenerationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16792,15 +16847,24 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVe } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_skills_get_version_request( - name=name, - version=version, + content_type = content_type or "application/json" + _content = None + if isinstance(job, (IOBase, bytes)): + _content = job + else: + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_datasets_create_generation_job_request( + operation_id=operation_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -16817,7 +16881,7 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVe response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -16830,26 +16894,30 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVe ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillVersion, response.json()) + deserialized = _deserialize(_models.DataGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def download(self, name: str, **kwargs: Any) -> Iterator[bytes]: - """Download the zip content for the default version of a skill. + def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: + """Cancel a data generation job. - Downloads the zip content for the default version of a skill. + Cancels the specified data generation job if it is still in progress. - :param name: The name of the skill. Required. - :type name: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param job_id: The ID of the job to cancel. Required. + :type job_id: str + :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16863,10 +16931,10 @@ def download(self, name: str, **kwargs: Any) -> Iterator[bytes]: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) - _request = build_beta_skills_download_request( - name=name, + _request = build_beta_datasets_cancel_generation_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -16877,7 +16945,7 @@ def download(self, name: str, **kwargs: Any) -> Iterator[bytes]: _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16897,28 +16965,28 @@ def download(self, name: str, **kwargs: Any) -> Iterator[bytes]: ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataGenerationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def download_version(self, name: str, version: str, **kwargs: Any) -> Iterator[bytes]: - """Download the zip content for a specific version of a skill. + def delete_generation_job( # pylint: disable=inconsistent-return-statements + self, job_id: str, **kwargs: Any + ) -> None: + """Delete a data generation job. - Downloads the zip content for a specific version of a skill. + Removes the specified data generation job and its associated output. - :param name: The name of the skill. Required. - :type name: str - :param version: The version to download content for. Required. - :type version: str - :return: Iterator[bytes] - :rtype: Iterator[bytes] + :param job_id: The ID of the job to delete. Required. + :type job_id: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16932,11 +17000,10 @@ def download_version(self, name: str, version: str, **kwargs: Any) -> Iterator[b _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_skills_download_version_request( - name=name, - version=version, + _request = build_beta_datasets_delete_generation_job_request( + job_id=job_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -16946,20 +17013,14 @@ def download_version(self, name: str, version: str, **kwargs: Any) -> Iterator[b } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", True) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ApiErrorResponse, @@ -16967,29 +17028,120 @@ def download_version(self, name: str, version: str, **kwargs: Any) -> Iterator[b ) raise HttpResponseError(response=response, model=error) - response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + if cls: + return cls(pipeline_response, None, {}) # type: ignore - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore +class BetaAgentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - return deserialized # type: ignore + Instead, you should access the following operations through + :class:`~azure.ai.projects.AIProjectClient`'s + :attr:`agents` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create_optimization_job( + self, + job: _models.OptimizationJob, + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: ~azure.ai.projects.models.OptimizationJob + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_optimization_job( + self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: JSON + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_optimization_job( + self, + job: IO[bytes], + *, + operation_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. + + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. + + :param job: The job to create. Required. + :type job: IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.DeleteSkillVersionResult: - """Delete a specific version of a skill. + def create_optimization_job( + self, job: Union[_models.OptimizationJob, JSON, IO[bytes]], *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _models.OptimizationJob: + """Creates an agent optimization job. - Removes the specified version of a skill. + Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for + idempotent retry. - :param name: The name of the skill. Required. - :type name: str - :param version: The version identifier to delete. Required. - :type version: str - :return: DeleteSkillVersionResult. The DeleteSkillVersionResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.DeleteSkillVersionResult + :param job: The job to create. Is one of the following types: OptimizationJob, JSON, IO[bytes] + Required. + :type job: ~azure.ai.projects.models.OptimizationJob or JSON or IO[bytes] + :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the + server creates the job unconditionally. Default value is None. + :paramtype operation_id: str + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17000,15 +17152,24 @@ def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.Dele } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteSkillVersionResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) - _request = build_beta_skills_delete_version_request( - name=name, - version=version, + content_type = content_type or "application/json" + _content = None + if isinstance(job, (IOBase, bytes)): + _content = job + else: + _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_beta_agents_create_optimization_job_request( + operation_id=operation_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -17025,7 +17186,7 @@ def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.Dele response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -17038,44 +17199,30 @@ def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.Dele ) raise HttpResponseError(response=response, model=error) + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteSkillVersionResult, response.json()) + deserialized = _deserialize(_models.OptimizationJob, response.json()) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - -class BetaDatasetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`datasets` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: AIProjectClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: - """Get a data generation job. + def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + """Get info about an agent optimization job. - Retrieves the specified data generation job and its current status. + Get an optimization job by id. :param job_id: The ID of the job. Required. :type job_id: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17089,9 +17236,9 @@ def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerati _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) - _request = build_beta_datasets_get_generation_job_request( + _request = build_beta_agents_get_optimization_job_request( job_id=job_id, api_version=self._config.api_version, headers=_headers, @@ -17129,7 +17276,7 @@ def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerati if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) + deserialized = _deserialize(_models.OptimizationJob, response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -17137,17 +17284,19 @@ def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerati return deserialized # type: ignore @distributed_trace - def list_generation_jobs( + def list_optimization_jobs( self, *, limit: Optional[int] = None, order: Optional[Union[str, _models.PageOrder]] = None, before: Optional[str] = None, + status: Optional[Union[str, _models.JobStatus]] = None, + agent_name: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.DataGenerationJob"]: - """List data generation jobs. + ) -> ItemPaged["_models.OptimizationJobListItem"]: + """Returns a list of agent optimization jobs. - Returns a list of data generation jobs. + List optimization jobs. Supports cursor pagination and optional status / agent_name filters. :keyword limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the @@ -17163,14 +17312,19 @@ def list_generation_jobs( subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. :paramtype before: str - :return: An iterator like instance of DataGenerationJob - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DataGenerationJob] + :keyword status: Filter to jobs in this lifecycle state. Known values are: "queued", + "in_progress", "succeeded", "failed", and "cancelled". Default value is None. + :paramtype status: str or ~azure.ai.projects.models.JobStatus + :keyword agent_name: Filter to jobs targeting this agent name. Default value is None. + :paramtype agent_name: str + :return: An iterator like instance of OptimizationJobListItem + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.OptimizationJobListItem] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DataGenerationJob]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OptimizationJobListItem]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17182,11 +17336,13 @@ def list_generation_jobs( def prepare_request(_continuation_token=None): - _request = build_beta_datasets_list_generation_jobs_request( + _request = build_beta_agents_list_optimization_jobs_request( limit=limit, order=order, after=_continuation_token, before=before, + status=status, + agent_name=agent_name, api_version=self._config.api_version, headers=_headers, params=_params, @@ -17200,7 +17356,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.DataGenerationJob], + List[_models.OptimizationJobListItem], deserialized.get("data", []), ) if cls: @@ -17228,180 +17384,17 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) - @overload - def create_generation_job( - self, - job: _models.DataGenerationJob, - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataGenerationJob: - """Create a data generation job. - - Submits a new data generation job for asynchronous execution. - - :param job: The job to create. Required. - :type job: ~azure.ai.projects.models.DataGenerationJob - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_generation_job( - self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.DataGenerationJob: - """Create a data generation job. - - Submits a new data generation job for asynchronous execution. - - :param job: The job to create. Required. - :type job: JSON - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_generation_job( - self, - job: IO[bytes], - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataGenerationJob: - """Create a data generation job. - - Submits a new data generation job for asynchronous execution. - - :param job: The job to create. Required. - :type job: IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_generation_job( - self, - job: Union[_models.DataGenerationJob, JSON, IO[bytes]], - *, - operation_id: Optional[str] = None, - **kwargs: Any - ) -> _models.DataGenerationJob: - """Create a data generation job. - - Submits a new data generation job for asynchronous execution. - - :param job: The job to create. Is one of the following types: DataGenerationJob, JSON, - IO[bytes] Required. - :type job: ~azure.ai.projects.models.DataGenerationJob or JSON or IO[bytes] - :keyword operation_id: Client-generated unique ID for idempotent retries. When absent, the - server creates the job unconditionally. Default value is None. - :paramtype operation_id: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(job, (IOBase, bytes)): - _content = job - else: - _content = json.dumps(job, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_beta_datasets_create_generation_job_request( - operation_id=operation_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error) - - response_headers = {} - response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - @distributed_trace - def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: - """Cancel a data generation job. + def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + """Cancels an agent optimization job. - Cancels the specified data generation job if it is still in progress. + Request cancellation of a running or queued job. Returns an error if the job is already in a + terminal state. :param job_id: The ID of the job to cancel. Required. :type job_id: str - :return: DataGenerationJob. The DataGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DataGenerationJob + :return: OptimizationJob. The OptimizationJob is compatible with MutableMapping + :rtype: ~azure.ai.projects.models.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17415,9 +17408,9 @@ def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGener _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DataGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) - _request = build_beta_datasets_cancel_generation_job_request( + _request = build_beta_agents_cancel_optimization_job_request( job_id=job_id, api_version=self._config.api_version, headers=_headers, @@ -17452,7 +17445,7 @@ def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGener if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) + deserialized = _deserialize(_models.OptimizationJob, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17460,12 +17453,12 @@ def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGener return deserialized # type: ignore @distributed_trace - def delete_generation_job( # pylint: disable=inconsistent-return-statements + def delete_optimization_job( # pylint: disable=inconsistent-return-statements self, job_id: str, **kwargs: Any ) -> None: - """Delete a data generation job. + """Deletes an agent optimization job. - Removes the specified data generation job and its associated output. + Delete the job and its candidate artifacts. Cancels first if non-terminal. :param job_id: The ID of the job to delete. Required. :type job_id: str @@ -17486,7 +17479,7 @@ def delete_generation_job( # pylint: disable=inconsistent-return-statements cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_beta_datasets_delete_generation_job_request( + _request = build_beta_agents_delete_optimization_job_request( job_id=job_id, api_version=self._config.api_version, headers=_headers, diff --git a/sdk/ai/azure-ai-projects/docs/subclients.md b/sdk/ai/azure-ai-projects/docs/subclients.md index e6e1523ad1e2..9815c65a0b6c 100644 --- a/sdk/ai/azure-ai-projects/docs/subclients.md +++ b/sdk/ai/azure-ai-projects/docs/subclients.md @@ -10,19 +10,20 @@ There are a total of 134 unique public methods across all sub-clients. | Subclient | Class Name | Methods Count | |-----------|------------|----------------| -| `agents` | AgentsOperations | 8 | +| `agents` | AgentsOperations | 21 | | `evaluation_rules` | EvaluationRulesOperations | 4 | | `connections` | ConnectionsOperations | 3 | | `datasets` | DatasetsOperations | 9 | | `deployments` | DeploymentsOperations | 2 | | `indexes` | IndexesOperations | 5 | | `telemetry` | TelemetryOperations | 1 | +| `toolboxes` | ToolboxesOperations | 8 | ### Nested Sub-clients (beta operations) | Subclient | Class Name | Methods Count | |-----------|------------|----------------| -| `beta.agents` | BetaAgentsOperations | 18 | +| `beta.agents` | BetaAgentsOperations | 5 | | `beta.datasets` | BetaDatasetsOperations | 5 | | `beta.evaluation_taxonomies` | BetaEvaluationTaxonomiesOperations | 5 | | `beta.evaluators` | BetaEvaluatorsOperations | 13 | @@ -33,12 +34,11 @@ There are a total of 134 unique public methods across all sub-clients. | `beta.routines` | BetaRoutinesOperations | 8 | | `beta.schedules` | BetaSchedulesOperations | 6 | | `beta.skills` | BetaSkillsOperations | 11 | -| `beta.toolboxes` | BetaToolboxesOperations | 8 | -## Method list table +## Stable methods -Alphabetically sorted, with ".beta" sub-client at the end. If the method is a new hand-written method, there will be an asterisk at the end. +Alphabetically sorted. An asterisk at the end of the method name means is a hand-written method. ``` .agents.create_version @@ -49,6 +49,19 @@ Alphabetically sorted, with ".beta" sub-client at the end. If the method is a ne .agents.get_version .agents.list .agents.list_versions +.agents.create_session +.agents.create_version_from_code +.agents.delete_session +.agents.delete_session_file +.agents.download_code +.agents.download_session_file +.agents.get_session +.agents.get_session_log_stream +.agents.list_session_files +.agents.list_sessions +.agents.patch_agent_details +.agents.stop_session +.agents.upload_session_file* .connections.get* .connections.get_default* @@ -80,24 +93,26 @@ Alphabetically sorted, with ".beta" sub-client at the end. If the method is a ne .telemetry.get_application_insights_connection_string* +.toolboxes.create_version +.toolboxes.delete +.toolboxes.delete_version +.toolboxes.get +.toolboxes.get_version +.toolboxes.list +.toolboxes.list_versions +.toolboxes.update +``` + +## Beta methods + +Alphabetically sorted. An asterisk at the end of the method name means is a hand-written method. + +``` .beta.agents.cancel_optimization_job .beta.agents.create_optimization_job -.beta.agents.create_session -.beta.agents.create_version_from_code .beta.agents.delete_optimization_job -.beta.agents.delete_session -.beta.agents.delete_session_file -.beta.agents.download_code -.beta.agents.download_session_file .beta.agents.get_optimization_job -.beta.agents.get_session -.beta.agents.get_session_log_stream .beta.agents.list_optimization_jobs -.beta.agents.list_session_files -.beta.agents.list_sessions -.beta.agents.patch_agent_details -.beta.agents.stop_session -.beta.agents.upload_session_file* .beta.datasets.cancel_generation_job .beta.datasets.create_generation_job @@ -184,13 +199,4 @@ Alphabetically sorted, with ".beta" sub-client at the end. If the method is a ne .beta.skills.list .beta.skills.list_versions .beta.skills.update - -.beta.toolboxes.create_version -.beta.toolboxes.delete -.beta.toolboxes.delete_version -.beta.toolboxes.get -.beta.toolboxes.get_version -.beta.toolboxes.list -.beta.toolboxes.list_versions -.beta.toolboxes.update ``` diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py index 63bdc57e0ee8..ca59e5aab6ec 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py @@ -17,7 +17,7 @@ those inner tools. Toolboxes and tool search are preview features. CRUD goes through - 'project_client.beta.toolboxes'. + 'project_client.toolboxes'. USAGE: python sample_toolboxes_with_search_preview.py @@ -72,7 +72,7 @@ project_connection_id=os.environ["MCP_PROJECT_CONNECTION_ID"], ) - toolbox_version = project_client.beta.toolboxes.create_version( + toolbox_version = project_client.toolboxes.create_version( name=TOOLBOX_NAME, description=f"Toolbox with `{INNER_MCP_LABEL}` MCP server and tool search enabled.", tools=[inner_mcp_tool, ToolboxSearchPreviewTool()], @@ -86,7 +86,6 @@ server_label=TOOLBOX_MCP_LABEL, server_url=toolbox_mcp_url, authorization=token, - headers={"Foundry-Features": "Toolboxes=V1Preview"}, require_approval="never", ) diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py index bfd43071c2f3..d10e025af59a 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py @@ -17,7 +17,7 @@ those inner tools. Toolboxes and tool search are preview features. CRUD goes through - 'project_client.beta.toolboxes'. + 'project_client.toolboxes'. USAGE: python sample_toolboxes_with_search_preview_async.py @@ -73,7 +73,7 @@ async def main() -> None: project_connection_id=os.environ["MCP_PROJECT_CONNECTION_ID"], ) - toolbox_version = await project_client.beta.toolboxes.create_version( + toolbox_version = await project_client.toolboxes.create_version( name=TOOLBOX_NAME, description=f"Toolbox with `{INNER_MCP_LABEL}` MCP server and tool search enabled.", tools=[inner_mcp_tool, ToolboxSearchPreviewTool()], @@ -87,7 +87,6 @@ async def main() -> None: server_label=TOOLBOX_MCP_LABEL, server_url=toolbox_mcp_url, authorization=token, - headers={"Foundry-Features": "Toolboxes=V1Preview"}, require_approval="never", ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint.py index 82be3e7df1ce..a821563ee063 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint.py @@ -65,7 +65,7 @@ agent = get_latest_active_agent_version(project_client, agent_name) - session = project_client.beta.agents.create_session( + session = project_client.agents.create_session( agent_name=agent_name, version_indicator=VersionRefIndicator(agent_version=agent.version), ) @@ -82,7 +82,7 @@ protocols=[AgentEndpointProtocol.RESPONSES], ) - patched_agent = project_client.beta.agents.patch_agent_details( + patched_agent = project_client.agents.patch_agent_details( agent_name=agent_name, agent_endpoint=endpoint_config, ) @@ -100,7 +100,7 @@ ) print(f"Response output: {response.output_text}") finally: - project_client.beta.agents.delete_session( + project_client.agents.delete_session( agent_name=agent_name, session_id=session.agent_session_id, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint_async.py index 94649b7ad73a..a8b3d4e5ceab 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint_async.py @@ -68,7 +68,7 @@ async def main(): agent = await get_latest_active_agent_version_async(project_client, agent_name) - session = await project_client.beta.agents.create_session( + session = await project_client.agents.create_session( agent_name=agent_name, version_indicator=VersionRefIndicator(agent_version=agent.version), ) @@ -85,7 +85,7 @@ async def main(): protocols=[AgentEndpointProtocol.RESPONSES], ) - patched_agent = await project_client.beta.agents.patch_agent_details( + patched_agent = await project_client.agents.patch_agent_details( agent_name=agent_name, agent_endpoint=endpoint_config, ) @@ -103,7 +103,7 @@ async def main(): ) print(f"Response output: {response.output_text}") finally: - await project_client.beta.agents.delete_session( + await project_client.agents.delete_session( agent_name=agent_name, session_id=session.agent_session_id, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py index cdd4a3396125..cf1fbf0af7ab 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code.py @@ -90,7 +90,7 @@ code=(zip_filename, code_zip_bytes, "application/zip"), ) - created = project_client.beta.agents.create_version_from_code( + created = project_client.agents.create_version_from_code( agent_name=agent_name, content=content, code_zip_sha256=code_zip_sha256, @@ -114,7 +114,7 @@ version_zip_path = Path(tempfile.gettempdir()) / f"{agent_name}-{created.version}.zip" sha = hashlib.sha256() with open(version_zip_path, "wb") as f: - for chunk in project_client.beta.agents.download_code( + for chunk in project_client.agents.download_code( agent_name=agent_name, agent_version=created.version, ): diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py index cd05ad4b472e..d3d27713f881 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_create_hosted_agent_from_code_async.py @@ -94,7 +94,7 @@ async def main() -> None: code=(zip_filename, code_zip_bytes, "application/zip"), ) - created = await project_client.beta.agents.create_version_from_code( + created = await project_client.agents.create_version_from_code( agent_name=agent_name, content=content, code_zip_sha256=code_zip_sha256, @@ -119,7 +119,7 @@ async def main() -> None: # Download the zip for the version we just created, streaming to a temp file. version_zip_path = Path(tempfile.gettempdir()) / f"{agent_name}-{created.version}.zip" sha = hashlib.sha256() - version_stream = await project_client.beta.agents.download_code( + version_stream = await project_client.agents.download_code( agent_name=agent_name, agent_version=created.version, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py index 8957839ec8f9..a55c716562b2 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py @@ -7,7 +7,7 @@ """ DESCRIPTION: This sample demonstrates how to stream hosted agent session logs - using `project_client.beta.agents.get_session_log_stream` with the + using `project_client.agents.get_session_log_stream` with the synchronous AIProjectClient. Sessions only work with Hosted Agents. @@ -97,7 +97,7 @@ def _iter_sse_frames(stream, max_log_events: int): project_client.get_openai_client(agent_name=agent_name) as openai_client, ): agent = get_latest_active_agent_version(project_client, agent_name) - session = project_client.beta.agents.create_session( + session = project_client.agents.create_session( agent_name=agent_name, version_indicator=VersionRefIndicator(agent_version=agent.version), ) @@ -112,7 +112,7 @@ def _iter_sse_frames(stream, max_log_events: int): protocols=[AgentEndpointProtocol.RESPONSES], ) - project_client.beta.agents.patch_agent_details( + project_client.agents.patch_agent_details( agent_name=agent_name, agent_endpoint=endpoint_config, ) @@ -129,7 +129,7 @@ def _iter_sse_frames(stream, max_log_events: int): print(f"Response output: {response.output_text}") print("Streaming session logs...") - raw_stream = project_client.beta.agents.get_session_log_stream( + raw_stream = project_client.agents.get_session_log_stream( agent_name=agent_name, agent_version=agent.version, session_id=session.agent_session_id, @@ -138,7 +138,7 @@ def _iter_sse_frames(stream, max_log_events: int): print(f"SSE event: {frame.get('event')}") print(f"SSE data: {frame.get('data')}\n") finally: - project_client.beta.agents.delete_session( + project_client.agents.delete_session( agent_name=agent_name, session_id=session.agent_session_id, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream_async.py index 3c2fe3bfa3d9..9908ad616bcc 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream_async.py @@ -7,7 +7,7 @@ """ DESCRIPTION: This sample demonstrates how to stream hosted agent session logs - using `project_client.beta.agents.get_session_log_stream` with the + using `project_client.agents.get_session_log_stream` with the asynchronous AIProjectClient. Sessions only work with Hosted Agents. @@ -127,7 +127,7 @@ async def main(): ) as project_client, ): agent = await get_latest_active_agent_version_async(project_client, agent_name) - session = await project_client.beta.agents.create_session( + session = await project_client.agents.create_session( agent_name=agent_name, version_indicator=VersionRefIndicator(agent_version=agent.version), ) @@ -142,7 +142,7 @@ async def main(): protocols=[AgentEndpointProtocol.RESPONSES], ) - await project_client.beta.agents.patch_agent_details( + await project_client.agents.patch_agent_details( agent_name=agent_name, agent_endpoint=endpoint_config, ) @@ -160,7 +160,7 @@ async def main(): print(f"Response output: {response.output_text}") print("Streaming session logs...") - raw_stream = await project_client.beta.agents.get_session_log_stream( + raw_stream = await project_client.agents.get_session_log_stream( agent_name=agent_name, agent_version=agent.version, session_id=session.agent_session_id, @@ -169,7 +169,7 @@ async def main(): print(f"SSE event: {frame.get('event')}") print(f"SSE data: {frame.get('data')}\n") finally: - await project_client.beta.agents.delete_session( + await project_client.agents.delete_session( agent_name=agent_name, session_id=session.agent_session_id, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud.py index 5ef49160a3fb..cbcc64f28cc4 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud.py @@ -31,10 +31,10 @@ SDK FUNCTIONS: - project_client.agents.list_versions: resolves the active version for the existing hosted agent. - - project_client.beta.agents.create_session: creates a session for the agent. - - project_client.beta.agents.get_session: retrieves a session by ID. - - project_client.beta.agents.list_sessions: lists sessions for an agent. - - project_client.beta.agents.delete_session: deletes a session by ID. + - project_client.agents.create_session: creates a session for the agent. + - project_client.agents.get_session: retrieves a session by ID. + - project_client.agents.list_sessions: lists sessions for an agent. + - project_client.agents.delete_session: deletes a session by ID. """ import os @@ -61,14 +61,14 @@ ) as project_client, ): agent = get_latest_active_agent_version(project_client, agent_name) - session = project_client.beta.agents.create_session( + session = project_client.agents.create_session( agent_name=agent_name, version_indicator=VersionRefIndicator(agent_version=agent.version), ) print(f"Created session (id: {session.agent_session_id}, status: {session.status})") # Retrieve the session by its ID - fetched = project_client.beta.agents.get_session( + fetched = project_client.agents.get_session( agent_name=agent_name, session_id=session.agent_session_id, ) @@ -76,12 +76,12 @@ # List sessions for the agent print("Listing sessions for the agent...") - sessions = project_client.beta.agents.list_sessions(agent_name=agent_name) + sessions = project_client.agents.list_sessions(agent_name=agent_name) print("Sessions:") for item in sessions: print(f" - {item.agent_session_id} (status: {item.status})") - project_client.beta.agents.delete_session( + project_client.agents.delete_session( agent_name=agent_name, session_id=session.agent_session_id, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud_async.py index 82362b933488..3dafc80fe44a 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud_async.py @@ -31,10 +31,10 @@ SDK FUNCTIONS: - project_client.agents.list_versions: resolves the active version for the existing hosted agent. - - project_client.beta.agents.create_session: creates a session for the agent. - - project_client.beta.agents.get_session: retrieves a session by ID. - - project_client.beta.agents.list_sessions: lists sessions for an agent. - - project_client.beta.agents.delete_session: deletes a session by ID. + - project_client.agents.create_session: creates a session for the agent. + - project_client.agents.get_session: retrieves a session by ID. + - project_client.agents.list_sessions: lists sessions for an agent. + - project_client.agents.delete_session: deletes a session by ID. """ import asyncio @@ -64,14 +64,14 @@ async def main(): ) as project_client, ): agent = await get_latest_active_agent_version_async(project_client, agent_name) - session = await project_client.beta.agents.create_session( + session = await project_client.agents.create_session( agent_name=agent_name, version_indicator=VersionRefIndicator(agent_version=agent.version), ) print(f"Created session (id: {session.agent_session_id}, status: {session.status})") # Retrieve the session by its ID - fetched = await project_client.beta.agents.get_session( + fetched = await project_client.agents.get_session( agent_name=agent_name, session_id=session.agent_session_id, ) @@ -79,12 +79,12 @@ async def main(): # List sessions for the agent print("Listing sessions for the agent...") - sessions = project_client.beta.agents.list_sessions(agent_name=agent_name) + sessions = project_client.agents.list_sessions(agent_name=agent_name) print("Sessions:") async for item in sessions: print(f" - {item.agent_session_id} (status: {item.status})") - await project_client.beta.agents.delete_session( + await project_client.agents.delete_session( agent_name=agent_name, session_id=session.agent_session_id, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py index 848c91609e38..d5f0385f50cd 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py @@ -63,14 +63,14 @@ ) as project_client, ): agent = get_latest_active_agent_version(project_client, agent_name) - session = project_client.beta.agents.create_session( + session = project_client.agents.create_session( agent_name=agent_name, version_indicator=VersionRefIndicator(agent_version=agent.version), ) print(f"Session created (id: {session.agent_session_id}, status: {session.status})") try: # Upload and list session files - project_client.beta.agents.upload_session_file( + project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, content_or_file_path=data_file1, @@ -78,7 +78,7 @@ ) print(f"Uploading session file: {data_file2} -> {remote_file_path2}") - project_client.beta.agents.upload_session_file( + project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, content_or_file_path=data_file2, @@ -86,7 +86,7 @@ ) print("Listing session files for the session at path '.'...") - files = project_client.beta.agents.list_session_files( + files = project_client.agents.list_session_files( agent_name=agent_name, agent_session_id=session.agent_session_id, path="/remote", @@ -96,7 +96,7 @@ print(f"Downloading and printing content from '{remote_file_path1}'") content_bytes = b"".join( - project_client.beta.agents.download_session_file( + project_client.agents.download_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, path=remote_file_path1, @@ -106,20 +106,20 @@ print(f"Session file content ({remote_file_path1}):\n{file_content}") print(f"Deleting session file at path: {remote_file_path1}...") - project_client.beta.agents.delete_session_file( + project_client.agents.delete_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, path=remote_file_path1, ) print(f"Deleting session file at path: {remote_file_path2}...") - project_client.beta.agents.delete_session_file( + project_client.agents.delete_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, path=remote_file_path2, ) finally: - project_client.beta.agents.delete_session( + project_client.agents.delete_session( agent_name=agent_name, session_id=session.agent_session_id, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py index 4fecd929aa47..d6f683cfc323 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py @@ -65,14 +65,14 @@ async def main(): ) as project_client, ): agent = await get_latest_active_agent_version_async(project_client, agent_name) - session = await project_client.beta.agents.create_session( + session = await project_client.agents.create_session( agent_name=agent_name, version_indicator=VersionRefIndicator(agent_version=agent.version), ) print(f"Session created (id: {session.agent_session_id}, status: {session.status})") try: # Upload and list session files - await project_client.beta.agents.upload_session_file( + await project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, content_or_file_path=data_file1, @@ -80,7 +80,7 @@ async def main(): ) print(f"Uploading session file: {data_file2} -> {remote_file_path2}") - await project_client.beta.agents.upload_session_file( + await project_client.agents.upload_session_file( agent_name=agent_name, session_id=session.agent_session_id, content_or_file_path=data_file2, @@ -88,7 +88,7 @@ async def main(): ) print("Listing session files for the session at path '.'...") - files = project_client.beta.agents.list_session_files( + files = project_client.agents.list_session_files( agent_name=agent_name, agent_session_id=session.agent_session_id, path="/remote", @@ -98,7 +98,7 @@ async def main(): print(f"Downloading and printing content from '{remote_file_path1}'") content_bytes = b"" - async for chunk in await project_client.beta.agents.download_session_file( + async for chunk in await project_client.agents.download_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, path=remote_file_path1, @@ -108,20 +108,20 @@ async def main(): print(f"Session file content ({remote_file_path1}):\n{file_content}") print(f"Deleting session file at path: {remote_file_path1}...") - await project_client.beta.agents.delete_session_file( + await project_client.agents.delete_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, path=remote_file_path1, ) print(f"Deleting session file at path: {remote_file_path2}...") - await project_client.beta.agents.delete_session_file( + await project_client.agents.delete_session_file( agent_name=agent_name, agent_session_id=session.agent_session_id, path=remote_file_path2, ) finally: - await project_client.beta.agents.delete_session( + await project_client.agents.delete_session( agent_name=agent_name, session_id=session.agent_session_id, ) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_skill_in_toolbox.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_skill_in_toolbox.py index af07a47bae37..5acd6832028f 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_skill_in_toolbox.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_skill_in_toolbox.py @@ -19,7 +19,7 @@ Skills and Toolboxes are currently preview features. In the Python SDK, you access these operations via `project_client.beta.skills` and - `project_client.beta.toolboxes`. + `project_client.toolboxes`. USAGE: python sample_skill_in_toolbox.py @@ -68,7 +68,7 @@ ): try: - project_client.beta.toolboxes.delete(TOOLBOX_NAME) + project_client.toolboxes.delete(TOOLBOX_NAME) except ResourceNotFoundError: pass @@ -92,7 +92,7 @@ ) print(f"Created skill: {skill_version.name} version={skill_version.version}") - toolbox_version = project_client.beta.toolboxes.create_version( + toolbox_version = project_client.toolboxes.create_version( name=TOOLBOX_NAME, description="Toolbox exposing a shipping-cost skill.", tools=[ToolboxSearchPreviewTool()], @@ -107,7 +107,6 @@ server_label="skill-toolbox", server_url=toolbox_mcp_url, authorization=token, - headers={"Foundry-Features": "Toolboxes=V1Preview"}, require_approval="never", ) @@ -149,7 +148,7 @@ print(f"Response: {response.output_text}") - project_client.beta.toolboxes.delete(TOOLBOX_NAME) + project_client.toolboxes.delete(TOOLBOX_NAME) print("Toolbox deleted") project_client.beta.skills.delete(SKILL_NAME) print("Skill deleted") diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py index 60ca6d1b969a..fadb722fe983 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py @@ -14,7 +14,7 @@ MCP `require_approval` setting from the fetched default version. Toolboxes are currently a preview feature. In the Python SDK, you access - these operations via `project_client.beta.toolboxes`. + these operations via `project_client.toolboxes`. USAGE: python sample_toolboxes_crud.py @@ -59,7 +59,7 @@ def print_mcp_require_approval(tools: list[Tool]) -> None: toolbox_name = "toolbox_with_mcp_tool" try: - project_client.beta.toolboxes.delete(toolbox_name) + project_client.toolboxes.delete(toolbox_name) print(f"Toolbox `{toolbox_name}` deleted") except ResourceNotFoundError: pass @@ -80,52 +80,52 @@ def print_mcp_require_approval(tools: list[Tool]) -> None: ) ] - created = project_client.beta.toolboxes.create_version( + created = project_client.toolboxes.create_version( name=toolbox_name, description="Toolbox version with MCP require_approval set to 'never'.", tools=tools_with_mcp_approval_required, ) print(f"Created toolbox: {created.name} with MCP tools requiring approval 'never' in version {created.version}") - created = project_client.beta.toolboxes.create_version( + created = project_client.toolboxes.create_version( name=toolbox_name, description="Toolbox version with MCP require_approval set to 'always'.", tools=tools_with_mcp_approval_always, ) print(f"Created toolbox: {created.name} with MCP tools requiring approval 'always' in version {created.version}") - updated = project_client.beta.toolboxes.update( + updated = project_client.toolboxes.update( toolbox_name, default_version="2", ) print(f"Updated toolbox: {updated.name} default version is now {updated.default_version}") - fetched = project_client.beta.toolboxes.get(name=toolbox_name) + fetched = project_client.toolboxes.get(name=toolbox_name) print(f"Retrieved toolbox with default version: {fetched.default_version}") - fetched_version = project_client.beta.toolboxes.get_version( + fetched_version = project_client.toolboxes.get_version( name=toolbox_name, version=fetched.default_version, ) print_mcp_require_approval(fetched_version.tools) - updated = project_client.beta.toolboxes.update( + updated = project_client.toolboxes.update( toolbox_name, default_version="1", ) print(f"Updated toolbox: {updated.name} default version is now {updated.default_version}") - fetched = project_client.beta.toolboxes.get(name=toolbox_name) + fetched = project_client.toolboxes.get(name=toolbox_name) print(f"Retrieved toolbox with default version: {fetched.default_version}") - fetched_version = project_client.beta.toolboxes.get_version( + fetched_version = project_client.toolboxes.get_version( name=toolbox_name, version=fetched.default_version, ) print_mcp_require_approval(fetched_version.tools) - toolboxes = list(project_client.beta.toolboxes.list()) + toolboxes = list(project_client.toolboxes.list()) print(f"Found {len(toolboxes)} toolboxes") for item in toolboxes: print(f" - {item.name} ({item.id})") - project_client.beta.toolboxes.delete(name=toolbox_name) + project_client.toolboxes.delete(name=toolbox_name) print("Toolbox deleted") diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py index 1721a5e6fdb0..dc8cb2049bac 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py @@ -14,7 +14,7 @@ MCP `require_approval` setting from the fetched default version. Toolboxes are currently a preview feature. In the Python SDK, you access - these operations via `project_client.beta.toolboxes`. + these operations via `project_client.toolboxes`. USAGE: python sample_toolboxes_crud_async.py @@ -60,7 +60,7 @@ async def main() -> None: toolbox_name = "toolbox_with_mcp_tool" try: - await project_client.beta.toolboxes.delete(toolbox_name) + await project_client.toolboxes.delete(toolbox_name) print(f"Toolbox `{toolbox_name}` deleted") except ResourceNotFoundError: pass @@ -81,14 +81,14 @@ async def main() -> None: ) ] - created = await project_client.beta.toolboxes.create_version( + created = await project_client.toolboxes.create_version( name=toolbox_name, description="Toolbox version with MCP require_approval set to 'never'.", tools=tools_with_mcp_approval_never, ) print(f"Created toolbox: {created.name} with MCP tools requiring approval 'never' in version {created.version}") - created = await project_client.beta.toolboxes.create_version( + created = await project_client.toolboxes.create_version( name=toolbox_name, description="Toolbox version with MCP require_approval set to 'always'.", tools=tools_with_mcp_approval_always, @@ -97,42 +97,42 @@ async def main() -> None: f"Created toolbox: {created.name} with MCP tools requiring approval 'always' in version {created.version}" ) - updated = await project_client.beta.toolboxes.update( + updated = await project_client.toolboxes.update( name=toolbox_name, default_version="2", ) print(f"Updated toolbox: {updated.name} default version is now {updated.default_version}") - fetched = await project_client.beta.toolboxes.get(name=toolbox_name) + fetched = await project_client.toolboxes.get(name=toolbox_name) print(f"Retrieved toolbox with default version: {fetched.default_version}") - fetched_version = await project_client.beta.toolboxes.get_version( + fetched_version = await project_client.toolboxes.get_version( name=toolbox_name, version=fetched.default_version, ) print_mcp_require_approval(fetched_version.tools) - updated = await project_client.beta.toolboxes.update( + updated = await project_client.toolboxes.update( toolbox_name, default_version="1", ) print(f"Updated toolbox: {updated.name} default version is now {updated.default_version}") - fetched = await project_client.beta.toolboxes.get(name=toolbox_name) + fetched = await project_client.toolboxes.get(name=toolbox_name) print(f"Retrieved toolbox with default version: {fetched.default_version}") - fetched_version = await project_client.beta.toolboxes.get_version( + fetched_version = await project_client.toolboxes.get_version( name=toolbox_name, version=fetched.default_version, ) print_mcp_require_approval(fetched_version.tools) toolboxes = [] - async for item in project_client.beta.toolboxes.list(): + async for item in project_client.toolboxes.list(): toolboxes.append(item) print(f"Found {len(toolboxes)} toolboxes") for item in toolboxes: print(f" - {item.name} ({item.id})") - await project_client.beta.toolboxes.delete(name=toolbox_name) + await project_client.toolboxes.delete(name=toolbox_name) print("Toolbox deleted") diff --git a/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py b/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py index 8aaa0adc7fcc..e66acbc28382 100644 --- a/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py +++ b/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py @@ -43,10 +43,9 @@ "red_teams": "RedTeams=V1Preview", "routines": "Routines=V1Preview", "schedules": "Schedules=V1Preview", - "toolboxes": "Toolboxes=V1Preview", "skills": "Skills=V1Preview", "datasets": "DataGenerationJobs=V1Preview", - "agents": "HostedAgents=V1Preview,WorkflowAgents=V1Preview,AgentEndpoints=V1Preview,CodeAgents=V1Preview,ExternalAgents=V1Preview,AgentsOptimization=V2Preview", + "agents": "WorkflowAgents=V1Preview,ExternalAgents=V1Preview,AgentsOptimization=V2Preview", } # Methods on .beta sub-clients that are NOT simple one-HTTP-call wrappers and diff --git a/sdk/ai/azure-ai-projects/tsp-location.yaml b/sdk/ai/azure-ai-projects/tsp-location.yaml index 99ceb36cff7f..8991217d553c 100644 --- a/sdk/ai/azure-ai-projects/tsp-location.yaml +++ b/sdk/ai/azure-ai-projects/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/ai-foundry/data-plane/Foundry/src/sdk-python-js-azure-ai-projects -commit: e67cdc6ec1f508a0384b8a9f89f7a367f5ca4fe1 +commit: ed970345c89c8758b74b08f740067cc2d854ed26 repo: Azure/azure-rest-api-specs additionalDirectories: - specification/ai-foundry/data-plane/Foundry/src/agents From 51d1104d15e41405d59143d4ee54217ad8447868 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Wed, 17 Jun 2026 16:13:34 -0700 Subject: [PATCH 02/12] Fix patched code --- .../azure/ai/projects/aio/operations/_patch.py | 4 ---- .../azure-ai-projects/azure/ai/projects/operations/_patch.py | 4 ---- 2 files changed, 8 deletions(-) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py index 9840dd5a6ac6..3fdf26467d47 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py @@ -28,7 +28,6 @@ BetaRoutinesOperations, BetaSchedulesOperations, BetaSkillsOperations, - BetaToolboxesOperations, ) @@ -60,8 +59,6 @@ class BetaOperations(GeneratedBetaOperations): """:class:`~azure.ai.projects.aio.operations.BetaRoutinesOperations` operations""" schedules: BetaSchedulesOperations """:class:`~azure.ai.projects.aio.operations.BetaSchedulesOperations` operations""" - toolboxes: BetaToolboxesOperations - """:class:`~azure.ai.projects.aio.operations.BetaToolboxesOperations` operations""" skills: BetaSkillsOperations """:class:`~azure.ai.projects.aio.operations.BetaSkillsOperations` operations""" datasets: BetaDatasetsOperations @@ -100,7 +97,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: "BetaRoutinesOperations", "BetaSchedulesOperations", "BetaSkillsOperations", - "BetaToolboxesOperations", "ConnectionsOperations", "DatasetsOperations", "EvaluationRulesOperations", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py index 29adf947b535..f81e1ceb403a 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py @@ -30,7 +30,6 @@ BetaRoutinesOperations, BetaSchedulesOperations, BetaSkillsOperations, - BetaToolboxesOperations, ) @@ -115,8 +114,6 @@ class BetaOperations(GeneratedBetaOperations): """:class:`~azure.ai.projects.operations.BetaRoutinesOperations` operations""" schedules: BetaSchedulesOperations """:class:`~azure.ai.projects.operations.BetaSchedulesOperations` operations""" - toolboxes: BetaToolboxesOperations - """:class:`~azure.ai.projects.operations.BetaToolboxesOperations` operations""" skills: BetaSkillsOperations """:class:`~azure.ai.projects.operations.BetaSkillsOperations` operations""" datasets: BetaDatasetsOperations @@ -155,7 +152,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: "BetaRoutinesOperations", "BetaSchedulesOperations", "BetaSkillsOperations", - "BetaToolboxesOperations", "ConnectionsOperations", "DatasetsOperations", "EvaluationRulesOperations", From 27d401b48a8684c393f3273ca3b11a8263e0e329 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Wed, 17 Jun 2026 16:56:58 -0700 Subject: [PATCH 03/12] fix tests --- .../foundry_features_header_test_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py b/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py index e66acbc28382..7f4bc5f908f2 100644 --- a/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py +++ b/sdk/ai/azure-ai-projects/tests/foundry_features_header/foundry_features_header_test_base.py @@ -83,7 +83,7 @@ # The test id is derived automatically from method_name. pytest.param( "agents.create_version", - "HostedAgents=V1Preview,WorkflowAgents=V1Preview,AgentEndpoints=V1Preview,CodeAgents=V1Preview,ExternalAgents=V1Preview,AgentsOptimization=V2Preview", + "WorkflowAgents=V1Preview,ExternalAgents=V1Preview,AgentsOptimization=V2Preview", ), pytest.param( "evaluation_rules.create_or_update", From 8b3c1257c55b70192ef70e2233ca9c3d2073a46c Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Wed, 17 Jun 2026 17:32:15 -0700 Subject: [PATCH 04/12] Fix --- sdk/ai/azure-ai-projects/api.md | 11396 ---------------- sdk/ai/azure-ai-projects/api.metadata.yml | 3 - .../ai/projects/aio/operations/_patch.py | 2 +- .../aio/operations/_patch_agents_async.py | 50 +- .../aio/operations/_patch_sessions_async.py | 74 - .../azure/ai/projects/operations/_patch.py | 2 +- .../ai/projects/operations/_patch_agents.py | 49 + .../ai/projects/operations/_patch_sessions.py | 74 - sdk/ai/azure-ai-projects/docs/subclients.md | 14 +- 9 files changed, 107 insertions(+), 11557 deletions(-) delete mode 100644 sdk/ai/azure-ai-projects/api.md delete mode 100644 sdk/ai/azure-ai-projects/api.metadata.yml delete mode 100644 sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_sessions_async.py delete mode 100644 sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_sessions.py diff --git a/sdk/ai/azure-ai-projects/api.md b/sdk/ai/azure-ai-projects/api.md deleted file mode 100644 index aa20e54a46e6..000000000000 --- a/sdk/ai/azure-ai-projects/api.md +++ /dev/null @@ -1,11396 +0,0 @@ -```py -namespace azure.ai.projects - - class azure.ai.projects.AIProjectClient(AIProjectClientGenerated): implements ContextManager - agents: AgentsOperations - beta: BetaOperations - connections: ConnectionsOperations - datasets: DatasetsOperations - deployments: DeploymentsOperations - evaluation_rules: EvaluationRulesOperations - indexes: IndexesOperations - - def __init__( - self, - endpoint: str, - credential: TokenCredential, - *, - allow_preview: bool = False, - api_version: str = ..., - **kwargs: Any - ) -> None: ... - - def close(self) -> None: ... - - @distributed_trace - def get_openai_client( - self, - *, - agent_name: Optional[str] = ..., - **kwargs: Any - ) -> OpenAI: ... - - def send_request( - self, - request: HttpRequest, - *, - stream: bool = False, - **kwargs: Any - ) -> HttpResponse: ... - - -namespace azure.ai.projects.aio - - class azure.ai.projects.aio.AIProjectClient(AIProjectClientGenerated): implements AsyncContextManager - agents: AgentsOperations - beta: BetaOperations - connections: ConnectionsOperations - datasets: DatasetsOperations - deployments: DeploymentsOperations - evaluation_rules: EvaluationRulesOperations - indexes: IndexesOperations - - def __init__( - self, - endpoint: str, - credential: AsyncTokenCredential, - *, - allow_preview: bool = False, - api_version: str = ..., - **kwargs: Any - ) -> None: ... - - async def close(self) -> None: ... - - @distributed_trace - def get_openai_client( - self, - *, - agent_name: Optional[str] = ..., - **kwargs: Any - ) -> AsyncOpenAI: ... - - def send_request( - self, - request: HttpRequest, - *, - stream: bool = False, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: ... - - -namespace azure.ai.projects.aio.operations - - class azure.ai.projects.aio.operations.AgentsOperations(GeneratedAgentsOperations): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create_version( - self, - agent_name: str, - *, - blueprint_reference: Optional[AgentBlueprintReference] = ..., - content_type: str = "application/json", - definition: AgentDefinition, - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - async def create_version( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - async def create_version( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - async def create_version_from_manifest( - self, - agent_name: str, - *, - content_type: str = "application/json", - description: Optional[str] = ..., - manifest_id: str, - metadata: Optional[dict[str, str]] = ..., - parameter_values: dict[str, Any], - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - async def create_version_from_manifest( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - async def create_version_from_manifest( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AgentVersionDetails: ... - - @distributed_trace_async - async def delete( - self, - agent_name: str, - *, - force: Optional[bool] = ..., - **kwargs: Any - ) -> DeleteAgentResponse: ... - - @distributed_trace_async - async def delete_version( - self, - agent_name: str, - agent_version: str, - *, - force: Optional[bool] = ..., - **kwargs: Any - ) -> DeleteAgentVersionResponse: ... - - @distributed_trace_async - async def get( - self, - agent_name: str, - **kwargs: Any - ) -> AgentDetails: ... - - @distributed_trace_async - async def get_version( - self, - agent_name: str, - agent_version: str, - **kwargs: Any - ) -> AgentVersionDetails: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - kind: Optional[Union[str, AgentKind]] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[AgentDetails]: ... - - @distributed_trace - def list_versions( - self, - agent_name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[AgentVersionDetails]: ... - - - class azure.ai.projects.aio.operations.BetaAgentsOperations(GeneratedBetaAgentsOperations): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def cancel_optimization_job( - self, - job_id: str, - **kwargs: Any - ) -> OptimizationJob: ... - - @overload - async def create_optimization_job( - self, - job: OptimizationJob, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> OptimizationJob: ... - - @overload - async def create_optimization_job( - self, - job: JSON, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> OptimizationJob: ... - - @overload - async def create_optimization_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> OptimizationJob: ... - - @overload - async def create_session( - self, - agent_name: str, - *, - agent_session_id: Optional[str] = ..., - content_type: str = "application/json", - user_isolation_key: Optional[str] = ..., - version_indicator: VersionIndicator, - **kwargs: Any - ) -> AgentSessionResource: ... - - @overload - async def create_session( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> AgentSessionResource: ... - - @overload - async def create_session( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> AgentSessionResource: ... - - @overload - async def create_version_from_code( - self, - agent_name: str, - content: CreateAgentVersionFromCodeContent, - *, - code_zip_sha256: str, - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - async def create_version_from_code( - self, - agent_name: str, - content: JSON, - *, - code_zip_sha256: str, - **kwargs: Any - ) -> AgentVersionDetails: ... - - @distributed_trace_async - async def delete_optimization_job( - self, - job_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def delete_session( - self, - agent_name: str, - session_id: str, - *, - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def delete_session_file( - self, - agent_name: str, - agent_session_id: str, - *, - path: str, - recursive: Optional[bool] = ..., - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def download_code( - self, - agent_name: str, - *, - agent_version: Optional[str] = ..., - **kwargs: Any - ) -> AsyncIterator[bytes]: ... - - @distributed_trace_async - async def download_session_file( - self, - agent_name: str, - agent_session_id: str, - *, - path: str, - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> AsyncIterator[bytes]: ... - - @distributed_trace_async - async def get_optimization_job( - self, - job_id: str, - **kwargs: Any - ) -> OptimizationJob: ... - - @distributed_trace_async - async def get_session( - self, - agent_name: str, - session_id: str, - *, - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> AgentSessionResource: ... - - @distributed_trace_async - async def get_session_log_stream( - self, - agent_name: str, - agent_version: str, - session_id: str, - **kwargs: Any - ) -> SessionLogEvent: ... - - @distributed_trace - def list_optimization_jobs( - self, - *, - agent_name: Optional[str] = ..., - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - status: Optional[Union[str, JobStatus]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[OptimizationJobListItem]: ... - - @distributed_trace - def list_session_files( - self, - agent_name: str, - agent_session_id: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - path: Optional[str] = ..., - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> AsyncItemPaged[SessionDirectoryEntry]: ... - - @distributed_trace - def list_sessions( - self, - agent_name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> AsyncItemPaged[AgentSessionResource]: ... - - @overload - async def patch_agent_details( - self, - agent_name: str, - *, - agent_card: Optional[AgentCard] = ..., - agent_endpoint: Optional[AgentEndpointConfig] = ..., - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AgentDetails: ... - - @overload - async def patch_agent_details( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AgentDetails: ... - - @overload - async def patch_agent_details( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AgentDetails: ... - - @distributed_trace_async - async def stop_session( - self, - agent_name: str, - session_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def upload_session_file( - self, - agent_name: str, - session_id: str, - content_or_file_path: bytes | str, - *, - path: str, - **kwargs: Any - ) -> SessionFileWriteResult: ... - - - class azure.ai.projects.aio.operations.BetaDatasetsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def cancel_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> DataGenerationJob: ... - - @overload - async def create_generation_job( - self, - job: DataGenerationJob, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> DataGenerationJob: ... - - @overload - async def create_generation_job( - self, - job: JSON, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> DataGenerationJob: ... - - @overload - async def create_generation_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> DataGenerationJob: ... - - @distributed_trace_async - async def delete_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def get_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> DataGenerationJob: ... - - @distributed_trace - def list_generation_jobs( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[DataGenerationJob]: ... - - - class azure.ai.projects.aio.operations.BetaEvaluationTaxonomiesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create( - self, - name: str, - taxonomy: EvaluationTaxonomy, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @overload - async def create( - self, - name: str, - taxonomy: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @overload - async def create( - self, - name: str, - taxonomy: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @distributed_trace_async - async def delete( - self, - name: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def get( - self, - name: str, - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @distributed_trace - def list( - self, - *, - input_name: Optional[str] = ..., - input_type: Optional[str] = ..., - **kwargs: Any - ) -> AsyncItemPaged[EvaluationTaxonomy]: ... - - @overload - async def update( - self, - name: str, - taxonomy: EvaluationTaxonomy, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @overload - async def update( - self, - name: str, - taxonomy: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @overload - async def update( - self, - name: str, - taxonomy: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - - class azure.ai.projects.aio.operations.BetaEvaluatorsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def cancel_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @overload - async def create_generation_job( - self, - job: EvaluatorGenerationJob, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @overload - async def create_generation_job( - self, - job: JSON, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @overload - async def create_generation_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @overload - async def create_version( - self, - name: str, - evaluator_version: EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @overload - async def create_version( - self, - name: str, - evaluator_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @overload - async def create_version( - self, - name: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @distributed_trace_async - async def delete_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def delete_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: EvaluatorCredentialRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @distributed_trace_async - async def get_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @distributed_trace_async - async def get_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> EvaluatorVersion: ... - - @distributed_trace - def list( - self, - *, - limit: Optional[int] = ..., - type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[EvaluatorVersion]: ... - - @distributed_trace - def list_generation_jobs( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[EvaluatorGenerationJob]: ... - - @distributed_trace - def list_versions( - self, - name: str, - *, - limit: Optional[int] = ..., - type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[EvaluatorVersion]: ... - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: PendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - async def update_version( - self, - name: str, - version: str, - evaluator_version: EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @overload - async def update_version( - self, - name: str, - version: str, - evaluator_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @overload - async def update_version( - self, - name: str, - version: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - - class azure.ai.projects.aio.operations.BetaInsightsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def generate( - self, - insight: Insight, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Insight: ... - - @overload - async def generate( - self, - insight: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Insight: ... - - @overload - async def generate( - self, - insight: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Insight: ... - - @distributed_trace_async - async def get( - self, - insight_id: str, - *, - include_coordinates: Optional[bool] = ..., - **kwargs: Any - ) -> Insight: ... - - @distributed_trace - def list( - self, - *, - agent_name: Optional[str] = ..., - eval_id: Optional[str] = ..., - include_coordinates: Optional[bool] = ..., - run_id: Optional[str] = ..., - type: Optional[Union[str, InsightType]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[Insight]: ... - - - class azure.ai.projects.aio.operations.BetaMemoryStoresOperations(GenerateBetaMemoryStoresOperations): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def begin_update_memories( - self, - name: str, - *, - content_type: str = "application/json", - items: Optional[Union[str, ResponseInputParam]] = ..., - previous_update_id: Optional[str] = ..., - scope: str, - update_delay: Optional[int] = ..., - **kwargs: Any - ) -> AsyncUpdateMemoriesLROPoller: ... - - @overload - async def begin_update_memories( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncUpdateMemoriesLROPoller: ... - - @overload - async def begin_update_memories( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncUpdateMemoriesLROPoller: ... - - @overload - async def create( - self, - *, - content_type: str = "application/json", - definition: MemoryStoreDefinition, - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - name: str, - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - async def create( - self, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - async def create( - self, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - async def create_memory( - self, - name: str, - *, - content: str, - content_type: str = "application/json", - kind: Union[str, MemoryItemKind], - scope: str, - **kwargs: Any - ) -> MemoryItem: ... - - @overload - async def create_memory( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - @overload - async def create_memory( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - @distributed_trace_async - async def delete( - self, - name: str, - **kwargs: Any - ) -> DeleteMemoryStoreResult: ... - - @distributed_trace_async - async def delete_memory( - self, - name: str, - memory_id: str, - **kwargs: Any - ) -> DeleteMemoryResult: ... - - @overload - async def delete_scope( - self, - name: str, - *, - content_type: str = "application/json", - scope: str, - **kwargs: Any - ) -> MemoryStoreDeleteScopeResult: ... - - @overload - async def delete_scope( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDeleteScopeResult: ... - - @overload - async def delete_scope( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDeleteScopeResult: ... - - @distributed_trace_async - async def get( - self, - name: str, - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @distributed_trace_async - async def get_memory( - self, - name: str, - memory_id: str, - **kwargs: Any - ) -> MemoryItem: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[MemoryStoreDetails]: ... - - @overload - def list_memories( - self, - name: str, - *, - before: Optional[str] = ..., - content_type: str = "application/json", - kind: Optional[Union[str, MemoryItemKind]] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - scope: str, - **kwargs: Any - ) -> AsyncItemPaged[MemoryItem]: ... - - @overload - def list_memories( - self, - name: str, - body: JSON, - *, - before: Optional[str] = ..., - content_type: str = "application/json", - kind: Optional[Union[str, MemoryItemKind]] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[MemoryItem]: ... - - @overload - def list_memories( - self, - name: str, - body: IO[bytes], - *, - before: Optional[str] = ..., - content_type: str = "application/json", - kind: Optional[Union[str, MemoryItemKind]] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[MemoryItem]: ... - - @overload - async def search_memories( - self, - name: str, - *, - content_type: str = "application/json", - items: Optional[Union[str, ResponseInputParam]] = ..., - options: Optional[MemorySearchOptions] = ..., - previous_search_id: Optional[str] = ..., - scope: str, - **kwargs: Any - ) -> MemoryStoreSearchResult: ... - - @overload - async def search_memories( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreSearchResult: ... - - @overload - async def search_memories( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreSearchResult: ... - - @overload - async def update( - self, - name: str, - *, - content_type: str = "application/json", - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - async def update( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - async def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - async def update_memory( - self, - name: str, - memory_id: str, - *, - content: str, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - @overload - async def update_memory( - self, - name: str, - memory_id: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - @overload - async def update_memory( - self, - name: str, - memory_id: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - - class azure.ai.projects.aio.operations.BetaModelsOperations(BetaModelsOperationsGenerated): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create( - self, - *, - base_model: Optional[str] = ..., - description: Optional[str] = ..., - name: str, - polling_interval: float = 2.0, - polling_timeout: float = 300.0, - source: Union[str, PathLike[str]], - tags: Optional[dict[str, str]] = ..., - version: str, - wait_for_commit: Literal[True] = True, - weight_type: Optional[str] = ..., - **kwargs: Any - ) -> ModelVersion: ... - - @overload - async def create( - self, - *, - base_model: Optional[str] = ..., - description: Optional[str] = ..., - name: str, - polling_interval: float = 2.0, - polling_timeout: float = 300.0, - source: Union[str, PathLike[str]], - tags: Optional[dict[str, str]] = ..., - version: str, - wait_for_commit: Literal[False], - weight_type: Optional[str] = ..., - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def delete( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def get( - self, - name: str, - version: str, - **kwargs: Any - ) -> ModelVersion: ... - - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: ModelCredentialRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged[ModelVersion]: ... - - @distributed_trace - def list_versions( - self, - name: str, - **kwargs: Any - ) -> AsyncItemPaged[ModelVersion]: ... - - @overload - async def pending_create_version( - self, - name: str, - version: str, - model_version: ModelVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> CreateAsyncResponse: ... - - @overload - async def pending_create_version( - self, - name: str, - version: str, - model_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> CreateAsyncResponse: ... - - @overload - async def pending_create_version( - self, - name: str, - version: str, - model_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> CreateAsyncResponse: ... - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: ModelPendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ModelPendingUploadResponse: ... - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ModelPendingUploadResponse: ... - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ModelPendingUploadResponse: ... - - @overload - async def update( - self, - name: str, - version: str, - model_version_update: UpdateModelVersionRequest, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> ModelVersion: ... - - @overload - async def update( - self, - name: str, - version: str, - model_version_update: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> ModelVersion: ... - - @overload - async def update( - self, - name: str, - version: str, - model_version_update: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> ModelVersion: ... - - - class azure.ai.projects.aio.operations.BetaOperations(GeneratedBetaOperations): - agents: BetaAgentsOperations - datasets: BetaDatasetsOperations - evaluation_taxonomies: BetaEvaluationTaxonomiesOperations - evaluators: BetaEvaluatorsOperations - insights: BetaInsightsOperations - memory_stores: BetaMemoryStoresOperations - models: BetaModelsOperations - red_teams: BetaRedTeamsOperations - routines: BetaRoutinesOperations - schedules: BetaSchedulesOperations - skills: BetaSkillsOperations - toolboxes: BetaToolboxesOperations - - def __init__( - self, - *args: Any, - **kwargs: Any - ) -> None: ... - - - class azure.ai.projects.aio.operations.BetaRedTeamsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create( - self, - red_team: RedTeam, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> RedTeam: ... - - @overload - async def create( - self, - red_team: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> RedTeam: ... - - @overload - async def create( - self, - red_team: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> RedTeam: ... - - @distributed_trace_async - async def get( - self, - name: str, - **kwargs: Any - ) -> RedTeam: ... - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged[RedTeam]: ... - - - class azure.ai.projects.aio.operations.BetaRoutinesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create_or_update( - self, - routine_name: str, - *, - action: Optional[RoutineAction] = ..., - content_type: str = "application/json", - description: Optional[str] = ..., - enabled: Optional[bool] = ..., - triggers: Optional[dict[str, RoutineTrigger]] = ..., - **kwargs: Any - ) -> Routine: ... - - @overload - async def create_or_update( - self, - routine_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Routine: ... - - @overload - async def create_or_update( - self, - routine_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Routine: ... - - @distributed_trace_async - async def delete( - self, - routine_name: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def disable( - self, - routine_name: str, - **kwargs: Any - ) -> Routine: ... - - @overload - async def dispatch( - self, - routine_name: str, - *, - content_type: str = "application/json", - payload: Optional[RoutineDispatchPayload] = ..., - **kwargs: Any - ) -> DispatchRoutineResult: ... - - @overload - async def dispatch( - self, - routine_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DispatchRoutineResult: ... - - @overload - async def dispatch( - self, - routine_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DispatchRoutineResult: ... - - @distributed_trace_async - async def enable( - self, - routine_name: str, - **kwargs: Any - ) -> Routine: ... - - @distributed_trace_async - async def get( - self, - routine_name: str, - **kwargs: Any - ) -> Routine: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[str] = ..., - **kwargs: Any - ) -> AsyncItemPaged[Routine]: ... - - @distributed_trace - def list_runs( - self, - routine_name: str, - *, - before: Optional[str] = ..., - filter: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[str] = ..., - **kwargs: Any - ) -> AsyncItemPaged[RoutineRun]: ... - - - class azure.ai.projects.aio.operations.BetaSchedulesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create_or_update( - self, - schedule_id: str, - schedule: Schedule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Schedule: ... - - @overload - async def create_or_update( - self, - schedule_id: str, - schedule: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Schedule: ... - - @overload - async def create_or_update( - self, - schedule_id: str, - schedule: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Schedule: ... - - @distributed_trace_async - async def delete( - self, - schedule_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def get( - self, - schedule_id: str, - **kwargs: Any - ) -> Schedule: ... - - @distributed_trace_async - async def get_run( - self, - schedule_id: str, - run_id: str, - **kwargs: Any - ) -> ScheduleRun: ... - - @distributed_trace - def list( - self, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[Schedule]: ... - - @distributed_trace - def list_runs( - self, - schedule_id: str, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[ScheduleRun]: ... - - - class azure.ai.projects.aio.operations.BetaSkillsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create( - self, - name: str, - *, - content_type: str = "application/json", - default: Optional[bool] = ..., - inline_content: Optional[SkillInlineContent] = ..., - **kwargs: Any - ) -> SkillVersion: ... - - @overload - async def create( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillVersion: ... - - @overload - async def create( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillVersion: ... - - @overload - async def create_from_files( - self, - name: str, - content: CreateSkillVersionFromFilesBody, - **kwargs: Any - ) -> SkillVersion: ... - - @overload - async def create_from_files( - self, - name: str, - content: JSON, - **kwargs: Any - ) -> SkillVersion: ... - - @distributed_trace_async - async def delete( - self, - name: str, - **kwargs: Any - ) -> DeleteSkillResult: ... - - @distributed_trace_async - async def delete_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> DeleteSkillVersionResult: ... - - @distributed_trace_async - async def download( - self, - name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: ... - - @distributed_trace_async - async def download_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: ... - - @distributed_trace_async - async def get( - self, - name: str, - **kwargs: Any - ) -> SkillDetails: ... - - @distributed_trace_async - async def get_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> SkillVersion: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[SkillDetails]: ... - - @distributed_trace - def list_versions( - self, - name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[SkillVersion]: ... - - @overload - async def update( - self, - name: str, - *, - content_type: str = "application/json", - default_version: str, - **kwargs: Any - ) -> SkillDetails: ... - - @overload - async def update( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillDetails: ... - - @overload - async def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillDetails: ... - - - class azure.ai.projects.aio.operations.BetaToolboxesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create_version( - self, - name: str, - *, - content_type: str = "application/json", - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - policies: Optional[ToolboxPolicies] = ..., - skills: Optional[List[ToolboxSkill]] = ..., - tools: List[Tool], - **kwargs: Any - ) -> ToolboxVersionObject: ... - - @overload - async def create_version( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ToolboxVersionObject: ... - - @overload - async def create_version( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ToolboxVersionObject: ... - - @distributed_trace_async - async def delete( - self, - name: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def delete_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def get( - self, - name: str, - **kwargs: Any - ) -> ToolboxObject: ... - - @distributed_trace_async - async def get_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> ToolboxVersionObject: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[ToolboxObject]: ... - - @distributed_trace - def list_versions( - self, - name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> AsyncItemPaged[ToolboxVersionObject]: ... - - @overload - async def update( - self, - name: str, - *, - content_type: str = "application/json", - default_version: str, - **kwargs: Any - ) -> ToolboxObject: ... - - @overload - async def update( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ToolboxObject: ... - - @overload - async def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ToolboxObject: ... - - - class azure.ai.projects.aio.operations.ConnectionsOperations(ConnectionsOperationsGenerated): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def get( - self, - name: str, - *, - include_credentials: Optional[bool] = False, - **kwargs: Any - ) -> Connection: ... - - @distributed_trace_async - async def get_default( - self, - connection_type: Union[str, ConnectionType], - *, - include_credentials: Optional[bool] = False, - **kwargs: Any - ) -> Connection: ... - - @distributed_trace - def list( - self, - *, - connection_type: Optional[Union[str, ConnectionType]] = ..., - default_connection: Optional[bool] = ..., - **kwargs: Any - ) -> AsyncItemPaged[Connection]: ... - - - class azure.ai.projects.aio.operations.DatasetsOperations(DatasetsOperationsGenerated): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create_or_update( - self, - name: str, - version: str, - dataset_version: DatasetVersion, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> DatasetVersion: ... - - @overload - async def create_or_update( - self, - name: str, - version: str, - dataset_version: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> DatasetVersion: ... - - @overload - async def create_or_update( - self, - name: str, - version: str, - dataset_version: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> DatasetVersion: ... - - @distributed_trace_async - async def delete( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def get( - self, - name: str, - version: str, - **kwargs: Any - ) -> DatasetVersion: ... - - @distributed_trace_async - async def get_credentials( - self, - name: str, - version: str, - **kwargs: Any - ) -> DatasetCredential: ... - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged[DatasetVersion]: ... - - @distributed_trace - def list_versions( - self, - name: str, - **kwargs: Any - ) -> AsyncItemPaged[DatasetVersion]: ... - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: PendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @distributed_trace_async - async def upload_file( - self, - *, - connection_name: Optional[str] = ..., - file_path: str, - name: str, - version: str, - **kwargs: Any - ) -> FileDatasetVersion: ... - - @distributed_trace_async - async def upload_folder( - self, - *, - connection_name: Optional[str] = ..., - file_pattern: Optional[Pattern] = ..., - folder: str, - name: str, - version: str, - **kwargs: Any - ) -> FolderDatasetVersion: ... - - - class azure.ai.projects.aio.operations.DeploymentsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace_async - async def get( - self, - name: str, - **kwargs: Any - ) -> Deployment: ... - - @distributed_trace - def list( - self, - *, - deployment_type: Optional[Union[str, DeploymentType]] = ..., - model_name: Optional[str] = ..., - model_publisher: Optional[str] = ..., - **kwargs: Any - ) -> AsyncItemPaged[Deployment]: ... - - - class azure.ai.projects.aio.operations.EvaluationRulesOperations(GeneratedEvaluationRulesOperations): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create_or_update( - self, - id: str, - evaluation_rule: EvaluationRule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationRule: ... - - @overload - async def create_or_update( - self, - id: str, - evaluation_rule: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationRule: ... - - @overload - async def create_or_update( - self, - id: str, - evaluation_rule: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationRule: ... - - @distributed_trace_async - async def delete( - self, - id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def get( - self, - id: str, - **kwargs: Any - ) -> EvaluationRule: ... - - @distributed_trace - def list( - self, - *, - action_type: Optional[Union[str, EvaluationRuleActionType]] = ..., - agent_name: Optional[str] = ..., - enabled: Optional[bool] = ..., - **kwargs: Any - ) -> AsyncItemPaged[EvaluationRule]: ... - - - class azure.ai.projects.aio.operations.IndexesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - async def create_or_update( - self, - name: str, - version: str, - index: Index, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> Index: ... - - @overload - async def create_or_update( - self, - name: str, - version: str, - index: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> Index: ... - - @overload - async def create_or_update( - self, - name: str, - version: str, - index: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> Index: ... - - @distributed_trace_async - async def delete( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace_async - async def get( - self, - name: str, - version: str, - **kwargs: Any - ) -> Index: ... - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged[Index]: ... - - @distributed_trace - def list_versions( - self, - name: str, - **kwargs: Any - ) -> AsyncItemPaged[Index]: ... - - - class azure.ai.projects.aio.operations.TelemetryOperations: - - def __init__(self, outer_instance: AIProjectClient) -> None: ... - - @distributed_trace_async - async def get_application_insights_connection_string(self) -> str: ... - - -namespace azure.ai.projects.models - - class azure.ai.projects.models.A2APreviewTool(Tool, discriminator='a2a_preview'): - agent_card_path: Optional[str] - base_url: Optional[str] - description: Optional[str] - name: Optional[str] - project_connection_id: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.A2A_PREVIEW] - - @overload - def __init__( - self, - *, - agent_card_path: Optional[str] = ..., - base_url: Optional[str] = ..., - description: Optional[str] = ..., - name: Optional[str] = ..., - project_connection_id: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AISearchIndexResource(_Model): - filter: Optional[str] - index_asset_id: Optional[str] - index_name: Optional[str] - project_connection_id: Optional[str] - query_type: Optional[Union[str, AzureAISearchQueryType]] - top_k: Optional[int] - - @overload - def __init__( - self, - *, - filter: Optional[str] = ..., - index_asset_id: Optional[str] = ..., - index_name: Optional[str] = ..., - project_connection_id: Optional[str] = ..., - query_type: Optional[Union[str, AzureAISearchQueryType]] = ..., - top_k: Optional[int] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentBlueprintReference(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentBlueprintReferenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - MANAGED_AGENT_IDENTITY_BLUEPRINT = "ManagedAgentIdentityBlueprint" - - - class azure.ai.projects.models.AgentCard(_Model): - description: Optional[str] - skills: list[AgentCardSkill] - version: str - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - skills: list[AgentCardSkill], - version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentCardSkill(_Model): - description: Optional[str] - examples: Optional[list[str]] - id: str - name: str - tags: Optional[list[str]] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - examples: Optional[list[str]] = ..., - id: str, - name: str, - tags: Optional[list[str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentClusterInsightRequest(InsightRequest, discriminator='AgentClusterInsight'): - agent_name: str - model_configuration: Optional[InsightModelConfiguration] - type: Literal[InsightType.AGENT_CLUSTER_INSIGHT] - - @overload - def __init__( - self, - *, - agent_name: str, - model_configuration: Optional[InsightModelConfiguration] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentClusterInsightResult(InsightResult, discriminator='AgentClusterInsight'): - cluster_insight: ClusterInsightResult - type: Literal[InsightType.AGENT_CLUSTER_INSIGHT] - - @overload - def __init__( - self, - *, - cluster_insight: ClusterInsightResult - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentDataGenerationJobSource(DataGenerationJobSource, discriminator='agent'): - agent_name: str - agent_version: Optional[str] - description: str - type: Literal[DataGenerationJobSourceType.AGENT] - - @overload - def __init__( - self, - *, - agent_name: str, - agent_version: Optional[str] = ..., - description: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentDefinition(_Model): - kind: str - rai_config: Optional[RaiConfig] - - @overload - def __init__( - self, - *, - kind: str, - rai_config: Optional[RaiConfig] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentDetails(_Model): - agent_card: Optional[AgentCard] - agent_endpoint: Optional[AgentEndpointConfig] - blueprint: Optional[AgentIdentity] - blueprint_reference: Optional[AgentBlueprintReference] - id: str - instance_identity: Optional[AgentIdentity] - name: str - object: Literal[AgentObjectType.AGENT] - versions: AgentObjectVersions - - @overload - def __init__( - self, - *, - agent_card: Optional[AgentCard] = ..., - agent_endpoint: Optional[AgentEndpointConfig] = ..., - id: str, - name: str, - object: Literal[AgentObjectType.AGENT], - versions: AgentObjectVersions - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentEndpointAuthorizationScheme(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentEndpointAuthorizationSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - BOT_SERVICE = "BotService" - BOT_SERVICE_RBAC = "BotServiceRbac" - ENTRA = "Entra" - - - class azure.ai.projects.models.AgentEndpointConfig(_Model): - authorization_schemes: Optional[list[AgentEndpointAuthorizationScheme]] - protocols: Optional[list[Union[str, AgentEndpointProtocol]]] - version_selector: Optional[VersionSelector] - - @overload - def __init__( - self, - *, - authorization_schemes: Optional[list[AgentEndpointAuthorizationScheme]] = ..., - protocols: Optional[list[Union[str, AgentEndpointProtocol]]] = ..., - version_selector: Optional[VersionSelector] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentEndpointProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - A2A = "a2a" - ACTIVITY = "activity" - INVOCATIONS = "invocations" - INVOCATIONS_WS = "invocations_ws" - MCP = "mcp" - RESPONSES = "responses" - - - class azure.ai.projects.models.AgentEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator='agent'): - agent_name: str - agent_version: Optional[str] - description: Optional[str] - type: Literal[EvaluatorGenerationJobSourceType.AGENT] - - @overload - def __init__( - self, - *, - agent_name: str, - agent_version: Optional[str] = ..., - description: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentIdentity(_Model): - client_id: str - principal_id: str - - @overload - def __init__( - self, - *, - client_id: str, - principal_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - EXTERNAL = "external" - HOSTED = "hosted" - PROMPT = "prompt" - WORKFLOW = "workflow" - - - class azure.ai.projects.models.AgentObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AGENT = "agent" - AGENT_CONTAINER = "agent.container" - AGENT_DELETED = "agent.deleted" - AGENT_VERSION = "agent.version" - AGENT_VERSION_DELETED = "agent.version.deleted" - - - class azure.ai.projects.models.AgentObjectVersions(_Model): - latest: AgentVersionDetails - - @overload - def __init__( - self, - *, - latest: AgentVersionDetails - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - A2A = "a2a" - ACTIVITY_PROTOCOL = "activity_protocol" - INVOCATIONS = "invocations" - INVOCATIONS_WS = "invocations_ws" - MCP = "mcp" - RESPONSES = "responses" - - - class azure.ai.projects.models.AgentSessionResource(_Model): - agent_session_id: str - created_at: datetime - expires_at: datetime - last_accessed_at: datetime - status: Union[str, AgentSessionStatus] - version_indicator: VersionIndicator - - @overload - def __init__( - self, - *, - agent_session_id: str, - status: Union[str, AgentSessionStatus], - version_indicator: VersionIndicator - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentSessionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - ACTIVE = "active" - CREATING = "creating" - DELETED = "deleted" - DELETING = "deleting" - EXPIRED = "expired" - FAILED = "failed" - IDLE = "idle" - UPDATING = "updating" - - - class azure.ai.projects.models.AgentTaxonomyInput(EvaluationTaxonomyInput, discriminator='agent'): - risk_categories: list[Union[str, RiskCategory]] - target: EvaluationTarget - type: Literal[EvaluationTaxonomyInputType.AGENT] - - @overload - def __init__( - self, - *, - risk_categories: list[Union[str, RiskCategory]], - target: EvaluationTarget - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentVersionDetails(_Model): - agent_guid: Optional[str] - blueprint: Optional[AgentIdentity] - blueprint_reference: Optional[AgentBlueprintReference] - created_at: datetime - definition: AgentDefinition - description: Optional[str] - id: str - instance_identity: Optional[AgentIdentity] - metadata: dict[str, str] - name: str - object: Literal[AgentObjectType.AGENT_VERSION] - status: Optional[Union[str, AgentVersionStatus]] - version: str - - @overload - def __init__( - self, - *, - created_at: datetime, - definition: AgentDefinition, - description: Optional[str] = ..., - id: str, - metadata: dict[str, str], - name: str, - object: Literal[AgentObjectType.AGENT_VERSION], - status: Optional[Union[str, AgentVersionStatus]] = ..., - version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AgentVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - ACTIVE = "active" - CREATING = "creating" - DELETED = "deleted" - DELETING = "deleting" - FAILED = "failed" - - - class azure.ai.projects.models.AgenticIdentityPreviewCredentials(BaseCredentials, discriminator='AgenticIdentityToken_Preview'): - type: Literal[CredentialType.AGENTIC_IDENTITY_PREVIEW] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ApiError(_Model): - additional_info: Optional[dict[str, Any]] - code: str - debug_info: Optional[dict[str, Any]] - details: Optional[list[ApiError]] - message: str - param: Optional[str] - type: Optional[str] - - @overload - def __init__( - self, - *, - additional_info: Optional[dict[str, Any]] = ..., - code: str, - debug_info: Optional[dict[str, Any]] = ..., - details: Optional[list[ApiError]] = ..., - message: str, - param: Optional[str] = ..., - type: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ApiErrorResponse(_Model): - error: ApiError - - @overload - def __init__( - self, - *, - error: ApiError - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ApiKeyCredentials(BaseCredentials, discriminator='ApiKey'): - api_key: Optional[str] - type: Literal[CredentialType.API_KEY] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ApplyPatchToolParam(Tool, discriminator='apply_patch'): - type: Literal[ToolType.APPLY_PATCH] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ApproximateLocation(_Model): - city: Optional[str] - country: Optional[str] - region: Optional[str] - timezone: Optional[str] - type: Literal["approximate"] - - @overload - def __init__( - self, - *, - city: Optional[str] = ..., - country: Optional[str] = ..., - region: Optional[str] = ..., - timezone: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ArtifactProfile(_Model): - category: Union[str, FoundryModelArtifactProfileCategory] - signals: Optional[list[Union[str, FoundryModelArtifactProfileSignal]]] - - @overload - def __init__( - self, - *, - category: Union[str, FoundryModelArtifactProfileCategory], - signals: Optional[list[Union[str, FoundryModelArtifactProfileSignal]]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AsyncUpdateMemoriesLROPoller(AsyncLROPoller[MemoryStoreUpdateCompletedResult]): - property superseded_by: Optional[str] # Read-only - property update_id: str # Read-only - - @classmethod - def from_continuation_token( - cls, - polling_method: AsyncPollingMethod[MemoryStoreUpdateCompletedResult], - continuation_token: str, - **kwargs: Any - ) -> AsyncUpdateMemoriesLROPoller: ... - - - class azure.ai.projects.models.AttackStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - ANSI_ATTACK = "ansi_attack" - ASCII_ART = "ascii_art" - ASCII_SMUGGLER = "ascii_smuggler" - ATBASH = "atbash" - BASE64 = "base64" - BASELINE = "baseline" - BINARY = "binary" - CAESAR = "caesar" - CHARACTER_SPACE = "character_space" - CHARACTER_SWAP = "character_swap" - CRESCENDO = "crescendo" - DIACRITIC = "diacritic" - DIFFICULT = "difficult" - EASY = "easy" - FLIP = "flip" - INDIRECT_JAILBREAK = "indirect_jailbreak" - JAILBREAK = "jailbreak" - LEETSPEAK = "leetspeak" - MODERATE = "moderate" - MORSE = "morse" - MULTI_TURN = "multi_turn" - ROT13 = "rot13" - STRING_JOIN = "string_join" - SUFFIX_APPEND = "suffix_append" - TENSE = "tense" - UNICODE_CONFUSABLE = "unicode_confusable" - UNICODE_SUBSTITUTION = "unicode_substitution" - URL = "url" - - - class azure.ai.projects.models.AutoCodeInterpreterToolParam(_Model): - file_ids: Optional[list[str]] - memory_limit: Optional[Union[str, ContainerMemoryLimit]] - network_policy: Optional[ContainerNetworkPolicyParam] - type: Literal["auto"] - - @overload - def __init__( - self, - *, - file_ids: Optional[list[str]] = ..., - memory_limit: Optional[Union[str, ContainerMemoryLimit]] = ..., - network_policy: Optional[ContainerNetworkPolicyParam] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureAIAgentTarget(EvaluationTarget, discriminator='azure_ai_agent'): - name: str - tool_descriptions: Optional[list[ToolDescription]] - tools: Optional[list[Tool]] - type: Literal["azure_ai_agent"] - version: Optional[str] - - @overload - def __init__( - self, - *, - name: str, - tool_descriptions: Optional[list[ToolDescription]] = ..., - tools: Optional[list[Tool]] = ..., - version: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureAIAgentTargetParam(TypedDict, total=False): - key "name": Required[str] - key "tool_descriptions": List[ToolDescriptionParam] - key "type": Required[Literal["azure_ai_agent"]] - key "version": str - - - class azure.ai.projects.models.AzureAIBenchmarkPreviewEvalRunDataSource(TypedDict, total=False): - key "input_messages": InputMessagesItemReference - key "target": Required[Union[AzureAIAgentTargetParam, AzureAIModelTargetParam, dict[str, Any]]] - key "type": Required[Literal["azure_ai_benchmark_preview"]] - - - class azure.ai.projects.models.AzureAIDataSourceConfig(TypedDict, total=False): - key "scenario": Required[str] - key "type": Required[Literal["azure_ai_source"]] - - - class azure.ai.projects.models.AzureAIModelTarget(EvaluationTarget, discriminator='azure_ai_model'): - model: Optional[str] - sampling_params: Optional[ModelSamplingParams] - type: Literal["azure_ai_model"] - - @overload - def __init__( - self, - *, - model: Optional[str] = ..., - sampling_params: Optional[ModelSamplingParams] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureAIModelTargetParam(TypedDict, total=False): - key "model": str - key "sampling_params": ModelSamplingConfigParam - key "type": Required[Literal["azure_ai_model"]] - - - class azure.ai.projects.models.AzureAIResponsesEvalRunDataSource(TypedDict, total=False): - key "event_configuration_id": str - key "item_generation_params": Required[ResponseRetrievalItemGenerationParams] - key "max_runs_hourly": int - key "type": Required[Literal["azure_ai_responses"]] - - - class azure.ai.projects.models.AzureAISearchIndex(Index, discriminator='AzureSearch'): - connection_name: str - description: str - field_mapping: Optional[FieldMapping] - id: str - index_name: str - name: str - tags: dict[str, str] - type: Literal[IndexType.AZURE_SEARCH] - version: str - - @overload - def __init__( - self, - *, - connection_name: str, - description: Optional[str] = ..., - field_mapping: Optional[FieldMapping] = ..., - index_name: str, - tags: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureAISearchQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - SEMANTIC = "semantic" - SIMPLE = "simple" - VECTOR = "vector" - VECTOR_SEMANTIC_HYBRID = "vector_semantic_hybrid" - VECTOR_SIMPLE_HYBRID = "vector_simple_hybrid" - - - class azure.ai.projects.models.AzureAISearchTool(Tool, discriminator='azure_ai_search'): - azure_ai_search: AzureAISearchToolResource - description: Optional[str] - name: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.AZURE_AI_SEARCH] - - @overload - def __init__( - self, - *, - azure_ai_search: AzureAISearchToolResource, - description: Optional[str] = ..., - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureAISearchToolResource(_Model): - indexes: list[AISearchIndexResource] - - @overload - def __init__( - self, - *, - indexes: list[AISearchIndexResource] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureFunctionBinding(_Model): - storage_queue: AzureFunctionStorageQueue - type: Literal["storage_queue"] - - @overload - def __init__( - self, - *, - storage_queue: AzureFunctionStorageQueue - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureFunctionDefinition(_Model): - function: AzureFunctionDefinitionFunction - input_binding: AzureFunctionBinding - output_binding: AzureFunctionBinding - - @overload - def __init__( - self, - *, - function: AzureFunctionDefinitionFunction, - input_binding: AzureFunctionBinding, - output_binding: AzureFunctionBinding - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureFunctionDefinitionFunction(_Model): - description: Optional[str] - name: str - parameters: dict[str, Any] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: str, - parameters: dict[str, Any] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureFunctionStorageQueue(_Model): - queue_name: str - queue_service_endpoint: str - - @overload - def __init__( - self, - *, - queue_name: str, - queue_service_endpoint: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureFunctionTool(Tool, discriminator='azure_function'): - azure_function: AzureFunctionDefinition - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.AZURE_FUNCTION] - - @overload - def __init__( - self, - *, - azure_function: AzureFunctionDefinition, - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.AzureOpenAIModelConfiguration(RedTeamTargetConfig, discriminator='AzureOpenAIModel'): - model_deployment_name: str - type: Literal["AzureOpenAIModel"] - - @overload - def __init__( - self, - *, - model_deployment_name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BaseCredentials(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BingCustomSearchConfiguration(_Model): - count: Optional[int] - freshness: Optional[str] - instance_name: str - market: Optional[str] - project_connection_id: str - set_lang: Optional[str] - - @overload - def __init__( - self, - *, - count: Optional[int] = ..., - freshness: Optional[str] = ..., - instance_name: str, - market: Optional[str] = ..., - project_connection_id: str, - set_lang: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BingCustomSearchPreviewTool(Tool, discriminator='bing_custom_search_preview'): - bing_custom_search_preview: BingCustomSearchToolParameters - description: Optional[str] - name: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.BING_CUSTOM_SEARCH_PREVIEW] - - @overload - def __init__( - self, - *, - bing_custom_search_preview: BingCustomSearchToolParameters, - description: Optional[str] = ..., - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BingCustomSearchToolParameters(_Model): - search_configurations: list[BingCustomSearchConfiguration] - - @overload - def __init__( - self, - *, - search_configurations: list[BingCustomSearchConfiguration] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BingGroundingSearchConfiguration(_Model): - count: Optional[int] - freshness: Optional[str] - market: Optional[str] - project_connection_id: str - set_lang: Optional[str] - - @overload - def __init__( - self, - *, - count: Optional[int] = ..., - freshness: Optional[str] = ..., - market: Optional[str] = ..., - project_connection_id: str, - set_lang: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BingGroundingSearchToolParameters(_Model): - search_configurations: list[BingGroundingSearchConfiguration] - - @overload - def __init__( - self, - *, - search_configurations: list[BingGroundingSearchConfiguration] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BingGroundingTool(Tool, discriminator='bing_grounding'): - bing_grounding: BingGroundingSearchToolParameters - description: Optional[str] - name: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.BING_GROUNDING] - - @overload - def __init__( - self, - *, - bing_grounding: BingGroundingSearchToolParameters, - description: Optional[str] = ..., - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BlobReference(_Model): - blob_uri: str - credential: BlobReferenceSasCredential - storage_account_arm_id: str - - @overload - def __init__( - self, - *, - blob_uri: str, - credential: BlobReferenceSasCredential, - storage_account_arm_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BlobReferenceSasCredential(_Model): - sas_uri: str - type: Literal["SAS"] - - def __init__( - self, - *args: Any, - **kwargs: Any - ) -> None: ... - - - class azure.ai.projects.models.BotServiceAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator='BotService'): - type: Literal[AgentEndpointAuthorizationSchemeType.BOT_SERVICE] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BotServiceRbacAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator='BotServiceRbac'): - type: Literal[AgentEndpointAuthorizationSchemeType.BOT_SERVICE_RBAC] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BrowserAutomationPreviewTool(Tool, discriminator='browser_automation_preview'): - browser_automation_preview: BrowserAutomationToolParameters - description: Optional[str] - name: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.BROWSER_AUTOMATION_PREVIEW] - - @overload - def __init__( - self, - *, - browser_automation_preview: BrowserAutomationToolParameters, - description: Optional[str] = ..., - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BrowserAutomationToolConnectionParameters(_Model): - project_connection_id: str - - @overload - def __init__( - self, - *, - project_connection_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.BrowserAutomationToolParameters(_Model): - connection: BrowserAutomationToolConnectionParameters - - @overload - def __init__( - self, - *, - connection: BrowserAutomationToolConnectionParameters - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CaptureStructuredOutputsTool(Tool, discriminator='capture_structured_outputs'): - description: Optional[str] - name: Optional[str] - outputs: StructuredOutputDefinition - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.CAPTURE_STRUCTURED_OUTPUTS] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - outputs: StructuredOutputDefinition, - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ChartCoordinate(_Model): - size: int - x: int - y: int - - @overload - def __init__( - self, - *, - size: int, - x: int, - y: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ChatSummaryMemoryItem(MemoryItem, discriminator='chat_summary'): - content: str - kind: Literal[MemoryItemKind.CHAT_SUMMARY] - memory_id: str - scope: str - updated_at: datetime - - @overload - def __init__( - self, - *, - content: str, - memory_id: str, - scope: str, - updated_at: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ClusterInsightResult(_Model): - clusters: list[InsightCluster] - coordinates: Optional[dict[str, ChartCoordinate]] - summary: InsightSummary - - @overload - def __init__( - self, - *, - clusters: list[InsightCluster], - coordinates: Optional[dict[str, ChartCoordinate]] = ..., - summary: InsightSummary - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ClusterTokenUsage(_Model): - input_token_usage: int - output_token_usage: int - total_token_usage: int - - @overload - def __init__( - self, - *, - input_token_usage: int, - output_token_usage: int, - total_token_usage: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CodeBasedEvaluatorDefinition(EvaluatorDefinition, discriminator='code'): - blob_uri: Optional[str] - code_text: Optional[str] - data_schema: dict[str, any] - entry_point: Optional[str] - image_tag: Optional[str] - init_parameters: dict[str, any] - metrics: dict[str, EvaluatorMetric] - type: Literal[EvaluatorDefinitionType.CODE] - - @overload - def __init__( - self, - *, - blob_uri: Optional[str] = ..., - code_text: Optional[str] = ..., - data_schema: Optional[dict[str, Any]] = ..., - entry_point: Optional[str] = ..., - image_tag: Optional[str] = ..., - init_parameters: Optional[dict[str, Any]] = ..., - metrics: Optional[dict[str, EvaluatorMetric]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CodeConfiguration(_Model): - content_hash: Optional[str] - dependency_resolution: Union[str, CodeDependencyResolution] - entry_point: list[str] - runtime: str - - @overload - def __init__( - self, - *, - dependency_resolution: Union[str, CodeDependencyResolution], - entry_point: list[str], - runtime: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CodeDependencyResolution(str, Enum, metaclass=CaseInsensitiveEnumMeta): - BUNDLED = "bundled" - REMOTE_BUILD = "remote_build" - - - class azure.ai.projects.models.CodeInterpreterTool(Tool, discriminator='code_interpreter'): - container: Optional[Union[str, AutoCodeInterpreterToolParam]] - description: Optional[str] - name: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.CODE_INTERPRETER] - - @overload - def __init__( - self, - *, - container: Optional[Union[str, AutoCodeInterpreterToolParam]] = ..., - description: Optional[str] = ..., - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ComparisonFilter(_Model): - key: str - type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"] - value: Union[str, float, bool, list[Union[str, float]]] - - @overload - def __init__( - self, - *, - key: str, - type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"], - value: Union[str, float, bool, list[Union[str, float]]] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CompoundFilter(_Model): - filters: list[Union[ComparisonFilter, Any]] - type: Literal["and", "or"] - - @overload - def __init__( - self, - *, - filters: list[Union[ComparisonFilter, Any]], - type: Literal["and", "or"] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ComputerEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta): - BROWSER = "browser" - LINUX = "linux" - MAC = "mac" - UBUNTU = "ubuntu" - WINDOWS = "windows" - - - class azure.ai.projects.models.ComputerTool(Tool, discriminator='computer'): - type: Literal[ToolType.COMPUTER] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ComputerUsePreviewTool(Tool, discriminator='computer_use_preview'): - display_height: int - display_width: int - environment: Union[str, ComputerEnvironment] - type: Literal[ToolType.COMPUTER_USE_PREVIEW] - - @overload - def __init__( - self, - *, - display_height: int, - display_width: int, - environment: Union[str, ComputerEnvironment] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.Connection(_Model): - credentials: BaseCredentials - id: str - is_default: bool - metadata: dict[str, str] - name: str - target: str - type: Union[str, ConnectionType] - - - class azure.ai.projects.models.ConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - API_KEY = "ApiKey" - APPLICATION_CONFIGURATION = "AppConfig" - APPLICATION_INSIGHTS = "AppInsights" - AZURE_AI_SEARCH = "CognitiveSearch" - AZURE_BLOB_STORAGE = "AzureBlob" - AZURE_OPEN_AI = "AzureOpenAI" - AZURE_STORAGE_ACCOUNT = "AzureStorageAccount" - COSMOS_DB = "CosmosDB" - CUSTOM = "CustomKeys" - REMOTE_TOOL = "RemoteTool_Preview" - - - class azure.ai.projects.models.ContainerAutoParam(FunctionShellToolParamEnvironment, discriminator='container_auto'): - file_ids: Optional[list[str]] - memory_limit: Optional[Union[str, ContainerMemoryLimit]] - network_policy: Optional[ContainerNetworkPolicyParam] - skills: Optional[list[ContainerSkill]] - type: Literal[FunctionShellToolParamEnvironmentType.CONTAINER_AUTO] - - @overload - def __init__( - self, - *, - file_ids: Optional[list[str]] = ..., - memory_limit: Optional[Union[str, ContainerMemoryLimit]] = ..., - network_policy: Optional[ContainerNetworkPolicyParam] = ..., - skills: Optional[list[ContainerSkill]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ContainerConfiguration(_Model): - image: str - - @overload - def __init__( - self, - *, - image: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ContainerMemoryLimit(str, Enum, metaclass=CaseInsensitiveEnumMeta): - MEMORY_16GB = "16g" - MEMORY_1GB = "1g" - MEMORY_4GB = "4g" - MEMORY_64GB = "64g" - - - class azure.ai.projects.models.ContainerNetworkPolicyAllowlistParam(ContainerNetworkPolicyParam, discriminator='allowlist'): - allowed_domains: list[str] - domain_secrets: Optional[list[ContainerNetworkPolicyDomainSecretParam]] - type: Literal[ContainerNetworkPolicyParamType.ALLOWLIST] - - @overload - def __init__( - self, - *, - allowed_domains: list[str], - domain_secrets: Optional[list[ContainerNetworkPolicyDomainSecretParam]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ContainerNetworkPolicyDisabledParam(ContainerNetworkPolicyParam, discriminator='disabled'): - type: Literal[ContainerNetworkPolicyParamType.DISABLED] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ContainerNetworkPolicyDomainSecretParam(_Model): - domain: str - name: str - value: str - - @overload - def __init__( - self, - *, - domain: str, - name: str, - value: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ContainerNetworkPolicyParam(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ContainerNetworkPolicyParamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - ALLOWLIST = "allowlist" - DISABLED = "disabled" - - - class azure.ai.projects.models.ContainerSkill(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ContainerSkillType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - INLINE = "inline" - SKILL_REFERENCE = "skill_reference" - - - class azure.ai.projects.models.ContinuousEvaluationRuleAction(EvaluationRuleAction, discriminator='continuousEvaluation'): - eval_id: str - max_hourly_runs: Optional[int] - sampling_rate: Optional[float] - type: Literal[EvaluationRuleActionType.CONTINUOUS_EVALUATION] - - @overload - def __init__( - self, - *, - eval_id: str, - max_hourly_runs: Optional[int] = ..., - sampling_rate: Optional[float] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CosmosDBIndex(Index, discriminator='CosmosDBNoSqlVectorStore'): - connection_name: str - container_name: str - database_name: str - description: str - embedding_configuration: EmbeddingConfiguration - field_mapping: FieldMapping - id: str - name: str - tags: dict[str, str] - type: Literal[IndexType.COSMOS_DB] - version: str - - @overload - def __init__( - self, - *, - connection_name: str, - container_name: str, - database_name: str, - description: Optional[str] = ..., - embedding_configuration: EmbeddingConfiguration, - field_mapping: FieldMapping, - tags: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CreateAgentVersionFromCodeContent(_Model): - code: Union[str, bytes, IO[str], IO[bytes], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]]], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]], Optional[str]]] - metadata: CreateAgentVersionFromCodeMetadata - - @overload - def __init__( - self, - *, - code: FileType, - metadata: CreateAgentVersionFromCodeMetadata - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CreateAgentVersionFromCodeMetadata(_Model): - definition: HostedAgentDefinition - description: Optional[str] - metadata: Optional[dict[str, str]] - - @overload - def __init__( - self, - *, - definition: HostedAgentDefinition, - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CreateAsyncResponse(_Model): - location: Optional[str] - operation_result: Optional[str] - - @overload - def __init__( - self, - *, - location: Optional[str] = ..., - operation_result: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CreateSkillVersionFromFilesBody(_Model): - default: Optional[bool] - files: list[Union[str, bytes, IO[str], IO[bytes], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]]], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]], Optional[str]]]] - - @overload - def __init__( - self, - *, - default: Optional[bool] = ..., - files: list[FileType] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CredentialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AGENTIC_IDENTITY_PREVIEW = "AgenticIdentityToken_Preview" - API_KEY = "ApiKey" - CUSTOM = "CustomKeys" - ENTRA_ID = "AAD" - NONE = "None" - SAS = "SAS" - - - class azure.ai.projects.models.CronTrigger(Trigger, discriminator='Cron'): - end_time: Optional[datetime] - expression: str - start_time: Optional[datetime] - time_zone: Optional[str] - type: Literal[TriggerType.CRON] - - @overload - def __init__( - self, - *, - end_time: Optional[datetime] = ..., - expression: str, - start_time: Optional[datetime] = ..., - time_zone: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CustomCredential(CustomCredentialGenerated, discriminator='CustomKeys'): - credential_keys: Dict[str, str] - type: Union[str, CredentialType] - - def __init__( - self, - *args: Any, - **kwargs: Any - ) -> None: ... - - - class azure.ai.projects.models.CustomGrammarFormatParam(CustomToolParamFormat, discriminator='grammar'): - definition: str - syntax: Union[str, GrammarSyntax1] - type: Literal[CustomToolParamFormatType.GRAMMAR] - - @overload - def __init__( - self, - *, - definition: str, - syntax: Union[str, GrammarSyntax1] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CustomRoutineTrigger(RoutineTrigger, discriminator='custom'): - event_name: Optional[str] - parameters: dict[str, Any] - provider: str - type: Literal[RoutineTriggerType.CUSTOM] - - @overload - def __init__( - self, - *, - event_name: Optional[str] = ..., - parameters: dict[str, Any], - provider: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CustomTextFormatParam(CustomToolParamFormat, discriminator='text'): - type: Literal[CustomToolParamFormatType.TEXT] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CustomToolParam(Tool, discriminator='custom'): - defer_loading: Optional[bool] - description: Optional[str] - format: Optional[CustomToolParamFormat] - name: str - type: Literal[ToolType.CUSTOM] - - @overload - def __init__( - self, - *, - defer_loading: Optional[bool] = ..., - description: Optional[str] = ..., - format: Optional[CustomToolParamFormat] = ..., - name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CustomToolParamFormat(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.CustomToolParamFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - GRAMMAR = "grammar" - TEXT = "text" - - - class azure.ai.projects.models.DailyRecurrenceSchedule(RecurrenceSchedule, discriminator='Daily'): - hours: list[int] - type: Literal[RecurrenceType.DAILY] - - @overload - def __init__( - self, - *, - hours: list[int] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DataGenerationJob(_Model): - created_at: datetime - error: Optional[ApiError] - finished_at: Optional[datetime] - id: str - inputs: Optional[DataGenerationJobInputs] - result: Optional[DataGenerationJobResult] - status: Union[str, JobStatus] - - @overload - def __init__( - self, - *, - inputs: Optional[DataGenerationJobInputs] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DataGenerationJobInputs(_Model): - name: str - options: DataGenerationJobOptions - output_options: Optional[DataGenerationJobOutputOptions] - scenario: Union[str, DataGenerationJobScenario] - sources: list[DataGenerationJobSource] - - @overload - def __init__( - self, - *, - name: str, - options: DataGenerationJobOptions, - output_options: Optional[DataGenerationJobOutputOptions] = ..., - scenario: Union[str, DataGenerationJobScenario], - sources: list[DataGenerationJobSource] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DataGenerationJobOptions(_Model): - max_samples: int - model_options: Optional[DataGenerationModelOptions] - train_split: Optional[float] - type: str - - @overload - def __init__( - self, - *, - max_samples: int, - model_options: Optional[DataGenerationModelOptions] = ..., - train_split: Optional[float] = ..., - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DataGenerationJobOutput(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DataGenerationJobOutputOptions(_Model): - description: Optional[str] - name: Optional[str] - tags: Optional[dict[str, str]] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - tags: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DataGenerationJobOutputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - DATASET = "dataset" - FILE = "file" - - - class azure.ai.projects.models.DataGenerationJobResult(_Model): - generated_samples: int - outputs: Optional[list[DataGenerationJobOutput]] - token_usage: Optional[DataGenerationTokenUsage] - - @overload - def __init__( - self, - *, - generated_samples: int, - outputs: Optional[list[DataGenerationJobOutput]] = ..., - token_usage: Optional[DataGenerationTokenUsage] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DataGenerationJobScenario(str, Enum, metaclass=CaseInsensitiveEnumMeta): - EVALUATION = "evaluation" - REINFORCEMENT_FINETUNING = "reinforcement_finetuning" - SUPERVISED_FINETUNING = "supervised_finetuning" - - - class azure.ai.projects.models.DataGenerationJobSource(_Model): - description: Optional[str] - type: str - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DataGenerationJobSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AGENT = "agent" - FILE = "file" - PROMPT = "prompt" - TRACES = "traces" - - - class azure.ai.projects.models.DataGenerationJobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - SIMPLE_QNA = "simple_qna" - TOOL_USE = "tool_use" - TRACES = "traces" - - - class azure.ai.projects.models.DataGenerationModelOptions(_Model): - model: str - - @overload - def __init__( - self, - *, - model: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DataGenerationTokenUsage(_Model): - completion_tokens: int - prompt_tokens: int - total_tokens: int - - - class azure.ai.projects.models.DatasetCredential(_Model): - blob_reference: BlobReference - - @overload - def __init__( - self, - *, - blob_reference: BlobReference - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DatasetDataGenerationJobOutput(DataGenerationJobOutput, discriminator='dataset'): - description: Optional[str] - id: Optional[str] - name: Optional[str] - tags: Optional[dict[str, str]] - type: Literal[DataGenerationJobOutputType.DATASET] - version: Optional[str] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DatasetEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator='dataset'): - description: Optional[str] - name: str - type: Literal[EvaluatorGenerationJobSourceType.DATASET] - version: Optional[str] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: str, - version: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DatasetReference(_Model): - name: str - version: str - - @overload - def __init__( - self, - *, - name: str, - version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DatasetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - URI_FILE = "uri_file" - URI_FOLDER = "uri_folder" - - - class azure.ai.projects.models.DatasetVersion(_Model): - connection_name: Optional[str] - data_uri: str - description: Optional[str] - id: Optional[str] - is_reference: Optional[bool] - name: str - tags: Optional[dict[str, str]] - type: str - version: str - - @overload - def __init__( - self, - *, - connection_name: Optional[str] = ..., - data_uri: str, - description: Optional[str] = ..., - tags: Optional[dict[str, str]] = ..., - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): - FRIDAY = "Friday" - MONDAY = "Monday" - SATURDAY = "Saturday" - SUNDAY = "Sunday" - THURSDAY = "Thursday" - TUESDAY = "Tuesday" - WEDNESDAY = "Wednesday" - - - class azure.ai.projects.models.DeleteAgentResponse(_Model): - deleted: bool - name: str - object: Literal[AgentObjectType.AGENT_DELETED] - - @overload - def __init__( - self, - *, - deleted: bool, - name: str, - object: Literal[AgentObjectType.AGENT_DELETED] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DeleteAgentVersionResponse(_Model): - deleted: bool - name: str - object: Literal[AgentObjectType.AGENT_VERSION_DELETED] - version: str - - @overload - def __init__( - self, - *, - deleted: bool, - name: str, - object: Literal[AgentObjectType.AGENT_VERSION_DELETED], - version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DeleteMemoryResult(_Model): - deleted: bool - memory_id: str - object: Literal[MemoryStoreObjectType.MEMORY_DELETED] - - @overload - def __init__( - self, - *, - deleted: bool, - memory_id: str, - object: Literal[MemoryStoreObjectType.MEMORY_DELETED] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DeleteMemoryStoreResult(_Model): - deleted: bool - name: str - object: Literal[MemoryStoreObjectType.MEMORY_STORE_DELETED] - - @overload - def __init__( - self, - *, - deleted: bool, - name: str, - object: Literal[MemoryStoreObjectType.MEMORY_STORE_DELETED] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DeleteSkillResult(_Model): - deleted: bool - id: str - name: str - - @overload - def __init__( - self, - *, - deleted: bool, - id: str, - name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DeleteSkillVersionResult(_Model): - deleted: bool - id: str - name: str - version: str - - @overload - def __init__( - self, - *, - deleted: bool, - id: str, - name: str, - version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.Deployment(_Model): - name: str - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - MODEL_DEPLOYMENT = "ModelDeployment" - - - class azure.ai.projects.models.Dimension(_Model): - always_applicable: Optional[bool] - description: str - id: str - weight: int - - @overload - def __init__( - self, - *, - always_applicable: Optional[bool] = ..., - description: str, - id: str, - weight: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.DispatchRoutineResult(_Model): - action_correlation_id: Optional[str] - dispatch_id: Optional[str] - task_id: Optional[str] - - @overload - def __init__( - self, - *, - action_correlation_id: Optional[str] = ..., - dispatch_id: Optional[str] = ..., - task_id: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EmbeddingConfiguration(_Model): - embedding_field: str - model_deployment_name: str - - @overload - def __init__( - self, - *, - embedding_field: str, - model_deployment_name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EmptyModelParam(_Model): - - - class azure.ai.projects.models.EntraAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator='Entra'): - isolation_key_source: Optional[IsolationKeySource] - type: Literal[AgentEndpointAuthorizationSchemeType.ENTRA] - - @overload - def __init__( - self, - *, - isolation_key_source: Optional[IsolationKeySource] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EntraIDCredentials(BaseCredentials, discriminator='AAD'): - type: Literal[CredentialType.ENTRA_ID] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EntraIsolationKeySource(IsolationKeySource, discriminator='Entra'): - kind: Literal[IsolationKeySourceKind.ENTRA] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvalCsvFileIdSource(TypedDict, total=False): - key "id": Required[str] - key "type": Required[Literal["file_id"]] - - - class azure.ai.projects.models.EvalCsvRunDataSource(TypedDict, total=False): - key "source": Required[EvalCsvFileIdSource] - key "type": Required[Literal["csv"]] - - - class azure.ai.projects.models.EvalResult(_Model): - name: str - passed: bool - score: float - type: str - - @overload - def __init__( - self, - *, - name: str, - passed: bool, - score: float, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvalRunResultCompareItem(_Model): - delta_estimate: float - p_value: float - treatment_effect: Union[str, TreatmentEffectType] - treatment_run_id: str - treatment_run_summary: EvalRunResultSummary - - @overload - def __init__( - self, - *, - delta_estimate: float, - p_value: float, - treatment_effect: Union[str, TreatmentEffectType], - treatment_run_id: str, - treatment_run_summary: EvalRunResultSummary - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvalRunResultComparison(_Model): - baseline_run_summary: EvalRunResultSummary - compare_items: list[EvalRunResultCompareItem] - evaluator: str - metric: str - testing_criteria: str - - @overload - def __init__( - self, - *, - baseline_run_summary: EvalRunResultSummary, - compare_items: list[EvalRunResultCompareItem], - evaluator: str, - metric: str, - testing_criteria: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvalRunResultSummary(_Model): - average: float - run_id: str - sample_count: int - standard_deviation: float - - @overload - def __init__( - self, - *, - average: float, - run_id: str, - sample_count: int, - standard_deviation: float - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationComparisonInsightRequest(InsightRequest, discriminator='EvaluationComparison'): - baseline_run_id: str - eval_id: str - treatment_run_ids: list[str] - type: Literal[InsightType.EVALUATION_COMPARISON] - - @overload - def __init__( - self, - *, - baseline_run_id: str, - eval_id: str, - treatment_run_ids: list[str] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationComparisonInsightResult(InsightResult, discriminator='EvaluationComparison'): - comparisons: list[EvalRunResultComparison] - method: str - type: Literal[InsightType.EVALUATION_COMPARISON] - - @overload - def __init__( - self, - *, - comparisons: list[EvalRunResultComparison], - method: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CONVERSATION = "conversation" - TURN = "turn" - - - class azure.ai.projects.models.EvaluationResultSample(InsightSample, discriminator='EvaluationResultSample'): - correlation_info: dict[str, any] - evaluation_result: EvalResult - features: dict[str, any] - id: str - type: Literal[SampleType.EVALUATION_RESULT_SAMPLE] - - @overload - def __init__( - self, - *, - correlation_info: dict[str, Any], - evaluation_result: EvalResult, - features: dict[str, Any], - id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationRule(_Model): - action: EvaluationRuleAction - description: Optional[str] - display_name: Optional[str] - enabled: bool - event_type: Union[str, EvaluationRuleEventType] - filter: Optional[EvaluationRuleFilter] - id: str - system_data: dict[str, str] - - @overload - def __init__( - self, - *, - action: EvaluationRuleAction, - description: Optional[str] = ..., - display_name: Optional[str] = ..., - enabled: bool, - event_type: Union[str, EvaluationRuleEventType], - filter: Optional[EvaluationRuleFilter] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationRuleAction(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationRuleActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CONTINUOUS_EVALUATION = "continuousEvaluation" - HUMAN_EVALUATION_PREVIEW = "humanEvaluationPreview" - - - class azure.ai.projects.models.EvaluationRuleEventType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - MANUAL = "manual" - RESPONSE_COMPLETED = "responseCompleted" - - - class azure.ai.projects.models.EvaluationRuleFilter(_Model): - agent_name: str - - @overload - def __init__( - self, - *, - agent_name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationRunClusterInsightRequest(InsightRequest, discriminator='EvaluationRunClusterInsight'): - eval_id: str - model_configuration: Optional[InsightModelConfiguration] - run_ids: list[str] - type: Literal[InsightType.EVALUATION_RUN_CLUSTER_INSIGHT] - - @overload - def __init__( - self, - *, - eval_id: str, - model_configuration: Optional[InsightModelConfiguration] = ..., - run_ids: list[str] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationRunClusterInsightResult(InsightResult, discriminator='EvaluationRunClusterInsight'): - cluster_insight: ClusterInsightResult - type: Literal[InsightType.EVALUATION_RUN_CLUSTER_INSIGHT] - - @overload - def __init__( - self, - *, - cluster_insight: ClusterInsightResult - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationScheduleTask(ScheduleTask, discriminator='Evaluation'): - configuration: dict[str, str] - eval_id: str - eval_run: dict[str, Any] - type: Literal[ScheduleTaskType.EVALUATION] - - @overload - def __init__( - self, - *, - configuration: Optional[dict[str, str]] = ..., - eval_id: str, - eval_run: dict[str, Any] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationTarget(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationTaxonomy(_Model): - description: Optional[str] - id: Optional[str] - name: str - properties: Optional[dict[str, str]] - tags: Optional[dict[str, str]] - taxonomy_categories: Optional[list[TaxonomyCategory]] - taxonomy_input: EvaluationTaxonomyInput - version: str - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - properties: Optional[dict[str, str]] = ..., - tags: Optional[dict[str, str]] = ..., - taxonomy_categories: Optional[list[TaxonomyCategory]] = ..., - taxonomy_input: EvaluationTaxonomyInput - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationTaxonomyInput(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluationTaxonomyInputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AGENT = "agent" - POLICY = "policy" - - - class azure.ai.projects.models.EvaluatorCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AGENTS = "agents" - QUALITY = "quality" - SAFETY = "safety" - - - class azure.ai.projects.models.EvaluatorCredentialRequest(_Model): - blob_uri: str - - @overload - def __init__( - self, - *, - blob_uri: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluatorDefinition(_Model): - data_schema: Optional[dict[str, Any]] - init_parameters: Optional[dict[str, Any]] - metrics: Optional[dict[str, EvaluatorMetric]] - type: str - - @overload - def __init__( - self, - *, - data_schema: Optional[dict[str, Any]] = ..., - init_parameters: Optional[dict[str, Any]] = ..., - metrics: Optional[dict[str, EvaluatorMetric]] = ..., - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluatorDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CODE = "code" - OPENAI_GRADERS = "openai_graders" - PROMPT = "prompt" - PROMPT_AND_CODE = "prompt_and_code" - RUBRIC = "rubric" - SERVICE = "service" - - - class azure.ai.projects.models.EvaluatorGenerationArtifacts(_Model): - dataset: DatasetReference - kinds: list[str] - - @overload - def __init__( - self, - *, - dataset: DatasetReference, - kinds: list[str] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluatorGenerationInputs(_Model): - evaluator_description: Optional[str] - evaluator_display_name: Optional[str] - evaluator_name: str - model: str - sources: list[EvaluatorGenerationJobSource] - - @overload - def __init__( - self, - *, - evaluator_description: Optional[str] = ..., - evaluator_display_name: Optional[str] = ..., - evaluator_name: str, - model: str, - sources: list[EvaluatorGenerationJobSource] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluatorGenerationJob(_Model): - created_at: datetime - error: Optional[ApiError] - finished_at: Optional[datetime] - id: str - inputs: Optional[EvaluatorGenerationInputs] - result: Optional[EvaluatorVersion] - status: Union[str, JobStatus] - usage: Optional[EvaluatorGenerationTokenUsage] - - @overload - def __init__( - self, - *, - inputs: Optional[EvaluatorGenerationInputs] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluatorGenerationJobSource(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluatorGenerationJobSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AGENT = "agent" - DATASET = "dataset" - PROMPT = "prompt" - TRACES = "traces" - - - class azure.ai.projects.models.EvaluatorGenerationTokenUsage(_Model): - input_tokens: int - output_tokens: int - total_tokens: int - - @overload - def __init__( - self, - *, - input_tokens: int, - output_tokens: int, - total_tokens: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluatorMetric(_Model): - desirable_direction: Optional[Union[str, EvaluatorMetricDirection]] - is_primary: Optional[bool] - max_value: Optional[float] - min_value: Optional[float] - threshold: Optional[float] - type: Optional[Union[str, EvaluatorMetricType]] - - @overload - def __init__( - self, - *, - desirable_direction: Optional[Union[str, EvaluatorMetricDirection]] = ..., - is_primary: Optional[bool] = ..., - max_value: Optional[float] = ..., - min_value: Optional[float] = ..., - threshold: Optional[float] = ..., - type: Optional[Union[str, EvaluatorMetricType]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.EvaluatorMetricDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - DECREASE = "decrease" - INCREASE = "increase" - NEUTRAL = "neutral" - - - class azure.ai.projects.models.EvaluatorMetricType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - BOOLEAN = "boolean" - CONTINUOUS = "continuous" - ORDINAL = "ordinal" - - - class azure.ai.projects.models.EvaluatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - BUILT_IN = "builtin" - CUSTOM = "custom" - - - class azure.ai.projects.models.EvaluatorVersion(_Model): - categories: list[Union[str, EvaluatorCategory]] - created_at: datetime - created_by: str - definition: EvaluatorDefinition - description: Optional[str] - display_name: Optional[str] - evaluator_type: Union[str, EvaluatorType] - generation_artifacts: Optional[EvaluatorGenerationArtifacts] - id: Optional[str] - metadata: Optional[dict[str, str]] - modified_at: datetime - name: str - supported_evaluation_levels: Optional[list[Union[str, EvaluationLevel]]] - tags: Optional[dict[str, str]] - version: str - - @overload - def __init__( - self, - *, - categories: list[Union[str, EvaluatorCategory]], - definition: EvaluatorDefinition, - description: Optional[str] = ..., - display_name: Optional[str] = ..., - evaluator_type: Union[str, EvaluatorType], - metadata: Optional[dict[str, str]] = ..., - supported_evaluation_levels: Optional[list[Union[str, EvaluationLevel]]] = ..., - tags: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ExternalAgentDefinition(AgentDefinition, discriminator='external'): - kind: Literal[AgentKind.EXTERNAL] - otel_agent_id: Optional[str] - rai_config: RaiConfig - - @overload - def __init__( - self, - *, - otel_agent_id: Optional[str] = ..., - rai_config: Optional[RaiConfig] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FabricDataAgentToolParameters(_Model): - project_connections: Optional[list[ToolProjectConnection]] - - @overload - def __init__( - self, - *, - project_connections: Optional[list[ToolProjectConnection]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FabricIQPreviewTool(Tool, discriminator='fabric_iq_preview'): - description: Optional[str] - name: Optional[str] - project_connection_id: str - require_approval: Optional[Union[MCPToolRequireApproval, str]] - server_label: Optional[str] - server_url: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.FABRIC_IQ_PREVIEW] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - project_connection_id: str, - require_approval: Optional[Union[MCPToolRequireApproval, str]] = ..., - server_label: Optional[str] = ..., - server_url: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FieldMapping(_Model): - content_fields: list[str] - filepath_field: Optional[str] - metadata_fields: Optional[list[str]] - title_field: Optional[str] - url_field: Optional[str] - vector_fields: Optional[list[str]] - - @overload - def __init__( - self, - *, - content_fields: list[str], - filepath_field: Optional[str] = ..., - metadata_fields: Optional[list[str]] = ..., - title_field: Optional[str] = ..., - url_field: Optional[str] = ..., - vector_fields: Optional[list[str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FileDataGenerationJobOutput(DataGenerationJobOutput, discriminator='file'): - filename: str - id: str - type: Literal[DataGenerationJobOutputType.FILE] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FileDataGenerationJobSource(DataGenerationJobSource, discriminator='file'): - description: str - id: str - type: Literal[DataGenerationJobSourceType.FILE] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FileDatasetVersion(DatasetVersion, discriminator='uri_file'): - connection_name: str - data_uri: str - description: str - id: str - is_reference: bool - name: str - tags: dict[str, str] - type: Literal[DatasetType.URI_FILE] - version: str - - @overload - def __init__( - self, - *, - connection_name: Optional[str] = ..., - data_uri: str, - description: Optional[str] = ..., - tags: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FileSearchTool(Tool, discriminator='file_search'): - description: Optional[str] - filters: Optional[Filters] - max_num_results: Optional[int] - name: Optional[str] - ranking_options: Optional[RankingOptions] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.FILE_SEARCH] - vector_store_ids: list[str] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - filters: Optional[Filters] = ..., - max_num_results: Optional[int] = ..., - name: Optional[str] = ..., - ranking_options: Optional[RankingOptions] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ..., - vector_store_ids: list[str] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FixedRatioVersionSelectionRule(VersionSelectionRule, discriminator='FixedRatio'): - agent_version: str - traffic_percentage: int - type: Literal[VersionSelectorType.FIXED_RATIO] - - @overload - def __init__( - self, - *, - agent_version: str, - traffic_percentage: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FolderDatasetVersion(DatasetVersion, discriminator='uri_folder'): - connection_name: str - data_uri: str - description: str - id: str - is_reference: bool - name: str - tags: dict[str, str] - type: Literal[DatasetType.URI_FOLDER] - version: str - - @overload - def __init__( - self, - *, - connection_name: Optional[str] = ..., - data_uri: str, - description: Optional[str] = ..., - tags: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FoundryModelArtifactProfileCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): - DATA_ONLY = "DataOnly" - RUNTIME_DEPENDENT = "RuntimeDependent" - UNKNOWN = "Unknown" - - - class azure.ai.projects.models.FoundryModelArtifactProfileSignal(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CUSTOM_PYTHON_CODE = "CustomPythonCode" - DYNAMIC_OPS = "DynamicOps" - NATIVE_BINARY = "NativeBinary" - PICKLE_DESERIALIZATION = "PickleDeserialization" - UNKNOWN_FORMAT = "UnknownFormat" - - - class azure.ai.projects.models.FoundryModelSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - LOCAL_UPLOAD = "LocalUpload" - TRAINING_JOB = "TrainingJob" - - - class azure.ai.projects.models.FoundryModelWarning(_Model): - code: Optional[Union[str, FoundryModelWarningCode]] - message: Optional[str] - - @overload - def __init__( - self, - *, - code: Optional[Union[str, FoundryModelWarningCode]] = ..., - message: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FoundryModelWarningCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - RUNTIME_DEPENDENT_ARTIFACT = "RuntimeDependentArtifact" - UNCLASSIFIED_ARTIFACT = "UnclassifiedArtifact" - - - class azure.ai.projects.models.FoundryModelWeightType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - DRAFT_MODEL = "DraftModel" - FULL_WEIGHT = "FullWeight" - LO_RA = "LoRA" - - - class azure.ai.projects.models.FunctionShellToolParam(Tool, discriminator='shell'): - description: Optional[str] - environment: Optional[FunctionShellToolParamEnvironment] - name: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.SHELL] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - environment: Optional[FunctionShellToolParamEnvironment] = ..., - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FunctionShellToolParamEnvironment(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FunctionShellToolParamEnvironmentContainerReferenceParam(FunctionShellToolParamEnvironment, discriminator='container_reference'): - container_id: str - type: Literal[FunctionShellToolParamEnvironmentType.CONTAINER_REFERENCE] - - @overload - def __init__( - self, - *, - container_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FunctionShellToolParamEnvironmentLocalEnvironmentParam(FunctionShellToolParamEnvironment, discriminator='local'): - skills: Optional[list[LocalSkillParam]] - type: Literal[FunctionShellToolParamEnvironmentType.LOCAL] - - @overload - def __init__( - self, - *, - skills: Optional[list[LocalSkillParam]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FunctionShellToolParamEnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CONTAINER_AUTO = "container_auto" - CONTAINER_REFERENCE = "container_reference" - LOCAL = "local" - - - class azure.ai.projects.models.FunctionTool(Tool, discriminator='function'): - defer_loading: Optional[bool] - description: Optional[str] - name: str - parameters: dict[str, Any] - strict: bool - type: Literal[ToolType.FUNCTION] - - @overload - def __init__( - self, - *, - defer_loading: Optional[bool] = ..., - description: Optional[str] = ..., - name: str, - parameters: dict[str, Any], - strict: bool - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.FunctionToolParam(_Model): - defer_loading: Optional[bool] - description: Optional[str] - name: str - parameters: Optional[EmptyModelParam] - strict: Optional[bool] - type: Literal["function"] - - @overload - def __init__( - self, - *, - defer_loading: Optional[bool] = ..., - description: Optional[str] = ..., - name: str, - parameters: Optional[EmptyModelParam] = ..., - strict: Optional[bool] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.GitHubIssueEvent(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CLOSED = "closed" - OPENED = "opened" - - - class azure.ai.projects.models.GitHubIssueRoutineTrigger(RoutineTrigger, discriminator='github_issue'): - connection_id: str - issue_event: Union[str, GitHubIssueEvent] - owner: str - repository: str - type: Literal[RoutineTriggerType.GITHUB_ISSUE] - - @overload - def __init__( - self, - *, - connection_id: str, - issue_event: Union[str, GitHubIssueEvent], - owner: str, - repository: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.GrammarSyntax1(str, Enum, metaclass=CaseInsensitiveEnumMeta): - LARK = "lark" - REGEX = "regex" - - - class azure.ai.projects.models.HeaderIsolationKeySource(IsolationKeySource, discriminator='Header'): - kind: Literal[IsolationKeySourceKind.HEADER] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.HeaderTelemetryEndpointAuth(TelemetryEndpointAuth, discriminator='header'): - header_name: str - secret_id: str - secret_key: str - type: Literal[TelemetryEndpointAuthType.HEADER] - - @overload - def __init__( - self, - *, - header_name: str, - secret_id: str, - secret_key: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.HostedAgentDefinition(AgentDefinition, discriminator='hosted'): - code_configuration: Optional[CodeConfiguration] - container_configuration: Optional[ContainerConfiguration] - cpu: str - environment_variables: Optional[dict[str, str]] - kind: Literal[AgentKind.HOSTED] - memory: str - protocol_versions: Optional[list[ProtocolVersionRecord]] - rai_config: RaiConfig - telemetry_config: Optional[TelemetryConfig] - tools: Optional[list[Tool]] - - @overload - def __init__( - self, - *, - code_configuration: Optional[CodeConfiguration] = ..., - container_configuration: Optional[ContainerConfiguration] = ..., - cpu: str, - environment_variables: Optional[dict[str, str]] = ..., - memory: str, - protocol_versions: Optional[list[ProtocolVersionRecord]] = ..., - rai_config: Optional[RaiConfig] = ..., - telemetry_config: Optional[TelemetryConfig] = ..., - tools: Optional[list[Tool]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.HourlyRecurrenceSchedule(RecurrenceSchedule, discriminator='Hourly'): - type: Literal[RecurrenceType.HOURLY] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.HumanEvaluationPreviewRuleAction(EvaluationRuleAction, discriminator='humanEvaluationPreview'): - template_id: str - type: Literal[EvaluationRuleActionType.HUMAN_EVALUATION_PREVIEW] - - @overload - def __init__( - self, - *, - template_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.HybridSearchOptions(_Model): - embedding_weight: float - text_weight: float - - @overload - def __init__( - self, - *, - embedding_weight: float, - text_weight: float - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ImageGenAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AUTO = "auto" - EDIT = "edit" - GENERATE = "generate" - - - class azure.ai.projects.models.ImageGenTool(Tool, discriminator='image_generation'): - action: Optional[Union[str, ImageGenAction]] - background: Optional[Literal["transparent", "opaque", "auto"]] - description: Optional[str] - input_fidelity: Optional[Union[str, InputFidelity]] - input_image_mask: Optional[ImageGenToolInputImageMask] - model: Optional[Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-5"], str]] - moderation: Optional[Literal["auto", "low"]] - name: Optional[str] - output_compression: Optional[int] - output_format: Optional[Literal["png", "webp", "jpeg"]] - partial_images: Optional[int] - quality: Optional[Literal["low", "medium", "high", "auto"]] - size: Optional[Union[Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], Literal["auto"], str]] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.IMAGE_GENERATION] - - @overload - def __init__( - self, - *, - action: Optional[Union[str, ImageGenAction]] = ..., - background: Optional[Literal[transparent, opaque, auto]] = ..., - description: Optional[str] = ..., - input_fidelity: Optional[Union[str, InputFidelity]] = ..., - input_image_mask: Optional[ImageGenToolInputImageMask] = ..., - model: Optional[Union[Literal[gpt-image-1], Literal[gpt-image-1-mini], Literal[gpt-image-5], str]] = ..., - moderation: Optional[Literal[auto, low]] = ..., - name: Optional[str] = ..., - output_compression: Optional[int] = ..., - output_format: Optional[Literal[png, webp, jpeg]] = ..., - partial_images: Optional[int] = ..., - quality: Optional[Literal[low, medium, high, auto]] = ..., - size: Optional[Union[Literal[1024x1024], Literal[1024x1536], Literal[1536x1024], Literal[auto], str]] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ImageGenToolInputImageMask(_Model): - file_id: Optional[str] - image_url: Optional[str] - - @overload - def __init__( - self, - *, - file_id: Optional[str] = ..., - image_url: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.Index(_Model): - description: Optional[str] - id: Optional[str] - name: str - tags: Optional[dict[str, str]] - type: str - version: str - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - tags: Optional[dict[str, str]] = ..., - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.IndexType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AZURE_SEARCH = "AzureSearch" - COSMOS_DB = "CosmosDBNoSqlVectorStore" - MANAGED_AZURE_SEARCH = "ManagedAzureSearch" - - - class azure.ai.projects.models.InlineSkillParam(ContainerSkill, discriminator='inline'): - description: str - name: str - source: InlineSkillSourceParam - type: Literal[ContainerSkillType.INLINE] - - @overload - def __init__( - self, - *, - description: str, - name: str, - source: InlineSkillSourceParam - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InlineSkillSourceParam(_Model): - data: str - media_type: Literal["application/zip"] - type: Literal["base64"] - - @overload - def __init__( - self, - *, - data: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InputFidelity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - HIGH = "high" - LOW = "low" - - - class azure.ai.projects.models.Insight(_Model): - display_name: str - insight_id: str - metadata: InsightsMetadata - request: InsightRequest - result: Optional[InsightResult] - state: Union[str, OperationState] - - @overload - def __init__( - self, - *, - display_name: str, - request: InsightRequest - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InsightCluster(_Model): - description: str - id: str - label: str - samples: Optional[list[InsightSample]] - sub_clusters: Optional[list[InsightCluster]] - suggestion: str - suggestion_title: str - weight: int - - @overload - def __init__( - self, - *, - description: str, - id: str, - label: str, - samples: Optional[list[InsightSample]] = ..., - sub_clusters: Optional[list[InsightCluster]] = ..., - suggestion: str, - suggestion_title: str, - weight: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InsightModelConfiguration(_Model): - model_deployment_name: str - - @overload - def __init__( - self, - *, - model_deployment_name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InsightRequest(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InsightResult(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InsightSample(_Model): - correlation_info: dict[str, Any] - features: dict[str, Any] - id: str - type: str - - @overload - def __init__( - self, - *, - correlation_info: dict[str, Any], - features: dict[str, Any], - id: str, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InsightScheduleTask(ScheduleTask, discriminator='Insight'): - configuration: dict[str, str] - insight: Insight - type: Literal[ScheduleTaskType.INSIGHT] - - @overload - def __init__( - self, - *, - configuration: Optional[dict[str, str]] = ..., - insight: Insight - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InsightSummary(_Model): - method: str - sample_count: int - unique_cluster_count: int - unique_subcluster_count: int - usage: ClusterTokenUsage - - @overload - def __init__( - self, - *, - method: str, - sample_count: int, - unique_cluster_count: int, - unique_subcluster_count: int, - usage: ClusterTokenUsage - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InsightType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AGENT_CLUSTER_INSIGHT = "AgentClusterInsight" - EVALUATION_COMPARISON = "EvaluationComparison" - EVALUATION_RUN_CLUSTER_INSIGHT = "EvaluationRunClusterInsight" - - - class azure.ai.projects.models.InsightsMetadata(_Model): - completed_at: Optional[datetime] - created_at: datetime - - @overload - def __init__( - self, - *, - completed_at: Optional[datetime] = ..., - created_at: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InvokeAgentInvocationsApiDispatchPayload(RoutineDispatchPayload, discriminator='invoke_agent_invocations_api'): - input: Any - type: Literal[RoutineDispatchPayloadType.INVOKE_AGENT_INVOCATIONS_API] - - @overload - def __init__( - self, - *, - input: Any - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InvokeAgentInvocationsApiRoutineAction(RoutineAction, discriminator='invoke_agent_invocations_api'): - agent_endpoint_id: Optional[str] - agent_name: Optional[str] - input: Optional[Any] - session_id: Optional[str] - type: Literal[RoutineActionType.INVOKE_AGENT_INVOCATIONS_API] - - @overload - def __init__( - self, - *, - agent_endpoint_id: Optional[str] = ..., - agent_name: Optional[str] = ..., - input: Optional[Any] = ..., - session_id: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InvokeAgentResponsesApiDispatchPayload(RoutineDispatchPayload, discriminator='invoke_agent_responses_api'): - input: Any - type: Literal[RoutineDispatchPayloadType.INVOKE_AGENT_RESPONSES_API] - - @overload - def __init__( - self, - *, - input: Any - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.InvokeAgentResponsesApiRoutineAction(RoutineAction, discriminator='invoke_agent_responses_api'): - agent_endpoint_id: Optional[str] - agent_name: Optional[str] - conversation: Optional[str] - input: Optional[Any] - type: Literal[RoutineActionType.INVOKE_AGENT_RESPONSES_API] - - @overload - def __init__( - self, - *, - agent_endpoint_id: Optional[str] = ..., - agent_name: Optional[str] = ..., - conversation: Optional[str] = ..., - input: Optional[Any] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.IsolationKeySource(_Model): - kind: str - - @overload - def __init__( - self, - *, - kind: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.IsolationKeySourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - ENTRA = "Entra" - HEADER = "Header" - - - class azure.ai.projects.models.JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CANCELLED = "cancelled" - FAILED = "failed" - IN_PROGRESS = "in_progress" - QUEUED = "queued" - SUCCEEDED = "succeeded" - - - class azure.ai.projects.models.LocalShellToolParam(Tool, discriminator='local_shell'): - description: Optional[str] - name: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.LOCAL_SHELL] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.LocalSkillParam(_Model): - description: str - name: str - path: str - - @overload - def __init__( - self, - *, - description: str, - name: str, - path: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.LoraConfig(_Model): - alpha: Optional[int] - dropout: Optional[float] - rank: Optional[int] - target_modules: Optional[list[str]] - - @overload - def __init__( - self, - *, - alpha: Optional[int] = ..., - dropout: Optional[float] = ..., - rank: Optional[int] = ..., - target_modules: Optional[list[str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MCPTool(Tool, discriminator='mcp'): - allowed_tools: Optional[Union[list[str], MCPToolFilter]] - authorization: Optional[str] - connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams", "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint"]] - defer_loading: Optional[bool] - headers: Optional[dict[str, str]] - project_connection_id: Optional[str] - require_approval: Optional[Union[MCPToolRequireApproval, Literal["always"], Literal["never"]]] - server_description: Optional[str] - server_label: str - server_url: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.MCP] - - @overload - def __init__( - self, - *, - allowed_tools: Optional[Union[list[str], MCPToolFilter]] = ..., - authorization: Optional[str] = ..., - connector_id: Optional[Literal[connector_dropbox, connector_gmail, connector_googlecalendar, connector_googledrive, connector_microsoftteams, connector_outlookcalendar, connector_outlookemail, connector_sharepoint]] = ..., - defer_loading: Optional[bool] = ..., - headers: Optional[dict[str, str]] = ..., - project_connection_id: Optional[str] = ..., - require_approval: Optional[Union[MCPToolRequireApproval, Literal[always], Literal[never]]] = ..., - server_description: Optional[str] = ..., - server_label: str, - server_url: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MCPToolFilter(_Model): - read_only: Optional[bool] - tool_names: Optional[list[str]] - - @overload - def __init__( - self, - *, - read_only: Optional[bool] = ..., - tool_names: Optional[list[str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MCPToolRequireApproval(_Model): - always: Optional[MCPToolFilter] - never: Optional[MCPToolFilter] - - @overload - def __init__( - self, - *, - always: Optional[MCPToolFilter] = ..., - never: Optional[MCPToolFilter] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ManagedAgentIdentityBlueprintReference(AgentBlueprintReference, discriminator='ManagedAgentIdentityBlueprint'): - blueprint_id: str - type: Literal[AgentBlueprintReferenceType.MANAGED_AGENT_IDENTITY_BLUEPRINT] - - @overload - def __init__( - self, - *, - blueprint_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ManagedAzureAISearchIndex(Index, discriminator='ManagedAzureSearch'): - description: str - id: str - name: str - tags: dict[str, str] - type: Literal[IndexType.MANAGED_AZURE_SEARCH] - vector_store_id: str - version: str - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - tags: Optional[dict[str, str]] = ..., - vector_store_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryItem(_Model): - content: str - kind: str - memory_id: str - scope: str - updated_at: datetime - - @overload - def __init__( - self, - *, - content: str, - kind: str, - memory_id: str, - scope: str, - updated_at: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryItemKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CHAT_SUMMARY = "chat_summary" - PROCEDURAL = "procedural" - USER_PROFILE = "user_profile" - - - class azure.ai.projects.models.MemoryOperation(_Model): - kind: Union[str, MemoryOperationKind] - memory_item: MemoryItem - - @overload - def __init__( - self, - *, - kind: Union[str, MemoryOperationKind], - memory_item: MemoryItem - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryOperationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CREATE = "create" - DELETE = "delete" - UPDATE = "update" - - - class azure.ai.projects.models.MemorySearchItem(_Model): - memory_item: MemoryItem - - @overload - def __init__( - self, - *, - memory_item: MemoryItem - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemorySearchOptions(_Model): - max_memories: Optional[int] - - @overload - def __init__( - self, - *, - max_memories: Optional[int] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemorySearchPreviewTool(Tool, discriminator='memory_search_preview'): - description: Optional[str] - memory_store_name: str - name: Optional[str] - scope: str - search_options: Optional[MemorySearchOptions] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.MEMORY_SEARCH_PREVIEW] - update_delay: Optional[int] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - memory_store_name: str, - name: Optional[str] = ..., - scope: str, - search_options: Optional[MemorySearchOptions] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ..., - update_delay: Optional[int] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreDefaultDefinition(MemoryStoreDefinition, discriminator='default'): - chat_model: str - embedding_model: str - kind: Literal[MemoryStoreKind.DEFAULT] - options: Optional[MemoryStoreDefaultOptions] - - @overload - def __init__( - self, - *, - chat_model: str, - embedding_model: str, - options: Optional[MemoryStoreDefaultOptions] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreDefaultOptions(_Model): - chat_summary_enabled: bool - default_ttl_seconds: Optional[int] - procedural_memory_enabled: Optional[bool] - user_profile_details: Optional[str] - user_profile_enabled: bool - - @overload - def __init__( - self, - *, - chat_summary_enabled: bool, - default_ttl_seconds: Optional[int] = ..., - procedural_memory_enabled: Optional[bool] = ..., - user_profile_details: Optional[str] = ..., - user_profile_enabled: bool - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreDefinition(_Model): - kind: str - - @overload - def __init__( - self, - *, - kind: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreDeleteScopeResult(_Model): - deleted: bool - name: str - object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED] - scope: str - - @overload - def __init__( - self, - *, - deleted: bool, - name: str, - object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED], - scope: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreDetails(_Model): - created_at: datetime - definition: MemoryStoreDefinition - description: Optional[str] - id: str - metadata: Optional[dict[str, str]] - name: str - object: Literal[MemoryStoreObjectType.MEMORY_STORE] - updated_at: datetime - - @overload - def __init__( - self, - *, - created_at: datetime, - definition: MemoryStoreDefinition, - description: Optional[str] = ..., - id: str, - metadata: Optional[dict[str, str]] = ..., - name: str, - object: Literal[MemoryStoreObjectType.MEMORY_STORE], - updated_at: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - DEFAULT = "default" - - - class azure.ai.projects.models.MemoryStoreObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - MEMORY_DELETED = "memory_store.item.deleted" - MEMORY_STORE = "memory_store" - MEMORY_STORE_DELETED = "memory_store.deleted" - MEMORY_STORE_SCOPE_DELETED = "memory_store.scope.deleted" - - - class azure.ai.projects.models.MemoryStoreOperationUsage(_Model): - embedding_tokens: int - input_tokens: int - input_tokens_details: ResponseUsageInputTokensDetails - output_tokens: int - output_tokens_details: ResponseUsageOutputTokensDetails - total_tokens: int - - @overload - def __init__( - self, - *, - embedding_tokens: int, - input_tokens: int, - input_tokens_details: ResponseUsageInputTokensDetails, - output_tokens: int, - output_tokens_details: ResponseUsageOutputTokensDetails, - total_tokens: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreSearchResult(_Model): - memories: list[MemorySearchItem] - search_id: str - usage: MemoryStoreOperationUsage - - @overload - def __init__( - self, - *, - memories: list[MemorySearchItem], - search_id: str, - usage: MemoryStoreOperationUsage - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreUpdateCompletedResult(_Model): - memory_operations: list[MemoryOperation] - usage: MemoryStoreOperationUsage - - @overload - def __init__( - self, - *, - memory_operations: list[MemoryOperation], - usage: MemoryStoreOperationUsage - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreUpdateResult(_Model): - error: Optional[ApiError] - result: Optional[MemoryStoreUpdateCompletedResult] - status: Union[str, MemoryStoreUpdateStatus] - superseded_by: Optional[str] - update_id: str - - @overload - def __init__( - self, - *, - error: Optional[ApiError] = ..., - result: Optional[MemoryStoreUpdateCompletedResult] = ..., - status: Union[str, MemoryStoreUpdateStatus], - superseded_by: Optional[str] = ..., - update_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MemoryStoreUpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - COMPLETED = "completed" - FAILED = "failed" - IN_PROGRESS = "in_progress" - QUEUED = "queued" - SUPERSEDED = "superseded" - - - class azure.ai.projects.models.MicrosoftFabricPreviewTool(Tool, discriminator='fabric_dataagent_preview'): - description: Optional[str] - fabric_dataagent_preview: FabricDataAgentToolParameters - name: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.FABRIC_DATAAGENT_PREVIEW] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - fabric_dataagent_preview: FabricDataAgentToolParameters, - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ModelCredentialRequest(_Model): - blob_uri: str - - @overload - def __init__( - self, - *, - blob_uri: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ModelDeployment(Deployment, discriminator='ModelDeployment'): - capabilities: dict[str, str] - connection_name: Optional[str] - model_name: str - model_publisher: str - model_version: str - name: str - sku: ModelDeploymentSku - type: Literal[DeploymentType.MODEL_DEPLOYMENT] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ModelDeploymentSku(_Model): - capacity: int - family: str - name: str - size: str - tier: str - - @overload - def __init__( - self, - *, - capacity: int, - family: str, - name: str, - size: str, - tier: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ModelPendingUploadRequest(_Model): - connection_name: Optional[str] - pending_upload_id: Optional[str] - pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE] - - @overload - def __init__( - self, - *, - connection_name: Optional[str] = ..., - pending_upload_id: Optional[str] = ..., - pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ModelPendingUploadResponse(_Model): - blob_reference: BlobReference - pending_upload_id: str - pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE] - version: Optional[str] - - @overload - def __init__( - self, - *, - blob_reference: BlobReference, - pending_upload_id: str, - pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE], - version: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ModelSamplingConfigParam(TypedDict, total=False): - key "max_completion_tokens": int - key "seed": int - key "temperature": float - key "top_p": float - - - class azure.ai.projects.models.ModelSamplingParams(_Model): - max_completion_tokens: Optional[int] - seed: Optional[int] - temperature: Optional[float] - top_p: Optional[float] - - @overload - def __init__( - self, - *, - max_completion_tokens: Optional[int] = ..., - seed: Optional[int] = ..., - temperature: Optional[float] = ..., - top_p: Optional[float] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ModelSourceData(_Model): - job_id: Optional[str] - source_type: Optional[Union[str, FoundryModelSourceType]] - - @overload - def __init__( - self, - *, - job_id: Optional[str] = ..., - source_type: Optional[Union[str, FoundryModelSourceType]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ModelVersion(_Model): - artifact_profile: Optional[ArtifactProfile] - base_model: Optional[str] - blob_uri: str - description: Optional[str] - id: Optional[str] - lora_config: Optional[LoraConfig] - name: str - source: Optional[ModelSourceData] - system_data: Optional[SystemDataV3] - tags: Optional[dict[str, str]] - version: str - warnings: Optional[list[FoundryModelWarning]] - weight_type: Optional[Union[str, FoundryModelWeightType]] - - @overload - def __init__( - self, - *, - base_model: Optional[str] = ..., - blob_uri: str, - description: Optional[str] = ..., - lora_config: Optional[LoraConfig] = ..., - source: Optional[ModelSourceData] = ..., - tags: Optional[dict[str, str]] = ..., - weight_type: Optional[Union[str, FoundryModelWeightType]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.MonthlyRecurrenceSchedule(RecurrenceSchedule, discriminator='Monthly'): - days_of_month: list[int] - type: Literal[RecurrenceType.MONTHLY] - - @overload - def __init__( - self, - *, - days_of_month: list[int] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.NamespaceToolParam(Tool, discriminator='namespace'): - description: str - name: str - tools: list[Union[FunctionToolParam, CustomToolParam]] - type: Literal[ToolType.NAMESPACE] - - @overload - def __init__( - self, - *, - description: str, - name: str, - tools: list[Union[FunctionToolParam, CustomToolParam]] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.NoAuthenticationCredentials(BaseCredentials, discriminator='None'): - type: Literal[CredentialType.NONE] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OneTimeTrigger(Trigger, discriminator='OneTime'): - time_zone: Optional[str] - trigger_at: datetime - type: Literal[TriggerType.ONE_TIME] - - @overload - def __init__( - self, - *, - time_zone: Optional[str] = ..., - trigger_at: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OpenApiAnonymousAuthDetails(OpenApiAuthDetails, discriminator='anonymous'): - type: Literal[OpenApiAuthType.ANONYMOUS] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OpenApiAuthDetails(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OpenApiAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - ANONYMOUS = "anonymous" - MANAGED_IDENTITY = "managed_identity" - PROJECT_CONNECTION = "project_connection" - - - class azure.ai.projects.models.OpenApiFunctionDefinition(_Model): - auth: OpenApiAuthDetails - default_params: Optional[list[str]] - description: Optional[str] - functions: Optional[list[OpenApiFunctionDefinitionFunction]] - name: str - spec: dict[str, Any] - - @overload - def __init__( - self, - *, - auth: OpenApiAuthDetails, - default_params: Optional[list[str]] = ..., - description: Optional[str] = ..., - name: str, - spec: dict[str, Any] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OpenApiFunctionDefinitionFunction(_Model): - description: Optional[str] - name: str - parameters: dict[str, Any] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: str, - parameters: dict[str, Any] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OpenApiManagedAuthDetails(OpenApiAuthDetails, discriminator='managed_identity'): - security_scheme: OpenApiManagedSecurityScheme - type: Literal[OpenApiAuthType.MANAGED_IDENTITY] - - @overload - def __init__( - self, - *, - security_scheme: OpenApiManagedSecurityScheme - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OpenApiManagedSecurityScheme(_Model): - audience: str - - @overload - def __init__( - self, - *, - audience: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OpenApiProjectConnectionAuthDetails(OpenApiAuthDetails, discriminator='project_connection'): - security_scheme: OpenApiProjectConnectionSecurityScheme - type: Literal[OpenApiAuthType.PROJECT_CONNECTION] - - @overload - def __init__( - self, - *, - security_scheme: OpenApiProjectConnectionSecurityScheme - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OpenApiProjectConnectionSecurityScheme(_Model): - project_connection_id: str - - @overload - def __init__( - self, - *, - project_connection_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OpenApiTool(Tool, discriminator='openapi'): - openapi: OpenApiFunctionDefinition - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.OPENAPI] - - @overload - def __init__( - self, - *, - openapi: OpenApiFunctionDefinition, - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CANCELED = "Canceled" - FAILED = "Failed" - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - - - class azure.ai.projects.models.OptimizationAgentIdentifier(_Model): - agent_name: str - agent_version: Optional[str] - - @overload - def __init__( - self, - *, - agent_name: str, - agent_version: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationCandidate(_Model): - avg_score: float - avg_tokens: float - candidate_id: Optional[str] - eval_id: Optional[str] - eval_run_id: Optional[str] - mutations: Optional[dict[str, Any]] - name: str - promotion: Optional[PromotionInfo] - - @overload - def __init__( - self, - *, - avg_score: float, - avg_tokens: float, - candidate_id: Optional[str] = ..., - eval_id: Optional[str] = ..., - eval_run_id: Optional[str] = ..., - mutations: Optional[dict[str, Any]] = ..., - name: str, - promotion: Optional[PromotionInfo] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationDatasetCriterion(_Model): - instruction: str - name: str - - @overload - def __init__( - self, - *, - instruction: str, - name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationDatasetInput(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationDatasetInputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - INLINE = "inline" - REFERENCE = "reference" - - - class azure.ai.projects.models.OptimizationDatasetItem(_Model): - criteria: Optional[list[OptimizationDatasetCriterion]] - desired_num_turns: Optional[int] - ground_truth: Optional[str] - query: Optional[str] - - @overload - def __init__( - self, - *, - criteria: Optional[list[OptimizationDatasetCriterion]] = ..., - desired_num_turns: Optional[int] = ..., - ground_truth: Optional[str] = ..., - query: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationEvaluatorRef(_Model): - name: str - version: Optional[str] - - @overload - def __init__( - self, - *, - name: str, - version: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationInlineDatasetInput(OptimizationDatasetInput, discriminator='inline'): - dataset_items: list[OptimizationDatasetItem] - type: Literal[OptimizationDatasetInputType.INLINE] - - @overload - def __init__( - self, - *, - dataset_items: list[OptimizationDatasetItem] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationJob(_Model): - created_at: datetime - error: Optional[ApiError] - id: str - inputs: Optional[OptimizationJobInputs] - progress: Optional[OptimizationJobProgress] - result: Optional[OptimizationJobResult] - status: Union[str, JobStatus] - updated_at: datetime - warnings: Optional[list[str]] - - @overload - def __init__( - self, - *, - inputs: Optional[OptimizationJobInputs] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationJobInputs(_Model): - agent: OptimizationAgentIdentifier - evaluators: list[OptimizationEvaluatorRef] - options: Optional[OptimizationOptions] - train_dataset: OptimizationDatasetInput - validation_dataset: Optional[OptimizationDatasetInput] - - @overload - def __init__( - self, - *, - agent: OptimizationAgentIdentifier, - evaluators: list[OptimizationEvaluatorRef], - options: Optional[OptimizationOptions] = ..., - train_dataset: OptimizationDatasetInput, - validation_dataset: Optional[OptimizationDatasetInput] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationJobListItem(_Model): - agent: Optional[OptimizationAgentIdentifier] - created_at: datetime - error: Optional[ApiError] - id: str - progress: Optional[OptimizationJobProgress] - status: Union[str, JobStatus] - updated_at: datetime - - - class azure.ai.projects.models.OptimizationJobProgress(_Model): - best_score: float - candidates_completed: int - elapsed_seconds: float - - @overload - def __init__( - self, - *, - best_score: float, - candidates_completed: int, - elapsed_seconds: float - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationJobResult(_Model): - baseline: Optional[str] - best: Optional[str] - candidates: Optional[list[OptimizationCandidate]] - - @overload - def __init__( - self, - *, - baseline: Optional[str] = ..., - best: Optional[str] = ..., - candidates: Optional[list[OptimizationCandidate]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationOptions(_Model): - eval_model: Optional[str] - evaluation_level: Optional[Union[str, EvaluationLevel]] - max_candidates: Optional[int] - optimization_config: Optional[dict[str, Any]] - optimization_model: Optional[str] - - @overload - def __init__( - self, - *, - eval_model: Optional[str] = ..., - evaluation_level: Optional[Union[str, EvaluationLevel]] = ..., - max_candidates: Optional[int] = ..., - optimization_config: Optional[dict[str, Any]] = ..., - optimization_model: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OptimizationReferenceDatasetInput(OptimizationDatasetInput, discriminator='reference'): - name: str - type: Literal[OptimizationDatasetInputType.REFERENCE] - version: Optional[str] - - @overload - def __init__( - self, - *, - name: str, - version: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.OtlpTelemetryEndpoint(TelemetryEndpoint, discriminator='OTLP'): - auth: TelemetryEndpointAuth - data: Union[list[str, TelemetryDataKind]] - endpoint: str - kind: Literal[TelemetryEndpointKind.OTLP] - protocol: Union[str, TelemetryTransportProtocol] - - @overload - def __init__( - self, - *, - auth: Optional[TelemetryEndpointAuth] = ..., - data: list[Union[str, TelemetryDataKind]], - endpoint: str, - protocol: Union[str, TelemetryTransportProtocol] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.PageOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): - ASC = "asc" - DESC = "desc" - - - class azure.ai.projects.models.PendingUploadRequest(_Model): - connection_name: Optional[str] - pending_upload_id: Optional[str] - pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] - - @overload - def __init__( - self, - *, - connection_name: Optional[str] = ..., - pending_upload_id: Optional[str] = ..., - pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.PendingUploadResponse(_Model): - blob_reference: BlobReference - pending_upload_id: str - pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] - version: Optional[str] - - @overload - def __init__( - self, - *, - blob_reference: BlobReference, - pending_upload_id: str, - pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE], - version: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.PendingUploadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - BLOB_REFERENCE = "BlobReference" - NONE = "None" - TEMPORARY_BLOB_REFERENCE = "TemporaryBlobReference" - - - class azure.ai.projects.models.ProceduralMemoryItem(MemoryItem, discriminator='procedural'): - content: str - kind: Literal[MemoryItemKind.PROCEDURAL] - memory_id: str - scope: str - updated_at: datetime - - @overload - def __init__( - self, - *, - content: str, - memory_id: str, - scope: str, - updated_at: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.PromotionInfo(_Model): - agent_name: str - agent_version: str - promoted_at: datetime - - @overload - def __init__( - self, - *, - agent_name: str, - agent_version: str, - promoted_at: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.PromptAgentDefinition(AgentDefinition, discriminator='prompt'): - instructions: Optional[str] - kind: Literal[AgentKind.PROMPT] - model: str - rai_config: RaiConfig - reasoning: Optional[Reasoning] - structured_inputs: Optional[dict[str, StructuredInputDefinition]] - temperature: Optional[float] - text: Optional[PromptAgentDefinitionTextOptions] - tool_choice: Optional[Union[str, ToolChoiceParam]] - tools: Optional[list[Tool]] - top_p: Optional[float] - - @overload - def __init__( - self, - *, - instructions: Optional[str] = ..., - model: str, - rai_config: Optional[RaiConfig] = ..., - reasoning: Optional[Reasoning] = ..., - structured_inputs: Optional[dict[str, StructuredInputDefinition]] = ..., - temperature: Optional[float] = ..., - text: Optional[PromptAgentDefinitionTextOptions] = ..., - tool_choice: Optional[Union[str, ToolChoiceParam]] = ..., - tools: Optional[list[Tool]] = ..., - top_p: Optional[float] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.PromptAgentDefinitionTextOptions(_Model): - format: Optional[TextResponseFormat] - - @overload - def __init__( - self, - *, - format: Optional[TextResponseFormat] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.PromptBasedEvaluatorDefinition(EvaluatorDefinition, discriminator='prompt'): - data_schema: dict[str, any] - init_parameters: dict[str, any] - metrics: dict[str, EvaluatorMetric] - prompt_text: str - type: Literal[EvaluatorDefinitionType.PROMPT] - - @overload - def __init__( - self, - *, - data_schema: Optional[dict[str, Any]] = ..., - init_parameters: Optional[dict[str, Any]] = ..., - metrics: Optional[dict[str, EvaluatorMetric]] = ..., - prompt_text: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.PromptDataGenerationJobSource(DataGenerationJobSource, discriminator='prompt'): - description: str - prompt: str - type: Literal[DataGenerationJobSourceType.PROMPT] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - prompt: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.PromptEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator='prompt'): - description: Optional[str] - prompt: str - type: Literal[EvaluatorGenerationJobSourceType.PROMPT] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - prompt: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ProtocolVersionRecord(_Model): - protocol: Union[str, AgentProtocol] - version: str - - @overload - def __init__( - self, - *, - protocol: Union[str, AgentProtocol], - version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RaiConfig(_Model): - rai_policy_name: str - - @overload - def __init__( - self, - *, - rai_policy_name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RankerVersionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AUTO = "auto" - DEFAULT_2024_11_15 = "default-2024-11-15" - - - class azure.ai.projects.models.RankingOptions(_Model): - hybrid_search: Optional[HybridSearchOptions] - ranker: Optional[Union[str, RankerVersionType]] - score_threshold: Optional[float] - - @overload - def __init__( - self, - *, - hybrid_search: Optional[HybridSearchOptions] = ..., - ranker: Optional[Union[str, RankerVersionType]] = ..., - score_threshold: Optional[float] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.Reasoning(_Model): - effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] - generate_summary: Optional[Literal["auto", "concise", "detailed"]] - summary: Optional[Literal["auto", "concise", "detailed"]] - - @overload - def __init__( - self, - *, - effort: Optional[Literal[none, minimal, low, medium, high, xhigh]] = ..., - generate_summary: Optional[Literal[auto, concise, detailed]] = ..., - summary: Optional[Literal[auto, concise, detailed]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RecurrenceSchedule(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RecurrenceTrigger(Trigger, discriminator='Recurrence'): - end_time: Optional[datetime] - interval: int - schedule: RecurrenceSchedule - start_time: Optional[datetime] - time_zone: Optional[str] - type: Literal[TriggerType.RECURRENCE] - - @overload - def __init__( - self, - *, - end_time: Optional[datetime] = ..., - interval: int, - schedule: RecurrenceSchedule, - start_time: Optional[datetime] = ..., - time_zone: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RecurrenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - DAILY = "Daily" - HOURLY = "Hourly" - MONTHLY = "Monthly" - WEEKLY = "Weekly" - - - class azure.ai.projects.models.RedTeam(_Model): - application_scenario: Optional[str] - attack_strategies: Optional[list[Union[str, AttackStrategy]]] - display_name: Optional[str] - name: str - num_turns: Optional[int] - properties: Optional[dict[str, str]] - risk_categories: Optional[list[Union[str, RiskCategory]]] - simulation_only: Optional[bool] - status: Optional[str] - tags: Optional[dict[str, str]] - target: RedTeamTargetConfig - - @overload - def __init__( - self, - *, - application_scenario: Optional[str] = ..., - attack_strategies: Optional[list[Union[str, AttackStrategy]]] = ..., - display_name: Optional[str] = ..., - num_turns: Optional[int] = ..., - properties: Optional[dict[str, str]] = ..., - risk_categories: Optional[list[Union[str, RiskCategory]]] = ..., - simulation_only: Optional[bool] = ..., - tags: Optional[dict[str, str]] = ..., - target: RedTeamTargetConfig - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RedTeamEvalRunDataSource(TypedDict, total=False): - key "item_generation_params": Required[Any] - key "target": Required[Union[AzureAIAgentTargetParam, AzureAIModelTargetParam, dict[str, Any]]] - key "type": Required[Literal["azure_ai_red_team"]] - - - class azure.ai.projects.models.RedTeamTargetConfig(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ResponseRetrievalItemGenerationParams(TypedDict, total=False): - key "data_mapping": Required[Dict[str, str]] - key "max_num_turns": int - key "source": Required[Union[SourceFileContent, SourceFileID]] - key "type": Required[Literal["response_retrieval"]] - - - class azure.ai.projects.models.ResponseUsageInputTokensDetails(_Model): - cached_tokens: int - - @overload - def __init__( - self, - *, - cached_tokens: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ResponseUsageOutputTokensDetails(_Model): - reasoning_tokens: int - - @overload - def __init__( - self, - *, - reasoning_tokens: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RiskCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CODE_VULNERABILITY = "CodeVulnerability" - HATE_UNFAIRNESS = "HateUnfairness" - PROHIBITED_ACTIONS = "ProhibitedActions" - PROTECTED_MATERIAL = "ProtectedMaterial" - SELF_HARM = "SelfHarm" - SENSITIVE_DATA_LEAKAGE = "SensitiveDataLeakage" - SEXUAL = "Sexual" - TASK_ADHERENCE = "TaskAdherence" - UNGROUNDED_ATTRIBUTES = "UngroundedAttributes" - VIOLENCE = "Violence" - - - class azure.ai.projects.models.Routine(_Model): - action: Optional[RoutineAction] - created_at: Optional[datetime] - description: Optional[str] - enabled: bool - name: Optional[str] - triggers: Optional[dict[str, RoutineTrigger]] - updated_at: Optional[datetime] - - @overload - def __init__( - self, - *, - action: Optional[RoutineAction] = ..., - created_at: Optional[datetime] = ..., - description: Optional[str] = ..., - enabled: bool, - name: Optional[str] = ..., - triggers: Optional[dict[str, RoutineTrigger]] = ..., - updated_at: Optional[datetime] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RoutineAction(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RoutineActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - INVOKE_AGENT_INVOCATIONS_API = "invoke_agent_invocations_api" - INVOKE_AGENT_RESPONSES_API = "invoke_agent_responses_api" - - - class azure.ai.projects.models.RoutineAttemptSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): - EVENT_FIRE = "event_fire" - MANUAL_DISPATCH = "manual_dispatch" - QUEUED_DISPATCH = "queued_dispatch" - SCHEDULE_DELIVERY = "schedule_delivery" - TIMER_DELIVERY = "timer_delivery" - - - class azure.ai.projects.models.RoutineDispatchPayload(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RoutineDispatchPayloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - INVOKE_AGENT_INVOCATIONS_API = "invoke_agent_invocations_api" - INVOKE_AGENT_RESPONSES_API = "invoke_agent_responses_api" - - - class azure.ai.projects.models.RoutineRun(_Model): - action_correlation_id: Optional[str] - action_type: Optional[Union[str, RoutineActionType]] - agent_endpoint_id: Optional[str] - agent_id: Optional[str] - attempt_source: Optional[Union[str, RoutineAttemptSource]] - conversation_id: Optional[str] - dispatch_id: Optional[str] - ended_at: Optional[datetime] - error_message: Optional[str] - error_status_code: Optional[int] - error_type: Optional[str] - id: str - phase: Optional[Union[str, RoutineRunPhase]] - response_id: Optional[str] - scheduled_fire_at: Optional[datetime] - session_id: Optional[str] - started_at: Optional[datetime] - status: Optional[RoutineRunStatus] - task_id: Optional[str] - trigger_name: Optional[str] - trigger_type: Optional[Union[str, RoutineTriggerType]] - triggered_at: Optional[datetime] - - @overload - def __init__( - self, - *, - action_correlation_id: Optional[str] = ..., - action_type: Optional[Union[str, RoutineActionType]] = ..., - agent_endpoint_id: Optional[str] = ..., - agent_id: Optional[str] = ..., - attempt_source: Optional[Union[str, RoutineAttemptSource]] = ..., - conversation_id: Optional[str] = ..., - dispatch_id: Optional[str] = ..., - ended_at: Optional[datetime] = ..., - error_message: Optional[str] = ..., - error_status_code: Optional[int] = ..., - error_type: Optional[str] = ..., - phase: Optional[Union[str, RoutineRunPhase]] = ..., - response_id: Optional[str] = ..., - scheduled_fire_at: Optional[datetime] = ..., - session_id: Optional[str] = ..., - started_at: Optional[datetime] = ..., - status: Optional[RoutineRunStatus] = ..., - task_id: Optional[str] = ..., - trigger_name: Optional[str] = ..., - trigger_type: Optional[Union[str, RoutineTriggerType]] = ..., - triggered_at: Optional[datetime] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RoutineRunPhase(str, Enum, metaclass=CaseInsensitiveEnumMeta): - COMPLETED = "completed" - DISPATCHING = "dispatching" - FAILED = "failed" - QUEUED = "queued" - - - class azure.ai.projects.models.RoutineTrigger(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.RoutineTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CUSTOM = "custom" - GITHUB_ISSUE = "github_issue" - SCHEDULE = "schedule" - TIMER = "timer" - - - class azure.ai.projects.models.RubricBasedEvaluatorDefinition(EvaluatorDefinition, discriminator='rubric'): - data_schema: dict[str, any] - dimensions: list[Dimension] - init_parameters: dict[str, any] - metrics: dict[str, EvaluatorMetric] - pass_threshold: Optional[float] - type: Literal[EvaluatorDefinitionType.RUBRIC] - - @overload - def __init__( - self, - *, - data_schema: Optional[dict[str, Any]] = ..., - dimensions: list[Dimension], - init_parameters: Optional[dict[str, Any]] = ..., - metrics: Optional[dict[str, EvaluatorMetric]] = ..., - pass_threshold: Optional[float] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SASCredentials(BaseCredentials, discriminator='SAS'): - sas_token: Optional[str] - type: Literal[CredentialType.SAS] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SampleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - EVALUATION_RESULT_SAMPLE = "EvaluationResultSample" - - - class azure.ai.projects.models.Schedule(_Model): - description: Optional[str] - display_name: Optional[str] - enabled: bool - properties: Optional[dict[str, str]] - provisioning_status: Optional[Union[str, ScheduleProvisioningStatus]] - schedule_id: str - system_data: dict[str, str] - tags: Optional[dict[str, str]] - task: ScheduleTask - trigger: Trigger - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - display_name: Optional[str] = ..., - enabled: bool, - properties: Optional[dict[str, str]] = ..., - tags: Optional[dict[str, str]] = ..., - task: ScheduleTask, - trigger: Trigger - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ScheduleProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CREATING = "Creating" - DELETING = "Deleting" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - - - class azure.ai.projects.models.ScheduleRoutineTrigger(RoutineTrigger, discriminator='schedule'): - cron_expression: str - time_zone: str - type: Literal[RoutineTriggerType.SCHEDULE] - - @overload - def __init__( - self, - *, - cron_expression: str, - time_zone: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ScheduleRun(_Model): - error: Optional[str] - properties: dict[str, str] - run_id: str - schedule_id: str - success: bool - trigger_time: Optional[datetime] - - @overload - def __init__( - self, - *, - schedule_id: str, - trigger_time: Optional[datetime] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ScheduleTask(_Model): - configuration: Optional[dict[str, str]] - type: str - - @overload - def __init__( - self, - *, - configuration: Optional[dict[str, str]] = ..., - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ScheduleTaskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - EVALUATION = "Evaluation" - INSIGHT = "Insight" - - - class azure.ai.projects.models.SearchContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - IMAGE = "image" - TEXT = "text" - - - class azure.ai.projects.models.SearchContextSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): - HIGH = "high" - LOW = "low" - MEDIUM = "medium" - - - class azure.ai.projects.models.SessionDirectoryEntry(_Model): - is_directory: bool - modified_time: datetime - name: str - size: int - - @overload - def __init__( - self, - *, - is_directory: bool, - modified_time: datetime, - name: str, - size: int - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SessionFileWriteResult(_Model): - bytes_written: int - path: str - - @overload - def __init__( - self, - *, - bytes_written: int, - path: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SessionLogEvent(_Model): - data: str - event: Union[str, SessionLogEventType] - - @overload - def __init__( - self, - *, - data: str, - event: Union[str, SessionLogEventType] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SessionLogEventType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - LOG = "log" - - - class azure.ai.projects.models.SharepointGroundingToolParameters(_Model): - project_connections: Optional[list[ToolProjectConnection]] - - @overload - def __init__( - self, - *, - project_connections: Optional[list[ToolProjectConnection]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SharepointPreviewTool(Tool, discriminator='sharepoint_grounding_preview'): - description: Optional[str] - name: Optional[str] - sharepoint_grounding_preview: SharepointGroundingToolParameters - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.SHAREPOINT_GROUNDING_PREVIEW] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - sharepoint_grounding_preview: SharepointGroundingToolParameters, - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SimpleQnADataGenerationJobOptions(DataGenerationJobOptions, discriminator='simple_qna'): - max_samples: int - model_options: DataGenerationModelOptions - question_types: Optional[list[Union[str, SimpleQnAFineTuningQuestionType]]] - train_split: float - type: Literal[DataGenerationJobType.SIMPLE_QNA] - - @overload - def __init__( - self, - *, - max_samples: int, - model_options: Optional[DataGenerationModelOptions] = ..., - question_types: Optional[list[Union[str, SimpleQnAFineTuningQuestionType]]] = ..., - train_split: Optional[float] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SimpleQnAFineTuningQuestionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - LONG_ANSWER = "long_answer" - SHORT_ANSWER = "short_answer" - - - class azure.ai.projects.models.SkillDetails(_Model): - created_at: datetime - default_version: str - description: str - id: str - latest_version: str - name: str - - @overload - def __init__( - self, - *, - created_at: datetime, - default_version: str, - description: str, - id: str, - latest_version: str, - name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SkillInlineContent(_Model): - allowed_tools: Optional[list[str]] - compatibility: Optional[str] - description: str - instructions: str - license: Optional[str] - metadata: Optional[dict[str, str]] - - @overload - def __init__( - self, - *, - allowed_tools: Optional[list[str]] = ..., - compatibility: Optional[str] = ..., - description: str, - instructions: str, - license: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SkillReferenceParam(ContainerSkill, discriminator='skill_reference'): - skill_id: str - type: Literal[ContainerSkillType.SKILL_REFERENCE] - version: Optional[str] - - @overload - def __init__( - self, - *, - skill_id: str, - version: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SkillVersion(_Model): - created_at: datetime - description: str - id: str - name: str - skill_id: str - version: str - - @overload - def __init__( - self, - *, - created_at: datetime, - description: str, - id: str, - name: str, - skill_id: str, - version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SpecificApplyPatchParam(ToolChoiceParam, discriminator='apply_patch'): - type: Literal[ToolChoiceParamType.APPLY_PATCH] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SpecificFunctionShellParam(ToolChoiceParam, discriminator='shell'): - type: Literal[ToolChoiceParamType.SHELL] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.StructuredInputDefinition(_Model): - default_value: Optional[Any] - description: Optional[str] - required: Optional[bool] - schema: Optional[dict[str, Any]] - - @overload - def __init__( - self, - *, - default_value: Optional[Any] = ..., - description: Optional[str] = ..., - required: Optional[bool] = ..., - schema: Optional[dict[str, Any]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.StructuredOutputDefinition(_Model): - description: str - name: str - schema: dict[str, Any] - strict: bool - - @overload - def __init__( - self, - *, - description: str, - name: str, - schema: dict[str, Any], - strict: bool - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.SystemDataV3(_Model): - created_at: Optional[datetime] - created_by: Optional[str] - created_by_type: Optional[str] - last_modified_at: Optional[datetime] - - @overload - def __init__( - self, - *, - created_at: Optional[datetime] = ..., - created_by: Optional[str] = ..., - created_by_type: Optional[str] = ..., - last_modified_at: Optional[datetime] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TargetCompletionEvalRunDataSource(TypedDict, total=False): - key "input_messages": Required[InputMessagesItemReference] - key "source": Required[Union[SourceFileContent, SourceFileID]] - key "target": Required[Union[AzureAIAgentTargetParam, AzureAIModelTargetParam, dict[str, Any]]] - key "type": Required[Literal["azure_ai_target_completions"]] - - - class azure.ai.projects.models.TaxonomyCategory(_Model): - description: Optional[str] - id: str - name: str - properties: Optional[dict[str, str]] - risk_category: Union[str, RiskCategory] - sub_categories: list[TaxonomySubCategory] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - id: str, - name: str, - properties: Optional[dict[str, str]] = ..., - risk_category: Union[str, RiskCategory], - sub_categories: list[TaxonomySubCategory] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TaxonomySubCategory(_Model): - description: Optional[str] - enabled: bool - id: str - name: str - properties: Optional[dict[str, str]] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - enabled: bool, - id: str, - name: str, - properties: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TelemetryConfig(_Model): - endpoints: list[TelemetryEndpoint] - - @overload - def __init__( - self, - *, - endpoints: list[TelemetryEndpoint] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TelemetryDataKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CONTAINER_OTEL = "ContainerOtel" - CONTAINER_STDOUT_STDERR = "ContainerStdoutStderr" - METRICS = "Metrics" - - - class azure.ai.projects.models.TelemetryEndpoint(_Model): - auth: Optional[TelemetryEndpointAuth] - data: list[Union[str, TelemetryDataKind]] - kind: str - - @overload - def __init__( - self, - *, - auth: Optional[TelemetryEndpointAuth] = ..., - data: list[Union[str, TelemetryDataKind]], - kind: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TelemetryEndpointAuth(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TelemetryEndpointAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - HEADER = "header" - - - class azure.ai.projects.models.TelemetryEndpointKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - OTLP = "OTLP" - - - class azure.ai.projects.models.TelemetryTransportProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - GRPC = "Grpc" - HTTP = "Http" - - - class azure.ai.projects.models.TestingCriterionAzureAIEvaluator(TypedDict, total=False): - key "data_mapping": Dict[str, str] - key "evaluator_name": Required[str] - key "evaluator_version": str - key "initialization_parameters": Dict[str, Any] - key "name": Required[str] - key "type": Required[Literal["azure_ai_evaluator"]] - - - class azure.ai.projects.models.TextResponseFormat(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TextResponseFormatConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - JSON_OBJECT = "json_object" - JSON_SCHEMA = "json_schema" - TEXT = "text" - - - class azure.ai.projects.models.TextResponseFormatJsonObject(TextResponseFormat, discriminator='json_object'): - type: Literal[TextResponseFormatConfigurationType.JSON_OBJECT] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TextResponseFormatJsonSchema(TextResponseFormat, discriminator='json_schema'): - description: Optional[str] - name: str - schema: dict[str, Any] - strict: Optional[bool] - type: Literal[TextResponseFormatConfigurationType.JSON_SCHEMA] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: str, - schema: dict[str, Any], - strict: Optional[bool] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TextResponseFormatText(TextResponseFormat, discriminator='text'): - type: Literal[TextResponseFormatConfigurationType.TEXT] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TimerRoutineTrigger(RoutineTrigger, discriminator='timer'): - at: Optional[datetime] - type: Literal[RoutineTriggerType.TIMER] - - @overload - def __init__( - self, - *, - at: Optional[datetime] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.Tool(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceAllowed(ToolChoiceParam, discriminator='allowed_tools'): - mode: Literal["auto", "required"] - tools: list[dict[str, Any]] - type: Literal[ToolChoiceParamType.ALLOWED_TOOLS] - - @overload - def __init__( - self, - *, - mode: Literal["auto", "required"], - tools: list[dict[str, Any]] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceCodeInterpreter(ToolChoiceParam, discriminator='code_interpreter'): - type: Literal[ToolChoiceParamType.CODE_INTERPRETER] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceComputer(ToolChoiceParam, discriminator='computer'): - type: Literal[ToolChoiceParamType.COMPUTER] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceComputerUse(ToolChoiceParam, discriminator='computer_use'): - type: Literal[ToolChoiceParamType.COMPUTER_USE] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceComputerUsePreview(ToolChoiceParam, discriminator='computer_use_preview'): - type: Literal[ToolChoiceParamType.COMPUTER_USE_PREVIEW] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceCustom(ToolChoiceParam, discriminator='custom'): - name: str - type: Literal[ToolChoiceParamType.CUSTOM] - - @overload - def __init__( - self, - *, - name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceFileSearch(ToolChoiceParam, discriminator='file_search'): - type: Literal[ToolChoiceParamType.FILE_SEARCH] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceFunction(ToolChoiceParam, discriminator='function'): - name: str - type: Literal[ToolChoiceParamType.FUNCTION] - - @overload - def __init__( - self, - *, - name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceImageGeneration(ToolChoiceParam, discriminator='image_generation'): - type: Literal[ToolChoiceParamType.IMAGE_GENERATION] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceMCP(ToolChoiceParam, discriminator='mcp'): - name: Optional[str] - server_label: str - type: Literal[ToolChoiceParamType.MCP] - - @overload - def __init__( - self, - *, - name: Optional[str] = ..., - server_label: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceParam(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceParamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - ALLOWED_TOOLS = "allowed_tools" - APPLY_PATCH = "apply_patch" - CODE_INTERPRETER = "code_interpreter" - COMPUTER = "computer" - COMPUTER_USE = "computer_use" - COMPUTER_USE_PREVIEW = "computer_use_preview" - CUSTOM = "custom" - FILE_SEARCH = "file_search" - FUNCTION = "function" - IMAGE_GENERATION = "image_generation" - MCP = "mcp" - SHELL = "shell" - WEB_SEARCH_PREVIEW = "web_search_preview" - WEB_SEARCH_PREVIEW_2025_03_11 = "web_search_preview_2025_03_11" - - - class azure.ai.projects.models.ToolChoiceWebSearchPreview(ToolChoiceParam, discriminator='web_search_preview'): - type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolChoiceWebSearchPreview20250311(ToolChoiceParam, discriminator='web_search_preview_2025_03_11'): - type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW_2025_03_11] - - @overload - def __init__(self) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolConfig(_Model): - additional_search_text: Optional[str] - pin: Optional[bool] - - @overload - def __init__( - self, - *, - additional_search_text: Optional[str] = ..., - pin: Optional[bool] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolDescription(_Model): - description: Optional[str] - name: Optional[str] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolDescriptionParam(TypedDict, total=False): - key "description": str - key "name": str - - - class azure.ai.projects.models.ToolProjectConnection(_Model): - project_connection_id: str - - @overload - def __init__( - self, - *, - project_connection_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolSearchExecutionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CLIENT = "client" - SERVER = "server" - - - class azure.ai.projects.models.ToolSearchToolParam(Tool, discriminator='tool_search'): - description: Optional[str] - execution: Optional[Union[str, ToolSearchExecutionType]] - parameters: Optional[EmptyModelParam] - type: Literal[ToolType.TOOL_SEARCH] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - execution: Optional[Union[str, ToolSearchExecutionType]] = ..., - parameters: Optional[EmptyModelParam] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - A2A_PREVIEW = "a2a_preview" - APPLY_PATCH = "apply_patch" - AZURE_AI_SEARCH = "azure_ai_search" - AZURE_FUNCTION = "azure_function" - BING_CUSTOM_SEARCH_PREVIEW = "bing_custom_search_preview" - BING_GROUNDING = "bing_grounding" - BROWSER_AUTOMATION_PREVIEW = "browser_automation_preview" - CAPTURE_STRUCTURED_OUTPUTS = "capture_structured_outputs" - CODE_INTERPRETER = "code_interpreter" - COMPUTER = "computer" - COMPUTER_USE_PREVIEW = "computer_use_preview" - CUSTOM = "custom" - FABRIC_DATAAGENT_PREVIEW = "fabric_dataagent_preview" - FABRIC_IQ_PREVIEW = "fabric_iq_preview" - FILE_SEARCH = "file_search" - FUNCTION = "function" - IMAGE_GENERATION = "image_generation" - LOCAL_SHELL = "local_shell" - MCP = "mcp" - MEMORY_SEARCH_PREVIEW = "memory_search_preview" - NAMESPACE = "namespace" - OPENAPI = "openapi" - SHAREPOINT_GROUNDING_PREVIEW = "sharepoint_grounding_preview" - SHELL = "shell" - TOOLBOX_SEARCH_PREVIEW = "toolbox_search_preview" - TOOL_SEARCH = "tool_search" - WEB_SEARCH = "web_search" - WEB_SEARCH_PREVIEW = "web_search_preview" - WORK_IQ_PREVIEW = "work_iq_preview" - - - class azure.ai.projects.models.ToolUseFineTuningDataGenerationJobOptions(DataGenerationJobOptions, discriminator='tool_use'): - max_samples: int - model_options: DataGenerationModelOptions - train_split: float - type: Literal[DataGenerationJobType.TOOL_USE] - - @overload - def __init__( - self, - *, - max_samples: int, - model_options: Optional[DataGenerationModelOptions] = ..., - train_split: Optional[float] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolboxObject(_Model): - default_version: str - id: str - name: str - - @overload - def __init__( - self, - *, - default_version: str, - id: str, - name: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolboxPolicies(_Model): - rai_config: Optional[RaiConfig] - - @overload - def __init__( - self, - *, - rai_config: Optional[RaiConfig] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolboxSearchPreviewTool(Tool, discriminator='toolbox_search_preview'): - description: Optional[str] - name: Optional[str] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.TOOLBOX_SEARCH_PREVIEW] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolboxSkill(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolboxSkillReference(ToolboxSkill, discriminator='skill_reference'): - name: str - type: Literal["skill_reference"] - version: Optional[str] - - @overload - def __init__( - self, - *, - name: str, - version: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.ToolboxVersionObject(_Model): - created_at: datetime - description: Optional[str] - id: str - metadata: dict[str, str] - name: str - policies: Optional[ToolboxPolicies] - skills: Optional[list[ToolboxSkill]] - tools: list[Tool] - version: str - - @overload - def __init__( - self, - *, - created_at: datetime, - description: Optional[str] = ..., - id: str, - metadata: dict[str, str], - name: str, - policies: Optional[ToolboxPolicies] = ..., - skills: Optional[list[ToolboxSkill]] = ..., - tools: list[Tool], - version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TracesDataGenerationJobOptions(DataGenerationJobOptions, discriminator='traces'): - max_samples: int - model_options: DataGenerationModelOptions - train_split: float - type: Literal[DataGenerationJobType.TRACES] - - @overload - def __init__( - self, - *, - max_samples: int, - model_options: Optional[DataGenerationModelOptions] = ..., - train_split: Optional[float] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TracesDataGenerationJobSource(DataGenerationJobSource, discriminator='traces'): - agent_id: Optional[str] - agent_name: Optional[str] - agent_version: Optional[str] - description: str - end_time: Optional[datetime] - start_time: datetime - type: Literal[DataGenerationJobSourceType.TRACES] - - @overload - def __init__( - self, - *, - agent_id: Optional[str] = ..., - agent_name: Optional[str] = ..., - agent_version: Optional[str] = ..., - description: Optional[str] = ..., - end_time: Optional[datetime] = ..., - start_time: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TracesEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator='traces'): - agent_id: Optional[str] - agent_name: Optional[str] - agent_version: Optional[str] - description: Optional[str] - end_time: Optional[datetime] - start_time: datetime - type: Literal[EvaluatorGenerationJobSourceType.TRACES] - - @overload - def __init__( - self, - *, - agent_id: Optional[str] = ..., - agent_name: Optional[str] = ..., - agent_version: Optional[str] = ..., - description: Optional[str] = ..., - end_time: Optional[datetime] = ..., - start_time: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TracesPreviewEvalRunDataSource(TypedDict, total=False): - key "agent_id": str - key "agent_name": str - key "end_time": datetime - key "ingestion_delay_seconds": int - key "lookback_hours": int - key "max_traces": int - key "trace_ids": List[str] - key "type": Required[Literal["azure_ai_traces_preview"]] - - - class azure.ai.projects.models.TreatmentEffectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CHANGED = "Changed" - DEGRADED = "Degraded" - IMPROVED = "Improved" - INCONCLUSIVE = "Inconclusive" - TOO_FEW_SAMPLES = "TooFewSamples" - - - class azure.ai.projects.models.Trigger(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - CRON = "Cron" - ONE_TIME = "OneTime" - RECURRENCE = "Recurrence" - - - class azure.ai.projects.models.UpdateMemoriesLROPoller(LROPoller[MemoryStoreUpdateCompletedResult]): - property superseded_by: Optional[str] # Read-only - property update_id: str # Read-only - - @classmethod - def from_continuation_token( - cls, - polling_method: PollingMethod[MemoryStoreUpdateCompletedResult], - continuation_token: str, - **kwargs: Any - ) -> UpdateMemoriesLROPoller: ... - - - class azure.ai.projects.models.UpdateModelVersionRequest(_Model): - description: Optional[str] - tags: Optional[dict[str, str]] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - tags: Optional[dict[str, str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.UpdateToolboxRequest(_Model): - default_version: str - - @overload - def __init__( - self, - *, - default_version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.UserProfileMemoryItem(MemoryItem, discriminator='user_profile'): - content: str - kind: Literal[MemoryItemKind.USER_PROFILE] - memory_id: str - scope: str - updated_at: datetime - - @overload - def __init__( - self, - *, - content: str, - memory_id: str, - scope: str, - updated_at: datetime - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.VersionIndicator(_Model): - type: str - - @overload - def __init__( - self, - *, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.VersionIndicatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - VERSION_REF = "version_ref" - - - class azure.ai.projects.models.VersionRefIndicator(VersionIndicator, discriminator='version_ref'): - agent_version: str - type: Literal[VersionIndicatorType.VERSION_REF] - - @overload - def __init__( - self, - *, - agent_version: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.VersionSelectionRule(_Model): - agent_version: str - type: str - - @overload - def __init__( - self, - *, - agent_version: str, - type: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.VersionSelector(_Model): - version_selection_rules: list[VersionSelectionRule] - - @overload - def __init__( - self, - *, - version_selection_rules: list[VersionSelectionRule] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.VersionSelectorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - FIXED_RATIO = "FixedRatio" - - - class azure.ai.projects.models.WebSearchApproximateLocation(_Model): - city: Optional[str] - country: Optional[str] - region: Optional[str] - timezone: Optional[str] - type: Literal["approximate"] - - @overload - def __init__( - self, - *, - city: Optional[str] = ..., - country: Optional[str] = ..., - region: Optional[str] = ..., - timezone: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.WebSearchConfiguration(_Model): - instance_name: str - project_connection_id: str - - @overload - def __init__( - self, - *, - instance_name: str, - project_connection_id: str - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.WebSearchPreviewTool(Tool, discriminator='web_search_preview'): - search_content_types: Optional[list[Union[str, SearchContentType]]] - search_context_size: Optional[Union[str, SearchContextSize]] - type: Literal[ToolType.WEB_SEARCH_PREVIEW] - user_location: Optional[ApproximateLocation] - - @overload - def __init__( - self, - *, - search_content_types: Optional[list[Union[str, SearchContentType]]] = ..., - search_context_size: Optional[Union[str, SearchContextSize]] = ..., - user_location: Optional[ApproximateLocation] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.WebSearchTool(Tool, discriminator='web_search'): - custom_search_configuration: Optional[WebSearchConfiguration] - description: Optional[str] - filters: Optional[WebSearchToolFilters] - name: Optional[str] - search_context_size: Optional[Literal["low", "medium", "high"]] - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.WEB_SEARCH] - user_location: Optional[WebSearchApproximateLocation] - - @overload - def __init__( - self, - *, - custom_search_configuration: Optional[WebSearchConfiguration] = ..., - description: Optional[str] = ..., - filters: Optional[WebSearchToolFilters] = ..., - name: Optional[str] = ..., - search_context_size: Optional[Literal[low, medium, high]] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ..., - user_location: Optional[WebSearchApproximateLocation] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.WebSearchToolFilters(_Model): - allowed_domains: Optional[list[str]] - - @overload - def __init__( - self, - *, - allowed_domains: Optional[list[str]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.WeeklyRecurrenceSchedule(RecurrenceSchedule, discriminator='Weekly'): - days_of_week: list[Union[str, DayOfWeek]] - type: Literal[RecurrenceType.WEEKLY] - - @overload - def __init__( - self, - *, - days_of_week: list[Union[str, DayOfWeek]] - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.WorkIQPreviewTool(Tool, discriminator='work_iq_preview'): - description: Optional[str] - name: Optional[str] - project_connection_id: str - tool_configs: Optional[dict[str, ToolConfig]] - type: Literal[ToolType.WORK_IQ_PREVIEW] - - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - project_connection_id: str, - tool_configs: Optional[dict[str, ToolConfig]] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.ai.projects.models.WorkflowAgentDefinition(AgentDefinition, discriminator='workflow'): - kind: Literal[AgentKind.WORKFLOW] - rai_config: RaiConfig - workflow: Optional[str] - - @overload - def __init__( - self, - *, - rai_config: Optional[RaiConfig] = ..., - workflow: Optional[str] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - -namespace azure.ai.projects.operations - - class azure.ai.projects.operations.AgentsOperations(GeneratedAgentsOperations): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create_version( - self, - agent_name: str, - *, - blueprint_reference: Optional[AgentBlueprintReference] = ..., - content_type: str = "application/json", - definition: AgentDefinition, - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - def create_version( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - def create_version( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - def create_version_from_manifest( - self, - agent_name: str, - *, - content_type: str = "application/json", - description: Optional[str] = ..., - manifest_id: str, - metadata: Optional[dict[str, str]] = ..., - parameter_values: dict[str, Any], - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - def create_version_from_manifest( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - def create_version_from_manifest( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AgentVersionDetails: ... - - @distributed_trace - def delete( - self, - agent_name: str, - *, - force: Optional[bool] = ..., - **kwargs: Any - ) -> DeleteAgentResponse: ... - - @distributed_trace - def delete_version( - self, - agent_name: str, - agent_version: str, - *, - force: Optional[bool] = ..., - **kwargs: Any - ) -> DeleteAgentVersionResponse: ... - - @distributed_trace - def get( - self, - agent_name: str, - **kwargs: Any - ) -> AgentDetails: ... - - @distributed_trace - def get_version( - self, - agent_name: str, - agent_version: str, - **kwargs: Any - ) -> AgentVersionDetails: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - kind: Optional[Union[str, AgentKind]] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[AgentDetails]: ... - - @distributed_trace - def list_versions( - self, - agent_name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[AgentVersionDetails]: ... - - - class azure.ai.projects.operations.BetaAgentsOperations(GeneratedBetaAgentsOperations): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace - def cancel_optimization_job( - self, - job_id: str, - **kwargs: Any - ) -> OptimizationJob: ... - - @overload - def create_optimization_job( - self, - job: OptimizationJob, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> OptimizationJob: ... - - @overload - def create_optimization_job( - self, - job: JSON, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> OptimizationJob: ... - - @overload - def create_optimization_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> OptimizationJob: ... - - @overload - def create_session( - self, - agent_name: str, - *, - agent_session_id: Optional[str] = ..., - content_type: str = "application/json", - user_isolation_key: Optional[str] = ..., - version_indicator: VersionIndicator, - **kwargs: Any - ) -> AgentSessionResource: ... - - @overload - def create_session( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> AgentSessionResource: ... - - @overload - def create_session( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> AgentSessionResource: ... - - @overload - def create_version_from_code( - self, - agent_name: str, - content: CreateAgentVersionFromCodeContent, - *, - code_zip_sha256: str, - **kwargs: Any - ) -> AgentVersionDetails: ... - - @overload - def create_version_from_code( - self, - agent_name: str, - content: JSON, - *, - code_zip_sha256: str, - **kwargs: Any - ) -> AgentVersionDetails: ... - - @distributed_trace - def delete_optimization_job( - self, - job_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def delete_session( - self, - agent_name: str, - session_id: str, - *, - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> None: ... - - @distributed_trace - def delete_session_file( - self, - agent_name: str, - agent_session_id: str, - *, - path: str, - recursive: Optional[bool] = ..., - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> None: ... - - @distributed_trace - def download_code( - self, - agent_name: str, - *, - agent_version: Optional[str] = ..., - **kwargs: Any - ) -> Iterator[bytes]: ... - - @distributed_trace - def download_session_file( - self, - agent_name: str, - agent_session_id: str, - *, - path: str, - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> Iterator[bytes]: ... - - @distributed_trace - def get_optimization_job( - self, - job_id: str, - **kwargs: Any - ) -> OptimizationJob: ... - - @distributed_trace - def get_session( - self, - agent_name: str, - session_id: str, - *, - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> AgentSessionResource: ... - - @distributed_trace - def get_session_log_stream( - self, - agent_name: str, - agent_version: str, - session_id: str, - **kwargs: Any - ) -> SessionLogEvent: ... - - @distributed_trace - def list_optimization_jobs( - self, - *, - agent_name: Optional[str] = ..., - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - status: Optional[Union[str, JobStatus]] = ..., - **kwargs: Any - ) -> ItemPaged[OptimizationJobListItem]: ... - - @distributed_trace - def list_session_files( - self, - agent_name: str, - agent_session_id: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - path: Optional[str] = ..., - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> ItemPaged[SessionDirectoryEntry]: ... - - @distributed_trace - def list_sessions( - self, - agent_name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - user_isolation_key: Optional[str] = ..., - **kwargs: Any - ) -> ItemPaged[AgentSessionResource]: ... - - @overload - def patch_agent_details( - self, - agent_name: str, - *, - agent_card: Optional[AgentCard] = ..., - agent_endpoint: Optional[AgentEndpointConfig] = ..., - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AgentDetails: ... - - @overload - def patch_agent_details( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AgentDetails: ... - - @overload - def patch_agent_details( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AgentDetails: ... - - @distributed_trace - def stop_session( - self, - agent_name: str, - session_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def upload_session_file( - self, - agent_name: str, - session_id: str, - content_or_file_path: bytes | str, - *, - path: str, - **kwargs: Any - ) -> SessionFileWriteResult: ... - - - class azure.ai.projects.operations.BetaDatasetsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace - def cancel_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> DataGenerationJob: ... - - @overload - def create_generation_job( - self, - job: DataGenerationJob, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> DataGenerationJob: ... - - @overload - def create_generation_job( - self, - job: JSON, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> DataGenerationJob: ... - - @overload - def create_generation_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> DataGenerationJob: ... - - @distributed_trace - def delete_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def get_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> DataGenerationJob: ... - - @distributed_trace - def list_generation_jobs( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[DataGenerationJob]: ... - - - class azure.ai.projects.operations.BetaEvaluationTaxonomiesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create( - self, - name: str, - taxonomy: EvaluationTaxonomy, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @overload - def create( - self, - name: str, - taxonomy: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @overload - def create( - self, - name: str, - taxonomy: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @distributed_trace - def delete( - self, - name: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def get( - self, - name: str, - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @distributed_trace - def list( - self, - *, - input_name: Optional[str] = ..., - input_type: Optional[str] = ..., - **kwargs: Any - ) -> ItemPaged[EvaluationTaxonomy]: ... - - @overload - def update( - self, - name: str, - taxonomy: EvaluationTaxonomy, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @overload - def update( - self, - name: str, - taxonomy: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - @overload - def update( - self, - name: str, - taxonomy: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationTaxonomy: ... - - - class azure.ai.projects.operations.BetaEvaluatorsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace - def cancel_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @overload - def create_generation_job( - self, - job: EvaluatorGenerationJob, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @overload - def create_generation_job( - self, - job: JSON, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @overload - def create_generation_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @overload - def create_version( - self, - name: str, - evaluator_version: EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @overload - def create_version( - self, - name: str, - evaluator_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @overload - def create_version( - self, - name: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @distributed_trace - def delete_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def delete_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: EvaluatorCredentialRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @distributed_trace - def get_generation_job( - self, - job_id: str, - **kwargs: Any - ) -> EvaluatorGenerationJob: ... - - @distributed_trace - def get_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> EvaluatorVersion: ... - - @distributed_trace - def list( - self, - *, - limit: Optional[int] = ..., - type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., - **kwargs: Any - ) -> ItemPaged[EvaluatorVersion]: ... - - @distributed_trace - def list_generation_jobs( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[EvaluatorGenerationJob]: ... - - @distributed_trace - def list_versions( - self, - name: str, - *, - limit: Optional[int] = ..., - type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., - **kwargs: Any - ) -> ItemPaged[EvaluatorVersion]: ... - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: PendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - def update_version( - self, - name: str, - version: str, - evaluator_version: EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @overload - def update_version( - self, - name: str, - version: str, - evaluator_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - @overload - def update_version( - self, - name: str, - version: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluatorVersion: ... - - - class azure.ai.projects.operations.BetaInsightsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def generate( - self, - insight: Insight, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Insight: ... - - @overload - def generate( - self, - insight: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Insight: ... - - @overload - def generate( - self, - insight: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Insight: ... - - @distributed_trace - def get( - self, - insight_id: str, - *, - include_coordinates: Optional[bool] = ..., - **kwargs: Any - ) -> Insight: ... - - @distributed_trace - def list( - self, - *, - agent_name: Optional[str] = ..., - eval_id: Optional[str] = ..., - include_coordinates: Optional[bool] = ..., - run_id: Optional[str] = ..., - type: Optional[Union[str, InsightType]] = ..., - **kwargs: Any - ) -> ItemPaged[Insight]: ... - - - class azure.ai.projects.operations.BetaMemoryStoresOperations(GenerateBetaMemoryStoresOperations): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def begin_update_memories( - self, - name: str, - *, - content_type: str = "application/json", - items: Optional[Union[str, ResponseInputParam]] = ..., - previous_update_id: Optional[str] = ..., - scope: str, - update_delay: Optional[int] = ..., - **kwargs: Any - ) -> UpdateMemoriesLROPoller: ... - - @overload - def begin_update_memories( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> UpdateMemoriesLROPoller: ... - - @overload - def begin_update_memories( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> UpdateMemoriesLROPoller: ... - - @overload - def create( - self, - *, - content_type: str = "application/json", - definition: MemoryStoreDefinition, - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - name: str, - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - def create( - self, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - def create( - self, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - def create_memory( - self, - name: str, - *, - content: str, - content_type: str = "application/json", - kind: Union[str, MemoryItemKind], - scope: str, - **kwargs: Any - ) -> MemoryItem: ... - - @overload - def create_memory( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - @overload - def create_memory( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - @distributed_trace - def delete( - self, - name: str, - **kwargs: Any - ) -> DeleteMemoryStoreResult: ... - - @distributed_trace - def delete_memory( - self, - name: str, - memory_id: str, - **kwargs: Any - ) -> DeleteMemoryResult: ... - - @overload - def delete_scope( - self, - name: str, - *, - content_type: str = "application/json", - scope: str, - **kwargs: Any - ) -> MemoryStoreDeleteScopeResult: ... - - @overload - def delete_scope( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDeleteScopeResult: ... - - @overload - def delete_scope( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDeleteScopeResult: ... - - @distributed_trace - def get( - self, - name: str, - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @distributed_trace - def get_memory( - self, - name: str, - memory_id: str, - **kwargs: Any - ) -> MemoryItem: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[MemoryStoreDetails]: ... - - @overload - def list_memories( - self, - name: str, - *, - before: Optional[str] = ..., - content_type: str = "application/json", - kind: Optional[Union[str, MemoryItemKind]] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - scope: str, - **kwargs: Any - ) -> ItemPaged[MemoryItem]: ... - - @overload - def list_memories( - self, - name: str, - body: JSON, - *, - before: Optional[str] = ..., - content_type: str = "application/json", - kind: Optional[Union[str, MemoryItemKind]] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[MemoryItem]: ... - - @overload - def list_memories( - self, - name: str, - body: IO[bytes], - *, - before: Optional[str] = ..., - content_type: str = "application/json", - kind: Optional[Union[str, MemoryItemKind]] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[MemoryItem]: ... - - @overload - def search_memories( - self, - name: str, - *, - content_type: str = "application/json", - items: Optional[Union[str, ResponseInputParam]] = ..., - options: Optional[MemorySearchOptions] = ..., - previous_search_id: Optional[str] = ..., - scope: str, - **kwargs: Any - ) -> MemoryStoreSearchResult: ... - - @overload - def search_memories( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreSearchResult: ... - - @overload - def search_memories( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreSearchResult: ... - - @overload - def update( - self, - name: str, - *, - content_type: str = "application/json", - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - def update( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryStoreDetails: ... - - @overload - def update_memory( - self, - name: str, - memory_id: str, - *, - content: str, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - @overload - def update_memory( - self, - name: str, - memory_id: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - @overload - def update_memory( - self, - name: str, - memory_id: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> MemoryItem: ... - - - class azure.ai.projects.operations.BetaModelsOperations(BetaModelsOperationsGenerated): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create( - self, - *, - azcopy_path: Optional[str] = ..., - base_model: Optional[str] = ..., - description: Optional[str] = ..., - name: str, - polling_interval: float = 2.0, - polling_timeout: float = 300.0, - source: Union[str, PathLike[str]], - tags: Optional[dict[str, str]] = ..., - version: str, - wait_for_commit: Literal[True] = True, - weight_type: Optional[str] = ..., - **kwargs: Any - ) -> ModelVersion: ... - - @overload - def create( - self, - *, - azcopy_path: Optional[str] = ..., - base_model: Optional[str] = ..., - description: Optional[str] = ..., - name: str, - polling_interval: float = 2.0, - polling_timeout: float = 300.0, - source: Union[str, PathLike[str]], - tags: Optional[dict[str, str]] = ..., - version: str, - wait_for_commit: Literal[False], - weight_type: Optional[str] = ..., - **kwargs: Any - ) -> None: ... - - @distributed_trace - def delete( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def get( - self, - name: str, - version: str, - **kwargs: Any - ) -> ModelVersion: ... - - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: ModelCredentialRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DatasetCredential: ... - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged[ModelVersion]: ... - - @distributed_trace - def list_versions( - self, - name: str, - **kwargs: Any - ) -> ItemPaged[ModelVersion]: ... - - @overload - def pending_create_version( - self, - name: str, - version: str, - model_version: ModelVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> CreateAsyncResponse: ... - - @overload - def pending_create_version( - self, - name: str, - version: str, - model_version: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> CreateAsyncResponse: ... - - @overload - def pending_create_version( - self, - name: str, - version: str, - model_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> CreateAsyncResponse: ... - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: ModelPendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ModelPendingUploadResponse: ... - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ModelPendingUploadResponse: ... - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ModelPendingUploadResponse: ... - - @overload - def update( - self, - name: str, - version: str, - model_version_update: UpdateModelVersionRequest, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> ModelVersion: ... - - @overload - def update( - self, - name: str, - version: str, - model_version_update: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> ModelVersion: ... - - @overload - def update( - self, - name: str, - version: str, - model_version_update: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> ModelVersion: ... - - - class azure.ai.projects.operations.BetaOperations(GeneratedBetaOperations): - agents: BetaAgentsOperations - datasets: BetaDatasetsOperations - evaluation_taxonomies: BetaEvaluationTaxonomiesOperations - evaluators: BetaEvaluatorsOperations - insights: BetaInsightsOperations - memory_stores: BetaMemoryStoresOperations - models: BetaModelsOperations - red_teams: BetaRedTeamsOperations - routines: BetaRoutinesOperations - schedules: BetaSchedulesOperations - skills: BetaSkillsOperations - toolboxes: BetaToolboxesOperations - - def __init__( - self, - *args: Any, - **kwargs: Any - ) -> None: ... - - - class azure.ai.projects.operations.BetaRedTeamsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create( - self, - red_team: RedTeam, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> RedTeam: ... - - @overload - def create( - self, - red_team: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> RedTeam: ... - - @overload - def create( - self, - red_team: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> RedTeam: ... - - @distributed_trace - def get( - self, - name: str, - **kwargs: Any - ) -> RedTeam: ... - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged[RedTeam]: ... - - - class azure.ai.projects.operations.BetaRoutinesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create_or_update( - self, - routine_name: str, - *, - action: Optional[RoutineAction] = ..., - content_type: str = "application/json", - description: Optional[str] = ..., - enabled: Optional[bool] = ..., - triggers: Optional[dict[str, RoutineTrigger]] = ..., - **kwargs: Any - ) -> Routine: ... - - @overload - def create_or_update( - self, - routine_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Routine: ... - - @overload - def create_or_update( - self, - routine_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Routine: ... - - @distributed_trace - def delete( - self, - routine_name: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def disable( - self, - routine_name: str, - **kwargs: Any - ) -> Routine: ... - - @overload - def dispatch( - self, - routine_name: str, - *, - content_type: str = "application/json", - payload: Optional[RoutineDispatchPayload] = ..., - **kwargs: Any - ) -> DispatchRoutineResult: ... - - @overload - def dispatch( - self, - routine_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DispatchRoutineResult: ... - - @overload - def dispatch( - self, - routine_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> DispatchRoutineResult: ... - - @distributed_trace - def enable( - self, - routine_name: str, - **kwargs: Any - ) -> Routine: ... - - @distributed_trace - def get( - self, - routine_name: str, - **kwargs: Any - ) -> Routine: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[str] = ..., - **kwargs: Any - ) -> ItemPaged[Routine]: ... - - @distributed_trace - def list_runs( - self, - routine_name: str, - *, - before: Optional[str] = ..., - filter: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[str] = ..., - **kwargs: Any - ) -> ItemPaged[RoutineRun]: ... - - - class azure.ai.projects.operations.BetaSchedulesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create_or_update( - self, - schedule_id: str, - schedule: Schedule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Schedule: ... - - @overload - def create_or_update( - self, - schedule_id: str, - schedule: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Schedule: ... - - @overload - def create_or_update( - self, - schedule_id: str, - schedule: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Schedule: ... - - @distributed_trace - def delete( - self, - schedule_id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def get( - self, - schedule_id: str, - **kwargs: Any - ) -> Schedule: ... - - @distributed_trace - def get_run( - self, - schedule_id: str, - run_id: str, - **kwargs: Any - ) -> ScheduleRun: ... - - @distributed_trace - def list( - self, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., - **kwargs: Any - ) -> ItemPaged[Schedule]: ... - - @distributed_trace - def list_runs( - self, - schedule_id: str, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., - **kwargs: Any - ) -> ItemPaged[ScheduleRun]: ... - - - class azure.ai.projects.operations.BetaSkillsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create( - self, - name: str, - *, - content_type: str = "application/json", - default: Optional[bool] = ..., - inline_content: Optional[SkillInlineContent] = ..., - **kwargs: Any - ) -> SkillVersion: ... - - @overload - def create( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillVersion: ... - - @overload - def create( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillVersion: ... - - @overload - def create_from_files( - self, - name: str, - content: CreateSkillVersionFromFilesBody, - **kwargs: Any - ) -> SkillVersion: ... - - @overload - def create_from_files( - self, - name: str, - content: JSON, - **kwargs: Any - ) -> SkillVersion: ... - - @distributed_trace - def delete( - self, - name: str, - **kwargs: Any - ) -> DeleteSkillResult: ... - - @distributed_trace - def delete_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> DeleteSkillVersionResult: ... - - @distributed_trace - def download( - self, - name: str, - **kwargs: Any - ) -> Iterator[bytes]: ... - - @distributed_trace - def download_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> Iterator[bytes]: ... - - @distributed_trace - def get( - self, - name: str, - **kwargs: Any - ) -> SkillDetails: ... - - @distributed_trace - def get_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> SkillVersion: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[SkillDetails]: ... - - @distributed_trace - def list_versions( - self, - name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[SkillVersion]: ... - - @overload - def update( - self, - name: str, - *, - content_type: str = "application/json", - default_version: str, - **kwargs: Any - ) -> SkillDetails: ... - - @overload - def update( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillDetails: ... - - @overload - def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillDetails: ... - - - class azure.ai.projects.operations.BetaToolboxesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create_version( - self, - name: str, - *, - content_type: str = "application/json", - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., - policies: Optional[ToolboxPolicies] = ..., - skills: Optional[List[ToolboxSkill]] = ..., - tools: List[Tool], - **kwargs: Any - ) -> ToolboxVersionObject: ... - - @overload - def create_version( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ToolboxVersionObject: ... - - @overload - def create_version( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ToolboxVersionObject: ... - - @distributed_trace - def delete( - self, - name: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def delete_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def get( - self, - name: str, - **kwargs: Any - ) -> ToolboxObject: ... - - @distributed_trace - def get_version( - self, - name: str, - version: str, - **kwargs: Any - ) -> ToolboxVersionObject: ... - - @distributed_trace - def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[ToolboxObject]: ... - - @distributed_trace - def list_versions( - self, - name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - **kwargs: Any - ) -> ItemPaged[ToolboxVersionObject]: ... - - @overload - def update( - self, - name: str, - *, - content_type: str = "application/json", - default_version: str, - **kwargs: Any - ) -> ToolboxObject: ... - - @overload - def update( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ToolboxObject: ... - - @overload - def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> ToolboxObject: ... - - - class azure.ai.projects.operations.ConnectionsOperations(ConnectionsOperationsGenerated): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace - def get( - self, - name: str, - *, - include_credentials: Optional[bool] = False, - **kwargs: Any - ) -> Connection: ... - - @distributed_trace - def get_default( - self, - connection_type: Union[str, ConnectionType], - *, - include_credentials: Optional[bool] = False, - **kwargs: Any - ) -> Connection: ... - - @distributed_trace - def list( - self, - *, - connection_type: Optional[Union[str, ConnectionType]] = ..., - default_connection: Optional[bool] = ..., - **kwargs: Any - ) -> ItemPaged[Connection]: ... - - - class azure.ai.projects.operations.DatasetsOperations(DatasetsOperationsGenerated): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create_or_update( - self, - name: str, - version: str, - dataset_version: DatasetVersion, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> DatasetVersion: ... - - @overload - def create_or_update( - self, - name: str, - version: str, - dataset_version: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> DatasetVersion: ... - - @overload - def create_or_update( - self, - name: str, - version: str, - dataset_version: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> DatasetVersion: ... - - @distributed_trace - def delete( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def get( - self, - name: str, - version: str, - **kwargs: Any - ) -> DatasetVersion: ... - - @distributed_trace - def get_credentials( - self, - name: str, - version: str, - **kwargs: Any - ) -> DatasetCredential: ... - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged[DatasetVersion]: ... - - @distributed_trace - def list_versions( - self, - name: str, - **kwargs: Any - ) -> ItemPaged[DatasetVersion]: ... - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: PendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> PendingUploadResponse: ... - - @distributed_trace - def upload_file( - self, - *, - connection_name: Optional[str] = ..., - file_path: str, - name: str, - version: str, - **kwargs: Any - ) -> FileDatasetVersion: ... - - @distributed_trace - def upload_folder( - self, - *, - connection_name: Optional[str] = ..., - file_pattern: Optional[Pattern] = ..., - folder: str, - name: str, - version: str, - **kwargs: Any - ) -> FolderDatasetVersion: ... - - - class azure.ai.projects.operations.DeploymentsOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @distributed_trace - def get( - self, - name: str, - **kwargs: Any - ) -> Deployment: ... - - @distributed_trace - def list( - self, - *, - deployment_type: Optional[Union[str, DeploymentType]] = ..., - model_name: Optional[str] = ..., - model_publisher: Optional[str] = ..., - **kwargs: Any - ) -> ItemPaged[Deployment]: ... - - - class azure.ai.projects.operations.EvaluationRulesOperations(GeneratedEvaluationRulesOperations): - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create_or_update( - self, - id: str, - evaluation_rule: EvaluationRule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationRule: ... - - @overload - def create_or_update( - self, - id: str, - evaluation_rule: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationRule: ... - - @overload - def create_or_update( - self, - id: str, - evaluation_rule: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> EvaluationRule: ... - - @distributed_trace - def delete( - self, - id: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def get( - self, - id: str, - **kwargs: Any - ) -> EvaluationRule: ... - - @distributed_trace - def list( - self, - *, - action_type: Optional[Union[str, EvaluationRuleActionType]] = ..., - agent_name: Optional[str] = ..., - enabled: Optional[bool] = ..., - **kwargs: Any - ) -> ItemPaged[EvaluationRule]: ... - - - class azure.ai.projects.operations.IndexesOperations: - - def __init__( - self, - *args, - **kwargs - ) -> None: ... - - @overload - def create_or_update( - self, - name: str, - version: str, - index: Index, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> Index: ... - - @overload - def create_or_update( - self, - name: str, - version: str, - index: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> Index: ... - - @overload - def create_or_update( - self, - name: str, - version: str, - index: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> Index: ... - - @distributed_trace - def delete( - self, - name: str, - version: str, - **kwargs: Any - ) -> None: ... - - @distributed_trace - def get( - self, - name: str, - version: str, - **kwargs: Any - ) -> Index: ... - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged[Index]: ... - - @distributed_trace - def list_versions( - self, - name: str, - **kwargs: Any - ) -> ItemPaged[Index]: ... - - - class azure.ai.projects.operations.TelemetryOperations: - - def __init__(self, outer_instance: AIProjectClient) -> None: ... - - @distributed_trace - def get_application_insights_connection_string(self) -> str: ... - - -namespace azure.ai.projects.telemetry - - def azure.ai.projects.telemetry.trace_function(span_name: Optional[str] = None) -> Callable: ... - - - class azure.ai.projects.telemetry.AIProjectInstrumentor: - - def __init__(self) -> None: ... - - def instrument( - self, - enable_content_recording: Optional[bool] = None, - enable_trace_context_propagation: Optional[bool] = None, - enable_baggage_propagation: Optional[bool] = None - ) -> None: ... - - def is_content_recording_enabled(self) -> bool: ... - - def is_instrumented(self) -> bool: ... - - def uninstrument(self) -> None: ... - - -``` \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/api.metadata.yml b/sdk/ai/azure-ai-projects/api.metadata.yml deleted file mode 100644 index 881bafc80613..000000000000 --- a/sdk/ai/azure-ai-projects/api.metadata.yml +++ /dev/null @@ -1,3 +0,0 @@ -apiMdSha256: f4c05c4124d4d6f1d59ec55aefc17f8184427317294f3a526d8d98d6133c35d8 -parserVersion: 0.3.28 -pythonVersion: 3.14.3 diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py index 3fdf26467d47..5d8893177cae 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch.py @@ -16,9 +16,9 @@ from ._patch_connections_async import ConnectionsOperations from ._patch_memories_async import BetaMemoryStoresOperations from ._patch_models_async import BetaModelsOperations -from ._patch_sessions_async import BetaAgentsOperations from ...operations._patch import _BETA_OPERATION_FEATURE_HEADERS, _OperationMethodHeaderProxy from ._operations import ( + BetaAgentsOperations, BetaDatasetsOperations, BetaEvaluationTaxonomiesOperations, BetaEvaluatorsOperations, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index 46a4d7a9e456..8f9496fa4c2b 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -7,7 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - +from pathlib import Path from typing import Union, Optional, Any, IO, overload from azure.core.exceptions import HttpResponseError from azure.core.tracing.decorator_async import distributed_trace_async @@ -198,3 +198,51 @@ async def create_version( new_exc.model = exc.model raise new_exc from exc raise + + @distributed_trace_async + async def upload_session_file( # type: ignore[override] + self, + agent_name: str, + session_id: str, + content_or_file_path: "bytes | str", + *, + path: str, + **kwargs: Any, + ) -> _models.SessionFileWriteResult: + """Upload a file to the session sandbox. + + Accepts either a ``bytes`` buffer or a local file path (``str``). + When a file path is provided the file is read from disk and its contents + are forwarded to the service. Maximum file size is 50 MB. Uploads + exceeding this limit return 413 Payload Too Large. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session ID. Required. + :type session_id: str + :param content_or_file_path: The binary content to upload, **or** the full path to a local + file whose contents should be uploaded. Required. + :type content_or_file_path: bytes or str + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult + :raises ~azure.core.exceptions.HttpResponseError: + :raises FileNotFoundError: If *content_or_file_path* is a ``str`` and the file does not exist. + """ + if isinstance(content_or_file_path, str): + + file_path = Path(content_or_file_path) + if not file_path.exists(): + raise ValueError(f"The provided file `{content_or_file_path}` does not exist.") + if file_path.is_dir(): + raise ValueError(f"Provide a valid file path, not a folder path `{content_or_file_path}`.") + + with open(content_or_file_path, "rb") as f: + content: bytes = f.read() + else: + content = content_or_file_path + + return await super()._upload_session_file(agent_name, session_id, content, path=path, **kwargs) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_sessions_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_sessions_async.py deleted file mode 100644 index dd1427541a65..000000000000 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_sessions_async.py +++ /dev/null @@ -1,74 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -from pathlib import Path -from typing import Any -from azure.core.tracing.decorator_async import distributed_trace_async -from ._operations import BetaAgentsOperations as GeneratedBetaAgentsOperations -from ... import models as _models - - -class BetaAgentsOperations(GeneratedBetaAgentsOperations): - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.aio.AIProjectClient`'s - :attr:`beta.agents` attribute. - """ - - @distributed_trace_async - async def upload_session_file( # type: ignore[override] - self, - agent_name: str, - session_id: str, - content_or_file_path: "bytes | str", - *, - path: str, - **kwargs: Any, - ) -> _models.SessionFileWriteResult: - """Upload a file to the session sandbox. - - Accepts either a ``bytes`` buffer or a local file path (``str``). - When a file path is provided the file is read from disk and its contents - are forwarded to the service. Maximum file size is 50 MB. Uploads - exceeding this limit return 413 Payload Too Large. - - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session ID. Required. - :type session_id: str - :param content_or_file_path: The binary content to upload, **or** the full path to a local - file whose contents should be uploaded. Required. - :type content_or_file_path: bytes or str - :keyword path: The destination file path within the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.SessionFileWriteResult - :raises ~azure.core.exceptions.HttpResponseError: - :raises FileNotFoundError: If *content_or_file_path* is a ``str`` and the file does not exist. - """ - if isinstance(content_or_file_path, str): - - file_path = Path(content_or_file_path) - if not file_path.exists(): - raise ValueError(f"The provided file `{content_or_file_path}` does not exist.") - if file_path.is_dir(): - raise ValueError(f"Provide a valid file path, not a folder path `{content_or_file_path}`.") - - with open(content_or_file_path, "rb") as f: - content: bytes = f.read() - else: - content = content_or_file_path - - return await super()._upload_session_file(agent_name, session_id, content, path=path, **kwargs) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py index f81e1ceb403a..283443056bf4 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch.py @@ -19,8 +19,8 @@ from ._patch_connections import ConnectionsOperations from ._patch_memories import BetaMemoryStoresOperations from ._patch_models import BetaModelsOperations -from ._patch_sessions import BetaAgentsOperations from ._operations import ( + BetaAgentsOperations, BetaDatasetsOperations, BetaEvaluationTaxonomiesOperations, BetaEvaluatorsOperations, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index a2f129f1dae1..9f0e581ec9b3 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -214,3 +214,52 @@ def create_version( new_exc.model = exc.model raise new_exc from exc raise + + + @distributed_trace + def upload_session_file( # type: ignore[override] + self, + agent_name: str, + session_id: str, + content_or_file_path: "bytes | str", + *, + path: str, + **kwargs: Any, + ) -> _models.SessionFileWriteResult: + """Upload a file to the session sandbox. + + Accepts either a ``bytes`` buffer or a local file path (``str``). + When a file path is provided the file is read from disk and its contents + are forwarded to the service. Maximum file size is 50 MB. Uploads + exceeding this limit return 413 Payload Too Large. + + :param agent_name: The name of the agent. Required. + :type agent_name: str + :param session_id: The session ID. Required. + :type session_id: str + :param content_or_file_path: The binary content to upload, **or** the full path to a local + file whose contents should be uploaded. Required. + :type content_or_file_path: bytes or str + :keyword path: The destination file path within the sandbox, relative to the session home + directory. Required. + :paramtype path: str + :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with + MutableMapping + :rtype: ~azure.ai.projects.models.SessionFileWriteResult + :raises ~azure.core.exceptions.HttpResponseError: + :raises FileNotFoundError: If *content_or_file_path* is a ``str`` and the file does not exist. + """ + if isinstance(content_or_file_path, str): + + file_path = Path(content_or_file_path) + if not file_path.exists(): + raise ValueError(f"The provided file `{content_or_file_path}` does not exist.") + if file_path.is_dir(): + raise ValueError(f"Provide a valid file path, not a folder path `{content_or_file_path}`.") + + with open(content_or_file_path, "rb") as f: + content: bytes = f.read() + else: + content = content_or_file_path + + return super()._upload_session_file(agent_name, session_id, content, path=path, **kwargs) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_sessions.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_sessions.py deleted file mode 100644 index 8d417620e725..000000000000 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_sessions.py +++ /dev/null @@ -1,74 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - -from pathlib import Path -from typing import Any -from azure.core.tracing.decorator import distributed_trace -from ._operations import BetaAgentsOperations as GeneratedBetaAgentsOperations -from .. import models as _models - - -class BetaAgentsOperations(GeneratedBetaAgentsOperations): - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.ai.projects.AIProjectClient`'s - :attr:`beta.agents` attribute. - """ - - @distributed_trace - def upload_session_file( # type: ignore[override] - self, - agent_name: str, - session_id: str, - content_or_file_path: "bytes | str", - *, - path: str, - **kwargs: Any, - ) -> _models.SessionFileWriteResult: - """Upload a file to the session sandbox. - - Accepts either a ``bytes`` buffer or a local file path (``str``). - When a file path is provided the file is read from disk and its contents - are forwarded to the service. Maximum file size is 50 MB. Uploads - exceeding this limit return 413 Payload Too Large. - - :param agent_name: The name of the agent. Required. - :type agent_name: str - :param session_id: The session ID. Required. - :type session_id: str - :param content_or_file_path: The binary content to upload, **or** the full path to a local - file whose contents should be uploaded. Required. - :type content_or_file_path: bytes or str - :keyword path: The destination file path within the sandbox, relative to the session home - directory. Required. - :paramtype path: str - :return: SessionFileWriteResult. The SessionFileWriteResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.SessionFileWriteResult - :raises ~azure.core.exceptions.HttpResponseError: - :raises FileNotFoundError: If *content_or_file_path* is a ``str`` and the file does not exist. - """ - if isinstance(content_or_file_path, str): - - file_path = Path(content_or_file_path) - if not file_path.exists(): - raise ValueError(f"The provided file `{content_or_file_path}` does not exist.") - if file_path.is_dir(): - raise ValueError(f"Provide a valid file path, not a folder path `{content_or_file_path}`.") - - with open(content_or_file_path, "rb") as f: - content: bytes = f.read() - else: - content = content_or_file_path - - return super()._upload_session_file(agent_name, session_id, content, path=path, **kwargs) diff --git a/sdk/ai/azure-ai-projects/docs/subclients.md b/sdk/ai/azure-ai-projects/docs/subclients.md index 9815c65a0b6c..aff9c07e877c 100644 --- a/sdk/ai/azure-ai-projects/docs/subclients.md +++ b/sdk/ai/azure-ai-projects/docs/subclients.md @@ -41,24 +41,24 @@ There are a total of 134 unique public methods across all sub-clients. Alphabetically sorted. An asterisk at the end of the method name means is a hand-written method. ``` +.agents.create_session .agents.create_version +.agents.create_version_from_code .agents.create_version_from_manifest .agents.delete -.agents.delete_version -.agents.get -.agents.get_version -.agents.list -.agents.list_versions -.agents.create_session -.agents.create_version_from_code .agents.delete_session .agents.delete_session_file +.agents.delete_version .agents.download_code .agents.download_session_file +.agents.get .agents.get_session .agents.get_session_log_stream +.agents.get_version +.agents.list .agents.list_session_files .agents.list_sessions +.agents.list_versions .agents.patch_agent_details .agents.stop_session .agents.upload_session_file* From f24d9580813a882d622032ef31cb0acd66716a77 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Wed, 17 Jun 2026 17:39:02 -0700 Subject: [PATCH 05/12] Update report --- sdk/ai/azure-ai-projects/docs/subclients.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sdk/ai/azure-ai-projects/docs/subclients.md b/sdk/ai/azure-ai-projects/docs/subclients.md index aff9c07e877c..d6cf04d08fa3 100644 --- a/sdk/ai/azure-ai-projects/docs/subclients.md +++ b/sdk/ai/azure-ai-projects/docs/subclients.md @@ -1,10 +1,10 @@ # AIProjectClient Subclients -This document lists all sub-clients available on `AIProjectClient` and their public method counts. Overload methods are not counted. Only synchronous methods are counted (but each one has an equivalent asynchronous method). +This document lists all methods available on `AIProjectClient` and its sub-clients. Overload methods are not counted. Only synchronous methods are counted (but each one has an equivalent asynchronous method). ## Summary -There are a total of 134 unique public methods across all sub-clients. +There are a total of 135 unique public methods (1 on the client, 134 across all sub-clients). ### Top-level Sub-clients (stable operations) @@ -36,7 +36,15 @@ There are a total of 134 unique public methods across all sub-clients. | `beta.skills` | BetaSkillsOperations | 11 | -## Stable methods +## Stable methods on the client + +An asterisk at the end of the method name means is a hand-written method. + +``` +.get_openai_client* +``` + +## Stable methods on sub clients Alphabetically sorted. An asterisk at the end of the method name means is a hand-written method. @@ -103,7 +111,7 @@ Alphabetically sorted. An asterisk at the end of the method name means is a hand .toolboxes.update ``` -## Beta methods +## Beta methods on sub-clients Alphabetically sorted. An asterisk at the end of the method name means is a hand-written method. From 8e35ae9fb4c3ffb9a9eb9c20ab7a73668a64cd0b Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Wed, 17 Jun 2026 17:58:25 -0700 Subject: [PATCH 06/12] Rename and update method doc --- .../docs/{subclients.md => public-methods.md} | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) rename sdk/ai/azure-ai-projects/docs/{subclients.md => public-methods.md} (88%) diff --git a/sdk/ai/azure-ai-projects/docs/subclients.md b/sdk/ai/azure-ai-projects/docs/public-methods.md similarity index 88% rename from sdk/ai/azure-ai-projects/docs/subclients.md rename to sdk/ai/azure-ai-projects/docs/public-methods.md index d6cf04d08fa3..6bce7cefb456 100644 --- a/sdk/ai/azure-ai-projects/docs/subclients.md +++ b/sdk/ai/azure-ai-projects/docs/public-methods.md @@ -1,12 +1,15 @@ -# AIProjectClient Subclients +# Public AIProjectClient methods -This document lists all methods available on `AIProjectClient` and its sub-clients. Overload methods are not counted. Only synchronous methods are counted (but each one has an equivalent asynchronous method). +This document lists all public methods available on `AIProjectClient` and its sub-clients. Overload methods are not counted. Only synchronous methods are counted (but each one has an equivalent asynchronous method). ## Summary -There are a total of 135 unique public methods (1 on the client, 134 across all sub-clients). +There are a total of 139 unique public methods: +- 5 stable methods on the client +- 53 stable methods on top-level sub-clients +- 81 beta methods on nested beta sub-clients -### Top-level Sub-clients (stable operations) +### Top-level sub-clients (stable operations) | Subclient | Class Name | Methods Count | |-----------|------------|----------------| @@ -19,7 +22,7 @@ There are a total of 135 unique public methods (1 on the client, 134 across all | `telemetry` | TelemetryOperations | 1 | | `toolboxes` | ToolboxesOperations | 8 | -### Nested Sub-clients (beta operations) +### Nested sub-clients (beta operations) | Subclient | Class Name | Methods Count | |-----------|------------|----------------| @@ -41,10 +44,14 @@ There are a total of 135 unique public methods (1 on the client, 134 across all An asterisk at the end of the method name means is a hand-written method. ``` +.__enter__ +.__exit__ +.close .get_openai_client* +.send_request ``` -## Stable methods on sub clients +## Stable methods on top-level sub clients Alphabetically sorted. An asterisk at the end of the method name means is a hand-written method. @@ -111,7 +118,7 @@ Alphabetically sorted. An asterisk at the end of the method name means is a hand .toolboxes.update ``` -## Beta methods on sub-clients +## Beta methods on nested sub-clients Alphabetically sorted. An asterisk at the end of the method name means is a hand-written method. From c0f26e4df83d9fae32db0b5d39b23eddf81bd1f7 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Wed, 17 Jun 2026 17:59:45 -0700 Subject: [PATCH 07/12] update assets --- sdk/ai/azure-ai-projects/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/ai/azure-ai-projects/assets.json b/sdk/ai/azure-ai-projects/assets.json index c546cf197dd0..b62170f7f6b5 100644 --- a/sdk/ai/azure-ai-projects/assets.json +++ b/sdk/ai/azure-ai-projects/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/ai/azure-ai-projects", - "Tag": "python/ai/azure-ai-projects_cc9f48b0e7" + "Tag": "python/ai/azure-ai-projects_ab237ea03d" } From dc0a46f172ad5ea11f065acb69728c56cb0d2c1f Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Thu, 18 Jun 2026 08:58:43 -0700 Subject: [PATCH 08/12] Fix tests --- sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py | 9 +-------- .../azure/ai/projects/operations/_patch_agents.py | 1 + .../agents/tools/sample_toolboxes_with_search_preview.py | 6 +----- .../tools/sample_toolboxes_with_search_preview_async.py | 5 +---- .../samples/hosted_agents/sample_agent_endpoint.py | 7 +------ .../samples/hosted_agents/sample_agent_endpoint_async.py | 7 +------ .../samples/hosted_agents/sample_session_log_stream.py | 7 +------ .../hosted_agents/sample_session_log_stream_async.py | 7 +------ .../samples/hosted_agents/sample_sessions_crud.py | 6 +----- .../samples/hosted_agents/sample_sessions_crud_async.py | 6 +----- .../sample_sessions_files_upload_download.py | 6 +----- .../sample_sessions_files_upload_download_async.py | 6 +----- .../samples/hosted_agents/sample_skill_in_toolbox.py | 7 +++---- .../samples/hosted_agents/sample_toolboxes_crud.py | 7 ++----- .../samples/hosted_agents/sample_toolboxes_crud_async.py | 5 +---- 15 files changed, 18 insertions(+), 74 deletions(-) diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py index 60caaa703731..fe332adb3a45 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py @@ -42,18 +42,11 @@ def _resolve_openai_base_url(config: Any, agent_name: Optional[str], kwargs: dic :type kwargs: dict :return: The base URL to use for the (Async)OpenAI client. :rtype: str - :raises ValueError: If ``agent_name`` is provided but ``allow_preview=True`` was not set. """ if "base_url" in kwargs: return kwargs.pop("base_url") if agent_name is not None: - if config.allow_preview: - return config.endpoint.rstrip("/") + f"/agents/{agent_name}/endpoint/protocols/openai" - raise ValueError( - "Calling `get_openai_client` method with an `agent_name` requires you to set `allow_preview=True`" - "\nwhen constructing the AIProjectClient. Note that preview features are under development and " - "\nsubject to change. They should not be used in production environments." - ) + return config.endpoint.rstrip("/") + f"/agents/{agent_name}/endpoint/protocols/openai" return config.endpoint.rstrip("/") + "/openai/v1" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index 9f0e581ec9b3..6325885c2947 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ +from pathlib import Path from typing import Union, Optional, Any, IO, overload from azure.core.exceptions import HttpResponseError from azure.core.tracing.decorator import distributed_trace diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py index ca59e5aab6ec..c71266e7a623 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview.py @@ -24,7 +24,7 @@ Before running the sample: - pip install "azure-ai-projects>=2.2.0" python-dotenv openai + pip install "azure-ai-projects>=2.3.0" python-dotenv openai Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -36,12 +36,8 @@ """ import os - from dotenv import load_dotenv - -from azure.core.exceptions import ResourceNotFoundError from azure.identity import DefaultAzureCredential - from azure.ai.projects import AIProjectClient from azure.ai.projects.models import ( MCPTool, diff --git a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py index d10e025af59a..940b9788879b 100644 --- a/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py +++ b/sdk/ai/azure-ai-projects/samples/agents/tools/sample_toolboxes_with_search_preview_async.py @@ -24,7 +24,7 @@ Before running the sample: - pip install "azure-ai-projects>=2.2.0" python-dotenv openai aiohttp + pip install "azure-ai-projects>=2.3.0" python-dotenv openai aiohttp Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -37,11 +37,8 @@ import asyncio import os - from dotenv import load_dotenv - from azure.identity.aio import DefaultAzureCredential - from azure.ai.projects.aio import AIProjectClient from azure.ai.projects.models import ( MCPTool, diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint.py index a821563ee063..a1203199d8d6 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint.py @@ -13,16 +13,12 @@ Sessions only work with Hosted Agents. - Session and Agent endpoint operations are currently preview features. - In the Python SDK, you access these operations via - `project_client.beta.agents`. - USAGE: python sample_agent_endpoint.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv + pip install "azure-ai-projects>=2.3.0" python-dotenv Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -59,7 +55,6 @@ AIProjectClient( endpoint=endpoint, credential=credential, - allow_preview=True, ) as project_client, ): diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint_async.py index a8b3d4e5ceab..ffa1cc9602de 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_endpoint_async.py @@ -13,16 +13,12 @@ Sessions only work with Hosted Agents. - Session and Agent endpoint operations are currently preview features. - In the Python SDK, you access these operations via - `project_client.beta.agents`. - USAGE: python sample_agent_endpoint_async.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv aiohttp + pip install "azure-ai-projects>=2.3.0" python-dotenv aiohttp Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -62,7 +58,6 @@ async def main(): AIProjectClient( endpoint=endpoint, credential=credential, - allow_preview=True, ) as project_client, ): diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py index a55c716562b2..d6cb2907625d 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream.py @@ -12,16 +12,12 @@ Sessions only work with Hosted Agents. - Session and log stream operations are currently preview features. - In the Python SDK, you access these operations via - `project_client.beta.agents`. - USAGE: python sample_session_log_stream.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv + pip install "azure-ai-projects>=2.3.0" python-dotenv Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -92,7 +88,6 @@ def _iter_sse_frames(stream, max_log_events: int): AIProjectClient( endpoint=endpoint, credential=credential, - allow_preview=True, ) as project_client, project_client.get_openai_client(agent_name=agent_name) as openai_client, ): diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream_async.py index 9908ad616bcc..577ca005e6c7 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_session_log_stream_async.py @@ -12,16 +12,12 @@ Sessions only work with Hosted Agents. - Session and log stream operations are currently preview features. - In the Python SDK, you access these operations via - `project_client.beta.agents`. - USAGE: python sample_session_log_stream_async.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv aiohttp + pip install "azure-ai-projects>=2.3.0" python-dotenv aiohttp Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -123,7 +119,6 @@ async def main(): AIProjectClient( endpoint=endpoint, credential=credential, - allow_preview=True, ) as project_client, ): agent = await get_latest_active_agent_version_async(project_client, agent_name) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud.py index cbcc64f28cc4..f1a7ccbb547a 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud.py @@ -11,15 +11,12 @@ Sessions only work with Hosted Agents. - Sessions are currently a preview feature. In the Python SDK, you access - these operations via `project_client.beta.agents`. - USAGE: python sample_sessions_crud.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv + pip install "azure-ai-projects>=2.3.0" python-dotenv Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -57,7 +54,6 @@ AIProjectClient( endpoint=endpoint, credential=credential, - allow_preview=True, ) as project_client, ): agent = get_latest_active_agent_version(project_client, agent_name) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud_async.py index 3dafc80fe44a..d9b70765e184 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_crud_async.py @@ -11,15 +11,12 @@ Sessions only work with Hosted Agents. - Sessions are currently a preview feature. In the Python SDK, you access - these operations via `project_client.beta.agents`. - USAGE: python sample_sessions_crud_async.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv aiohttp + pip install "azure-ai-projects>=2.3.0" python-dotenv aiohttp Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -60,7 +57,6 @@ async def main(): AIProjectClient( endpoint=endpoint, credential=credential, - allow_preview=True, ) as project_client, ): agent = await get_latest_active_agent_version_async(project_client, agent_name) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py index d5f0385f50cd..123ff986601d 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download.py @@ -11,15 +11,12 @@ Sessions only work with Hosted Agents. - Sessions are currently a preview feature. In the Python SDK, you access - these operations via `project_client.beta.agents`. - USAGE: python sample_sessions_files_upload_download.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv + pip install "azure-ai-projects>=2.3.0" python-dotenv Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -59,7 +56,6 @@ AIProjectClient( endpoint=endpoint, credential=credential, - allow_preview=True, ) as project_client, ): agent = get_latest_active_agent_version(project_client, agent_name) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py index d6f683cfc323..9a9ffb22f507 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_sessions_files_upload_download_async.py @@ -11,15 +11,12 @@ Sessions only work with Hosted Agents. - Sessions are currently a preview feature. In the Python SDK, you access - these operations via `project_client.beta.agents`. - USAGE: python sample_sessions_files_upload_download_async.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv aiohttp + pip install "azure-ai-projects>=2.3.0" python-dotenv aiohttp Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -61,7 +58,6 @@ async def main(): AIProjectClient( endpoint=endpoint, credential=credential, - allow_preview=True, ) as project_client, ): agent = await get_latest_active_agent_version_async(project_client, agent_name) diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_skill_in_toolbox.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_skill_in_toolbox.py index 5acd6832028f..1750f9bf3758 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_skill_in_toolbox.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_skill_in_toolbox.py @@ -17,16 +17,15 @@ context, so when asked a shipping-cost question the agent answers directly using the skill's formula. - Skills and Toolboxes are currently preview features. In the Python SDK, - you access these operations via `project_client.beta.skills` and - `project_client.toolboxes`. + Skills are currently a preview features. In the Python SDK, + you access these operations via `project_client.beta.skills`. USAGE: python sample_skill_in_toolbox.py Before running the sample: - pip install "azure-ai-projects>=2.2.0" python-dotenv openai + pip install "azure-ai-projects>=2.3.0" python-dotenv openai Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py index fadb722fe983..83103d279784 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud.py @@ -13,15 +13,12 @@ `require_approval` values, switches the default version, and prints the MCP `require_approval` setting from the fetched default version. - Toolboxes are currently a preview feature. In the Python SDK, you access - these operations via `project_client.toolboxes`. - USAGE: python sample_toolboxes_crud.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv + pip install "azure-ai-projects>=2.3.0" python-dotenv Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview @@ -53,7 +50,7 @@ def print_mcp_require_approval(tools: list[Tool]) -> None: with ( DefaultAzureCredential() as credential, - AIProjectClient(endpoint=endpoint, credential=credential, logging_enable=True) as project_client, + AIProjectClient(endpoint=endpoint, credential=credential) as project_client, ): toolbox_name = "toolbox_with_mcp_tool" diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py index dc8cb2049bac..f8f7991ec4a4 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_toolboxes_crud_async.py @@ -13,15 +13,12 @@ `require_approval` values, switches the default version, and prints the MCP `require_approval` setting from the fetched default version. - Toolboxes are currently a preview feature. In the Python SDK, you access - these operations via `project_client.toolboxes`. - USAGE: python sample_toolboxes_crud_async.py Before running the sample: - pip install "azure-ai-projects>=2.1.0" python-dotenv aiohttp + pip install "azure-ai-projects>=2.3.0" python-dotenv aiohttp Set these environment variables with your own values: 1) FOUNDRY_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview From cd1af8504a946b0aa0e5ccda06c75dec94057666 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Thu, 18 Jun 2026 08:59:25 -0700 Subject: [PATCH 09/12] Update test assets --- sdk/ai/azure-ai-projects/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/ai/azure-ai-projects/assets.json b/sdk/ai/azure-ai-projects/assets.json index b62170f7f6b5..063c1e757547 100644 --- a/sdk/ai/azure-ai-projects/assets.json +++ b/sdk/ai/azure-ai-projects/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/ai/azure-ai-projects", - "Tag": "python/ai/azure-ai-projects_ab237ea03d" + "Tag": "python/ai/azure-ai-projects_562fab9bcc" } From 082fe81752f24d03f61fb216050a1a8b471249da Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Thu, 18 Jun 2026 11:20:59 -0700 Subject: [PATCH 10/12] Updat tests --- .../tests/responses/test_openai_client_endpoint.py | 12 ------------ .../responses/test_openai_client_endpoint_async.py | 13 ------------- 2 files changed, 25 deletions(-) diff --git a/sdk/ai/azure-ai-projects/tests/responses/test_openai_client_endpoint.py b/sdk/ai/azure-ai-projects/tests/responses/test_openai_client_endpoint.py index be5d6f429040..f5a5dd6ba9f2 100644 --- a/sdk/ai/azure-ai-projects/tests/responses/test_openai_client_endpoint.py +++ b/sdk/ai/azure-ai-projects/tests/responses/test_openai_client_endpoint.py @@ -49,18 +49,6 @@ def test_get_openai_client_default_endpoint(self): expected_base_url = FAKE_ENDPOINT.rstrip("/") + "/openai/v1" assert str(openai_client.base_url).rstrip("/") == expected_base_url - def test_get_openai_client_with_agent_name_raises_without_allow_preview(self): - """Verify that passing agent_name without allow_preview=True raises ValueError.""" - project_client = AIProjectClient( - endpoint=FAKE_ENDPOINT, - credential=FakeCredential(), # type: ignore[arg-type] - ) - - with pytest.raises(ValueError) as exc_info: - project_client.get_openai_client(agent_name=AGENT_NAME) - - assert "allow_preview=True" in str(exc_info.value) - def test_get_openai_client_with_agent_name_and_allow_preview(self): """Verify that the OpenAI client base_url includes the agent endpoint when allow_preview=True.""" project_client = AIProjectClient( diff --git a/sdk/ai/azure-ai-projects/tests/responses/test_openai_client_endpoint_async.py b/sdk/ai/azure-ai-projects/tests/responses/test_openai_client_endpoint_async.py index 8335531787af..097fb21e8f9c 100644 --- a/sdk/ai/azure-ai-projects/tests/responses/test_openai_client_endpoint_async.py +++ b/sdk/ai/azure-ai-projects/tests/responses/test_openai_client_endpoint_async.py @@ -56,19 +56,6 @@ async def test_get_openai_client_default_endpoint_async(self): expected_base_url = FAKE_ENDPOINT.rstrip("/") + "/openai/v1" assert str(openai_client.base_url).rstrip("/") == expected_base_url - @pytest.mark.asyncio - async def test_get_openai_client_with_agent_name_raises_without_allow_preview_async(self): - """Verify that passing agent_name without allow_preview=True raises ValueError.""" - project_client = AIProjectClient( - endpoint=FAKE_ENDPOINT, - credential=FakeAsyncCredential(), # type: ignore[arg-type] - ) - - with pytest.raises(ValueError) as exc_info: - project_client.get_openai_client(agent_name=AGENT_NAME) - - assert "allow_preview=True" in str(exc_info.value) - @pytest.mark.asyncio async def test_get_openai_client_with_agent_name_and_allow_preview_async(self): """Verify that the async OpenAI client base_url includes the agent endpoint when allow_preview=True.""" From f21969cf256d3e072de69850e4ba14ed0eaea696 Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Thu, 18 Jun 2026 11:21:37 -0700 Subject: [PATCH 11/12] update test assets --- sdk/ai/azure-ai-projects/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/ai/azure-ai-projects/assets.json b/sdk/ai/azure-ai-projects/assets.json index 063c1e757547..5d1358cbf42f 100644 --- a/sdk/ai/azure-ai-projects/assets.json +++ b/sdk/ai/azure-ai-projects/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/ai/azure-ai-projects", - "Tag": "python/ai/azure-ai-projects_562fab9bcc" + "Tag": "python/ai/azure-ai-projects_3ec4cc5f02" } From 74d5c4bbba8b03cf0566e52e00089e5af3857e5d Mon Sep 17 00:00:00 2001 From: Darren Cohen <39422044+dargilco@users.noreply.github.com> Date: Thu, 18 Jun 2026 12:07:56 -0700 Subject: [PATCH 12/12] update --- sdk/ai/azure-ai-projects/CHANGELOG.md | 7 + sdk/ai/azure-ai-projects/api.md | 11394 ++++++++++++++++ sdk/ai/azure-ai-projects/api.metadata.yml | 3 + .../aio/operations/_patch_agents_async.py | 1 + .../ai/projects/operations/_patch_agents.py | 1 - 5 files changed, 11405 insertions(+), 1 deletion(-) create mode 100644 sdk/ai/azure-ai-projects/api.md create mode 100644 sdk/ai/azure-ai-projects/api.metadata.yml diff --git a/sdk/ai/azure-ai-projects/CHANGELOG.md b/sdk/ai/azure-ai-projects/CHANGELOG.md index f2f0df63cdd1..4478e611da39 100644 --- a/sdk/ai/azure-ai-projects/CHANGELOG.md +++ b/sdk/ai/azure-ai-projects/CHANGELOG.md @@ -2,6 +2,13 @@ ## 2.3.0 (Unreleased) +### Features Added + +* Hosted agents are now stable. There is need to set `allow_preview=True` on the `AIProjectClient` constructor to create a Hosted agent. +* Toolboxes operations are now stable. The have moved from `.beta.toolboxes` subclient to the `.toolboxes` subclient. +* Session and Session files operations are now stable. They have moved from the `.beta.agents` subclient to the `.agents` subclient. +* Agent code operations are now stable. This includes `create_version_from_code` and `download_code`. They have moved from the `.beta.agents` subclient to the `.agents` subclient. + ### Breaking Changes Breaking changes in beta methods: diff --git a/sdk/ai/azure-ai-projects/api.md b/sdk/ai/azure-ai-projects/api.md new file mode 100644 index 000000000000..8c9fe3dcc5a2 --- /dev/null +++ b/sdk/ai/azure-ai-projects/api.md @@ -0,0 +1,11394 @@ +```py +namespace azure.ai.projects + + class azure.ai.projects.AIProjectClient(AIProjectClientGenerated): implements ContextManager + agents: AgentsOperations + beta: BetaOperations + connections: ConnectionsOperations + datasets: DatasetsOperations + deployments: DeploymentsOperations + evaluation_rules: EvaluationRulesOperations + indexes: IndexesOperations + + def __init__( + self, + endpoint: str, + credential: TokenCredential, + *, + allow_preview: bool = False, + api_version: str = ..., + **kwargs: Any + ) -> None: ... + + def close(self) -> None: ... + + @distributed_trace + def get_openai_client( + self, + *, + agent_name: Optional[str] = ..., + **kwargs: Any + ) -> OpenAI: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> HttpResponse: ... + + +namespace azure.ai.projects.aio + + class azure.ai.projects.aio.AIProjectClient(AIProjectClientGenerated): implements AsyncContextManager + agents: AgentsOperations + beta: BetaOperations + connections: ConnectionsOperations + datasets: DatasetsOperations + deployments: DeploymentsOperations + evaluation_rules: EvaluationRulesOperations + indexes: IndexesOperations + + def __init__( + self, + endpoint: str, + credential: AsyncTokenCredential, + *, + allow_preview: bool = False, + api_version: str = ..., + **kwargs: Any + ) -> None: ... + + async def close(self) -> None: ... + + @distributed_trace + def get_openai_client( + self, + *, + agent_name: Optional[str] = ..., + **kwargs: Any + ) -> AsyncOpenAI: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: ... + + +namespace azure.ai.projects.aio.operations + + class azure.ai.projects.aio.operations.AgentsOperations(GeneratedAgentsOperations): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create_session( + self, + agent_name: str, + *, + agent_session_id: Optional[str] = ..., + content_type: str = "application/json", + user_isolation_key: Optional[str] = ..., + version_indicator: VersionIndicator, + **kwargs: Any + ) -> AgentSessionResource: ... + + @overload + async def create_session( + self, + agent_name: str, + body: JSON, + *, + content_type: str = "application/json", + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> AgentSessionResource: ... + + @overload + async def create_session( + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> AgentSessionResource: ... + + @overload + async def create_version( + self, + agent_name: str, + *, + blueprint_reference: Optional[AgentBlueprintReference] = ..., + content_type: str = "application/json", + definition: AgentDefinition, + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + async def create_version( + self, + agent_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + async def create_version( + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + async def create_version_from_code( + self, + agent_name: str, + content: CreateAgentVersionFromCodeContent, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + async def create_version_from_code( + self, + agent_name: str, + content: JSON, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + async def create_version_from_manifest( + self, + agent_name: str, + *, + content_type: str = "application/json", + description: Optional[str] = ..., + manifest_id: str, + metadata: Optional[dict[str, str]] = ..., + parameter_values: dict[str, Any], + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + async def create_version_from_manifest( + self, + agent_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + async def create_version_from_manifest( + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AgentVersionDetails: ... + + @distributed_trace_async + async def delete( + self, + agent_name: str, + *, + force: Optional[bool] = ..., + **kwargs: Any + ) -> DeleteAgentResponse: ... + + @distributed_trace_async + async def delete_session( + self, + agent_name: str, + session_id: str, + *, + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def delete_session_file( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + recursive: Optional[bool] = ..., + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def delete_version( + self, + agent_name: str, + agent_version: str, + *, + force: Optional[bool] = ..., + **kwargs: Any + ) -> DeleteAgentVersionResponse: ... + + @distributed_trace_async + async def download_code( + self, + agent_name: str, + *, + agent_version: Optional[str] = ..., + **kwargs: Any + ) -> AsyncIterator[bytes]: ... + + @distributed_trace_async + async def download_session_file( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> AsyncIterator[bytes]: ... + + @distributed_trace_async + async def get( + self, + agent_name: str, + **kwargs: Any + ) -> AgentDetails: ... + + @distributed_trace_async + async def get_session( + self, + agent_name: str, + session_id: str, + *, + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> AgentSessionResource: ... + + @distributed_trace_async + async def get_session_log_stream( + self, + agent_name: str, + agent_version: str, + session_id: str, + **kwargs: Any + ) -> SessionLogEvent: ... + + @distributed_trace_async + async def get_version( + self, + agent_name: str, + agent_version: str, + **kwargs: Any + ) -> AgentVersionDetails: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + kind: Optional[Union[str, AgentKind]] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[AgentDetails]: ... + + @distributed_trace + def list_session_files( + self, + agent_name: str, + agent_session_id: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + path: Optional[str] = ..., + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> AsyncItemPaged[SessionDirectoryEntry]: ... + + @distributed_trace + def list_sessions( + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> AsyncItemPaged[AgentSessionResource]: ... + + @distributed_trace + def list_versions( + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[AgentVersionDetails]: ... + + @overload + async def patch_agent_details( + self, + agent_name: str, + *, + agent_card: Optional[AgentCard] = ..., + agent_endpoint: Optional[AgentEndpointConfig] = ..., + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> AgentDetails: ... + + @overload + async def patch_agent_details( + self, + agent_name: str, + body: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> AgentDetails: ... + + @overload + async def patch_agent_details( + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> AgentDetails: ... + + @distributed_trace_async + async def stop_session( + self, + agent_name: str, + session_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def upload_session_file( + self, + agent_name: str, + session_id: str, + content_or_file_path: bytes | str, + *, + path: str, + **kwargs: Any + ) -> SessionFileWriteResult: ... + + + class azure.ai.projects.aio.operations.BetaAgentsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def cancel_optimization_job( + self, + job_id: str, + **kwargs: Any + ) -> OptimizationJob: ... + + @overload + async def create_optimization_job( + self, + job: OptimizationJob, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> OptimizationJob: ... + + @overload + async def create_optimization_job( + self, + job: JSON, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> OptimizationJob: ... + + @overload + async def create_optimization_job( + self, + job: IO[bytes], + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> OptimizationJob: ... + + @distributed_trace_async + async def delete_optimization_job( + self, + job_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get_optimization_job( + self, + job_id: str, + **kwargs: Any + ) -> OptimizationJob: ... + + @distributed_trace + def list_optimization_jobs( + self, + *, + agent_name: Optional[str] = ..., + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + status: Optional[Union[str, JobStatus]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[OptimizationJobListItem]: ... + + + class azure.ai.projects.aio.operations.BetaDatasetsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def cancel_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> DataGenerationJob: ... + + @overload + async def create_generation_job( + self, + job: DataGenerationJob, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> DataGenerationJob: ... + + @overload + async def create_generation_job( + self, + job: JSON, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> DataGenerationJob: ... + + @overload + async def create_generation_job( + self, + job: IO[bytes], + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> DataGenerationJob: ... + + @distributed_trace_async + async def delete_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> DataGenerationJob: ... + + @distributed_trace + def list_generation_jobs( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[DataGenerationJob]: ... + + + class azure.ai.projects.aio.operations.BetaEvaluationTaxonomiesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create( + self, + name: str, + taxonomy: EvaluationTaxonomy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @overload + async def create( + self, + name: str, + taxonomy: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @overload + async def create( + self, + name: str, + taxonomy: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @distributed_trace_async + async def delete( + self, + name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + name: str, + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @distributed_trace + def list( + self, + *, + input_name: Optional[str] = ..., + input_type: Optional[str] = ..., + **kwargs: Any + ) -> AsyncItemPaged[EvaluationTaxonomy]: ... + + @overload + async def update( + self, + name: str, + taxonomy: EvaluationTaxonomy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @overload + async def update( + self, + name: str, + taxonomy: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @overload + async def update( + self, + name: str, + taxonomy: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + + class azure.ai.projects.aio.operations.BetaEvaluatorsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def cancel_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @overload + async def create_generation_job( + self, + job: EvaluatorGenerationJob, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @overload + async def create_generation_job( + self, + job: JSON, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @overload + async def create_generation_job( + self, + job: IO[bytes], + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @overload + async def create_version( + self, + name: str, + evaluator_version: EvaluatorVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + async def create_version( + self, + name: str, + evaluator_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + async def create_version( + self, + name: str, + evaluator_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @distributed_trace_async + async def delete_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def delete_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @overload + async def get_credentials( + self, + name: str, + version: str, + credential_request: EvaluatorCredentialRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @overload + async def get_credentials( + self, + name: str, + version: str, + credential_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @overload + async def get_credentials( + self, + name: str, + version: str, + credential_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @distributed_trace_async + async def get_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @distributed_trace_async + async def get_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> EvaluatorVersion: ... + + @distributed_trace + def list( + self, + *, + limit: Optional[int] = ..., + type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[EvaluatorVersion]: ... + + @distributed_trace + def list_generation_jobs( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[EvaluatorGenerationJob]: ... + + @distributed_trace + def list_versions( + self, + name: str, + *, + limit: Optional[int] = ..., + type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[EvaluatorVersion]: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: PendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + async def update_version( + self, + name: str, + version: str, + evaluator_version: EvaluatorVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + async def update_version( + self, + name: str, + version: str, + evaluator_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + async def update_version( + self, + name: str, + version: str, + evaluator_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + + class azure.ai.projects.aio.operations.BetaInsightsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def generate( + self, + insight: Insight, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Insight: ... + + @overload + async def generate( + self, + insight: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Insight: ... + + @overload + async def generate( + self, + insight: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Insight: ... + + @distributed_trace_async + async def get( + self, + insight_id: str, + *, + include_coordinates: Optional[bool] = ..., + **kwargs: Any + ) -> Insight: ... + + @distributed_trace + def list( + self, + *, + agent_name: Optional[str] = ..., + eval_id: Optional[str] = ..., + include_coordinates: Optional[bool] = ..., + run_id: Optional[str] = ..., + type: Optional[Union[str, InsightType]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[Insight]: ... + + + class azure.ai.projects.aio.operations.BetaMemoryStoresOperations(GenerateBetaMemoryStoresOperations): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_update_memories( + self, + name: str, + *, + content_type: str = "application/json", + items: Optional[Union[str, ResponseInputParam]] = ..., + previous_update_id: Optional[str] = ..., + scope: str, + update_delay: Optional[int] = ..., + **kwargs: Any + ) -> AsyncUpdateMemoriesLROPoller: ... + + @overload + async def begin_update_memories( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncUpdateMemoriesLROPoller: ... + + @overload + async def begin_update_memories( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncUpdateMemoriesLROPoller: ... + + @overload + async def create( + self, + *, + content_type: str = "application/json", + definition: MemoryStoreDefinition, + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + name: str, + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + async def create( + self, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + async def create( + self, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + async def create_memory( + self, + name: str, + *, + content: str, + content_type: str = "application/json", + kind: Union[str, MemoryItemKind], + scope: str, + **kwargs: Any + ) -> MemoryItem: ... + + @overload + async def create_memory( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + @overload + async def create_memory( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + @distributed_trace_async + async def delete( + self, + name: str, + **kwargs: Any + ) -> DeleteMemoryStoreResult: ... + + @distributed_trace_async + async def delete_memory( + self, + name: str, + memory_id: str, + **kwargs: Any + ) -> DeleteMemoryResult: ... + + @overload + async def delete_scope( + self, + name: str, + *, + content_type: str = "application/json", + scope: str, + **kwargs: Any + ) -> MemoryStoreDeleteScopeResult: ... + + @overload + async def delete_scope( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDeleteScopeResult: ... + + @overload + async def delete_scope( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDeleteScopeResult: ... + + @distributed_trace_async + async def get( + self, + name: str, + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @distributed_trace_async + async def get_memory( + self, + name: str, + memory_id: str, + **kwargs: Any + ) -> MemoryItem: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[MemoryStoreDetails]: ... + + @overload + def list_memories( + self, + name: str, + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[Union[str, MemoryItemKind]] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + scope: str, + **kwargs: Any + ) -> AsyncItemPaged[MemoryItem]: ... + + @overload + def list_memories( + self, + name: str, + body: JSON, + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[Union[str, MemoryItemKind]] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[MemoryItem]: ... + + @overload + def list_memories( + self, + name: str, + body: IO[bytes], + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[Union[str, MemoryItemKind]] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[MemoryItem]: ... + + @overload + async def search_memories( + self, + name: str, + *, + content_type: str = "application/json", + items: Optional[Union[str, ResponseInputParam]] = ..., + options: Optional[MemorySearchOptions] = ..., + previous_search_id: Optional[str] = ..., + scope: str, + **kwargs: Any + ) -> MemoryStoreSearchResult: ... + + @overload + async def search_memories( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreSearchResult: ... + + @overload + async def search_memories( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreSearchResult: ... + + @overload + async def update( + self, + name: str, + *, + content_type: str = "application/json", + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + async def update( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + async def update( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + async def update_memory( + self, + name: str, + memory_id: str, + *, + content: str, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + @overload + async def update_memory( + self, + name: str, + memory_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + @overload + async def update_memory( + self, + name: str, + memory_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + + class azure.ai.projects.aio.operations.BetaModelsOperations(BetaModelsOperationsGenerated): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create( + self, + *, + base_model: Optional[str] = ..., + description: Optional[str] = ..., + name: str, + polling_interval: float = 2.0, + polling_timeout: float = 300.0, + source: Union[str, PathLike[str]], + tags: Optional[dict[str, str]] = ..., + version: str, + wait_for_commit: Literal[True] = True, + weight_type: Optional[str] = ..., + **kwargs: Any + ) -> ModelVersion: ... + + @overload + async def create( + self, + *, + base_model: Optional[str] = ..., + description: Optional[str] = ..., + name: str, + polling_interval: float = 2.0, + polling_timeout: float = 300.0, + source: Union[str, PathLike[str]], + tags: Optional[dict[str, str]] = ..., + version: str, + wait_for_commit: Literal[False], + weight_type: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def delete( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + name: str, + version: str, + **kwargs: Any + ) -> ModelVersion: ... + + @overload + async def get_credentials( + self, + name: str, + version: str, + credential_request: ModelCredentialRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @overload + async def get_credentials( + self, + name: str, + version: str, + credential_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @overload + async def get_credentials( + self, + name: str, + version: str, + credential_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[ModelVersion]: ... + + @distributed_trace + def list_versions( + self, + name: str, + **kwargs: Any + ) -> AsyncItemPaged[ModelVersion]: ... + + @overload + async def pending_create_version( + self, + name: str, + version: str, + model_version: ModelVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CreateAsyncResponse: ... + + @overload + async def pending_create_version( + self, + name: str, + version: str, + model_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CreateAsyncResponse: ... + + @overload + async def pending_create_version( + self, + name: str, + version: str, + model_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CreateAsyncResponse: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: ModelPendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ModelPendingUploadResponse: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ModelPendingUploadResponse: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ModelPendingUploadResponse: ... + + @overload + async def update( + self, + name: str, + version: str, + model_version_update: UpdateModelVersionRequest, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> ModelVersion: ... + + @overload + async def update( + self, + name: str, + version: str, + model_version_update: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> ModelVersion: ... + + @overload + async def update( + self, + name: str, + version: str, + model_version_update: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> ModelVersion: ... + + + class azure.ai.projects.aio.operations.BetaOperations(GeneratedBetaOperations): + agents: BetaAgentsOperations + datasets: BetaDatasetsOperations + evaluation_taxonomies: BetaEvaluationTaxonomiesOperations + evaluators: BetaEvaluatorsOperations + insights: BetaInsightsOperations + memory_stores: BetaMemoryStoresOperations + models: BetaModelsOperations + red_teams: BetaRedTeamsOperations + routines: BetaRoutinesOperations + schedules: BetaSchedulesOperations + skills: BetaSkillsOperations + + def __init__( + self, + *args: Any, + **kwargs: Any + ) -> None: ... + + + class azure.ai.projects.aio.operations.BetaRedTeamsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create( + self, + red_team: RedTeam, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> RedTeam: ... + + @overload + async def create( + self, + red_team: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> RedTeam: ... + + @overload + async def create( + self, + red_team: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> RedTeam: ... + + @distributed_trace_async + async def get( + self, + name: str, + **kwargs: Any + ) -> RedTeam: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[RedTeam]: ... + + + class azure.ai.projects.aio.operations.BetaRoutinesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create_or_update( + self, + routine_name: str, + *, + action: Optional[RoutineAction] = ..., + content_type: str = "application/json", + description: Optional[str] = ..., + enabled: Optional[bool] = ..., + triggers: Optional[dict[str, RoutineTrigger]] = ..., + **kwargs: Any + ) -> Routine: ... + + @overload + async def create_or_update( + self, + routine_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Routine: ... + + @overload + async def create_or_update( + self, + routine_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Routine: ... + + @distributed_trace_async + async def delete( + self, + routine_name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def disable( + self, + routine_name: str, + **kwargs: Any + ) -> Routine: ... + + @overload + async def dispatch( + self, + routine_name: str, + *, + content_type: str = "application/json", + payload: Optional[RoutineDispatchPayload] = ..., + **kwargs: Any + ) -> DispatchRoutineResult: ... + + @overload + async def dispatch( + self, + routine_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DispatchRoutineResult: ... + + @overload + async def dispatch( + self, + routine_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DispatchRoutineResult: ... + + @distributed_trace_async + async def enable( + self, + routine_name: str, + **kwargs: Any + ) -> Routine: ... + + @distributed_trace_async + async def get( + self, + routine_name: str, + **kwargs: Any + ) -> Routine: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[str] = ..., + **kwargs: Any + ) -> AsyncItemPaged[Routine]: ... + + @distributed_trace + def list_runs( + self, + routine_name: str, + *, + before: Optional[str] = ..., + filter: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[str] = ..., + **kwargs: Any + ) -> AsyncItemPaged[RoutineRun]: ... + + + class azure.ai.projects.aio.operations.BetaSchedulesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create_or_update( + self, + schedule_id: str, + schedule: Schedule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Schedule: ... + + @overload + async def create_or_update( + self, + schedule_id: str, + schedule: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Schedule: ... + + @overload + async def create_or_update( + self, + schedule_id: str, + schedule: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Schedule: ... + + @distributed_trace_async + async def delete( + self, + schedule_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + schedule_id: str, + **kwargs: Any + ) -> Schedule: ... + + @distributed_trace_async + async def get_run( + self, + schedule_id: str, + run_id: str, + **kwargs: Any + ) -> ScheduleRun: ... + + @distributed_trace + def list( + self, + *, + enabled: Optional[bool] = ..., + type: Optional[Union[str, ScheduleTaskType]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[Schedule]: ... + + @distributed_trace + def list_runs( + self, + schedule_id: str, + *, + enabled: Optional[bool] = ..., + type: Optional[Union[str, ScheduleTaskType]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[ScheduleRun]: ... + + + class azure.ai.projects.aio.operations.BetaSkillsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create( + self, + name: str, + *, + content_type: str = "application/json", + default: Optional[bool] = ..., + inline_content: Optional[SkillInlineContent] = ..., + **kwargs: Any + ) -> SkillVersion: ... + + @overload + async def create( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillVersion: ... + + @overload + async def create( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillVersion: ... + + @overload + async def create_from_files( + self, + name: str, + content: CreateSkillVersionFromFilesBody, + **kwargs: Any + ) -> SkillVersion: ... + + @overload + async def create_from_files( + self, + name: str, + content: JSON, + **kwargs: Any + ) -> SkillVersion: ... + + @distributed_trace_async + async def delete( + self, + name: str, + **kwargs: Any + ) -> DeleteSkillResult: ... + + @distributed_trace_async + async def delete_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> DeleteSkillVersionResult: ... + + @distributed_trace_async + async def download( + self, + name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: ... + + @distributed_trace_async + async def download_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: ... + + @distributed_trace_async + async def get( + self, + name: str, + **kwargs: Any + ) -> SkillDetails: ... + + @distributed_trace_async + async def get_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> SkillVersion: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[SkillDetails]: ... + + @distributed_trace + def list_versions( + self, + name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[SkillVersion]: ... + + @overload + async def update( + self, + name: str, + *, + content_type: str = "application/json", + default_version: str, + **kwargs: Any + ) -> SkillDetails: ... + + @overload + async def update( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillDetails: ... + + @overload + async def update( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillDetails: ... + + + class azure.ai.projects.aio.operations.ConnectionsOperations(ConnectionsOperationsGenerated): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def get( + self, + name: str, + *, + include_credentials: Optional[bool] = False, + **kwargs: Any + ) -> Connection: ... + + @distributed_trace_async + async def get_default( + self, + connection_type: Union[str, ConnectionType], + *, + include_credentials: Optional[bool] = False, + **kwargs: Any + ) -> Connection: ... + + @distributed_trace + def list( + self, + *, + connection_type: Optional[Union[str, ConnectionType]] = ..., + default_connection: Optional[bool] = ..., + **kwargs: Any + ) -> AsyncItemPaged[Connection]: ... + + + class azure.ai.projects.aio.operations.DatasetsOperations(DatasetsOperationsGenerated): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create_or_update( + self, + name: str, + version: str, + dataset_version: DatasetVersion, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> DatasetVersion: ... + + @overload + async def create_or_update( + self, + name: str, + version: str, + dataset_version: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> DatasetVersion: ... + + @overload + async def create_or_update( + self, + name: str, + version: str, + dataset_version: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> DatasetVersion: ... + + @distributed_trace_async + async def delete( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + name: str, + version: str, + **kwargs: Any + ) -> DatasetVersion: ... + + @distributed_trace_async + async def get_credentials( + self, + name: str, + version: str, + **kwargs: Any + ) -> DatasetCredential: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[DatasetVersion]: ... + + @distributed_trace + def list_versions( + self, + name: str, + **kwargs: Any + ) -> AsyncItemPaged[DatasetVersion]: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: PendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + async def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @distributed_trace_async + async def upload_file( + self, + *, + connection_name: Optional[str] = ..., + file_path: str, + name: str, + version: str, + **kwargs: Any + ) -> FileDatasetVersion: ... + + @distributed_trace_async + async def upload_folder( + self, + *, + connection_name: Optional[str] = ..., + file_pattern: Optional[Pattern] = ..., + folder: str, + name: str, + version: str, + **kwargs: Any + ) -> FolderDatasetVersion: ... + + + class azure.ai.projects.aio.operations.DeploymentsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def get( + self, + name: str, + **kwargs: Any + ) -> Deployment: ... + + @distributed_trace + def list( + self, + *, + deployment_type: Optional[Union[str, DeploymentType]] = ..., + model_name: Optional[str] = ..., + model_publisher: Optional[str] = ..., + **kwargs: Any + ) -> AsyncItemPaged[Deployment]: ... + + + class azure.ai.projects.aio.operations.EvaluationRulesOperations(GeneratedEvaluationRulesOperations): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create_or_update( + self, + id: str, + evaluation_rule: EvaluationRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationRule: ... + + @overload + async def create_or_update( + self, + id: str, + evaluation_rule: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationRule: ... + + @overload + async def create_or_update( + self, + id: str, + evaluation_rule: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationRule: ... + + @distributed_trace_async + async def delete( + self, + id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + id: str, + **kwargs: Any + ) -> EvaluationRule: ... + + @distributed_trace + def list( + self, + *, + action_type: Optional[Union[str, EvaluationRuleActionType]] = ..., + agent_name: Optional[str] = ..., + enabled: Optional[bool] = ..., + **kwargs: Any + ) -> AsyncItemPaged[EvaluationRule]: ... + + + class azure.ai.projects.aio.operations.IndexesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create_or_update( + self, + name: str, + version: str, + index: Index, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> Index: ... + + @overload + async def create_or_update( + self, + name: str, + version: str, + index: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> Index: ... + + @overload + async def create_or_update( + self, + name: str, + version: str, + index: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> Index: ... + + @distributed_trace_async + async def delete( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + name: str, + version: str, + **kwargs: Any + ) -> Index: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[Index]: ... + + @distributed_trace + def list_versions( + self, + name: str, + **kwargs: Any + ) -> AsyncItemPaged[Index]: ... + + + class azure.ai.projects.aio.operations.TelemetryOperations: + + def __init__(self, outer_instance: AIProjectClient) -> None: ... + + @distributed_trace_async + async def get_application_insights_connection_string(self) -> str: ... + + + class azure.ai.projects.aio.operations.ToolboxesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create_version( + self, + name: str, + *, + content_type: str = "application/json", + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + policies: Optional[ToolboxPolicies] = ..., + skills: Optional[List[ToolboxSkill]] = ..., + tools: List[Tool], + **kwargs: Any + ) -> ToolboxVersionObject: ... + + @overload + async def create_version( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ToolboxVersionObject: ... + + @overload + async def create_version( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ToolboxVersionObject: ... + + @distributed_trace_async + async def delete( + self, + name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def delete_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + async def get( + self, + name: str, + **kwargs: Any + ) -> ToolboxObject: ... + + @distributed_trace_async + async def get_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> ToolboxVersionObject: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[ToolboxObject]: ... + + @distributed_trace + def list_versions( + self, + name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[ToolboxVersionObject]: ... + + @overload + async def update( + self, + name: str, + *, + content_type: str = "application/json", + default_version: str, + **kwargs: Any + ) -> ToolboxObject: ... + + @overload + async def update( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ToolboxObject: ... + + @overload + async def update( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ToolboxObject: ... + + +namespace azure.ai.projects.models + + class azure.ai.projects.models.A2APreviewTool(Tool, discriminator='a2a_preview'): + agent_card_path: Optional[str] + base_url: Optional[str] + description: Optional[str] + name: Optional[str] + project_connection_id: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.A2A_PREVIEW] + + @overload + def __init__( + self, + *, + agent_card_path: Optional[str] = ..., + base_url: Optional[str] = ..., + description: Optional[str] = ..., + name: Optional[str] = ..., + project_connection_id: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AISearchIndexResource(_Model): + filter: Optional[str] + index_asset_id: Optional[str] + index_name: Optional[str] + project_connection_id: Optional[str] + query_type: Optional[Union[str, AzureAISearchQueryType]] + top_k: Optional[int] + + @overload + def __init__( + self, + *, + filter: Optional[str] = ..., + index_asset_id: Optional[str] = ..., + index_name: Optional[str] = ..., + project_connection_id: Optional[str] = ..., + query_type: Optional[Union[str, AzureAISearchQueryType]] = ..., + top_k: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentBlueprintReference(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentBlueprintReferenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MANAGED_AGENT_IDENTITY_BLUEPRINT = "ManagedAgentIdentityBlueprint" + + + class azure.ai.projects.models.AgentCard(_Model): + description: Optional[str] + skills: list[AgentCardSkill] + version: str + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + skills: list[AgentCardSkill], + version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentCardSkill(_Model): + description: Optional[str] + examples: Optional[list[str]] + id: str + name: str + tags: Optional[list[str]] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + examples: Optional[list[str]] = ..., + id: str, + name: str, + tags: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentClusterInsightRequest(InsightRequest, discriminator='AgentClusterInsight'): + agent_name: str + model_configuration: Optional[InsightModelConfiguration] + type: Literal[InsightType.AGENT_CLUSTER_INSIGHT] + + @overload + def __init__( + self, + *, + agent_name: str, + model_configuration: Optional[InsightModelConfiguration] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentClusterInsightResult(InsightResult, discriminator='AgentClusterInsight'): + cluster_insight: ClusterInsightResult + type: Literal[InsightType.AGENT_CLUSTER_INSIGHT] + + @overload + def __init__( + self, + *, + cluster_insight: ClusterInsightResult + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentDataGenerationJobSource(DataGenerationJobSource, discriminator='agent'): + agent_name: str + agent_version: Optional[str] + description: str + type: Literal[DataGenerationJobSourceType.AGENT] + + @overload + def __init__( + self, + *, + agent_name: str, + agent_version: Optional[str] = ..., + description: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentDefinition(_Model): + kind: str + rai_config: Optional[RaiConfig] + + @overload + def __init__( + self, + *, + kind: str, + rai_config: Optional[RaiConfig] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentDetails(_Model): + agent_card: Optional[AgentCard] + agent_endpoint: Optional[AgentEndpointConfig] + blueprint: Optional[AgentIdentity] + blueprint_reference: Optional[AgentBlueprintReference] + id: str + instance_identity: Optional[AgentIdentity] + name: str + object: Literal[AgentObjectType.AGENT] + versions: AgentObjectVersions + + @overload + def __init__( + self, + *, + agent_card: Optional[AgentCard] = ..., + agent_endpoint: Optional[AgentEndpointConfig] = ..., + id: str, + name: str, + object: Literal[AgentObjectType.AGENT], + versions: AgentObjectVersions + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentEndpointAuthorizationScheme(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentEndpointAuthorizationSchemeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + BOT_SERVICE = "BotService" + BOT_SERVICE_RBAC = "BotServiceRbac" + ENTRA = "Entra" + + + class azure.ai.projects.models.AgentEndpointConfig(_Model): + authorization_schemes: Optional[list[AgentEndpointAuthorizationScheme]] + protocols: Optional[list[Union[str, AgentEndpointProtocol]]] + version_selector: Optional[VersionSelector] + + @overload + def __init__( + self, + *, + authorization_schemes: Optional[list[AgentEndpointAuthorizationScheme]] = ..., + protocols: Optional[list[Union[str, AgentEndpointProtocol]]] = ..., + version_selector: Optional[VersionSelector] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentEndpointProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + A2A = "a2a" + ACTIVITY = "activity" + INVOCATIONS = "invocations" + INVOCATIONS_WS = "invocations_ws" + MCP = "mcp" + RESPONSES = "responses" + + + class azure.ai.projects.models.AgentEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator='agent'): + agent_name: str + agent_version: Optional[str] + description: Optional[str] + type: Literal[EvaluatorGenerationJobSourceType.AGENT] + + @overload + def __init__( + self, + *, + agent_name: str, + agent_version: Optional[str] = ..., + description: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentIdentity(_Model): + client_id: str + principal_id: str + + @overload + def __init__( + self, + *, + client_id: str, + principal_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + EXTERNAL = "external" + HOSTED = "hosted" + PROMPT = "prompt" + WORKFLOW = "workflow" + + + class azure.ai.projects.models.AgentObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AGENT = "agent" + AGENT_CONTAINER = "agent.container" + AGENT_DELETED = "agent.deleted" + AGENT_VERSION = "agent.version" + AGENT_VERSION_DELETED = "agent.version.deleted" + + + class azure.ai.projects.models.AgentObjectVersions(_Model): + latest: AgentVersionDetails + + @overload + def __init__( + self, + *, + latest: AgentVersionDetails + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + A2A = "a2a" + ACTIVITY_PROTOCOL = "activity_protocol" + INVOCATIONS = "invocations" + INVOCATIONS_WS = "invocations_ws" + MCP = "mcp" + RESPONSES = "responses" + + + class azure.ai.projects.models.AgentSessionResource(_Model): + agent_session_id: str + created_at: datetime + expires_at: datetime + last_accessed_at: datetime + status: Union[str, AgentSessionStatus] + version_indicator: VersionIndicator + + @overload + def __init__( + self, + *, + agent_session_id: str, + status: Union[str, AgentSessionStatus], + version_indicator: VersionIndicator + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentSessionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACTIVE = "active" + CREATING = "creating" + DELETED = "deleted" + DELETING = "deleting" + EXPIRED = "expired" + FAILED = "failed" + IDLE = "idle" + UPDATING = "updating" + + + class azure.ai.projects.models.AgentTaxonomyInput(EvaluationTaxonomyInput, discriminator='agent'): + risk_categories: list[Union[str, RiskCategory]] + target: EvaluationTarget + type: Literal[EvaluationTaxonomyInputType.AGENT] + + @overload + def __init__( + self, + *, + risk_categories: list[Union[str, RiskCategory]], + target: EvaluationTarget + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentVersionDetails(_Model): + agent_guid: Optional[str] + blueprint: Optional[AgentIdentity] + blueprint_reference: Optional[AgentBlueprintReference] + created_at: datetime + definition: AgentDefinition + description: Optional[str] + id: str + instance_identity: Optional[AgentIdentity] + metadata: dict[str, str] + name: str + object: Literal[AgentObjectType.AGENT_VERSION] + status: Optional[Union[str, AgentVersionStatus]] + version: str + + @overload + def __init__( + self, + *, + created_at: datetime, + definition: AgentDefinition, + description: Optional[str] = ..., + id: str, + metadata: dict[str, str], + name: str, + object: Literal[AgentObjectType.AGENT_VERSION], + status: Optional[Union[str, AgentVersionStatus]] = ..., + version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AgentVersionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACTIVE = "active" + CREATING = "creating" + DELETED = "deleted" + DELETING = "deleting" + FAILED = "failed" + + + class azure.ai.projects.models.AgenticIdentityPreviewCredentials(BaseCredentials, discriminator='AgenticIdentityToken_Preview'): + type: Literal[CredentialType.AGENTIC_IDENTITY_PREVIEW] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ApiError(_Model): + additional_info: Optional[dict[str, Any]] + code: str + debug_info: Optional[dict[str, Any]] + details: Optional[list[ApiError]] + message: str + param: Optional[str] + type: Optional[str] + + @overload + def __init__( + self, + *, + additional_info: Optional[dict[str, Any]] = ..., + code: str, + debug_info: Optional[dict[str, Any]] = ..., + details: Optional[list[ApiError]] = ..., + message: str, + param: Optional[str] = ..., + type: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ApiErrorResponse(_Model): + error: ApiError + + @overload + def __init__( + self, + *, + error: ApiError + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ApiKeyCredentials(BaseCredentials, discriminator='ApiKey'): + api_key: Optional[str] + type: Literal[CredentialType.API_KEY] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ApplyPatchToolParam(Tool, discriminator='apply_patch'): + type: Literal[ToolType.APPLY_PATCH] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ApproximateLocation(_Model): + city: Optional[str] + country: Optional[str] + region: Optional[str] + timezone: Optional[str] + type: Literal["approximate"] + + @overload + def __init__( + self, + *, + city: Optional[str] = ..., + country: Optional[str] = ..., + region: Optional[str] = ..., + timezone: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ArtifactProfile(_Model): + category: Union[str, FoundryModelArtifactProfileCategory] + signals: Optional[list[Union[str, FoundryModelArtifactProfileSignal]]] + + @overload + def __init__( + self, + *, + category: Union[str, FoundryModelArtifactProfileCategory], + signals: Optional[list[Union[str, FoundryModelArtifactProfileSignal]]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AsyncUpdateMemoriesLROPoller(AsyncLROPoller[MemoryStoreUpdateCompletedResult]): + property superseded_by: Optional[str] # Read-only + property update_id: str # Read-only + + @classmethod + def from_continuation_token( + cls, + polling_method: AsyncPollingMethod[MemoryStoreUpdateCompletedResult], + continuation_token: str, + **kwargs: Any + ) -> AsyncUpdateMemoriesLROPoller: ... + + + class azure.ai.projects.models.AttackStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ANSI_ATTACK = "ansi_attack" + ASCII_ART = "ascii_art" + ASCII_SMUGGLER = "ascii_smuggler" + ATBASH = "atbash" + BASE64 = "base64" + BASELINE = "baseline" + BINARY = "binary" + CAESAR = "caesar" + CHARACTER_SPACE = "character_space" + CHARACTER_SWAP = "character_swap" + CRESCENDO = "crescendo" + DIACRITIC = "diacritic" + DIFFICULT = "difficult" + EASY = "easy" + FLIP = "flip" + INDIRECT_JAILBREAK = "indirect_jailbreak" + JAILBREAK = "jailbreak" + LEETSPEAK = "leetspeak" + MODERATE = "moderate" + MORSE = "morse" + MULTI_TURN = "multi_turn" + ROT13 = "rot13" + STRING_JOIN = "string_join" + SUFFIX_APPEND = "suffix_append" + TENSE = "tense" + UNICODE_CONFUSABLE = "unicode_confusable" + UNICODE_SUBSTITUTION = "unicode_substitution" + URL = "url" + + + class azure.ai.projects.models.AutoCodeInterpreterToolParam(_Model): + file_ids: Optional[list[str]] + memory_limit: Optional[Union[str, ContainerMemoryLimit]] + network_policy: Optional[ContainerNetworkPolicyParam] + type: Literal["auto"] + + @overload + def __init__( + self, + *, + file_ids: Optional[list[str]] = ..., + memory_limit: Optional[Union[str, ContainerMemoryLimit]] = ..., + network_policy: Optional[ContainerNetworkPolicyParam] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureAIAgentTarget(EvaluationTarget, discriminator='azure_ai_agent'): + name: str + tool_descriptions: Optional[list[ToolDescription]] + tools: Optional[list[Tool]] + type: Literal["azure_ai_agent"] + version: Optional[str] + + @overload + def __init__( + self, + *, + name: str, + tool_descriptions: Optional[list[ToolDescription]] = ..., + tools: Optional[list[Tool]] = ..., + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureAIAgentTargetParam(TypedDict, total=False): + key "name": Required[str] + key "tool_descriptions": List[ToolDescriptionParam] + key "type": Required[Literal["azure_ai_agent"]] + key "version": str + + + class azure.ai.projects.models.AzureAIBenchmarkPreviewEvalRunDataSource(TypedDict, total=False): + key "input_messages": InputMessagesItemReference + key "target": Required[Union[AzureAIAgentTargetParam, AzureAIModelTargetParam, dict[str, Any]]] + key "type": Required[Literal["azure_ai_benchmark_preview"]] + + + class azure.ai.projects.models.AzureAIDataSourceConfig(TypedDict, total=False): + key "scenario": Required[str] + key "type": Required[Literal["azure_ai_source"]] + + + class azure.ai.projects.models.AzureAIModelTarget(EvaluationTarget, discriminator='azure_ai_model'): + model: Optional[str] + sampling_params: Optional[ModelSamplingParams] + type: Literal["azure_ai_model"] + + @overload + def __init__( + self, + *, + model: Optional[str] = ..., + sampling_params: Optional[ModelSamplingParams] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureAIModelTargetParam(TypedDict, total=False): + key "model": str + key "sampling_params": ModelSamplingConfigParam + key "type": Required[Literal["azure_ai_model"]] + + + class azure.ai.projects.models.AzureAIResponsesEvalRunDataSource(TypedDict, total=False): + key "event_configuration_id": str + key "item_generation_params": Required[ResponseRetrievalItemGenerationParams] + key "max_runs_hourly": int + key "type": Required[Literal["azure_ai_responses"]] + + + class azure.ai.projects.models.AzureAISearchIndex(Index, discriminator='AzureSearch'): + connection_name: str + description: str + field_mapping: Optional[FieldMapping] + id: str + index_name: str + name: str + tags: dict[str, str] + type: Literal[IndexType.AZURE_SEARCH] + version: str + + @overload + def __init__( + self, + *, + connection_name: str, + description: Optional[str] = ..., + field_mapping: Optional[FieldMapping] = ..., + index_name: str, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureAISearchQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SEMANTIC = "semantic" + SIMPLE = "simple" + VECTOR = "vector" + VECTOR_SEMANTIC_HYBRID = "vector_semantic_hybrid" + VECTOR_SIMPLE_HYBRID = "vector_simple_hybrid" + + + class azure.ai.projects.models.AzureAISearchTool(Tool, discriminator='azure_ai_search'): + azure_ai_search: AzureAISearchToolResource + description: Optional[str] + name: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.AZURE_AI_SEARCH] + + @overload + def __init__( + self, + *, + azure_ai_search: AzureAISearchToolResource, + description: Optional[str] = ..., + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureAISearchToolResource(_Model): + indexes: list[AISearchIndexResource] + + @overload + def __init__( + self, + *, + indexes: list[AISearchIndexResource] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureFunctionBinding(_Model): + storage_queue: AzureFunctionStorageQueue + type: Literal["storage_queue"] + + @overload + def __init__( + self, + *, + storage_queue: AzureFunctionStorageQueue + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureFunctionDefinition(_Model): + function: AzureFunctionDefinitionFunction + input_binding: AzureFunctionBinding + output_binding: AzureFunctionBinding + + @overload + def __init__( + self, + *, + function: AzureFunctionDefinitionFunction, + input_binding: AzureFunctionBinding, + output_binding: AzureFunctionBinding + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureFunctionDefinitionFunction(_Model): + description: Optional[str] + name: str + parameters: dict[str, Any] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: str, + parameters: dict[str, Any] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureFunctionStorageQueue(_Model): + queue_name: str + queue_service_endpoint: str + + @overload + def __init__( + self, + *, + queue_name: str, + queue_service_endpoint: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureFunctionTool(Tool, discriminator='azure_function'): + azure_function: AzureFunctionDefinition + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.AZURE_FUNCTION] + + @overload + def __init__( + self, + *, + azure_function: AzureFunctionDefinition, + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.AzureOpenAIModelConfiguration(RedTeamTargetConfig, discriminator='AzureOpenAIModel'): + model_deployment_name: str + type: Literal["AzureOpenAIModel"] + + @overload + def __init__( + self, + *, + model_deployment_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BaseCredentials(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BingCustomSearchConfiguration(_Model): + count: Optional[int] + freshness: Optional[str] + instance_name: str + market: Optional[str] + project_connection_id: str + set_lang: Optional[str] + + @overload + def __init__( + self, + *, + count: Optional[int] = ..., + freshness: Optional[str] = ..., + instance_name: str, + market: Optional[str] = ..., + project_connection_id: str, + set_lang: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BingCustomSearchPreviewTool(Tool, discriminator='bing_custom_search_preview'): + bing_custom_search_preview: BingCustomSearchToolParameters + description: Optional[str] + name: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.BING_CUSTOM_SEARCH_PREVIEW] + + @overload + def __init__( + self, + *, + bing_custom_search_preview: BingCustomSearchToolParameters, + description: Optional[str] = ..., + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BingCustomSearchToolParameters(_Model): + search_configurations: list[BingCustomSearchConfiguration] + + @overload + def __init__( + self, + *, + search_configurations: list[BingCustomSearchConfiguration] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BingGroundingSearchConfiguration(_Model): + count: Optional[int] + freshness: Optional[str] + market: Optional[str] + project_connection_id: str + set_lang: Optional[str] + + @overload + def __init__( + self, + *, + count: Optional[int] = ..., + freshness: Optional[str] = ..., + market: Optional[str] = ..., + project_connection_id: str, + set_lang: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BingGroundingSearchToolParameters(_Model): + search_configurations: list[BingGroundingSearchConfiguration] + + @overload + def __init__( + self, + *, + search_configurations: list[BingGroundingSearchConfiguration] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BingGroundingTool(Tool, discriminator='bing_grounding'): + bing_grounding: BingGroundingSearchToolParameters + description: Optional[str] + name: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.BING_GROUNDING] + + @overload + def __init__( + self, + *, + bing_grounding: BingGroundingSearchToolParameters, + description: Optional[str] = ..., + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BlobReference(_Model): + blob_uri: str + credential: BlobReferenceSasCredential + storage_account_arm_id: str + + @overload + def __init__( + self, + *, + blob_uri: str, + credential: BlobReferenceSasCredential, + storage_account_arm_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BlobReferenceSasCredential(_Model): + sas_uri: str + type: Literal["SAS"] + + def __init__( + self, + *args: Any, + **kwargs: Any + ) -> None: ... + + + class azure.ai.projects.models.BotServiceAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator='BotService'): + type: Literal[AgentEndpointAuthorizationSchemeType.BOT_SERVICE] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BotServiceRbacAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator='BotServiceRbac'): + type: Literal[AgentEndpointAuthorizationSchemeType.BOT_SERVICE_RBAC] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BrowserAutomationPreviewTool(Tool, discriminator='browser_automation_preview'): + browser_automation_preview: BrowserAutomationToolParameters + description: Optional[str] + name: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.BROWSER_AUTOMATION_PREVIEW] + + @overload + def __init__( + self, + *, + browser_automation_preview: BrowserAutomationToolParameters, + description: Optional[str] = ..., + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BrowserAutomationToolConnectionParameters(_Model): + project_connection_id: str + + @overload + def __init__( + self, + *, + project_connection_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.BrowserAutomationToolParameters(_Model): + connection: BrowserAutomationToolConnectionParameters + + @overload + def __init__( + self, + *, + connection: BrowserAutomationToolConnectionParameters + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CaptureStructuredOutputsTool(Tool, discriminator='capture_structured_outputs'): + description: Optional[str] + name: Optional[str] + outputs: StructuredOutputDefinition + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.CAPTURE_STRUCTURED_OUTPUTS] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + outputs: StructuredOutputDefinition, + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ChartCoordinate(_Model): + size: int + x: int + y: int + + @overload + def __init__( + self, + *, + size: int, + x: int, + y: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ChatSummaryMemoryItem(MemoryItem, discriminator='chat_summary'): + content: str + kind: Literal[MemoryItemKind.CHAT_SUMMARY] + memory_id: str + scope: str + updated_at: datetime + + @overload + def __init__( + self, + *, + content: str, + memory_id: str, + scope: str, + updated_at: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ClusterInsightResult(_Model): + clusters: list[InsightCluster] + coordinates: Optional[dict[str, ChartCoordinate]] + summary: InsightSummary + + @overload + def __init__( + self, + *, + clusters: list[InsightCluster], + coordinates: Optional[dict[str, ChartCoordinate]] = ..., + summary: InsightSummary + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ClusterTokenUsage(_Model): + input_token_usage: int + output_token_usage: int + total_token_usage: int + + @overload + def __init__( + self, + *, + input_token_usage: int, + output_token_usage: int, + total_token_usage: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CodeBasedEvaluatorDefinition(EvaluatorDefinition, discriminator='code'): + blob_uri: Optional[str] + code_text: Optional[str] + data_schema: dict[str, any] + entry_point: Optional[str] + image_tag: Optional[str] + init_parameters: dict[str, any] + metrics: dict[str, EvaluatorMetric] + type: Literal[EvaluatorDefinitionType.CODE] + + @overload + def __init__( + self, + *, + blob_uri: Optional[str] = ..., + code_text: Optional[str] = ..., + data_schema: Optional[dict[str, Any]] = ..., + entry_point: Optional[str] = ..., + image_tag: Optional[str] = ..., + init_parameters: Optional[dict[str, Any]] = ..., + metrics: Optional[dict[str, EvaluatorMetric]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CodeConfiguration(_Model): + content_hash: Optional[str] + dependency_resolution: Union[str, CodeDependencyResolution] + entry_point: list[str] + runtime: str + + @overload + def __init__( + self, + *, + dependency_resolution: Union[str, CodeDependencyResolution], + entry_point: list[str], + runtime: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CodeDependencyResolution(str, Enum, metaclass=CaseInsensitiveEnumMeta): + BUNDLED = "bundled" + REMOTE_BUILD = "remote_build" + + + class azure.ai.projects.models.CodeInterpreterTool(Tool, discriminator='code_interpreter'): + container: Optional[Union[str, AutoCodeInterpreterToolParam]] + description: Optional[str] + name: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.CODE_INTERPRETER] + + @overload + def __init__( + self, + *, + container: Optional[Union[str, AutoCodeInterpreterToolParam]] = ..., + description: Optional[str] = ..., + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ComparisonFilter(_Model): + key: str + type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"] + value: Union[str, float, bool, list[Union[str, float]]] + + @overload + def __init__( + self, + *, + key: str, + type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"], + value: Union[str, float, bool, list[Union[str, float]]] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CompoundFilter(_Model): + filters: list[Union[ComparisonFilter, Any]] + type: Literal["and", "or"] + + @overload + def __init__( + self, + *, + filters: list[Union[ComparisonFilter, Any]], + type: Literal["and", "or"] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ComputerEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta): + BROWSER = "browser" + LINUX = "linux" + MAC = "mac" + UBUNTU = "ubuntu" + WINDOWS = "windows" + + + class azure.ai.projects.models.ComputerTool(Tool, discriminator='computer'): + type: Literal[ToolType.COMPUTER] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ComputerUsePreviewTool(Tool, discriminator='computer_use_preview'): + display_height: int + display_width: int + environment: Union[str, ComputerEnvironment] + type: Literal[ToolType.COMPUTER_USE_PREVIEW] + + @overload + def __init__( + self, + *, + display_height: int, + display_width: int, + environment: Union[str, ComputerEnvironment] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.Connection(_Model): + credentials: BaseCredentials + id: str + is_default: bool + metadata: dict[str, str] + name: str + target: str + type: Union[str, ConnectionType] + + + class azure.ai.projects.models.ConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + API_KEY = "ApiKey" + APPLICATION_CONFIGURATION = "AppConfig" + APPLICATION_INSIGHTS = "AppInsights" + AZURE_AI_SEARCH = "CognitiveSearch" + AZURE_BLOB_STORAGE = "AzureBlob" + AZURE_OPEN_AI = "AzureOpenAI" + AZURE_STORAGE_ACCOUNT = "AzureStorageAccount" + COSMOS_DB = "CosmosDB" + CUSTOM = "CustomKeys" + REMOTE_TOOL = "RemoteTool_Preview" + + + class azure.ai.projects.models.ContainerAutoParam(FunctionShellToolParamEnvironment, discriminator='container_auto'): + file_ids: Optional[list[str]] + memory_limit: Optional[Union[str, ContainerMemoryLimit]] + network_policy: Optional[ContainerNetworkPolicyParam] + skills: Optional[list[ContainerSkill]] + type: Literal[FunctionShellToolParamEnvironmentType.CONTAINER_AUTO] + + @overload + def __init__( + self, + *, + file_ids: Optional[list[str]] = ..., + memory_limit: Optional[Union[str, ContainerMemoryLimit]] = ..., + network_policy: Optional[ContainerNetworkPolicyParam] = ..., + skills: Optional[list[ContainerSkill]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ContainerConfiguration(_Model): + image: str + + @overload + def __init__( + self, + *, + image: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ContainerMemoryLimit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MEMORY_16GB = "16g" + MEMORY_1GB = "1g" + MEMORY_4GB = "4g" + MEMORY_64GB = "64g" + + + class azure.ai.projects.models.ContainerNetworkPolicyAllowlistParam(ContainerNetworkPolicyParam, discriminator='allowlist'): + allowed_domains: list[str] + domain_secrets: Optional[list[ContainerNetworkPolicyDomainSecretParam]] + type: Literal[ContainerNetworkPolicyParamType.ALLOWLIST] + + @overload + def __init__( + self, + *, + allowed_domains: list[str], + domain_secrets: Optional[list[ContainerNetworkPolicyDomainSecretParam]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ContainerNetworkPolicyDisabledParam(ContainerNetworkPolicyParam, discriminator='disabled'): + type: Literal[ContainerNetworkPolicyParamType.DISABLED] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ContainerNetworkPolicyDomainSecretParam(_Model): + domain: str + name: str + value: str + + @overload + def __init__( + self, + *, + domain: str, + name: str, + value: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ContainerNetworkPolicyParam(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ContainerNetworkPolicyParamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ALLOWLIST = "allowlist" + DISABLED = "disabled" + + + class azure.ai.projects.models.ContainerSkill(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ContainerSkillType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INLINE = "inline" + SKILL_REFERENCE = "skill_reference" + + + class azure.ai.projects.models.ContinuousEvaluationRuleAction(EvaluationRuleAction, discriminator='continuousEvaluation'): + eval_id: str + max_hourly_runs: Optional[int] + sampling_rate: Optional[float] + type: Literal[EvaluationRuleActionType.CONTINUOUS_EVALUATION] + + @overload + def __init__( + self, + *, + eval_id: str, + max_hourly_runs: Optional[int] = ..., + sampling_rate: Optional[float] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CosmosDBIndex(Index, discriminator='CosmosDBNoSqlVectorStore'): + connection_name: str + container_name: str + database_name: str + description: str + embedding_configuration: EmbeddingConfiguration + field_mapping: FieldMapping + id: str + name: str + tags: dict[str, str] + type: Literal[IndexType.COSMOS_DB] + version: str + + @overload + def __init__( + self, + *, + connection_name: str, + container_name: str, + database_name: str, + description: Optional[str] = ..., + embedding_configuration: EmbeddingConfiguration, + field_mapping: FieldMapping, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CreateAgentVersionFromCodeContent(_Model): + code: Union[str, bytes, IO[str], IO[bytes], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]]], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]], Optional[str]]] + metadata: CreateAgentVersionFromCodeMetadata + + @overload + def __init__( + self, + *, + code: FileType, + metadata: CreateAgentVersionFromCodeMetadata + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CreateAgentVersionFromCodeMetadata(_Model): + definition: HostedAgentDefinition + description: Optional[str] + metadata: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + definition: HostedAgentDefinition, + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CreateAsyncResponse(_Model): + location: Optional[str] + operation_result: Optional[str] + + @overload + def __init__( + self, + *, + location: Optional[str] = ..., + operation_result: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CreateSkillVersionFromFilesBody(_Model): + default: Optional[bool] + files: list[Union[str, bytes, IO[str], IO[bytes], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]]], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]], Optional[str]]]] + + @overload + def __init__( + self, + *, + default: Optional[bool] = ..., + files: list[FileType] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CredentialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AGENTIC_IDENTITY_PREVIEW = "AgenticIdentityToken_Preview" + API_KEY = "ApiKey" + CUSTOM = "CustomKeys" + ENTRA_ID = "AAD" + NONE = "None" + SAS = "SAS" + + + class azure.ai.projects.models.CronTrigger(Trigger, discriminator='Cron'): + end_time: Optional[datetime] + expression: str + start_time: Optional[datetime] + time_zone: Optional[str] + type: Literal[TriggerType.CRON] + + @overload + def __init__( + self, + *, + end_time: Optional[datetime] = ..., + expression: str, + start_time: Optional[datetime] = ..., + time_zone: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CustomCredential(CustomCredentialGenerated, discriminator='CustomKeys'): + credential_keys: Dict[str, str] + type: Union[str, CredentialType] + + def __init__( + self, + *args: Any, + **kwargs: Any + ) -> None: ... + + + class azure.ai.projects.models.CustomGrammarFormatParam(CustomToolParamFormat, discriminator='grammar'): + definition: str + syntax: Union[str, GrammarSyntax1] + type: Literal[CustomToolParamFormatType.GRAMMAR] + + @overload + def __init__( + self, + *, + definition: str, + syntax: Union[str, GrammarSyntax1] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CustomRoutineTrigger(RoutineTrigger, discriminator='custom'): + event_name: Optional[str] + parameters: dict[str, Any] + provider: str + type: Literal[RoutineTriggerType.CUSTOM] + + @overload + def __init__( + self, + *, + event_name: Optional[str] = ..., + parameters: dict[str, Any], + provider: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CustomTextFormatParam(CustomToolParamFormat, discriminator='text'): + type: Literal[CustomToolParamFormatType.TEXT] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CustomToolParam(Tool, discriminator='custom'): + defer_loading: Optional[bool] + description: Optional[str] + format: Optional[CustomToolParamFormat] + name: str + type: Literal[ToolType.CUSTOM] + + @overload + def __init__( + self, + *, + defer_loading: Optional[bool] = ..., + description: Optional[str] = ..., + format: Optional[CustomToolParamFormat] = ..., + name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CustomToolParamFormat(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.CustomToolParamFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + GRAMMAR = "grammar" + TEXT = "text" + + + class azure.ai.projects.models.DailyRecurrenceSchedule(RecurrenceSchedule, discriminator='Daily'): + hours: list[int] + type: Literal[RecurrenceType.DAILY] + + @overload + def __init__( + self, + *, + hours: list[int] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DataGenerationJob(_Model): + created_at: datetime + error: Optional[ApiError] + finished_at: Optional[datetime] + id: str + inputs: Optional[DataGenerationJobInputs] + result: Optional[DataGenerationJobResult] + status: Union[str, JobStatus] + + @overload + def __init__( + self, + *, + inputs: Optional[DataGenerationJobInputs] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DataGenerationJobInputs(_Model): + name: str + options: DataGenerationJobOptions + output_options: Optional[DataGenerationJobOutputOptions] + scenario: Union[str, DataGenerationJobScenario] + sources: list[DataGenerationJobSource] + + @overload + def __init__( + self, + *, + name: str, + options: DataGenerationJobOptions, + output_options: Optional[DataGenerationJobOutputOptions] = ..., + scenario: Union[str, DataGenerationJobScenario], + sources: list[DataGenerationJobSource] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DataGenerationJobOptions(_Model): + max_samples: int + model_options: Optional[DataGenerationModelOptions] + train_split: Optional[float] + type: str + + @overload + def __init__( + self, + *, + max_samples: int, + model_options: Optional[DataGenerationModelOptions] = ..., + train_split: Optional[float] = ..., + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DataGenerationJobOutput(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DataGenerationJobOutputOptions(_Model): + description: Optional[str] + name: Optional[str] + tags: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DataGenerationJobOutputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DATASET = "dataset" + FILE = "file" + + + class azure.ai.projects.models.DataGenerationJobResult(_Model): + generated_samples: int + outputs: Optional[list[DataGenerationJobOutput]] + token_usage: Optional[DataGenerationTokenUsage] + + @overload + def __init__( + self, + *, + generated_samples: int, + outputs: Optional[list[DataGenerationJobOutput]] = ..., + token_usage: Optional[DataGenerationTokenUsage] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DataGenerationJobScenario(str, Enum, metaclass=CaseInsensitiveEnumMeta): + EVALUATION = "evaluation" + REINFORCEMENT_FINETUNING = "reinforcement_finetuning" + SUPERVISED_FINETUNING = "supervised_finetuning" + + + class azure.ai.projects.models.DataGenerationJobSource(_Model): + description: Optional[str] + type: str + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DataGenerationJobSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AGENT = "agent" + FILE = "file" + PROMPT = "prompt" + TRACES = "traces" + + + class azure.ai.projects.models.DataGenerationJobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SIMPLE_QNA = "simple_qna" + TOOL_USE = "tool_use" + TRACES = "traces" + + + class azure.ai.projects.models.DataGenerationModelOptions(_Model): + model: str + + @overload + def __init__( + self, + *, + model: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DataGenerationTokenUsage(_Model): + completion_tokens: int + prompt_tokens: int + total_tokens: int + + + class azure.ai.projects.models.DatasetCredential(_Model): + blob_reference: BlobReference + + @overload + def __init__( + self, + *, + blob_reference: BlobReference + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DatasetDataGenerationJobOutput(DataGenerationJobOutput, discriminator='dataset'): + description: Optional[str] + id: Optional[str] + name: Optional[str] + tags: Optional[dict[str, str]] + type: Literal[DataGenerationJobOutputType.DATASET] + version: Optional[str] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DatasetEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator='dataset'): + description: Optional[str] + name: str + type: Literal[EvaluatorGenerationJobSourceType.DATASET] + version: Optional[str] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: str, + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DatasetReference(_Model): + name: str + version: str + + @overload + def __init__( + self, + *, + name: str, + version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DatasetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + URI_FILE = "uri_file" + URI_FOLDER = "uri_folder" + + + class azure.ai.projects.models.DatasetVersion(_Model): + connection_name: Optional[str] + data_uri: str + description: Optional[str] + id: Optional[str] + is_reference: Optional[bool] + name: str + tags: Optional[dict[str, str]] + type: str + version: str + + @overload + def __init__( + self, + *, + connection_name: Optional[str] = ..., + data_uri: str, + description: Optional[str] = ..., + tags: Optional[dict[str, str]] = ..., + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FRIDAY = "Friday" + MONDAY = "Monday" + SATURDAY = "Saturday" + SUNDAY = "Sunday" + THURSDAY = "Thursday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + + + class azure.ai.projects.models.DeleteAgentResponse(_Model): + deleted: bool + name: str + object: Literal[AgentObjectType.AGENT_DELETED] + + @overload + def __init__( + self, + *, + deleted: bool, + name: str, + object: Literal[AgentObjectType.AGENT_DELETED] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DeleteAgentVersionResponse(_Model): + deleted: bool + name: str + object: Literal[AgentObjectType.AGENT_VERSION_DELETED] + version: str + + @overload + def __init__( + self, + *, + deleted: bool, + name: str, + object: Literal[AgentObjectType.AGENT_VERSION_DELETED], + version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DeleteMemoryResult(_Model): + deleted: bool + memory_id: str + object: Literal[MemoryStoreObjectType.MEMORY_DELETED] + + @overload + def __init__( + self, + *, + deleted: bool, + memory_id: str, + object: Literal[MemoryStoreObjectType.MEMORY_DELETED] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DeleteMemoryStoreResult(_Model): + deleted: bool + name: str + object: Literal[MemoryStoreObjectType.MEMORY_STORE_DELETED] + + @overload + def __init__( + self, + *, + deleted: bool, + name: str, + object: Literal[MemoryStoreObjectType.MEMORY_STORE_DELETED] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DeleteSkillResult(_Model): + deleted: bool + id: str + name: str + + @overload + def __init__( + self, + *, + deleted: bool, + id: str, + name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DeleteSkillVersionResult(_Model): + deleted: bool + id: str + name: str + version: str + + @overload + def __init__( + self, + *, + deleted: bool, + id: str, + name: str, + version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.Deployment(_Model): + name: str + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MODEL_DEPLOYMENT = "ModelDeployment" + + + class azure.ai.projects.models.Dimension(_Model): + always_applicable: Optional[bool] + description: str + id: str + weight: int + + @overload + def __init__( + self, + *, + always_applicable: Optional[bool] = ..., + description: str, + id: str, + weight: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.DispatchRoutineResult(_Model): + action_correlation_id: Optional[str] + dispatch_id: Optional[str] + task_id: Optional[str] + + @overload + def __init__( + self, + *, + action_correlation_id: Optional[str] = ..., + dispatch_id: Optional[str] = ..., + task_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EmbeddingConfiguration(_Model): + embedding_field: str + model_deployment_name: str + + @overload + def __init__( + self, + *, + embedding_field: str, + model_deployment_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EmptyModelParam(_Model): + + + class azure.ai.projects.models.EntraAuthorizationScheme(AgentEndpointAuthorizationScheme, discriminator='Entra'): + isolation_key_source: Optional[IsolationKeySource] + type: Literal[AgentEndpointAuthorizationSchemeType.ENTRA] + + @overload + def __init__( + self, + *, + isolation_key_source: Optional[IsolationKeySource] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EntraIDCredentials(BaseCredentials, discriminator='AAD'): + type: Literal[CredentialType.ENTRA_ID] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EntraIsolationKeySource(IsolationKeySource, discriminator='Entra'): + kind: Literal[IsolationKeySourceKind.ENTRA] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvalCsvFileIdSource(TypedDict, total=False): + key "id": Required[str] + key "type": Required[Literal["file_id"]] + + + class azure.ai.projects.models.EvalCsvRunDataSource(TypedDict, total=False): + key "source": Required[EvalCsvFileIdSource] + key "type": Required[Literal["csv"]] + + + class azure.ai.projects.models.EvalResult(_Model): + name: str + passed: bool + score: float + type: str + + @overload + def __init__( + self, + *, + name: str, + passed: bool, + score: float, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvalRunResultCompareItem(_Model): + delta_estimate: float + p_value: float + treatment_effect: Union[str, TreatmentEffectType] + treatment_run_id: str + treatment_run_summary: EvalRunResultSummary + + @overload + def __init__( + self, + *, + delta_estimate: float, + p_value: float, + treatment_effect: Union[str, TreatmentEffectType], + treatment_run_id: str, + treatment_run_summary: EvalRunResultSummary + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvalRunResultComparison(_Model): + baseline_run_summary: EvalRunResultSummary + compare_items: list[EvalRunResultCompareItem] + evaluator: str + metric: str + testing_criteria: str + + @overload + def __init__( + self, + *, + baseline_run_summary: EvalRunResultSummary, + compare_items: list[EvalRunResultCompareItem], + evaluator: str, + metric: str, + testing_criteria: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvalRunResultSummary(_Model): + average: float + run_id: str + sample_count: int + standard_deviation: float + + @overload + def __init__( + self, + *, + average: float, + run_id: str, + sample_count: int, + standard_deviation: float + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationComparisonInsightRequest(InsightRequest, discriminator='EvaluationComparison'): + baseline_run_id: str + eval_id: str + treatment_run_ids: list[str] + type: Literal[InsightType.EVALUATION_COMPARISON] + + @overload + def __init__( + self, + *, + baseline_run_id: str, + eval_id: str, + treatment_run_ids: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationComparisonInsightResult(InsightResult, discriminator='EvaluationComparison'): + comparisons: list[EvalRunResultComparison] + method: str + type: Literal[InsightType.EVALUATION_COMPARISON] + + @overload + def __init__( + self, + *, + comparisons: list[EvalRunResultComparison], + method: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CONVERSATION = "conversation" + TURN = "turn" + + + class azure.ai.projects.models.EvaluationResultSample(InsightSample, discriminator='EvaluationResultSample'): + correlation_info: dict[str, any] + evaluation_result: EvalResult + features: dict[str, any] + id: str + type: Literal[SampleType.EVALUATION_RESULT_SAMPLE] + + @overload + def __init__( + self, + *, + correlation_info: dict[str, Any], + evaluation_result: EvalResult, + features: dict[str, Any], + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationRule(_Model): + action: EvaluationRuleAction + description: Optional[str] + display_name: Optional[str] + enabled: bool + event_type: Union[str, EvaluationRuleEventType] + filter: Optional[EvaluationRuleFilter] + id: str + system_data: dict[str, str] + + @overload + def __init__( + self, + *, + action: EvaluationRuleAction, + description: Optional[str] = ..., + display_name: Optional[str] = ..., + enabled: bool, + event_type: Union[str, EvaluationRuleEventType], + filter: Optional[EvaluationRuleFilter] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationRuleAction(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationRuleActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CONTINUOUS_EVALUATION = "continuousEvaluation" + HUMAN_EVALUATION_PREVIEW = "humanEvaluationPreview" + + + class azure.ai.projects.models.EvaluationRuleEventType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MANUAL = "manual" + RESPONSE_COMPLETED = "responseCompleted" + + + class azure.ai.projects.models.EvaluationRuleFilter(_Model): + agent_name: str + + @overload + def __init__( + self, + *, + agent_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationRunClusterInsightRequest(InsightRequest, discriminator='EvaluationRunClusterInsight'): + eval_id: str + model_configuration: Optional[InsightModelConfiguration] + run_ids: list[str] + type: Literal[InsightType.EVALUATION_RUN_CLUSTER_INSIGHT] + + @overload + def __init__( + self, + *, + eval_id: str, + model_configuration: Optional[InsightModelConfiguration] = ..., + run_ids: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationRunClusterInsightResult(InsightResult, discriminator='EvaluationRunClusterInsight'): + cluster_insight: ClusterInsightResult + type: Literal[InsightType.EVALUATION_RUN_CLUSTER_INSIGHT] + + @overload + def __init__( + self, + *, + cluster_insight: ClusterInsightResult + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationScheduleTask(ScheduleTask, discriminator='Evaluation'): + configuration: dict[str, str] + eval_id: str + eval_run: dict[str, Any] + type: Literal[ScheduleTaskType.EVALUATION] + + @overload + def __init__( + self, + *, + configuration: Optional[dict[str, str]] = ..., + eval_id: str, + eval_run: dict[str, Any] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationTarget(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationTaxonomy(_Model): + description: Optional[str] + id: Optional[str] + name: str + properties: Optional[dict[str, str]] + tags: Optional[dict[str, str]] + taxonomy_categories: Optional[list[TaxonomyCategory]] + taxonomy_input: EvaluationTaxonomyInput + version: str + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + properties: Optional[dict[str, str]] = ..., + tags: Optional[dict[str, str]] = ..., + taxonomy_categories: Optional[list[TaxonomyCategory]] = ..., + taxonomy_input: EvaluationTaxonomyInput + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationTaxonomyInput(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluationTaxonomyInputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AGENT = "agent" + POLICY = "policy" + + + class azure.ai.projects.models.EvaluatorCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AGENTS = "agents" + QUALITY = "quality" + SAFETY = "safety" + + + class azure.ai.projects.models.EvaluatorCredentialRequest(_Model): + blob_uri: str + + @overload + def __init__( + self, + *, + blob_uri: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluatorDefinition(_Model): + data_schema: Optional[dict[str, Any]] + init_parameters: Optional[dict[str, Any]] + metrics: Optional[dict[str, EvaluatorMetric]] + type: str + + @overload + def __init__( + self, + *, + data_schema: Optional[dict[str, Any]] = ..., + init_parameters: Optional[dict[str, Any]] = ..., + metrics: Optional[dict[str, EvaluatorMetric]] = ..., + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluatorDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CODE = "code" + OPENAI_GRADERS = "openai_graders" + PROMPT = "prompt" + PROMPT_AND_CODE = "prompt_and_code" + RUBRIC = "rubric" + SERVICE = "service" + + + class azure.ai.projects.models.EvaluatorGenerationArtifacts(_Model): + dataset: DatasetReference + kinds: list[str] + + @overload + def __init__( + self, + *, + dataset: DatasetReference, + kinds: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluatorGenerationInputs(_Model): + evaluator_description: Optional[str] + evaluator_display_name: Optional[str] + evaluator_name: str + model: str + sources: list[EvaluatorGenerationJobSource] + + @overload + def __init__( + self, + *, + evaluator_description: Optional[str] = ..., + evaluator_display_name: Optional[str] = ..., + evaluator_name: str, + model: str, + sources: list[EvaluatorGenerationJobSource] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluatorGenerationJob(_Model): + created_at: datetime + error: Optional[ApiError] + finished_at: Optional[datetime] + id: str + inputs: Optional[EvaluatorGenerationInputs] + result: Optional[EvaluatorVersion] + status: Union[str, JobStatus] + usage: Optional[EvaluatorGenerationTokenUsage] + + @overload + def __init__( + self, + *, + inputs: Optional[EvaluatorGenerationInputs] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluatorGenerationJobSource(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluatorGenerationJobSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AGENT = "agent" + DATASET = "dataset" + PROMPT = "prompt" + TRACES = "traces" + + + class azure.ai.projects.models.EvaluatorGenerationTokenUsage(_Model): + input_tokens: int + output_tokens: int + total_tokens: int + + @overload + def __init__( + self, + *, + input_tokens: int, + output_tokens: int, + total_tokens: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluatorMetric(_Model): + desirable_direction: Optional[Union[str, EvaluatorMetricDirection]] + is_primary: Optional[bool] + max_value: Optional[float] + min_value: Optional[float] + threshold: Optional[float] + type: Optional[Union[str, EvaluatorMetricType]] + + @overload + def __init__( + self, + *, + desirable_direction: Optional[Union[str, EvaluatorMetricDirection]] = ..., + is_primary: Optional[bool] = ..., + max_value: Optional[float] = ..., + min_value: Optional[float] = ..., + threshold: Optional[float] = ..., + type: Optional[Union[str, EvaluatorMetricType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.EvaluatorMetricDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DECREASE = "decrease" + INCREASE = "increase" + NEUTRAL = "neutral" + + + class azure.ai.projects.models.EvaluatorMetricType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + BOOLEAN = "boolean" + CONTINUOUS = "continuous" + ORDINAL = "ordinal" + + + class azure.ai.projects.models.EvaluatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + BUILT_IN = "builtin" + CUSTOM = "custom" + + + class azure.ai.projects.models.EvaluatorVersion(_Model): + categories: list[Union[str, EvaluatorCategory]] + created_at: datetime + created_by: str + definition: EvaluatorDefinition + description: Optional[str] + display_name: Optional[str] + evaluator_type: Union[str, EvaluatorType] + generation_artifacts: Optional[EvaluatorGenerationArtifacts] + id: Optional[str] + metadata: Optional[dict[str, str]] + modified_at: datetime + name: str + supported_evaluation_levels: Optional[list[Union[str, EvaluationLevel]]] + tags: Optional[dict[str, str]] + version: str + + @overload + def __init__( + self, + *, + categories: list[Union[str, EvaluatorCategory]], + definition: EvaluatorDefinition, + description: Optional[str] = ..., + display_name: Optional[str] = ..., + evaluator_type: Union[str, EvaluatorType], + metadata: Optional[dict[str, str]] = ..., + supported_evaluation_levels: Optional[list[Union[str, EvaluationLevel]]] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ExternalAgentDefinition(AgentDefinition, discriminator='external'): + kind: Literal[AgentKind.EXTERNAL] + otel_agent_id: Optional[str] + rai_config: RaiConfig + + @overload + def __init__( + self, + *, + otel_agent_id: Optional[str] = ..., + rai_config: Optional[RaiConfig] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FabricDataAgentToolParameters(_Model): + project_connections: Optional[list[ToolProjectConnection]] + + @overload + def __init__( + self, + *, + project_connections: Optional[list[ToolProjectConnection]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FabricIQPreviewTool(Tool, discriminator='fabric_iq_preview'): + description: Optional[str] + name: Optional[str] + project_connection_id: str + require_approval: Optional[Union[MCPToolRequireApproval, str]] + server_label: Optional[str] + server_url: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.FABRIC_IQ_PREVIEW] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + project_connection_id: str, + require_approval: Optional[Union[MCPToolRequireApproval, str]] = ..., + server_label: Optional[str] = ..., + server_url: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FieldMapping(_Model): + content_fields: list[str] + filepath_field: Optional[str] + metadata_fields: Optional[list[str]] + title_field: Optional[str] + url_field: Optional[str] + vector_fields: Optional[list[str]] + + @overload + def __init__( + self, + *, + content_fields: list[str], + filepath_field: Optional[str] = ..., + metadata_fields: Optional[list[str]] = ..., + title_field: Optional[str] = ..., + url_field: Optional[str] = ..., + vector_fields: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FileDataGenerationJobOutput(DataGenerationJobOutput, discriminator='file'): + filename: str + id: str + type: Literal[DataGenerationJobOutputType.FILE] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FileDataGenerationJobSource(DataGenerationJobSource, discriminator='file'): + description: str + id: str + type: Literal[DataGenerationJobSourceType.FILE] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FileDatasetVersion(DatasetVersion, discriminator='uri_file'): + connection_name: str + data_uri: str + description: str + id: str + is_reference: bool + name: str + tags: dict[str, str] + type: Literal[DatasetType.URI_FILE] + version: str + + @overload + def __init__( + self, + *, + connection_name: Optional[str] = ..., + data_uri: str, + description: Optional[str] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FileSearchTool(Tool, discriminator='file_search'): + description: Optional[str] + filters: Optional[Filters] + max_num_results: Optional[int] + name: Optional[str] + ranking_options: Optional[RankingOptions] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.FILE_SEARCH] + vector_store_ids: list[str] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + filters: Optional[Filters] = ..., + max_num_results: Optional[int] = ..., + name: Optional[str] = ..., + ranking_options: Optional[RankingOptions] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ..., + vector_store_ids: list[str] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FixedRatioVersionSelectionRule(VersionSelectionRule, discriminator='FixedRatio'): + agent_version: str + traffic_percentage: int + type: Literal[VersionSelectorType.FIXED_RATIO] + + @overload + def __init__( + self, + *, + agent_version: str, + traffic_percentage: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FolderDatasetVersion(DatasetVersion, discriminator='uri_folder'): + connection_name: str + data_uri: str + description: str + id: str + is_reference: bool + name: str + tags: dict[str, str] + type: Literal[DatasetType.URI_FOLDER] + version: str + + @overload + def __init__( + self, + *, + connection_name: Optional[str] = ..., + data_uri: str, + description: Optional[str] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FoundryModelArtifactProfileCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DATA_ONLY = "DataOnly" + RUNTIME_DEPENDENT = "RuntimeDependent" + UNKNOWN = "Unknown" + + + class azure.ai.projects.models.FoundryModelArtifactProfileSignal(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CUSTOM_PYTHON_CODE = "CustomPythonCode" + DYNAMIC_OPS = "DynamicOps" + NATIVE_BINARY = "NativeBinary" + PICKLE_DESERIALIZATION = "PickleDeserialization" + UNKNOWN_FORMAT = "UnknownFormat" + + + class azure.ai.projects.models.FoundryModelSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + LOCAL_UPLOAD = "LocalUpload" + TRAINING_JOB = "TrainingJob" + + + class azure.ai.projects.models.FoundryModelWarning(_Model): + code: Optional[Union[str, FoundryModelWarningCode]] + message: Optional[str] + + @overload + def __init__( + self, + *, + code: Optional[Union[str, FoundryModelWarningCode]] = ..., + message: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FoundryModelWarningCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + RUNTIME_DEPENDENT_ARTIFACT = "RuntimeDependentArtifact" + UNCLASSIFIED_ARTIFACT = "UnclassifiedArtifact" + + + class azure.ai.projects.models.FoundryModelWeightType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DRAFT_MODEL = "DraftModel" + FULL_WEIGHT = "FullWeight" + LO_RA = "LoRA" + + + class azure.ai.projects.models.FunctionShellToolParam(Tool, discriminator='shell'): + description: Optional[str] + environment: Optional[FunctionShellToolParamEnvironment] + name: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.SHELL] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + environment: Optional[FunctionShellToolParamEnvironment] = ..., + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FunctionShellToolParamEnvironment(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FunctionShellToolParamEnvironmentContainerReferenceParam(FunctionShellToolParamEnvironment, discriminator='container_reference'): + container_id: str + type: Literal[FunctionShellToolParamEnvironmentType.CONTAINER_REFERENCE] + + @overload + def __init__( + self, + *, + container_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FunctionShellToolParamEnvironmentLocalEnvironmentParam(FunctionShellToolParamEnvironment, discriminator='local'): + skills: Optional[list[LocalSkillParam]] + type: Literal[FunctionShellToolParamEnvironmentType.LOCAL] + + @overload + def __init__( + self, + *, + skills: Optional[list[LocalSkillParam]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FunctionShellToolParamEnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CONTAINER_AUTO = "container_auto" + CONTAINER_REFERENCE = "container_reference" + LOCAL = "local" + + + class azure.ai.projects.models.FunctionTool(Tool, discriminator='function'): + defer_loading: Optional[bool] + description: Optional[str] + name: str + parameters: dict[str, Any] + strict: bool + type: Literal[ToolType.FUNCTION] + + @overload + def __init__( + self, + *, + defer_loading: Optional[bool] = ..., + description: Optional[str] = ..., + name: str, + parameters: dict[str, Any], + strict: bool + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.FunctionToolParam(_Model): + defer_loading: Optional[bool] + description: Optional[str] + name: str + parameters: Optional[EmptyModelParam] + strict: Optional[bool] + type: Literal["function"] + + @overload + def __init__( + self, + *, + defer_loading: Optional[bool] = ..., + description: Optional[str] = ..., + name: str, + parameters: Optional[EmptyModelParam] = ..., + strict: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.GitHubIssueEvent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CLOSED = "closed" + OPENED = "opened" + + + class azure.ai.projects.models.GitHubIssueRoutineTrigger(RoutineTrigger, discriminator='github_issue'): + connection_id: str + issue_event: Union[str, GitHubIssueEvent] + owner: str + repository: str + type: Literal[RoutineTriggerType.GITHUB_ISSUE] + + @overload + def __init__( + self, + *, + connection_id: str, + issue_event: Union[str, GitHubIssueEvent], + owner: str, + repository: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.GrammarSyntax1(str, Enum, metaclass=CaseInsensitiveEnumMeta): + LARK = "lark" + REGEX = "regex" + + + class azure.ai.projects.models.HeaderIsolationKeySource(IsolationKeySource, discriminator='Header'): + kind: Literal[IsolationKeySourceKind.HEADER] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.HeaderTelemetryEndpointAuth(TelemetryEndpointAuth, discriminator='header'): + header_name: str + secret_id: str + secret_key: str + type: Literal[TelemetryEndpointAuthType.HEADER] + + @overload + def __init__( + self, + *, + header_name: str, + secret_id: str, + secret_key: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.HostedAgentDefinition(AgentDefinition, discriminator='hosted'): + code_configuration: Optional[CodeConfiguration] + container_configuration: Optional[ContainerConfiguration] + cpu: str + environment_variables: Optional[dict[str, str]] + kind: Literal[AgentKind.HOSTED] + memory: str + protocol_versions: Optional[list[ProtocolVersionRecord]] + rai_config: RaiConfig + telemetry_config: Optional[TelemetryConfig] + tools: Optional[list[Tool]] + + @overload + def __init__( + self, + *, + code_configuration: Optional[CodeConfiguration] = ..., + container_configuration: Optional[ContainerConfiguration] = ..., + cpu: str, + environment_variables: Optional[dict[str, str]] = ..., + memory: str, + protocol_versions: Optional[list[ProtocolVersionRecord]] = ..., + rai_config: Optional[RaiConfig] = ..., + telemetry_config: Optional[TelemetryConfig] = ..., + tools: Optional[list[Tool]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.HourlyRecurrenceSchedule(RecurrenceSchedule, discriminator='Hourly'): + type: Literal[RecurrenceType.HOURLY] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.HumanEvaluationPreviewRuleAction(EvaluationRuleAction, discriminator='humanEvaluationPreview'): + template_id: str + type: Literal[EvaluationRuleActionType.HUMAN_EVALUATION_PREVIEW] + + @overload + def __init__( + self, + *, + template_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.HybridSearchOptions(_Model): + embedding_weight: float + text_weight: float + + @overload + def __init__( + self, + *, + embedding_weight: float, + text_weight: float + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ImageGenAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AUTO = "auto" + EDIT = "edit" + GENERATE = "generate" + + + class azure.ai.projects.models.ImageGenTool(Tool, discriminator='image_generation'): + action: Optional[Union[str, ImageGenAction]] + background: Optional[Literal["transparent", "opaque", "auto"]] + description: Optional[str] + input_fidelity: Optional[Union[str, InputFidelity]] + input_image_mask: Optional[ImageGenToolInputImageMask] + model: Optional[Union[Literal["gpt-image-1"], Literal["gpt-image-1-mini"], Literal["gpt-image-5"], str]] + moderation: Optional[Literal["auto", "low"]] + name: Optional[str] + output_compression: Optional[int] + output_format: Optional[Literal["png", "webp", "jpeg"]] + partial_images: Optional[int] + quality: Optional[Literal["low", "medium", "high", "auto"]] + size: Optional[Union[Literal["1024x1024"], Literal["1024x1536"], Literal["1536x1024"], Literal["auto"], str]] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.IMAGE_GENERATION] + + @overload + def __init__( + self, + *, + action: Optional[Union[str, ImageGenAction]] = ..., + background: Optional[Literal[transparent, opaque, auto]] = ..., + description: Optional[str] = ..., + input_fidelity: Optional[Union[str, InputFidelity]] = ..., + input_image_mask: Optional[ImageGenToolInputImageMask] = ..., + model: Optional[Union[Literal[gpt-image-1], Literal[gpt-image-1-mini], Literal[gpt-image-5], str]] = ..., + moderation: Optional[Literal[auto, low]] = ..., + name: Optional[str] = ..., + output_compression: Optional[int] = ..., + output_format: Optional[Literal[png, webp, jpeg]] = ..., + partial_images: Optional[int] = ..., + quality: Optional[Literal[low, medium, high, auto]] = ..., + size: Optional[Union[Literal[1024x1024], Literal[1024x1536], Literal[1536x1024], Literal[auto], str]] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ImageGenToolInputImageMask(_Model): + file_id: Optional[str] + image_url: Optional[str] + + @overload + def __init__( + self, + *, + file_id: Optional[str] = ..., + image_url: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.Index(_Model): + description: Optional[str] + id: Optional[str] + name: str + tags: Optional[dict[str, str]] + type: str + version: str + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + tags: Optional[dict[str, str]] = ..., + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.IndexType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AZURE_SEARCH = "AzureSearch" + COSMOS_DB = "CosmosDBNoSqlVectorStore" + MANAGED_AZURE_SEARCH = "ManagedAzureSearch" + + + class azure.ai.projects.models.InlineSkillParam(ContainerSkill, discriminator='inline'): + description: str + name: str + source: InlineSkillSourceParam + type: Literal[ContainerSkillType.INLINE] + + @overload + def __init__( + self, + *, + description: str, + name: str, + source: InlineSkillSourceParam + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InlineSkillSourceParam(_Model): + data: str + media_type: Literal["application/zip"] + type: Literal["base64"] + + @overload + def __init__( + self, + *, + data: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InputFidelity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + HIGH = "high" + LOW = "low" + + + class azure.ai.projects.models.Insight(_Model): + display_name: str + insight_id: str + metadata: InsightsMetadata + request: InsightRequest + result: Optional[InsightResult] + state: Union[str, OperationState] + + @overload + def __init__( + self, + *, + display_name: str, + request: InsightRequest + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InsightCluster(_Model): + description: str + id: str + label: str + samples: Optional[list[InsightSample]] + sub_clusters: Optional[list[InsightCluster]] + suggestion: str + suggestion_title: str + weight: int + + @overload + def __init__( + self, + *, + description: str, + id: str, + label: str, + samples: Optional[list[InsightSample]] = ..., + sub_clusters: Optional[list[InsightCluster]] = ..., + suggestion: str, + suggestion_title: str, + weight: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InsightModelConfiguration(_Model): + model_deployment_name: str + + @overload + def __init__( + self, + *, + model_deployment_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InsightRequest(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InsightResult(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InsightSample(_Model): + correlation_info: dict[str, Any] + features: dict[str, Any] + id: str + type: str + + @overload + def __init__( + self, + *, + correlation_info: dict[str, Any], + features: dict[str, Any], + id: str, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InsightScheduleTask(ScheduleTask, discriminator='Insight'): + configuration: dict[str, str] + insight: Insight + type: Literal[ScheduleTaskType.INSIGHT] + + @overload + def __init__( + self, + *, + configuration: Optional[dict[str, str]] = ..., + insight: Insight + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InsightSummary(_Model): + method: str + sample_count: int + unique_cluster_count: int + unique_subcluster_count: int + usage: ClusterTokenUsage + + @overload + def __init__( + self, + *, + method: str, + sample_count: int, + unique_cluster_count: int, + unique_subcluster_count: int, + usage: ClusterTokenUsage + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InsightType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AGENT_CLUSTER_INSIGHT = "AgentClusterInsight" + EVALUATION_COMPARISON = "EvaluationComparison" + EVALUATION_RUN_CLUSTER_INSIGHT = "EvaluationRunClusterInsight" + + + class azure.ai.projects.models.InsightsMetadata(_Model): + completed_at: Optional[datetime] + created_at: datetime + + @overload + def __init__( + self, + *, + completed_at: Optional[datetime] = ..., + created_at: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InvokeAgentInvocationsApiDispatchPayload(RoutineDispatchPayload, discriminator='invoke_agent_invocations_api'): + input: Any + type: Literal[RoutineDispatchPayloadType.INVOKE_AGENT_INVOCATIONS_API] + + @overload + def __init__( + self, + *, + input: Any + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InvokeAgentInvocationsApiRoutineAction(RoutineAction, discriminator='invoke_agent_invocations_api'): + agent_endpoint_id: Optional[str] + agent_name: Optional[str] + input: Optional[Any] + session_id: Optional[str] + type: Literal[RoutineActionType.INVOKE_AGENT_INVOCATIONS_API] + + @overload + def __init__( + self, + *, + agent_endpoint_id: Optional[str] = ..., + agent_name: Optional[str] = ..., + input: Optional[Any] = ..., + session_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InvokeAgentResponsesApiDispatchPayload(RoutineDispatchPayload, discriminator='invoke_agent_responses_api'): + input: Any + type: Literal[RoutineDispatchPayloadType.INVOKE_AGENT_RESPONSES_API] + + @overload + def __init__( + self, + *, + input: Any + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.InvokeAgentResponsesApiRoutineAction(RoutineAction, discriminator='invoke_agent_responses_api'): + agent_endpoint_id: Optional[str] + agent_name: Optional[str] + conversation: Optional[str] + input: Optional[Any] + type: Literal[RoutineActionType.INVOKE_AGENT_RESPONSES_API] + + @overload + def __init__( + self, + *, + agent_endpoint_id: Optional[str] = ..., + agent_name: Optional[str] = ..., + conversation: Optional[str] = ..., + input: Optional[Any] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.IsolationKeySource(_Model): + kind: str + + @overload + def __init__( + self, + *, + kind: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.IsolationKeySourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ENTRA = "Entra" + HEADER = "Header" + + + class azure.ai.projects.models.JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CANCELLED = "cancelled" + FAILED = "failed" + IN_PROGRESS = "in_progress" + QUEUED = "queued" + SUCCEEDED = "succeeded" + + + class azure.ai.projects.models.LocalShellToolParam(Tool, discriminator='local_shell'): + description: Optional[str] + name: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.LOCAL_SHELL] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.LocalSkillParam(_Model): + description: str + name: str + path: str + + @overload + def __init__( + self, + *, + description: str, + name: str, + path: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.LoraConfig(_Model): + alpha: Optional[int] + dropout: Optional[float] + rank: Optional[int] + target_modules: Optional[list[str]] + + @overload + def __init__( + self, + *, + alpha: Optional[int] = ..., + dropout: Optional[float] = ..., + rank: Optional[int] = ..., + target_modules: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MCPTool(Tool, discriminator='mcp'): + allowed_tools: Optional[Union[list[str], MCPToolFilter]] + authorization: Optional[str] + connector_id: Optional[Literal["connector_dropbox", "connector_gmail", "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams", "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint"]] + defer_loading: Optional[bool] + headers: Optional[dict[str, str]] + project_connection_id: Optional[str] + require_approval: Optional[Union[MCPToolRequireApproval, Literal["always"], Literal["never"]]] + server_description: Optional[str] + server_label: str + server_url: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.MCP] + + @overload + def __init__( + self, + *, + allowed_tools: Optional[Union[list[str], MCPToolFilter]] = ..., + authorization: Optional[str] = ..., + connector_id: Optional[Literal[connector_dropbox, connector_gmail, connector_googlecalendar, connector_googledrive, connector_microsoftteams, connector_outlookcalendar, connector_outlookemail, connector_sharepoint]] = ..., + defer_loading: Optional[bool] = ..., + headers: Optional[dict[str, str]] = ..., + project_connection_id: Optional[str] = ..., + require_approval: Optional[Union[MCPToolRequireApproval, Literal[always], Literal[never]]] = ..., + server_description: Optional[str] = ..., + server_label: str, + server_url: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MCPToolFilter(_Model): + read_only: Optional[bool] + tool_names: Optional[list[str]] + + @overload + def __init__( + self, + *, + read_only: Optional[bool] = ..., + tool_names: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MCPToolRequireApproval(_Model): + always: Optional[MCPToolFilter] + never: Optional[MCPToolFilter] + + @overload + def __init__( + self, + *, + always: Optional[MCPToolFilter] = ..., + never: Optional[MCPToolFilter] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ManagedAgentIdentityBlueprintReference(AgentBlueprintReference, discriminator='ManagedAgentIdentityBlueprint'): + blueprint_id: str + type: Literal[AgentBlueprintReferenceType.MANAGED_AGENT_IDENTITY_BLUEPRINT] + + @overload + def __init__( + self, + *, + blueprint_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ManagedAzureAISearchIndex(Index, discriminator='ManagedAzureSearch'): + description: str + id: str + name: str + tags: dict[str, str] + type: Literal[IndexType.MANAGED_AZURE_SEARCH] + vector_store_id: str + version: str + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + tags: Optional[dict[str, str]] = ..., + vector_store_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryItem(_Model): + content: str + kind: str + memory_id: str + scope: str + updated_at: datetime + + @overload + def __init__( + self, + *, + content: str, + kind: str, + memory_id: str, + scope: str, + updated_at: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryItemKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CHAT_SUMMARY = "chat_summary" + PROCEDURAL = "procedural" + USER_PROFILE = "user_profile" + + + class azure.ai.projects.models.MemoryOperation(_Model): + kind: Union[str, MemoryOperationKind] + memory_item: MemoryItem + + @overload + def __init__( + self, + *, + kind: Union[str, MemoryOperationKind], + memory_item: MemoryItem + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryOperationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CREATE = "create" + DELETE = "delete" + UPDATE = "update" + + + class azure.ai.projects.models.MemorySearchItem(_Model): + memory_item: MemoryItem + + @overload + def __init__( + self, + *, + memory_item: MemoryItem + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemorySearchOptions(_Model): + max_memories: Optional[int] + + @overload + def __init__( + self, + *, + max_memories: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemorySearchPreviewTool(Tool, discriminator='memory_search_preview'): + description: Optional[str] + memory_store_name: str + name: Optional[str] + scope: str + search_options: Optional[MemorySearchOptions] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.MEMORY_SEARCH_PREVIEW] + update_delay: Optional[int] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + memory_store_name: str, + name: Optional[str] = ..., + scope: str, + search_options: Optional[MemorySearchOptions] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ..., + update_delay: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreDefaultDefinition(MemoryStoreDefinition, discriminator='default'): + chat_model: str + embedding_model: str + kind: Literal[MemoryStoreKind.DEFAULT] + options: Optional[MemoryStoreDefaultOptions] + + @overload + def __init__( + self, + *, + chat_model: str, + embedding_model: str, + options: Optional[MemoryStoreDefaultOptions] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreDefaultOptions(_Model): + chat_summary_enabled: bool + default_ttl_seconds: Optional[int] + procedural_memory_enabled: Optional[bool] + user_profile_details: Optional[str] + user_profile_enabled: bool + + @overload + def __init__( + self, + *, + chat_summary_enabled: bool, + default_ttl_seconds: Optional[int] = ..., + procedural_memory_enabled: Optional[bool] = ..., + user_profile_details: Optional[str] = ..., + user_profile_enabled: bool + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreDefinition(_Model): + kind: str + + @overload + def __init__( + self, + *, + kind: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreDeleteScopeResult(_Model): + deleted: bool + name: str + object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED] + scope: str + + @overload + def __init__( + self, + *, + deleted: bool, + name: str, + object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED], + scope: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreDetails(_Model): + created_at: datetime + definition: MemoryStoreDefinition + description: Optional[str] + id: str + metadata: Optional[dict[str, str]] + name: str + object: Literal[MemoryStoreObjectType.MEMORY_STORE] + updated_at: datetime + + @overload + def __init__( + self, + *, + created_at: datetime, + definition: MemoryStoreDefinition, + description: Optional[str] = ..., + id: str, + metadata: Optional[dict[str, str]] = ..., + name: str, + object: Literal[MemoryStoreObjectType.MEMORY_STORE], + updated_at: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DEFAULT = "default" + + + class azure.ai.projects.models.MemoryStoreObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MEMORY_DELETED = "memory_store.item.deleted" + MEMORY_STORE = "memory_store" + MEMORY_STORE_DELETED = "memory_store.deleted" + MEMORY_STORE_SCOPE_DELETED = "memory_store.scope.deleted" + + + class azure.ai.projects.models.MemoryStoreOperationUsage(_Model): + embedding_tokens: int + input_tokens: int + input_tokens_details: ResponseUsageInputTokensDetails + output_tokens: int + output_tokens_details: ResponseUsageOutputTokensDetails + total_tokens: int + + @overload + def __init__( + self, + *, + embedding_tokens: int, + input_tokens: int, + input_tokens_details: ResponseUsageInputTokensDetails, + output_tokens: int, + output_tokens_details: ResponseUsageOutputTokensDetails, + total_tokens: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreSearchResult(_Model): + memories: list[MemorySearchItem] + search_id: str + usage: MemoryStoreOperationUsage + + @overload + def __init__( + self, + *, + memories: list[MemorySearchItem], + search_id: str, + usage: MemoryStoreOperationUsage + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreUpdateCompletedResult(_Model): + memory_operations: list[MemoryOperation] + usage: MemoryStoreOperationUsage + + @overload + def __init__( + self, + *, + memory_operations: list[MemoryOperation], + usage: MemoryStoreOperationUsage + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreUpdateResult(_Model): + error: Optional[ApiError] + result: Optional[MemoryStoreUpdateCompletedResult] + status: Union[str, MemoryStoreUpdateStatus] + superseded_by: Optional[str] + update_id: str + + @overload + def __init__( + self, + *, + error: Optional[ApiError] = ..., + result: Optional[MemoryStoreUpdateCompletedResult] = ..., + status: Union[str, MemoryStoreUpdateStatus], + superseded_by: Optional[str] = ..., + update_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MemoryStoreUpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + COMPLETED = "completed" + FAILED = "failed" + IN_PROGRESS = "in_progress" + QUEUED = "queued" + SUPERSEDED = "superseded" + + + class azure.ai.projects.models.MicrosoftFabricPreviewTool(Tool, discriminator='fabric_dataagent_preview'): + description: Optional[str] + fabric_dataagent_preview: FabricDataAgentToolParameters + name: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.FABRIC_DATAAGENT_PREVIEW] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + fabric_dataagent_preview: FabricDataAgentToolParameters, + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ModelCredentialRequest(_Model): + blob_uri: str + + @overload + def __init__( + self, + *, + blob_uri: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ModelDeployment(Deployment, discriminator='ModelDeployment'): + capabilities: dict[str, str] + connection_name: Optional[str] + model_name: str + model_publisher: str + model_version: str + name: str + sku: ModelDeploymentSku + type: Literal[DeploymentType.MODEL_DEPLOYMENT] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ModelDeploymentSku(_Model): + capacity: int + family: str + name: str + size: str + tier: str + + @overload + def __init__( + self, + *, + capacity: int, + family: str, + name: str, + size: str, + tier: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ModelPendingUploadRequest(_Model): + connection_name: Optional[str] + pending_upload_id: Optional[str] + pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE] + + @overload + def __init__( + self, + *, + connection_name: Optional[str] = ..., + pending_upload_id: Optional[str] = ..., + pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ModelPendingUploadResponse(_Model): + blob_reference: BlobReference + pending_upload_id: str + pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE] + version: Optional[str] + + @overload + def __init__( + self, + *, + blob_reference: BlobReference, + pending_upload_id: str, + pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE], + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ModelSamplingConfigParam(TypedDict, total=False): + key "max_completion_tokens": int + key "seed": int + key "temperature": float + key "top_p": float + + + class azure.ai.projects.models.ModelSamplingParams(_Model): + max_completion_tokens: Optional[int] + seed: Optional[int] + temperature: Optional[float] + top_p: Optional[float] + + @overload + def __init__( + self, + *, + max_completion_tokens: Optional[int] = ..., + seed: Optional[int] = ..., + temperature: Optional[float] = ..., + top_p: Optional[float] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ModelSourceData(_Model): + job_id: Optional[str] + source_type: Optional[Union[str, FoundryModelSourceType]] + + @overload + def __init__( + self, + *, + job_id: Optional[str] = ..., + source_type: Optional[Union[str, FoundryModelSourceType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ModelVersion(_Model): + artifact_profile: Optional[ArtifactProfile] + base_model: Optional[str] + blob_uri: str + description: Optional[str] + id: Optional[str] + lora_config: Optional[LoraConfig] + name: str + source: Optional[ModelSourceData] + system_data: Optional[SystemDataV3] + tags: Optional[dict[str, str]] + version: str + warnings: Optional[list[FoundryModelWarning]] + weight_type: Optional[Union[str, FoundryModelWeightType]] + + @overload + def __init__( + self, + *, + base_model: Optional[str] = ..., + blob_uri: str, + description: Optional[str] = ..., + lora_config: Optional[LoraConfig] = ..., + source: Optional[ModelSourceData] = ..., + tags: Optional[dict[str, str]] = ..., + weight_type: Optional[Union[str, FoundryModelWeightType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.MonthlyRecurrenceSchedule(RecurrenceSchedule, discriminator='Monthly'): + days_of_month: list[int] + type: Literal[RecurrenceType.MONTHLY] + + @overload + def __init__( + self, + *, + days_of_month: list[int] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.NamespaceToolParam(Tool, discriminator='namespace'): + description: str + name: str + tools: list[Union[FunctionToolParam, CustomToolParam]] + type: Literal[ToolType.NAMESPACE] + + @overload + def __init__( + self, + *, + description: str, + name: str, + tools: list[Union[FunctionToolParam, CustomToolParam]] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.NoAuthenticationCredentials(BaseCredentials, discriminator='None'): + type: Literal[CredentialType.NONE] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OneTimeTrigger(Trigger, discriminator='OneTime'): + time_zone: Optional[str] + trigger_at: datetime + type: Literal[TriggerType.ONE_TIME] + + @overload + def __init__( + self, + *, + time_zone: Optional[str] = ..., + trigger_at: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OpenApiAnonymousAuthDetails(OpenApiAuthDetails, discriminator='anonymous'): + type: Literal[OpenApiAuthType.ANONYMOUS] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OpenApiAuthDetails(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OpenApiAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ANONYMOUS = "anonymous" + MANAGED_IDENTITY = "managed_identity" + PROJECT_CONNECTION = "project_connection" + + + class azure.ai.projects.models.OpenApiFunctionDefinition(_Model): + auth: OpenApiAuthDetails + default_params: Optional[list[str]] + description: Optional[str] + functions: Optional[list[OpenApiFunctionDefinitionFunction]] + name: str + spec: dict[str, Any] + + @overload + def __init__( + self, + *, + auth: OpenApiAuthDetails, + default_params: Optional[list[str]] = ..., + description: Optional[str] = ..., + name: str, + spec: dict[str, Any] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OpenApiFunctionDefinitionFunction(_Model): + description: Optional[str] + name: str + parameters: dict[str, Any] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: str, + parameters: dict[str, Any] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OpenApiManagedAuthDetails(OpenApiAuthDetails, discriminator='managed_identity'): + security_scheme: OpenApiManagedSecurityScheme + type: Literal[OpenApiAuthType.MANAGED_IDENTITY] + + @overload + def __init__( + self, + *, + security_scheme: OpenApiManagedSecurityScheme + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OpenApiManagedSecurityScheme(_Model): + audience: str + + @overload + def __init__( + self, + *, + audience: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OpenApiProjectConnectionAuthDetails(OpenApiAuthDetails, discriminator='project_connection'): + security_scheme: OpenApiProjectConnectionSecurityScheme + type: Literal[OpenApiAuthType.PROJECT_CONNECTION] + + @overload + def __init__( + self, + *, + security_scheme: OpenApiProjectConnectionSecurityScheme + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OpenApiProjectConnectionSecurityScheme(_Model): + project_connection_id: str + + @overload + def __init__( + self, + *, + project_connection_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OpenApiTool(Tool, discriminator='openapi'): + openapi: OpenApiFunctionDefinition + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.OPENAPI] + + @overload + def __init__( + self, + *, + openapi: OpenApiFunctionDefinition, + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CANCELED = "Canceled" + FAILED = "Failed" + NOT_STARTED = "NotStarted" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + + + class azure.ai.projects.models.OptimizationAgentIdentifier(_Model): + agent_name: str + agent_version: Optional[str] + + @overload + def __init__( + self, + *, + agent_name: str, + agent_version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationCandidate(_Model): + avg_score: float + avg_tokens: float + candidate_id: Optional[str] + eval_id: Optional[str] + eval_run_id: Optional[str] + mutations: Optional[dict[str, Any]] + name: str + promotion: Optional[PromotionInfo] + + @overload + def __init__( + self, + *, + avg_score: float, + avg_tokens: float, + candidate_id: Optional[str] = ..., + eval_id: Optional[str] = ..., + eval_run_id: Optional[str] = ..., + mutations: Optional[dict[str, Any]] = ..., + name: str, + promotion: Optional[PromotionInfo] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationDatasetCriterion(_Model): + instruction: str + name: str + + @overload + def __init__( + self, + *, + instruction: str, + name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationDatasetInput(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationDatasetInputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INLINE = "inline" + REFERENCE = "reference" + + + class azure.ai.projects.models.OptimizationDatasetItem(_Model): + criteria: Optional[list[OptimizationDatasetCriterion]] + desired_num_turns: Optional[int] + ground_truth: Optional[str] + query: Optional[str] + + @overload + def __init__( + self, + *, + criteria: Optional[list[OptimizationDatasetCriterion]] = ..., + desired_num_turns: Optional[int] = ..., + ground_truth: Optional[str] = ..., + query: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationEvaluatorRef(_Model): + name: str + version: Optional[str] + + @overload + def __init__( + self, + *, + name: str, + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationInlineDatasetInput(OptimizationDatasetInput, discriminator='inline'): + dataset_items: list[OptimizationDatasetItem] + type: Literal[OptimizationDatasetInputType.INLINE] + + @overload + def __init__( + self, + *, + dataset_items: list[OptimizationDatasetItem] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationJob(_Model): + created_at: datetime + error: Optional[ApiError] + id: str + inputs: Optional[OptimizationJobInputs] + progress: Optional[OptimizationJobProgress] + result: Optional[OptimizationJobResult] + status: Union[str, JobStatus] + updated_at: datetime + warnings: Optional[list[str]] + + @overload + def __init__( + self, + *, + inputs: Optional[OptimizationJobInputs] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationJobInputs(_Model): + agent: OptimizationAgentIdentifier + evaluators: list[OptimizationEvaluatorRef] + options: Optional[OptimizationOptions] + train_dataset: OptimizationDatasetInput + validation_dataset: Optional[OptimizationDatasetInput] + + @overload + def __init__( + self, + *, + agent: OptimizationAgentIdentifier, + evaluators: list[OptimizationEvaluatorRef], + options: Optional[OptimizationOptions] = ..., + train_dataset: OptimizationDatasetInput, + validation_dataset: Optional[OptimizationDatasetInput] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationJobListItem(_Model): + agent: Optional[OptimizationAgentIdentifier] + created_at: datetime + error: Optional[ApiError] + id: str + progress: Optional[OptimizationJobProgress] + status: Union[str, JobStatus] + updated_at: datetime + + + class azure.ai.projects.models.OptimizationJobProgress(_Model): + best_score: float + candidates_completed: int + elapsed_seconds: float + + @overload + def __init__( + self, + *, + best_score: float, + candidates_completed: int, + elapsed_seconds: float + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationJobResult(_Model): + baseline: Optional[str] + best: Optional[str] + candidates: Optional[list[OptimizationCandidate]] + + @overload + def __init__( + self, + *, + baseline: Optional[str] = ..., + best: Optional[str] = ..., + candidates: Optional[list[OptimizationCandidate]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationOptions(_Model): + eval_model: Optional[str] + evaluation_level: Optional[Union[str, EvaluationLevel]] + max_candidates: Optional[int] + optimization_config: Optional[dict[str, Any]] + optimization_model: Optional[str] + + @overload + def __init__( + self, + *, + eval_model: Optional[str] = ..., + evaluation_level: Optional[Union[str, EvaluationLevel]] = ..., + max_candidates: Optional[int] = ..., + optimization_config: Optional[dict[str, Any]] = ..., + optimization_model: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OptimizationReferenceDatasetInput(OptimizationDatasetInput, discriminator='reference'): + name: str + type: Literal[OptimizationDatasetInputType.REFERENCE] + version: Optional[str] + + @overload + def __init__( + self, + *, + name: str, + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.OtlpTelemetryEndpoint(TelemetryEndpoint, discriminator='OTLP'): + auth: TelemetryEndpointAuth + data: Union[list[str, TelemetryDataKind]] + endpoint: str + kind: Literal[TelemetryEndpointKind.OTLP] + protocol: Union[str, TelemetryTransportProtocol] + + @overload + def __init__( + self, + *, + auth: Optional[TelemetryEndpointAuth] = ..., + data: list[Union[str, TelemetryDataKind]], + endpoint: str, + protocol: Union[str, TelemetryTransportProtocol] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.PageOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ASC = "asc" + DESC = "desc" + + + class azure.ai.projects.models.PendingUploadRequest(_Model): + connection_name: Optional[str] + pending_upload_id: Optional[str] + pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] + + @overload + def __init__( + self, + *, + connection_name: Optional[str] = ..., + pending_upload_id: Optional[str] = ..., + pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.PendingUploadResponse(_Model): + blob_reference: BlobReference + pending_upload_id: str + pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] + version: Optional[str] + + @overload + def __init__( + self, + *, + blob_reference: BlobReference, + pending_upload_id: str, + pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE], + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.PendingUploadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + BLOB_REFERENCE = "BlobReference" + NONE = "None" + TEMPORARY_BLOB_REFERENCE = "TemporaryBlobReference" + + + class azure.ai.projects.models.ProceduralMemoryItem(MemoryItem, discriminator='procedural'): + content: str + kind: Literal[MemoryItemKind.PROCEDURAL] + memory_id: str + scope: str + updated_at: datetime + + @overload + def __init__( + self, + *, + content: str, + memory_id: str, + scope: str, + updated_at: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.PromotionInfo(_Model): + agent_name: str + agent_version: str + promoted_at: datetime + + @overload + def __init__( + self, + *, + agent_name: str, + agent_version: str, + promoted_at: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.PromptAgentDefinition(AgentDefinition, discriminator='prompt'): + instructions: Optional[str] + kind: Literal[AgentKind.PROMPT] + model: str + rai_config: RaiConfig + reasoning: Optional[Reasoning] + structured_inputs: Optional[dict[str, StructuredInputDefinition]] + temperature: Optional[float] + text: Optional[PromptAgentDefinitionTextOptions] + tool_choice: Optional[Union[str, ToolChoiceParam]] + tools: Optional[list[Tool]] + top_p: Optional[float] + + @overload + def __init__( + self, + *, + instructions: Optional[str] = ..., + model: str, + rai_config: Optional[RaiConfig] = ..., + reasoning: Optional[Reasoning] = ..., + structured_inputs: Optional[dict[str, StructuredInputDefinition]] = ..., + temperature: Optional[float] = ..., + text: Optional[PromptAgentDefinitionTextOptions] = ..., + tool_choice: Optional[Union[str, ToolChoiceParam]] = ..., + tools: Optional[list[Tool]] = ..., + top_p: Optional[float] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.PromptAgentDefinitionTextOptions(_Model): + format: Optional[TextResponseFormat] + + @overload + def __init__( + self, + *, + format: Optional[TextResponseFormat] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.PromptBasedEvaluatorDefinition(EvaluatorDefinition, discriminator='prompt'): + data_schema: dict[str, any] + init_parameters: dict[str, any] + metrics: dict[str, EvaluatorMetric] + prompt_text: str + type: Literal[EvaluatorDefinitionType.PROMPT] + + @overload + def __init__( + self, + *, + data_schema: Optional[dict[str, Any]] = ..., + init_parameters: Optional[dict[str, Any]] = ..., + metrics: Optional[dict[str, EvaluatorMetric]] = ..., + prompt_text: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.PromptDataGenerationJobSource(DataGenerationJobSource, discriminator='prompt'): + description: str + prompt: str + type: Literal[DataGenerationJobSourceType.PROMPT] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + prompt: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.PromptEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator='prompt'): + description: Optional[str] + prompt: str + type: Literal[EvaluatorGenerationJobSourceType.PROMPT] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + prompt: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ProtocolVersionRecord(_Model): + protocol: Union[str, AgentProtocol] + version: str + + @overload + def __init__( + self, + *, + protocol: Union[str, AgentProtocol], + version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RaiConfig(_Model): + rai_policy_name: str + + @overload + def __init__( + self, + *, + rai_policy_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RankerVersionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AUTO = "auto" + DEFAULT_2024_11_15 = "default-2024-11-15" + + + class azure.ai.projects.models.RankingOptions(_Model): + hybrid_search: Optional[HybridSearchOptions] + ranker: Optional[Union[str, RankerVersionType]] + score_threshold: Optional[float] + + @overload + def __init__( + self, + *, + hybrid_search: Optional[HybridSearchOptions] = ..., + ranker: Optional[Union[str, RankerVersionType]] = ..., + score_threshold: Optional[float] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.Reasoning(_Model): + effort: Optional[Literal["none", "minimal", "low", "medium", "high", "xhigh"]] + generate_summary: Optional[Literal["auto", "concise", "detailed"]] + summary: Optional[Literal["auto", "concise", "detailed"]] + + @overload + def __init__( + self, + *, + effort: Optional[Literal[none, minimal, low, medium, high, xhigh]] = ..., + generate_summary: Optional[Literal[auto, concise, detailed]] = ..., + summary: Optional[Literal[auto, concise, detailed]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RecurrenceSchedule(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RecurrenceTrigger(Trigger, discriminator='Recurrence'): + end_time: Optional[datetime] + interval: int + schedule: RecurrenceSchedule + start_time: Optional[datetime] + time_zone: Optional[str] + type: Literal[TriggerType.RECURRENCE] + + @overload + def __init__( + self, + *, + end_time: Optional[datetime] = ..., + interval: int, + schedule: RecurrenceSchedule, + start_time: Optional[datetime] = ..., + time_zone: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RecurrenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DAILY = "Daily" + HOURLY = "Hourly" + MONTHLY = "Monthly" + WEEKLY = "Weekly" + + + class azure.ai.projects.models.RedTeam(_Model): + application_scenario: Optional[str] + attack_strategies: Optional[list[Union[str, AttackStrategy]]] + display_name: Optional[str] + name: str + num_turns: Optional[int] + properties: Optional[dict[str, str]] + risk_categories: Optional[list[Union[str, RiskCategory]]] + simulation_only: Optional[bool] + status: Optional[str] + tags: Optional[dict[str, str]] + target: RedTeamTargetConfig + + @overload + def __init__( + self, + *, + application_scenario: Optional[str] = ..., + attack_strategies: Optional[list[Union[str, AttackStrategy]]] = ..., + display_name: Optional[str] = ..., + num_turns: Optional[int] = ..., + properties: Optional[dict[str, str]] = ..., + risk_categories: Optional[list[Union[str, RiskCategory]]] = ..., + simulation_only: Optional[bool] = ..., + tags: Optional[dict[str, str]] = ..., + target: RedTeamTargetConfig + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RedTeamEvalRunDataSource(TypedDict, total=False): + key "item_generation_params": Required[Any] + key "target": Required[Union[AzureAIAgentTargetParam, AzureAIModelTargetParam, dict[str, Any]]] + key "type": Required[Literal["azure_ai_red_team"]] + + + class azure.ai.projects.models.RedTeamTargetConfig(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ResponseRetrievalItemGenerationParams(TypedDict, total=False): + key "data_mapping": Required[Dict[str, str]] + key "max_num_turns": int + key "source": Required[Union[SourceFileContent, SourceFileID]] + key "type": Required[Literal["response_retrieval"]] + + + class azure.ai.projects.models.ResponseUsageInputTokensDetails(_Model): + cached_tokens: int + + @overload + def __init__( + self, + *, + cached_tokens: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ResponseUsageOutputTokensDetails(_Model): + reasoning_tokens: int + + @overload + def __init__( + self, + *, + reasoning_tokens: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RiskCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CODE_VULNERABILITY = "CodeVulnerability" + HATE_UNFAIRNESS = "HateUnfairness" + PROHIBITED_ACTIONS = "ProhibitedActions" + PROTECTED_MATERIAL = "ProtectedMaterial" + SELF_HARM = "SelfHarm" + SENSITIVE_DATA_LEAKAGE = "SensitiveDataLeakage" + SEXUAL = "Sexual" + TASK_ADHERENCE = "TaskAdherence" + UNGROUNDED_ATTRIBUTES = "UngroundedAttributes" + VIOLENCE = "Violence" + + + class azure.ai.projects.models.Routine(_Model): + action: Optional[RoutineAction] + created_at: Optional[datetime] + description: Optional[str] + enabled: bool + name: Optional[str] + triggers: Optional[dict[str, RoutineTrigger]] + updated_at: Optional[datetime] + + @overload + def __init__( + self, + *, + action: Optional[RoutineAction] = ..., + created_at: Optional[datetime] = ..., + description: Optional[str] = ..., + enabled: bool, + name: Optional[str] = ..., + triggers: Optional[dict[str, RoutineTrigger]] = ..., + updated_at: Optional[datetime] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RoutineAction(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RoutineActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INVOKE_AGENT_INVOCATIONS_API = "invoke_agent_invocations_api" + INVOKE_AGENT_RESPONSES_API = "invoke_agent_responses_api" + + + class azure.ai.projects.models.RoutineAttemptSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + EVENT_FIRE = "event_fire" + MANUAL_DISPATCH = "manual_dispatch" + QUEUED_DISPATCH = "queued_dispatch" + SCHEDULE_DELIVERY = "schedule_delivery" + TIMER_DELIVERY = "timer_delivery" + + + class azure.ai.projects.models.RoutineDispatchPayload(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RoutineDispatchPayloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INVOKE_AGENT_INVOCATIONS_API = "invoke_agent_invocations_api" + INVOKE_AGENT_RESPONSES_API = "invoke_agent_responses_api" + + + class azure.ai.projects.models.RoutineRun(_Model): + action_correlation_id: Optional[str] + action_type: Optional[Union[str, RoutineActionType]] + agent_endpoint_id: Optional[str] + agent_id: Optional[str] + attempt_source: Optional[Union[str, RoutineAttemptSource]] + conversation_id: Optional[str] + dispatch_id: Optional[str] + ended_at: Optional[datetime] + error_message: Optional[str] + error_status_code: Optional[int] + error_type: Optional[str] + id: str + phase: Optional[Union[str, RoutineRunPhase]] + response_id: Optional[str] + scheduled_fire_at: Optional[datetime] + session_id: Optional[str] + started_at: Optional[datetime] + status: Optional[RoutineRunStatus] + task_id: Optional[str] + trigger_name: Optional[str] + trigger_type: Optional[Union[str, RoutineTriggerType]] + triggered_at: Optional[datetime] + + @overload + def __init__( + self, + *, + action_correlation_id: Optional[str] = ..., + action_type: Optional[Union[str, RoutineActionType]] = ..., + agent_endpoint_id: Optional[str] = ..., + agent_id: Optional[str] = ..., + attempt_source: Optional[Union[str, RoutineAttemptSource]] = ..., + conversation_id: Optional[str] = ..., + dispatch_id: Optional[str] = ..., + ended_at: Optional[datetime] = ..., + error_message: Optional[str] = ..., + error_status_code: Optional[int] = ..., + error_type: Optional[str] = ..., + phase: Optional[Union[str, RoutineRunPhase]] = ..., + response_id: Optional[str] = ..., + scheduled_fire_at: Optional[datetime] = ..., + session_id: Optional[str] = ..., + started_at: Optional[datetime] = ..., + status: Optional[RoutineRunStatus] = ..., + task_id: Optional[str] = ..., + trigger_name: Optional[str] = ..., + trigger_type: Optional[Union[str, RoutineTriggerType]] = ..., + triggered_at: Optional[datetime] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RoutineRunPhase(str, Enum, metaclass=CaseInsensitiveEnumMeta): + COMPLETED = "completed" + DISPATCHING = "dispatching" + FAILED = "failed" + QUEUED = "queued" + + + class azure.ai.projects.models.RoutineTrigger(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.RoutineTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CUSTOM = "custom" + GITHUB_ISSUE = "github_issue" + SCHEDULE = "schedule" + TIMER = "timer" + + + class azure.ai.projects.models.RubricBasedEvaluatorDefinition(EvaluatorDefinition, discriminator='rubric'): + data_schema: dict[str, any] + dimensions: list[Dimension] + init_parameters: dict[str, any] + metrics: dict[str, EvaluatorMetric] + pass_threshold: Optional[float] + type: Literal[EvaluatorDefinitionType.RUBRIC] + + @overload + def __init__( + self, + *, + data_schema: Optional[dict[str, Any]] = ..., + dimensions: list[Dimension], + init_parameters: Optional[dict[str, Any]] = ..., + metrics: Optional[dict[str, EvaluatorMetric]] = ..., + pass_threshold: Optional[float] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SASCredentials(BaseCredentials, discriminator='SAS'): + sas_token: Optional[str] + type: Literal[CredentialType.SAS] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SampleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + EVALUATION_RESULT_SAMPLE = "EvaluationResultSample" + + + class azure.ai.projects.models.Schedule(_Model): + description: Optional[str] + display_name: Optional[str] + enabled: bool + properties: Optional[dict[str, str]] + provisioning_status: Optional[Union[str, ScheduleProvisioningStatus]] + schedule_id: str + system_data: dict[str, str] + tags: Optional[dict[str, str]] + task: ScheduleTask + trigger: Trigger + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + display_name: Optional[str] = ..., + enabled: bool, + properties: Optional[dict[str, str]] = ..., + tags: Optional[dict[str, str]] = ..., + task: ScheduleTask, + trigger: Trigger + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ScheduleProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + + class azure.ai.projects.models.ScheduleRoutineTrigger(RoutineTrigger, discriminator='schedule'): + cron_expression: str + time_zone: str + type: Literal[RoutineTriggerType.SCHEDULE] + + @overload + def __init__( + self, + *, + cron_expression: str, + time_zone: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ScheduleRun(_Model): + error: Optional[str] + properties: dict[str, str] + run_id: str + schedule_id: str + success: bool + trigger_time: Optional[datetime] + + @overload + def __init__( + self, + *, + schedule_id: str, + trigger_time: Optional[datetime] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ScheduleTask(_Model): + configuration: Optional[dict[str, str]] + type: str + + @overload + def __init__( + self, + *, + configuration: Optional[dict[str, str]] = ..., + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ScheduleTaskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + EVALUATION = "Evaluation" + INSIGHT = "Insight" + + + class azure.ai.projects.models.SearchContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + IMAGE = "image" + TEXT = "text" + + + class azure.ai.projects.models.SearchContextSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): + HIGH = "high" + LOW = "low" + MEDIUM = "medium" + + + class azure.ai.projects.models.SessionDirectoryEntry(_Model): + is_directory: bool + modified_time: datetime + name: str + size: int + + @overload + def __init__( + self, + *, + is_directory: bool, + modified_time: datetime, + name: str, + size: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SessionFileWriteResult(_Model): + bytes_written: int + path: str + + @overload + def __init__( + self, + *, + bytes_written: int, + path: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SessionLogEvent(_Model): + data: str + event: Union[str, SessionLogEventType] + + @overload + def __init__( + self, + *, + data: str, + event: Union[str, SessionLogEventType] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SessionLogEventType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + LOG = "log" + + + class azure.ai.projects.models.SharepointGroundingToolParameters(_Model): + project_connections: Optional[list[ToolProjectConnection]] + + @overload + def __init__( + self, + *, + project_connections: Optional[list[ToolProjectConnection]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SharepointPreviewTool(Tool, discriminator='sharepoint_grounding_preview'): + description: Optional[str] + name: Optional[str] + sharepoint_grounding_preview: SharepointGroundingToolParameters + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.SHAREPOINT_GROUNDING_PREVIEW] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + sharepoint_grounding_preview: SharepointGroundingToolParameters, + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SimpleQnADataGenerationJobOptions(DataGenerationJobOptions, discriminator='simple_qna'): + max_samples: int + model_options: DataGenerationModelOptions + question_types: Optional[list[Union[str, SimpleQnAFineTuningQuestionType]]] + train_split: float + type: Literal[DataGenerationJobType.SIMPLE_QNA] + + @overload + def __init__( + self, + *, + max_samples: int, + model_options: Optional[DataGenerationModelOptions] = ..., + question_types: Optional[list[Union[str, SimpleQnAFineTuningQuestionType]]] = ..., + train_split: Optional[float] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SimpleQnAFineTuningQuestionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + LONG_ANSWER = "long_answer" + SHORT_ANSWER = "short_answer" + + + class azure.ai.projects.models.SkillDetails(_Model): + created_at: datetime + default_version: str + description: str + id: str + latest_version: str + name: str + + @overload + def __init__( + self, + *, + created_at: datetime, + default_version: str, + description: str, + id: str, + latest_version: str, + name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SkillInlineContent(_Model): + allowed_tools: Optional[list[str]] + compatibility: Optional[str] + description: str + instructions: str + license: Optional[str] + metadata: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + allowed_tools: Optional[list[str]] = ..., + compatibility: Optional[str] = ..., + description: str, + instructions: str, + license: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SkillReferenceParam(ContainerSkill, discriminator='skill_reference'): + skill_id: str + type: Literal[ContainerSkillType.SKILL_REFERENCE] + version: Optional[str] + + @overload + def __init__( + self, + *, + skill_id: str, + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SkillVersion(_Model): + created_at: datetime + description: str + id: str + name: str + skill_id: str + version: str + + @overload + def __init__( + self, + *, + created_at: datetime, + description: str, + id: str, + name: str, + skill_id: str, + version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SpecificApplyPatchParam(ToolChoiceParam, discriminator='apply_patch'): + type: Literal[ToolChoiceParamType.APPLY_PATCH] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SpecificFunctionShellParam(ToolChoiceParam, discriminator='shell'): + type: Literal[ToolChoiceParamType.SHELL] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.StructuredInputDefinition(_Model): + default_value: Optional[Any] + description: Optional[str] + required: Optional[bool] + schema: Optional[dict[str, Any]] + + @overload + def __init__( + self, + *, + default_value: Optional[Any] = ..., + description: Optional[str] = ..., + required: Optional[bool] = ..., + schema: Optional[dict[str, Any]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.StructuredOutputDefinition(_Model): + description: str + name: str + schema: dict[str, Any] + strict: bool + + @overload + def __init__( + self, + *, + description: str, + name: str, + schema: dict[str, Any], + strict: bool + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.SystemDataV3(_Model): + created_at: Optional[datetime] + created_by: Optional[str] + created_by_type: Optional[str] + last_modified_at: Optional[datetime] + + @overload + def __init__( + self, + *, + created_at: Optional[datetime] = ..., + created_by: Optional[str] = ..., + created_by_type: Optional[str] = ..., + last_modified_at: Optional[datetime] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TargetCompletionEvalRunDataSource(TypedDict, total=False): + key "input_messages": Required[InputMessagesItemReference] + key "source": Required[Union[SourceFileContent, SourceFileID]] + key "target": Required[Union[AzureAIAgentTargetParam, AzureAIModelTargetParam, dict[str, Any]]] + key "type": Required[Literal["azure_ai_target_completions"]] + + + class azure.ai.projects.models.TaxonomyCategory(_Model): + description: Optional[str] + id: str + name: str + properties: Optional[dict[str, str]] + risk_category: Union[str, RiskCategory] + sub_categories: list[TaxonomySubCategory] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + id: str, + name: str, + properties: Optional[dict[str, str]] = ..., + risk_category: Union[str, RiskCategory], + sub_categories: list[TaxonomySubCategory] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TaxonomySubCategory(_Model): + description: Optional[str] + enabled: bool + id: str + name: str + properties: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + enabled: bool, + id: str, + name: str, + properties: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TelemetryConfig(_Model): + endpoints: list[TelemetryEndpoint] + + @overload + def __init__( + self, + *, + endpoints: list[TelemetryEndpoint] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TelemetryDataKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CONTAINER_OTEL = "ContainerOtel" + CONTAINER_STDOUT_STDERR = "ContainerStdoutStderr" + METRICS = "Metrics" + + + class azure.ai.projects.models.TelemetryEndpoint(_Model): + auth: Optional[TelemetryEndpointAuth] + data: list[Union[str, TelemetryDataKind]] + kind: str + + @overload + def __init__( + self, + *, + auth: Optional[TelemetryEndpointAuth] = ..., + data: list[Union[str, TelemetryDataKind]], + kind: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TelemetryEndpointAuth(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TelemetryEndpointAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + HEADER = "header" + + + class azure.ai.projects.models.TelemetryEndpointKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + OTLP = "OTLP" + + + class azure.ai.projects.models.TelemetryTransportProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + GRPC = "Grpc" + HTTP = "Http" + + + class azure.ai.projects.models.TestingCriterionAzureAIEvaluator(TypedDict, total=False): + key "data_mapping": Dict[str, str] + key "evaluator_name": Required[str] + key "evaluator_version": str + key "initialization_parameters": Dict[str, Any] + key "name": Required[str] + key "type": Required[Literal["azure_ai_evaluator"]] + + + class azure.ai.projects.models.TextResponseFormat(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TextResponseFormatConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + JSON_OBJECT = "json_object" + JSON_SCHEMA = "json_schema" + TEXT = "text" + + + class azure.ai.projects.models.TextResponseFormatJsonObject(TextResponseFormat, discriminator='json_object'): + type: Literal[TextResponseFormatConfigurationType.JSON_OBJECT] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TextResponseFormatJsonSchema(TextResponseFormat, discriminator='json_schema'): + description: Optional[str] + name: str + schema: dict[str, Any] + strict: Optional[bool] + type: Literal[TextResponseFormatConfigurationType.JSON_SCHEMA] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: str, + schema: dict[str, Any], + strict: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TextResponseFormatText(TextResponseFormat, discriminator='text'): + type: Literal[TextResponseFormatConfigurationType.TEXT] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TimerRoutineTrigger(RoutineTrigger, discriminator='timer'): + at: Optional[datetime] + type: Literal[RoutineTriggerType.TIMER] + + @overload + def __init__( + self, + *, + at: Optional[datetime] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.Tool(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceAllowed(ToolChoiceParam, discriminator='allowed_tools'): + mode: Literal["auto", "required"] + tools: list[dict[str, Any]] + type: Literal[ToolChoiceParamType.ALLOWED_TOOLS] + + @overload + def __init__( + self, + *, + mode: Literal["auto", "required"], + tools: list[dict[str, Any]] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceCodeInterpreter(ToolChoiceParam, discriminator='code_interpreter'): + type: Literal[ToolChoiceParamType.CODE_INTERPRETER] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceComputer(ToolChoiceParam, discriminator='computer'): + type: Literal[ToolChoiceParamType.COMPUTER] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceComputerUse(ToolChoiceParam, discriminator='computer_use'): + type: Literal[ToolChoiceParamType.COMPUTER_USE] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceComputerUsePreview(ToolChoiceParam, discriminator='computer_use_preview'): + type: Literal[ToolChoiceParamType.COMPUTER_USE_PREVIEW] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceCustom(ToolChoiceParam, discriminator='custom'): + name: str + type: Literal[ToolChoiceParamType.CUSTOM] + + @overload + def __init__( + self, + *, + name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceFileSearch(ToolChoiceParam, discriminator='file_search'): + type: Literal[ToolChoiceParamType.FILE_SEARCH] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceFunction(ToolChoiceParam, discriminator='function'): + name: str + type: Literal[ToolChoiceParamType.FUNCTION] + + @overload + def __init__( + self, + *, + name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceImageGeneration(ToolChoiceParam, discriminator='image_generation'): + type: Literal[ToolChoiceParamType.IMAGE_GENERATION] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceMCP(ToolChoiceParam, discriminator='mcp'): + name: Optional[str] + server_label: str + type: Literal[ToolChoiceParamType.MCP] + + @overload + def __init__( + self, + *, + name: Optional[str] = ..., + server_label: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceParam(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceParamType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ALLOWED_TOOLS = "allowed_tools" + APPLY_PATCH = "apply_patch" + CODE_INTERPRETER = "code_interpreter" + COMPUTER = "computer" + COMPUTER_USE = "computer_use" + COMPUTER_USE_PREVIEW = "computer_use_preview" + CUSTOM = "custom" + FILE_SEARCH = "file_search" + FUNCTION = "function" + IMAGE_GENERATION = "image_generation" + MCP = "mcp" + SHELL = "shell" + WEB_SEARCH_PREVIEW = "web_search_preview" + WEB_SEARCH_PREVIEW_2025_03_11 = "web_search_preview_2025_03_11" + + + class azure.ai.projects.models.ToolChoiceWebSearchPreview(ToolChoiceParam, discriminator='web_search_preview'): + type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolChoiceWebSearchPreview20250311(ToolChoiceParam, discriminator='web_search_preview_2025_03_11'): + type: Literal[ToolChoiceParamType.WEB_SEARCH_PREVIEW_2025_03_11] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolConfig(_Model): + additional_search_text: Optional[str] + pin: Optional[bool] + + @overload + def __init__( + self, + *, + additional_search_text: Optional[str] = ..., + pin: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolDescription(_Model): + description: Optional[str] + name: Optional[str] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolDescriptionParam(TypedDict, total=False): + key "description": str + key "name": str + + + class azure.ai.projects.models.ToolProjectConnection(_Model): + project_connection_id: str + + @overload + def __init__( + self, + *, + project_connection_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolSearchExecutionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CLIENT = "client" + SERVER = "server" + + + class azure.ai.projects.models.ToolSearchToolParam(Tool, discriminator='tool_search'): + description: Optional[str] + execution: Optional[Union[str, ToolSearchExecutionType]] + parameters: Optional[EmptyModelParam] + type: Literal[ToolType.TOOL_SEARCH] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + execution: Optional[Union[str, ToolSearchExecutionType]] = ..., + parameters: Optional[EmptyModelParam] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + A2A_PREVIEW = "a2a_preview" + APPLY_PATCH = "apply_patch" + AZURE_AI_SEARCH = "azure_ai_search" + AZURE_FUNCTION = "azure_function" + BING_CUSTOM_SEARCH_PREVIEW = "bing_custom_search_preview" + BING_GROUNDING = "bing_grounding" + BROWSER_AUTOMATION_PREVIEW = "browser_automation_preview" + CAPTURE_STRUCTURED_OUTPUTS = "capture_structured_outputs" + CODE_INTERPRETER = "code_interpreter" + COMPUTER = "computer" + COMPUTER_USE_PREVIEW = "computer_use_preview" + CUSTOM = "custom" + FABRIC_DATAAGENT_PREVIEW = "fabric_dataagent_preview" + FABRIC_IQ_PREVIEW = "fabric_iq_preview" + FILE_SEARCH = "file_search" + FUNCTION = "function" + IMAGE_GENERATION = "image_generation" + LOCAL_SHELL = "local_shell" + MCP = "mcp" + MEMORY_SEARCH_PREVIEW = "memory_search_preview" + NAMESPACE = "namespace" + OPENAPI = "openapi" + SHAREPOINT_GROUNDING_PREVIEW = "sharepoint_grounding_preview" + SHELL = "shell" + TOOLBOX_SEARCH_PREVIEW = "toolbox_search_preview" + TOOL_SEARCH = "tool_search" + WEB_SEARCH = "web_search" + WEB_SEARCH_PREVIEW = "web_search_preview" + WORK_IQ_PREVIEW = "work_iq_preview" + + + class azure.ai.projects.models.ToolUseFineTuningDataGenerationJobOptions(DataGenerationJobOptions, discriminator='tool_use'): + max_samples: int + model_options: DataGenerationModelOptions + train_split: float + type: Literal[DataGenerationJobType.TOOL_USE] + + @overload + def __init__( + self, + *, + max_samples: int, + model_options: Optional[DataGenerationModelOptions] = ..., + train_split: Optional[float] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolboxObject(_Model): + default_version: str + id: str + name: str + + @overload + def __init__( + self, + *, + default_version: str, + id: str, + name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolboxPolicies(_Model): + rai_config: Optional[RaiConfig] + + @overload + def __init__( + self, + *, + rai_config: Optional[RaiConfig] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolboxSearchPreviewTool(Tool, discriminator='toolbox_search_preview'): + description: Optional[str] + name: Optional[str] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.TOOLBOX_SEARCH_PREVIEW] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolboxSkill(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolboxSkillReference(ToolboxSkill, discriminator='skill_reference'): + name: str + type: Literal["skill_reference"] + version: Optional[str] + + @overload + def __init__( + self, + *, + name: str, + version: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.ToolboxVersionObject(_Model): + created_at: datetime + description: Optional[str] + id: str + metadata: dict[str, str] + name: str + policies: Optional[ToolboxPolicies] + skills: Optional[list[ToolboxSkill]] + tools: list[Tool] + version: str + + @overload + def __init__( + self, + *, + created_at: datetime, + description: Optional[str] = ..., + id: str, + metadata: dict[str, str], + name: str, + policies: Optional[ToolboxPolicies] = ..., + skills: Optional[list[ToolboxSkill]] = ..., + tools: list[Tool], + version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TracesDataGenerationJobOptions(DataGenerationJobOptions, discriminator='traces'): + max_samples: int + model_options: DataGenerationModelOptions + train_split: float + type: Literal[DataGenerationJobType.TRACES] + + @overload + def __init__( + self, + *, + max_samples: int, + model_options: Optional[DataGenerationModelOptions] = ..., + train_split: Optional[float] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TracesDataGenerationJobSource(DataGenerationJobSource, discriminator='traces'): + agent_id: Optional[str] + agent_name: Optional[str] + agent_version: Optional[str] + description: str + end_time: Optional[datetime] + start_time: datetime + type: Literal[DataGenerationJobSourceType.TRACES] + + @overload + def __init__( + self, + *, + agent_id: Optional[str] = ..., + agent_name: Optional[str] = ..., + agent_version: Optional[str] = ..., + description: Optional[str] = ..., + end_time: Optional[datetime] = ..., + start_time: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TracesEvaluatorGenerationJobSource(EvaluatorGenerationJobSource, discriminator='traces'): + agent_id: Optional[str] + agent_name: Optional[str] + agent_version: Optional[str] + description: Optional[str] + end_time: Optional[datetime] + start_time: datetime + type: Literal[EvaluatorGenerationJobSourceType.TRACES] + + @overload + def __init__( + self, + *, + agent_id: Optional[str] = ..., + agent_name: Optional[str] = ..., + agent_version: Optional[str] = ..., + description: Optional[str] = ..., + end_time: Optional[datetime] = ..., + start_time: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TracesPreviewEvalRunDataSource(TypedDict, total=False): + key "agent_id": str + key "agent_name": str + key "end_time": datetime + key "ingestion_delay_seconds": int + key "lookback_hours": int + key "max_traces": int + key "trace_ids": List[str] + key "type": Required[Literal["azure_ai_traces_preview"]] + + + class azure.ai.projects.models.TreatmentEffectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CHANGED = "Changed" + DEGRADED = "Degraded" + IMPROVED = "Improved" + INCONCLUSIVE = "Inconclusive" + TOO_FEW_SAMPLES = "TooFewSamples" + + + class azure.ai.projects.models.Trigger(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CRON = "Cron" + ONE_TIME = "OneTime" + RECURRENCE = "Recurrence" + + + class azure.ai.projects.models.UpdateMemoriesLROPoller(LROPoller[MemoryStoreUpdateCompletedResult]): + property superseded_by: Optional[str] # Read-only + property update_id: str # Read-only + + @classmethod + def from_continuation_token( + cls, + polling_method: PollingMethod[MemoryStoreUpdateCompletedResult], + continuation_token: str, + **kwargs: Any + ) -> UpdateMemoriesLROPoller: ... + + + class azure.ai.projects.models.UpdateModelVersionRequest(_Model): + description: Optional[str] + tags: Optional[dict[str, str]] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.UpdateToolboxRequest(_Model): + default_version: str + + @overload + def __init__( + self, + *, + default_version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.UserProfileMemoryItem(MemoryItem, discriminator='user_profile'): + content: str + kind: Literal[MemoryItemKind.USER_PROFILE] + memory_id: str + scope: str + updated_at: datetime + + @overload + def __init__( + self, + *, + content: str, + memory_id: str, + scope: str, + updated_at: datetime + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.VersionIndicator(_Model): + type: str + + @overload + def __init__( + self, + *, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.VersionIndicatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + VERSION_REF = "version_ref" + + + class azure.ai.projects.models.VersionRefIndicator(VersionIndicator, discriminator='version_ref'): + agent_version: str + type: Literal[VersionIndicatorType.VERSION_REF] + + @overload + def __init__( + self, + *, + agent_version: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.VersionSelectionRule(_Model): + agent_version: str + type: str + + @overload + def __init__( + self, + *, + agent_version: str, + type: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.VersionSelector(_Model): + version_selection_rules: list[VersionSelectionRule] + + @overload + def __init__( + self, + *, + version_selection_rules: list[VersionSelectionRule] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.VersionSelectorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FIXED_RATIO = "FixedRatio" + + + class azure.ai.projects.models.WebSearchApproximateLocation(_Model): + city: Optional[str] + country: Optional[str] + region: Optional[str] + timezone: Optional[str] + type: Literal["approximate"] + + @overload + def __init__( + self, + *, + city: Optional[str] = ..., + country: Optional[str] = ..., + region: Optional[str] = ..., + timezone: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.WebSearchConfiguration(_Model): + instance_name: str + project_connection_id: str + + @overload + def __init__( + self, + *, + instance_name: str, + project_connection_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.WebSearchPreviewTool(Tool, discriminator='web_search_preview'): + search_content_types: Optional[list[Union[str, SearchContentType]]] + search_context_size: Optional[Union[str, SearchContextSize]] + type: Literal[ToolType.WEB_SEARCH_PREVIEW] + user_location: Optional[ApproximateLocation] + + @overload + def __init__( + self, + *, + search_content_types: Optional[list[Union[str, SearchContentType]]] = ..., + search_context_size: Optional[Union[str, SearchContextSize]] = ..., + user_location: Optional[ApproximateLocation] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.WebSearchTool(Tool, discriminator='web_search'): + custom_search_configuration: Optional[WebSearchConfiguration] + description: Optional[str] + filters: Optional[WebSearchToolFilters] + name: Optional[str] + search_context_size: Optional[Literal["low", "medium", "high"]] + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.WEB_SEARCH] + user_location: Optional[WebSearchApproximateLocation] + + @overload + def __init__( + self, + *, + custom_search_configuration: Optional[WebSearchConfiguration] = ..., + description: Optional[str] = ..., + filters: Optional[WebSearchToolFilters] = ..., + name: Optional[str] = ..., + search_context_size: Optional[Literal[low, medium, high]] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ..., + user_location: Optional[WebSearchApproximateLocation] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.WebSearchToolFilters(_Model): + allowed_domains: Optional[list[str]] + + @overload + def __init__( + self, + *, + allowed_domains: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.WeeklyRecurrenceSchedule(RecurrenceSchedule, discriminator='Weekly'): + days_of_week: list[Union[str, DayOfWeek]] + type: Literal[RecurrenceType.WEEKLY] + + @overload + def __init__( + self, + *, + days_of_week: list[Union[str, DayOfWeek]] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.WorkIQPreviewTool(Tool, discriminator='work_iq_preview'): + description: Optional[str] + name: Optional[str] + project_connection_id: str + tool_configs: Optional[dict[str, ToolConfig]] + type: Literal[ToolType.WORK_IQ_PREVIEW] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + project_connection_id: str, + tool_configs: Optional[dict[str, ToolConfig]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.ai.projects.models.WorkflowAgentDefinition(AgentDefinition, discriminator='workflow'): + kind: Literal[AgentKind.WORKFLOW] + rai_config: RaiConfig + workflow: Optional[str] + + @overload + def __init__( + self, + *, + rai_config: Optional[RaiConfig] = ..., + workflow: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + +namespace azure.ai.projects.operations + + class azure.ai.projects.operations.AgentsOperations(GeneratedAgentsOperations): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_session( + self, + agent_name: str, + *, + agent_session_id: Optional[str] = ..., + content_type: str = "application/json", + user_isolation_key: Optional[str] = ..., + version_indicator: VersionIndicator, + **kwargs: Any + ) -> AgentSessionResource: ... + + @overload + def create_session( + self, + agent_name: str, + body: JSON, + *, + content_type: str = "application/json", + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> AgentSessionResource: ... + + @overload + def create_session( + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> AgentSessionResource: ... + + @overload + def create_version( + self, + agent_name: str, + *, + blueprint_reference: Optional[AgentBlueprintReference] = ..., + content_type: str = "application/json", + definition: AgentDefinition, + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + def create_version( + self, + agent_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + def create_version( + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + def create_version_from_code( + self, + agent_name: str, + content: CreateAgentVersionFromCodeContent, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + def create_version_from_code( + self, + agent_name: str, + content: JSON, + *, + code_zip_sha256: str, + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + def create_version_from_manifest( + self, + agent_name: str, + *, + content_type: str = "application/json", + description: Optional[str] = ..., + manifest_id: str, + metadata: Optional[dict[str, str]] = ..., + parameter_values: dict[str, Any], + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + def create_version_from_manifest( + self, + agent_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AgentVersionDetails: ... + + @overload + def create_version_from_manifest( + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AgentVersionDetails: ... + + @distributed_trace + def delete( + self, + agent_name: str, + *, + force: Optional[bool] = ..., + **kwargs: Any + ) -> DeleteAgentResponse: ... + + @distributed_trace + def delete_session( + self, + agent_name: str, + session_id: str, + *, + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + @distributed_trace + def delete_session_file( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + recursive: Optional[bool] = ..., + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + @distributed_trace + def delete_version( + self, + agent_name: str, + agent_version: str, + *, + force: Optional[bool] = ..., + **kwargs: Any + ) -> DeleteAgentVersionResponse: ... + + @distributed_trace + def download_code( + self, + agent_name: str, + *, + agent_version: Optional[str] = ..., + **kwargs: Any + ) -> Iterator[bytes]: ... + + @distributed_trace + def download_session_file( + self, + agent_name: str, + agent_session_id: str, + *, + path: str, + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> Iterator[bytes]: ... + + @distributed_trace + def get( + self, + agent_name: str, + **kwargs: Any + ) -> AgentDetails: ... + + @distributed_trace + def get_session( + self, + agent_name: str, + session_id: str, + *, + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> AgentSessionResource: ... + + @distributed_trace + def get_session_log_stream( + self, + agent_name: str, + agent_version: str, + session_id: str, + **kwargs: Any + ) -> SessionLogEvent: ... + + @distributed_trace + def get_version( + self, + agent_name: str, + agent_version: str, + **kwargs: Any + ) -> AgentVersionDetails: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + kind: Optional[Union[str, AgentKind]] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[AgentDetails]: ... + + @distributed_trace + def list_session_files( + self, + agent_name: str, + agent_session_id: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + path: Optional[str] = ..., + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> ItemPaged[SessionDirectoryEntry]: ... + + @distributed_trace + def list_sessions( + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + user_isolation_key: Optional[str] = ..., + **kwargs: Any + ) -> ItemPaged[AgentSessionResource]: ... + + @distributed_trace + def list_versions( + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[AgentVersionDetails]: ... + + @overload + def patch_agent_details( + self, + agent_name: str, + *, + agent_card: Optional[AgentCard] = ..., + agent_endpoint: Optional[AgentEndpointConfig] = ..., + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> AgentDetails: ... + + @overload + def patch_agent_details( + self, + agent_name: str, + body: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> AgentDetails: ... + + @overload + def patch_agent_details( + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> AgentDetails: ... + + @distributed_trace + def stop_session( + self, + agent_name: str, + session_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def upload_session_file( + self, + agent_name: str, + session_id: str, + content_or_file_path: bytes | str, + *, + path: str, + **kwargs: Any + ) -> SessionFileWriteResult: ... + + + class azure.ai.projects.operations.BetaAgentsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def cancel_optimization_job( + self, + job_id: str, + **kwargs: Any + ) -> OptimizationJob: ... + + @overload + def create_optimization_job( + self, + job: OptimizationJob, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> OptimizationJob: ... + + @overload + def create_optimization_job( + self, + job: JSON, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> OptimizationJob: ... + + @overload + def create_optimization_job( + self, + job: IO[bytes], + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> OptimizationJob: ... + + @distributed_trace + def delete_optimization_job( + self, + job_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get_optimization_job( + self, + job_id: str, + **kwargs: Any + ) -> OptimizationJob: ... + + @distributed_trace + def list_optimization_jobs( + self, + *, + agent_name: Optional[str] = ..., + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + status: Optional[Union[str, JobStatus]] = ..., + **kwargs: Any + ) -> ItemPaged[OptimizationJobListItem]: ... + + + class azure.ai.projects.operations.BetaDatasetsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def cancel_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> DataGenerationJob: ... + + @overload + def create_generation_job( + self, + job: DataGenerationJob, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> DataGenerationJob: ... + + @overload + def create_generation_job( + self, + job: JSON, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> DataGenerationJob: ... + + @overload + def create_generation_job( + self, + job: IO[bytes], + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> DataGenerationJob: ... + + @distributed_trace + def delete_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> DataGenerationJob: ... + + @distributed_trace + def list_generation_jobs( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[DataGenerationJob]: ... + + + class azure.ai.projects.operations.BetaEvaluationTaxonomiesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create( + self, + name: str, + taxonomy: EvaluationTaxonomy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @overload + def create( + self, + name: str, + taxonomy: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @overload + def create( + self, + name: str, + taxonomy: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @distributed_trace + def delete( + self, + name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + name: str, + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @distributed_trace + def list( + self, + *, + input_name: Optional[str] = ..., + input_type: Optional[str] = ..., + **kwargs: Any + ) -> ItemPaged[EvaluationTaxonomy]: ... + + @overload + def update( + self, + name: str, + taxonomy: EvaluationTaxonomy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @overload + def update( + self, + name: str, + taxonomy: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + @overload + def update( + self, + name: str, + taxonomy: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationTaxonomy: ... + + + class azure.ai.projects.operations.BetaEvaluatorsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def cancel_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @overload + def create_generation_job( + self, + job: EvaluatorGenerationJob, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @overload + def create_generation_job( + self, + job: JSON, + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @overload + def create_generation_job( + self, + job: IO[bytes], + *, + content_type: str = "application/json", + operation_id: Optional[str] = ..., + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @overload + def create_version( + self, + name: str, + evaluator_version: EvaluatorVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + def create_version( + self, + name: str, + evaluator_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + def create_version( + self, + name: str, + evaluator_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @distributed_trace + def delete_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def delete_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @overload + def get_credentials( + self, + name: str, + version: str, + credential_request: EvaluatorCredentialRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @overload + def get_credentials( + self, + name: str, + version: str, + credential_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @overload + def get_credentials( + self, + name: str, + version: str, + credential_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @distributed_trace + def get_generation_job( + self, + job_id: str, + **kwargs: Any + ) -> EvaluatorGenerationJob: ... + + @distributed_trace + def get_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> EvaluatorVersion: ... + + @distributed_trace + def list( + self, + *, + limit: Optional[int] = ..., + type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + **kwargs: Any + ) -> ItemPaged[EvaluatorVersion]: ... + + @distributed_trace + def list_generation_jobs( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[EvaluatorGenerationJob]: ... + + @distributed_trace + def list_versions( + self, + name: str, + *, + limit: Optional[int] = ..., + type: Optional[Union[Literal[builtin], Literal[custom], Literal[all], str]] = ..., + **kwargs: Any + ) -> ItemPaged[EvaluatorVersion]: ... + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: PendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + def update_version( + self, + name: str, + version: str, + evaluator_version: EvaluatorVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + def update_version( + self, + name: str, + version: str, + evaluator_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + @overload + def update_version( + self, + name: str, + version: str, + evaluator_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluatorVersion: ... + + + class azure.ai.projects.operations.BetaInsightsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def generate( + self, + insight: Insight, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Insight: ... + + @overload + def generate( + self, + insight: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Insight: ... + + @overload + def generate( + self, + insight: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Insight: ... + + @distributed_trace + def get( + self, + insight_id: str, + *, + include_coordinates: Optional[bool] = ..., + **kwargs: Any + ) -> Insight: ... + + @distributed_trace + def list( + self, + *, + agent_name: Optional[str] = ..., + eval_id: Optional[str] = ..., + include_coordinates: Optional[bool] = ..., + run_id: Optional[str] = ..., + type: Optional[Union[str, InsightType]] = ..., + **kwargs: Any + ) -> ItemPaged[Insight]: ... + + + class azure.ai.projects.operations.BetaMemoryStoresOperations(GenerateBetaMemoryStoresOperations): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_update_memories( + self, + name: str, + *, + content_type: str = "application/json", + items: Optional[Union[str, ResponseInputParam]] = ..., + previous_update_id: Optional[str] = ..., + scope: str, + update_delay: Optional[int] = ..., + **kwargs: Any + ) -> UpdateMemoriesLROPoller: ... + + @overload + def begin_update_memories( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> UpdateMemoriesLROPoller: ... + + @overload + def begin_update_memories( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> UpdateMemoriesLROPoller: ... + + @overload + def create( + self, + *, + content_type: str = "application/json", + definition: MemoryStoreDefinition, + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + name: str, + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + def create( + self, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + def create( + self, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + def create_memory( + self, + name: str, + *, + content: str, + content_type: str = "application/json", + kind: Union[str, MemoryItemKind], + scope: str, + **kwargs: Any + ) -> MemoryItem: ... + + @overload + def create_memory( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + @overload + def create_memory( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + @distributed_trace + def delete( + self, + name: str, + **kwargs: Any + ) -> DeleteMemoryStoreResult: ... + + @distributed_trace + def delete_memory( + self, + name: str, + memory_id: str, + **kwargs: Any + ) -> DeleteMemoryResult: ... + + @overload + def delete_scope( + self, + name: str, + *, + content_type: str = "application/json", + scope: str, + **kwargs: Any + ) -> MemoryStoreDeleteScopeResult: ... + + @overload + def delete_scope( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDeleteScopeResult: ... + + @overload + def delete_scope( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDeleteScopeResult: ... + + @distributed_trace + def get( + self, + name: str, + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @distributed_trace + def get_memory( + self, + name: str, + memory_id: str, + **kwargs: Any + ) -> MemoryItem: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[MemoryStoreDetails]: ... + + @overload + def list_memories( + self, + name: str, + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[Union[str, MemoryItemKind]] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + scope: str, + **kwargs: Any + ) -> ItemPaged[MemoryItem]: ... + + @overload + def list_memories( + self, + name: str, + body: JSON, + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[Union[str, MemoryItemKind]] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[MemoryItem]: ... + + @overload + def list_memories( + self, + name: str, + body: IO[bytes], + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[Union[str, MemoryItemKind]] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[MemoryItem]: ... + + @overload + def search_memories( + self, + name: str, + *, + content_type: str = "application/json", + items: Optional[Union[str, ResponseInputParam]] = ..., + options: Optional[MemorySearchOptions] = ..., + previous_search_id: Optional[str] = ..., + scope: str, + **kwargs: Any + ) -> MemoryStoreSearchResult: ... + + @overload + def search_memories( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreSearchResult: ... + + @overload + def search_memories( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreSearchResult: ... + + @overload + def update( + self, + name: str, + *, + content_type: str = "application/json", + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + def update( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + def update( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryStoreDetails: ... + + @overload + def update_memory( + self, + name: str, + memory_id: str, + *, + content: str, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + @overload + def update_memory( + self, + name: str, + memory_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + @overload + def update_memory( + self, + name: str, + memory_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> MemoryItem: ... + + + class azure.ai.projects.operations.BetaModelsOperations(BetaModelsOperationsGenerated): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create( + self, + *, + azcopy_path: Optional[str] = ..., + base_model: Optional[str] = ..., + description: Optional[str] = ..., + name: str, + polling_interval: float = 2.0, + polling_timeout: float = 300.0, + source: Union[str, PathLike[str]], + tags: Optional[dict[str, str]] = ..., + version: str, + wait_for_commit: Literal[True] = True, + weight_type: Optional[str] = ..., + **kwargs: Any + ) -> ModelVersion: ... + + @overload + def create( + self, + *, + azcopy_path: Optional[str] = ..., + base_model: Optional[str] = ..., + description: Optional[str] = ..., + name: str, + polling_interval: float = 2.0, + polling_timeout: float = 300.0, + source: Union[str, PathLike[str]], + tags: Optional[dict[str, str]] = ..., + version: str, + wait_for_commit: Literal[False], + weight_type: Optional[str] = ..., + **kwargs: Any + ) -> None: ... + + @distributed_trace + def delete( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + name: str, + version: str, + **kwargs: Any + ) -> ModelVersion: ... + + @overload + def get_credentials( + self, + name: str, + version: str, + credential_request: ModelCredentialRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @overload + def get_credentials( + self, + name: str, + version: str, + credential_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @overload + def get_credentials( + self, + name: str, + version: str, + credential_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DatasetCredential: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[ModelVersion]: ... + + @distributed_trace + def list_versions( + self, + name: str, + **kwargs: Any + ) -> ItemPaged[ModelVersion]: ... + + @overload + def pending_create_version( + self, + name: str, + version: str, + model_version: ModelVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CreateAsyncResponse: ... + + @overload + def pending_create_version( + self, + name: str, + version: str, + model_version: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CreateAsyncResponse: ... + + @overload + def pending_create_version( + self, + name: str, + version: str, + model_version: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CreateAsyncResponse: ... + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: ModelPendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ModelPendingUploadResponse: ... + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ModelPendingUploadResponse: ... + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ModelPendingUploadResponse: ... + + @overload + def update( + self, + name: str, + version: str, + model_version_update: UpdateModelVersionRequest, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> ModelVersion: ... + + @overload + def update( + self, + name: str, + version: str, + model_version_update: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> ModelVersion: ... + + @overload + def update( + self, + name: str, + version: str, + model_version_update: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> ModelVersion: ... + + + class azure.ai.projects.operations.BetaOperations(GeneratedBetaOperations): + agents: BetaAgentsOperations + datasets: BetaDatasetsOperations + evaluation_taxonomies: BetaEvaluationTaxonomiesOperations + evaluators: BetaEvaluatorsOperations + insights: BetaInsightsOperations + memory_stores: BetaMemoryStoresOperations + models: BetaModelsOperations + red_teams: BetaRedTeamsOperations + routines: BetaRoutinesOperations + schedules: BetaSchedulesOperations + skills: BetaSkillsOperations + + def __init__( + self, + *args: Any, + **kwargs: Any + ) -> None: ... + + + class azure.ai.projects.operations.BetaRedTeamsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create( + self, + red_team: RedTeam, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> RedTeam: ... + + @overload + def create( + self, + red_team: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> RedTeam: ... + + @overload + def create( + self, + red_team: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> RedTeam: ... + + @distributed_trace + def get( + self, + name: str, + **kwargs: Any + ) -> RedTeam: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[RedTeam]: ... + + + class azure.ai.projects.operations.BetaRoutinesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_or_update( + self, + routine_name: str, + *, + action: Optional[RoutineAction] = ..., + content_type: str = "application/json", + description: Optional[str] = ..., + enabled: Optional[bool] = ..., + triggers: Optional[dict[str, RoutineTrigger]] = ..., + **kwargs: Any + ) -> Routine: ... + + @overload + def create_or_update( + self, + routine_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Routine: ... + + @overload + def create_or_update( + self, + routine_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Routine: ... + + @distributed_trace + def delete( + self, + routine_name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def disable( + self, + routine_name: str, + **kwargs: Any + ) -> Routine: ... + + @overload + def dispatch( + self, + routine_name: str, + *, + content_type: str = "application/json", + payload: Optional[RoutineDispatchPayload] = ..., + **kwargs: Any + ) -> DispatchRoutineResult: ... + + @overload + def dispatch( + self, + routine_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DispatchRoutineResult: ... + + @overload + def dispatch( + self, + routine_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DispatchRoutineResult: ... + + @distributed_trace + def enable( + self, + routine_name: str, + **kwargs: Any + ) -> Routine: ... + + @distributed_trace + def get( + self, + routine_name: str, + **kwargs: Any + ) -> Routine: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[str] = ..., + **kwargs: Any + ) -> ItemPaged[Routine]: ... + + @distributed_trace + def list_runs( + self, + routine_name: str, + *, + before: Optional[str] = ..., + filter: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[str] = ..., + **kwargs: Any + ) -> ItemPaged[RoutineRun]: ... + + + class azure.ai.projects.operations.BetaSchedulesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_or_update( + self, + schedule_id: str, + schedule: Schedule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Schedule: ... + + @overload + def create_or_update( + self, + schedule_id: str, + schedule: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Schedule: ... + + @overload + def create_or_update( + self, + schedule_id: str, + schedule: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Schedule: ... + + @distributed_trace + def delete( + self, + schedule_id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + schedule_id: str, + **kwargs: Any + ) -> Schedule: ... + + @distributed_trace + def get_run( + self, + schedule_id: str, + run_id: str, + **kwargs: Any + ) -> ScheduleRun: ... + + @distributed_trace + def list( + self, + *, + enabled: Optional[bool] = ..., + type: Optional[Union[str, ScheduleTaskType]] = ..., + **kwargs: Any + ) -> ItemPaged[Schedule]: ... + + @distributed_trace + def list_runs( + self, + schedule_id: str, + *, + enabled: Optional[bool] = ..., + type: Optional[Union[str, ScheduleTaskType]] = ..., + **kwargs: Any + ) -> ItemPaged[ScheduleRun]: ... + + + class azure.ai.projects.operations.BetaSkillsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create( + self, + name: str, + *, + content_type: str = "application/json", + default: Optional[bool] = ..., + inline_content: Optional[SkillInlineContent] = ..., + **kwargs: Any + ) -> SkillVersion: ... + + @overload + def create( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillVersion: ... + + @overload + def create( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillVersion: ... + + @overload + def create_from_files( + self, + name: str, + content: CreateSkillVersionFromFilesBody, + **kwargs: Any + ) -> SkillVersion: ... + + @overload + def create_from_files( + self, + name: str, + content: JSON, + **kwargs: Any + ) -> SkillVersion: ... + + @distributed_trace + def delete( + self, + name: str, + **kwargs: Any + ) -> DeleteSkillResult: ... + + @distributed_trace + def delete_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> DeleteSkillVersionResult: ... + + @distributed_trace + def download( + self, + name: str, + **kwargs: Any + ) -> Iterator[bytes]: ... + + @distributed_trace + def download_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> Iterator[bytes]: ... + + @distributed_trace + def get( + self, + name: str, + **kwargs: Any + ) -> SkillDetails: ... + + @distributed_trace + def get_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> SkillVersion: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[SkillDetails]: ... + + @distributed_trace + def list_versions( + self, + name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[SkillVersion]: ... + + @overload + def update( + self, + name: str, + *, + content_type: str = "application/json", + default_version: str, + **kwargs: Any + ) -> SkillDetails: ... + + @overload + def update( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillDetails: ... + + @overload + def update( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SkillDetails: ... + + + class azure.ai.projects.operations.ConnectionsOperations(ConnectionsOperationsGenerated): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def get( + self, + name: str, + *, + include_credentials: Optional[bool] = False, + **kwargs: Any + ) -> Connection: ... + + @distributed_trace + def get_default( + self, + connection_type: Union[str, ConnectionType], + *, + include_credentials: Optional[bool] = False, + **kwargs: Any + ) -> Connection: ... + + @distributed_trace + def list( + self, + *, + connection_type: Optional[Union[str, ConnectionType]] = ..., + default_connection: Optional[bool] = ..., + **kwargs: Any + ) -> ItemPaged[Connection]: ... + + + class azure.ai.projects.operations.DatasetsOperations(DatasetsOperationsGenerated): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_or_update( + self, + name: str, + version: str, + dataset_version: DatasetVersion, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> DatasetVersion: ... + + @overload + def create_or_update( + self, + name: str, + version: str, + dataset_version: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> DatasetVersion: ... + + @overload + def create_or_update( + self, + name: str, + version: str, + dataset_version: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> DatasetVersion: ... + + @distributed_trace + def delete( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + name: str, + version: str, + **kwargs: Any + ) -> DatasetVersion: ... + + @distributed_trace + def get_credentials( + self, + name: str, + version: str, + **kwargs: Any + ) -> DatasetCredential: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[DatasetVersion]: ... + + @distributed_trace + def list_versions( + self, + name: str, + **kwargs: Any + ) -> ItemPaged[DatasetVersion]: ... + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: PendingUploadRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @overload + def pending_upload( + self, + name: str, + version: str, + pending_upload_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> PendingUploadResponse: ... + + @distributed_trace + def upload_file( + self, + *, + connection_name: Optional[str] = ..., + file_path: str, + name: str, + version: str, + **kwargs: Any + ) -> FileDatasetVersion: ... + + @distributed_trace + def upload_folder( + self, + *, + connection_name: Optional[str] = ..., + file_pattern: Optional[Pattern] = ..., + folder: str, + name: str, + version: str, + **kwargs: Any + ) -> FolderDatasetVersion: ... + + + class azure.ai.projects.operations.DeploymentsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def get( + self, + name: str, + **kwargs: Any + ) -> Deployment: ... + + @distributed_trace + def list( + self, + *, + deployment_type: Optional[Union[str, DeploymentType]] = ..., + model_name: Optional[str] = ..., + model_publisher: Optional[str] = ..., + **kwargs: Any + ) -> ItemPaged[Deployment]: ... + + + class azure.ai.projects.operations.EvaluationRulesOperations(GeneratedEvaluationRulesOperations): + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_or_update( + self, + id: str, + evaluation_rule: EvaluationRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationRule: ... + + @overload + def create_or_update( + self, + id: str, + evaluation_rule: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationRule: ... + + @overload + def create_or_update( + self, + id: str, + evaluation_rule: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> EvaluationRule: ... + + @distributed_trace + def delete( + self, + id: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + id: str, + **kwargs: Any + ) -> EvaluationRule: ... + + @distributed_trace + def list( + self, + *, + action_type: Optional[Union[str, EvaluationRuleActionType]] = ..., + agent_name: Optional[str] = ..., + enabled: Optional[bool] = ..., + **kwargs: Any + ) -> ItemPaged[EvaluationRule]: ... + + + class azure.ai.projects.operations.IndexesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_or_update( + self, + name: str, + version: str, + index: Index, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> Index: ... + + @overload + def create_or_update( + self, + name: str, + version: str, + index: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> Index: ... + + @overload + def create_or_update( + self, + name: str, + version: str, + index: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> Index: ... + + @distributed_trace + def delete( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + name: str, + version: str, + **kwargs: Any + ) -> Index: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[Index]: ... + + @distributed_trace + def list_versions( + self, + name: str, + **kwargs: Any + ) -> ItemPaged[Index]: ... + + + class azure.ai.projects.operations.TelemetryOperations: + + def __init__(self, outer_instance: AIProjectClient) -> None: ... + + @distributed_trace + def get_application_insights_connection_string(self) -> str: ... + + + class azure.ai.projects.operations.ToolboxesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create_version( + self, + name: str, + *, + content_type: str = "application/json", + description: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ..., + policies: Optional[ToolboxPolicies] = ..., + skills: Optional[List[ToolboxSkill]] = ..., + tools: List[Tool], + **kwargs: Any + ) -> ToolboxVersionObject: ... + + @overload + def create_version( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ToolboxVersionObject: ... + + @overload + def create_version( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ToolboxVersionObject: ... + + @distributed_trace + def delete( + self, + name: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def delete_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> None: ... + + @distributed_trace + def get( + self, + name: str, + **kwargs: Any + ) -> ToolboxObject: ... + + @distributed_trace + def get_version( + self, + name: str, + version: str, + **kwargs: Any + ) -> ToolboxVersionObject: ... + + @distributed_trace + def list( + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[ToolboxObject]: ... + + @distributed_trace + def list_versions( + self, + name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[Union[str, PageOrder]] = ..., + **kwargs: Any + ) -> ItemPaged[ToolboxVersionObject]: ... + + @overload + def update( + self, + name: str, + *, + content_type: str = "application/json", + default_version: str, + **kwargs: Any + ) -> ToolboxObject: ... + + @overload + def update( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ToolboxObject: ... + + @overload + def update( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ToolboxObject: ... + + +namespace azure.ai.projects.telemetry + + def azure.ai.projects.telemetry.trace_function(span_name: Optional[str] = None) -> Callable: ... + + + class azure.ai.projects.telemetry.AIProjectInstrumentor: + + def __init__(self) -> None: ... + + def instrument( + self, + enable_content_recording: Optional[bool] = None, + enable_trace_context_propagation: Optional[bool] = None, + enable_baggage_propagation: Optional[bool] = None + ) -> None: ... + + def is_content_recording_enabled(self) -> bool: ... + + def is_instrumented(self) -> bool: ... + + def uninstrument(self) -> None: ... + + +``` \ No newline at end of file diff --git a/sdk/ai/azure-ai-projects/api.metadata.yml b/sdk/ai/azure-ai-projects/api.metadata.yml new file mode 100644 index 000000000000..538384a3372c --- /dev/null +++ b/sdk/ai/azure-ai-projects/api.metadata.yml @@ -0,0 +1,3 @@ +apiMdSha256: 2515589fc688e1a9369aadfd0922bb686ddc1081f2fc8e4ebbd4241238336162 +parserVersion: 0.3.28 +pythonVersion: 3.14.3 diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py index 8f9496fa4c2b..9b1acdd6cd31 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_agents_async.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from pathlib import Path from typing import Union, Optional, Any, IO, overload from azure.core.exceptions import HttpResponseError diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py index 6325885c2947..19a0c25317b2 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_agents.py @@ -216,7 +216,6 @@ def create_version( raise new_exc from exc raise - @distributed_trace def upload_session_file( # type: ignore[override] self,