diff --git a/sdk/ai/azure-ai-projects/PostEmitter.ps1 b/sdk/ai/azure-ai-projects/PostEmitter.ps1 index c5ae7d169221..7fc18b1e0a77 100644 --- a/sdk/ai/azure-ai-projects/PostEmitter.ps1 +++ b/sdk/ai/azure-ai-projects/PostEmitter.ps1 @@ -86,6 +86,31 @@ foreach ($f in $files) { Set-Content $f $c -NoNewline } +# Fix generated multipart upload operations. The emitter currently generates +# JSON builders for multipart endpoints and retains a runtime-model as_dict() +# path even though Projects now uses TypedDict payloads for these request bodies. +$syncOperationsFile = 'azure\ai\projects\operations\_operations.py' +$c = Get-Content $syncOperationsFile -Raw +$c = $c -replace 'from \.\._utils\.utils import prepare_multipart_form_data', 'from .._utils.utils import FileType, prepare_multipart_form_data' +$c = $c -replace 'agent_name: str, \*, code_zip_sha256: str, json: _types\._CreateAgentVersionFromCodeContent, \*\*kwargs: Any', 'agent_name: str, *, code_zip_sha256: str, files: list[FileType], **kwargs: Any' +$c = $c -replace 'name: str, \*, json: _types\.CreateSkillVersionFromFilesBody, \*\*kwargs: Any', 'name: str, *, files: list[FileType], **kwargs: Any' +$c = [regex]::Replace($c, '(?s)(def build_agents_create_version_from_code_request.*?return HttpRequest\(method="POST", url=_url, params=_params, headers=_headers, )json=json(, \*\*kwargs\))', '$1files=files$2', 1) +$c = [regex]::Replace($c, '(?s)(def build_beta_skills_create_from_files_request.*?return HttpRequest\(method="POST", url=_url, params=_params, headers=_headers, )json=json(, \*\*kwargs\))', '$1files=files$2', 1) +Set-Content $syncOperationsFile $c -NoNewline + +$files = 'azure\ai\projects\operations\_operations.py', 'azure\ai\projects\aio\operations\_operations.py' +$typedDictMultipartBody = @" + if not isinstance(content, MutableMapping): + raise TypeError("content must be a mapping") + _body = content + +"@ +foreach ($f in $files) { + $c = Get-Content $f -Raw + $c = $c -replace ' _body = content\.as_dict\(\) if isinstance\(content, _Model\) else content\r?\n', $typedDictMultipartBody + Set-Content $f $c -NoNewline +} + # A block of code in the implementation of "list_memories", in both sync # and async _operations.py files, needs to be moved up. It's emitted in the wrong place, # in the inline function named "prepare_request". Instead it should be moved up into the @@ -160,6 +185,51 @@ foreach ($f in $files) { Set-Content $f $c -NoNewline } +# Generate shared TypedDict model contracts directly into azure-ai-extensions-openai +# and leave local azure.ai.projects files as compatibility re-export shims. +python ..\azure-ai-extensions-openai\_scripts\generate_shared_models.py projects +python _scripts\write_extension_type_shims.py + +# Keep public model exports limited to models/enums defined by generated modules. +# Star imports from generated _models.py otherwise pull helper imports like +# datetime, Any, FileType, rest_field, Enum, and CaseInsensitiveEnumMeta into +# azure.ai.projects.models and APIView. +@' +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from . import _enums as _enums_module +from . import _models as _models_module +from ._models import * # type: ignore # noqa: F401,F403 +from ._enums import * # type: ignore # noqa: F401,F403 +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + name + for module in (_models_module, _enums_module) + for name, value in vars(module).items() + if not name.startswith("_") and isinstance(value, type) and getattr(value, "__module__", None) == module.__name__ +] # pyright: ignore +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +for _name in list(globals()): + if not _name.startswith("_") and _name not in __all__: + del globals()[_name] +_patch_sdk() +'@ | Set-Content 'azure\ai\projects\models\__init__.py' -NoNewline + # Finishing by running 'black' tool to format code. pip install black diff --git a/sdk/ai/azure-ai-projects/_scripts/write_extension_type_shims.py b/sdk/ai/azure-ai-projects/_scripts/write_extension_type_shims.py new file mode 100644 index 000000000000..b3b45c1992fc --- /dev/null +++ b/sdk/ai/azure-ai-projects/_scripts/write_extension_type_shims.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""Write local compatibility shims for extension-owned Projects types.""" + +from __future__ import annotations + +import argparse +from pathlib import Path + + +COPYRIGHT = "# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT license.\n" + +TYPES_SHIM = ( + COPYRIGHT + + '"""Compatibility re-export for extension-owned Azure AI Projects generated types."""\n\n' + + "from azure.ai.extensions.openai.projects._generated import types as _extension_types\n" + + "from azure.ai.extensions.openai.projects._generated.types import * # type: ignore # noqa: F401,F403\n\n" + + "for _name in dir(_extension_types):\n" + + ' if not _name.startswith("__"):\n' + + " globals()[_name] = getattr(_extension_types, _name)\n" +) + +UNIONS_SHIM = ( + COPYRIGHT + + '"""Compatibility re-export for extension-owned Azure AI Projects generated types."""\n\n' + + "from azure.ai.extensions.openai.projects._generated._unions import * # type: ignore # noqa: F401,F403\n" +) + + +def _write(path: Path, content: str) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(content, encoding="utf-8") + + +def write_shims(package_root: Path) -> None: + _write(package_root / "azure" / "ai" / "projects" / "types.py", TYPES_SHIM) + _write(package_root / "azure" / "ai" / "projects" / "_unions.py", UNIONS_SHIM) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--package-root", type=Path, default=Path(".")) + args = parser.parse_args() + write_shims(args.package_root) + + +if __name__ == "__main__": + main() diff --git a/sdk/ai/azure-ai-projects/api.md b/sdk/ai/azure-ai-projects/api.md index f9aef5d02952..56da3dd82616 100644 --- a/sdk/ai/azure-ai-projects/api.md +++ b/sdk/ai/azure-ai-projects/api.md @@ -1,7 +1,7 @@ ```py namespace azure.ai.projects - class azure.ai.projects.AIProjectClient(AIProjectClientGenerated): implements ContextManager + class azure.ai.projects.AIProjectClient(AIProjectClientGenerated): implements ContextManager agents: AgentsOperations beta: BetaOperations connections: ConnectionsOperations @@ -11,12 +11,12 @@ namespace azure.ai.projects indexes: IndexesOperations def __init__( - self, - endpoint: str, - credential: TokenCredential, - *, - allow_preview: bool = False, - api_version: str = ..., + self, + endpoint: str, + credential: TokenCredential, + *, + allow_preview: bool = False, + api_version: str = ..., **kwargs: Any ) -> None: ... @@ -24,24 +24,24 @@ namespace azure.ai.projects @distributed_trace def get_openai_client( - self, - *, - agent_name: Optional[str] = ..., + self, + *, + agent_name: Optional[str] = ..., **kwargs: Any ) -> OpenAI: ... def send_request( - self, - request: HttpRequest, - *, - stream: bool = False, + self, + request: HttpRequest, + *, + stream: bool = False, **kwargs: Any ) -> HttpResponse: ... namespace azure.ai.projects.aio - class azure.ai.projects.aio.AIProjectClient(AIProjectClientGenerated): implements AsyncContextManager + class azure.ai.projects.aio.AIProjectClient(AIProjectClientGenerated): implements AsyncContextManager agents: AgentsOperations beta: BetaOperations connections: ConnectionsOperations @@ -51,12 +51,12 @@ namespace azure.ai.projects.aio indexes: IndexesOperations def __init__( - self, - endpoint: str, - credential: AsyncTokenCredential, - *, - allow_preview: bool = False, - api_version: str = ..., + self, + endpoint: str, + credential: AsyncTokenCredential, + *, + allow_preview: bool = False, + api_version: str = ..., **kwargs: Any ) -> None: ... @@ -64,17 +64,17 @@ namespace azure.ai.projects.aio @distributed_trace def get_openai_client( - self, - *, - agent_name: Optional[str] = ..., + self, + *, + agent_name: Optional[str] = ..., **kwargs: Any ) -> AsyncOpenAI: ... def send_request( - self, - request: HttpRequest, - *, - stream: bool = False, + self, + request: HttpRequest, + *, + stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: ... @@ -84,319 +84,289 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.AgentsOperations(GeneratedAgentsOperations): def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @overload async def create_session( - self, - agent_name: str, - *, - agent_session_id: Optional[str] = ..., - content_type: str = "application/json", - version_indicator: VersionIndicator, + self, + agent_name: str, + *, + agent_session_id: Optional[str] = ..., + content_type: str = "application/json", + version_indicator: VersionIndicator, **kwargs: Any ) -> AgentSessionResource: ... @overload async def create_session( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AgentSessionResource: ... - - @overload - async def create_session( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + agent_name: str, + body: CreateSessionRequest, + *, + content_type: str = "application/json", **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] = ..., - draft: Optional[bool] = ..., - metadata: Optional[dict[str, str]] = ..., + self, + agent_name: str, + *, + blueprint_reference: Optional[AgentBlueprintReference] = ..., + content_type: str = "application/json", + definition: AgentDefinition, + description: Optional[str] = ..., + draft: Optional[bool] = ..., + metadata: Optional[dict[str, str]] = ..., **kwargs: Any ) -> AgentVersionDetails: ... @overload async def create_version( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", + 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", + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any ) -> AgentVersionDetails: ... @distributed_trace_async async def create_version_from_code( - self, - agent_name: str, - *, - code: IO[bytes], - code_zip_sha256: Optional[str] = ..., - definition: HostedAgentDefinition, - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., + self, + agent_name: str, + *, + code: IO[bytes], + code_zip_sha256: Optional[str] = ..., + definition: HostedAgentDefinition, + description: Optional[str] = ..., + metadata: Optional[dict[str, 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], + 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", + self, + agent_name: str, + body: CreateAgentVersionFromManifestRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AgentVersionDetails: ... @distributed_trace_async async def delete( - self, - agent_name: str, - *, - force: Optional[bool] = ..., + self, + agent_name: str, + *, + force: Optional[bool] = ..., **kwargs: Any ) -> DeleteAgentResponse: ... @distributed_trace_async async def delete_session( - self, - agent_name: str, - session_id: str, + self, + agent_name: str, + session_id: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def delete_session_file( - self, - agent_name: str, - session_id: str, - *, - path: str, - recursive: Optional[bool] = ..., + self, + agent_name: str, + session_id: str, + *, + path: str, + recursive: Optional[bool] = ..., **kwargs: Any ) -> None: ... @distributed_trace_async async def delete_version( - self, - agent_name: str, - agent_version: str, - *, - force: Optional[bool] = ..., + self, + agent_name: str, + agent_version: str, + *, + force: Optional[bool] = ..., **kwargs: Any ) -> DeleteAgentVersionResponse: ... @distributed_trace_async async def disable( - self, - agent_name: str, + self, + agent_name: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def download_code( - self, - agent_name: str, - *, - agent_version: Optional[str] = ..., + self, + agent_name: str, + *, + agent_version: Optional[str] = ..., **kwargs: Any ) -> AsyncIterator[bytes]: ... @distributed_trace_async async def download_session_file( - self, - agent_name: str, - session_id: str, - *, - path: str, + self, + agent_name: str, + session_id: str, + *, + path: str, **kwargs: Any ) -> AsyncIterator[bytes]: ... @distributed_trace_async async def enable( - self, - agent_name: str, + self, + agent_name: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get( - self, - agent_name: str, + self, + agent_name: str, **kwargs: Any ) -> AgentDetails: ... @distributed_trace_async async def get_session( - self, - agent_name: str, - session_id: str, + self, + agent_name: str, + session_id: str, **kwargs: Any ) -> AgentSessionResource: ... @distributed_trace_async async def get_session_log_stream( - self, - agent_name: str, - agent_version: str, - session_id: str, + 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, + 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]] = ..., + self, + *, + before: Optional[str] = ..., + kind: Optional[AgentKind] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> AsyncItemPaged[AgentDetails]: ... @distributed_trace def list_session_files( - self, - agent_name: str, - session_id: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - path: Optional[str] = ..., + self, + agent_name: str, + session_id: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., + path: 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]] = ..., + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> AsyncItemPaged[AgentSessionResource]: ... @distributed_trace def list_versions( - self, - agent_name: str, - *, - before: Optional[str] = ..., - include_drafts: Optional[bool] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + agent_name: str, + *, + before: Optional[str] = ..., + include_drafts: Optional[bool] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> AsyncItemPaged[AgentVersionDetails]: ... @distributed_trace_async async def stop_session( - self, - agent_name: str, - session_id: str, + self, + agent_name: str, + session_id: str, **kwargs: Any ) -> None: ... @overload async def update_details( - self, - agent_name: str, - *, - agent_card: Optional[AgentCard] = ..., - agent_endpoint: Optional[AgentEndpointConfig] = ..., - content_type: str = "application/merge-patch+json", + 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 update_details( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AgentDetails: ... - - @overload - async def update_details( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", + self, + agent_name: str, + body: PatchAgentObjectRequest, + *, + content_type: str = "application/merge-patch+json", **kwargs: Any ) -> AgentDetails: ... @distributed_trace_async async def upload_session_file( - self, - agent_name: str, - session_id: str, - content: bytes, - *, - path: str, + self, + agent_name: str, + session_id: str, + content: bytes, + *, + path: str, **kwargs: Any ) -> SessionFileWriteResult: ... @@ -404,71 +374,50 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaAgentsOperations: def __init__( - self, - *args, + 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] = ..., + self, + job_id: str, **kwargs: Any ) -> OptimizationJob: ... - @overload + @distributed_trace_async async def create_optimization_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., + self, + job: OptimizationJob, + *, + operation_id: Optional[str] = ..., **kwargs: Any ) -> OptimizationJob: ... @distributed_trace_async async def delete_optimization_job( - self, - job_id: str, + self, + job_id: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get_optimization_job( - self, - job_id: str, + 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]] = ..., + self, + *, + agent_name: Optional[str] = ..., + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., + status: Optional[JobStatus] = ..., **kwargs: Any ) -> AsyncItemPaged[OptimizationJobListItem]: ... @@ -476,69 +425,48 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaDatasetsOperations: def __init__( - self, - *args, + 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] = ..., + self, + job_id: 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 + @distributed_trace_async async def create_generation_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., + self, + job: DataGenerationJob, + *, + operation_id: Optional[str] = ..., **kwargs: Any ) -> DataGenerationJob: ... @distributed_trace_async async def delete_generation_job( - self, - job_id: str, + self, + job_id: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get_generation_job( - self, - job_id: str, + 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]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> AsyncItemPaged[DataGenerationJob]: ... @@ -546,91 +474,47 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaEvaluationTaxonomiesOperations: def __init__( - self, - *args, + 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 + @distributed_trace_async async def create( - self, - name: str, - taxonomy: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + taxonomy: EvaluationTaxonomy, **kwargs: Any ) -> EvaluationTaxonomy: ... @distributed_trace_async async def delete( - self, - name: str, + self, + name: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> EvaluationTaxonomy: ... @distributed_trace def list( - self, - *, - input_name: Optional[str] = ..., - input_type: Optional[str] = ..., + 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 + @distributed_trace_async async def update( - self, - name: str, - taxonomy: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + taxonomy: EvaluationTaxonomy, **kwargs: Any ) -> EvaluationTaxonomy: ... @@ -638,233 +522,118 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaEvaluatorsOperations: def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @distributed_trace_async async def cancel_generation_job( - self, - job_id: str, + 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 + @distributed_trace_async async def create_generation_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., + self, + job: EvaluatorGenerationJob, + *, + 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 + @distributed_trace_async async def create_version( - self, - name: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + evaluator_version: EvaluatorVersion, **kwargs: Any ) -> EvaluatorVersion: ... @distributed_trace_async async def delete_generation_job( - self, - job_id: str, + self, + job_id: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def delete_version( - self, - name: str, - version: str, + 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 + @distributed_trace_async async def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + credential_request: EvaluatorCredentialRequest, **kwargs: Any ) -> DatasetCredential: ... @distributed_trace_async async def get_generation_job( - self, - job_id: str, + self, + job_id: str, **kwargs: Any ) -> EvaluatorGenerationJob: ... @distributed_trace_async async def get_version( - self, - name: str, - version: str, + 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]] = ..., + 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]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[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]] = ..., + 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 + @distributed_trace_async async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + pending_upload_request: PendingUploadRequest, **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 + @distributed_trace_async async def update_version( - self, - name: str, - version: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + evaluator_version: EvaluatorVersion, **kwargs: Any ) -> EvaluatorVersion: ... @@ -872,56 +641,36 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaInsightsOperations: def __init__( - self, - *args, + 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 + @distributed_trace_async async def generate( - self, - insight: IO[bytes], - *, - content_type: str = "application/json", + self, + insight: Insight, **kwargs: Any ) -> Insight: ... @distributed_trace_async async def get( - self, - insight_id: str, - *, - include_coordinates: Optional[bool] = ..., + 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]] = ..., + self, + *, + agent_name: Optional[str] = ..., + eval_id: Optional[str] = ..., + include_coordinates: Optional[bool] = ..., + run_id: Optional[str] = ..., + type: Optional[InsightType] = ..., **kwargs: Any ) -> AsyncItemPaged[Insight]: ... @@ -929,312 +678,228 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaMemoryStoresOperations(GenerateBetaMemoryStoresOperations): def __init__( - self, - *args, + 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] = ..., + 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", + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", + self, + body: CreateMemoryStoreRequest, + *, + 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", + self, + name: str, + *, + content: str, + content_type: str = "application/json", + kind: MemoryItemKind, + scope: str, **kwargs: Any ) -> MemoryItem: ... @overload async def create_memory( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: CreateMemoryRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> MemoryItem: ... @distributed_trace_async async def delete( - self, - name: str, + self, + name: str, **kwargs: Any ) -> DeleteMemoryStoreResult: ... @distributed_trace_async async def delete_memory( - self, - name: str, - memory_id: str, + self, + name: str, + memory_id: str, **kwargs: Any ) -> DeleteMemoryResult: ... @overload async def delete_scope( - self, - name: str, - *, - content_type: str = "application/json", - scope: str, + 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", + self, + name: str, + body: DeleteScopeRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> MemoryStoreDeleteScopeResult: ... @distributed_trace_async async def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> MemoryStoreDetails: ... @distributed_trace_async async def get_memory( - self, - name: str, - memory_id: str, + 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]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[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, + self, + name: str, + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[MemoryItemKind] = ..., + limit: Optional[int] = ..., + order: Optional[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]] = ..., + self, + name: str, + body: ListMemoriesRequest, + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[MemoryItemKind] = ..., + limit: Optional[int] = ..., + order: Optional[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, + 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", + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: UpdateMemoryStoreRequest, + *, + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + memory_id: str, + body: UpdateMemoryRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> MemoryItem: ... @@ -1242,91 +907,67 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaModelsOperations(BetaModelsOperationsGenerated): def __init__( - self, - *args, + 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] = ..., + 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] = ..., + 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, + self, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get( - self, - name: str, - version: str, + 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 + @distributed_trace_async async def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + credential_request: ModelCredentialRequest, **kwargs: Any ) -> DatasetCredential: ... @@ -1335,107 +976,35 @@ namespace azure.ai.projects.aio.operations @distributed_trace def list_versions( - self, - name: str, + 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 + @distributed_trace_async async def pending_create_version( - self, - name: str, - version: str, - model_version: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + model_version: ModelVersion, **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 + @distributed_trace_async async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + pending_upload_request: ModelPendingUploadRequest, **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 + @distributed_trace_async async def update( - self, - name: str, - version: str, - model_version_update: IO[bytes], - *, - content_type: str = "application/merge-patch+json", + self, + name: str, + version: str, + model_version_update: UpdateModelVersionRequest, **kwargs: Any ) -> ModelVersion: ... @@ -1454,8 +1023,8 @@ namespace azure.ai.projects.aio.operations skills: BetaSkillsOperations def __init__( - self, - *args: Any, + self, + *args: Any, **kwargs: Any ) -> None: ... @@ -1463,42 +1032,22 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaRedTeamsOperations: def __init__( - self, - *args, + 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 + @distributed_trace_async async def create( - self, - red_team: IO[bytes], - *, - content_type: str = "application/json", + self, + red_team: RedTeam, **kwargs: Any ) -> RedTeam: ... @distributed_trace_async async def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> RedTeam: ... @@ -1509,121 +1058,101 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaRoutinesOperations: def __init__( - self, - *args, + 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]] = ..., + 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", + self, + routine_name: str, + body: CreateOrUpdateRoutineRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> Routine: ... @distributed_trace_async async def delete( - self, - routine_name: str, + self, + routine_name: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def disable( - self, - routine_name: str, + 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", + self, + routine_name: str, + *, + content_type: str = "application/json", + payload: Optional[RoutineDispatchPayload] = ..., **kwargs: Any ) -> DispatchRoutineResult: ... @overload async def dispatch( - self, - routine_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + routine_name: str, + body: DispatchRoutineAsyncRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> DispatchRoutineResult: ... @distributed_trace_async async def enable( - self, - routine_name: str, + self, + routine_name: str, **kwargs: Any ) -> Routine: ... @distributed_trace_async async def get( - self, - routine_name: str, + self, + routine_name: str, **kwargs: Any ) -> Routine: ... @distributed_trace def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[str] = ..., + 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] = ..., + self, + routine_name: str, + *, + before: Optional[str] = ..., + filter: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[str] = ..., **kwargs: Any ) -> AsyncItemPaged[RoutineRun]: ... @@ -1631,79 +1160,57 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaSchedulesOperations: def __init__( - self, - *args, + 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 + @distributed_trace_async async def create_or_update( - self, - schedule_id: str, - schedule: IO[bytes], - *, - content_type: str = "application/json", + self, + schedule_id: str, + schedule: Schedule, **kwargs: Any ) -> Schedule: ... @distributed_trace_async async def delete( - self, - schedule_id: str, + self, + schedule_id: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get( - self, - schedule_id: str, + self, + schedule_id: str, **kwargs: Any ) -> Schedule: ... @distributed_trace_async async def get_run( - self, - schedule_id: str, - run_id: str, + self, + schedule_id: str, + run_id: str, **kwargs: Any ) -> ScheduleRun: ... @distributed_trace def list( - self, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., + self, + *, + enabled: Optional[bool] = ..., + type: Optional[ScheduleTaskType] = ..., **kwargs: Any ) -> AsyncItemPaged[Schedule]: ... @distributed_trace def list_runs( - self, - schedule_id: str, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., + self, + schedule_id: str, + *, + enabled: Optional[bool] = ..., + type: Optional[ScheduleTaskType] = ..., **kwargs: Any ) -> AsyncItemPaged[ScheduleRun]: ... @@ -1711,151 +1218,123 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.BetaSkillsOperations: def __init__( - self, - *args, + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: CreateSkillVersionRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> SkillVersion: ... - @overload - async def create_from_files( - self, - name: str, - content: CreateSkillVersionFromFilesBody, - **kwargs: Any - ) -> SkillVersion: ... - - @overload + @distributed_trace_async async def create_from_files( - self, - name: str, - content: JSON, + self, + name: str, + content: CreateSkillVersionFromFilesBody, **kwargs: Any ) -> SkillVersion: ... @distributed_trace_async async def delete( - self, - name: str, + self, + name: str, **kwargs: Any ) -> DeleteSkillResult: ... @distributed_trace_async async def delete_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> DeleteSkillVersionResult: ... @distributed_trace_async async def download( - self, - name: str, + self, + name: str, **kwargs: Any ) -> AsyncIterator[bytes]: ... @distributed_trace_async async def download_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> AsyncIterator[bytes]: ... @distributed_trace_async async def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> SkillDetails: ... @distributed_trace_async async def get_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> SkillVersion: ... @distributed_trace def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> AsyncItemPaged[SkillDetails]: ... @distributed_trace def list_versions( - self, - name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[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", + self, + name: str, + *, + content_type: str = "application/json", + default_version: str, **kwargs: Any ) -> SkillDetails: ... @overload async def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: UpdateSkillRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> SkillDetails: ... @@ -1863,35 +1342,35 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.ConnectionsOperations(ConnectionsOperationsGenerated): def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @distributed_trace_async async def get( - self, - name: str, - *, - include_credentials: Optional[bool] = False, + 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, + 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] = ..., + self, + *, + connection_type: Optional[ConnectionType] = ..., + default_connection: Optional[bool] = ..., **kwargs: Any ) -> AsyncItemPaged[Connection]: ... @@ -1899,65 +1378,41 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.DatasetsOperations(DatasetsOperationsGenerated): def __init__( - self, - *args, + 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 + @distributed_trace_async async def create_or_update( - self, - name: str, - version: str, - dataset_version: IO[bytes], - *, - content_type: str = "application/merge-patch+json", + self, + name: str, + version: str, + dataset_version: DatasetVersion, **kwargs: Any ) -> DatasetVersion: ... @distributed_trace_async async def delete( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> DatasetVersion: ... @distributed_trace_async async def get_credentials( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> DatasetCredential: ... @@ -1966,64 +1421,40 @@ namespace azure.ai.projects.aio.operations @distributed_trace def list_versions( - self, - name: str, + 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 + @distributed_trace_async async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + pending_upload_request: PendingUploadRequest, **kwargs: Any ) -> PendingUploadResponse: ... @distributed_trace_async async def upload_file( - self, - *, - connection_name: Optional[str] = ..., - file_path: str, - name: str, - version: str, + 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, + self, + *, + connection_name: Optional[str] = ..., + file_pattern: Optional[Pattern] = ..., + folder: str, + name: str, + version: str, **kwargs: Any ) -> FolderDatasetVersion: ... @@ -2031,25 +1462,25 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.DeploymentsOperations: def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @distributed_trace_async async def get( - self, - name: str, + 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] = ..., + self, + *, + deployment_type: Optional[DeploymentType] = ..., + model_name: Optional[str] = ..., + model_publisher: Optional[str] = ..., **kwargs: Any ) -> AsyncItemPaged[Deployment]: ... @@ -2057,62 +1488,62 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.EvaluationRulesOperations(GeneratedEvaluationRulesOperations): def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @overload async def create_or_update( - self, - id: str, - evaluation_rule: EvaluationRule, - *, - content_type: str = "application/json", + 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", + 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", + self, + id: str, + evaluation_rule: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any ) -> EvaluationRule: ... @distributed_trace_async async def delete( - self, - id: str, + self, + id: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get( - self, - id: str, + self, + id: str, **kwargs: Any ) -> EvaluationRule: ... @distributed_trace def list( - self, - *, - action_type: Optional[Union[str, EvaluationRuleActionType]] = ..., - agent_name: Optional[str] = ..., - enabled: Optional[bool] = ..., + self, + *, + action_type: Optional[EvaluationRuleActionType] = ..., + agent_name: Optional[str] = ..., + enabled: Optional[bool] = ..., **kwargs: Any ) -> AsyncItemPaged[EvaluationRule]: ... @@ -2120,57 +1551,33 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.IndexesOperations: def __init__( - self, - *args, + 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 + @distributed_trace_async async def create_or_update( - self, - name: str, - version: str, - index: IO[bytes], - *, - content_type: str = "application/merge-patch+json", + self, + name: str, + version: str, + index: Index, **kwargs: Any ) -> Index: ... @distributed_trace_async async def delete( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> Index: ... @@ -2179,8 +1586,8 @@ namespace azure.ai.projects.aio.operations @distributed_trace def list_versions( - self, - name: str, + self, + name: str, **kwargs: Any ) -> AsyncItemPaged[Index]: ... @@ -2196,123 +1603,103 @@ namespace azure.ai.projects.aio.operations class azure.ai.projects.aio.operations.ToolboxesOperations: def __init__( - self, - *args, + 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[ToolboxTool], + 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[ToolboxTool], **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", + self, + name: str, + body: CreateToolboxVersionRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> ToolboxVersionObject: ... @distributed_trace_async async def delete( - self, - name: str, + self, + name: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def delete_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace_async async def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> ToolboxObject: ... @distributed_trace_async async def get_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> ToolboxVersionObject: ... @distributed_trace def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> AsyncItemPaged[ToolboxObject]: ... @distributed_trace def list_versions( - self, - name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[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", + self, + name: str, + *, + content_type: str = "application/json", + default_version: str, **kwargs: Any ) -> ToolboxObject: ... @overload async def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: UpdateToolboxRequest1, + *, + content_type: str = "application/json", **kwargs: Any ) -> ToolboxObject: ... @@ -2328,11 +1715,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_card_path: Optional[str] = ..., - base_url: Optional[str] = ..., - project_connection_id: Optional[str] = ..., + self, + *, + agent_card_path: Optional[str] = ..., + base_url: Optional[str] = ..., + project_connection_id: Optional[str] = ..., send_credentials_for_agent_card: Optional[bool] = ... ) -> None: ... @@ -2352,14 +1739,14 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_card_path: Optional[str] = ..., - base_url: Optional[str] = ..., - description: Optional[str] = ..., - name: Optional[str] = ..., - project_connection_id: Optional[str] = ..., - send_credentials_for_agent_card: Optional[bool] = ..., + self, + *, + agent_card_path: Optional[str] = ..., + base_url: Optional[str] = ..., + description: Optional[str] = ..., + name: Optional[str] = ..., + project_connection_id: Optional[str] = ..., + send_credentials_for_agent_card: Optional[bool] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -2380,13 +1767,13 @@ namespace azure.ai.projects.models @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]] = ..., + 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: ... @@ -2399,8 +1786,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, enable_m365_public_endpoint: Optional[bool] = ... ) -> None: ... @@ -2413,8 +1800,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -2433,10 +1820,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - skills: list[AgentCardSkill], + self, + *, + description: Optional[str] = ..., + skills: list[AgentCardSkill], version: str ) -> None: ... @@ -2453,12 +1840,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - examples: Optional[list[str]] = ..., - id: str, - name: str, + self, + *, + description: Optional[str] = ..., + examples: Optional[list[str]] = ..., + id: str, + name: str, tags: Optional[list[str]] = ... ) -> None: ... @@ -2473,9 +1860,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_name: str, + self, + *, + agent_name: str, model_configuration: Optional[InsightModelConfiguration] = ... ) -> None: ... @@ -2489,8 +1876,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, cluster_insight: ClusterInsightResult ) -> None: ... @@ -2506,10 +1893,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_name: str, - agent_version: Optional[str] = ..., + self, + *, + agent_name: str, + agent_version: Optional[str] = ..., description: Optional[str] = ... ) -> None: ... @@ -2523,9 +1910,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - kind: str, + self, + *, + kind: str, rai_config: Optional[RaiConfig] = ... ) -> None: ... @@ -2547,13 +1934,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_card: Optional[AgentCard] = ..., - agent_endpoint: Optional[AgentEndpointConfig] = ..., - id: str, - name: str, - object: Literal[AgentObjectType.AGENT], + self, + *, + agent_card: Optional[AgentCard] = ..., + agent_endpoint: Optional[AgentEndpointConfig] = ..., + id: str, + name: str, + object: Literal[AgentObjectType.AGENT], versions: AgentObjectVersions ) -> None: ... @@ -2566,8 +1953,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -2589,10 +1976,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - authorization_schemes: Optional[list[AgentEndpointAuthorizationScheme]] = ..., - protocol_configuration: Optional[ProtocolConfiguration] = ..., + self, + *, + authorization_schemes: Optional[list[AgentEndpointAuthorizationScheme]] = ..., + protocol_configuration: Optional[ProtocolConfiguration] = ..., version_selector: Optional[VersionSelector] = ... ) -> None: ... @@ -2617,10 +2004,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_name: str, - agent_version: Optional[str] = ..., + self, + *, + agent_name: str, + agent_version: Optional[str] = ..., description: Optional[str] = ... ) -> None: ... @@ -2634,9 +2021,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - client_id: str, + self, + *, + client_id: str, principal_id: str ) -> None: ... @@ -2664,8 +2051,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, latest: AgentVersionDetails ) -> None: ... @@ -2683,10 +2070,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_session_id: str, - status: Union[str, AgentSessionStatus], + self, + *, + agent_session_id: str, + status: Union[str, AgentSessionStatus], version_indicator: VersionIndicator ) -> None: ... @@ -2717,9 +2104,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - risk_categories: list[Union[str, RiskCategory]], + self, + *, + risk_categories: list[Union[str, RiskCategory]], target: EvaluationTarget ) -> None: ... @@ -2745,17 +2132,17 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - created_at: datetime, - definition: AgentDefinition, - description: Optional[str] = ..., - draft: Optional[bool] = ..., - id: str, - metadata: dict[str, str], - name: str, - object: Literal[AgentObjectType.AGENT_VERSION], - status: Optional[Union[str, AgentVersionStatus]] = ..., + self, + *, + created_at: datetime, + definition: AgentDefinition, + description: Optional[str] = ..., + draft: Optional[bool] = ..., + id: str, + metadata: dict[str, str], + name: str, + object: Literal[AgentObjectType.AGENT_VERSION], + status: Optional[Union[str, AgentVersionStatus]] = ..., version: str ) -> None: ... @@ -2792,14 +2179,14 @@ namespace azure.ai.projects.models @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] = ..., + 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: ... @@ -2812,8 +2199,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, error: ApiError ) -> None: ... @@ -2851,11 +2238,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - city: Optional[str] = ..., - country: Optional[str] = ..., - region: Optional[str] = ..., + self, + *, + city: Optional[str] = ..., + country: Optional[str] = ..., + region: Optional[str] = ..., timezone: Optional[str] = ... ) -> None: ... @@ -2869,9 +2256,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - category: Union[str, FoundryModelArtifactProfileCategory], + self, + *, + category: Union[str, FoundryModelArtifactProfileCategory], signals: Optional[list[Union[str, FoundryModelArtifactProfileSignal]]] = ... ) -> None: ... @@ -2885,9 +2272,9 @@ namespace azure.ai.projects.models @classmethod def from_continuation_token( - cls, - polling_method: AsyncPollingMethod[MemoryStoreUpdateCompletedResult], - continuation_token: str, + cls, + polling_method: AsyncPollingMethod[MemoryStoreUpdateCompletedResult], + continuation_token: str, **kwargs: Any ) -> AsyncUpdateMemoriesLROPoller: ... @@ -2931,10 +2318,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - file_ids: Optional[list[str]] = ..., - memory_limit: Optional[Union[str, ContainerMemoryLimit]] = ..., + self, + *, + file_ids: Optional[list[str]] = ..., + memory_limit: Optional[Union[str, ContainerMemoryLimit]] = ..., network_policy: Optional[ContainerNetworkPolicyParam] = ... ) -> None: ... @@ -2951,11 +2338,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - name: str, - tool_descriptions: Optional[list[ToolDescription]] = ..., - tools: Optional[list[Tool]] = ..., + self, + *, + name: str, + tool_descriptions: Optional[list[ToolDescription]] = ..., + tools: Optional[list[Tool]] = ..., version: Optional[str] = ... ) -> None: ... @@ -2988,9 +2375,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - model: Optional[str] = ..., + self, + *, + model: Optional[str] = ..., sampling_params: Optional[ModelSamplingParams] = ... ) -> None: ... @@ -3024,12 +2411,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - connection_name: str, - description: Optional[str] = ..., - field_mapping: Optional[FieldMapping] = ..., - index_name: str, + self, + *, + connection_name: str, + description: Optional[str] = ..., + field_mapping: Optional[FieldMapping] = ..., + index_name: str, tags: Optional[dict[str, str]] = ... ) -> None: ... @@ -3054,11 +2441,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - azure_ai_search: AzureAISearchToolResource, - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + azure_ai_search: AzureAISearchToolResource, + description: Optional[str] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -3071,8 +2458,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, indexes: list[AISearchIndexResource] ) -> None: ... @@ -3089,11 +2476,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - azure_ai_search: AzureAISearchToolResource, - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + azure_ai_search: AzureAISearchToolResource, + description: Optional[str] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -3107,8 +2494,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, storage_queue: AzureFunctionStorageQueue ) -> None: ... @@ -3123,10 +2510,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - function: AzureFunctionDefinitionFunction, - input_binding: AzureFunctionBinding, + self, + *, + function: AzureFunctionDefinitionFunction, + input_binding: AzureFunctionBinding, output_binding: AzureFunctionBinding ) -> None: ... @@ -3141,10 +2528,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: str, + self, + *, + description: Optional[str] = ..., + name: str, parameters: dict[str, Any] ) -> None: ... @@ -3158,9 +2545,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - queue_name: str, + self, + *, + queue_name: str, queue_service_endpoint: str ) -> None: ... @@ -3175,9 +2562,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - azure_function: AzureFunctionDefinition, + self, + *, + azure_function: AzureFunctionDefinition, tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -3191,8 +2578,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, model_deployment_name: str ) -> None: ... @@ -3205,8 +2592,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -3224,13 +2611,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - count: Optional[int] = ..., - freshness: Optional[str] = ..., - instance_name: str, - market: Optional[str] = ..., - project_connection_id: str, + self, + *, + count: Optional[int] = ..., + freshness: Optional[str] = ..., + instance_name: str, + market: Optional[str] = ..., + project_connection_id: str, set_lang: Optional[str] = ... ) -> None: ... @@ -3244,8 +2631,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, bing_custom_search_preview: BingCustomSearchToolParameters ) -> None: ... @@ -3258,8 +2645,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, search_configurations: list[BingCustomSearchConfiguration] ) -> None: ... @@ -3276,12 +2663,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - count: Optional[int] = ..., - freshness: Optional[str] = ..., - market: Optional[str] = ..., - project_connection_id: str, + self, + *, + count: Optional[int] = ..., + freshness: Optional[str] = ..., + market: Optional[str] = ..., + project_connection_id: str, set_lang: Optional[str] = ... ) -> None: ... @@ -3294,8 +2681,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, search_configurations: list[BingGroundingSearchConfiguration] ) -> None: ... @@ -3312,11 +2699,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - bing_grounding: BingGroundingSearchToolParameters, - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + bing_grounding: BingGroundingSearchToolParameters, + description: Optional[str] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -3331,10 +2718,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - blob_uri: str, - credential: BlobReferenceSasCredential, + self, + *, + blob_uri: str, + credential: BlobReferenceSasCredential, storage_account_arm_id: str ) -> None: ... @@ -3347,8 +2734,8 @@ namespace azure.ai.projects.models type: Literal["SAS"] def __init__( - self, - *args: Any, + self, + *args: Any, **kwargs: Any ) -> None: ... @@ -3389,8 +2776,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, browser_automation_preview: BrowserAutomationToolParameters ) -> None: ... @@ -3407,11 +2794,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - browser_automation_preview: BrowserAutomationToolParameters, - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + browser_automation_preview: BrowserAutomationToolParameters, + description: Optional[str] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -3424,8 +2811,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, project_connection_id: str ) -> None: ... @@ -3438,8 +2825,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, connection: BrowserAutomationToolConnectionParameters ) -> None: ... @@ -3456,11 +2843,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - outputs: StructuredOutputDefinition, + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + outputs: StructuredOutputDefinition, tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -3475,10 +2862,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - size: int, - x: int, + self, + *, + size: int, + x: int, y: int ) -> None: ... @@ -3495,11 +2882,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - content: str, - memory_id: str, - scope: str, + self, + *, + content: str, + memory_id: str, + scope: str, updated_at: datetime ) -> None: ... @@ -3514,10 +2901,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - clusters: list[InsightCluster], - coordinates: Optional[dict[str, ChartCoordinate]] = ..., + self, + *, + clusters: list[InsightCluster], + coordinates: Optional[dict[str, ChartCoordinate]] = ..., summary: InsightSummary ) -> None: ... @@ -3532,10 +2919,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - input_token_usage: int, - output_token_usage: int, + self, + *, + input_token_usage: int, + output_token_usage: int, total_token_usage: int ) -> None: ... @@ -3555,14 +2942,14 @@ namespace azure.ai.projects.models @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]] = ..., + 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: ... @@ -3578,10 +2965,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - dependency_resolution: Union[str, CodeDependencyResolution], - entry_point: list[str], + self, + *, + dependency_resolution: Union[str, CodeDependencyResolution], + entry_point: list[str], runtime: str ) -> None: ... @@ -3603,11 +2990,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - container: Optional[Union[str, AutoCodeInterpreterToolParam]] = ..., - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + container: Optional[Union[str, AutoCodeInterpreterToolParam]] = ..., + description: Optional[str] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -3624,11 +3011,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - container: Optional[Union[str, AutoCodeInterpreterToolParam]] = ..., - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + container: Optional[Union[str, AutoCodeInterpreterToolParam]] = ..., + description: Optional[str] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -3643,10 +3030,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - key: str, - type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"], + self, + *, + key: str, + type: Literal["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"], value: Union[str, float, bool, list[Union[str, float]]] ) -> None: ... @@ -3660,9 +3047,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - filters: list[Union[ComparisonFilter, Any]], + self, + *, + filters: list[Union[ComparisonFilter, Any]], type: Literal["and", "or"] ) -> None: ... @@ -3696,10 +3083,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - display_height: int, - display_width: int, + self, + *, + display_height: int, + display_width: int, environment: Union[str, ComputerEnvironment] ) -> None: ... @@ -3739,11 +3126,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - file_ids: Optional[list[str]] = ..., - memory_limit: Optional[Union[str, ContainerMemoryLimit]] = ..., - network_policy: Optional[ContainerNetworkPolicyParam] = ..., + self, + *, + file_ids: Optional[list[str]] = ..., + memory_limit: Optional[Union[str, ContainerMemoryLimit]] = ..., + network_policy: Optional[ContainerNetworkPolicyParam] = ..., skills: Optional[list[ContainerSkill]] = ... ) -> None: ... @@ -3756,8 +3143,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, image: str ) -> None: ... @@ -3779,9 +3166,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - allowed_domains: list[str], + self, + *, + allowed_domains: list[str], domain_secrets: Optional[list[ContainerNetworkPolicyDomainSecretParam]] = ... ) -> None: ... @@ -3806,10 +3193,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - domain: str, - name: str, + self, + *, + domain: str, + name: str, value: str ) -> None: ... @@ -3822,8 +3209,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -3841,8 +3228,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -3863,10 +3250,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - eval_id: str, - max_hourly_runs: Optional[int] = ..., + self, + *, + eval_id: str, + max_hourly_runs: Optional[int] = ..., sampling_rate: Optional[float] = ... ) -> None: ... @@ -3889,14 +3276,14 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - connection_name: str, - container_name: str, - database_name: str, - description: Optional[str] = ..., - embedding_configuration: EmbeddingConfiguration, - field_mapping: FieldMapping, + 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: ... @@ -3910,9 +3297,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - location: Optional[str] = ..., + self, + *, + location: Optional[str] = ..., operation_result: Optional[str] = ... ) -> None: ... @@ -3926,9 +3313,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - default: Optional[bool] = ..., + self, + *, + default: Optional[bool] = ..., files: list[FileType] ) -> None: ... @@ -3954,11 +3341,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - end_time: Optional[datetime] = ..., - expression: str, - start_time: Optional[datetime] = ..., + self, + *, + end_time: Optional[datetime] = ..., + expression: str, + start_time: Optional[datetime] = ..., time_zone: Optional[str] = ... ) -> None: ... @@ -3971,8 +3358,8 @@ namespace azure.ai.projects.models type: Union[str, CredentialType] def __init__( - self, - *args: Any, + self, + *args: Any, **kwargs: Any ) -> None: ... @@ -3984,9 +3371,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - definition: str, + self, + *, + definition: str, syntax: Union[str, GrammarSyntax1] ) -> None: ... @@ -4002,10 +3389,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - event_name: Optional[str] = ..., - parameters: dict[str, Any], + self, + *, + event_name: Optional[str] = ..., + parameters: dict[str, Any], provider: str ) -> None: ... @@ -4032,11 +3419,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - defer_loading: Optional[bool] = ..., - description: Optional[str] = ..., - format: Optional[CustomToolParamFormat] = ..., + self, + *, + defer_loading: Optional[bool] = ..., + description: Optional[str] = ..., + format: Optional[CustomToolParamFormat] = ..., name: str ) -> None: ... @@ -4049,8 +3436,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -4069,8 +3456,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, hours: list[int] ) -> None: ... @@ -4089,8 +3476,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, inputs: Optional[DataGenerationJobInputs] = ... ) -> None: ... @@ -4107,12 +3494,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - name: str, - options: DataGenerationJobOptions, - output_options: Optional[DataGenerationJobOutputOptions] = ..., - scenario: Union[str, DataGenerationJobScenario], + self, + *, + name: str, + options: DataGenerationJobOptions, + output_options: Optional[DataGenerationJobOutputOptions] = ..., + scenario: Union[str, DataGenerationJobScenario], sources: list[DataGenerationJobSource] ) -> None: ... @@ -4128,11 +3515,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - max_samples: int, - model_options: Optional[DataGenerationModelOptions] = ..., - train_split: Optional[float] = ..., + self, + *, + max_samples: int, + model_options: Optional[DataGenerationModelOptions] = ..., + train_split: Optional[float] = ..., type: str ) -> None: ... @@ -4145,8 +3532,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -4161,10 +3548,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., tags: Optional[dict[str, str]] = ... ) -> None: ... @@ -4184,10 +3571,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - generated_samples: int, - outputs: Optional[list[DataGenerationJobOutput]] = ..., + self, + *, + generated_samples: int, + outputs: Optional[list[DataGenerationJobOutput]] = ..., token_usage: Optional[DataGenerationTokenUsage] = ... ) -> None: ... @@ -4207,9 +3594,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., type: str ) -> None: ... @@ -4235,8 +3622,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, model: str ) -> None: ... @@ -4255,8 +3642,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, blob_reference: BlobReference ) -> None: ... @@ -4287,10 +3674,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: str, + self, + *, + description: Optional[str] = ..., + name: str, version: Optional[str] = ... ) -> None: ... @@ -4304,9 +3691,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - name: str, + self, + *, + name: str, version: str ) -> None: ... @@ -4332,12 +3719,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - connection_name: Optional[str] = ..., - data_uri: str, - description: Optional[str] = ..., - tags: Optional[dict[str, str]] = ..., + self, + *, + connection_name: Optional[str] = ..., + data_uri: str, + description: Optional[str] = ..., + tags: Optional[dict[str, str]] = ..., type: str ) -> None: ... @@ -4362,10 +3749,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - deleted: bool, - name: str, + self, + *, + deleted: bool, + name: str, object: Literal[AgentObjectType.AGENT_DELETED] ) -> None: ... @@ -4381,11 +3768,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - deleted: bool, - name: str, - object: Literal[AgentObjectType.AGENT_VERSION_DELETED], + self, + *, + deleted: bool, + name: str, + object: Literal[AgentObjectType.AGENT_VERSION_DELETED], version: str ) -> None: ... @@ -4400,10 +3787,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - deleted: bool, - memory_id: str, + self, + *, + deleted: bool, + memory_id: str, object: Literal[MemoryStoreObjectType.MEMORY_DELETED] ) -> None: ... @@ -4418,10 +3805,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - deleted: bool, - name: str, + self, + *, + deleted: bool, + name: str, object: Literal[MemoryStoreObjectType.MEMORY_STORE_DELETED] ) -> None: ... @@ -4436,10 +3823,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - deleted: bool, - id: str, + self, + *, + deleted: bool, + id: str, name: str ) -> None: ... @@ -4455,11 +3842,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - deleted: bool, - id: str, - name: str, + self, + *, + deleted: bool, + id: str, + name: str, version: str ) -> None: ... @@ -4473,8 +3860,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -4494,11 +3881,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - always_applicable: Optional[bool] = ..., - description: str, - id: str, + self, + *, + always_applicable: Optional[bool] = ..., + description: str, + id: str, weight: int ) -> None: ... @@ -4513,10 +3900,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - action_correlation_id: Optional[str] = ..., - dispatch_id: Optional[str] = ..., + self, + *, + action_correlation_id: Optional[str] = ..., + dispatch_id: Optional[str] = ..., task_id: Optional[str] = ... ) -> None: ... @@ -4530,9 +3917,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - embedding_field: str, + self, + *, + embedding_field: str, model_deployment_name: str ) -> None: ... @@ -4552,11 +3939,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - connection_name: str, - data_schema: Optional[dict[str, Any]] = ..., - init_parameters: Optional[dict[str, Any]] = ..., + self, + *, + connection_name: str, + data_schema: Optional[dict[str, Any]] = ..., + init_parameters: Optional[dict[str, Any]] = ..., metrics: Optional[dict[str, EvaluatorMetric]] = ... ) -> None: ... @@ -4602,11 +3989,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - name: str, - passed: bool, - score: float, + self, + *, + name: str, + passed: bool, + score: float, type: str ) -> None: ... @@ -4623,12 +4010,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - delta_estimate: float, - p_value: float, - treatment_effect: Union[str, TreatmentEffectType], - treatment_run_id: str, + self, + *, + delta_estimate: float, + p_value: float, + treatment_effect: Union[str, TreatmentEffectType], + treatment_run_id: str, treatment_run_summary: EvalRunResultSummary ) -> None: ... @@ -4645,12 +4032,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - baseline_run_summary: EvalRunResultSummary, - compare_items: list[EvalRunResultCompareItem], - evaluator: str, - metric: str, + self, + *, + baseline_run_summary: EvalRunResultSummary, + compare_items: list[EvalRunResultCompareItem], + evaluator: str, + metric: str, testing_criteria: str ) -> None: ... @@ -4666,11 +4053,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - average: float, - run_id: str, - sample_count: int, + self, + *, + average: float, + run_id: str, + sample_count: int, standard_deviation: float ) -> None: ... @@ -4686,10 +4073,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - baseline_run_id: str, - eval_id: str, + self, + *, + baseline_run_id: str, + eval_id: str, treatment_run_ids: list[str] ) -> None: ... @@ -4704,9 +4091,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - comparisons: list[EvalRunResultComparison], + self, + *, + comparisons: list[EvalRunResultComparison], method: str ) -> None: ... @@ -4728,11 +4115,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - correlation_info: dict[str, Any], - evaluation_result: EvalResult, - features: dict[str, Any], + self, + *, + correlation_info: dict[str, Any], + evaluation_result: EvalResult, + features: dict[str, Any], id: str ) -> None: ... @@ -4752,13 +4139,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - action: EvaluationRuleAction, - description: Optional[str] = ..., - display_name: Optional[str] = ..., - enabled: bool, - event_type: Union[str, EvaluationRuleEventType], + self, + *, + action: EvaluationRuleAction, + description: Optional[str] = ..., + display_name: Optional[str] = ..., + enabled: bool, + event_type: Union[str, EvaluationRuleEventType], filter: Optional[EvaluationRuleFilter] = ... ) -> None: ... @@ -4771,8 +4158,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -4795,8 +4182,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, agent_name: str ) -> None: ... @@ -4812,10 +4199,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - eval_id: str, - model_configuration: Optional[InsightModelConfiguration] = ..., + self, + *, + eval_id: str, + model_configuration: Optional[InsightModelConfiguration] = ..., run_ids: list[str] ) -> None: ... @@ -4829,8 +4216,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, cluster_insight: ClusterInsightResult ) -> None: ... @@ -4846,10 +4233,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - configuration: Optional[dict[str, str]] = ..., - eval_id: str, + self, + *, + configuration: Optional[dict[str, str]] = ..., + eval_id: str, eval_run: dict[str, Any] ) -> None: ... @@ -4862,8 +4249,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -4883,12 +4270,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - properties: Optional[dict[str, str]] = ..., - tags: Optional[dict[str, str]] = ..., - taxonomy_categories: Optional[list[TaxonomyCategory]] = ..., + self, + *, + description: Optional[str] = ..., + properties: Optional[dict[str, str]] = ..., + tags: Optional[dict[str, str]] = ..., + taxonomy_categories: Optional[list[TaxonomyCategory]] = ..., taxonomy_input: EvaluationTaxonomyInput ) -> None: ... @@ -4901,8 +4288,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -4926,8 +4313,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, blob_uri: str ) -> None: ... @@ -4943,11 +4330,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - data_schema: Optional[dict[str, Any]] = ..., - init_parameters: Optional[dict[str, Any]] = ..., - metrics: Optional[dict[str, EvaluatorMetric]] = ..., + self, + *, + data_schema: Optional[dict[str, Any]] = ..., + init_parameters: Optional[dict[str, Any]] = ..., + metrics: Optional[dict[str, EvaluatorMetric]] = ..., type: str ) -> None: ... @@ -4971,9 +4358,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - dataset: DatasetReference, + self, + *, + dataset: DatasetReference, kinds: list[str] ) -> None: ... @@ -4990,12 +4377,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - evaluator_description: Optional[str] = ..., - evaluator_display_name: Optional[str] = ..., - evaluator_name: str, - model: str, + self, + *, + evaluator_description: Optional[str] = ..., + evaluator_display_name: Optional[str] = ..., + evaluator_name: str, + model: str, sources: list[EvaluatorGenerationJobSource] ) -> None: ... @@ -5015,8 +4402,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, inputs: Optional[EvaluatorGenerationInputs] = ... ) -> None: ... @@ -5029,8 +4416,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -5052,10 +4439,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - input_tokens: int, - output_tokens: int, + self, + *, + input_tokens: int, + output_tokens: int, total_tokens: int ) -> None: ... @@ -5073,13 +4460,13 @@ namespace azure.ai.projects.models @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] = ..., + 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: ... @@ -5123,15 +4510,15 @@ namespace azure.ai.projects.models @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]]] = ..., + 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: ... @@ -5146,9 +4533,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - otel_agent_id: Optional[str] = ..., + self, + *, + otel_agent_id: Optional[str] = ..., rai_config: Optional[RaiConfig] = ... ) -> None: ... @@ -5161,8 +4548,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, project_connections: Optional[list[ToolProjectConnection]] = ... ) -> None: ... @@ -5179,11 +4566,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - project_connection_id: str, - require_approval: Optional[Union[MCPToolRequireApproval, str]] = ..., - server_label: Optional[str] = ..., + self, + *, + project_connection_id: str, + require_approval: Optional[Union[MCPToolRequireApproval, str]] = ..., + server_label: Optional[str] = ..., server_url: Optional[str] = ... ) -> None: ... @@ -5203,14 +4590,14 @@ namespace azure.ai.projects.models @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] = ..., + 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: ... @@ -5228,13 +4615,13 @@ namespace azure.ai.projects.models @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] = ..., + 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: ... @@ -5261,9 +4648,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., id: str ) -> None: ... @@ -5284,11 +4671,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - connection_name: Optional[str] = ..., - data_uri: str, - description: Optional[str] = ..., + self, + *, + connection_name: Optional[str] = ..., + data_uri: str, + description: Optional[str] = ..., tags: Optional[dict[str, str]] = ... ) -> None: ... @@ -5308,14 +4695,14 @@ namespace azure.ai.projects.models @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]] = ..., + 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: ... @@ -5335,14 +4722,14 @@ namespace azure.ai.projects.models @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]] = ..., + 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: Optional[list[str]] = ... ) -> None: ... @@ -5357,9 +4744,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_version: str, + self, + *, + agent_version: str, traffic_percentage: int ) -> None: ... @@ -5380,11 +4767,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - connection_name: Optional[str] = ..., - data_uri: str, - description: Optional[str] = ..., + self, + *, + connection_name: Optional[str] = ..., + data_uri: str, + description: Optional[str] = ..., tags: Optional[dict[str, str]] = ... ) -> None: ... @@ -5417,9 +4804,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - code: Optional[Union[str, FoundryModelWarningCode]] = ..., + self, + *, + code: Optional[Union[str, FoundryModelWarningCode]] = ..., message: Optional[str] = ... ) -> None: ... @@ -5447,11 +4834,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - environment: Optional[FunctionShellToolParamEnvironment] = ..., - name: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., + environment: Optional[FunctionShellToolParamEnvironment] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -5464,8 +4851,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -5479,8 +4866,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, container_id: str ) -> None: ... @@ -5494,8 +4881,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, skills: Optional[list[LocalSkillParam]] = ... ) -> None: ... @@ -5519,12 +4906,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - defer_loading: Optional[bool] = ..., - description: Optional[str] = ..., - name: str, - parameters: dict[str, Any], + self, + *, + defer_loading: Optional[bool] = ..., + description: Optional[str] = ..., + name: str, + parameters: dict[str, Any], strict: bool ) -> None: ... @@ -5542,12 +4929,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - defer_loading: Optional[bool] = ..., - description: Optional[str] = ..., - name: str, - parameters: Optional[EmptyModelParam] = ..., + self, + *, + defer_loading: Optional[bool] = ..., + description: Optional[str] = ..., + name: str, + parameters: Optional[EmptyModelParam] = ..., strict: Optional[bool] = ... ) -> None: ... @@ -5569,11 +4956,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - connection_id: str, - issue_event: Union[str, GitHubIssueEvent], - owner: str, + self, + *, + connection_id: str, + issue_event: Union[str, GitHubIssueEvent], + owner: str, repository: str ) -> None: ... @@ -5594,10 +4981,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - header_name: str, - secret_id: str, + self, + *, + header_name: str, + secret_id: str, secret_key: str ) -> None: ... @@ -5618,15 +5005,15 @@ namespace azure.ai.projects.models @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] = ..., + 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] = ... ) -> None: ... @@ -5650,8 +5037,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, template_id: str ) -> None: ... @@ -5665,9 +5052,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - embedding_weight: float, + self, + *, + embedding_weight: float, text_weight: float ) -> None: ... @@ -5700,21 +5087,21 @@ namespace azure.ai.projects.models @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]] = ..., + 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: ... @@ -5728,9 +5115,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - file_id: Optional[str] = ..., + self, + *, + file_id: Optional[str] = ..., image_url: Optional[str] = ... ) -> None: ... @@ -5748,10 +5135,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - tags: Optional[dict[str, str]] = ..., + self, + *, + description: Optional[str] = ..., + tags: Optional[dict[str, str]] = ..., type: str ) -> None: ... @@ -5773,10 +5160,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: str, - name: str, + self, + *, + description: str, + name: str, source: InlineSkillSourceParam ) -> None: ... @@ -5791,8 +5178,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, data: str ) -> None: ... @@ -5815,9 +5202,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - display_name: str, + self, + *, + display_name: str, request: InsightRequest ) -> None: ... @@ -5837,15 +5224,15 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: str, - id: str, - label: str, - samples: Optional[list[InsightSample]] = ..., - sub_clusters: Optional[list[InsightCluster]] = ..., - suggestion: str, - suggestion_title: str, + self, + *, + description: str, + id: str, + label: str, + samples: Optional[list[InsightSample]] = ..., + sub_clusters: Optional[list[InsightCluster]] = ..., + suggestion: str, + suggestion_title: str, weight: int ) -> None: ... @@ -5858,8 +5245,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, model_deployment_name: str ) -> None: ... @@ -5872,8 +5259,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -5886,8 +5273,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -5903,11 +5290,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - correlation_info: dict[str, Any], - features: dict[str, Any], - id: str, + self, + *, + correlation_info: dict[str, Any], + features: dict[str, Any], + id: str, type: str ) -> None: ... @@ -5922,9 +5309,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - configuration: Optional[dict[str, str]] = ..., + self, + *, + configuration: Optional[dict[str, str]] = ..., insight: Insight ) -> None: ... @@ -5941,12 +5328,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - method: str, - sample_count: int, - unique_cluster_count: int, - unique_subcluster_count: int, + self, + *, + method: str, + sample_count: int, + unique_cluster_count: int, + unique_subcluster_count: int, usage: ClusterTokenUsage ) -> None: ... @@ -5966,9 +5353,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - completed_at: Optional[datetime] = ..., + self, + *, + completed_at: Optional[datetime] = ..., created_at: datetime ) -> None: ... @@ -5988,8 +5375,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, input: Any ) -> None: ... @@ -6006,11 +5393,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_endpoint_id: Optional[str] = ..., - agent_name: Optional[str] = ..., - input: Optional[Any] = ..., + self, + *, + agent_endpoint_id: Optional[str] = ..., + agent_name: Optional[str] = ..., + input: Optional[Any] = ..., session_id: Optional[str] = ... ) -> None: ... @@ -6024,8 +5411,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, input: Any ) -> None: ... @@ -6042,11 +5429,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_endpoint_id: Optional[str] = ..., - agent_name: Optional[str] = ..., - conversation: Optional[str] = ..., + self, + *, + agent_endpoint_id: Optional[str] = ..., + agent_name: Optional[str] = ..., + conversation: Optional[str] = ..., input: Optional[Any] = ... ) -> None: ... @@ -6070,10 +5457,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -6088,10 +5475,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: str, - name: str, + self, + *, + description: str, + name: str, path: str ) -> None: ... @@ -6107,11 +5494,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - alpha: Optional[int] = ..., - dropout: Optional[float] = ..., - rank: Optional[int] = ..., + self, + *, + alpha: Optional[int] = ..., + dropout: Optional[float] = ..., + rank: Optional[int] = ..., target_modules: Optional[list[str]] = ... ) -> None: ... @@ -6135,18 +5522,18 @@ namespace azure.ai.projects.models @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] = ..., + 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: ... @@ -6160,9 +5547,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - read_only: Optional[bool] = ..., + self, + *, + read_only: Optional[bool] = ..., tool_names: Optional[list[str]] = ... ) -> None: ... @@ -6176,9 +5563,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - always: Optional[MCPToolFilter] = ..., + self, + *, + always: Optional[MCPToolFilter] = ..., never: Optional[MCPToolFilter] = ... ) -> None: ... @@ -6204,20 +5591,20 @@ namespace azure.ai.projects.models @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] = ..., - description: Optional[str] = ..., - headers: Optional[dict[str, str]] = ..., - name: Optional[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] = ..., + 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] = ..., + description: Optional[str] = ..., + headers: Optional[dict[str, str]] = ..., + name: Optional[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: ... @@ -6231,8 +5618,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, blueprint_id: str ) -> None: ... @@ -6251,10 +5638,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - tags: Optional[dict[str, str]] = ..., + self, + *, + description: Optional[str] = ..., + tags: Optional[dict[str, str]] = ..., vector_store_id: str ) -> None: ... @@ -6274,12 +5661,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - content: str, - kind: str, - memory_id: str, - scope: str, + self, + *, + content: str, + kind: str, + memory_id: str, + scope: str, updated_at: datetime ) -> None: ... @@ -6299,9 +5686,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - kind: Union[str, MemoryOperationKind], + self, + *, + kind: Union[str, MemoryOperationKind], memory_item: MemoryItem ) -> None: ... @@ -6320,8 +5707,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, memory_item: MemoryItem ) -> None: ... @@ -6334,8 +5721,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, max_memories: Optional[int] = ... ) -> None: ... @@ -6352,11 +5739,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - memory_store_name: str, - scope: str, - search_options: Optional[MemorySearchOptions] = ..., + self, + *, + memory_store_name: str, + scope: str, + search_options: Optional[MemorySearchOptions] = ..., update_delay: Optional[int] = ... ) -> None: ... @@ -6372,10 +5759,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - chat_model: str, - embedding_model: str, + self, + *, + chat_model: str, + embedding_model: str, options: Optional[MemoryStoreDefaultOptions] = ... ) -> None: ... @@ -6392,12 +5779,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - chat_summary_enabled: bool, - default_ttl_seconds: Optional[timedelta] = ..., - procedural_memory_enabled: Optional[bool] = ..., - user_profile_details: Optional[str] = ..., + self, + *, + chat_summary_enabled: bool, + default_ttl_seconds: Optional[timedelta] = ..., + procedural_memory_enabled: Optional[bool] = ..., + user_profile_details: Optional[str] = ..., user_profile_enabled: bool ) -> None: ... @@ -6410,8 +5797,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, kind: str ) -> None: ... @@ -6427,11 +5814,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - deleted: bool, - name: str, - object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED], + self, + *, + deleted: bool, + name: str, + object: Literal[MemoryStoreObjectType.MEMORY_STORE_SCOPE_DELETED], scope: str ) -> None: ... @@ -6451,15 +5838,15 @@ namespace azure.ai.projects.models @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], + 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: ... @@ -6488,13 +5875,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - embedding_tokens: int, - input_tokens: int, - input_tokens_details: ResponseUsageInputTokensDetails, - output_tokens: int, - output_tokens_details: ResponseUsageOutputTokensDetails, + self, + *, + embedding_tokens: int, + input_tokens: int, + input_tokens_details: ResponseUsageInputTokensDetails, + output_tokens: int, + output_tokens_details: ResponseUsageOutputTokensDetails, total_tokens: int ) -> None: ... @@ -6509,10 +5896,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - memories: list[MemorySearchItem], - search_id: str, + self, + *, + memories: list[MemorySearchItem], + search_id: str, usage: MemoryStoreOperationUsage ) -> None: ... @@ -6526,9 +5913,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - memory_operations: list[MemoryOperation], + self, + *, + memory_operations: list[MemoryOperation], usage: MemoryStoreOperationUsage ) -> None: ... @@ -6545,12 +5932,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - error: Optional[ApiError] = ..., - result: Optional[MemoryStoreUpdateCompletedResult] = ..., - status: Union[str, MemoryStoreUpdateStatus], - superseded_by: Optional[str] = ..., + self, + *, + error: Optional[ApiError] = ..., + result: Optional[MemoryStoreUpdateCompletedResult] = ..., + status: Union[str, MemoryStoreUpdateStatus], + superseded_by: Optional[str] = ..., update_id: str ) -> None: ... @@ -6572,8 +5959,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, fabric_dataagent_preview: FabricDataAgentToolParameters ) -> None: ... @@ -6586,8 +5973,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, blob_uri: str ) -> None: ... @@ -6621,12 +6008,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - capacity: int, - family: str, - name: str, - size: str, + self, + *, + capacity: int, + family: str, + name: str, + size: str, tier: str ) -> None: ... @@ -6641,10 +6028,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - connection_name: Optional[str] = ..., - pending_upload_id: Optional[str] = ..., + self, + *, + connection_name: Optional[str] = ..., + pending_upload_id: Optional[str] = ..., pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE] ) -> None: ... @@ -6660,11 +6047,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - blob_reference: BlobReference, - pending_upload_id: str, - pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE], + self, + *, + blob_reference: BlobReference, + pending_upload_id: str, + pending_upload_type: Literal[PendingUploadType.TEMPORARY_BLOB_REFERENCE], version: Optional[str] = ... ) -> None: ... @@ -6687,11 +6074,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - max_completion_tokens: Optional[int] = ..., - seed: Optional[int] = ..., - temperature: Optional[float] = ..., + self, + *, + max_completion_tokens: Optional[int] = ..., + seed: Optional[int] = ..., + temperature: Optional[float] = ..., top_p: Optional[float] = ... ) -> None: ... @@ -6705,9 +6092,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - job_id: Optional[str] = ..., + self, + *, + job_id: Optional[str] = ..., source_type: Optional[Union[str, FoundryModelSourceType]] = ... ) -> None: ... @@ -6731,14 +6118,14 @@ namespace azure.ai.projects.models @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]] = ..., + 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: ... @@ -6752,8 +6139,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, days_of_month: list[int] ) -> None: ... @@ -6769,10 +6156,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: str, - name: str, + self, + *, + description: str, + name: str, tools: list[Union[FunctionToolParam, CustomToolParam]] ) -> None: ... @@ -6797,9 +6184,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - time_zone: Optional[str] = ..., + self, + *, + time_zone: Optional[str] = ..., trigger_at: datetime ) -> None: ... @@ -6822,8 +6209,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -6847,12 +6234,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - auth: OpenApiAuthDetails, - default_params: Optional[list[str]] = ..., - description: Optional[str] = ..., - name: str, + self, + *, + auth: OpenApiAuthDetails, + default_params: Optional[list[str]] = ..., + description: Optional[str] = ..., + name: str, spec: dict[str, Any] ) -> None: ... @@ -6867,10 +6254,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: str, + self, + *, + description: Optional[str] = ..., + name: str, parameters: dict[str, Any] ) -> None: ... @@ -6884,8 +6271,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, security_scheme: OpenApiManagedSecurityScheme ) -> None: ... @@ -6898,8 +6285,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, audience: str ) -> None: ... @@ -6913,8 +6300,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, security_scheme: OpenApiProjectConnectionSecurityScheme ) -> None: ... @@ -6927,8 +6314,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, project_connection_id: str ) -> None: ... @@ -6943,9 +6330,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - openapi: OpenApiFunctionDefinition, + self, + *, + openapi: OpenApiFunctionDefinition, tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -6962,11 +6349,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - openapi: OpenApiFunctionDefinition, + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + openapi: OpenApiFunctionDefinition, tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -6988,9 +6375,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_name: str, + self, + *, + agent_name: str, agent_version: Optional[str] = ... ) -> None: ... @@ -7010,15 +6397,15 @@ namespace azure.ai.projects.models @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, + 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: ... @@ -7032,9 +6419,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - instruction: str, + self, + *, + instruction: str, name: str ) -> None: ... @@ -7047,8 +6434,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -7069,11 +6456,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - criteria: Optional[list[OptimizationDatasetCriterion]] = ..., - desired_num_turns: Optional[int] = ..., - ground_truth: Optional[str] = ..., + self, + *, + criteria: Optional[list[OptimizationDatasetCriterion]] = ..., + desired_num_turns: Optional[int] = ..., + ground_truth: Optional[str] = ..., query: Optional[str] = ... ) -> None: ... @@ -7087,9 +6474,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - name: str, + self, + *, + name: str, version: Optional[str] = ... ) -> None: ... @@ -7103,8 +6490,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, dataset_items: list[OptimizationDatasetItem] ) -> None: ... @@ -7125,8 +6512,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, inputs: Optional[OptimizationJobInputs] = ... ) -> None: ... @@ -7143,12 +6530,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent: OptimizationAgentIdentifier, - evaluators: list[OptimizationEvaluatorRef], - options: Optional[OptimizationOptions] = ..., - train_dataset: OptimizationDatasetInput, + self, + *, + agent: OptimizationAgentIdentifier, + evaluators: list[OptimizationEvaluatorRef], + options: Optional[OptimizationOptions] = ..., + train_dataset: OptimizationDatasetInput, validation_dataset: Optional[OptimizationDatasetInput] = ... ) -> None: ... @@ -7173,10 +6560,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - best_score: float, - candidates_completed: int, + self, + *, + best_score: float, + candidates_completed: int, elapsed_seconds: float ) -> None: ... @@ -7191,10 +6578,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - baseline: Optional[str] = ..., - best: Optional[str] = ..., + self, + *, + baseline: Optional[str] = ..., + best: Optional[str] = ..., candidates: Optional[list[OptimizationCandidate]] = ... ) -> None: ... @@ -7211,12 +6598,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - eval_model: Optional[str] = ..., - evaluation_level: Optional[Union[str, EvaluationLevel]] = ..., - max_candidates: Optional[int] = ..., - optimization_config: Optional[dict[str, Any]] = ..., + 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: ... @@ -7231,9 +6618,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - name: str, + self, + *, + name: str, version: Optional[str] = ... ) -> None: ... @@ -7250,11 +6637,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - auth: Optional[TelemetryEndpointAuth] = ..., - data: list[Union[str, TelemetryDataKind]], - endpoint: str, + self, + *, + auth: Optional[TelemetryEndpointAuth] = ..., + data: list[Union[str, TelemetryDataKind]], + endpoint: str, protocol: Union[str, TelemetryTransportProtocol] ) -> None: ... @@ -7274,10 +6661,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - connection_name: Optional[str] = ..., - pending_upload_id: Optional[str] = ..., + self, + *, + connection_name: Optional[str] = ..., + pending_upload_id: Optional[str] = ..., pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] ) -> None: ... @@ -7293,11 +6680,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - blob_reference: BlobReference, - pending_upload_id: str, - pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE], + self, + *, + blob_reference: BlobReference, + pending_upload_id: str, + pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE], version: Optional[str] = ... ) -> None: ... @@ -7320,11 +6707,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - content: str, - memory_id: str, - scope: str, + self, + *, + content: str, + memory_id: str, + scope: str, updated_at: datetime ) -> None: ... @@ -7339,10 +6726,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_name: str, - agent_version: str, + self, + *, + agent_name: str, + agent_version: str, promoted_at: datetime ) -> None: ... @@ -7365,17 +6752,17 @@ namespace azure.ai.projects.models @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]] = ..., + 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: ... @@ -7388,8 +6775,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, format: Optional[TextResponseFormat] = ... ) -> None: ... @@ -7406,11 +6793,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - data_schema: Optional[dict[str, Any]] = ..., - init_parameters: Optional[dict[str, Any]] = ..., - metrics: Optional[dict[str, EvaluatorMetric]] = ..., + self, + *, + data_schema: Optional[dict[str, Any]] = ..., + init_parameters: Optional[dict[str, Any]] = ..., + metrics: Optional[dict[str, EvaluatorMetric]] = ..., prompt_text: str ) -> None: ... @@ -7425,9 +6812,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., prompt: str ) -> None: ... @@ -7442,9 +6829,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., prompt: str ) -> None: ... @@ -7462,13 +6849,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - a2a: Optional[A2AProtocolConfiguration] = ..., - activity: Optional[ActivityProtocolConfiguration] = ..., - invocations: Optional[InvocationsProtocolConfiguration] = ..., - invocations_ws: Optional[InvocationsWsProtocolConfiguration] = ..., - mcp: Optional[McpProtocolConfiguration] = ..., + self, + *, + a2a: Optional[A2AProtocolConfiguration] = ..., + activity: Optional[ActivityProtocolConfiguration] = ..., + invocations: Optional[InvocationsProtocolConfiguration] = ..., + invocations_ws: Optional[InvocationsWsProtocolConfiguration] = ..., + mcp: Optional[McpProtocolConfiguration] = ..., responses: Optional[ResponsesProtocolConfiguration] = ... ) -> None: ... @@ -7482,9 +6869,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - protocol: Union[str, AgentEndpointProtocol], + self, + *, + protocol: Union[str, AgentEndpointProtocol], version: str ) -> None: ... @@ -7497,8 +6884,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, rai_policy_name: str ) -> None: ... @@ -7518,10 +6905,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - hybrid_search: Optional[HybridSearchOptions] = ..., - ranker: Optional[Union[str, RankerVersionType]] = ..., + self, + *, + hybrid_search: Optional[HybridSearchOptions] = ..., + ranker: Optional[Union[str, RankerVersionType]] = ..., score_threshold: Optional[float] = ... ) -> None: ... @@ -7536,10 +6923,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - effort: Optional[Literal[none, minimal, low, medium, high, xhigh]] = ..., - generate_summary: Optional[Literal[auto, concise, detailed]] = ..., + self, + *, + effort: Optional[Literal[none, minimal, low, medium, high, xhigh]] = ..., + generate_summary: Optional[Literal[auto, concise, detailed]] = ..., summary: Optional[Literal[auto, concise, detailed]] = ... ) -> None: ... @@ -7552,8 +6939,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -7571,12 +6958,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - end_time: Optional[datetime] = ..., - interval: int, - schedule: RecurrenceSchedule, - start_time: Optional[datetime] = ..., + self, + *, + end_time: Optional[datetime] = ..., + interval: int, + schedule: RecurrenceSchedule, + start_time: Optional[datetime] = ..., time_zone: Optional[str] = ... ) -> None: ... @@ -7606,16 +6993,16 @@ namespace azure.ai.projects.models @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]] = ..., + 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: ... @@ -7634,8 +7021,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -7651,10 +7038,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -7674,8 +7061,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, cached_tokens: int ) -> None: ... @@ -7688,8 +7075,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, reasoning_tokens: int ) -> None: ... @@ -7724,14 +7111,14 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - action: Optional[RoutineAction] = ..., - created_at: Optional[datetime] = ..., - description: Optional[str] = ..., - enabled: bool, - name: Optional[str] = ..., - triggers: Optional[dict[str, RoutineTrigger]] = ..., + 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: ... @@ -7744,8 +7131,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -7771,8 +7158,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -7812,29 +7199,29 @@ namespace azure.ai.projects.models @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_event_payload: Optional[dict[str, Any]] = ..., - trigger_name: Optional[str] = ..., - trigger_type: Optional[Union[str, RoutineTriggerType]] = ..., + 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_event_payload: Optional[dict[str, Any]] = ..., + trigger_name: Optional[str] = ..., + trigger_type: Optional[Union[str, RoutineTriggerType]] = ..., triggered_at: Optional[datetime] = ... ) -> None: ... @@ -7854,8 +7241,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -7880,12 +7267,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - data_schema: Optional[dict[str, Any]] = ..., - dimensions: list[Dimension], - init_parameters: Optional[dict[str, Any]] = ..., - metrics: Optional[dict[str, EvaluatorMetric]] = ..., + 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: ... @@ -7922,14 +7309,14 @@ namespace azure.ai.projects.models @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, + 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: ... @@ -7952,9 +7339,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - cron_expression: str, + self, + *, + cron_expression: str, time_zone: str ) -> None: ... @@ -7972,9 +7359,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - schedule_id: str, + self, + *, + schedule_id: str, trigger_time: Optional[datetime] = ... ) -> None: ... @@ -7988,9 +7375,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - configuration: Optional[dict[str, str]] = ..., + self, + *, + configuration: Optional[dict[str, str]] = ..., type: str ) -> None: ... @@ -8022,11 +7409,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - is_directory: bool, - modified_time: datetime, - name: str, + self, + *, + is_directory: bool, + modified_time: datetime, + name: str, size: int ) -> None: ... @@ -8040,9 +7427,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - bytes_written: int, + self, + *, + bytes_written: int, path: str ) -> None: ... @@ -8056,9 +7443,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - data: str, + self, + *, + data: str, event: Union[str, SessionLogEventType] ) -> None: ... @@ -8075,8 +7462,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, project_connections: Optional[list[ToolProjectConnection]] = ... ) -> None: ... @@ -8090,8 +7477,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, sharepoint_grounding_preview: SharepointGroundingToolParameters ) -> None: ... @@ -8108,11 +7495,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - max_samples: int, - model_options: Optional[DataGenerationModelOptions] = ..., - question_types: Optional[list[Union[str, SimpleQnAFineTuningQuestionType]]] = ..., + self, + *, + max_samples: int, + model_options: Optional[DataGenerationModelOptions] = ..., + question_types: Optional[list[Union[str, SimpleQnAFineTuningQuestionType]]] = ..., train_split: Optional[float] = ... ) -> None: ... @@ -8135,13 +7522,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - created_at: datetime, - default_version: str, - description: str, - id: str, - latest_version: str, + self, + *, + created_at: datetime, + default_version: str, + description: str, + id: str, + latest_version: str, name: str ) -> None: ... @@ -8159,13 +7546,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - allowed_tools: Optional[list[str]] = ..., - compatibility: Optional[str] = ..., - description: str, - instructions: str, - license: Optional[str] = ..., + self, + *, + allowed_tools: Optional[list[str]] = ..., + compatibility: Optional[str] = ..., + description: str, + instructions: str, + license: Optional[str] = ..., metadata: Optional[dict[str, str]] = ... ) -> None: ... @@ -8180,9 +7567,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - skill_id: str, + self, + *, + skill_id: str, version: Optional[str] = ... ) -> None: ... @@ -8200,13 +7587,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - created_at: datetime, - description: str, - id: str, - name: str, - skill_id: str, + self, + *, + created_at: datetime, + description: str, + id: str, + name: str, + skill_id: str, version: str ) -> None: ... @@ -8242,11 +7629,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - default_value: Optional[Any] = ..., - description: Optional[str] = ..., - required: Optional[bool] = ..., + self, + *, + default_value: Optional[Any] = ..., + description: Optional[str] = ..., + required: Optional[bool] = ..., schema: Optional[dict[str, Any]] = ... ) -> None: ... @@ -8262,11 +7649,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: str, - name: str, - schema: dict[str, Any], + self, + *, + description: str, + name: str, + schema: dict[str, Any], strict: bool ) -> None: ... @@ -8291,13 +7678,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - id: str, - name: str, - properties: Optional[dict[str, str]] = ..., - risk_category: Union[str, RiskCategory], + self, + *, + description: Optional[str] = ..., + id: str, + name: str, + properties: Optional[dict[str, str]] = ..., + risk_category: Union[str, RiskCategory], sub_categories: list[TaxonomySubCategory] ) -> None: ... @@ -8314,12 +7701,12 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - enabled: bool, - id: str, - name: str, + self, + *, + description: Optional[str] = ..., + enabled: bool, + id: str, + name: str, properties: Optional[dict[str, str]] = ... ) -> None: ... @@ -8332,8 +7719,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, endpoints: list[TelemetryEndpoint] ) -> None: ... @@ -8354,10 +7741,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - auth: Optional[TelemetryEndpointAuth] = ..., - data: list[Union[str, TelemetryDataKind]], + self, + *, + auth: Optional[TelemetryEndpointAuth] = ..., + data: list[Union[str, TelemetryDataKind]], kind: str ) -> None: ... @@ -8370,8 +7757,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -8406,8 +7793,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -8440,11 +7827,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: str, - schema: dict[str, Any], + self, + *, + description: Optional[str] = ..., + name: str, + schema: dict[str, Any], strict: Optional[bool] = ... ) -> None: ... @@ -8468,8 +7855,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, at: Optional[datetime] = ... ) -> None: ... @@ -8482,8 +7869,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -8498,9 +7885,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - mode: Literal["auto", "required"], + self, + *, + mode: Literal["auto", "required"], tools: list[dict[str, Any]] ) -> None: ... @@ -8554,8 +7941,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, name: str ) -> None: ... @@ -8579,8 +7966,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, name: str ) -> None: ... @@ -8605,9 +7992,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - name: Optional[str] = ..., + self, + *, + name: Optional[str] = ..., server_label: str ) -> None: ... @@ -8620,8 +8007,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -8672,9 +8059,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - additional_search_text: Optional[str] = ..., + self, + *, + additional_search_text: Optional[str] = ..., pin: Optional[bool] = ... ) -> None: ... @@ -8688,9 +8075,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., name: Optional[str] = ... ) -> None: ... @@ -8708,8 +8095,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, project_connection_id: str ) -> None: ... @@ -8730,10 +8117,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - execution: Optional[Union[str, ToolSearchExecutionType]] = ..., + self, + *, + description: Optional[str] = ..., + execution: Optional[Union[str, ToolSearchExecutionType]] = ..., parameters: Optional[EmptyModelParam] = ... ) -> None: ... @@ -8781,10 +8168,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - max_samples: int, - model_options: Optional[DataGenerationModelOptions] = ..., + self, + *, + max_samples: int, + model_options: Optional[DataGenerationModelOptions] = ..., train_split: Optional[float] = ... ) -> None: ... @@ -8799,10 +8186,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - default_version: str, - id: str, + self, + *, + default_version: str, + id: str, name: str ) -> None: ... @@ -8815,8 +8202,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, rai_config: Optional[RaiConfig] = ... ) -> None: ... @@ -8832,10 +8219,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -8848,8 +8235,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -8864,9 +8251,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - name: str, + self, + *, + name: str, version: Optional[str] = ... ) -> None: ... @@ -8882,11 +8269,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - tool_configs: Optional[dict[str, ToolConfig]] = ..., + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + tool_configs: Optional[dict[str, ToolConfig]] = ..., type: str ) -> None: ... @@ -8922,16 +8309,16 @@ namespace azure.ai.projects.models @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[ToolboxTool], + self, + *, + created_at: datetime, + description: Optional[str] = ..., + id: str, + metadata: dict[str, str], + name: str, + policies: Optional[ToolboxPolicies] = ..., + skills: Optional[list[ToolboxSkill]] = ..., + tools: list[ToolboxTool], version: str ) -> None: ... @@ -8947,10 +8334,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - max_samples: int, - model_options: Optional[DataGenerationModelOptions] = ..., + self, + *, + max_samples: int, + model_options: Optional[DataGenerationModelOptions] = ..., train_split: Optional[float] = ... ) -> None: ... @@ -8969,13 +8356,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_id: Optional[str] = ..., - agent_name: Optional[str] = ..., - agent_version: Optional[str] = ..., - description: Optional[str] = ..., - end_time: Optional[datetime] = ..., + self, + *, + agent_id: Optional[str] = ..., + agent_name: Optional[str] = ..., + agent_version: Optional[str] = ..., + description: Optional[str] = ..., + end_time: Optional[datetime] = ..., start_time: datetime ) -> None: ... @@ -8994,13 +8381,13 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_id: Optional[str] = ..., - agent_name: Optional[str] = ..., - agent_version: Optional[str] = ..., - description: Optional[str] = ..., - end_time: Optional[datetime] = ..., + self, + *, + agent_id: Optional[str] = ..., + agent_name: Optional[str] = ..., + agent_version: Optional[str] = ..., + description: Optional[str] = ..., + end_time: Optional[datetime] = ..., start_time: datetime ) -> None: ... @@ -9032,8 +8419,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -9053,9 +8440,9 @@ namespace azure.ai.projects.models @classmethod def from_continuation_token( - cls, - polling_method: PollingMethod[MemoryStoreUpdateCompletedResult], - continuation_token: str, + cls, + polling_method: PollingMethod[MemoryStoreUpdateCompletedResult], + continuation_token: str, **kwargs: Any ) -> UpdateMemoriesLROPoller: ... @@ -9066,9 +8453,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., + self, + *, + description: Optional[str] = ..., tags: Optional[dict[str, str]] = ... ) -> None: ... @@ -9081,8 +8468,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, default_version: str ) -> None: ... @@ -9099,11 +8486,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - content: str, - memory_id: str, - scope: str, + self, + *, + content: str, + memory_id: str, + scope: str, updated_at: datetime ) -> None: ... @@ -9116,8 +8503,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, type: str ) -> None: ... @@ -9135,8 +8522,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, agent_version: str ) -> None: ... @@ -9150,9 +8537,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - agent_version: str, + self, + *, + agent_version: str, type: str ) -> None: ... @@ -9165,8 +8552,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, version_selection_rules: list[VersionSelectionRule] ) -> None: ... @@ -9187,11 +8574,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - city: Optional[str] = ..., - country: Optional[str] = ..., - region: Optional[str] = ..., + self, + *, + city: Optional[str] = ..., + country: Optional[str] = ..., + region: Optional[str] = ..., timezone: Optional[str] = ... ) -> None: ... @@ -9205,9 +8592,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - instance_name: str, + self, + *, + instance_name: str, project_connection_id: str ) -> None: ... @@ -9223,10 +8610,10 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - search_content_types: Optional[list[Union[str, SearchContentType]]] = ..., - search_context_size: Optional[Union[str, SearchContextSize]] = ..., + self, + *, + search_content_types: Optional[list[Union[str, SearchContentType]]] = ..., + search_context_size: Optional[Union[str, SearchContextSize]] = ..., user_location: Optional[ApproximateLocation] = ... ) -> None: ... @@ -9246,14 +8633,14 @@ namespace azure.ai.projects.models @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]] = ..., + 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: ... @@ -9266,8 +8653,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, allowed_domains: Optional[list[str]] = ... ) -> None: ... @@ -9287,14 +8674,14 @@ namespace azure.ai.projects.models @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]] = ..., + 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: ... @@ -9308,8 +8695,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, days_of_week: list[Union[str, DayOfWeek]] ) -> None: ... @@ -9323,8 +8710,8 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, + self, + *, project_connection_id: str ) -> None: ... @@ -9341,11 +8728,11 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - description: Optional[str] = ..., - name: Optional[str] = ..., - project_connection_id: str, + self, + *, + description: Optional[str] = ..., + name: Optional[str] = ..., + project_connection_id: str, tool_configs: Optional[dict[str, ToolConfig]] = ... ) -> None: ... @@ -9360,9 +8747,9 @@ namespace azure.ai.projects.models @overload def __init__( - self, - *, - rai_config: Optional[RaiConfig] = ..., + self, + *, + rai_config: Optional[RaiConfig] = ..., workflow: Optional[str] = ... ) -> None: ... @@ -9375,319 +8762,289 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.AgentsOperations(GeneratedAgentsOperations): def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @overload def create_session( - self, - agent_name: str, - *, - agent_session_id: Optional[str] = ..., - content_type: str = "application/json", - version_indicator: VersionIndicator, - **kwargs: Any - ) -> AgentSessionResource: ... - - @overload - def create_session( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", + self, + agent_name: str, + *, + agent_session_id: Optional[str] = ..., + content_type: str = "application/json", + version_indicator: VersionIndicator, **kwargs: Any ) -> AgentSessionResource: ... @overload def create_session( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + agent_name: str, + body: CreateSessionRequest, + *, + content_type: str = "application/json", **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] = ..., - draft: Optional[bool] = ..., - metadata: Optional[dict[str, str]] = ..., + self, + agent_name: str, + *, + blueprint_reference: Optional[AgentBlueprintReference] = ..., + content_type: str = "application/json", + definition: AgentDefinition, + description: Optional[str] = ..., + draft: Optional[bool] = ..., + metadata: Optional[dict[str, str]] = ..., **kwargs: Any ) -> AgentVersionDetails: ... @overload def create_version( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/json", + 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", + self, + agent_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any ) -> AgentVersionDetails: ... @distributed_trace def create_version_from_code( - self, - agent_name: str, - *, - code: IO[bytes], - code_zip_sha256: Optional[str] = ..., - definition: HostedAgentDefinition, - description: Optional[str] = ..., - metadata: Optional[dict[str, str]] = ..., + self, + agent_name: str, + *, + code: IO[bytes], + code_zip_sha256: Optional[str] = ..., + definition: HostedAgentDefinition, + description: Optional[str] = ..., + metadata: Optional[dict[str, 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], + 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", + self, + agent_name: str, + body: CreateAgentVersionFromManifestRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AgentVersionDetails: ... @distributed_trace def delete( - self, - agent_name: str, - *, - force: Optional[bool] = ..., + self, + agent_name: str, + *, + force: Optional[bool] = ..., **kwargs: Any ) -> DeleteAgentResponse: ... @distributed_trace def delete_session( - self, - agent_name: str, - session_id: str, + self, + agent_name: str, + session_id: str, **kwargs: Any ) -> None: ... @distributed_trace def delete_session_file( - self, - agent_name: str, - session_id: str, - *, - path: str, - recursive: Optional[bool] = ..., + self, + agent_name: str, + session_id: str, + *, + path: str, + recursive: Optional[bool] = ..., **kwargs: Any ) -> None: ... @distributed_trace def delete_version( - self, - agent_name: str, - agent_version: str, - *, - force: Optional[bool] = ..., + self, + agent_name: str, + agent_version: str, + *, + force: Optional[bool] = ..., **kwargs: Any ) -> DeleteAgentVersionResponse: ... @distributed_trace def disable( - self, - agent_name: str, + self, + agent_name: str, **kwargs: Any ) -> None: ... @distributed_trace def download_code( - self, - agent_name: str, - *, - agent_version: Optional[str] = ..., + self, + agent_name: str, + *, + agent_version: Optional[str] = ..., **kwargs: Any ) -> Iterator[bytes]: ... @distributed_trace def download_session_file( - self, - agent_name: str, - session_id: str, - *, - path: str, + self, + agent_name: str, + session_id: str, + *, + path: str, **kwargs: Any ) -> Iterator[bytes]: ... @distributed_trace def enable( - self, - agent_name: str, + self, + agent_name: str, **kwargs: Any ) -> None: ... @distributed_trace def get( - self, - agent_name: str, + self, + agent_name: str, **kwargs: Any ) -> AgentDetails: ... @distributed_trace def get_session( - self, - agent_name: str, - session_id: str, + self, + agent_name: str, + session_id: str, **kwargs: Any ) -> AgentSessionResource: ... @distributed_trace def get_session_log_stream( - self, - agent_name: str, - agent_version: str, - session_id: str, + 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, + 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]] = ..., + self, + *, + before: Optional[str] = ..., + kind: Optional[AgentKind] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> ItemPaged[AgentDetails]: ... @distributed_trace def list_session_files( - self, - agent_name: str, - session_id: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., - path: Optional[str] = ..., + self, + agent_name: str, + session_id: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., + path: 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]] = ..., + self, + agent_name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> ItemPaged[AgentSessionResource]: ... @distributed_trace def list_versions( - self, - agent_name: str, - *, - before: Optional[str] = ..., - include_drafts: Optional[bool] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + agent_name: str, + *, + before: Optional[str] = ..., + include_drafts: Optional[bool] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> ItemPaged[AgentVersionDetails]: ... @distributed_trace def stop_session( - self, - agent_name: str, - session_id: str, + self, + agent_name: str, + session_id: str, **kwargs: Any ) -> None: ... @overload def update_details( - self, - agent_name: str, - *, - agent_card: Optional[AgentCard] = ..., - agent_endpoint: Optional[AgentEndpointConfig] = ..., - content_type: str = "application/merge-patch+json", + self, + agent_name: str, + *, + agent_card: Optional[AgentCard] = ..., + agent_endpoint: Optional[AgentEndpointConfig] = ..., + content_type: str = "application/merge-patch+json", **kwargs: Any ) -> AgentDetails: ... @overload def update_details( - self, - agent_name: str, - body: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AgentDetails: ... - - @overload - def update_details( - self, - agent_name: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", + self, + agent_name: str, + body: PatchAgentObjectRequest, + *, + content_type: str = "application/merge-patch+json", **kwargs: Any ) -> AgentDetails: ... @distributed_trace def upload_session_file( - self, - agent_name: str, - session_id: str, - content: bytes, - *, - path: str, + self, + agent_name: str, + session_id: str, + content: bytes, + *, + path: str, **kwargs: Any ) -> SessionFileWriteResult: ... @@ -9695,71 +9052,50 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaAgentsOperations: def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @distributed_trace def cancel_optimization_job( - self, - job_id: str, + 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 + @distributed_trace def create_optimization_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., + self, + job: OptimizationJob, + *, + operation_id: Optional[str] = ..., **kwargs: Any ) -> OptimizationJob: ... @distributed_trace def delete_optimization_job( - self, - job_id: str, + self, + job_id: str, **kwargs: Any ) -> None: ... @distributed_trace def get_optimization_job( - self, - job_id: str, + 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]] = ..., + self, + *, + agent_name: Optional[str] = ..., + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., + status: Optional[JobStatus] = ..., **kwargs: Any ) -> ItemPaged[OptimizationJobListItem]: ... @@ -9767,69 +9103,48 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaDatasetsOperations: def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @distributed_trace def cancel_generation_job( - self, - job_id: str, + 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 + @distributed_trace def create_generation_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., + self, + job: DataGenerationJob, + *, + operation_id: Optional[str] = ..., **kwargs: Any ) -> DataGenerationJob: ... @distributed_trace def delete_generation_job( - self, - job_id: str, + self, + job_id: str, **kwargs: Any ) -> None: ... @distributed_trace def get_generation_job( - self, - job_id: str, + 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]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> ItemPaged[DataGenerationJob]: ... @@ -9837,325 +9152,166 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaEvaluationTaxonomiesOperations: def __init__( - self, - *args, + 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 + @distributed_trace def create( - self, - name: str, - taxonomy: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + taxonomy: EvaluationTaxonomy, **kwargs: Any ) -> EvaluationTaxonomy: ... @distributed_trace def delete( - self, - name: str, + self, + name: str, **kwargs: Any ) -> None: ... @distributed_trace def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> EvaluationTaxonomy: ... @distributed_trace def list( - self, - *, - input_name: Optional[str] = ..., - input_type: Optional[str] = ..., + 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 + @distributed_trace def update( - self, - name: str, - taxonomy: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + taxonomy: EvaluationTaxonomy, **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: ... + class azure.ai.projects.operations.BetaEvaluatorsOperations: - @overload - def create_generation_job( - self, - job: JSON, - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def cancel_generation_job( + self, + job_id: str, **kwargs: Any ) -> EvaluatorGenerationJob: ... - @overload + @distributed_trace def create_generation_job( - self, - job: IO[bytes], - *, - content_type: str = "application/json", - operation_id: Optional[str] = ..., + self, + job: EvaluatorGenerationJob, + *, + 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 + @distributed_trace def create_version( - self, - name: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + evaluator_version: EvaluatorVersion, **kwargs: Any ) -> EvaluatorVersion: ... @distributed_trace def delete_generation_job( - self, - job_id: str, + self, + job_id: str, **kwargs: Any ) -> None: ... @distributed_trace def delete_version( - self, - name: str, - version: str, + 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 + @distributed_trace def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + credential_request: EvaluatorCredentialRequest, **kwargs: Any ) -> DatasetCredential: ... @distributed_trace def get_generation_job( - self, - job_id: str, + self, + job_id: str, **kwargs: Any ) -> EvaluatorGenerationJob: ... @distributed_trace def get_version( - self, - name: str, - version: str, + 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]] = ..., + 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]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[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]] = ..., + 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 + @distributed_trace def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + pending_upload_request: PendingUploadRequest, **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 + @distributed_trace def update_version( - self, - name: str, - version: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + evaluator_version: EvaluatorVersion, **kwargs: Any ) -> EvaluatorVersion: ... @@ -10163,56 +9319,36 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaInsightsOperations: def __init__( - self, - *args, + 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 + @distributed_trace def generate( - self, - insight: IO[bytes], - *, - content_type: str = "application/json", + self, + insight: Insight, **kwargs: Any ) -> Insight: ... @distributed_trace def get( - self, - insight_id: str, - *, - include_coordinates: Optional[bool] = ..., + 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]] = ..., + self, + *, + agent_name: Optional[str] = ..., + eval_id: Optional[str] = ..., + include_coordinates: Optional[bool] = ..., + run_id: Optional[str] = ..., + type: Optional[InsightType] = ..., **kwargs: Any ) -> ItemPaged[Insight]: ... @@ -10220,312 +9356,228 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaMemoryStoresOperations(GenerateBetaMemoryStoresOperations): def __init__( - self, - *args, + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: JSON, + *, + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", + self, + body: CreateMemoryStoreRequest, + *, + 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", + self, + name: str, + *, + content: str, + content_type: str = "application/json", + kind: MemoryItemKind, + scope: str, **kwargs: Any ) -> MemoryItem: ... @overload def create_memory( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: CreateMemoryRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> MemoryItem: ... @distributed_trace def delete( - self, - name: str, + self, + name: str, **kwargs: Any ) -> DeleteMemoryStoreResult: ... @distributed_trace def delete_memory( - self, - name: str, - memory_id: str, + 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", + self, + name: str, + *, + content_type: str = "application/json", + scope: str, **kwargs: Any ) -> MemoryStoreDeleteScopeResult: ... @overload def delete_scope( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: DeleteScopeRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> MemoryStoreDeleteScopeResult: ... @distributed_trace def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> MemoryStoreDetails: ... @distributed_trace def get_memory( - self, - name: str, - memory_id: str, + 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]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[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]] = ..., + self, + name: str, + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[MemoryItemKind] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., + scope: str, **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]] = ..., + self, + name: str, + body: ListMemoriesRequest, + *, + before: Optional[str] = ..., + content_type: str = "application/json", + kind: Optional[MemoryItemKind] = ..., + limit: Optional[int] = ..., + order: Optional[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, + 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", + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: UpdateMemoryStoreRequest, + *, + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + memory_id: str, + body: UpdateMemoryRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> MemoryItem: ... @@ -10533,93 +9585,69 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaModelsOperations(BetaModelsOperationsGenerated): def __init__( - self, - *args, + 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] = ..., + 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] = ..., + 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, + self, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace def get( - self, - name: str, - version: str, + 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 + @distributed_trace def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + credential_request: ModelCredentialRequest, **kwargs: Any ) -> DatasetCredential: ... @@ -10628,107 +9656,35 @@ namespace azure.ai.projects.operations @distributed_trace def list_versions( - self, - name: str, + 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 + @distributed_trace def pending_create_version( - self, - name: str, - version: str, - model_version: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + model_version: ModelVersion, **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 + @distributed_trace def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + pending_upload_request: ModelPendingUploadRequest, **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 + @distributed_trace def update( - self, - name: str, - version: str, - model_version_update: IO[bytes], - *, - content_type: str = "application/merge-patch+json", + self, + name: str, + version: str, + model_version_update: UpdateModelVersionRequest, **kwargs: Any ) -> ModelVersion: ... @@ -10747,8 +9703,8 @@ namespace azure.ai.projects.operations skills: BetaSkillsOperations def __init__( - self, - *args: Any, + self, + *args: Any, **kwargs: Any ) -> None: ... @@ -10756,42 +9712,22 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaRedTeamsOperations: def __init__( - self, - *args, + 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 + @distributed_trace def create( - self, - red_team: IO[bytes], - *, - content_type: str = "application/json", + self, + red_team: RedTeam, **kwargs: Any ) -> RedTeam: ... @distributed_trace def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> RedTeam: ... @@ -10802,121 +9738,101 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaRoutinesOperations: def __init__( - self, - *args, + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", + self, + routine_name: str, + body: CreateOrUpdateRoutineRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> Routine: ... @distributed_trace def delete( - self, - routine_name: str, + self, + routine_name: str, **kwargs: Any ) -> None: ... @distributed_trace def disable( - self, - routine_name: str, + self, + routine_name: str, **kwargs: Any ) -> Routine: ... @overload def dispatch( - self, - routine_name: str, - *, - content_type: str = "application/json", - payload: Optional[RoutineDispatchPayload] = ..., + 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", + self, + routine_name: str, + body: DispatchRoutineAsyncRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> DispatchRoutineResult: ... @distributed_trace def enable( - self, - routine_name: str, + self, + routine_name: str, **kwargs: Any ) -> Routine: ... @distributed_trace def get( - self, - routine_name: str, + self, + routine_name: str, **kwargs: Any ) -> Routine: ... @distributed_trace def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[str] = ..., + 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] = ..., + self, + routine_name: str, + *, + before: Optional[str] = ..., + filter: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[str] = ..., **kwargs: Any ) -> ItemPaged[RoutineRun]: ... @@ -10924,79 +9840,57 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaSchedulesOperations: def __init__( - self, - *args, + 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 + @distributed_trace def create_or_update( - self, - schedule_id: str, - schedule: IO[bytes], - *, - content_type: str = "application/json", + self, + schedule_id: str, + schedule: Schedule, **kwargs: Any ) -> Schedule: ... @distributed_trace def delete( - self, - schedule_id: str, + self, + schedule_id: str, **kwargs: Any ) -> None: ... @distributed_trace def get( - self, - schedule_id: str, + self, + schedule_id: str, **kwargs: Any ) -> Schedule: ... @distributed_trace def get_run( - self, - schedule_id: str, - run_id: str, + self, + schedule_id: str, + run_id: str, **kwargs: Any ) -> ScheduleRun: ... @distributed_trace def list( - self, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., + self, + *, + enabled: Optional[bool] = ..., + type: Optional[ScheduleTaskType] = ..., **kwargs: Any ) -> ItemPaged[Schedule]: ... @distributed_trace def list_runs( - self, - schedule_id: str, - *, - enabled: Optional[bool] = ..., - type: Optional[Union[str, ScheduleTaskType]] = ..., + self, + schedule_id: str, + *, + enabled: Optional[bool] = ..., + type: Optional[ScheduleTaskType] = ..., **kwargs: Any ) -> ItemPaged[ScheduleRun]: ... @@ -11004,151 +9898,123 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.BetaSkillsOperations: def __init__( - self, - *args, + 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", + 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: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> SkillVersion: ... - - @overload - def create_from_files( - self, - name: str, - content: CreateSkillVersionFromFilesBody, + self, + name: str, + body: CreateSkillVersionRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> SkillVersion: ... - @overload + @distributed_trace def create_from_files( - self, - name: str, - content: JSON, + self, + name: str, + content: CreateSkillVersionFromFilesBody, **kwargs: Any ) -> SkillVersion: ... @distributed_trace def delete( - self, - name: str, + self, + name: str, **kwargs: Any ) -> DeleteSkillResult: ... @distributed_trace def delete_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> DeleteSkillVersionResult: ... @distributed_trace def download( - self, - name: str, + self, + name: str, **kwargs: Any ) -> Iterator[bytes]: ... @distributed_trace def download_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> Iterator[bytes]: ... @distributed_trace def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> SkillDetails: ... @distributed_trace def get_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> SkillVersion: ... @distributed_trace def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> ItemPaged[SkillDetails]: ... @distributed_trace def list_versions( - self, - name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[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", + self, + name: str, + *, + content_type: str = "application/json", + default_version: str, **kwargs: Any ) -> SkillDetails: ... @overload def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: UpdateSkillRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> SkillDetails: ... @@ -11156,35 +10022,35 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.ConnectionsOperations(ConnectionsOperationsGenerated): def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @distributed_trace def get( - self, - name: str, - *, - include_credentials: Optional[bool] = False, + 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, + 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] = ..., + self, + *, + connection_type: Optional[ConnectionType] = ..., + default_connection: Optional[bool] = ..., **kwargs: Any ) -> ItemPaged[Connection]: ... @@ -11192,65 +10058,41 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.DatasetsOperations(DatasetsOperationsGenerated): def __init__( - self, - *args, + 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 + @distributed_trace def create_or_update( - self, - name: str, - version: str, - dataset_version: IO[bytes], - *, - content_type: str = "application/merge-patch+json", + self, + name: str, + version: str, + dataset_version: DatasetVersion, **kwargs: Any ) -> DatasetVersion: ... @distributed_trace def delete( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace def get( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> DatasetVersion: ... @distributed_trace def get_credentials( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> DatasetCredential: ... @@ -11259,64 +10101,40 @@ namespace azure.ai.projects.operations @distributed_trace def list_versions( - self, - name: str, + 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 + @distributed_trace def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + version: str, + pending_upload_request: PendingUploadRequest, **kwargs: Any ) -> PendingUploadResponse: ... @distributed_trace def upload_file( - self, - *, - connection_name: Optional[str] = ..., - file_path: str, - name: str, - version: str, + 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, + self, + *, + connection_name: Optional[str] = ..., + file_pattern: Optional[Pattern] = ..., + folder: str, + name: str, + version: str, **kwargs: Any ) -> FolderDatasetVersion: ... @@ -11324,25 +10142,25 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.DeploymentsOperations: def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @distributed_trace def get( - self, - name: str, + 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] = ..., + self, + *, + deployment_type: Optional[DeploymentType] = ..., + model_name: Optional[str] = ..., + model_publisher: Optional[str] = ..., **kwargs: Any ) -> ItemPaged[Deployment]: ... @@ -11350,62 +10168,62 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.EvaluationRulesOperations(GeneratedEvaluationRulesOperations): def __init__( - self, - *args, + self, + *args, **kwargs ) -> None: ... @overload def create_or_update( - self, - id: str, - evaluation_rule: EvaluationRule, - *, - content_type: str = "application/json", + 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", + 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", + self, + id: str, + evaluation_rule: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any ) -> EvaluationRule: ... @distributed_trace def delete( - self, - id: str, + self, + id: str, **kwargs: Any ) -> None: ... @distributed_trace def get( - self, - id: str, + self, + id: str, **kwargs: Any ) -> EvaluationRule: ... @distributed_trace def list( - self, - *, - action_type: Optional[Union[str, EvaluationRuleActionType]] = ..., - agent_name: Optional[str] = ..., - enabled: Optional[bool] = ..., + self, + *, + action_type: Optional[EvaluationRuleActionType] = ..., + agent_name: Optional[str] = ..., + enabled: Optional[bool] = ..., **kwargs: Any ) -> ItemPaged[EvaluationRule]: ... @@ -11413,57 +10231,33 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.IndexesOperations: def __init__( - self, - *args, + 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 + @distributed_trace def create_or_update( - self, - name: str, - version: str, - index: IO[bytes], - *, - content_type: str = "application/merge-patch+json", + self, + name: str, + version: str, + index: Index, **kwargs: Any ) -> Index: ... @distributed_trace def delete( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace def get( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> Index: ... @@ -11472,8 +10266,8 @@ namespace azure.ai.projects.operations @distributed_trace def list_versions( - self, - name: str, + self, + name: str, **kwargs: Any ) -> ItemPaged[Index]: ... @@ -11489,123 +10283,103 @@ namespace azure.ai.projects.operations class azure.ai.projects.operations.ToolboxesOperations: def __init__( - self, - *args, + 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[ToolboxTool], - **kwargs: Any - ) -> ToolboxVersionObject: ... - - @overload - def create_version( - self, - name: str, - body: JSON, - *, - content_type: str = "application/json", + 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[ToolboxTool], **kwargs: Any ) -> ToolboxVersionObject: ... @overload def create_version( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: CreateToolboxVersionRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> ToolboxVersionObject: ... @distributed_trace def delete( - self, - name: str, + self, + name: str, **kwargs: Any ) -> None: ... @distributed_trace def delete_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> None: ... @distributed_trace def get( - self, - name: str, + self, + name: str, **kwargs: Any ) -> ToolboxObject: ... @distributed_trace def get_version( - self, - name: str, - version: str, + self, + name: str, + version: str, **kwargs: Any ) -> ToolboxVersionObject: ... @distributed_trace def list( - self, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[PageOrder] = ..., **kwargs: Any ) -> ItemPaged[ToolboxObject]: ... @distributed_trace def list_versions( - self, - name: str, - *, - before: Optional[str] = ..., - limit: Optional[int] = ..., - order: Optional[Union[str, PageOrder]] = ..., + self, + name: str, + *, + before: Optional[str] = ..., + limit: Optional[int] = ..., + order: Optional[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", + self, + name: str, + *, + content_type: str = "application/json", + default_version: str, **kwargs: Any ) -> ToolboxObject: ... @overload def update( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", + self, + name: str, + body: UpdateToolboxRequest1, + *, + content_type: str = "application/json", **kwargs: Any ) -> ToolboxObject: ... @@ -11620,9 +10394,9 @@ namespace azure.ai.projects.telemetry def __init__(self) -> None: ... def instrument( - self, - enable_content_recording: Optional[bool] = None, - enable_trace_context_propagation: Optional[bool] = None, + self, + enable_content_recording: Optional[bool] = None, + enable_trace_context_propagation: Optional[bool] = None, enable_baggage_propagation: Optional[bool] = None ) -> None: ... diff --git a/sdk/ai/azure-ai-projects/api.metadata.yml b/sdk/ai/azure-ai-projects/api.metadata.yml index 30461e1b3794..e791cd34a048 100644 --- a/sdk/ai/azure-ai-projects/api.metadata.yml +++ b/sdk/ai/azure-ai-projects/api.metadata.yml @@ -1,3 +1,3 @@ -apiMdSha256: 3769cdd6d12da4829d90f71066b705ee8951c33eac0288d5a5cc3ebc002e6df0 +apiMdSha256: 85f5120f2b8850521efaf75471e6b720a6eff11ae2aee9890ec5d0c44cc4babd parserVersion: 0.3.28 -pythonVersion: 3.14.3 +pythonVersion: 3.11.15 diff --git a/sdk/ai/azure-ai-projects/apiview-properties.json b/sdk/ai/azure-ai-projects/apiview-properties.json index fa141e2c53cf..eefba62b151b 100644 --- a/sdk/ai/azure-ai-projects/apiview-properties.json +++ b/sdk/ai/azure-ai-projects/apiview-properties.json @@ -1,361 +1,6 @@ { "CrossLanguagePackageId": "Azure.AI.Projects", "CrossLanguageDefinitionId": { - "azure.ai.projects.models.Tool": "OpenAI.Tool", - "azure.ai.projects.models.A2APreviewTool": "Azure.AI.Projects.A2APreviewTool", - "azure.ai.projects.models.ToolboxTool": "Azure.AI.Projects.ToolboxTool", - "azure.ai.projects.models.A2APreviewToolboxTool": "Azure.AI.Projects.A2APreviewToolboxTool", - "azure.ai.projects.models.A2AProtocolConfiguration": "Azure.AI.Projects.A2AProtocolConfiguration", - "azure.ai.projects.models.ActivityProtocolConfiguration": "Azure.AI.Projects.ActivityProtocolConfiguration", - "azure.ai.projects.models.AgentBlueprintReference": "Azure.AI.Projects.AgentBlueprintReference", - "azure.ai.projects.models.AgentCard": "Azure.AI.Projects.AgentCard", - "azure.ai.projects.models.AgentCardSkill": "Azure.AI.Projects.AgentCardSkill", - "azure.ai.projects.models.InsightRequest": "Azure.AI.Projects.InsightRequest", - "azure.ai.projects.models.AgentClusterInsightRequest": "Azure.AI.Projects.AgentClusterInsightRequest", - "azure.ai.projects.models.InsightResult": "Azure.AI.Projects.InsightResult", - "azure.ai.projects.models.AgentClusterInsightResult": "Azure.AI.Projects.AgentClusterInsightResult", - "azure.ai.projects.models.DataGenerationJobSource": "Azure.AI.Projects.DataGenerationJobSource", - "azure.ai.projects.models.AgentDataGenerationJobSource": "Azure.AI.Projects.AgentDataGenerationJobSource", - "azure.ai.projects.models.AgentDefinition": "Azure.AI.Projects.AgentDefinition", - "azure.ai.projects.models.AgentDetails": "Azure.AI.Projects.AgentObject", - "azure.ai.projects.models.AgentEndpointAuthorizationScheme": "Azure.AI.Projects.AgentEndpointAuthorizationScheme", - "azure.ai.projects.models.AgentEndpointConfig": "Azure.AI.Projects.AgentEndpointConfig", - "azure.ai.projects.models.EvaluatorGenerationJobSource": "Azure.AI.Projects.EvaluatorGenerationJobSource", - "azure.ai.projects.models.AgentEvaluatorGenerationJobSource": "Azure.AI.Projects.AgentEvaluatorGenerationJobSource", - "azure.ai.projects.models.BaseCredentials": "Azure.AI.Projects.BaseCredentials", - "azure.ai.projects.models.AgenticIdentityPreviewCredentials": "Azure.AI.Projects.AgenticIdentityPreviewCredentials", - "azure.ai.projects.models.AgentIdentity": "Azure.AI.Projects.AgentIdentity", - "azure.ai.projects.models.AgentObjectVersions": "Azure.AI.Projects.AgentObject.versions.anonymous", - "azure.ai.projects.models.AgentSessionResource": "Azure.AI.Projects.AgentSessionResource", - "azure.ai.projects.models.EvaluationTaxonomyInput": "Azure.AI.Projects.EvaluationTaxonomyInput", - "azure.ai.projects.models.AgentTaxonomyInput": "Azure.AI.Projects.AgentTaxonomyInput", - "azure.ai.projects.models.AgentVersionDetails": "Azure.AI.Projects.AgentVersionObject", - "azure.ai.projects.models.AISearchIndexResource": "Azure.AI.Projects.AISearchIndexResource", - "azure.ai.projects.models.ApiError": "OpenAI.Error", - "azure.ai.projects.models.ApiErrorResponse": "Azure.AI.Projects.ApiErrorResponse", - "azure.ai.projects.models.ApiKeyCredentials": "Azure.AI.Projects.ApiKeyCredentials", - "azure.ai.projects.models.ApplyPatchToolParam": "OpenAI.ApplyPatchToolParam", - "azure.ai.projects.models.ApproximateLocation": "OpenAI.ApproximateLocation", - "azure.ai.projects.models.ArtifactProfile": "Azure.AI.Projects.ArtifactProfile", - "azure.ai.projects.models.AutoCodeInterpreterToolParam": "OpenAI.AutoCodeInterpreterToolParam", - "azure.ai.projects.models.EvaluationTarget": "Azure.AI.Projects.Target", - "azure.ai.projects.models.AzureAIAgentTarget": "Azure.AI.Projects.AzureAIAgentTarget", - "azure.ai.projects.models.AzureAIModelTarget": "Azure.AI.Projects.AzureAIModelTarget", - "azure.ai.projects.models.Index": "Azure.AI.Projects.Index", - "azure.ai.projects.models.AzureAISearchIndex": "Azure.AI.Projects.AzureAISearchIndex", - "azure.ai.projects.models.AzureAISearchTool": "Azure.AI.Projects.AzureAISearchTool", - "azure.ai.projects.models.AzureAISearchToolboxTool": "Azure.AI.Projects.AzureAISearchToolboxTool", - "azure.ai.projects.models.AzureAISearchToolResource": "Azure.AI.Projects.AzureAISearchToolResource", - "azure.ai.projects.models.AzureFunctionBinding": "Azure.AI.Projects.AzureFunctionBinding", - "azure.ai.projects.models.AzureFunctionDefinition": "Azure.AI.Projects.AzureFunctionDefinition", - "azure.ai.projects.models.AzureFunctionDefinitionFunction": "Azure.AI.Projects.AzureFunctionDefinition.function.anonymous", - "azure.ai.projects.models.AzureFunctionStorageQueue": "Azure.AI.Projects.AzureFunctionStorageQueue", - "azure.ai.projects.models.AzureFunctionTool": "Azure.AI.Projects.AzureFunctionTool", - "azure.ai.projects.models.RedTeamTargetConfig": "Azure.AI.Projects.RedTeamTargetConfig", - "azure.ai.projects.models.AzureOpenAIModelConfiguration": "Azure.AI.Projects.AzureOpenAIModelConfiguration", - "azure.ai.projects.models.BingCustomSearchConfiguration": "Azure.AI.Projects.BingCustomSearchConfiguration", - "azure.ai.projects.models.BingCustomSearchPreviewTool": "Azure.AI.Projects.BingCustomSearchPreviewTool", - "azure.ai.projects.models.BingCustomSearchToolParameters": "Azure.AI.Projects.BingCustomSearchToolParameters", - "azure.ai.projects.models.BingGroundingSearchConfiguration": "Azure.AI.Projects.BingGroundingSearchConfiguration", - "azure.ai.projects.models.BingGroundingSearchToolParameters": "Azure.AI.Projects.BingGroundingSearchToolParameters", - "azure.ai.projects.models.BingGroundingTool": "Azure.AI.Projects.BingGroundingTool", - "azure.ai.projects.models.BlobReference": "Azure.AI.Projects.BlobReference", - "azure.ai.projects.models.BlobReferenceSasCredential": "Azure.AI.Projects.SasCredential", - "azure.ai.projects.models.BotServiceAuthorizationScheme": "Azure.AI.Projects.BotServiceAuthorizationScheme", - "azure.ai.projects.models.BotServiceRbacAuthorizationScheme": "Azure.AI.Projects.BotServiceRbacAuthorizationScheme", - "azure.ai.projects.models.BotServiceTenantAuthorizationScheme": "Azure.AI.Projects.BotServiceTenantAuthorizationScheme", - "azure.ai.projects.models.BrowserAutomationPreviewTool": "Azure.AI.Projects.BrowserAutomationPreviewTool", - "azure.ai.projects.models.BrowserAutomationPreviewToolboxTool": "Azure.AI.Projects.BrowserAutomationPreviewToolboxTool", - "azure.ai.projects.models.BrowserAutomationToolConnectionParameters": "Azure.AI.Projects.BrowserAutomationToolConnectionParameters", - "azure.ai.projects.models.BrowserAutomationToolParameters": "Azure.AI.Projects.BrowserAutomationToolParameters", - "azure.ai.projects.models.CaptureStructuredOutputsTool": "Azure.AI.Projects.CaptureStructuredOutputsTool", - "azure.ai.projects.models.ChartCoordinate": "Azure.AI.Projects.ChartCoordinate", - "azure.ai.projects.models.MemoryItem": "Azure.AI.Projects.MemoryItem", - "azure.ai.projects.models.ChatSummaryMemoryItem": "Azure.AI.Projects.ChatSummaryMemoryItem", - "azure.ai.projects.models.ClusterInsightResult": "Azure.AI.Projects.ClusterInsightResult", - "azure.ai.projects.models.ClusterTokenUsage": "Azure.AI.Projects.ClusterTokenUsage", - "azure.ai.projects.models.EvaluatorDefinition": "Azure.AI.Projects.EvaluatorDefinition", - "azure.ai.projects.models.CodeBasedEvaluatorDefinition": "Azure.AI.Projects.CodeBasedEvaluatorDefinition", - "azure.ai.projects.models.CodeConfiguration": "Azure.AI.Projects.CodeConfiguration", - "azure.ai.projects.models.CodeInterpreterTool": "OpenAI.CodeInterpreterTool", - "azure.ai.projects.models.CodeInterpreterToolboxTool": "Azure.AI.Projects.CodeInterpreterToolboxTool", - "azure.ai.projects.models.ComparisonFilter": "OpenAI.ComparisonFilter", - "azure.ai.projects.models.CompoundFilter": "OpenAI.CompoundFilter", - "azure.ai.projects.models.ComputerTool": "OpenAI.ComputerTool", - "azure.ai.projects.models.ComputerUsePreviewTool": "OpenAI.ComputerUsePreviewTool", - "azure.ai.projects.models.Connection": "Azure.AI.Projects.Connection", - "azure.ai.projects.models.FunctionShellToolParamEnvironment": "OpenAI.FunctionShellToolParamEnvironment", - "azure.ai.projects.models.ContainerAutoParam": "OpenAI.ContainerAutoParam", - "azure.ai.projects.models.ContainerConfiguration": "Azure.AI.Projects.ContainerConfiguration", - "azure.ai.projects.models.ContainerNetworkPolicyParam": "OpenAI.ContainerNetworkPolicyParam", - "azure.ai.projects.models.ContainerNetworkPolicyAllowlistParam": "OpenAI.ContainerNetworkPolicyAllowlistParam", - "azure.ai.projects.models.ContainerNetworkPolicyDisabledParam": "OpenAI.ContainerNetworkPolicyDisabledParam", - "azure.ai.projects.models.ContainerNetworkPolicyDomainSecretParam": "OpenAI.ContainerNetworkPolicyDomainSecretParam", - "azure.ai.projects.models.ContainerSkill": "OpenAI.ContainerSkill", - "azure.ai.projects.models.EvaluationRuleAction": "Azure.AI.Projects.EvaluationRuleAction", - "azure.ai.projects.models.ContinuousEvaluationRuleAction": "Azure.AI.Projects.ContinuousEvaluationRuleAction", - "azure.ai.projects.models.CosmosDBIndex": "Azure.AI.Projects.CosmosDBIndex", - "azure.ai.projects.models.CreateAsyncResponse": "Azure.AI.Projects.createAsync.Response.anonymous", - "azure.ai.projects.models.CreateSkillVersionFromFilesBody": "Azure.AI.Projects.CreateSkillVersionFromFilesBody", - "azure.ai.projects.models.Trigger": "Azure.AI.Projects.Trigger", - "azure.ai.projects.models.CronTrigger": "Azure.AI.Projects.CronTrigger", - "azure.ai.projects.models.CustomCredential": "Azure.AI.Projects.CustomCredential", - "azure.ai.projects.models.CustomToolParamFormat": "OpenAI.CustomToolParamFormat", - "azure.ai.projects.models.CustomGrammarFormatParam": "OpenAI.CustomGrammarFormatParam", - "azure.ai.projects.models.RoutineTrigger": "Azure.AI.Projects.RoutineTrigger", - "azure.ai.projects.models.CustomRoutineTrigger": "Azure.AI.Projects.CustomRoutineTrigger", - "azure.ai.projects.models.CustomTextFormatParam": "OpenAI.CustomTextFormatParam", - "azure.ai.projects.models.CustomToolParam": "OpenAI.CustomToolParam", - "azure.ai.projects.models.RecurrenceSchedule": "Azure.AI.Projects.RecurrenceSchedule", - "azure.ai.projects.models.DailyRecurrenceSchedule": "Azure.AI.Projects.DailyRecurrenceSchedule", - "azure.ai.projects.models.DataGenerationJob": "Azure.AI.Projects.DataGenerationJob", - "azure.ai.projects.models.DataGenerationJobInputs": "Azure.AI.Projects.DataGenerationJobInputs", - "azure.ai.projects.models.DataGenerationJobOptions": "Azure.AI.Projects.DataGenerationJobOptions", - "azure.ai.projects.models.DataGenerationJobOutput": "Azure.AI.Projects.DataGenerationJobOutput", - "azure.ai.projects.models.DataGenerationJobOutputOptions": "Azure.AI.Projects.DataGenerationJobOutputOptions", - "azure.ai.projects.models.DataGenerationJobResult": "Azure.AI.Projects.DataGenerationJobResult", - "azure.ai.projects.models.DataGenerationModelOptions": "Azure.AI.Projects.DataGenerationModelOptions", - "azure.ai.projects.models.DataGenerationTokenUsage": "Azure.AI.Projects.DataGenerationTokenUsage", - "azure.ai.projects.models.DatasetCredential": "Azure.AI.Projects.AssetCredentialResponse", - "azure.ai.projects.models.DatasetDataGenerationJobOutput": "Azure.AI.Projects.DatasetDataGenerationJobOutput", - "azure.ai.projects.models.DatasetEvaluatorGenerationJobSource": "Azure.AI.Projects.DatasetEvaluatorGenerationJobSource", - "azure.ai.projects.models.DatasetReference": "Azure.AI.Projects.DatasetReference", - "azure.ai.projects.models.DatasetVersion": "Azure.AI.Projects.DatasetVersion", - "azure.ai.projects.models.DeleteAgentResponse": "Azure.AI.Projects.DeleteAgentResponse", - "azure.ai.projects.models.DeleteAgentVersionResponse": "Azure.AI.Projects.DeleteAgentVersionResponse", - "azure.ai.projects.models.DeleteMemoryResult": "Azure.AI.Projects.DeleteMemoryResponse", - "azure.ai.projects.models.DeleteMemoryStoreResult": "Azure.AI.Projects.DeleteMemoryStoreResponse", - "azure.ai.projects.models.DeleteSkillResult": "Azure.AI.Projects.DeleteSkillResponse", - "azure.ai.projects.models.DeleteSkillVersionResult": "Azure.AI.Projects.DeleteSkillVersionResponse", - "azure.ai.projects.models.Deployment": "Azure.AI.Projects.Deployment", - "azure.ai.projects.models.Dimension": "Azure.AI.Projects.Dimension", - "azure.ai.projects.models.DispatchRoutineResult": "Azure.AI.Projects.DispatchRoutineResponse", - "azure.ai.projects.models.EmbeddingConfiguration": "Azure.AI.Projects.EmbeddingConfiguration", - "azure.ai.projects.models.EmptyModelParam": "OpenAI.EmptyModelParam", - "azure.ai.projects.models.EndpointBasedEvaluatorDefinition": "Azure.AI.Projects.EndpointBasedEvaluatorDefinition", - "azure.ai.projects.models.EntraAuthorizationScheme": "Azure.AI.Projects.EntraAuthorizationScheme", - "azure.ai.projects.models.EntraIDCredentials": "Azure.AI.Projects.EntraIDCredentials", - "azure.ai.projects.models.EvalResult": "Azure.AI.Projects.EvalResult", - "azure.ai.projects.models.EvalRunResultCompareItem": "Azure.AI.Projects.EvalRunResultCompareItem", - "azure.ai.projects.models.EvalRunResultComparison": "Azure.AI.Projects.EvalRunResultComparison", - "azure.ai.projects.models.EvalRunResultSummary": "Azure.AI.Projects.EvalRunResultSummary", - "azure.ai.projects.models.EvaluationComparisonInsightRequest": "Azure.AI.Projects.EvaluationComparisonInsightRequest", - "azure.ai.projects.models.EvaluationComparisonInsightResult": "Azure.AI.Projects.EvaluationComparisonInsightResult", - "azure.ai.projects.models.InsightSample": "Azure.AI.Projects.InsightSample", - "azure.ai.projects.models.EvaluationResultSample": "Azure.AI.Projects.EvaluationResultSample", - "azure.ai.projects.models.EvaluationRule": "Azure.AI.Projects.EvaluationRule", - "azure.ai.projects.models.EvaluationRuleFilter": "Azure.AI.Projects.EvaluationRuleFilter", - "azure.ai.projects.models.EvaluationRunClusterInsightRequest": "Azure.AI.Projects.EvaluationRunClusterInsightRequest", - "azure.ai.projects.models.EvaluationRunClusterInsightResult": "Azure.AI.Projects.EvaluationRunClusterInsightResult", - "azure.ai.projects.models.ScheduleTask": "Azure.AI.Projects.ScheduleTask", - "azure.ai.projects.models.EvaluationScheduleTask": "Azure.AI.Projects.EvaluationScheduleTask", - "azure.ai.projects.models.EvaluationTaxonomy": "Azure.AI.Projects.EvaluationTaxonomy", - "azure.ai.projects.models.EvaluatorCredentialRequest": "Azure.AI.Projects.EvaluatorCredentialRequest", - "azure.ai.projects.models.EvaluatorGenerationArtifacts": "Azure.AI.Projects.EvaluatorGenerationArtifacts", - "azure.ai.projects.models.EvaluatorGenerationInputs": "Azure.AI.Projects.EvaluatorGenerationInputs", - "azure.ai.projects.models.EvaluatorGenerationJob": "Azure.AI.Projects.EvaluatorGenerationJob", - "azure.ai.projects.models.EvaluatorGenerationTokenUsage": "Azure.AI.Projects.EvaluatorGenerationTokenUsage", - "azure.ai.projects.models.EvaluatorMetric": "Azure.AI.Projects.EvaluatorMetric", - "azure.ai.projects.models.EvaluatorVersion": "Azure.AI.Projects.EvaluatorVersion", - "azure.ai.projects.models.ExternalAgentDefinition": "Azure.AI.Projects.ExternalAgentDefinition", - "azure.ai.projects.models.FabricDataAgentToolParameters": "Azure.AI.Projects.FabricDataAgentToolParameters", - "azure.ai.projects.models.FabricIQPreviewTool": "Azure.AI.Projects.FabricIQPreviewTool", - "azure.ai.projects.models.FabricIQPreviewToolboxTool": "Azure.AI.Projects.FabricIQPreviewToolboxTool", - "azure.ai.projects.models.FieldMapping": "Azure.AI.Projects.FieldMapping", - "azure.ai.projects.models.FileDataGenerationJobOutput": "Azure.AI.Projects.FileDataGenerationJobOutput", - "azure.ai.projects.models.FileDataGenerationJobSource": "Azure.AI.Projects.FileDataGenerationJobSource", - "azure.ai.projects.models.FileDatasetVersion": "Azure.AI.Projects.FileDatasetVersion", - "azure.ai.projects.models.FileSearchTool": "OpenAI.FileSearchTool", - "azure.ai.projects.models.FileSearchToolboxTool": "Azure.AI.Projects.FileSearchToolboxTool", - "azure.ai.projects.models.VersionSelectionRule": "Azure.AI.Projects.VersionSelectionRule", - "azure.ai.projects.models.FixedRatioVersionSelectionRule": "Azure.AI.Projects.FixedRatioVersionSelectionRule", - "azure.ai.projects.models.FolderDatasetVersion": "Azure.AI.Projects.FolderDatasetVersion", - "azure.ai.projects.models.FoundryModelWarning": "Azure.AI.Projects.FoundryModelWarning", - "azure.ai.projects.models.FunctionShellToolParam": "OpenAI.FunctionShellToolParam", - "azure.ai.projects.models.FunctionShellToolParamEnvironmentContainerReferenceParam": "OpenAI.FunctionShellToolParamEnvironmentContainerReferenceParam", - "azure.ai.projects.models.FunctionShellToolParamEnvironmentLocalEnvironmentParam": "OpenAI.FunctionShellToolParamEnvironmentLocalEnvironmentParam", - "azure.ai.projects.models.FunctionTool": "OpenAI.FunctionTool", - "azure.ai.projects.models.FunctionToolParam": "OpenAI.FunctionToolParam", - "azure.ai.projects.models.GitHubIssueRoutineTrigger": "Azure.AI.Projects.GitHubIssueRoutineTrigger", - "azure.ai.projects.models.TelemetryEndpointAuth": "Azure.AI.Projects.TelemetryEndpointAuth", - "azure.ai.projects.models.HeaderTelemetryEndpointAuth": "Azure.AI.Projects.HeaderTelemetryEndpointAuth", - "azure.ai.projects.models.HostedAgentDefinition": "Azure.AI.Projects.HostedAgentDefinition", - "azure.ai.projects.models.HourlyRecurrenceSchedule": "Azure.AI.Projects.HourlyRecurrenceSchedule", - "azure.ai.projects.models.HumanEvaluationPreviewRuleAction": "Azure.AI.Projects.HumanEvaluationPreviewRuleAction", - "azure.ai.projects.models.HybridSearchOptions": "OpenAI.HybridSearchOptions", - "azure.ai.projects.models.ImageGenTool": "OpenAI.ImageGenTool", - "azure.ai.projects.models.ImageGenToolInputImageMask": "OpenAI.ImageGenToolInputImageMask", - "azure.ai.projects.models.InlineSkillParam": "OpenAI.InlineSkillParam", - "azure.ai.projects.models.InlineSkillSourceParam": "OpenAI.InlineSkillSourceParam", - "azure.ai.projects.models.Insight": "Azure.AI.Projects.Insight", - "azure.ai.projects.models.InsightCluster": "Azure.AI.Projects.InsightCluster", - "azure.ai.projects.models.InsightModelConfiguration": "Azure.AI.Projects.InsightModelConfiguration", - "azure.ai.projects.models.InsightScheduleTask": "Azure.AI.Projects.InsightScheduleTask", - "azure.ai.projects.models.InsightsMetadata": "Azure.AI.Projects.InsightsMetadata", - "azure.ai.projects.models.InsightSummary": "Azure.AI.Projects.InsightSummary", - "azure.ai.projects.models.InvocationsProtocolConfiguration": "Azure.AI.Projects.InvocationsProtocolConfiguration", - "azure.ai.projects.models.InvocationsWsProtocolConfiguration": "Azure.AI.Projects.InvocationsWsProtocolConfiguration", - "azure.ai.projects.models.RoutineDispatchPayload": "Azure.AI.Projects.RoutineDispatchPayload", - "azure.ai.projects.models.InvokeAgentInvocationsApiDispatchPayload": "Azure.AI.Projects.InvokeAgentInvocationsApiDispatchPayload", - "azure.ai.projects.models.RoutineAction": "Azure.AI.Projects.RoutineAction", - "azure.ai.projects.models.InvokeAgentInvocationsApiRoutineAction": "Azure.AI.Projects.InvokeAgentInvocationsApiRoutineAction", - "azure.ai.projects.models.InvokeAgentResponsesApiDispatchPayload": "Azure.AI.Projects.InvokeAgentResponsesApiDispatchPayload", - "azure.ai.projects.models.InvokeAgentResponsesApiRoutineAction": "Azure.AI.Projects.InvokeAgentResponsesApiRoutineAction", - "azure.ai.projects.models.LocalShellToolParam": "OpenAI.LocalShellToolParam", - "azure.ai.projects.models.LocalSkillParam": "OpenAI.LocalSkillParam", - "azure.ai.projects.models.LoraConfig": "Azure.AI.Projects.LoraConfig", - "azure.ai.projects.models.ManagedAgentIdentityBlueprintReference": "Azure.AI.Projects.ManagedAgentIdentityBlueprintReference", - "azure.ai.projects.models.ManagedAzureAISearchIndex": "Azure.AI.Projects.ManagedAzureAISearchIndex", - "azure.ai.projects.models.McpProtocolConfiguration": "Azure.AI.Projects.McpProtocolConfiguration", - "azure.ai.projects.models.MCPTool": "OpenAI.MCPTool", - "azure.ai.projects.models.MCPToolboxTool": "Azure.AI.Projects.MCPToolboxTool", - "azure.ai.projects.models.MCPToolFilter": "OpenAI.MCPToolFilter", - "azure.ai.projects.models.MCPToolRequireApproval": "OpenAI.MCPToolRequireApproval", - "azure.ai.projects.models.MemoryOperation": "Azure.AI.Projects.MemoryOperation", - "azure.ai.projects.models.MemorySearchItem": "Azure.AI.Projects.MemorySearchItem", - "azure.ai.projects.models.MemorySearchOptions": "Azure.AI.Projects.MemorySearchOptions", - "azure.ai.projects.models.MemorySearchPreviewTool": "Azure.AI.Projects.MemorySearchPreviewTool", - "azure.ai.projects.models.MemoryStoreDefinition": "Azure.AI.Projects.MemoryStoreDefinition", - "azure.ai.projects.models.MemoryStoreDefaultDefinition": "Azure.AI.Projects.MemoryStoreDefaultDefinition", - "azure.ai.projects.models.MemoryStoreDefaultOptions": "Azure.AI.Projects.MemoryStoreDefaultOptions", - "azure.ai.projects.models.MemoryStoreDeleteScopeResult": "Azure.AI.Projects.MemoryStoreDeleteScopeResponse", - "azure.ai.projects.models.MemoryStoreDetails": "Azure.AI.Projects.MemoryStoreObject", - "azure.ai.projects.models.MemoryStoreOperationUsage": "Azure.AI.Projects.MemoryStoreOperationUsage", - "azure.ai.projects.models.MemoryStoreSearchResult": "Azure.AI.Projects.MemoryStoreSearchResponse", - "azure.ai.projects.models.MemoryStoreUpdateCompletedResult": "Azure.AI.Projects.MemoryStoreUpdateCompletedResult", - "azure.ai.projects.models.MemoryStoreUpdateResult": "Azure.AI.Projects.MemoryStoreUpdateResponse", - "azure.ai.projects.models.MicrosoftFabricPreviewTool": "Azure.AI.Projects.MicrosoftFabricPreviewTool", - "azure.ai.projects.models.ModelCredentialRequest": "Azure.AI.Projects.ModelCredentialRequest", - "azure.ai.projects.models.ModelDeployment": "Azure.AI.Projects.ModelDeployment", - "azure.ai.projects.models.ModelDeploymentSku": "Azure.AI.Projects.Sku", - "azure.ai.projects.models.ModelPendingUploadRequest": "Azure.AI.Projects.ModelPendingUploadRequest", - "azure.ai.projects.models.ModelPendingUploadResponse": "Azure.AI.Projects.ModelPendingUploadResponse", - "azure.ai.projects.models.ModelSamplingParams": "Azure.AI.Projects.ModelSamplingParams", - "azure.ai.projects.models.ModelSourceData": "Azure.AI.Projects.ModelSourceData", - "azure.ai.projects.models.ModelVersion": "Azure.AI.Projects.ModelVersion", - "azure.ai.projects.models.MonthlyRecurrenceSchedule": "Azure.AI.Projects.MonthlyRecurrenceSchedule", - "azure.ai.projects.models.NamespaceToolParam": "OpenAI.NamespaceToolParam", - "azure.ai.projects.models.NoAuthenticationCredentials": "Azure.AI.Projects.NoAuthenticationCredentials", - "azure.ai.projects.models.OneTimeTrigger": "Azure.AI.Projects.OneTimeTrigger", - "azure.ai.projects.models.OpenApiAuthDetails": "Azure.AI.Projects.OpenApiAuthDetails", - "azure.ai.projects.models.OpenApiAnonymousAuthDetails": "Azure.AI.Projects.OpenApiAnonymousAuthDetails", - "azure.ai.projects.models.OpenApiFunctionDefinition": "Azure.AI.Projects.OpenApiFunctionDefinition", - "azure.ai.projects.models.OpenApiFunctionDefinitionFunction": "Azure.AI.Projects.OpenApiFunctionDefinition.function.anonymous", - "azure.ai.projects.models.OpenApiManagedAuthDetails": "Azure.AI.Projects.OpenApiManagedAuthDetails", - "azure.ai.projects.models.OpenApiManagedSecurityScheme": "Azure.AI.Projects.OpenApiManagedSecurityScheme", - "azure.ai.projects.models.OpenApiProjectConnectionAuthDetails": "Azure.AI.Projects.OpenApiProjectConnectionAuthDetails", - "azure.ai.projects.models.OpenApiProjectConnectionSecurityScheme": "Azure.AI.Projects.OpenApiProjectConnectionSecurityScheme", - "azure.ai.projects.models.OpenApiTool": "Azure.AI.Projects.OpenApiTool", - "azure.ai.projects.models.OpenApiToolboxTool": "Azure.AI.Projects.OpenApiToolboxTool", - "azure.ai.projects.models.OptimizationAgentIdentifier": "Azure.AI.Projects.OptimizationAgentIdentifier", - "azure.ai.projects.models.OptimizationCandidate": "Azure.AI.Projects.OptimizationCandidate", - "azure.ai.projects.models.OptimizationDatasetCriterion": "Azure.AI.Projects.OptimizationDatasetCriterion", - "azure.ai.projects.models.OptimizationDatasetInput": "Azure.AI.Projects.OptimizationDatasetInput", - "azure.ai.projects.models.OptimizationDatasetItem": "Azure.AI.Projects.OptimizationDatasetItem", - "azure.ai.projects.models.OptimizationEvaluatorRef": "Azure.AI.Projects.OptimizationEvaluatorRef", - "azure.ai.projects.models.OptimizationInlineDatasetInput": "Azure.AI.Projects.OptimizationInlineDatasetInput", - "azure.ai.projects.models.OptimizationJob": "Azure.AI.Projects.OptimizationJob", - "azure.ai.projects.models.OptimizationJobInputs": "Azure.AI.Projects.OptimizationJobInputs", - "azure.ai.projects.models.OptimizationJobListItem": "Azure.AI.Projects.OptimizationJobListItem", - "azure.ai.projects.models.OptimizationJobProgress": "Azure.AI.Projects.OptimizationJobProgress", - "azure.ai.projects.models.OptimizationJobResult": "Azure.AI.Projects.OptimizationJobResult", - "azure.ai.projects.models.OptimizationOptions": "Azure.AI.Projects.OptimizationOptions", - "azure.ai.projects.models.OptimizationReferenceDatasetInput": "Azure.AI.Projects.OptimizationReferenceDatasetInput", - "azure.ai.projects.models.TelemetryEndpoint": "Azure.AI.Projects.TelemetryEndpoint", - "azure.ai.projects.models.OtlpTelemetryEndpoint": "Azure.AI.Projects.OtlpTelemetryEndpoint", - "azure.ai.projects.models.PendingUploadRequest": "Azure.AI.Projects.PendingUploadRequest", - "azure.ai.projects.models.PendingUploadResponse": "Azure.AI.Projects.PendingUploadResponse", - "azure.ai.projects.models.ProceduralMemoryItem": "Azure.AI.Projects.ProceduralMemoryItem", - "azure.ai.projects.models.PromotionInfo": "Azure.AI.Projects.PromotionInfo", - "azure.ai.projects.models.PromptAgentDefinition": "Azure.AI.Projects.PromptAgentDefinition", - "azure.ai.projects.models.PromptAgentDefinitionTextOptions": "Azure.AI.Projects.PromptAgentDefinitionTextOptions", - "azure.ai.projects.models.PromptBasedEvaluatorDefinition": "Azure.AI.Projects.PromptBasedEvaluatorDefinition", - "azure.ai.projects.models.PromptDataGenerationJobSource": "Azure.AI.Projects.PromptDataGenerationJobSource", - "azure.ai.projects.models.PromptEvaluatorGenerationJobSource": "Azure.AI.Projects.PromptEvaluatorGenerationJobSource", - "azure.ai.projects.models.ProtocolConfiguration": "Azure.AI.Projects.ProtocolConfiguration", - "azure.ai.projects.models.ProtocolVersionRecord": "Azure.AI.Projects.ProtocolVersionRecord", - "azure.ai.projects.models.RaiConfig": "Azure.AI.Projects.RaiConfig", - "azure.ai.projects.models.RankingOptions": "OpenAI.RankingOptions", - "azure.ai.projects.models.Reasoning": "OpenAI.Reasoning", - "azure.ai.projects.models.RecurrenceTrigger": "Azure.AI.Projects.RecurrenceTrigger", - "azure.ai.projects.models.RedTeam": "Azure.AI.Projects.RedTeam", - "azure.ai.projects.models.ReminderPreviewTool": "Azure.AI.Projects.ReminderPreviewTool", - "azure.ai.projects.models.ReminderPreviewToolboxTool": "Azure.AI.Projects.ReminderPreviewToolboxTool", - "azure.ai.projects.models.ResponsesProtocolConfiguration": "Azure.AI.Projects.ResponsesProtocolConfiguration", - "azure.ai.projects.models.ResponseUsageInputTokensDetails": "OpenAI.ResponseUsageInputTokensDetails", - "azure.ai.projects.models.ResponseUsageOutputTokensDetails": "OpenAI.ResponseUsageOutputTokensDetails", - "azure.ai.projects.models.Routine": "Azure.AI.Projects.Routine", - "azure.ai.projects.models.RoutineRun": "Azure.AI.Projects.RoutineRun", - "azure.ai.projects.models.RubricBasedEvaluatorDefinition": "Azure.AI.Projects.RubricBasedEvaluatorDefinition", - "azure.ai.projects.models.SASCredentials": "Azure.AI.Projects.SASCredentials", - "azure.ai.projects.models.Schedule": "Azure.AI.Projects.Schedule", - "azure.ai.projects.models.ScheduleRoutineTrigger": "Azure.AI.Projects.ScheduleRoutineTrigger", - "azure.ai.projects.models.ScheduleRun": "Azure.AI.Projects.ScheduleRun", - "azure.ai.projects.models.SessionDirectoryEntry": "Azure.AI.Projects.SessionDirectoryEntry", - "azure.ai.projects.models.SessionFileWriteResult": "Azure.AI.Projects.SessionFileWriteResponse", - "azure.ai.projects.models.SessionLogEvent": "Azure.AI.Projects.SessionLogEvent", - "azure.ai.projects.models.SharepointGroundingToolParameters": "Azure.AI.Projects.SharepointGroundingToolParameters", - "azure.ai.projects.models.SharepointPreviewTool": "Azure.AI.Projects.SharepointPreviewTool", - "azure.ai.projects.models.SimpleQnADataGenerationJobOptions": "Azure.AI.Projects.SimpleQnADataGenerationJobOptions", - "azure.ai.projects.models.SkillDetails": "Azure.AI.Projects.Skill", - "azure.ai.projects.models.SkillInlineContent": "Azure.AI.Projects.SkillInlineContent", - "azure.ai.projects.models.SkillReferenceParam": "OpenAI.SkillReferenceParam", - "azure.ai.projects.models.SkillVersion": "Azure.AI.Projects.SkillVersion", - "azure.ai.projects.models.ToolChoiceParam": "OpenAI.ToolChoiceParam", - "azure.ai.projects.models.SpecificApplyPatchParam": "OpenAI.SpecificApplyPatchParam", - "azure.ai.projects.models.SpecificFunctionShellParam": "OpenAI.SpecificFunctionShellParam", - "azure.ai.projects.models.StructuredInputDefinition": "Azure.AI.Projects.StructuredInputDefinition", - "azure.ai.projects.models.StructuredOutputDefinition": "Azure.AI.Projects.StructuredOutputDefinition", - "azure.ai.projects.models.TaxonomyCategory": "Azure.AI.Projects.TaxonomyCategory", - "azure.ai.projects.models.TaxonomySubCategory": "Azure.AI.Projects.TaxonomySubCategory", - "azure.ai.projects.models.TelemetryConfig": "Azure.AI.Projects.TelemetryConfig", - "azure.ai.projects.models.TextResponseFormat": "OpenAI.TextResponseFormatConfiguration", - "azure.ai.projects.models.TextResponseFormatJsonObject": "OpenAI.TextResponseFormatConfigurationResponseFormatJsonObject", - "azure.ai.projects.models.TextResponseFormatJsonSchema": "OpenAI.TextResponseFormatJsonSchema", - "azure.ai.projects.models.TextResponseFormatText": "OpenAI.TextResponseFormatConfigurationResponseFormatText", - "azure.ai.projects.models.TimerRoutineTrigger": "Azure.AI.Projects.TimerRoutineTrigger", - "azure.ai.projects.models.ToolboxObject": "Azure.AI.Projects.ToolboxObject", - "azure.ai.projects.models.ToolboxPolicies": "Azure.AI.Projects.ToolboxPolicies", - "azure.ai.projects.models.ToolboxSearchPreviewToolboxTool": "Azure.AI.Projects.ToolboxSearchPreviewToolboxTool", - "azure.ai.projects.models.ToolboxSkill": "Azure.AI.Projects.ToolboxSkill", - "azure.ai.projects.models.ToolboxSkillReference": "Azure.AI.Projects.ToolboxSkillReference", - "azure.ai.projects.models.ToolboxVersionObject": "Azure.AI.Projects.ToolboxVersionObject", - "azure.ai.projects.models.ToolChoiceAllowed": "OpenAI.ToolChoiceAllowed", - "azure.ai.projects.models.ToolChoiceCodeInterpreter": "OpenAI.ToolChoiceCodeInterpreter", - "azure.ai.projects.models.ToolChoiceComputer": "OpenAI.ToolChoiceComputer", - "azure.ai.projects.models.ToolChoiceComputerUse": "OpenAI.ToolChoiceComputerUse", - "azure.ai.projects.models.ToolChoiceComputerUsePreview": "OpenAI.ToolChoiceComputerUsePreview", - "azure.ai.projects.models.ToolChoiceCustom": "OpenAI.ToolChoiceCustom", - "azure.ai.projects.models.ToolChoiceFileSearch": "OpenAI.ToolChoiceFileSearch", - "azure.ai.projects.models.ToolChoiceFunction": "OpenAI.ToolChoiceFunction", - "azure.ai.projects.models.ToolChoiceImageGeneration": "OpenAI.ToolChoiceImageGeneration", - "azure.ai.projects.models.ToolChoiceMCP": "OpenAI.ToolChoiceMCP", - "azure.ai.projects.models.ToolChoiceWebSearchPreview": "OpenAI.ToolChoiceWebSearchPreview", - "azure.ai.projects.models.ToolChoiceWebSearchPreview20250311": "OpenAI.ToolChoiceWebSearchPreview20250311", - "azure.ai.projects.models.ToolConfig": "Azure.AI.Projects.ToolConfig", - "azure.ai.projects.models.ToolDescription": "Azure.AI.Projects.ToolDescription", - "azure.ai.projects.models.ToolProjectConnection": "Azure.AI.Projects.ToolProjectConnection", - "azure.ai.projects.models.ToolSearchToolParam": "OpenAI.ToolSearchToolParam", - "azure.ai.projects.models.ToolUseFineTuningDataGenerationJobOptions": "Azure.AI.Projects.ToolUseFineTuningDataGenerationJobOptions", - "azure.ai.projects.models.TracesDataGenerationJobOptions": "Azure.AI.Projects.TracesDataGenerationJobOptions", - "azure.ai.projects.models.TracesDataGenerationJobSource": "Azure.AI.Projects.TracesDataGenerationJobSource", - "azure.ai.projects.models.TracesEvaluatorGenerationJobSource": "Azure.AI.Projects.TracesEvaluatorGenerationJobSource", - "azure.ai.projects.models.UpdateModelVersionRequest": "Azure.AI.Projects.UpdateModelVersionRequest", - "azure.ai.projects.models.UpdateToolboxRequest": "Azure.AI.Projects.UpdateToolboxRequest", - "azure.ai.projects.models.UserProfileMemoryItem": "Azure.AI.Projects.UserProfileMemoryItem", - "azure.ai.projects.models.VersionIndicator": "Azure.AI.Projects.VersionIndicator", - "azure.ai.projects.models.VersionRefIndicator": "Azure.AI.Projects.VersionRefIndicator", - "azure.ai.projects.models.VersionSelector": "Azure.AI.Projects.VersionSelector", - "azure.ai.projects.models.WebSearchApproximateLocation": "OpenAI.WebSearchApproximateLocation", - "azure.ai.projects.models.WebSearchConfiguration": "Azure.AI.Projects.WebSearchConfiguration", - "azure.ai.projects.models.WebSearchPreviewTool": "OpenAI.WebSearchPreviewTool", - "azure.ai.projects.models.WebSearchTool": "OpenAI.WebSearchTool", - "azure.ai.projects.models.WebSearchToolboxTool": "Azure.AI.Projects.WebSearchToolboxTool", - "azure.ai.projects.models.WebSearchToolFilters": "OpenAI.WebSearchToolFilters", - "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.WorkIQPreviewToolboxTool": "Azure.AI.Projects.WorkIQPreviewToolboxTool", "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", 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 f1f15152e708..7e83a9c253f0 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py @@ -13,7 +13,7 @@ import logging from typing import List, Any, Optional import httpx # pylint: disable=networking-import-outside-azure-core-transport -from openai import OpenAI +from azure.ai.extensions.openai.openai import OpenAI from azure.core.tracing.decorator import distributed_trace from azure.core.credentials import TokenCredential from azure.identity import get_bearer_token_provider diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/_unions.py b/sdk/ai/azure-ai-projects/azure/ai/projects/_unions.py new file mode 100644 index 000000000000..938bf5a7426e --- /dev/null +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/_unions.py @@ -0,0 +1,5 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""Compatibility re-export for extension-owned Azure AI Projects generated types.""" + +from azure.ai.extensions.openai.projects._generated._unions import * # type: ignore # noqa: F401,F403 diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py index c338b00b8bf8..0468fed14f0e 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py @@ -12,7 +12,7 @@ import logging from typing import List, Any, Optional import httpx # pylint: disable=networking-import-outside-azure-core-transport -from openai import AsyncOpenAI +from azure.ai.extensions.openai.openai import AsyncOpenAI from azure.core.tracing.decorator import distributed_trace from azure.core.credentials_async import AsyncTokenCredential from azure.identity.aio import get_bearer_token_provider 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 ba856252bdd8..7dccd2ee9ac6 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 @@ -7,9 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from io import IOBase -import json -from typing import Any, AsyncIterator, Callable, IO, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -32,8 +30,7 @@ from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict -from ... import models as _models -from ..._utils.model_base import Model as _Model, SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ... import types, types as _types from ..._utils.serialization import Deserializer, Serializer from ..._utils.utils import prepare_multipart_form_data from ...operations._operations import ( @@ -229,16 +226,197 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: + async def get(self, agent_name: str, **kwargs: Any) -> _types.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 + :return: AgentDetails + :rtype: ~azure.ai.projects.types.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -251,7 +429,7 @@ async def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentDetails] = kwargs.pop("cls", None) _request = build_agents_get_request( agent_name=agent_name, @@ -279,16 +457,19 @@ async def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -298,7 +479,7 @@ async def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: @distributed_trace_async async def delete( self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any - ) -> _models.DeleteAgentResponse: + ) -> _types.DeleteAgentResponse: """Delete an agent. Deletes an agent. For hosted agents, if any version has active sessions, the request is @@ -312,9 +493,19 @@ async def delete( ``false`` if a value is not specified by the caller. This value is not relevant for other Agent types. Default value is None. :paramtype force: bool - :return: DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteAgentResponse + :return: DeleteAgentResponse + :rtype: ~azure.ai.projects.types.DeleteAgentResponse :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -327,7 +518,7 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteAgentResponse] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteAgentResponse] = kwargs.pop("cls", None) _request = build_agents_delete_request( agent_name=agent_name, @@ -356,16 +547,19 @@ async def delete( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteAgentResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -376,12 +570,12 @@ async def delete( def list( self, *, - kind: Optional[Union[str, _models.AgentKind]] = None, + kind: Optional[types.AgentKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.AgentDetails"]: + ) -> AsyncItemPaged["_types.AgentDetails"]: """List agents. Returns a paged collection of agent resources. @@ -404,13 +598,194 @@ def list( Default value is None. :paramtype before: str :return: An iterator like instance of AgentDetails - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.AgentDetails] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.AgentDetails] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.AgentDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -440,10 +815,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.AgentDetails], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -459,9 +831,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -474,14 +846,14 @@ async def create_version( self, agent_name: str, *, - definition: _models.AgentDefinition, + definition: _types.AgentDefinition, content_type: str = "application/json", metadata: Optional[dict[str, str]] = None, description: Optional[str] = None, - blueprint_reference: Optional[_models.AgentBlueprintReference] = None, + blueprint_reference: Optional[_types.AgentBlueprintReference] = None, draft: Optional[bool] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.AgentVersionDetails: """Create an agent version. Creates a new version for the specified agent and returns the created version resource. @@ -495,7 +867,7 @@ async def create_version( :type agent_name: str :keyword definition: The agent definition. This can be a workflow, hosted agent, or a simple agent definition. Required. - :paramtype definition: ~azure.ai.projects.models.AgentDefinition + :paramtype definition: ~azure.ai.projects.types.AgentDefinition :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -509,21 +881,153 @@ async def create_version( :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. - :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference + :paramtype blueprint_reference: ~azure.ai.projects.types.AgentBlueprintReference :keyword draft: (Preview) Whether this agent version is a draft (candidate) rather than a release. The service defaults to ``false`` if a value is not specified by the caller. Draft versions are recorded but excluded from default 'latest' resolution and are not auto-promoted. Default value is None. :paramtype draft: bool - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ @overload async def create_version( - self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: + self, + agent_name: str, + body: _types.CreateAgentVersionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.AgentVersionDetails: """Create an agent version. Creates a new version for the specified agent and returns the created version resource. @@ -536,53 +1040,264 @@ async def create_version( * Must not exceed 63 characters. Required. :type agent_name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateAgentVersionRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create_version( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version. + Example: + .. code-block:: python - Creates a new version for the specified agent and returns the created version resource. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. 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/json". - :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template you can fill out and use as your body input. + body = { + "definition": agent_definition, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ @distributed_trace_async async def create_version( self, agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateAgentVersionRequest] = _Unset, *, - definition: _models.AgentDefinition = _Unset, + definition: _types.AgentDefinition = _Unset, metadata: Optional[dict[str, str]] = None, description: Optional[str] = None, - blueprint_reference: Optional[_models.AgentBlueprintReference] = None, + blueprint_reference: Optional[_types.AgentBlueprintReference] = None, draft: Optional[bool] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.AgentVersionDetails: """Create an agent version. Creates a new version for the specified agent and returns the created version resource. @@ -594,11 +1309,11 @@ async def create_version( * Can contain hyphens in the middle * Must not exceed 63 characters. Required. :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateAgentVersionRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateAgentVersionRequest :keyword definition: The agent definition. This can be a workflow, hosted agent, or a simple agent definition. Required. - :paramtype definition: ~azure.ai.projects.models.AgentDefinition + :paramtype definition: ~azure.ai.projects.types.AgentDefinition :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. @@ -609,15 +1324,251 @@ async def create_version( :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. - :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference + :paramtype blueprint_reference: ~azure.ai.projects.types.AgentBlueprintReference :keyword draft: (Preview) Whether this agent version is a draft (candidate) rather than a release. The service defaults to ``false`` if a value is not specified by the caller. Draft versions are recorded but excluded from default 'latest' resolution and are not auto-promoted. Default value is None. :paramtype draft: bool - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template you can fill out and use as your body input. + body = { + "definition": agent_definition, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -631,7 +1582,7 @@ async def create_version( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentVersionDetails] = kwargs.pop("cls", None) if body is _Unset: if definition is _Unset: @@ -645,17 +1596,17 @@ async def create_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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_agents_create_version_request( agent_name=agent_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -679,16 +1630,19 @@ async def create_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -706,7 +1660,7 @@ async def create_version_from_manifest( metadata: Optional[dict[str, str]] = None, description: Optional[str] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.AgentVersionDetails: """Create an agent version from manifest. Imports the provided manifest to create a new version for the specified agent. @@ -735,15 +1689,147 @@ async def create_version_from_manifest( :paramtype metadata: dict[str, str] :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ @overload async def create_version_from_manifest( - self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: + self, + agent_name: str, + body: _types.CreateAgentVersionFromManifestRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.AgentVersionDetails: """Create an agent version from manifest. Imports the provided manifest to create a new version for the specified agent. @@ -756,52 +1842,166 @@ async def create_version_from_manifest( * Must not exceed 63 characters. Required. :type agent_name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateAgentVersionFromManifestRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create_version_from_manifest( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version from manifest. + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "manifest_id": "str", + "parameter_values": { + "str": {} + }, + "description": "str", + "metadata": { + "str": "str" + } + } - Imports the provided manifest to create a new version for the specified agent. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. 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/json". - :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ @distributed_trace_async async def create_version_from_manifest( self, agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateAgentVersionFromManifestRequest] = _Unset, *, manifest_id: str = _Unset, parameter_values: dict[str, Any] = _Unset, metadata: Optional[dict[str, str]] = None, description: Optional[str] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.AgentVersionDetails: """Create an agent version from manifest. Imports the provided manifest to create a new version for the specified agent. @@ -813,8 +2013,8 @@ async def create_version_from_manifest( * Can contain hyphens in the middle * Must not exceed 63 characters. Required. :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateAgentVersionFromManifestRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateAgentVersionFromManifestRequest :keyword manifest_id: The manifest ID to import the agent version from. Required. :paramtype manifest_id: str :keyword parameter_values: The inputs to the manifest that will result in a fully materialized @@ -829,9 +2029,148 @@ async def create_version_from_manifest( :paramtype metadata: dict[str, str] :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "manifest_id": "str", + "parameter_values": { + "str": {} + }, + "description": "str", + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -845,7 +2184,7 @@ async def create_version_from_manifest( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentVersionDetails] = kwargs.pop("cls", None) if body is _Unset: if manifest_id is _Unset: @@ -860,17 +2199,17 @@ async def create_version_from_manifest( } 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_agents_create_version_from_manifest_request( agent_name=agent_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -894,16 +2233,19 @@ async def create_version_from_manifest( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -911,7 +2253,7 @@ async def create_version_from_manifest( return deserialized # type: ignore @distributed_trace_async - async def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _models.AgentVersionDetails: + async def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _types.AgentVersionDetails: """Get an agent version. Retrieves the specified version of an agent by its agent name and version identifier. @@ -920,9 +2262,136 @@ async def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) :type agent_name: str :param agent_version: The version of the agent to retrieve. Required. :type agent_version: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -935,7 +2404,7 @@ async def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentVersionDetails] = kwargs.pop("cls", None) _request = build_agents_get_version_request( agent_name=agent_name, @@ -964,16 +2433,19 @@ async def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -983,7 +2455,7 @@ async def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) @distributed_trace_async async def delete_version( self, agent_name: str, agent_version: str, *, force: Optional[bool] = None, **kwargs: Any - ) -> _models.DeleteAgentVersionResponse: + ) -> _types.DeleteAgentVersionResponse: """Delete an agent version. Deletes a specific version of an agent. For hosted agents, if the version has active sessions, @@ -999,10 +2471,20 @@ async def delete_version( value is not specified by the caller. This value is not relevant for other Agent types. Default value is None. :paramtype force: bool - :return: DeleteAgentVersionResponse. The DeleteAgentVersionResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.DeleteAgentVersionResponse + :return: DeleteAgentVersionResponse + :rtype: ~azure.ai.projects.types.DeleteAgentVersionResponse :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1015,7 +2497,7 @@ async def delete_version( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteAgentVersionResponse] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteAgentVersionResponse] = kwargs.pop("cls", None) _request = build_agents_delete_version_request( agent_name=agent_name, @@ -1045,16 +2527,19 @@ async def delete_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteAgentVersionResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1067,11 +2552,11 @@ def list_versions( agent_name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, include_drafts: Optional[bool] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.AgentVersionDetails"]: + ) -> AsyncItemPaged["_types.AgentVersionDetails"]: """List agent versions. Returns a paged collection of versions for the specified agent. @@ -1097,13 +2582,140 @@ def list_versions( versions are returned). Default value is None. :paramtype include_drafts: bool :return: An iterator like instance of AgentVersionDetails - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.AgentVersionDetails] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.AgentVersionDetails] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentVersionDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.AgentVersionDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1134,10 +2746,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.AgentVersionDetails], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -1153,9 +2762,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -1169,10 +2778,10 @@ async def update_details( agent_name: str, *, content_type: str = "application/merge-patch+json", - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, + agent_endpoint: Optional[_types.AgentEndpointConfig] = None, + agent_card: Optional[_types.AgentCard] = None, **kwargs: Any - ) -> _models.AgentDetails: + ) -> _types.AgentDetails: """Update an agent endpoint. Applies a merge-patch update to the specified agent endpoint configuration. @@ -1183,38 +2792,204 @@ async def update_details( 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 + :paramtype agent_endpoint: ~azure.ai.projects.types.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 + :paramtype agent_card: ~azure.ai.projects.types.AgentCard + :return: AgentDetails + :rtype: ~azure.ai.projects.types.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def update_details( - self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. + Example: + .. code-block:: python - Applies a merge-patch update to the specified agent endpoint configuration. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": - :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: + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ @overload async def update_details( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: + self, + agent_name: str, + body: _types.PatchAgentObjectRequest, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _types.AgentDetails: """Update an agent endpoint. Applies a merge-patch update to the specified agent endpoint configuration. @@ -1222,40 +2997,484 @@ async def update_details( :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. + :type body: ~azure.ai.projects.types.PatchAgentObjectRequest + :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 + :return: AgentDetails + :rtype: ~azure.ai.projects.types.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ @distributed_trace_async async def update_details( self, agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.PatchAgentObjectRequest] = _Unset, *, - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, + agent_endpoint: Optional[_types.AgentEndpointConfig] = None, + agent_card: Optional[_types.AgentCard] = None, **kwargs: Any - ) -> _models.AgentDetails: + ) -> _types.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: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a PatchAgentObjectRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.PatchAgentObjectRequest :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :paramtype agent_endpoint: ~azure.ai.projects.types.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 + :paramtype agent_card: ~azure.ai.projects.types.AgentCard + :return: AgentDetails + :rtype: ~azure.ai.projects.types.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1269,23 +3488,23 @@ async def update_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[_types.AgentDetails] = 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 = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_agents_update_details_request( agent_name=agent_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -1309,45 +3528,34 @@ async def update_details( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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()) + if response.content: + deserialized = response.json() + else: + deserialized = None 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._models._CreateAgentVersionFromCodeContent, - *, - code_zip_sha256: str, - **kwargs: Any - ) -> _models.AgentVersionDetails: ... - @overload - async def _create_version_from_code( - self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentVersionDetails: ... - @distributed_trace_async async def _create_version_from_code( self, agent_name: str, - content: Union[_models._models._CreateAgentVersionFromCodeContent, JSON], + content: _types._CreateAgentVersionFromCodeContent, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.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 @@ -1362,14 +3570,223 @@ async def _create_version_from_code( * 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._models._CreateAgentVersionFromCodeContent or JSON + :param content: Required. + :type content: ~azure.ai.projects.types._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: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template you can fill out and use as your body input. + content = { + "code": filetype, + "metadata": { + "definition": { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + }, + "description": "str", + "metadata": { + "str": "str" + } + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1382,9 +3799,11 @@ async def _create_version_from_code( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentVersionDetails] = kwargs.pop("cls", None) - _body = content.as_dict() if isinstance(content, _Model) else content + if not isinstance(content, MutableMapping): + raise TypeError("content must be a mapping") + _body = content _file_fields: list[str] = ["code"] _data_fields: list[str] = ["metadata"] _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) @@ -1417,16 +3836,19 @@ 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1497,9 +3919,9 @@ 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -1561,9 +3983,9 @@ async def enable(self, agent_name: str, **kwargs: Any) -> 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -1618,9 +4040,9 @@ async def disable(self, agent_name: str, **kwargs: Any) -> 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -1632,104 +4054,183 @@ async def create_session( self, agent_name: str, *, - version_indicator: _models.VersionIndicator, + version_indicator: _types.VersionIndicator, content_type: str = "application/json", agent_session_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: + ) -> _types.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 user identity for + 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 :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :paramtype version_indicator: ~azure.ai.projects.types.VersionIndicator :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 + :return: AgentSessionResource + :rtype: ~azure.ai.projects.types.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 201 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ @overload async def create_session( - self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentSessionResource: + self, + agent_name: str, + body: _types.CreateSessionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.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 user identity for + 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: JSON + :type body: ~azure.ai.projects.types.CreateSessionRequest :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 + :return: AgentSessionResource + :rtype: ~azure.ai.projects.types.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create_session( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + Example: + .. code-block:: python - 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 user identity for - session-mutating operations. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :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 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: + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # JSON input template you can fill out and use as your body input. + body = { + "version_indicator": version_indicator, + "agent_session_id": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 201 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ @distributed_trace_async async def create_session( self, agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateSessionRequest] = _Unset, *, - version_indicator: _models.VersionIndicator = _Unset, + version_indicator: _types.VersionIndicator = _Unset, agent_session_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: + ) -> _types.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 user identity for + 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] + :param body: Is either a JSON type or a CreateSessionRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateSessionRequest :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :paramtype version_indicator: ~azure.ai.projects.types.VersionIndicator :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: AgentSessionResource + :rtype: ~azure.ai.projects.types.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # JSON input template you can fill out and use as your body input. + body = { + "version_indicator": version_indicator, + "agent_session_id": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 201 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1743,7 +4244,7 @@ async 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[_types.AgentSessionResource] = kwargs.pop("cls", None) if body is _Unset: if version_indicator is _Unset: @@ -1751,17 +4252,17 @@ async def create_session( 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_agents_create_session_request( agent_name=agent_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -1785,16 +4286,19 @@ async def create_session( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1802,7 +4306,7 @@ async def create_session( return deserialized # type: ignore @distributed_trace_async - async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _models.AgentSessionResource: + async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _types.AgentSessionResource: """Get a session. Retrieves the details of a hosted agent session by agent name and session identifier. @@ -1811,9 +4315,31 @@ async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> :type agent_name: str :param session_id: The session identifier. Required. :type session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: AgentSessionResource + :rtype: ~azure.ai.projects.types.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 200 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1826,7 +4352,7 @@ async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentSessionResource] = kwargs.pop("cls", None) _request = build_agents_get_session_request( agent_name=agent_name, @@ -1855,16 +4381,19 @@ async def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1920,9 +4449,9 @@ async def delete_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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -1978,9 +4507,9 @@ 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -1993,10 +4522,10 @@ def list_sessions( agent_name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.AgentSessionResource"]: + ) -> AsyncItemPaged["_types.AgentSessionResource"]: """List sessions for an agent. Returns a paged collection of sessions associated with the specified agent endpoint. @@ -2018,13 +4547,35 @@ def list_sessions( 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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.AgentSessionResource] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 200 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.AgentSessionResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2054,10 +4605,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.AgentSessionResource], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -2073,9 +4621,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -2086,7 +4634,7 @@ async def get_next(_continuation_token=None): @distributed_trace_async async def get_session_log_stream( self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any - ) -> _models.SessionLogEvent: + ) -> _types.SessionLogEvent: """Stream console logs for a hosted agent session. Streams console logs (stdout / stderr) for a specific hosted agent session @@ -2122,9 +4670,18 @@ async def get_session_log_stream( :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 + :return: SessionLogEvent + :rtype: ~azure.ai.projects.types.SessionLogEvent :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "data": "str", + "event": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2137,7 +4694,7 @@ async def get_session_log_stream( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) + cls: ClsType[_types.SessionLogEvent] = kwargs.pop("cls", None) _request = build_agents_get_session_log_stream_request( agent_name=agent_name, @@ -2167,9 +4724,9 @@ async def get_session_log_stream( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -2179,7 +4736,10 @@ async def get_session_log_stream( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionLogEvent, response.text()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2189,7 +4749,7 @@ async def get_session_log_stream( @distributed_trace_async async def upload_session_file( self, agent_name: str, session_id: str, content: bytes, *, path: str, **kwargs: Any - ) -> _models.SessionFileWriteResult: + ) -> _types.SessionFileWriteResult: """Upload a session file. Uploads binary file content to the specified path in the session sandbox. The service stores @@ -2204,9 +4764,18 @@ async def upload_session_file( :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 + :return: SessionFileWriteResult + :rtype: ~azure.ai.projects.types.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 201 + response == { + "bytes_written": 0, + "path": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2220,9 +4789,9 @@ async def upload_session_file( _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) + cls: ClsType[_types.SessionFileWriteResult] = kwargs.pop("cls", None) - _content = content + _json = content _request = build_agents_upload_session_file_request( agent_name=agent_name, @@ -2230,7 +4799,7 @@ async def upload_session_file( path=path, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -2254,16 +4823,19 @@ async def upload_session_file( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2331,9 +4903,9 @@ async def download_session_file( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -2352,10 +4924,10 @@ def list_session_files( *, path: Optional[str] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SessionDirectoryEntry"]: + ) -> AsyncItemPaged["_types.SessionDirectoryEntry"]: """List session files. Returns files and directories at the specified path in the session sandbox. The response @@ -2384,14 +4956,24 @@ def list_session_files( 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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.SessionDirectoryEntry] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "is_directory": bool, + "modified_time": "2020-02-20 00:00:00", + "name": "str", + "size": 0 + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SessionDirectoryEntry]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.SessionDirectoryEntry]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2423,10 +5005,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.SessionDirectoryEntry], - deserialized.get("entries", []), - ) + list_of_elem = 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) @@ -2442,9 +5021,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -2511,9 +5090,9 @@ async def delete_session_file( 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -2539,16 +5118,52 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: + async def get(self, id: str, **kwargs: Any) -> _types.EvaluationRule: """Get an evaluation rule. Retrieves the specified evaluation rule and its 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 + :return: EvaluationRule + :rtype: ~azure.ai.projects.types.EvaluationRule :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } + + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } + + # response body for status code(s): 200 + response == { + "action": evaluation_rule_action, + "enabled": bool, + "eventType": "str", + "id": "str", + "systemData": { + "str": "str" + }, + "description": "str", + "displayName": "str", + "filter": { + "agentName": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2561,7 +5176,7 @@ async def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluationRule] = kwargs.pop("cls", None) _request = build_evaluation_rules_get_request( id=id, @@ -2594,7 +5209,10 @@ async def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2651,10 +5269,10 @@ async def delete(self, id: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload + @distributed_trace_async async def create_or_update( - self, id: str, evaluation_rule: _models.EvaluationRule, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: + self, id: str, evaluation_rule: _types.EvaluationRule, **kwargs: Any + ) -> _types.EvaluationRule: """Create or update an evaluation rule. Creates a new evaluation rule, or replaces the existing rule when the identifier matches. @@ -2662,71 +5280,96 @@ async def create_or_update( :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 + :type evaluation_rule: ~azure.ai.projects.types.EvaluationRule + :return: EvaluationRule + :rtype: ~azure.ai.projects.types.EvaluationRule :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. + Example: + .. code-block:: python - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :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: - """ + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } - @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. + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + # JSON input template you can fill out and use as your body input. + evaluation_rule = { + "action": evaluation_rule_action, + "enabled": bool, + "eventType": "str", + "id": "str", + "systemData": { + "str": "str" + }, + "description": "str", + "displayName": "str", + "filter": { + "agentName": "str" + } + } - :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: - """ + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - @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. + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } - :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: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } + + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } + + # response body for status code(s): 201, 200 + response == { + "action": evaluation_rule_action, + "enabled": bool, + "eventType": "str", + "id": "str", + "systemData": { + "str": "str" + }, + "description": "str", + "displayName": "str", + "filter": { + "agentName": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2739,21 +5382,16 @@ async def create_or_update( _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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.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 + _json = evaluation_rule _request = build_evaluation_rules_create_or_update_request( id=id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -2782,7 +5420,10 @@ async def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2793,11 +5434,11 @@ async def create_or_update( def list( self, *, - action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, + action_type: Optional[types.EvaluationRuleActionType] = None, agent_name: Optional[str] = None, enabled: Optional[bool] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluationRule"]: + ) -> AsyncItemPaged["_types.EvaluationRule"]: """List evaluation rules. Returns the evaluation rules configured for the project, optionally filtered by action type, @@ -2811,13 +5452,49 @@ def list( :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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.EvaluationRule] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } + + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } + + # response body for status code(s): 200 + response == { + "action": evaluation_rule_action, + "enabled": bool, + "eventType": "str", + "id": "str", + "systemData": { + "str": "str" + }, + "description": "str", + "displayName": "str", + "filter": { + "agentName": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluationRule]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluationRule]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2872,10 +5549,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.EvaluationRule], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2916,7 +5590,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def _get(self, name: str, **kwargs: Any) -> _models.Connection: + async def _get(self, name: str, **kwargs: Any) -> _types.Connection: """Get a connection. Retrieves the specified connection and its configuration details without including credential @@ -2924,9 +5598,54 @@ async def _get(self, name: str, **kwargs: Any) -> _models.Connection: :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 + :return: Connection + :rtype: ~azure.ai.projects.types.Connection :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AAD": + base_credentials = { + "type": "AAD" + } + + # JSON input template for discriminator value "AgenticIdentityToken_Preview": + base_credentials = { + "type": "AgenticIdentityToken_Preview" + } + + # JSON input template for discriminator value "ApiKey": + base_credentials = { + "type": "ApiKey", + "key": "str" + } + + # JSON input template for discriminator value "CustomKeys": + base_credentials = { + "type": "CustomKeys" + } + + # JSON input template for discriminator value "None": + base_credentials = { + "type": "None" + } + + # response body for status code(s): 200 + response == { + "credentials": base_credentials, + "id": "str", + "isDefault": bool, + "metadata": { + "str": "str" + }, + "name": "str", + "target": "str", + "type": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2939,7 +5658,7 @@ 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[_types.Connection] = kwargs.pop("cls", None) _request = build_connections_get_request( name=name, @@ -2977,7 +5696,10 @@ async def _get(self, name: str, **kwargs: Any) -> _models.Connection: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Connection, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2985,18 +5707,63 @@ async def _get(self, name: str, **kwargs: Any) -> _models.Connection: return deserialized # type: ignore @distributed_trace_async - async def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: + async def _get_with_credentials(self, name: str, **kwargs: Any) -> _types.Connection: """Get a connection with credentials. Retrieves the specified connection together with its credential values. :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 + :return: Connection + :rtype: ~azure.ai.projects.types.Connection :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AAD": + base_credentials = { + "type": "AAD" + } + + # JSON input template for discriminator value "AgenticIdentityToken_Preview": + base_credentials = { + "type": "AgenticIdentityToken_Preview" + } + + # JSON input template for discriminator value "ApiKey": + base_credentials = { + "type": "ApiKey", + "key": "str" + } + + # JSON input template for discriminator value "CustomKeys": + base_credentials = { + "type": "CustomKeys" + } + + # JSON input template for discriminator value "None": + base_credentials = { + "type": "None" + } + + # response body for status code(s): 200 + response == { + "credentials": base_credentials, + "id": "str", + "isDefault": bool, + "metadata": { + "str": "str" + }, + "name": "str", + "target": "str", + "type": "str" + } + """ + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3007,7 +5774,7 @@ 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[_types.Connection] = kwargs.pop("cls", None) _request = build_connections_get_with_credentials_request( name=name, @@ -3045,7 +5812,10 @@ async def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Conne if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Connection, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -3056,10 +5826,10 @@ async def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Conne def list( self, *, - connection_type: Optional[Union[str, _models.ConnectionType]] = None, + connection_type: Optional[types.ConnectionType] = None, default_connection: Optional[bool] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Connection"]: + ) -> AsyncItemPaged["_types.Connection"]: """List connections. Returns the connections available in the current project, optionally filtered by type or @@ -3073,13 +5843,58 @@ def list( None. :paramtype default_connection: bool :return: An iterator like instance of Connection - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Connection] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.Connection] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AAD": + base_credentials = { + "type": "AAD" + } + + # JSON input template for discriminator value "AgenticIdentityToken_Preview": + base_credentials = { + "type": "AgenticIdentityToken_Preview" + } + + # JSON input template for discriminator value "ApiKey": + base_credentials = { + "type": "ApiKey", + "key": "str" + } + + # JSON input template for discriminator value "CustomKeys": + base_credentials = { + "type": "CustomKeys" + } + + # JSON input template for discriminator value "None": + base_credentials = { + "type": "None" + } + + # response body for status code(s): 200 + response == { + "credentials": base_credentials, + "id": "str", + "isDefault": bool, + "metadata": { + "str": "str" + }, + "name": "str", + "target": "str", + "type": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Connection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3133,10 +5948,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.Connection], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -3177,7 +5989,7 @@ def __init__(self, *args, **kwargs) -> None: 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"]: + def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_types.DatasetVersion"]: """List versions. List all versions of the given DatasetVersion. @@ -3185,13 +5997,52 @@ def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.Dat :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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == dataset_version """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.DatasetVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3244,10 +6095,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.DatasetVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -3270,19 +6118,58 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.DatasetVersion"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_types.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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == dataset_version """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.DatasetVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3334,10 +6221,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.DatasetVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -3360,7 +6244,7 @@ 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.DatasetVersion: + async def get(self, name: str, version: str, **kwargs: Any) -> _types.DatasetVersion: """Get a version. Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the @@ -3370,9 +6254,48 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVe :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 + :return: DatasetVersion + :rtype: ~azure.ai.projects.types.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == dataset_version """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3385,7 +6308,7 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVe _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) + cls: ClsType[_types.DatasetVersion] = kwargs.pop("cls", None) _request = build_datasets_get_request( name=name, @@ -3419,7 +6342,10 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVe if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3480,16 +6406,10 @@ async def delete(self, name: str, version: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload + @distributed_trace_async 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: + self, name: str, version: str, dataset_version: _types.DatasetVersion, **kwargs: Any + ) -> _types.DatasetVersion: """Create or update a version. Create a new or update an existing DatasetVersion with the given version id. @@ -3499,89 +6419,118 @@ async def create_or_update( :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 + :type dataset_version: ~azure.ai.projects.types.DatasetVersion + :return: DatasetVersion + :rtype: ~azure.ai.projects.types.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async 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: - """ + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } - @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. + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } - Create a new or update an existing DatasetVersion with the given version id. + # JSON input template you can fill out and use as your body input. + dataset_version = dataset_version + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "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/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: - """ + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } - @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. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } - Create a new or update an existing DatasetVersion with the given version id. + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "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. 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: + # response body for status code(s): 201, 200 + response == dataset_version """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3594,22 +6543,17 @@ async def create_or_update( _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.DatasetVersion] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/merge-patch+json")) + cls: ClsType[_types.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 + _json = dataset_version _request = build_datasets_create_or_update_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -3638,79 +6582,20 @@ async def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None 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. - - :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 + @distributed_trace_async async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResponse: + self, name: str, version: str, pending_upload_request: _types.PendingUploadRequest, **kwargs: Any + ) -> _types.PendingUploadResponse: """Start a pending upload. Initiates a new pending upload or retrieves an existing one for the specified dataset version. @@ -3720,38 +6605,35 @@ async def pending_upload( :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 + :type pending_upload_request: ~azure.ai.projects.types.PendingUploadRequest + :return: PendingUploadResponse + :rtype: ~azure.ai.projects.types.PendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: - """ - @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. + Example: + .. code-block:: python - Initiates a new pending upload or retrieves an existing one for the specified dataset version. + # JSON input template you can fill out and use as your body input. + pending_upload_request = { + "pendingUploadType": "str", + "connectionName": "str", + "pendingUploadId": "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. 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: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + }, + "pendingUploadId": "str", + "pendingUploadType": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3764,22 +6646,17 @@ async def pending_upload( _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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.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 + _json = pending_upload_request _request = build_datasets_pending_upload_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -3808,7 +6685,10 @@ async def pending_upload( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PendingUploadResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3816,7 +6696,7 @@ async def pending_upload( return deserialized # type: ignore @distributed_trace_async - async def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.DatasetCredential: + async def get_credentials(self, name: str, version: str, **kwargs: Any) -> _types.DatasetCredential: """Get dataset credentials. Gets the SAS credential to access the storage account associated with a Dataset version. @@ -3825,9 +6705,24 @@ async def get_credentials(self, name: str, version: str, **kwargs: Any) -> _mode :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 + :return: DatasetCredential + :rtype: ~azure.ai.projects.types.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3840,7 +6735,7 @@ 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[_types.DatasetCredential] = kwargs.pop("cls", None) _request = build_datasets_get_credentials_request( name=name, @@ -3874,7 +6769,10 @@ async def get_credentials(self, name: str, version: str, **kwargs: Any) -> _mode if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetCredential, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3900,16 +6798,45 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.Deployment: + async def get(self, name: str, **kwargs: Any) -> _types.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 + :return: Deployment + :rtype: ~azure.ai.projects.types.Deployment :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "ModelDeployment": + deployment = { + "capabilities": { + "str": "str" + }, + "modelName": "str", + "modelPublisher": "str", + "modelVersion": "str", + "name": "str", + "sku": { + "capacity": 0, + "family": "str", + "name": "str", + "size": "str", + "tier": "str" + }, + "type": "ModelDeployment", + "connectionName": "str" + } + + # response body for status code(s): 200 + response == deployment """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3922,7 +6849,7 @@ async 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[_types.Deployment] = kwargs.pop("cls", None) _request = build_deployments_get_request( name=name, @@ -3960,7 +6887,10 @@ async def get(self, name: str, **kwargs: Any) -> _models.Deployment: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Deployment, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -3973,9 +6903,9 @@ def list( *, model_publisher: Optional[str] = None, model_name: Optional[str] = None, - deployment_type: Optional[Union[str, _models.DeploymentType]] = None, + deployment_type: Optional[types.DeploymentType] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Deployment"]: + ) -> AsyncItemPaged["_types.Deployment"]: """List deployments. Returns the deployed models available in the current project, optionally filtered by publisher, @@ -3990,13 +6920,42 @@ def list( 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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.Deployment] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "ModelDeployment": + deployment = { + "capabilities": { + "str": "str" + }, + "modelName": "str", + "modelPublisher": "str", + "modelVersion": "str", + "name": "str", + "sku": { + "capacity": 0, + "family": "str", + "name": "str", + "size": "str", + "tier": "str" + }, + "type": "ModelDeployment", + "connectionName": "str" + } + + # response body for status code(s): 200 + response == deployment """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Deployment]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4051,10 +7010,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], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -4095,7 +7051,7 @@ def __init__(self, *args, **kwargs) -> None: 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"]: + def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_types.Index"]: """List versions. List all versions of the given Index. @@ -4103,13 +7059,96 @@ def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.Ind :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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.Index] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == index """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Index]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4162,10 +7201,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], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -4188,19 +7224,102 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Index"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_types.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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.Index] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == index """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Index]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4252,10 +7371,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], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -4278,7 +7394,7 @@ 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: + async def get(self, name: str, version: str, **kwargs: Any) -> _types.Index: """Get a version. Get the specific version of the Index. The service returns 404 Not Found error if the Index @@ -4288,9 +7404,92 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: :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: Index + :rtype: ~azure.ai.projects.types.Index :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == index """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4303,7 +7502,7 @@ async 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[_types.Index] = kwargs.pop("cls", None) _request = build_indexes_get_request( name=name, @@ -4337,7 +7536,10 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Index, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4398,16 +7600,8 @@ async def delete(self, name: str, version: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload - async def create_or_update( - self, - name: str, - version: str, - index: _models.Index, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.Index: + @distributed_trace_async + async def create_or_update(self, name: str, version: str, index: _types.Index, **kwargs: Any) -> _types.Index: """Create or update a version. Create a new or update an existing Index with the given version id. @@ -4417,83 +7611,250 @@ async def create_or_update( :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 + :type index: ~azure.ai.projects.types.Index + :return: Index + :rtype: ~azure.ai.projects.types.Index :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: - """Create or update a version. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } - Create a new or update an existing Index with the given version id. + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - :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: - """ + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - @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. + # JSON input template you can fill out and use as your body input. + index = index + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } - Create a new or update an existing Index with the given version id. + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - :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: - """ + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - @distributed_trace_async - 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 response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } - Create a new or update an existing Index with the given version id. + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - :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: + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # response body for status code(s): 201, 200 + response == index """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4506,22 +7867,17 @@ async def create_or_update( _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.Index] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/merge-patch+json")) + cls: ClsType[_types.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 + _json = index _request = build_indexes_create_or_update_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -4550,7 +7906,10 @@ async def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Index, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4580,14 +7939,14 @@ async def create_version( self, name: str, *, - tools: List[_models.ToolboxTool], + tools: List[_types.ToolboxTool], 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, + skills: Optional[List[_types.ToolboxSkill]] = None, + policies: Optional[_types.ToolboxPolicies] = None, **kwargs: Any - ) -> _models.ToolboxVersionObject: + ) -> _types.ToolboxVersionObject: """Create a new version of a toolbox. Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. @@ -4596,7 +7955,7 @@ async def create_version( Required. :type name: str :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.ToolboxTool] + :paramtype tools: list[~azure.ai.projects.types.ToolboxTool] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -4608,18 +7967,49 @@ async def create_version( :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] + :paramtype skills: list[~azure.ai.projects.types.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 + :paramtype policies: ~azure.ai.projects.types.ToolboxPolicies + :return: ToolboxVersionObject + :rtype: ~azure.ai.projects.types.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ @overload async def create_version( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: + self, + name: str, + body: _types.CreateToolboxVersionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.ToolboxVersionObject: """Create a new version of a toolbox. Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. @@ -4628,49 +8018,73 @@ async def create_version( Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateToolboxVersionRequest :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 + :return: ToolboxVersionObject + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "tools": [ + toolbox_tool + ], + "description": "str", + "metadata": { + "str": "str" + }, + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } - :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: + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ @distributed_trace_async async def create_version( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateToolboxVersionRequest] = _Unset, *, - tools: List[_models.ToolboxTool] = _Unset, + tools: List[_types.ToolboxTool] = _Unset, description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, - skills: Optional[List[_models.ToolboxSkill]] = None, - policies: Optional[_models.ToolboxPolicies] = None, + skills: Optional[List[_types.ToolboxSkill]] = None, + policies: Optional[_types.ToolboxPolicies] = None, **kwargs: Any - ) -> _models.ToolboxVersionObject: + ) -> _types.ToolboxVersionObject: """Create a new version of a toolbox. Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. @@ -4678,10 +8092,10 @@ async def create_version( :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] + :param body: Is either a JSON type or a CreateToolboxVersionRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateToolboxVersionRequest :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.ToolboxTool] + :paramtype tools: list[~azure.ai.projects.types.ToolboxTool] :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 @@ -4690,12 +8104,57 @@ async def create_version( :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] + :paramtype skills: list[~azure.ai.projects.types.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 + :paramtype policies: ~azure.ai.projects.types.ToolboxPolicies + :return: ToolboxVersionObject + :rtype: ~azure.ai.projects.types.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "tools": [ + toolbox_tool + ], + "description": "str", + "metadata": { + "str": "str" + }, + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4709,7 +8168,7 @@ async def create_version( _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) + cls: ClsType[_types.ToolboxVersionObject] = kwargs.pop("cls", None) if body is _Unset: if tools is _Unset: @@ -4723,17 +8182,17 @@ async def create_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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_toolboxes_create_version_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -4757,16 +8216,19 @@ async def create_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4774,16 +8236,26 @@ async def create_version( return deserialized # type: ignore @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: + async def get(self, name: str, **kwargs: Any) -> _types.ToolboxObject: """Retrieve a toolbox. Retrieves the specified toolbox and its current configuration. :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 + :return: ToolboxObject + :rtype: ~azure.ai.projects.types.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4796,7 +8268,7 @@ 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[_types.ToolboxObject] = kwargs.pop("cls", None) _request = build_toolboxes_get_request( name=name, @@ -4824,16 +8296,19 @@ async def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4845,10 +8320,10 @@ def list( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ToolboxObject"]: + ) -> AsyncItemPaged["_types.ToolboxObject"]: """List toolboxes. Returns the toolboxes available in the current project. @@ -4868,13 +8343,23 @@ def 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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.ToolboxObject] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ToolboxObject]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4903,10 +8388,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.ToolboxObject], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -4922,9 +8404,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -4938,10 +8420,10 @@ def list_versions( name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ToolboxVersionObject"]: + ) -> AsyncItemPaged["_types.ToolboxVersionObject"]: """List toolbox versions. Returns the available versions for the specified toolbox. @@ -4963,13 +8445,39 @@ def list_versions( 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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.ToolboxVersionObject] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ToolboxVersionObject]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4999,10 +8507,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], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -5018,9 +8523,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5029,7 +8534,7 @@ 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: + async def get_version(self, name: str, version: str, **kwargs: Any) -> _types.ToolboxVersionObject: """Retrieve a specific version of a toolbox. Retrieves the specified version of a toolbox by name and version identifier. @@ -5038,9 +8543,35 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.T :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 + :return: ToolboxVersionObject + :rtype: ~azure.ai.projects.types.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5053,7 +8584,7 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.T _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) + cls: ClsType[_types.ToolboxVersionObject] = kwargs.pop("cls", None) _request = build_toolboxes_get_version_request( name=name, @@ -5082,16 +8613,19 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.T except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5101,7 +8635,7 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.T @overload async def update( self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: + ) -> _types.ToolboxObject: """Update a toolbox to point to a specific version. Updates the toolbox's default version pointer to the specified version. @@ -5114,15 +8648,25 @@ async def update( :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: ToolboxObject + :rtype: ~azure.ai.projects.types.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ @overload async def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: + self, name: str, body: _types.UpdateToolboxRequest1, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.ToolboxObject: """Update a toolbox to point to a specific version. Updates the toolbox's default version pointer to the specified version. @@ -5130,53 +8674,68 @@ async def update( :param name: The name of the toolbox to update. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.UpdateToolboxRequest1 :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: ToolboxObject + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python - Updates the toolbox's default version pointer to the specified version. + # JSON input template you can fill out and use as your body input. + body = { + "default_version": "str" + } - :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: + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ @distributed_trace_async async def update( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.ToolboxObject: + self, + name: str, + body: Union[JSON, _types.UpdateToolboxRequest1] = _Unset, + *, + default_version: str = _Unset, + **kwargs: Any + ) -> _types.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: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a UpdateToolboxRequest1 type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateToolboxRequest1 :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 + :return: ToolboxObject + :rtype: ~azure.ai.projects.types.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "default_version": "str" + } + + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5190,7 +8749,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[_types.ToolboxObject] = kwargs.pop("cls", None) if body is _Unset: if default_version is _Unset: @@ -5198,17 +8757,17 @@ async def update( 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_toolboxes_update_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -5232,16 +8791,19 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5293,9 +8855,9 @@ async def delete(self, name: str, **kwargs: Any) -> 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5350,9 +8912,9 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5378,16 +8940,96 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: + async def get(self, name: str, **kwargs: Any) -> _types.EvaluationTaxonomy: """Get an evaluation taxonomy. Retrieves the specified evaluation taxonomy. :param name: The name of the resource. Required. :type name: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationTaxonomy + :rtype: ~azure.ai.projects.types.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } + + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # response body for status code(s): 200 + response == { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5400,7 +9042,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluationTaxonomy] = kwargs.pop("cls", None) _request = build_beta_evaluation_taxonomies_get_request( name=name, @@ -5433,7 +9075,10 @@ async def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5443,7 +9088,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: @distributed_trace def list( self, *, input_name: Optional[str] = None, input_type: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluationTaxonomy"]: + ) -> AsyncItemPaged["_types.EvaluationTaxonomy"]: """List evaluation taxonomies. Returns the evaluation taxonomies available in the project, optionally filtered by input name @@ -5454,13 +9099,93 @@ def list( :keyword input_type: Filter by taxonomy input type. Default value is None. :paramtype input_type: str :return: An iterator like instance of EvaluationTaxonomy - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluationTaxonomy] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.EvaluationTaxonomy] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } + + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # response body for status code(s): 200 + response == { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluationTaxonomy]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluationTaxonomy]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5514,10 +9239,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.EvaluationTaxonomy], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -5589,10 +9311,8 @@ async def delete(self, name: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload - async def create( - self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: + @distributed_trace_async + async def create(self, name: str, taxonomy: _types.EvaluationTaxonomy, **kwargs: Any) -> _types.EvaluationTaxonomy: """Create an evaluation taxonomy. Creates or replaces the specified evaluation taxonomy with the provided definition. @@ -5600,71 +9320,207 @@ async def create( :param name: The name of the evaluation taxonomy. Required. :type name: str :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :type taxonomy: ~azure.ai.projects.types.EvaluationTaxonomy + :return: EvaluationTaxonomy + :rtype: ~azure.ai.projects.types.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create( - self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + Example: + .. code-block:: python - Creates or replaces the specified evaluation taxonomy with the provided definition. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } - @overload - async def create( - self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } - Creates or replaces the specified evaluation taxonomy with the provided definition. + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: 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: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template you can fill out and use as your body input. + taxonomy = { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } - @distributed_trace_async - async def create( - self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - Creates or replaces the specified evaluation taxonomy with the provided definition. + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, - JSON, IO[bytes] Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } + + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # response body for status code(s): 201, 200 + response == { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5677,21 +9533,16 @@ async def create( _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.EvaluationTaxonomy] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluationTaxonomy] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(taxonomy, (IOBase, bytes)): - _content = taxonomy - else: - _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = taxonomy _request = build_beta_evaluation_taxonomies_create_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -5720,17 +9571,18 @@ async def create( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def update( - self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: + @distributed_trace_async + async def update(self, name: str, taxonomy: _types.EvaluationTaxonomy, **kwargs: Any) -> _types.EvaluationTaxonomy: """Update an evaluation taxonomy. Update an evaluation taxonomy. @@ -5738,71 +9590,167 @@ async def update( :param name: The name of the evaluation taxonomy. Required. :type name: str :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :type taxonomy: ~azure.ai.projects.types.EvaluationTaxonomy + :return: EvaluationTaxonomy + :rtype: ~azure.ai.projects.types.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def update( - self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + Example: + .. code-block:: python - Update an evaluation taxonomy. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } - @overload - async def update( - self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } - Update an evaluation taxonomy. + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: 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: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template you can fill out and use as your body input. + taxonomy = { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } - @distributed_trace_async - async def update( - self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - Update an evaluation taxonomy. + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, - JSON, IO[bytes] Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # response body for status code(s): 200 + response == { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5815,21 +9763,16 @@ async def update( _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.EvaluationTaxonomy] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluationTaxonomy] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(taxonomy, (IOBase, bytes)): - _content = taxonomy - else: - _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = taxonomy _request = build_beta_evaluation_taxonomies_update_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -5858,7 +9801,10 @@ async def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5891,7 +9837,7 @@ def list_versions( type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, limit: Optional[int] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluatorVersion"]: + ) -> AsyncItemPaged["_types.EvaluatorVersion"]: """List evaluator versions. Returns the available versions for the specified evaluator. @@ -5906,13 +9852,153 @@ def list_versions( 100, and the default is 20. Default value is None. :paramtype limit: int :return: An iterator like instance of EvaluatorVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluatorVersion] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.EvaluatorVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluatorVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5967,10 +10053,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.EvaluatorVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -5999,7 +10082,7 @@ def list( type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, limit: Optional[int] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluatorVersion"]: + ) -> AsyncItemPaged["_types.EvaluatorVersion"]: """List latest evaluator versions. Lists the latest version of each evaluator. @@ -6012,13 +10095,153 @@ def list( 100, and the default is 20. Default value is None. :paramtype limit: int :return: An iterator like instance of EvaluatorVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluatorVersion] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.EvaluatorVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluatorVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6072,10 +10295,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.EvaluatorVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -6098,7 +10318,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.EvaluatorVersion: + async def get_version(self, name: str, version: str, **kwargs: Any) -> _types.EvaluatorVersion: """Get an evaluator version. Retrieves the specified evaluator version, returning 404 if it does not exist. @@ -6107,9 +10327,149 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.E :type name: str :param version: The specific version id of the EvaluatorVersion to retrieve. Required. :type version: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :return: EvaluatorVersion + :rtype: ~azure.ai.projects.types.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6122,7 +10482,7 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.E _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluatorVersion] = kwargs.pop("cls", None) _request = build_beta_evaluators_get_version_request( name=name, @@ -6156,7 +10516,10 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.E if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6216,15 +10579,10 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload + @distributed_trace_async async def create_version( - self, - name: str, - evaluator_version: _models.EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: + self, name: str, evaluator_version: _types.EvaluatorVersion, **kwargs: Any + ) -> _types.EvaluatorVersion: """Create an evaluator version. Creates a new evaluator version with an auto-incremented version identifier. @@ -6232,71 +10590,287 @@ async def create_version( :param name: The name of the resource. Required. :type name: str :param evaluator_version: Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :type evaluator_version: ~azure.ai.projects.types.EvaluatorVersion + :return: EvaluatorVersion + :rtype: ~azure.ai.projects.types.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create_version( - self, name: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create an evaluator version. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Creates a new evaluator version with an auto-incremented version identifier. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @overload - async def create_version( - self, name: str, evaluator_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create an evaluator version. + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } - Creates a new evaluator version with an auto-incremented version identifier. + # JSON input template you can fill out and use as your body input. + evaluator_version = { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: 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: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @distributed_trace_async - async def create_version( - self, name: str, evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create an evaluator version. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Creates a new evaluator version with an auto-incremented version identifier. + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Is one of the following types: EvaluatorVersion, JSON, IO[bytes] - Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 201 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6309,21 +10883,16 @@ async def create_version( _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.EvaluatorVersion] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluatorVersion] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(evaluator_version, (IOBase, bytes)): - _content = evaluator_version - else: - _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = evaluator_version _request = build_beta_evaluators_create_version_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -6352,23 +10921,20 @@ async def create_version( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload + @distributed_trace_async async def update_version( - self, - name: str, - version: str, - evaluator_version: _models.EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: + self, name: str, version: str, evaluator_version: _types.EvaluatorVersion, **kwargs: Any + ) -> _types.EvaluatorVersion: """Update an evaluator version. Updates the specified evaluator version in place. @@ -6378,87 +10944,287 @@ async def update_version( :param version: The version of the EvaluatorVersion to update. Required. :type version: str :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :type evaluator_version: ~azure.ai.projects.types.EvaluatorVersion + :return: EvaluatorVersion + :rtype: ~azure.ai.projects.types.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def update_version( - self, name: str, version: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an evaluator version. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Updates the specified evaluator version in place. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @overload - async def update_version( - self, - name: str, - version: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an evaluator version. + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } - Updates the specified evaluator version in place. + # JSON input template you can fill out and use as your body input. + evaluator_version = { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: 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: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @distributed_trace_async - async def update_version( - self, - name: str, - version: str, - evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an evaluator version. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Updates the specified evaluator version in place. + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Is one of the following types: EvaluatorVersion, - JSON, IO[bytes] Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6471,22 +11237,17 @@ async def update_version( _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.EvaluatorVersion] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluatorVersion] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(evaluator_version, (IOBase, bytes)): - _content = evaluator_version - else: - _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = evaluator_version _request = build_beta_evaluators_update_version_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -6515,23 +11276,20 @@ async def update_version( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload + @distributed_trace_async async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: _models.PendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResponse: + self, name: str, version: str, pending_upload_request: _types.PendingUploadRequest, **kwargs: Any + ) -> _types.PendingUploadResponse: """Start a pending upload. Initiates a new pending upload or retrieves an existing one for the specified evaluator @@ -6542,125 +11300,58 @@ async def pending_upload( :param version: The specific version id of the EvaluatorVersion 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 + :type pending_upload_request: ~azure.ai.projects.types.PendingUploadRequest + :return: PendingUploadResponse + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python - Initiates a new pending upload or retrieves an existing one for the specified evaluator - version. + # JSON input template you can fill out and use as your body input. + pending_upload_request = { + "pendingUploadType": "str", + "connectionName": "str", + "pendingUploadId": "str" + } - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion 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: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + }, + "pendingUploadId": "str", + "pendingUploadType": "str", + "version": "str" + } """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @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. + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - Initiates a new pending upload or retrieves an existing one for the specified evaluator - version. - - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion 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_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. + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.PendingUploadResponse] = kwargs.pop("cls", None) - Initiates a new pending upload or retrieves an existing one for the specified evaluator - version. - - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion 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 + _json = pending_upload_request _request = build_beta_evaluators_pending_upload_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -6684,61 +11375,29 @@ async def pending_upload( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PendingUploadResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: _models.EvaluatorCredentialRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: - """Get evaluator credentials. - - Retrieves SAS credentials for accessing the storage account associated with the specified - evaluator version. - - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion to operate on. Required. - :type version: str - :param credential_request: The credential request parameters. Required. - :type credential_request: ~azure.ai.projects.models.EvaluatorCredentialRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload + @distributed_trace_async async def get_credentials( - self, - name: str, - version: str, - credential_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: + self, name: str, version: str, credential_request: _types.EvaluatorCredentialRequest, **kwargs: Any + ) -> _types.DatasetCredential: """Get evaluator credentials. Retrieves SAS credentials for accessing the storage account associated with the specified @@ -6749,68 +11408,30 @@ async def get_credentials( :param version: The specific version id of the EvaluatorVersion to operate on. Required. :type version: str :param credential_request: The credential request parameters. Required. - :type credential_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: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential + :type credential_request: ~azure.ai.projects.types.EvaluatorCredentialRequest + :return: DatasetCredential + :rtype: ~azure.ai.projects.types.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: - """Get evaluator credentials. - Retrieves SAS credentials for accessing the storage account associated with the specified - evaluator version. + Example: + .. code-block:: python - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion to operate on. Required. - :type version: str - :param credential_request: The credential request parameters. Required. - :type credential_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: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def get_credentials( - self, - name: str, - version: str, - credential_request: Union[_models.EvaluatorCredentialRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.DatasetCredential: - """Get evaluator credentials. - - Retrieves SAS credentials for accessing the storage account associated with the specified - evaluator version. + # JSON input template you can fill out and use as your body input. + credential_request = { + "blob_uri": "str" + } - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion to operate on. Required. - :type version: str - :param credential_request: The credential request parameters. Is one of the following types: - EvaluatorCredentialRequest, JSON, IO[bytes] Required. - :type credential_request: ~azure.ai.projects.models.EvaluatorCredentialRequest or JSON or - IO[bytes] - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6823,22 +11444,17 @@ async def get_credentials( _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.DatasetCredential] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.DatasetCredential] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(credential_request, (IOBase, bytes)): - _content = credential_request - else: - _content = json.dumps(credential_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = credential_request _request = build_beta_evaluators_get_credentials_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -6862,120 +11478,389 @@ async def get_credentials( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetCredential, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload + @distributed_trace_async async def create_generation_job( - self, - job: _models.EvaluatorGenerationJob, - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorGenerationJob: + self, job: _types.EvaluatorGenerationJob, *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _types.EvaluatorGenerationJob: """Create an evaluator generation job. Creates an evaluator generation job. The service generates rubric-based evaluator definitions from the provided source materials asynchronously. :param job: The job to create. Required. - :type job: ~azure.ai.projects.models.EvaluatorGenerationJob + :type job: ~azure.ai.projects.types.EvaluatorGenerationJob :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: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: EvaluatorGenerationJob + :rtype: ~azure.ai.projects.types.EvaluatorGenerationJob :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.EvaluatorGenerationJob: - """Create an evaluator generation job. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :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: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @overload - async def create_generation_job( - self, - job: IO[bytes], - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Create an evaluator generation job. + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + # JSON input template you can fill out and use as your body input. + job = { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } - :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: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @distributed_trace_async - async def create_generation_job( - self, - job: Union[_models.EvaluatorGenerationJob, JSON, IO[bytes]], - *, - operation_id: Optional[str] = None, - **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Create an evaluator generation job. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param job: The job to create. Is one of the following types: EvaluatorGenerationJob, JSON, - IO[bytes] Required. - :type job: ~azure.ai.projects.models.EvaluatorGenerationJob 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: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 201 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6988,21 +11873,16 @@ async def create_generation_job( _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.EvaluatorGenerationJob] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluatorGenerationJob] = 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 + _json = job _request = build_beta_evaluators_create_generation_job_request( operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -7026,9 +11906,9 @@ async def create_generation_job( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -7039,7 +11919,10 @@ async def create_generation_job( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -7047,16 +11930,191 @@ async def create_generation_job( return deserialized # type: ignore @distributed_trace_async - async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: + async def get_generation_job(self, job_id: str, **kwargs: Any) -> _types.EvaluatorGenerationJob: """Get an evaluator generation job. Gets the details of an evaluator generation job by its ID. :param job_id: The ID of the job. Required. :type job_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: EvaluatorGenerationJob + :rtype: ~azure.ai.projects.types.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7069,7 +12127,7 @@ async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.Evalua _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluatorGenerationJob] = kwargs.pop("cls", None) _request = build_beta_evaluators_get_generation_job_request( job_id=job_id, @@ -7097,9 +12155,9 @@ async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.Evalua except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -7109,7 +12167,10 @@ async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.Evalua if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -7121,10 +12182,10 @@ def list_generation_jobs( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.EvaluatorGenerationJob"]: + ) -> AsyncItemPaged["_types.EvaluatorGenerationJob"]: """List evaluator generation jobs. Returns a list of evaluator generation jobs. The List API has up to a few seconds of @@ -7147,13 +12208,188 @@ def list_generation_jobs( :paramtype before: str :return: An iterator like instance of EvaluatorGenerationJob :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.EvaluatorGenerationJob] + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.EvaluatorGenerationJob] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluatorGenerationJob]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluatorGenerationJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7182,10 +12418,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.EvaluatorGenerationJob], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -7201,9 +12434,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -7212,16 +12445,191 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: + async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _types.EvaluatorGenerationJob: """Cancel an evaluator generation job. Cancels an evaluator generation job by its ID. :param job_id: The ID of the job to cancel. Required. :type job_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: EvaluatorGenerationJob + :rtype: ~azure.ai.projects.types.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7234,7 +12642,7 @@ async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Eva _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluatorGenerationJob] = kwargs.pop("cls", None) _request = build_beta_evaluators_cancel_generation_job_request( job_id=job_id, @@ -7262,16 +12670,19 @@ async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Eva except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7324,9 +12735,9 @@ async def delete_generation_job(self, job_id: str, **kwargs: Any) -> 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -7351,75 +12762,263 @@ 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 - async def generate( - self, insight: _models.Insight, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Insight: + @distributed_trace_async + async def generate(self, insight: _types.Insight, **kwargs: Any) -> _types.Insight: """Generate insights. Generates an insights report from the provided evaluation configuration. :param insight: Complete evaluation configuration including data source, evaluators, and result settings. Required. - :type insight: ~azure.ai.projects.models.Insight - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :type insight: ~azure.ai.projects.types.Insight + :return: Insight + :rtype: ~azure.ai.projects.types.Insight :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def generate( - self, insight: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Insight: - """Generate insights. + Example: + .. code-block:: python - Generates an insights report from the provided evaluation configuration. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "AgentClusterInsight": + insight_request = { + "agentName": "str", + "type": "AgentClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_request = { + "baselineRunId": "str", + "evalId": "str", + "treatmentRunIds": [ + "str" + ], + "type": "EvaluationComparison" + } + + # JSON input template for discriminator value "EvaluationRunClusterInsight": + insight_request = { + "evalId": "str", + "runIds": [ + "str" + ], + "type": "EvaluationRunClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "AgentClusterInsight": + insight_result = { + "clusterInsight": { + "clusters": [ + { + "description": "str", + "id": "str", + "label": "str", + "suggestion": "str", + "suggestionTitle": "str", + "weight": 0, + "samples": [ + insight_sample + ], + "subClusters": [ + ... + ] + } + ], + "summary": { + "method": "str", + "sampleCount": 0, + "uniqueClusterCount": 0, + "uniqueSubclusterCount": 0, + "usage": { + "inputTokenUsage": 0, + "outputTokenUsage": 0, + "totalTokenUsage": 0 + } + }, + "coordinates": { + "str": { + "size": 0, + "x": 0, + "y": 0 + } + } + }, + "type": "AgentClusterInsight" + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_result = { + "comparisons": [ + { + "baselineRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + }, + "compareItems": [ + { + "deltaEstimate": 0.0, + "pValue": 0.0, + "treatmentEffect": "str", + "treatmentRunId": "str", + "treatmentRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + } + } + ], + "evaluator": "str", + "metric": "str", + "testingCriteria": "str" + } + ], + "method": "str", + "type": "EvaluationComparison" + } - @overload - async def generate( - self, insight: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Insight: - """Generate insights. + # JSON input template you can fill out and use as your body input. + insight = { + "displayName": "str", + "id": "str", + "metadata": { + "createdAt": "2020-02-20 00:00:00", + "completedAt": "2020-02-20 00:00:00" + }, + "request": insight_request, + "state": "str", + "result": insight_result + } - Generates an insights report from the provided evaluation configuration. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: 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: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "AgentClusterInsight": + insight_request = { + "agentName": "str", + "type": "AgentClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } - @distributed_trace_async - async def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: Any) -> _models.Insight: - """Generate insights. + # JSON input template for discriminator value "EvaluationComparison": + insight_request = { + "baselineRunId": "str", + "evalId": "str", + "treatmentRunIds": [ + "str" + ], + "type": "EvaluationComparison" + } - Generates an insights report from the provided evaluation configuration. + # JSON input template for discriminator value "EvaluationRunClusterInsight": + insight_request = { + "evalId": "str", + "runIds": [ + "str" + ], + "type": "EvaluationRunClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Is one of the following types: Insight, JSON, IO[bytes] Required. - :type insight: ~azure.ai.projects.models.Insight or JSON or IO[bytes] - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "AgentClusterInsight": + insight_result = { + "clusterInsight": { + "clusters": [ + { + "description": "str", + "id": "str", + "label": "str", + "suggestion": "str", + "suggestionTitle": "str", + "weight": 0, + "samples": [ + insight_sample + ], + "subClusters": [ + ... + ] + } + ], + "summary": { + "method": "str", + "sampleCount": 0, + "uniqueClusterCount": 0, + "uniqueSubclusterCount": 0, + "usage": { + "inputTokenUsage": 0, + "outputTokenUsage": 0, + "totalTokenUsage": 0 + } + }, + "coordinates": { + "str": { + "size": 0, + "x": 0, + "y": 0 + } + } + }, + "type": "AgentClusterInsight" + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_result = { + "comparisons": [ + { + "baselineRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + }, + "compareItems": [ + { + "deltaEstimate": 0.0, + "pValue": 0.0, + "treatmentEffect": "str", + "treatmentRunId": "str", + "treatmentRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + } + } + ], + "evaluator": "str", + "metric": "str", + "testingCriteria": "str" + } + ], + "method": "str", + "type": "EvaluationComparison" + } + + # response body for status code(s): 201 + response == { + "displayName": "str", + "id": "str", + "metadata": { + "createdAt": "2020-02-20 00:00:00", + "completedAt": "2020-02-20 00:00:00" + }, + "request": insight_request, + "state": "str", + "result": insight_result + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7432,20 +13031,15 @@ async def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwa _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.Insight] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.Insight] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(insight, (IOBase, bytes)): - _content = insight - else: - _content = json.dumps(insight, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = insight _request = build_beta_insights_generate_request( content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -7469,16 +13063,19 @@ async def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwa except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Insight, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7488,7 +13085,7 @@ async def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwa @distributed_trace_async async def get( self, insight_id: str, *, include_coordinates: Optional[bool] = None, **kwargs: Any - ) -> _models.Insight: + ) -> _types.Insight: """Get an insight. Retrieves the specified insight report and its results. @@ -7498,9 +13095,133 @@ async def get( :keyword include_coordinates: Whether to include coordinates for visualization in the response. Defaults to false. Default value is None. :paramtype include_coordinates: bool - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :return: Insight + :rtype: ~azure.ai.projects.types.Insight :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AgentClusterInsight": + insight_request = { + "agentName": "str", + "type": "AgentClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_request = { + "baselineRunId": "str", + "evalId": "str", + "treatmentRunIds": [ + "str" + ], + "type": "EvaluationComparison" + } + + # JSON input template for discriminator value "EvaluationRunClusterInsight": + insight_request = { + "evalId": "str", + "runIds": [ + "str" + ], + "type": "EvaluationRunClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "AgentClusterInsight": + insight_result = { + "clusterInsight": { + "clusters": [ + { + "description": "str", + "id": "str", + "label": "str", + "suggestion": "str", + "suggestionTitle": "str", + "weight": 0, + "samples": [ + insight_sample + ], + "subClusters": [ + ... + ] + } + ], + "summary": { + "method": "str", + "sampleCount": 0, + "uniqueClusterCount": 0, + "uniqueSubclusterCount": 0, + "usage": { + "inputTokenUsage": 0, + "outputTokenUsage": 0, + "totalTokenUsage": 0 + } + }, + "coordinates": { + "str": { + "size": 0, + "x": 0, + "y": 0 + } + } + }, + "type": "AgentClusterInsight" + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_result = { + "comparisons": [ + { + "baselineRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + }, + "compareItems": [ + { + "deltaEstimate": 0.0, + "pValue": 0.0, + "treatmentEffect": "str", + "treatmentRunId": "str", + "treatmentRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + } + } + ], + "evaluator": "str", + "metric": "str", + "testingCriteria": "str" + } + ], + "method": "str", + "type": "EvaluationComparison" + } + + # response body for status code(s): 200 + response == { + "displayName": "str", + "id": "str", + "metadata": { + "createdAt": "2020-02-20 00:00:00", + "completedAt": "2020-02-20 00:00:00" + }, + "request": insight_request, + "state": "str", + "result": insight_result + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7513,7 +13234,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Insight] = kwargs.pop("cls", None) + cls: ClsType[_types.Insight] = kwargs.pop("cls", None) _request = build_beta_insights_get_request( insight_id=insight_id, @@ -7542,16 +13263,19 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Insight, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7562,13 +13286,13 @@ async def get( def list( self, *, - type: Optional[Union[str, _models.InsightType]] = None, + type: Optional[types.InsightType] = None, eval_id: Optional[str] = None, run_id: Optional[str] = None, agent_name: Optional[str] = None, include_coordinates: Optional[bool] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Insight"]: + ) -> AsyncItemPaged["_types.Insight"]: """List insights. Returns insights in reverse chronological order, with the most recent entries first. @@ -7586,13 +13310,137 @@ def list( Defaults to false. Default value is None. :paramtype include_coordinates: bool :return: An iterator like instance of Insight - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Insight] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.Insight] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AgentClusterInsight": + insight_request = { + "agentName": "str", + "type": "AgentClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_request = { + "baselineRunId": "str", + "evalId": "str", + "treatmentRunIds": [ + "str" + ], + "type": "EvaluationComparison" + } + + # JSON input template for discriminator value "EvaluationRunClusterInsight": + insight_request = { + "evalId": "str", + "runIds": [ + "str" + ], + "type": "EvaluationRunClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "AgentClusterInsight": + insight_result = { + "clusterInsight": { + "clusters": [ + { + "description": "str", + "id": "str", + "label": "str", + "suggestion": "str", + "suggestionTitle": "str", + "weight": 0, + "samples": [ + insight_sample + ], + "subClusters": [ + ... + ] + } + ], + "summary": { + "method": "str", + "sampleCount": 0, + "uniqueClusterCount": 0, + "uniqueSubclusterCount": 0, + "usage": { + "inputTokenUsage": 0, + "outputTokenUsage": 0, + "totalTokenUsage": 0 + } + }, + "coordinates": { + "str": { + "size": 0, + "x": 0, + "y": 0 + } + } + }, + "type": "AgentClusterInsight" + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_result = { + "comparisons": [ + { + "baselineRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + }, + "compareItems": [ + { + "deltaEstimate": 0.0, + "pValue": 0.0, + "treatmentEffect": "str", + "treatmentRunId": "str", + "treatmentRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + } + } + ], + "evaluator": "str", + "metric": "str", + "testingCriteria": "str" + } + ], + "method": "str", + "type": "EvaluationComparison" + } + + # response body for status code(s): 200 + response == { + "displayName": "str", + "id": "str", + "metadata": { + "createdAt": "2020-02-20 00:00:00", + "completedAt": "2020-02-20 00:00:00" + }, + "request": insight_request, + "state": "str", + "result": insight_result + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Insight]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Insight]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7649,10 +13497,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.Insight], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -7668,9 +13513,9 @@ 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) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -7701,12 +13546,12 @@ async def create( self, *, name: str, - definition: _models.MemoryStoreDefinition, + definition: _types.MemoryStoreDefinition, content_type: str = "application/json", description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: + ) -> _types.MemoryStoreDetails: """Create a memory store. Creates a memory store resource with the provided configuration. @@ -7714,7 +13559,7 @@ async def create( :keyword name: The name of the memory store. Required. :paramtype name: str :keyword definition: The memory store definition. Required. - :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition + :paramtype definition: ~azure.ai.projects.types.MemoryStoreDefinition :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -7723,76 +13568,214 @@ async def create( :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default value is None. :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ @overload async def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: + self, body: _types.CreateMemoryStoreRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryStoreDetails: """Create a memory store. Creates a memory store resource with the provided configuration. :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateMemoryStoreRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } - Creates a memory store resource with the provided configuration. + # JSON input template you can fill out and use as your body input. + body = { + "definition": memory_store_definition, + "name": "str", + "description": "str", + "metadata": { + "str": "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: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ @distributed_trace_async async def create( self, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateMemoryStoreRequest] = _Unset, *, name: str = _Unset, - definition: _models.MemoryStoreDefinition = _Unset, + definition: _types.MemoryStoreDefinition = _Unset, description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: + ) -> _types.MemoryStoreDetails: """Create a memory store. Creates a memory store resource with the provided configuration. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateMemoryStoreRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateMemoryStoreRequest :keyword name: The name of the memory store. Required. :paramtype name: str :keyword definition: The memory store definition. Required. - :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition + :paramtype definition: ~azure.ai.projects.types.MemoryStoreDefinition :keyword description: A human-readable description of the memory store. Default value is None. :paramtype description: str :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default value is None. :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # JSON input template you can fill out and use as your body input. + body = { + "definition": memory_store_definition, + "name": "str", + "description": "str", + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7806,7 +13789,7 @@ async def create( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreDetails] = kwargs.pop("cls", None) if body is _Unset: if name is _Unset: @@ -7816,16 +13799,16 @@ async def create( body = {"definition": definition, "description": description, "metadata": metadata, "name": name} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_create_request( content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -7849,16 +13832,19 @@ async def create( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7874,7 +13860,7 @@ async def update( description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: + ) -> _types.MemoryStoreDetails: """Update a memory store. Updates the specified memory store with the supplied configuration changes. @@ -7889,15 +13875,49 @@ async def update( :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default value is None. :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ @overload async def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: + self, name: str, body: _types.UpdateMemoryStoreRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryStoreDetails: """Update a memory store. Updates the specified memory store with the supplied configuration changes. @@ -7905,61 +13925,125 @@ async def update( :param name: The name of the memory store to update. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.UpdateMemoryStoreRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def update( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + Example: + .. code-block:: python - Updates the specified memory store with the supplied configuration changes. + # JSON input template you can fill out and use as your body input. + body = { + "description": "str", + "metadata": { + "str": "str" + } + } - :param name: The name of the memory store 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: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ @distributed_trace_async async def update( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.UpdateMemoryStoreRequest] = _Unset, *, description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: + ) -> _types.MemoryStoreDetails: """Update a memory store. Updates the specified memory store with the supplied configuration changes. :param name: The name of the memory store 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] + :param body: Is either a JSON type or a UpdateMemoryStoreRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateMemoryStoreRequest :keyword description: A human-readable description of the memory store. Default value is None. :paramtype description: str :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default value is None. :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "description": "str", + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7973,23 +14057,23 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreDetails] = kwargs.pop("cls", None) if body is _Unset: body = {"description": description, "metadata": metadata} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_update_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -8013,16 +14097,19 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8030,16 +14117,50 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: + async def get(self, name: str, **kwargs: Any) -> _types.MemoryStoreDetails: """Get a memory store. Retrieves the specified memory store and its current configuration. :param name: The name of the memory store to retrieve. Required. :type name: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8052,7 +14173,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreDetails] = kwargs.pop("cls", None) _request = build_beta_memory_stores_get_request( name=name, @@ -8080,16 +14201,19 @@ async def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8101,10 +14225,10 @@ def list( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.MemoryStoreDetails"]: + ) -> AsyncItemPaged["_types.MemoryStoreDetails"]: """List memory stores. Returns the memory stores available to the caller. @@ -8124,13 +14248,47 @@ def list( Default value is None. :paramtype before: str :return: An iterator like instance of MemoryStoreDetails - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.MemoryStoreDetails] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.MemoryStoreDetails] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MemoryStoreDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.MemoryStoreDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8159,10 +14317,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.MemoryStoreDetails], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -8178,9 +14333,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -8189,16 +14344,26 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: + async def delete(self, name: str, **kwargs: Any) -> _types.DeleteMemoryStoreResult: """Delete a memory store. Deletes the specified memory store. :param name: The name of the memory store to delete. Required. :type name: str - :return: DeleteMemoryStoreResult. The DeleteMemoryStoreResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteMemoryStoreResult + :return: DeleteMemoryStoreResult + :rtype: ~azure.ai.projects.types.DeleteMemoryStoreResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8211,7 +14376,7 @@ async def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreRes _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteMemoryStoreResult] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteMemoryStoreResult] = kwargs.pop("cls", None) _request = build_beta_memory_stores_delete_request( name=name, @@ -8239,16 +14404,19 @@ async def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreRes except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteMemoryStoreResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8264,38 +14432,34 @@ async def _search_memories( content_type: str = "application/json", items: Optional[List[dict[str, Any]]] = None, previous_search_id: Optional[str] = None, - options: Optional[_models.MemorySearchOptions] = None, + options: Optional[_types.MemorySearchOptions] = None, **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... - @overload - async def _search_memories( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... + ) -> _types.MemoryStoreSearchResult: ... @overload async def _search_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... + self, name: str, body: _types.SearchMemoriesRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryStoreSearchResult: ... @distributed_trace_async async def _search_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.SearchMemoriesRequest] = _Unset, *, scope: str = _Unset, items: Optional[List[dict[str, Any]]] = None, previous_search_id: Optional[str] = None, - options: Optional[_models.MemorySearchOptions] = None, + options: Optional[_types.MemorySearchOptions] = None, **kwargs: Any - ) -> _models.MemoryStoreSearchResult: + ) -> _types.MemoryStoreSearchResult: """Search memories. Searches the specified memory store for memories relevant to the provided conversation context. :param name: The name of the memory store to search. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a SearchMemoriesRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.SearchMemoriesRequest :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -8305,10 +14469,49 @@ async def _search_memories( memory search from where the last operation left off. Default value is None. :paramtype previous_search_id: str :keyword options: Memory search options. Default value is None. - :paramtype options: ~azure.ai.projects.models.MemorySearchOptions - :return: MemoryStoreSearchResult. The MemoryStoreSearchResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult + :paramtype options: ~azure.ai.projects.types.MemorySearchOptions + :return: MemoryStoreSearchResult + :rtype: ~azure.ai.projects.types.MemoryStoreSearchResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str", + "items": [ + { + "str": {} + } + ], + "options": { + "max_memories": 0 + }, + "previous_search_id": "str" + } + + # response body for status code(s): 200 + response == { + "memories": [ + { + "memory_item": memory_item + } + ], + "search_id": "str", + "usage": { + "embedding_tokens": 0, + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8322,7 +14525,7 @@ async def _search_memories( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreSearchResult] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreSearchResult] = kwargs.pop("cls", None) if body is _Unset: if scope is _Unset: @@ -8330,17 +14533,17 @@ async def _search_memories( body = {"items": items, "options": options, "previous_search_id": previous_search_id, "scope": scope} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_search_memories_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -8364,16 +14567,19 @@ async def _search_memories( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreSearchResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8383,7 +14589,7 @@ async def _search_memories( async def _update_memories_initial( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.UpdateMemoriesRequest] = _Unset, *, scope: str = _Unset, items: Optional[List[dict[str, Any]]] = None, @@ -8416,17 +14622,17 @@ async def _update_memories_initial( } 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_update_memories_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -8449,9 +14655,9 @@ async def _update_memories_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -8476,28 +14682,24 @@ async def _begin_update_memories( previous_update_id: Optional[str] = None, update_delay: Optional[int] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: ... - @overload - async def _begin_update_memories( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + ) -> AsyncLROPoller[_types.MemoryStoreUpdateCompletedResult]: ... @overload async def _begin_update_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + self, name: str, body: _types.UpdateMemoriesRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_types.MemoryStoreUpdateCompletedResult]: ... @distributed_trace_async async def _begin_update_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.UpdateMemoriesRequest] = _Unset, *, scope: str = _Unset, items: Optional[List[dict[str, Any]]] = None, previous_update_id: Optional[str] = None, update_delay: Optional[int] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]: + ) -> AsyncLROPoller[_types.MemoryStoreUpdateCompletedResult]: """Update memories. Starts an update that writes conversation memories into the specified memory store. The @@ -8505,8 +14707,8 @@ async def _begin_update_memories( :param name: The name of the memory store 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] + :param body: Is either a JSON type or a UpdateMemoriesRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateMemoriesRequest :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -8521,17 +14723,53 @@ async def _begin_update_memories( Set to 0 to immediately trigger the update without delay. Defaults to 300 (5 minutes). Default value is None. :paramtype update_delay: int - :return: An instance of AsyncLROPoller that returns MemoryStoreUpdateCompletedResult. The - MemoryStoreUpdateCompletedResult is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MemoryStoreUpdateCompletedResult :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.ai.projects.models.MemoryStoreUpdateCompletedResult] + ~azure.core.polling.AsyncLROPoller[~azure.ai.projects.types.MemoryStoreUpdateCompletedResult] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str", + "items": [ + { + "str": {} + } + ], + "previous_update_id": "str", + "update_delay": 0 + } + + # response body for status code(s): 202 + response == { + "memory_operations": [ + { + "kind": "str", + "memory_item": memory_item + } + ], + "usage": { + "embedding_tokens": 0, + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } """ _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.MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -8559,7 +14797,10 @@ def get_long_running_output(pipeline_response): "str", response.headers.get("Operation-Location") ) - deserialized = _deserialize(_models.MemoryStoreUpdateCompletedResult, response.json().get("result", {})) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -8578,20 +14819,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult].from_continuation_token( + return AsyncLROPoller[_types.MemoryStoreUpdateCompletedResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.MemoryStoreUpdateCompletedResult]( + return AsyncLROPoller[_types.MemoryStoreUpdateCompletedResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @overload async def delete_scope( self, name: str, *, scope: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: + ) -> _types.MemoryStoreDeleteScopeResult: """Delete memories by scope. Deletes all memories in the specified memory store that are associated with the provided scope. @@ -8604,16 +14845,26 @@ async def delete_scope( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :return: MemoryStoreDeleteScopeResult + :rtype: ~azure.ai.projects.types.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str", + "scope": "str" + } """ @overload async def delete_scope( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: + self, name: str, body: _types.DeleteScopeRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryStoreDeleteScopeResult: """Delete memories by scope. Deletes all memories in the specified memory store that are associated with the provided scope. @@ -8621,56 +14872,65 @@ async def delete_scope( :param name: The name of the memory store. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.DeleteScopeRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :return: MemoryStoreDeleteScopeResult + :rtype: ~azure.ai.projects.types.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def delete_scope( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete memories by scope. + Example: + .. code-block:: python - Deletes all memories in the specified memory store that are associated with the provided scope. + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str" + } - :param name: The name of the memory store. 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: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str", + "scope": "str" + } """ @distributed_trace_async async def delete_scope( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, scope: str = _Unset, **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: + self, name: str, body: Union[JSON, _types.DeleteScopeRequest] = _Unset, *, scope: str = _Unset, **kwargs: Any + ) -> _types.MemoryStoreDeleteScopeResult: """Delete memories by scope. Deletes all memories in the specified memory store that are associated with the provided scope. :param name: The name of the memory store. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a DeleteScopeRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.DeleteScopeRequest :keyword scope: The namespace that logically groups and isolates memories to delete, such as a user ID. Required. :paramtype scope: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :return: MemoryStoreDeleteScopeResult + :rtype: ~azure.ai.projects.types.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str" + } + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str", + "scope": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8684,7 +14944,7 @@ async def delete_scope( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDeleteScopeResult] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreDeleteScopeResult] = kwargs.pop("cls", None) if body is _Unset: if scope is _Unset: @@ -8692,17 +14952,17 @@ async def delete_scope( body = {"scope": scope} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_delete_scope_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -8726,16 +14986,19 @@ async def delete_scope( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDeleteScopeResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8749,10 +15012,10 @@ async def create_memory( *, scope: str, content: str, - kind: Union[str, _models.MemoryItemKind], + kind: types.MemoryItemKind, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: + ) -> _types.MemoryItem: """Create a memory item. Creates a memory item in the specified memory store. @@ -8770,15 +15033,51 @@ async def create_memory( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @overload async def create_memory( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: + self, name: str, body: _types.CreateMemoryRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryItem: """Create a memory item. Creates a memory item in the specified memory store. @@ -8786,54 +15085,77 @@ async def create_memory( :param name: The name of the memory store. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateMemoryRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create_memory( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: - """Create a memory item. + Example: + .. code-block:: python - Creates a memory item in the specified memory store. + # JSON input template you can fill out and use as your body input. + body = { + "content": "str", + "kind": "str", + "scope": "str" + } - :param name: The name of the memory store. 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: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @distributed_trace_async async def create_memory( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateMemoryRequest] = _Unset, *, scope: str = _Unset, content: str = _Unset, - kind: Union[str, _models.MemoryItemKind] = _Unset, + kind: types.MemoryItemKind = _Unset, **kwargs: Any - ) -> _models.MemoryItem: + ) -> _types.MemoryItem: """Create a memory item. Creates a memory item in the specified memory store. :param name: The name of the memory store. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateMemoryRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateMemoryRequest :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -8842,9 +15164,52 @@ async def create_memory( :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", and "procedural". Required. :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "content": "str", + "kind": "str", + "scope": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8858,7 +15223,7 @@ async def create_memory( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryItem] = kwargs.pop("cls", None) if body is _Unset: if scope is _Unset: @@ -8870,17 +15235,17 @@ async def create_memory( body = {"content": content, "kind": kind, "scope": scope} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_create_memory_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -8904,16 +15269,19 @@ async def create_memory( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryItem, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8923,7 +15291,7 @@ async def create_memory( @overload async def update_memory( self, name: str, memory_id: str, *, content: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: + ) -> _types.MemoryItem: """Update a memory item. Updates the specified memory item in the memory store. @@ -8937,37 +15305,57 @@ async def update_memory( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def update_memory( - self, name: str, memory_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: - """Update a memory item. + Example: + .. code-block:: python - Updates the specified memory item in the memory store. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": - :param name: The name of the memory store. Required. - :type name: str - :param memory_id: The ID of the memory item to update. Required. - :type memory_id: 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: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @overload async def update_memory( - self, name: str, memory_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: + self, + name: str, + memory_id: str, + body: _types.UpdateMemoryRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.MemoryItem: """Update a memory item. Updates the specified memory item in the memory store. @@ -8977,19 +15365,66 @@ async def update_memory( :param memory_id: The ID of the memory item to update. Required. :type memory_id: str :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + :type body: ~azure.ai.projects.types.UpdateMemoryRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "content": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @distributed_trace_async async def update_memory( - self, name: str, memory_id: str, body: Union[JSON, IO[bytes]] = _Unset, *, content: str = _Unset, **kwargs: Any - ) -> _models.MemoryItem: + self, + name: str, + memory_id: str, + body: Union[JSON, _types.UpdateMemoryRequest] = _Unset, + *, + content: str = _Unset, + **kwargs: Any + ) -> _types.MemoryItem: """Update a memory item. Updates the specified memory item in the memory store. @@ -8998,13 +15433,54 @@ async def update_memory( :type name: str :param memory_id: The ID of the memory item to update. Required. :type memory_id: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a UpdateMemoryRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateMemoryRequest :keyword content: The updated content of the memory. Required. :paramtype content: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "content": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9018,7 +15494,7 @@ async def update_memory( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryItem] = kwargs.pop("cls", None) if body is _Unset: if content is _Unset: @@ -9026,18 +15502,18 @@ async def update_memory( body = {"content": 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_update_memory_request( name=name, memory_id=memory_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -9061,16 +15537,19 @@ async def update_memory( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryItem, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9078,7 +15557,7 @@ async def update_memory( return deserialized # type: ignore @distributed_trace_async - async def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.MemoryItem: + async def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _types.MemoryItem: """Get a memory item. Retrieves the specified memory item from the memory store. @@ -9087,9 +15566,45 @@ async def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models. :type name: str :param memory_id: The ID of the memory item to retrieve. Required. :type memory_id: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9102,7 +15617,7 @@ async def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryItem] = kwargs.pop("cls", None) _request = build_beta_memory_stores_get_memory_request( name=name, @@ -9131,16 +15646,19 @@ async def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models. except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryItem, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9153,13 +15671,13 @@ def list_memories( name: str, *, scope: str, - kind: Optional[Union[str, _models.MemoryItemKind]] = None, + kind: Optional[types.MemoryItemKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.MemoryItem"]: + ) -> AsyncItemPaged["_types.MemoryItem"]: """List memory items. Returns memory items from the specified memory store. @@ -9190,23 +15708,59 @@ def list_memories( Default value is "application/json". :paramtype content_type: str :return: An iterator like instance of MemoryItem - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.MemoryItem] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.MemoryItem] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @overload def list_memories( self, name: str, - body: JSON, + body: _types.ListMemoriesRequest, *, - kind: Optional[Union[str, _models.MemoryItemKind]] = None, + kind: Optional[types.MemoryItemKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.MemoryItem"]: + ) -> AsyncItemPaged["_types.MemoryItem"]: """List memory items. Returns memory items from the specified memory store. @@ -9214,7 +15768,7 @@ def list_memories( :param name: The name of the memory store. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.ListMemoriesRequest :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", and "procedural". Default value is None. :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind @@ -9236,77 +15790,72 @@ def list_memories( Default value is "application/json". :paramtype content_type: str :return: An iterator like instance of MemoryItem - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.MemoryItem] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.MemoryItem] :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def list_memories( - self, - name: str, - body: IO[bytes], - *, - kind: Optional[Union[str, _models.MemoryItemKind]] = None, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncItemPaged["_models.MemoryItem"]: - """List memory items. + Example: + .. code-block:: python - Returns memory items from the specified memory store. + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str" + } - :param name: The name of the memory store. Required. - :type name: str - :param body: Required. - :type body: IO[bytes] - :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", - and "procedural". Default value is None. - :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind - :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 content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of MemoryItem - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.MemoryItem] - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @distributed_trace def list_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.ListMemoriesRequest] = _Unset, *, scope: str = _Unset, - kind: Optional[Union[str, _models.MemoryItemKind]] = None, + kind: Optional[types.MemoryItemKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.MemoryItem"]: + ) -> AsyncItemPaged["_types.MemoryItem"]: """List memory items. Returns memory items from the specified memory store. :param name: The name of the memory store. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a ListMemoriesRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.ListMemoriesRequest :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -9328,14 +15877,55 @@ def list_memories( Default value is None. :paramtype before: str :return: An iterator like instance of MemoryItem - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.MemoryItem] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.MemoryItem] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ _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[List[_models.MemoryItem]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.MemoryItem]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9350,11 +15940,11 @@ def list_memories( body = {"scope": scope} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body def prepare_request(_continuation_token=None): @@ -9367,7 +15957,7 @@ def prepare_request(_continuation_token=None): before=before, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -9379,10 +15969,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.MemoryItem], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -9398,9 +15985,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -9409,7 +15996,7 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.DeleteMemoryResult: + async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _types.DeleteMemoryResult: """Delete a memory item. Deletes the specified memory item from the memory store. @@ -9418,9 +16005,19 @@ async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _mode :type name: str :param memory_id: The ID of the memory item to delete. Required. :type memory_id: str - :return: DeleteMemoryResult. The DeleteMemoryResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteMemoryResult + :return: DeleteMemoryResult + :rtype: ~azure.ai.projects.types.DeleteMemoryResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "memory_id": "str", + "object": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9433,7 +16030,7 @@ async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteMemoryResult] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteMemoryResult] = kwargs.pop("cls", None) _request = build_beta_memory_stores_delete_memory_request( name=name, @@ -9462,16 +16059,19 @@ async def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _mode except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteMemoryResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9497,7 +16097,7 @@ def __init__(self, *args, **kwargs) -> None: 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.ModelVersion"]: + def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_types.ModelVersion"]: """List versions. List all versions of the given ModelVersion. @@ -9505,13 +16105,54 @@ def list_versions(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models.Mod :param name: The name of the resource. Required. :type name: str :return: An iterator like instance of ModelVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ModelVersion] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.ModelVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ModelVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ModelVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9564,10 +16205,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.ModelVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -9590,19 +16228,60 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ModelVersion"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_types.ModelVersion"]: """List latest versions. List the latest version of each ModelVersion. :return: An iterator like instance of ModelVersion - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ModelVersion] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.ModelVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ModelVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ModelVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9654,10 +16333,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.ModelVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -9680,7 +16356,7 @@ 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.ModelVersion: + async def get(self, name: str, version: str, **kwargs: Any) -> _types.ModelVersion: """Get a model version. Retrieves the specified model version, returning 404 if it does not exist. @@ -9689,9 +16365,50 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.ModelVers :type name: str :param version: The specific version id of the ModelVersion to retrieve. Required. :type version: str - :return: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion + :return: ModelVersion + :rtype: ~azure.ai.projects.types.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9704,7 +16421,7 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.ModelVers _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) + cls: ClsType[_types.ModelVersion] = kwargs.pop("cls", None) _request = build_beta_models_get_request( name=name, @@ -9738,7 +16455,10 @@ async def get(self, name: str, version: str, **kwargs: Any) -> _models.ModelVers if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ModelVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9799,74 +16519,10 @@ async def delete(self, name: str, version: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload - async def update( - self, - name: str, - version: str, - model_version_update: _models.UpdateModelVersionRequest, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.ModelVersion: - """Update a model version. - - Update an existing ModelVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the UpdateModelVersionRequest to create or update. - Required. - :type version: str - :param model_version_update: The UpdateModelVersionRequest to create or update. Required. - :type model_version_update: ~azure.ai.projects.models.UpdateModelVersionRequest - :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: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - name: str, - version: str, - model_version_update: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.ModelVersion: - """Update a model version. - - Update an existing ModelVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the UpdateModelVersionRequest to create or update. - Required. - :type version: str - :param model_version_update: The UpdateModelVersionRequest to create or update. Required. - :type model_version_update: 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: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload + @distributed_trace_async async def update( - self, - name: str, - version: str, - model_version_update: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.ModelVersion: + self, name: str, version: str, model_version_update: _types.UpdateModelVersionRequest, **kwargs: Any + ) -> _types.ModelVersion: """Update a model version. Update an existing ModelVersion with the given version id. @@ -9877,39 +16533,59 @@ async def update( Required. :type version: str :param model_version_update: The UpdateModelVersionRequest to create or update. Required. - :type model_version_update: 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: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion + :type model_version_update: ~azure.ai.projects.types.UpdateModelVersionRequest + :return: ModelVersion + :rtype: ~azure.ai.projects.types.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def update( - self, - name: str, - version: str, - model_version_update: Union[_models.UpdateModelVersionRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.ModelVersion: - """Update a model version. + Example: + .. code-block:: python - Update an existing ModelVersion with the given version id. + # JSON input template you can fill out and use as your body input. + model_version_update = { + "description": "str", + "tags": { + "str": "str" + } + } - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the UpdateModelVersionRequest to create or update. - Required. - :type version: str - :param model_version_update: The UpdateModelVersionRequest to create or update. Is one of the - following types: UpdateModelVersionRequest, JSON, IO[bytes] Required. - :type model_version_update: ~azure.ai.projects.models.UpdateModelVersionRequest or JSON or - IO[bytes] - :return: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 201, 200 + response == { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9922,22 +16598,17 @@ async def update( _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.ModelVersion] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/merge-patch+json")) + cls: ClsType[_types.ModelVersion] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" - _content = None - if isinstance(model_version_update, (IOBase, bytes)): - _content = model_version_update - else: - _content = json.dumps(model_version_update, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = model_version_update _request = build_beta_models_update_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -9956,108 +16627,30 @@ async def update( 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) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ModelVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def pending_create_version( - self, - name: str, - version: str, - model_version: _models.ModelVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CreateAsyncResponse: - """Create a model version async. - - Creates a model version asynchronously with blob content validation. Returns 202 Accepted with - a location header for polling the operation status. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param model_version: Model version to create. Required. - :type model_version: ~azure.ai.projects.models.ModelVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.CreateAsyncResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def pending_create_version( - self, name: str, version: str, model_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CreateAsyncResponse: - """Create a model version async. - - Creates a model version asynchronously with blob content validation. Returns 202 Accepted with - a location header for polling the operation status. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param model_version: Model version to create. Required. - :type model_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.CreateAsyncResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ + 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) - @overload - async def pending_create_version( - self, - name: str, - version: str, - model_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CreateAsyncResponse: - """Create a model version async. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + if response.content: + deserialized = response.json() + else: + deserialized = None - Creates a model version asynchronously with blob content validation. Returns 202 Accepted with - a location header for polling the operation status. + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param model_version: Model version to create. Required. - :type model_version: 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: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.CreateAsyncResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore @distributed_trace_async async def pending_create_version( - self, name: str, version: str, model_version: Union[_models.ModelVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.CreateAsyncResponse: + self, name: str, version: str, model_version: _types.ModelVersion, **kwargs: Any + ) -> _types.CreateAsyncResponse: """Create a model version async. Creates a model version asynchronously with blob content validation. Returns 202 Accepted with @@ -10067,12 +16660,58 @@ async def pending_create_version( :type name: str :param version: Version of the model. Required. :type version: str - :param model_version: Model version to create. Is one of the following types: ModelVersion, - JSON, IO[bytes] Required. - :type model_version: ~azure.ai.projects.models.ModelVersion or JSON or IO[bytes] - :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.CreateAsyncResponse + :param model_version: Model version to create. Required. + :type model_version: ~azure.ai.projects.types.ModelVersion + :return: CreateAsyncResponse + :rtype: ~azure.ai.projects.types.CreateAsyncResponse :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + model_version = { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } + + # response body for status code(s): 202 + response == { + "location": "str", + "operationResult": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10085,22 +16724,17 @@ async def pending_create_version( _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.CreateAsyncResponse] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.CreateAsyncResponse] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(model_version, (IOBase, bytes)): - _content = model_version - else: - _content = json.dumps(model_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = model_version _request = build_beta_models_pending_create_version_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -10132,81 +16766,20 @@ async def pending_create_version( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CreateAsyncResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: _models.ModelPendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ModelPendingUploadResponse: - """Start a pending upload. - - Initiates a new pending upload or retrieves an existing one for the specified model version. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param pending_upload_request: Required. - :type pending_upload_request: ~azure.ai.projects.models.ModelPendingUploadRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse - :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.ModelPendingUploadResponse: - """Start a pending upload. - - Initiates a new pending upload or retrieves an existing one for the specified model version. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param pending_upload_request: 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: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload + @distributed_trace_async async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ModelPendingUploadResponse: + self, name: str, version: str, pending_upload_request: _types.ModelPendingUploadRequest, **kwargs: Any + ) -> _types.ModelPendingUploadResponse: """Start a pending upload. Initiates a new pending upload or retrieves an existing one for the specified model version. @@ -10216,40 +16789,35 @@ async def pending_upload( :param version: Version of the model. Required. :type version: str :param pending_upload_request: 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: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse + :type pending_upload_request: ~azure.ai.projects.types.ModelPendingUploadRequest + :return: ModelPendingUploadResponse + :rtype: ~azure.ai.projects.types.ModelPendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def pending_upload( - self, - name: str, - version: str, - pending_upload_request: Union[_models.ModelPendingUploadRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.ModelPendingUploadResponse: - """Start a pending upload. + Example: + .. code-block:: python - Initiates a new pending upload or retrieves an existing one for the specified model version. + # JSON input template you can fill out and use as your body input. + pending_upload_request = { + "pendingUploadType": "str", + "connectionName": "str", + "pendingUploadId": "str" + } - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param pending_upload_request: Is one of the following types: ModelPendingUploadRequest, JSON, - IO[bytes] Required. - :type pending_upload_request: ~azure.ai.projects.models.ModelPendingUploadRequest or JSON or - IO[bytes] - :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + }, + "pendingUploadId": "str", + "pendingUploadType": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10262,22 +16830,17 @@ async def pending_upload( _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.ModelPendingUploadResponse] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.ModelPendingUploadResponse] = 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 + _json = pending_upload_request _request = build_beta_models_pending_upload_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -10306,79 +16869,20 @@ async def pending_upload( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ModelPendingUploadResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: _models.ModelCredentialRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: - """Get model asset credentials. - - Retrieves temporary credentials for accessing the storage backing the specified model version. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param credential_request: Required. - :type credential_request: ~azure.ai.projects.models.ModelCredentialRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def get_credentials( - self, - name: str, - version: str, - credential_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: - """Get model asset credentials. - - Retrieves temporary credentials for accessing the storage backing the specified model version. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param credential_request: Required. - :type credential_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: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload + @distributed_trace_async async def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: + self, name: str, version: str, credential_request: _types.ModelCredentialRequest, **kwargs: Any + ) -> _types.DatasetCredential: """Get model asset credentials. Retrieves temporary credentials for accessing the storage backing the specified model version. @@ -10388,37 +16892,30 @@ async def get_credentials( :param version: Version of the model. Required. :type version: str :param credential_request: Required. - :type credential_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: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential + :type credential_request: ~azure.ai.projects.types.ModelCredentialRequest + :return: DatasetCredential + :rtype: ~azure.ai.projects.types.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def get_credentials( - self, - name: str, - version: str, - credential_request: Union[_models.ModelCredentialRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.DatasetCredential: - """Get model asset credentials. + Example: + .. code-block:: python - Retrieves temporary credentials for accessing the storage backing the specified model version. + # JSON input template you can fill out and use as your body input. + credential_request = { + "blobUri": "str" + } - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param credential_request: Is one of the following types: ModelCredentialRequest, JSON, - IO[bytes] Required. - :type credential_request: ~azure.ai.projects.models.ModelCredentialRequest or JSON or IO[bytes] - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10431,22 +16928,17 @@ async def get_credentials( _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.DatasetCredential] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.DatasetCredential] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(credential_request, (IOBase, bytes)): - _content = credential_request - else: - _content = json.dumps(credential_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = credential_request _request = build_beta_models_get_credentials_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -10475,7 +16967,10 @@ async def get_credentials( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetCredential, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10501,16 +16996,51 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.RedTeam: + async def get(self, name: str, **kwargs: Any) -> _types.RedTeam: """Get a redteam. Retrieves the specified redteam and its configuration. :param name: Identifier of the red team run. Required. :type name: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam + :return: RedTeam + :rtype: ~azure.ai.projects.types.RedTeam :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureOpenAIModel": + red_team_target_config = { + "modelDeploymentName": "str", + "type": "AzureOpenAIModel" + } + + # response body for status code(s): 200 + response == { + "id": "str", + "target": red_team_target_config, + "applicationScenario": "str", + "attackStrategies": [ + "str" + ], + "displayName": "str", + "numTurns": 0, + "properties": { + "str": "str" + }, + "riskCategories": [ + "str" + ], + "simulationOnly": bool, + "status": "str", + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10523,7 +17053,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.RedTeam: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RedTeam] = kwargs.pop("cls", None) + cls: ClsType[_types.RedTeam] = kwargs.pop("cls", None) _request = build_beta_red_teams_get_request( name=name, @@ -10556,7 +17086,10 @@ async def get(self, name: str, **kwargs: Any) -> _models.RedTeam: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RedTeam, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10564,19 +17097,54 @@ async def get(self, name: str, **kwargs: Any) -> _models.RedTeam: return deserialized # type: ignore @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.RedTeam"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_types.RedTeam"]: """List redteams. Returns the redteams available in the current project. :return: An iterator like instance of RedTeam - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.RedTeam] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.RedTeam] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureOpenAIModel": + red_team_target_config = { + "modelDeploymentName": "str", + "type": "AzureOpenAIModel" + } + + # response body for status code(s): 200 + response == { + "id": "str", + "target": red_team_target_config, + "applicationScenario": "str", + "attackStrategies": [ + "str" + ], + "displayName": "str", + "numTurns": 0, + "properties": { + "str": "str" + }, + "riskCategories": [ + "str" + ], + "simulationOnly": bool, + "status": "str", + "tags": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RedTeam]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.RedTeam]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10628,10 +17196,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.RedTeam], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -10653,70 +17218,84 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @overload - async def create( - self, red_team: _models.RedTeam, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RedTeam: + @distributed_trace_async + async def create(self, red_team: _types.RedTeam, **kwargs: Any) -> _types.RedTeam: """Create a redteam run. Submits a new redteam run for execution with the provided configuration. :param red_team: Redteam to be run. Required. - :type red_team: ~azure.ai.projects.models.RedTeam - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam + :type red_team: ~azure.ai.projects.types.RedTeam + :return: RedTeam + :rtype: ~azure.ai.projects.types.RedTeam :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create(self, red_team: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.RedTeam: - """Create a redteam run. - Submits a new redteam run for execution with the provided configuration. - - :param red_team: Redteam to be run. Required. - :type red_team: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam - :raises ~azure.core.exceptions.HttpResponseError: - """ + Example: + .. code-block:: python - @overload - async def create( - self, red_team: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RedTeam: - """Create a redteam run. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - Submits a new redteam run for execution with the provided configuration. + # JSON input template for discriminator value "AzureOpenAIModel": + red_team_target_config = { + "modelDeploymentName": "str", + "type": "AzureOpenAIModel" + } - :param red_team: Redteam to be run. Required. - :type red_team: 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: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template you can fill out and use as your body input. + red_team = { + "id": "str", + "target": red_team_target_config, + "applicationScenario": "str", + "attackStrategies": [ + "str" + ], + "displayName": "str", + "numTurns": 0, + "properties": { + "str": "str" + }, + "riskCategories": [ + "str" + ], + "simulationOnly": bool, + "status": "str", + "tags": { + "str": "str" + } + } - @distributed_trace_async - async def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: Any) -> _models.RedTeam: - """Create a redteam run. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - Submits a new redteam run for execution with the provided configuration. + # JSON input template for discriminator value "AzureOpenAIModel": + red_team_target_config = { + "modelDeploymentName": "str", + "type": "AzureOpenAIModel" + } - :param red_team: Redteam to be run. Is one of the following types: RedTeam, JSON, IO[bytes] - Required. - :type red_team: ~azure.ai.projects.models.RedTeam or JSON or IO[bytes] - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 201 + response == { + "id": "str", + "target": red_team_target_config, + "applicationScenario": "str", + "attackStrategies": [ + "str" + ], + "displayName": "str", + "numTurns": 0, + "properties": { + "str": "str" + }, + "riskCategories": [ + "str" + ], + "simulationOnly": bool, + "status": "str", + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10729,20 +17308,15 @@ async def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwar _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.RedTeam] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.RedTeam] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(red_team, (IOBase, bytes)): - _content = red_team - else: - _content = json.dumps(red_team, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = red_team _request = build_beta_red_teams_create_request( content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -10766,16 +17340,19 @@ async def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwar except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RedTeam, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10808,10 +17385,10 @@ async def create_or_update( content_type: str = "application/json", description: Optional[str] = None, enabled: Optional[bool] = None, - triggers: Optional[dict[str, _models.RoutineTrigger]] = None, - action: Optional[_models.RoutineAction] = None, + triggers: Optional[dict[str, _types.RoutineTrigger]] = None, + action: Optional[_types.RoutineAction] = None, **kwargs: Any - ) -> _models.Routine: + ) -> _types.Routine: """Create or update a routine. Creates a new routine or replaces an existing routine with the supplied definition. @@ -10827,38 +17404,60 @@ async def create_or_update( :paramtype enabled: bool :keyword triggers: The triggers configured for the routine. In v1, exactly one trigger entry is supported. Default value is None. - :paramtype triggers: dict[str, ~azure.ai.projects.models.RoutineTrigger] + :paramtype triggers: dict[str, ~azure.ai.projects.types.RoutineTrigger] :keyword action: The action executed when the routine fires. Default value is None. - :paramtype action: ~azure.ai.projects.models.RoutineAction - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :paramtype action: ~azure.ai.projects.types.RoutineAction + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create_or_update( - self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Routine: - """Create or update a routine. + Example: + .. code-block:: python - Creates a new routine or replaces an existing routine with the supplied definition. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - :param routine_name: The unique name of the routine. Required. - :type routine_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: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ @overload async def create_or_update( - self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Routine: + self, + routine_name: str, + body: _types.CreateOrUpdateRoutineRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.Routine: """Create or update a routine. Creates a new routine or replaces an existing routine with the supplied definition. @@ -10866,47 +17465,183 @@ async def create_or_update( :param routine_name: The unique name of the routine. Required. :type routine_name: str :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + :type body: ~azure.ai.projects.types.CreateOrUpdateRoutineRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # JSON input template you can fill out and use as your body input. + body = { + "action": routine_action, + "description": "str", + "enabled": bool, + "triggers": { + "str": routine_trigger + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ @distributed_trace_async async def create_or_update( self, routine_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateOrUpdateRoutineRequest] = _Unset, *, description: Optional[str] = None, enabled: Optional[bool] = None, - triggers: Optional[dict[str, _models.RoutineTrigger]] = None, - action: Optional[_models.RoutineAction] = None, + triggers: Optional[dict[str, _types.RoutineTrigger]] = None, + action: Optional[_types.RoutineAction] = None, **kwargs: Any - ) -> _models.Routine: + ) -> _types.Routine: """Create or update a routine. Creates a new routine or replaces an existing routine with the supplied definition. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateOrUpdateRoutineRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateOrUpdateRoutineRequest :keyword description: A human-readable description of the routine. Default value is None. :paramtype description: str :keyword enabled: Whether the routine is enabled. Default value is None. :paramtype enabled: bool :keyword triggers: The triggers configured for the routine. In v1, exactly one trigger entry is supported. Default value is None. - :paramtype triggers: dict[str, ~azure.ai.projects.models.RoutineTrigger] + :paramtype triggers: dict[str, ~azure.ai.projects.types.RoutineTrigger] :keyword action: The action executed when the routine fires. Default value is None. - :paramtype action: ~azure.ai.projects.models.RoutineAction - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :paramtype action: ~azure.ai.projects.types.RoutineAction + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # JSON input template you can fill out and use as your body input. + body = { + "action": routine_action, + "description": "str", + "enabled": bool, + "triggers": { + "str": routine_trigger + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10920,23 +17655,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.Routine] = kwargs.pop("cls", None) + cls: ClsType[_types.Routine] = kwargs.pop("cls", None) if body is _Unset: body = {"action": action, "description": description, "enabled": enabled, "triggers": triggers} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_routines_create_or_update_request( routine_name=routine_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -10960,16 +17695,19 @@ async def create_or_update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Routine, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10977,16 +17715,53 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: + async def get(self, routine_name: str, **kwargs: Any) -> _types.Routine: """Get a routine. Retrieves the specified routine and its current configuration. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10999,7 +17774,7 @@ async def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + cls: ClsType[_types.Routine] = kwargs.pop("cls", None) _request = build_beta_routines_get_request( routine_name=routine_name, @@ -11027,16 +17802,19 @@ async def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Routine, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11044,16 +17822,53 @@ async def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: return deserialized # type: ignore @distributed_trace_async - async def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: + async def enable(self, routine_name: str, **kwargs: Any) -> _types.Routine: """Enable a routine. Enables the specified routine so it can be dispatched. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11066,7 +17881,7 @@ async def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + cls: ClsType[_types.Routine] = kwargs.pop("cls", None) _request = build_beta_routines_enable_request( routine_name=routine_name, @@ -11094,16 +17909,19 @@ async def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Routine, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11111,16 +17929,53 @@ async def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: return deserialized # type: ignore @distributed_trace_async - async def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: + async def disable(self, routine_name: str, **kwargs: Any) -> _types.Routine: """Disable a routine. Disables the specified routine so it no longer runs. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11133,7 +17988,7 @@ async def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + cls: ClsType[_types.Routine] = kwargs.pop("cls", None) _request = build_beta_routines_disable_request( routine_name=routine_name, @@ -11161,16 +18016,19 @@ async def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Routine, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11180,7 +18038,7 @@ async def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: @distributed_trace def list( self, *, limit: Optional[int] = None, before: Optional[str] = None, order: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Routine"]: + ) -> AsyncItemPaged["_types.Routine"]: """List routines. Returns the routines available in the current project. @@ -11194,13 +18052,50 @@ def list( None. :paramtype order: str :return: An iterator like instance of Routine - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Routine] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.Routine] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Routine]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Routine]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11229,10 +18124,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.Routine], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -11248,9 +18140,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -11303,9 +18195,9 @@ async def delete(self, routine_name: str, **kwargs: Any) -> 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -11322,7 +18214,7 @@ def list_runs( before: Optional[str] = None, order: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.RoutineRun"]: + ) -> AsyncItemPaged["_types.RoutineRun"]: """List prior runs for a routine. Returns prior runs recorded for the specified routine. @@ -11341,13 +18233,45 @@ def list_runs( None. :paramtype order: str :return: An iterator like instance of RoutineRun - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.RoutineRun] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.RoutineRun] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "action_correlation_id": "str", + "action_type": "str", + "agent_endpoint_id": "str", + "agent_id": "str", + "attempt_source": "str", + "conversation_id": "str", + "dispatch_id": "str", + "ended_at": "2020-02-20 00:00:00", + "error_message": "str", + "error_status_code": 0, + "error_type": "str", + "phase": "str", + "response_id": "str", + "scheduled_fire_at": "2020-02-20 00:00:00", + "session_id": "str", + "started_at": "2020-02-20 00:00:00", + "status": "str", + "task_id": "str", + "trigger_event_payload": { + "str": {} + }, + "trigger_name": "str", + "trigger_type": "str", + "triggered_at": "2020-02-20 00:00:00" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RoutineRun]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.RoutineRun]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11378,10 +18302,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.RoutineRun], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -11397,9 +18318,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -11413,9 +18334,9 @@ async def dispatch( routine_name: str, *, content_type: str = "application/json", - payload: Optional[_models.RoutineDispatchPayload] = None, + payload: Optional[_types.RoutineDispatchPayload] = None, **kwargs: Any - ) -> _models.DispatchRoutineResult: + ) -> _types.DispatchRoutineResult: """Queue an asynchronous routine dispatch. Queues an asynchronous dispatch for the specified routine. @@ -11427,16 +18348,31 @@ async def dispatch( :paramtype content_type: str :keyword payload: A direct action-input override sent downstream when testing a routine. Default value is None. - :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload - :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResult + :paramtype payload: ~azure.ai.projects.types.RoutineDispatchPayload + :return: DispatchRoutineResult + :rtype: ~azure.ai.projects.types.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "action_correlation_id": "str", + "dispatch_id": "str", + "task_id": "str" + } """ @overload async def dispatch( - self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DispatchRoutineResult: + self, + routine_name: str, + body: _types.DispatchRoutineAsyncRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.DispatchRoutineResult: """Queue an asynchronous routine dispatch. Queues an asynchronous dispatch for the specified routine. @@ -11444,58 +18380,98 @@ async def dispatch( :param routine_name: The unique name of the routine. Required. :type routine_name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.DispatchRoutineAsyncRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResult + :return: DispatchRoutineResult + :rtype: ~azure.ai.projects.types.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def dispatch( - self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DispatchRoutineResult: - """Queue an asynchronous routine dispatch. + Example: + .. code-block:: python - Queues an asynchronous dispatch for the specified routine. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param routine_name: The unique name of the routine. Required. - :type routine_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: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResult - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_dispatch_payload = { + "input": {}, + "type": "invoke_agent_invocations_api" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_dispatch_payload = { + "input": {}, + "type": "invoke_agent_responses_api" + } + + # JSON input template you can fill out and use as your body input. + body = { + "payload": routine_dispatch_payload + } + + # response body for status code(s): 200 + response == { + "action_correlation_id": "str", + "dispatch_id": "str", + "task_id": "str" + } """ @distributed_trace_async async def dispatch( self, routine_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.DispatchRoutineAsyncRequest] = _Unset, *, - payload: Optional[_models.RoutineDispatchPayload] = None, + payload: Optional[_types.RoutineDispatchPayload] = None, **kwargs: Any - ) -> _models.DispatchRoutineResult: + ) -> _types.DispatchRoutineResult: """Queue an asynchronous routine dispatch. Queues an asynchronous dispatch for the specified routine. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a DispatchRoutineAsyncRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.DispatchRoutineAsyncRequest :keyword payload: A direct action-input override sent downstream when testing a routine. Default value is None. - :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload - :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResult + :paramtype payload: ~azure.ai.projects.types.RoutineDispatchPayload + :return: DispatchRoutineResult + :rtype: ~azure.ai.projects.types.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_dispatch_payload = { + "input": {}, + "type": "invoke_agent_invocations_api" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_dispatch_payload = { + "input": {}, + "type": "invoke_agent_responses_api" + } + + # JSON input template you can fill out and use as your body input. + body = { + "payload": routine_dispatch_payload + } + + # response body for status code(s): 200 + response == { + "action_correlation_id": "str", + "dispatch_id": "str", + "task_id": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11509,23 +18485,23 @@ async def dispatch( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DispatchRoutineResult] = kwargs.pop("cls", None) + cls: ClsType[_types.DispatchRoutineResult] = kwargs.pop("cls", None) if body is _Unset: body = {"payload": payload} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_routines_dispatch_request( routine_name=routine_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -11549,16 +18525,19 @@ async def dispatch( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DispatchRoutineResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11634,16 +18613,81 @@ async def delete(self, schedule_id: str, **kwargs: Any) -> None: return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: + async def get(self, schedule_id: str, **kwargs: Any) -> _types.Schedule: """Get a schedule. Retrieves the specified schedule resource. :param schedule_id: Identifier of the schedule. Required. :type schedule_id: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :return: Schedule + :rtype: ~azure.ai.projects.types.Schedule :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } + + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } + + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "id": "str", + "systemData": { + "str": "str" + }, + "task": schedule_task, + "trigger": trigger, + "description": "str", + "displayName": "str", + "properties": { + "str": "str" + }, + "provisioningStatus": "str", + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11656,7 +18700,7 @@ async def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + cls: ClsType[_types.Schedule] = kwargs.pop("cls", None) _request = build_beta_schedules_get_request( schedule_id=schedule_id, @@ -11689,7 +18733,10 @@ async def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Schedule, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11698,12 +18745,8 @@ async def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: @distributed_trace def list( - self, - *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, - enabled: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Schedule"]: + self, *, type: Optional[types.ScheduleTaskType] = None, enabled: Optional[bool] = None, **kwargs: Any + ) -> AsyncItemPaged["_types.Schedule"]: """List schedules. Returns schedules that match the supplied type and enabled filters. @@ -11714,13 +18757,78 @@ def list( :keyword enabled: Filter by the enabled status. Default value is None. :paramtype enabled: bool :return: An iterator like instance of Schedule - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Schedule] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.Schedule] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } + + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } + + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "id": "str", + "systemData": { + "str": "str" + }, + "task": schedule_task, + "trigger": trigger, + "description": "str", + "displayName": "str", + "properties": { + "str": "str" + }, + "provisioningStatus": "str", + "tags": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Schedule]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Schedule]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11774,10 +18882,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.Schedule], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -11799,10 +18904,8 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @overload - async def create_or_update( - self, schedule_id: str, schedule: _models.Schedule, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: + @distributed_trace_async + async def create_or_update(self, schedule_id: str, schedule: _types.Schedule, **kwargs: Any) -> _types.Schedule: """Create or update a schedule. Creates a new schedule or updates an existing schedule with the supplied definition. @@ -11810,71 +18913,179 @@ async def create_or_update( :param schedule_id: Identifier of the schedule. Required. :type schedule_id: str :param schedule: The resource instance. Required. - :type schedule: ~azure.ai.projects.models.Schedule - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :type schedule: ~azure.ai.projects.types.Schedule + :return: Schedule + :rtype: ~azure.ai.projects.types.Schedule :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def create_or_update( - self, schedule_id: str, schedule: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update a schedule. + Example: + .. code-block:: python - Creates a new schedule or updates an existing schedule with the supplied definition. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } - @overload - async def create_or_update( - self, schedule_id: str, schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update a schedule. + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } - Creates a new schedule or updates an existing schedule with the supplied definition. + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: 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: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } - @distributed_trace_async - async def create_or_update( - self, schedule_id: str, schedule: Union[_models.Schedule, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Schedule: - """Create or update a schedule. + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } - Creates a new schedule or updates an existing schedule with the supplied definition. + # JSON input template you can fill out and use as your body input. + schedule = { + "enabled": bool, + "id": "str", + "systemData": { + "str": "str" + }, + "task": schedule_task, + "trigger": trigger, + "description": "str", + "displayName": "str", + "properties": { + "str": "str" + }, + "provisioningStatus": "str", + "tags": { + "str": "str" + } + } - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Is one of the following types: Schedule, JSON, - IO[bytes] Required. - :type schedule: ~azure.ai.projects.models.Schedule or JSON or IO[bytes] - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } + + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } + + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } + + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } + + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } + + # response body for status code(s): 201, 200 + response == { + "enabled": bool, + "id": "str", + "systemData": { + "str": "str" + }, + "task": schedule_task, + "trigger": trigger, + "description": "str", + "displayName": "str", + "properties": { + "str": "str" + }, + "provisioningStatus": "str", + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11887,21 +19098,16 @@ async def create_or_update( _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.Schedule] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.Schedule] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(schedule, (IOBase, bytes)): - _content = schedule - else: - _content = json.dumps(schedule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = schedule _request = build_beta_schedules_create_or_update_request( schedule_id=schedule_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -11930,7 +19136,10 @@ async def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Schedule, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11938,7 +19147,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.ScheduleRun: + async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _types.ScheduleRun: """Get a schedule run. Retrieves the specified run for a schedule. @@ -11947,9 +19156,24 @@ async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models :type schedule_id: str :param run_id: The unique identifier of the schedule run. Required. :type run_id: str - :return: ScheduleRun. The ScheduleRun is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ScheduleRun + :return: ScheduleRun + :rtype: ~azure.ai.projects.types.ScheduleRun :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "properties": { + "str": "str" + }, + "scheduleId": "str", + "success": bool, + "error": "str", + "triggerTime": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11962,7 +19186,7 @@ async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ScheduleRun] = kwargs.pop("cls", None) + cls: ClsType[_types.ScheduleRun] = kwargs.pop("cls", None) _request = build_beta_schedules_get_run_request( schedule_id=schedule_id, @@ -11991,16 +19215,19 @@ async def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ScheduleRun, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12012,10 +19239,10 @@ def list_runs( self, schedule_id: str, *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, + type: Optional[types.ScheduleTaskType] = None, enabled: Optional[bool] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ScheduleRun"]: + ) -> AsyncItemPaged["_types.ScheduleRun"]: """List schedule runs. Returns schedule runs that match the supplied filters. @@ -12028,13 +19255,28 @@ def list_runs( :keyword enabled: Filter by the enabled status. Default value is None. :paramtype enabled: bool :return: An iterator like instance of ScheduleRun - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.ScheduleRun] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.ScheduleRun] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "properties": { + "str": "str" + }, + "scheduleId": "str", + "success": bool, + "error": "str", + "triggerTime": "2020-02-20 00:00:00" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ScheduleRun]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ScheduleRun]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12089,10 +19331,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.ScheduleRun], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -12133,16 +19372,29 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: + async def get(self, name: str, **kwargs: Any) -> _types.SkillDetails: """Retrieve a skill. Retrieves the specified skill and its current configuration. :param name: The unique name of the skill. Required. :type name: str - :return: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails + :return: SkillDetails + :rtype: ~azure.ai.projects.types.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12155,7 +19407,7 @@ 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[_types.SkillDetails] = kwargs.pop("cls", None) _request = build_beta_skills_get_request( name=name, @@ -12183,16 +19435,19 @@ async def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12204,10 +19459,10 @@ def list( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SkillDetails"]: + ) -> AsyncItemPaged["_types.SkillDetails"]: """List skills. Returns the skills available in the current project. @@ -12227,13 +19482,26 @@ def 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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.SkillDetails] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SkillDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.SkillDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12262,10 +19530,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], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -12281,9 +19546,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -12294,7 +19559,7 @@ async def get_next(_continuation_token=None): @overload async def update( self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: + ) -> _types.SkillDetails: """Update a skill. Modifies the specified skill's configuration. @@ -12307,15 +19572,28 @@ async def update( :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 + :return: SkillDetails + :rtype: ~azure.ai.projects.types.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ @overload async def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: + self, name: str, body: _types.UpdateSkillRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.SkillDetails: """Update a skill. Modifies the specified skill's configuration. @@ -12323,53 +19601,74 @@ async def update( :param name: The name of the skill to update. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.UpdateSkillRequest :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 + :return: SkillDetails + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python - Modifies the specified skill's configuration. + # JSON input template you can fill out and use as your body input. + body = { + "default_version": "str" + } - :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: + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ @distributed_trace_async async def update( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.SkillDetails: + self, + name: str, + body: Union[JSON, _types.UpdateSkillRequest] = _Unset, + *, + default_version: str = _Unset, + **kwargs: Any + ) -> _types.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: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a UpdateSkillRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateSkillRequest :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 + :return: SkillDetails + :rtype: ~azure.ai.projects.types.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "default_version": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12383,7 +19682,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.SkillDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.SkillDetails] = kwargs.pop("cls", None) if body is _Unset: if default_version is _Unset: @@ -12391,17 +19690,17 @@ async def update( 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_skills_update_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -12425,16 +19724,19 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12442,16 +19744,26 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: + async def delete(self, name: str, **kwargs: Any) -> _types.DeleteSkillResult: """Delete a skill. Removes the specified skill and its associated versions. :param name: The unique name of the skill. Required. :type name: str - :return: DeleteSkillResult. The DeleteSkillResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteSkillResult + :return: DeleteSkillResult + :rtype: ~azure.ai.projects.types.DeleteSkillResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "id": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12464,7 +19776,7 @@ 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[_types.DeleteSkillResult] = kwargs.pop("cls", None) _request = build_beta_skills_delete_request( name=name, @@ -12492,16 +19804,19 @@ async def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12514,10 +19829,10 @@ async def create( name: str, *, content_type: str = "application/json", - inline_content: Optional[_models.SkillInlineContent] = None, + inline_content: Optional[_types.SkillInlineContent] = None, default: Optional[bool] = None, **kwargs: Any - ) -> _models.SkillVersion: + ) -> _types.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. @@ -12529,18 +19844,36 @@ async def create( :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 + :paramtype inline_content: ~azure.ai.projects.types.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 + :return: SkillVersion + :rtype: ~azure.ai.projects.types.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ @overload async def create( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillVersion: + self, + name: str, + body: _types.CreateSkillVersionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.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. @@ -12548,61 +19881,101 @@ async def create( :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 + :type body: ~azure.ai.projects.types.CreateSkillVersionRequest :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 + :return: SkillVersion + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "default": bool, + "inline_content": { + "description": "str", + "instructions": "str", + "allowed_tools": [ + "str" + ], + "compatibility": "str", + "license": "str", + "metadata": { + "str": "str" + } + } + } - :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: + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ @distributed_trace_async async def create( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateSkillVersionRequest] = _Unset, *, - inline_content: Optional[_models.SkillInlineContent] = None, + inline_content: Optional[_types.SkillInlineContent] = None, default: Optional[bool] = None, **kwargs: Any - ) -> _models.SkillVersion: + ) -> _types.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: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateSkillVersionRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateSkillVersionRequest :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 + :paramtype inline_content: ~azure.ai.projects.types.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 + :return: SkillVersion + :rtype: ~azure.ai.projects.types.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "default": bool, + "inline_content": { + "description": "str", + "instructions": "str", + "allowed_tools": [ + "str" + ], + "compatibility": "str", + "license": "str", + "metadata": { + "str": "str" + } + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12616,23 +19989,23 @@ async def create( _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) + cls: ClsType[_types.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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_skills_create_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -12656,41 +20029,29 @@ async def create( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload + @distributed_trace_async 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: + self, name: str, content: _types.CreateSkillVersionFromFilesBody, **kwargs: Any + ) -> _types.SkillVersion: """Create a skill version from uploaded files. Creates a new version of a skill from uploaded files via multipart form data. @@ -12698,27 +20059,31 @@ async def create_from_files(self, name: str, content: JSON, **kwargs: Any) -> _m :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 + :type content: ~azure.ai.projects.types.CreateSkillVersionFromFilesBody + :return: SkillVersion + :rtype: ~azure.ai.projects.types.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - @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. + Example: + .. code-block:: python - Creates a new version of a skill from uploaded files via multipart form data. + # JSON input template you can fill out and use as your body input. + content = { + "files": [ + filetype + ], + "default": bool + } - :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 - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12731,9 +20096,11 @@ async def create_from_files( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) + cls: ClsType[_types.SkillVersion] = kwargs.pop("cls", None) - _body = content.as_dict() if isinstance(content, _Model) else content + if not isinstance(content, MutableMapping): + raise TypeError("content must be a mapping") + _body = content _file_fields: list[str] = ["files"] _data_fields: list[str] = ["default"] _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) @@ -12765,16 +20132,19 @@ async def create_from_files( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12787,10 +20157,10 @@ def list_versions( name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.SkillVersion"]: + ) -> AsyncItemPaged["_types.SkillVersion"]: """List skill versions. Returns the available versions for the specified skill. @@ -12812,13 +20182,26 @@ def list_versions( 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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.SkillVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SkillVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.SkillVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12848,10 +20231,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], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -12867,9 +20247,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -12878,7 +20258,7 @@ 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.SkillVersion: + async def get_version(self, name: str, version: str, **kwargs: Any) -> _types.SkillVersion: """Retrieve a specific version of a skill. Retrieves the specified version of a skill by name and version identifier. @@ -12887,9 +20267,22 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.S :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 + :return: SkillVersion + :rtype: ~azure.ai.projects.types.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12902,7 +20295,7 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.S _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) + cls: ClsType[_types.SkillVersion] = kwargs.pop("cls", None) _request = build_beta_skills_get_version_request( name=name, @@ -12931,16 +20324,19 @@ async def get_version(self, name: str, version: str, **kwargs: Any) -> _models.S except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12998,9 +20394,9 @@ async def download(self, name: str, **kwargs: Any) -> AsyncIterator[bytes]: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -13068,9 +20464,9 @@ async def download_version(self, name: str, version: str, **kwargs: Any) -> Asyn except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -13085,7 +20481,7 @@ async def download_version(self, name: str, version: str, **kwargs: Any) -> Asyn return deserialized # type: ignore @distributed_trace_async - async def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.DeleteSkillVersionResult: + async def delete_version(self, name: str, version: str, **kwargs: Any) -> _types.DeleteSkillVersionResult: """Delete a specific version of a skill. Removes the specified version of a skill. @@ -13094,10 +20490,20 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> _model :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 + :return: DeleteSkillVersionResult + :rtype: ~azure.ai.projects.types.DeleteSkillVersionResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "id": "str", + "name": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13110,7 +20516,7 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteSkillVersionResult] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteSkillVersionResult] = kwargs.pop("cls", None) _request = build_beta_skills_delete_version_request( name=name, @@ -13139,16 +20545,19 @@ async def delete_version(self, name: str, version: str, **kwargs: Any) -> _model except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteSkillVersionResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13174,16 +20583,104 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: + async def get_generation_job(self, job_id: str, **kwargs: Any) -> _types.DataGenerationJob: """Get a data generation job. Retrieves the specified data generation job and its current status. :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: DataGenerationJob + :rtype: ~azure.ai.projects.types.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } + + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13196,7 +20693,7 @@ 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[_types.DataGenerationJob] = kwargs.pop("cls", None) _request = build_beta_datasets_get_generation_job_request( job_id=job_id, @@ -13224,9 +20721,9 @@ async def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGe except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -13236,7 +20733,10 @@ 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()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -13248,10 +20748,10 @@ def list_generation_jobs( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.DataGenerationJob"]: + ) -> AsyncItemPaged["_types.DataGenerationJob"]: """List data generation jobs. Returns a list of data generation jobs. @@ -13271,13 +20771,101 @@ def list_generation_jobs( 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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.DataGenerationJob] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } + + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DataGenerationJob]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.DataGenerationJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13306,10 +20894,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], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -13325,9 +20910,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -13335,100 +20920,195 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) - @overload + @distributed_trace_async async def create_generation_job( - self, - job: _models.DataGenerationJob, - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataGenerationJob: + self, job: _types.DataGenerationJob, *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _types.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 + :type job: ~azure.ai.projects.types.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 + :return: DataGenerationJob + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } - :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: - """ + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } - @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. + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } - Submits a new data generation job for asynchronous execution. + # JSON input template you can fill out and use as your body input. + job = { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } - :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: - """ + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } - @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. + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } - Submits a new data generation job for asynchronous execution. + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } - :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: + # response body for status code(s): 201 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13441,21 +21121,16 @@ async def create_generation_job( _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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.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 + _json = job _request = build_beta_datasets_create_generation_job_request( operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -13479,9 +21154,9 @@ async def create_generation_job( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -13492,7 +21167,10 @@ async def create_generation_job( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -13500,16 +21178,104 @@ async def create_generation_job( return deserialized # type: ignore @distributed_trace_async - async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: + async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _types.DataGenerationJob: """Cancel a data generation job. Cancels the specified data generation job if it is still in progress. :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: DataGenerationJob + :rtype: ~azure.ai.projects.types.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } + + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13522,7 +21288,7 @@ 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[_types.DataGenerationJob] = kwargs.pop("cls", None) _request = build_beta_datasets_cancel_generation_job_request( job_id=job_id, @@ -13550,16 +21316,19 @@ async def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Dat except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13611,9 +21380,9 @@ async def delete_generation_job(self, job_id: str, **kwargs: Any) -> 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -13638,100 +21407,234 @@ 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 - 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 + @distributed_trace_async async def create_optimization_job( - self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.OptimizationJob: + self, job: _types.OptimizationJob, *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _types.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 + :type job: ~azure.ai.projects.types.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 + :return: OptimizationJob + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "inline": + optimization_dataset_input = { + "items": [ + { + "criteria": [ + { + "instruction": "str", + "name": "str" + } + ], + "desired_num_turns": 0, + "ground_truth": "str", + "query": "str" + } + ], + "type": "inline" + } - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. + # JSON input template for discriminator value "reference": + optimization_dataset_input = { + "name": "str", + "type": "reference", + "version": "str" + } - :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: - """ + # JSON input template you can fill out and use as your body input. + job = { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "inputs": { + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "evaluators": [ + { + "name": "str", + "version": "str" + } + ], + "train_dataset": optimization_dataset_input, + "options": { + "eval_model": "str", + "evaluation_level": "str", + "max_candidates": 0, + "optimization_config": { + "str": {} + }, + "optimization_model": "str" + }, + "validation_dataset": optimization_dataset_input + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + }, + "result": { + "baseline": "str", + "best": "str", + "candidates": [ + { + "avg_score": 0.0, + "avg_tokens": 0.0, + "name": "str", + "candidate_id": "str", + "eval_id": "str", + "eval_run_id": "str", + "mutations": { + "str": {} + }, + "promotion": { + "agent_name": "str", + "agent_version": "str", + "promoted_at": "2020-02-20 00:00:00" + } + } + ] + }, + "warnings": [ + "str" + ] + } - @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. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "inline": + optimization_dataset_input = { + "items": [ + { + "criteria": [ + { + "instruction": "str", + "name": "str" + } + ], + "desired_num_turns": 0, + "ground_truth": "str", + "query": "str" + } + ], + "type": "inline" + } - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. + # JSON input template for discriminator value "reference": + optimization_dataset_input = { + "name": "str", + "type": "reference", + "version": "str" + } - :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: + # response body for status code(s): 201 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "inputs": { + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "evaluators": [ + { + "name": "str", + "version": "str" + } + ], + "train_dataset": optimization_dataset_input, + "options": { + "eval_model": "str", + "evaluation_level": "str", + "max_candidates": 0, + "optimization_config": { + "str": {} + }, + "optimization_model": "str" + }, + "validation_dataset": optimization_dataset_input + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + }, + "result": { + "baseline": "str", + "best": "str", + "candidates": [ + { + "avg_score": 0.0, + "avg_tokens": 0.0, + "name": "str", + "candidate_id": "str", + "eval_id": "str", + "eval_run_id": "str", + "mutations": { + "str": {} + }, + "promotion": { + "agent_name": "str", + "agent_version": "str", + "promoted_at": "2020-02-20 00:00:00" + } + } + ] + }, + "warnings": [ + "str" + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13744,21 +21647,16 @@ async def create_optimization_job( _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.OptimizationJob] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.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 + _json = job _request = build_beta_agents_create_optimization_job_request( operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -13782,9 +21680,9 @@ async def create_optimization_job( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -13795,7 +21693,10 @@ async def create_optimization_job( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -13803,16 +21704,123 @@ async def create_optimization_job( return deserialized # type: ignore @distributed_trace_async - async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _types.OptimizationJob: """Get info about an agent optimization job. Get an optimization job by id. :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 + :return: OptimizationJob + :rtype: ~azure.ai.projects.types.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "inline": + optimization_dataset_input = { + "items": [ + { + "criteria": [ + { + "instruction": "str", + "name": "str" + } + ], + "desired_num_turns": 0, + "ground_truth": "str", + "query": "str" + } + ], + "type": "inline" + } + + # JSON input template for discriminator value "reference": + optimization_dataset_input = { + "name": "str", + "type": "reference", + "version": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "inputs": { + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "evaluators": [ + { + "name": "str", + "version": "str" + } + ], + "train_dataset": optimization_dataset_input, + "options": { + "eval_model": "str", + "evaluation_level": "str", + "max_candidates": 0, + "optimization_config": { + "str": {} + }, + "optimization_model": "str" + }, + "validation_dataset": optimization_dataset_input + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + }, + "result": { + "baseline": "str", + "best": "str", + "candidates": [ + { + "avg_score": 0.0, + "avg_tokens": 0.0, + "name": "str", + "candidate_id": "str", + "eval_id": "str", + "eval_run_id": "str", + "mutations": { + "str": {} + }, + "promotion": { + "agent_name": "str", + "agent_version": "str", + "promoted_at": "2020-02-20 00:00:00" + } + } + ] + }, + "warnings": [ + "str" + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13825,7 +21833,7 @@ async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Opti _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + cls: ClsType[_types.OptimizationJob] = kwargs.pop("cls", None) _request = build_beta_agents_get_optimization_job_request( job_id=job_id, @@ -13853,9 +21861,9 @@ async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Opti except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -13865,7 +21873,10 @@ async def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Opti if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -13877,12 +21888,12 @@ def list_optimization_jobs( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, - status: Optional[Union[str, _models.JobStatus]] = None, + status: Optional[types.JobStatus] = None, agent_name: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.OptimizationJobListItem"]: + ) -> AsyncItemPaged["_types.OptimizationJobListItem"]: """Returns a list of agent optimization jobs. List optimization jobs. Supports cursor pagination and optional status / agent_name filters. @@ -13908,13 +21919,48 @@ def list_optimization_jobs( :paramtype agent_name: str :return: An iterator like instance of OptimizationJobListItem :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.OptimizationJobListItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.types.OptimizationJobListItem] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.OptimizationJobListItem]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.OptimizationJobListItem]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13945,10 +21991,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.OptimizationJobListItem], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -13964,9 +22007,9 @@ async def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -13975,7 +22018,7 @@ async def get_next(_continuation_token=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _types.OptimizationJob: """Cancels an agent optimization job. Request cancellation of a running or queued job. Returns an error if the job is already in a @@ -13983,9 +22026,116 @@ async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.O :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 + :return: OptimizationJob + :rtype: ~azure.ai.projects.types.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "inline": + optimization_dataset_input = { + "items": [ + { + "criteria": [ + { + "instruction": "str", + "name": "str" + } + ], + "desired_num_turns": 0, + "ground_truth": "str", + "query": "str" + } + ], + "type": "inline" + } + + # JSON input template for discriminator value "reference": + optimization_dataset_input = { + "name": "str", + "type": "reference", + "version": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "inputs": { + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "evaluators": [ + { + "name": "str", + "version": "str" + } + ], + "train_dataset": optimization_dataset_input, + "options": { + "eval_model": "str", + "evaluation_level": "str", + "max_candidates": 0, + "optimization_config": { + "str": {} + }, + "optimization_model": "str" + }, + "validation_dataset": optimization_dataset_input + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + }, + "result": { + "baseline": "str", + "best": "str", + "candidates": [ + { + "avg_score": 0.0, + "avg_tokens": 0.0, + "name": "str", + "candidate_id": "str", + "eval_id": "str", + "eval_run_id": "str", + "mutations": { + "str": {} + }, + "promotion": { + "agent_name": "str", + "agent_version": "str", + "promoted_at": "2020-02-20 00:00:00" + } + } + ] + }, + "warnings": [ + "str" + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13998,7 +22148,7 @@ 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[_types.OptimizationJob] = kwargs.pop("cls", None) _request = build_beta_agents_cancel_optimization_job_request( job_id=job_id, @@ -14026,16 +22176,19 @@ async def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.O except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14087,9 +22240,9 @@ async def delete_optimization_job(self, job_id: str, **kwargs: Any) -> 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) 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 cd906a8d8498..aca7fa22c4d4 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 @@ -13,7 +13,7 @@ from azure.core.tracing.decorator_async import distributed_trace_async from ._operations import AgentsOperations as GeneratedAgentsOperations, JSON, _Unset from ... import models as _models -from ...operations._patch_agents import _compute_sha256_from_stream +from ...operations._patch_agents import _build_create_version_from_code_content, _compute_sha256_from_stream from ...models._patch import ( _FOUNDRY_FEATURES_HEADER_NAME, _has_header_case_insensitive, @@ -273,16 +273,12 @@ async def create_version_from_code( if code_zip_sha256 is None: code_zip_sha256 = _compute_sha256_from_stream(code) - # Build content from expanded parameters using internal model classes - metadata_obj = _models._models._CreateAgentVersionFromCodeMetadata( # pylint: disable=protected-access + content = _build_create_version_from_code_content( definition=definition, + code=code, description=description, metadata=metadata, ) - content = _models._models._CreateAgentVersionFromCodeContent( # pylint: disable=protected-access - metadata=metadata_obj, - code=code, - ) if getattr(self._config, "allow_preview", False): # Add Foundry-Features header if not already present diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_memories_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_memories_async.py index 856d3433a6a7..97b0a5bbd0c1 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_memories_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_memories_async.py @@ -8,8 +8,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Union, Optional, Any, overload, IO, cast -from openai.types.responses import ResponseInputParam +from collections.abc import Mapping +from typing import Union, Optional, Any, overload, cast +from azure.ai.extensions.openai.types import ResponseInputParam from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.polling import AsyncNoPolling from azure.core.utils import case_insensitive_dict @@ -58,7 +59,7 @@ async def search_memories( keys. For example: {"role": "user", "type": "message", "content": "my user message"}. Only messages with `type` equals `message` are currently processed. Others are ignored. Default value is None. - :paramtype items: Union[str, openai.types.responses.ResponseInputParam] + :paramtype items: Union[str, azure.ai.extensions.openai.types.ResponseInputParam] :keyword previous_search_id: The unique ID of the previous search request, enabling incremental memory search from where the last operation left off. Default value is None. :paramtype previous_search_id: str @@ -90,28 +91,11 @@ async def search_memories( :raises ~azure.core.exceptions.HttpResponseError: """ - @overload - async def search_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: - """Search for relevant memories from a memory store based on conversation context. - - :param name: The name of the memory store to search. 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 - :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async async def search_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: JSON = _Unset, *, scope: str = _Unset, items: Optional[Union[str, ResponseInputParam]] = None, @@ -123,8 +107,8 @@ async def search_memories( :param name: The name of the memory store to search. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: JSON request body. Required. + :type body: JSON :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -133,7 +117,7 @@ async def search_memories( keys. For example: {"role": "user", "type": "message", "content": "my user message"}. Only messages with `type` equals `message` are currently processed. Others are ignored. Default value is None. - :paramtype items: Union[str, openai.types.responses.ResponseInputParam] + :paramtype items: Union[str, azure.ai.extensions.openai.types.ResponseInputParam] :keyword previous_search_id: The unique ID of the previous search request, enabling incremental memory search from where the last operation left off. Default value is None. :paramtype previous_search_id: str @@ -143,6 +127,9 @@ async def search_memories( :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult :raises ~azure.core.exceptions.HttpResponseError: """ + if body is not _Unset and not isinstance(body, Mapping): + raise TypeError("body must be a JSON mapping.") + return await super()._search_memories( name=name, body=body, @@ -177,7 +164,7 @@ async def begin_update_memories( keys. For example: {"role": "user", "type": "message", "content": "my user message"}. Only messages with `type` equals `message` are currently processed. Others are ignored. Default value is None. - :paramtype items: Union[str, openai.types.responses.ResponseInputParam] + :paramtype items: Union[str, azure.ai.extensions.openai.types.ResponseInputParam] :keyword previous_update_id: The unique ID of the previous update request, enabling incremental memory updates from where the last operation left off. Default value is None. :paramtype previous_update_id: str @@ -222,31 +209,6 @@ async def begin_update_memories( :raises ~azure.core.exceptions.HttpResponseError: """ - @overload - async def begin_update_memories( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any, - ) -> AsyncUpdateMemoriesLROPoller: - """Update memory store with conversation memories. - - :param name: The name of the memory store 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: An instance of AsyncUpdateMemoriesLROPoller that returns MemoryStoreUpdateCompletedResult. The - MemoryStoreUpdateCompletedResult is compatible with MutableMapping - :rtype: - ~azure.ai.projects.models.AsyncUpdateMemoriesLROPoller - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async @api_version_validation( method_added_on="v1", @@ -256,7 +218,7 @@ async def begin_update_memories( async def begin_update_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: JSON = _Unset, *, scope: str = _Unset, items: Optional[Union[str, ResponseInputParam]] = None, @@ -268,8 +230,8 @@ async def begin_update_memories( :param name: The name of the memory store 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] + :param body: JSON request body. Required. + :type body: JSON :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -278,7 +240,7 @@ async def begin_update_memories( keys. For example: {"role": "user", "type": "message", "content": "my user message"}. Only messages with `type` equals `message` are currently processed. Others are ignored. Default value is None. - :paramtype items: Union[str, openai.types.responses.ResponseInputParam] + :paramtype items: Union[str, azure.ai.extensions.openai.types.ResponseInputParam] :keyword previous_update_id: The unique ID of the previous update request, enabling incremental memory updates from where the last operation left off. Default value is None. :paramtype previous_update_id: str @@ -297,6 +259,9 @@ async def begin_update_memories( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + if body is not _Unset and not isinstance(body, Mapping): + raise TypeError("body must be a JSON mapping.") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) polling = kwargs.pop("polling", True) @@ -330,9 +295,7 @@ async def begin_update_memories( def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Operation-Location"] = self._deserialize( - "str", response.headers.get("Operation-Location") - ) + response_headers["Operation-Location"] = response.headers.get("Operation-Location") deserialized = _deserialize(MemoryStoreUpdateCompletedResult, response.json().get("result", None)) if deserialized is None: diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_models_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_models_async.py index bed6ccfae89d..7c8a5c1e0ad3 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_models_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_models_async.py @@ -55,15 +55,19 @@ def _extract_pending_upload_targets( :return: A tuple of ``(sas_uri, container_blob_uri, pending_upload_id)``. :rtype: tuple[str, str, str or None] """ - payload = dict(response) if isinstance(response, dict) else response.as_dict() - - blob_ref = payload.get("blobReferenceForConsumption") or payload.get("blobReference") or {} - sas_uri = (blob_ref.get("credential") or {}).get("sasUri") - container_blob_uri = blob_ref.get("blobUri") - pending_upload_id = payload.get("temporaryDataReferenceId") or payload.get("pendingUploadId") + if isinstance(response, dict): + blob_ref = response.get("blobReferenceForConsumption") or response.get("blobReference") or {} + sas_uri = (blob_ref.get("credential") or {}).get("sasUri") + container_blob_uri = blob_ref.get("blobUri") + pending_upload_id = response.get("temporaryDataReferenceId") or response.get("pendingUploadId") + else: + blob_ref = response.blob_reference + sas_uri = blob_ref.credential.sas_uri + container_blob_uri = blob_ref.blob_uri + pending_upload_id = response.pending_upload_id if not sas_uri or not container_blob_uri: - raise ValueError("Could not locate SAS URI / blob URI in pending_upload response: " f"{payload!r}") + raise ValueError("Could not locate SAS URI / blob URI in pending_upload response: " f"{response!r}") return sas_uri, container_blob_uri, pending_upload_id @staticmethod diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py index 2ee8abc3cf86..96a7d14611a7 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py @@ -12,897 +12,22 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import - -from ._models import ( # type: ignore - A2APreviewTool, - A2APreviewToolboxTool, - A2AProtocolConfiguration, - AISearchIndexResource, - ActivityProtocolConfiguration, - AgentBlueprintReference, - AgentCard, - AgentCardSkill, - AgentClusterInsightRequest, - AgentClusterInsightResult, - AgentDataGenerationJobSource, - AgentDefinition, - AgentDetails, - AgentEndpointAuthorizationScheme, - AgentEndpointConfig, - AgentEvaluatorGenerationJobSource, - AgentIdentity, - AgentObjectVersions, - AgentSessionResource, - AgentTaxonomyInput, - AgentVersionDetails, - AgenticIdentityPreviewCredentials, - ApiError, - ApiErrorResponse, - ApiKeyCredentials, - ApplyPatchToolParam, - ApproximateLocation, - ArtifactProfile, - AutoCodeInterpreterToolParam, - AzureAIAgentTarget, - AzureAIModelTarget, - AzureAISearchIndex, - AzureAISearchTool, - AzureAISearchToolResource, - AzureAISearchToolboxTool, - AzureFunctionBinding, - AzureFunctionDefinition, - AzureFunctionDefinitionFunction, - AzureFunctionStorageQueue, - AzureFunctionTool, - AzureOpenAIModelConfiguration, - BaseCredentials, - BingCustomSearchConfiguration, - BingCustomSearchPreviewTool, - BingCustomSearchToolParameters, - BingGroundingSearchConfiguration, - BingGroundingSearchToolParameters, - BingGroundingTool, - BlobReference, - BlobReferenceSasCredential, - BotServiceAuthorizationScheme, - BotServiceRbacAuthorizationScheme, - BotServiceTenantAuthorizationScheme, - BrowserAutomationPreviewTool, - BrowserAutomationPreviewToolboxTool, - BrowserAutomationToolConnectionParameters, - BrowserAutomationToolParameters, - CaptureStructuredOutputsTool, - ChartCoordinate, - ChatSummaryMemoryItem, - ClusterInsightResult, - ClusterTokenUsage, - CodeBasedEvaluatorDefinition, - CodeConfiguration, - CodeInterpreterTool, - CodeInterpreterToolboxTool, - ComparisonFilter, - CompoundFilter, - ComputerTool, - ComputerUsePreviewTool, - Connection, - ContainerAutoParam, - ContainerConfiguration, - ContainerNetworkPolicyAllowlistParam, - ContainerNetworkPolicyDisabledParam, - ContainerNetworkPolicyDomainSecretParam, - ContainerNetworkPolicyParam, - ContainerSkill, - ContinuousEvaluationRuleAction, - CosmosDBIndex, - CreateAsyncResponse, - CreateSkillVersionFromFilesBody, - CronTrigger, - CustomCredential, - CustomGrammarFormatParam, - CustomRoutineTrigger, - CustomTextFormatParam, - CustomToolParam, - CustomToolParamFormat, - DailyRecurrenceSchedule, - DataGenerationJob, - DataGenerationJobInputs, - DataGenerationJobOptions, - DataGenerationJobOutput, - DataGenerationJobOutputOptions, - DataGenerationJobResult, - DataGenerationJobSource, - DataGenerationModelOptions, - DataGenerationTokenUsage, - DatasetCredential, - DatasetDataGenerationJobOutput, - DatasetEvaluatorGenerationJobSource, - DatasetReference, - DatasetVersion, - DeleteAgentResponse, - DeleteAgentVersionResponse, - DeleteMemoryResult, - DeleteMemoryStoreResult, - DeleteSkillResult, - DeleteSkillVersionResult, - Deployment, - Dimension, - DispatchRoutineResult, - EmbeddingConfiguration, - EmptyModelParam, - EndpointBasedEvaluatorDefinition, - EntraAuthorizationScheme, - EntraIDCredentials, - EvalResult, - EvalRunResultCompareItem, - EvalRunResultComparison, - EvalRunResultSummary, - EvaluationComparisonInsightRequest, - EvaluationComparisonInsightResult, - EvaluationResultSample, - EvaluationRule, - EvaluationRuleAction, - EvaluationRuleFilter, - EvaluationRunClusterInsightRequest, - EvaluationRunClusterInsightResult, - EvaluationScheduleTask, - EvaluationTarget, - EvaluationTaxonomy, - EvaluationTaxonomyInput, - EvaluatorCredentialRequest, - EvaluatorDefinition, - EvaluatorGenerationArtifacts, - EvaluatorGenerationInputs, - EvaluatorGenerationJob, - EvaluatorGenerationJobSource, - EvaluatorGenerationTokenUsage, - EvaluatorMetric, - EvaluatorVersion, - ExternalAgentDefinition, - FabricDataAgentToolParameters, - FabricIQPreviewTool, - FabricIQPreviewToolboxTool, - FieldMapping, - FileDataGenerationJobOutput, - FileDataGenerationJobSource, - FileDatasetVersion, - FileSearchTool, - FileSearchToolboxTool, - FixedRatioVersionSelectionRule, - FolderDatasetVersion, - FoundryModelWarning, - FunctionShellToolParam, - FunctionShellToolParamEnvironment, - FunctionShellToolParamEnvironmentContainerReferenceParam, - FunctionShellToolParamEnvironmentLocalEnvironmentParam, - FunctionTool, - FunctionToolParam, - GitHubIssueRoutineTrigger, - HeaderTelemetryEndpointAuth, - HostedAgentDefinition, - HourlyRecurrenceSchedule, - HumanEvaluationPreviewRuleAction, - HybridSearchOptions, - ImageGenTool, - ImageGenToolInputImageMask, - Index, - InlineSkillParam, - InlineSkillSourceParam, - Insight, - InsightCluster, - InsightModelConfiguration, - InsightRequest, - InsightResult, - InsightSample, - InsightScheduleTask, - InsightSummary, - InsightsMetadata, - InvocationsProtocolConfiguration, - InvocationsWsProtocolConfiguration, - InvokeAgentInvocationsApiDispatchPayload, - InvokeAgentInvocationsApiRoutineAction, - InvokeAgentResponsesApiDispatchPayload, - InvokeAgentResponsesApiRoutineAction, - LocalShellToolParam, - LocalSkillParam, - LoraConfig, - MCPTool, - MCPToolFilter, - MCPToolRequireApproval, - MCPToolboxTool, - ManagedAgentIdentityBlueprintReference, - ManagedAzureAISearchIndex, - McpProtocolConfiguration, - MemoryItem, - MemoryOperation, - MemorySearchItem, - MemorySearchOptions, - MemorySearchPreviewTool, - MemoryStoreDefaultDefinition, - MemoryStoreDefaultOptions, - MemoryStoreDefinition, - MemoryStoreDeleteScopeResult, - MemoryStoreDetails, - MemoryStoreOperationUsage, - MemoryStoreSearchResult, - MemoryStoreUpdateCompletedResult, - MemoryStoreUpdateResult, - MicrosoftFabricPreviewTool, - ModelCredentialRequest, - ModelDeployment, - ModelDeploymentSku, - ModelPendingUploadRequest, - ModelPendingUploadResponse, - ModelSamplingParams, - ModelSourceData, - ModelVersion, - MonthlyRecurrenceSchedule, - NamespaceToolParam, - NoAuthenticationCredentials, - OneTimeTrigger, - OpenApiAnonymousAuthDetails, - OpenApiAuthDetails, - OpenApiFunctionDefinition, - OpenApiFunctionDefinitionFunction, - OpenApiManagedAuthDetails, - OpenApiManagedSecurityScheme, - OpenApiProjectConnectionAuthDetails, - OpenApiProjectConnectionSecurityScheme, - OpenApiTool, - OpenApiToolboxTool, - OptimizationAgentIdentifier, - OptimizationCandidate, - OptimizationDatasetCriterion, - OptimizationDatasetInput, - OptimizationDatasetItem, - OptimizationEvaluatorRef, - OptimizationInlineDatasetInput, - OptimizationJob, - OptimizationJobInputs, - OptimizationJobListItem, - OptimizationJobProgress, - OptimizationJobResult, - OptimizationOptions, - OptimizationReferenceDatasetInput, - OtlpTelemetryEndpoint, - PendingUploadRequest, - PendingUploadResponse, - ProceduralMemoryItem, - PromotionInfo, - PromptAgentDefinition, - PromptAgentDefinitionTextOptions, - PromptBasedEvaluatorDefinition, - PromptDataGenerationJobSource, - PromptEvaluatorGenerationJobSource, - ProtocolConfiguration, - ProtocolVersionRecord, - RaiConfig, - RankingOptions, - Reasoning, - RecurrenceSchedule, - RecurrenceTrigger, - RedTeam, - RedTeamTargetConfig, - ReminderPreviewToolboxTool, - ResponseUsageInputTokensDetails, - ResponseUsageOutputTokensDetails, - ResponsesProtocolConfiguration, - Routine, - RoutineAction, - RoutineDispatchPayload, - RoutineRun, - RoutineTrigger, - RubricBasedEvaluatorDefinition, - SASCredentials, - Schedule, - ScheduleRoutineTrigger, - ScheduleRun, - ScheduleTask, - SessionDirectoryEntry, - SessionFileWriteResult, - SessionLogEvent, - SharepointGroundingToolParameters, - SharepointPreviewTool, - SimpleQnADataGenerationJobOptions, - SkillDetails, - SkillInlineContent, - SkillReferenceParam, - SkillVersion, - SpecificApplyPatchParam, - SpecificFunctionShellParam, - StructuredInputDefinition, - StructuredOutputDefinition, - TaxonomyCategory, - TaxonomySubCategory, - TelemetryConfig, - TelemetryEndpoint, - TelemetryEndpointAuth, - TextResponseFormat, - TextResponseFormatJsonObject, - TextResponseFormatJsonSchema, - TextResponseFormatText, - TimerRoutineTrigger, - Tool, - ToolChoiceAllowed, - ToolChoiceCodeInterpreter, - ToolChoiceComputer, - ToolChoiceComputerUse, - ToolChoiceComputerUsePreview, - ToolChoiceCustom, - ToolChoiceFileSearch, - ToolChoiceFunction, - ToolChoiceImageGeneration, - ToolChoiceMCP, - ToolChoiceParam, - ToolChoiceWebSearchPreview, - ToolChoiceWebSearchPreview20250311, - ToolConfig, - ToolDescription, - ToolProjectConnection, - ToolSearchToolParam, - ToolUseFineTuningDataGenerationJobOptions, - ToolboxObject, - ToolboxPolicies, - ToolboxSearchPreviewToolboxTool, - ToolboxSkill, - ToolboxSkillReference, - ToolboxTool, - ToolboxVersionObject, - TracesDataGenerationJobOptions, - TracesDataGenerationJobSource, - TracesEvaluatorGenerationJobSource, - Trigger, - UpdateModelVersionRequest, - UpdateToolboxRequest, - UserProfileMemoryItem, - VersionIndicator, - VersionRefIndicator, - VersionSelectionRule, - VersionSelector, - WebSearchApproximateLocation, - WebSearchConfiguration, - WebSearchPreviewTool, - WebSearchTool, - WebSearchToolFilters, - WebSearchToolboxTool, - WeeklyRecurrenceSchedule, - WorkIQPreviewTool, - WorkIQPreviewToolboxTool, - WorkflowAgentDefinition, -) - -from ._enums import ( # type: ignore - AgentBlueprintReferenceType, - AgentEndpointAuthorizationSchemeType, - AgentEndpointProtocol, - AgentKind, - AgentObjectType, - AgentSessionStatus, - AgentState, - AgentVersionStatus, - AttackStrategy, - AzureAISearchQueryType, - CodeDependencyResolution, - ComputerEnvironment, - ConnectionType, - ContainerMemoryLimit, - ContainerNetworkPolicyParamType, - ContainerSkillType, - CredentialType, - CustomToolParamFormatType, - DataGenerationJobOutputType, - DataGenerationJobScenario, - DataGenerationJobSourceType, - DataGenerationJobType, - DatasetType, - DayOfWeek, - DeploymentType, - EvaluationLevel, - EvaluationRuleActionType, - EvaluationRuleEventType, - EvaluationTaxonomyInputType, - EvaluatorCategory, - EvaluatorDefinitionType, - EvaluatorGenerationJobSourceType, - EvaluatorMetricDirection, - EvaluatorMetricType, - EvaluatorType, - FoundryModelArtifactProfileCategory, - FoundryModelArtifactProfileSignal, - FoundryModelSourceType, - FoundryModelWarningCode, - FoundryModelWeightType, - FunctionShellToolParamEnvironmentType, - GitHubIssueEvent, - GrammarSyntax1, - ImageGenAction, - IndexType, - InputFidelity, - InsightType, - JobStatus, - MemoryItemKind, - MemoryOperationKind, - MemoryStoreKind, - MemoryStoreObjectType, - MemoryStoreUpdateStatus, - OpenApiAuthType, - OperationState, - OptimizationDatasetInputType, - PageOrder, - PendingUploadType, - RankerVersionType, - RecurrenceType, - RiskCategory, - RoutineActionType, - RoutineAttemptSource, - RoutineDispatchPayloadType, - RoutineRunPhase, - RoutineTriggerType, - SampleType, - ScheduleProvisioningStatus, - ScheduleTaskType, - SearchContentType, - SearchContextSize, - SessionLogEventType, - SimpleQnAFineTuningQuestionType, - TelemetryDataKind, - TelemetryEndpointAuthType, - TelemetryEndpointKind, - TelemetryTransportProtocol, - TextResponseFormatConfigurationType, - ToolChoiceParamType, - ToolSearchExecutionType, - ToolType, - ToolboxToolType, - TreatmentEffectType, - TriggerType, - VersionIndicatorType, - VersionSelectorType, -) +from . import _enums as _enums_module +from . import _models as _models_module +from ._models import * # type: ignore # noqa: F401,F403 +from ._enums import * # type: ignore # noqa: F401,F403 from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "A2APreviewTool", - "A2APreviewToolboxTool", - "A2AProtocolConfiguration", - "AISearchIndexResource", - "ActivityProtocolConfiguration", - "AgentBlueprintReference", - "AgentCard", - "AgentCardSkill", - "AgentClusterInsightRequest", - "AgentClusterInsightResult", - "AgentDataGenerationJobSource", - "AgentDefinition", - "AgentDetails", - "AgentEndpointAuthorizationScheme", - "AgentEndpointConfig", - "AgentEvaluatorGenerationJobSource", - "AgentIdentity", - "AgentObjectVersions", - "AgentSessionResource", - "AgentTaxonomyInput", - "AgentVersionDetails", - "AgenticIdentityPreviewCredentials", - "ApiError", - "ApiErrorResponse", - "ApiKeyCredentials", - "ApplyPatchToolParam", - "ApproximateLocation", - "ArtifactProfile", - "AutoCodeInterpreterToolParam", - "AzureAIAgentTarget", - "AzureAIModelTarget", - "AzureAISearchIndex", - "AzureAISearchTool", - "AzureAISearchToolResource", - "AzureAISearchToolboxTool", - "AzureFunctionBinding", - "AzureFunctionDefinition", - "AzureFunctionDefinitionFunction", - "AzureFunctionStorageQueue", - "AzureFunctionTool", - "AzureOpenAIModelConfiguration", - "BaseCredentials", - "BingCustomSearchConfiguration", - "BingCustomSearchPreviewTool", - "BingCustomSearchToolParameters", - "BingGroundingSearchConfiguration", - "BingGroundingSearchToolParameters", - "BingGroundingTool", - "BlobReference", - "BlobReferenceSasCredential", - "BotServiceAuthorizationScheme", - "BotServiceRbacAuthorizationScheme", - "BotServiceTenantAuthorizationScheme", - "BrowserAutomationPreviewTool", - "BrowserAutomationPreviewToolboxTool", - "BrowserAutomationToolConnectionParameters", - "BrowserAutomationToolParameters", - "CaptureStructuredOutputsTool", - "ChartCoordinate", - "ChatSummaryMemoryItem", - "ClusterInsightResult", - "ClusterTokenUsage", - "CodeBasedEvaluatorDefinition", - "CodeConfiguration", - "CodeInterpreterTool", - "CodeInterpreterToolboxTool", - "ComparisonFilter", - "CompoundFilter", - "ComputerTool", - "ComputerUsePreviewTool", - "Connection", - "ContainerAutoParam", - "ContainerConfiguration", - "ContainerNetworkPolicyAllowlistParam", - "ContainerNetworkPolicyDisabledParam", - "ContainerNetworkPolicyDomainSecretParam", - "ContainerNetworkPolicyParam", - "ContainerSkill", - "ContinuousEvaluationRuleAction", - "CosmosDBIndex", - "CreateAsyncResponse", - "CreateSkillVersionFromFilesBody", - "CronTrigger", - "CustomCredential", - "CustomGrammarFormatParam", - "CustomRoutineTrigger", - "CustomTextFormatParam", - "CustomToolParam", - "CustomToolParamFormat", - "DailyRecurrenceSchedule", - "DataGenerationJob", - "DataGenerationJobInputs", - "DataGenerationJobOptions", - "DataGenerationJobOutput", - "DataGenerationJobOutputOptions", - "DataGenerationJobResult", - "DataGenerationJobSource", - "DataGenerationModelOptions", - "DataGenerationTokenUsage", - "DatasetCredential", - "DatasetDataGenerationJobOutput", - "DatasetEvaluatorGenerationJobSource", - "DatasetReference", - "DatasetVersion", - "DeleteAgentResponse", - "DeleteAgentVersionResponse", - "DeleteMemoryResult", - "DeleteMemoryStoreResult", - "DeleteSkillResult", - "DeleteSkillVersionResult", - "Deployment", - "Dimension", - "DispatchRoutineResult", - "EmbeddingConfiguration", - "EmptyModelParam", - "EndpointBasedEvaluatorDefinition", - "EntraAuthorizationScheme", - "EntraIDCredentials", - "EvalResult", - "EvalRunResultCompareItem", - "EvalRunResultComparison", - "EvalRunResultSummary", - "EvaluationComparisonInsightRequest", - "EvaluationComparisonInsightResult", - "EvaluationResultSample", - "EvaluationRule", - "EvaluationRuleAction", - "EvaluationRuleFilter", - "EvaluationRunClusterInsightRequest", - "EvaluationRunClusterInsightResult", - "EvaluationScheduleTask", - "EvaluationTarget", - "EvaluationTaxonomy", - "EvaluationTaxonomyInput", - "EvaluatorCredentialRequest", - "EvaluatorDefinition", - "EvaluatorGenerationArtifacts", - "EvaluatorGenerationInputs", - "EvaluatorGenerationJob", - "EvaluatorGenerationJobSource", - "EvaluatorGenerationTokenUsage", - "EvaluatorMetric", - "EvaluatorVersion", - "ExternalAgentDefinition", - "FabricDataAgentToolParameters", - "FabricIQPreviewTool", - "FabricIQPreviewToolboxTool", - "FieldMapping", - "FileDataGenerationJobOutput", - "FileDataGenerationJobSource", - "FileDatasetVersion", - "FileSearchTool", - "FileSearchToolboxTool", - "FixedRatioVersionSelectionRule", - "FolderDatasetVersion", - "FoundryModelWarning", - "FunctionShellToolParam", - "FunctionShellToolParamEnvironment", - "FunctionShellToolParamEnvironmentContainerReferenceParam", - "FunctionShellToolParamEnvironmentLocalEnvironmentParam", - "FunctionTool", - "FunctionToolParam", - "GitHubIssueRoutineTrigger", - "HeaderTelemetryEndpointAuth", - "HostedAgentDefinition", - "HourlyRecurrenceSchedule", - "HumanEvaluationPreviewRuleAction", - "HybridSearchOptions", - "ImageGenTool", - "ImageGenToolInputImageMask", - "Index", - "InlineSkillParam", - "InlineSkillSourceParam", - "Insight", - "InsightCluster", - "InsightModelConfiguration", - "InsightRequest", - "InsightResult", - "InsightSample", - "InsightScheduleTask", - "InsightSummary", - "InsightsMetadata", - "InvocationsProtocolConfiguration", - "InvocationsWsProtocolConfiguration", - "InvokeAgentInvocationsApiDispatchPayload", - "InvokeAgentInvocationsApiRoutineAction", - "InvokeAgentResponsesApiDispatchPayload", - "InvokeAgentResponsesApiRoutineAction", - "LocalShellToolParam", - "LocalSkillParam", - "LoraConfig", - "MCPTool", - "MCPToolFilter", - "MCPToolRequireApproval", - "MCPToolboxTool", - "ManagedAgentIdentityBlueprintReference", - "ManagedAzureAISearchIndex", - "McpProtocolConfiguration", - "MemoryItem", - "MemoryOperation", - "MemorySearchItem", - "MemorySearchOptions", - "MemorySearchPreviewTool", - "MemoryStoreDefaultDefinition", - "MemoryStoreDefaultOptions", - "MemoryStoreDefinition", - "MemoryStoreDeleteScopeResult", - "MemoryStoreDetails", - "MemoryStoreOperationUsage", - "MemoryStoreSearchResult", - "MemoryStoreUpdateCompletedResult", - "MemoryStoreUpdateResult", - "MicrosoftFabricPreviewTool", - "ModelCredentialRequest", - "ModelDeployment", - "ModelDeploymentSku", - "ModelPendingUploadRequest", - "ModelPendingUploadResponse", - "ModelSamplingParams", - "ModelSourceData", - "ModelVersion", - "MonthlyRecurrenceSchedule", - "NamespaceToolParam", - "NoAuthenticationCredentials", - "OneTimeTrigger", - "OpenApiAnonymousAuthDetails", - "OpenApiAuthDetails", - "OpenApiFunctionDefinition", - "OpenApiFunctionDefinitionFunction", - "OpenApiManagedAuthDetails", - "OpenApiManagedSecurityScheme", - "OpenApiProjectConnectionAuthDetails", - "OpenApiProjectConnectionSecurityScheme", - "OpenApiTool", - "OpenApiToolboxTool", - "OptimizationAgentIdentifier", - "OptimizationCandidate", - "OptimizationDatasetCriterion", - "OptimizationDatasetInput", - "OptimizationDatasetItem", - "OptimizationEvaluatorRef", - "OptimizationInlineDatasetInput", - "OptimizationJob", - "OptimizationJobInputs", - "OptimizationJobListItem", - "OptimizationJobProgress", - "OptimizationJobResult", - "OptimizationOptions", - "OptimizationReferenceDatasetInput", - "OtlpTelemetryEndpoint", - "PendingUploadRequest", - "PendingUploadResponse", - "ProceduralMemoryItem", - "PromotionInfo", - "PromptAgentDefinition", - "PromptAgentDefinitionTextOptions", - "PromptBasedEvaluatorDefinition", - "PromptDataGenerationJobSource", - "PromptEvaluatorGenerationJobSource", - "ProtocolConfiguration", - "ProtocolVersionRecord", - "RaiConfig", - "RankingOptions", - "Reasoning", - "RecurrenceSchedule", - "RecurrenceTrigger", - "RedTeam", - "RedTeamTargetConfig", - "ReminderPreviewToolboxTool", - "ResponseUsageInputTokensDetails", - "ResponseUsageOutputTokensDetails", - "ResponsesProtocolConfiguration", - "Routine", - "RoutineAction", - "RoutineDispatchPayload", - "RoutineRun", - "RoutineTrigger", - "RubricBasedEvaluatorDefinition", - "SASCredentials", - "Schedule", - "ScheduleRoutineTrigger", - "ScheduleRun", - "ScheduleTask", - "SessionDirectoryEntry", - "SessionFileWriteResult", - "SessionLogEvent", - "SharepointGroundingToolParameters", - "SharepointPreviewTool", - "SimpleQnADataGenerationJobOptions", - "SkillDetails", - "SkillInlineContent", - "SkillReferenceParam", - "SkillVersion", - "SpecificApplyPatchParam", - "SpecificFunctionShellParam", - "StructuredInputDefinition", - "StructuredOutputDefinition", - "TaxonomyCategory", - "TaxonomySubCategory", - "TelemetryConfig", - "TelemetryEndpoint", - "TelemetryEndpointAuth", - "TextResponseFormat", - "TextResponseFormatJsonObject", - "TextResponseFormatJsonSchema", - "TextResponseFormatText", - "TimerRoutineTrigger", - "Tool", - "ToolChoiceAllowed", - "ToolChoiceCodeInterpreter", - "ToolChoiceComputer", - "ToolChoiceComputerUse", - "ToolChoiceComputerUsePreview", - "ToolChoiceCustom", - "ToolChoiceFileSearch", - "ToolChoiceFunction", - "ToolChoiceImageGeneration", - "ToolChoiceMCP", - "ToolChoiceParam", - "ToolChoiceWebSearchPreview", - "ToolChoiceWebSearchPreview20250311", - "ToolConfig", - "ToolDescription", - "ToolProjectConnection", - "ToolSearchToolParam", - "ToolUseFineTuningDataGenerationJobOptions", - "ToolboxObject", - "ToolboxPolicies", - "ToolboxSearchPreviewToolboxTool", - "ToolboxSkill", - "ToolboxSkillReference", - "ToolboxTool", - "ToolboxVersionObject", - "TracesDataGenerationJobOptions", - "TracesDataGenerationJobSource", - "TracesEvaluatorGenerationJobSource", - "Trigger", - "UpdateModelVersionRequest", - "UpdateToolboxRequest", - "UserProfileMemoryItem", - "VersionIndicator", - "VersionRefIndicator", - "VersionSelectionRule", - "VersionSelector", - "WebSearchApproximateLocation", - "WebSearchConfiguration", - "WebSearchPreviewTool", - "WebSearchTool", - "WebSearchToolFilters", - "WebSearchToolboxTool", - "WeeklyRecurrenceSchedule", - "WorkIQPreviewTool", - "WorkIQPreviewToolboxTool", - "WorkflowAgentDefinition", - "AgentBlueprintReferenceType", - "AgentEndpointAuthorizationSchemeType", - "AgentEndpointProtocol", - "AgentKind", - "AgentObjectType", - "AgentSessionStatus", - "AgentState", - "AgentVersionStatus", - "AttackStrategy", - "AzureAISearchQueryType", - "CodeDependencyResolution", - "ComputerEnvironment", - "ConnectionType", - "ContainerMemoryLimit", - "ContainerNetworkPolicyParamType", - "ContainerSkillType", - "CredentialType", - "CustomToolParamFormatType", - "DataGenerationJobOutputType", - "DataGenerationJobScenario", - "DataGenerationJobSourceType", - "DataGenerationJobType", - "DatasetType", - "DayOfWeek", - "DeploymentType", - "EvaluationLevel", - "EvaluationRuleActionType", - "EvaluationRuleEventType", - "EvaluationTaxonomyInputType", - "EvaluatorCategory", - "EvaluatorDefinitionType", - "EvaluatorGenerationJobSourceType", - "EvaluatorMetricDirection", - "EvaluatorMetricType", - "EvaluatorType", - "FoundryModelArtifactProfileCategory", - "FoundryModelArtifactProfileSignal", - "FoundryModelSourceType", - "FoundryModelWarningCode", - "FoundryModelWeightType", - "FunctionShellToolParamEnvironmentType", - "GitHubIssueEvent", - "GrammarSyntax1", - "ImageGenAction", - "IndexType", - "InputFidelity", - "InsightType", - "JobStatus", - "MemoryItemKind", - "MemoryOperationKind", - "MemoryStoreKind", - "MemoryStoreObjectType", - "MemoryStoreUpdateStatus", - "OpenApiAuthType", - "OperationState", - "OptimizationDatasetInputType", - "PageOrder", - "PendingUploadType", - "RankerVersionType", - "RecurrenceType", - "RiskCategory", - "RoutineActionType", - "RoutineAttemptSource", - "RoutineDispatchPayloadType", - "RoutineRunPhase", - "RoutineTriggerType", - "SampleType", - "ScheduleProvisioningStatus", - "ScheduleTaskType", - "SearchContentType", - "SearchContextSize", - "SessionLogEventType", - "SimpleQnAFineTuningQuestionType", - "TelemetryDataKind", - "TelemetryEndpointAuthType", - "TelemetryEndpointKind", - "TelemetryTransportProtocol", - "TextResponseFormatConfigurationType", - "ToolChoiceParamType", - "ToolSearchExecutionType", - "ToolType", - "ToolboxToolType", - "TreatmentEffectType", - "TriggerType", - "VersionIndicatorType", - "VersionSelectorType", -] + name + for module in (_models_module, _enums_module) + for name, value in vars(module).items() + if not name.startswith("_") and isinstance(value, type) and getattr(value, "__module__", None) == module.__name__ +] # pyright: ignore __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +for _name in list(globals()): + if not _name.startswith("_") and _name not in __all__: + del globals()[_name] _patch_sdk() 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 257e53dded78..0b92a5962e74 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 @@ -33,7 +33,7 @@ TracesPreviewEvalRunDataSource, ) from ._models import CustomCredential as CustomCredentialGenerated -from ..models import MemoryStoreUpdateCompletedResult, MemoryStoreUpdateResult +from ._models import MemoryStoreUpdateCompletedResult, MemoryStoreUpdateResult from ._enums import _FoundryFeaturesOptInKeys, _AgentDefinitionOptInKeys _FOUNDRY_FEATURES_HEADER_NAME: Final[str] = "Foundry-Features" diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch_evaluation_typeddicts.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch_evaluation_typeddicts.py index 67034529add3..a5bd28fa4d0a 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch_evaluation_typeddicts.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch_evaluation_typeddicts.py @@ -7,7 +7,7 @@ import datetime from typing import Dict, Any, List, Union from typing_extensions import Literal, Required, TypedDict -from openai.types.evals.create_eval_completions_run_data_source_param import ( +from azure.ai.extensions.openai.evals import ( InputMessagesItemReference, SourceFileContent, SourceFileID, 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 aca7d018ae15..5d410049aa0b 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 @@ -8,9 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping import datetime -from io import IOBase -import json -from typing import Any, Callable, IO, Iterator, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse import uuid @@ -33,11 +31,10 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict -from .. import models as _models +from .. import types, types as _types from .._configuration import AIProjectClientConfiguration -from .._utils.model_base import Model as _Model, SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer -from .._utils.utils import prepare_multipart_form_data +from .._utils.utils import FileType, prepare_multipart_form_data JSON = MutableMapping[str, Any] _Unset: Any = object() @@ -101,9 +98,9 @@ def build_agents_delete_request(agent_name: str, *, force: Optional[bool] = None def build_agents_list_request( *, - kind: Optional[Union[str, _models.AgentKind]] = None, + kind: Optional[types.AgentKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -250,7 +247,7 @@ def build_agents_list_versions_request( agent_name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, include_drafts: Optional[bool] = None, @@ -317,7 +314,7 @@ def build_agents_update_details_request(agent_name: str, **kwargs: Any) -> HttpR def build_agents_create_version_from_code_request( # pylint: disable=name-too-long - agent_name: str, *, code_zip_sha256: str, **kwargs: Any + agent_name: str, *, code_zip_sha256: str, files: list[FileType], **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -340,7 +337,7 @@ def build_agents_create_version_from_code_request( # pylint: disable=name-too-l _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) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, files=files, **kwargs) def build_agents_download_code_request( @@ -501,7 +498,7 @@ def build_agents_list_sessions_request( agent_name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -566,7 +563,7 @@ def build_agents_get_session_log_stream_request( # pylint: disable=name-too-lon def build_agents_upload_session_file_request( - agent_name: str, session_id: str, *, path: str, **kwargs: Any + agent_name: str, session_id: str, *, path: str, json: bytes, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -592,7 +589,7 @@ def build_agents_upload_session_file_request( _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="PUT", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_agents_download_session_file_request( # pylint: disable=name-too-long @@ -629,7 +626,7 @@ def build_agents_list_session_files_request( *, path: Optional[str] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -735,12 +732,12 @@ def build_evaluation_rules_delete_request(id: str, **kwargs: Any) -> HttpRequest def build_evaluation_rules_create_or_update_request( # pylint: disable=name-too-long - id: str, **kwargs: Any + id: str, *, json: _types.EvaluationRule, **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)) + 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") @@ -756,16 +753,15 @@ def build_evaluation_rules_create_or_update_request( # pylint: disable=name-too _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["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="PUT", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_evaluation_rules_list_request( *, - action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, + action_type: Optional[types.EvaluationRuleActionType] = None, agent_name: Optional[str] = None, enabled: Optional[bool] = None, **kwargs: Any @@ -845,10 +841,7 @@ def build_connections_get_with_credentials_request( # pylint: disable=name-too- def build_connections_list_request( - *, - connection_type: Optional[Union[str, _models.ConnectionType]] = None, - default_connection: Optional[bool] = None, - **kwargs: Any + *, connection_type: Optional[types.ConnectionType] = None, default_connection: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -959,11 +952,13 @@ def build_datasets_delete_request(name: str, version: str, **kwargs: Any) -> Htt return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_datasets_create_or_update_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_datasets_create_or_update_request( + name: str, version: str, *, json: _types.DatasetVersion, **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)) + 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") @@ -980,18 +975,19 @@ def build_datasets_create_or_update_request(name: str, version: str, **kwargs: A _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["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="PATCH", url=_url, params=_params, headers=_headers, json=json, **kwargs) -def build_datasets_pending_upload_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_datasets_pending_upload_request( + name: str, version: str, *, json: _types.PendingUploadRequest, **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)) + 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") @@ -1008,11 +1004,10 @@ def build_datasets_pending_upload_request(name: str, version: str, **kwargs: Any _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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_datasets_get_credentials_request(name: str, version: str, **kwargs: Any) -> HttpRequest: @@ -1068,7 +1063,7 @@ def build_deployments_list_request( *, model_publisher: Optional[str] = None, model_name: Optional[str] = None, - deployment_type: Optional[Union[str, _models.DeploymentType]] = None, + deployment_type: Optional[types.DeploymentType] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1182,11 +1177,13 @@ 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_indexes_create_or_update_request( + name: str, version: str, *, json: _types.Index, **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)) + 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") @@ -1203,11 +1200,10 @@ def build_indexes_create_or_update_request(name: str, version: str, **kwargs: An _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["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="PATCH", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_toolboxes_create_version_request(name: str, **kwargs: Any) -> HttpRequest: @@ -1264,7 +1260,7 @@ def build_toolboxes_get_request(name: str, **kwargs: Any) -> HttpRequest: def build_toolboxes_list_request( *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -1299,7 +1295,7 @@ def build_toolboxes_list_versions_request( name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -1496,12 +1492,12 @@ def build_beta_evaluation_taxonomies_delete_request( # pylint: disable=name-too def build_beta_evaluation_taxonomies_create_request( # pylint: disable=name-too-long - name: str, **kwargs: Any + name: str, *, json: _types.EvaluationTaxonomy, **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)) + 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") @@ -1517,20 +1513,19 @@ def build_beta_evaluation_taxonomies_create_request( # pylint: disable=name-too _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["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="PUT", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_evaluation_taxonomies_update_request( # pylint: disable=name-too-long - name: str, **kwargs: Any + name: str, *, json: _types.EvaluationTaxonomy, **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)) + 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") @@ -1546,11 +1541,10 @@ def build_beta_evaluation_taxonomies_update_request( # pylint: disable=name-too _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["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="PATCH", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_evaluators_list_versions_request( # pylint: disable=name-too-long @@ -1664,12 +1658,12 @@ def build_beta_evaluators_delete_version_request( # pylint: disable=name-too-lo def build_beta_evaluators_create_version_request( # pylint: disable=name-too-long - name: str, **kwargs: Any + name: str, *, json: _types.EvaluatorVersion, **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)) + 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") @@ -1685,20 +1679,19 @@ def build_beta_evaluators_create_version_request( # pylint: disable=name-too-lo _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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_evaluators_update_version_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any + name: str, version: str, *, json: _types.EvaluatorVersion, **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)) + 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") @@ -1715,20 +1708,19 @@ def build_beta_evaluators_update_version_request( # pylint: disable=name-too-lo _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["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="PATCH", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_evaluators_pending_upload_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any + name: str, version: str, *, json: _types.PendingUploadRequest, **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)) + 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") @@ -1745,20 +1737,19 @@ def build_beta_evaluators_pending_upload_request( # pylint: disable=name-too-lo _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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_evaluators_get_credentials_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any + name: str, version: str, *, json: _types.EvaluatorCredentialRequest, **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)) + 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") @@ -1775,20 +1766,19 @@ def build_beta_evaluators_get_credentials_request( # pylint: disable=name-too-l _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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_evaluators_create_generation_job_request( # pylint: disable=name-too-long - *, operation_id: Optional[str] = None, **kwargs: Any + *, json: _types.EvaluatorGenerationJob, 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)) + 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") @@ -1801,11 +1791,10 @@ def build_beta_evaluators_create_generation_job_request( # pylint: disable=name # 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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_evaluators_get_generation_job_request( # pylint: disable=name-too-long @@ -1837,7 +1826,7 @@ def build_beta_evaluators_get_generation_job_request( # pylint: disable=name-to def build_beta_evaluators_list_generation_jobs_request( # pylint: disable=name-too-long *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -1914,11 +1903,11 @@ def build_beta_evaluators_delete_generation_job_request( # pylint: disable=name return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_insights_generate_request(**kwargs: Any) -> HttpRequest: +def build_beta_insights_generate_request(*, json: _types.Insight, **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)) + 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") @@ -1935,11 +1924,10 @@ def build_beta_insights_generate_request(**kwargs: Any) -> HttpRequest: _headers["Repeatability-First-Sent"] = _SERIALIZER.serialize_data( datetime.datetime.now(datetime.timezone.utc), "rfc-1123" ) - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_insights_get_request( @@ -1972,7 +1960,7 @@ def build_beta_insights_get_request( def build_beta_insights_list_request( *, - type: Optional[Union[str, _models.InsightType]] = None, + type: Optional[types.InsightType] = None, eval_id: Optional[str] = None, run_id: Optional[str] = None, agent_name: Optional[str] = None, @@ -2083,7 +2071,7 @@ def build_beta_memory_stores_get_request(name: str, **kwargs: Any) -> HttpReques def build_beta_memory_stores_list_request( *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -2314,9 +2302,9 @@ def build_beta_memory_stores_get_memory_request( # pylint: disable=name-too-lon def build_beta_memory_stores_list_memories_request( # pylint: disable=name-too-long name: str, *, - kind: Optional[Union[str, _models.MemoryItemKind]] = None, + kind: Optional[types.MemoryItemKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -2471,11 +2459,13 @@ def build_beta_models_delete_request(name: str, version: str, **kwargs: Any) -> return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_beta_models_update_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_beta_models_update_request( + name: str, version: str, *, json: _types.UpdateModelVersionRequest, **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)) + 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") @@ -2492,20 +2482,19 @@ def build_beta_models_update_request(name: str, version: str, **kwargs: Any) -> _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["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="PATCH", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_models_pending_create_version_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any + name: str, version: str, *, json: _types.ModelVersion, **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)) + 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") @@ -2522,18 +2511,19 @@ def build_beta_models_pending_create_version_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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) -def build_beta_models_pending_upload_request(name: str, version: str, **kwargs: Any) -> HttpRequest: +def build_beta_models_pending_upload_request( + name: str, version: str, *, json: _types.ModelPendingUploadRequest, **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)) + 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") @@ -2550,20 +2540,19 @@ def build_beta_models_pending_upload_request(name: str, version: str, **kwargs: _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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_models_get_credentials_request( # pylint: disable=name-too-long - name: str, version: str, **kwargs: Any + name: str, version: str, *, json: _types.ModelCredentialRequest, **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)) + 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") @@ -2580,11 +2569,10 @@ def build_beta_models_get_credentials_request( # pylint: disable=name-too-long _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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_red_teams_get_request(name: str, **kwargs: Any) -> HttpRequest: @@ -2630,11 +2618,11 @@ def build_beta_red_teams_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_beta_red_teams_create_request(**kwargs: Any) -> HttpRequest: +def build_beta_red_teams_create_request(*, json: _types.RedTeam, **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)) + 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") @@ -2645,11 +2633,10 @@ def build_beta_red_teams_create_request(**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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_routines_create_or_update_request( # pylint: disable=name-too-long @@ -2918,7 +2905,7 @@ def build_beta_schedules_get_request(schedule_id: str, **kwargs: Any) -> HttpReq def build_beta_schedules_list_request( - *, type: Optional[Union[str, _models.ScheduleTaskType]] = None, enabled: Optional[bool] = None, **kwargs: Any + *, type: Optional[types.ScheduleTaskType] = None, enabled: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2943,12 +2930,12 @@ def build_beta_schedules_list_request( def build_beta_schedules_create_or_update_request( # pylint: disable=name-too-long - schedule_id: str, **kwargs: Any + schedule_id: str, *, json: _types.Schedule, **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)) + 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") @@ -2964,11 +2951,10 @@ def build_beta_schedules_create_or_update_request( # pylint: disable=name-too-l _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["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="PUT", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_schedules_get_run_request(schedule_id: str, run_id: str, **kwargs: Any) -> HttpRequest: @@ -2997,11 +2983,7 @@ def build_beta_schedules_get_run_request(schedule_id: str, run_id: str, **kwargs def build_beta_schedules_list_runs_request( - schedule_id: str, - *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, - enabled: Optional[bool] = None, - **kwargs: Any + schedule_id: str, *, type: Optional[types.ScheduleTaskType] = None, enabled: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3057,7 +3039,7 @@ def build_beta_skills_get_request(name: str, **kwargs: Any) -> HttpRequest: def build_beta_skills_list_request( *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -3167,7 +3149,7 @@ def build_beta_skills_create_request(name: str, **kwargs: Any) -> HttpRequest: def build_beta_skills_create_from_files_request( # pylint: disable=name-too-long - name: str, **kwargs: Any + name: str, *, files: list[FileType], **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3189,14 +3171,14 @@ def build_beta_skills_create_from_files_request( # pylint: disable=name-too-lon # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, files=files, **kwargs) def build_beta_skills_list_versions_request( name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -3362,7 +3344,7 @@ def build_beta_datasets_get_generation_job_request( # pylint: disable=name-too- def build_beta_datasets_list_generation_jobs_request( # pylint: disable=name-too-long *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, **kwargs: Any @@ -3394,12 +3376,12 @@ def build_beta_datasets_list_generation_jobs_request( # pylint: disable=name-to def build_beta_datasets_create_generation_job_request( # pylint: disable=name-too-long - *, operation_id: Optional[str] = None, **kwargs: Any + *, json: _types.DataGenerationJob, 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)) + 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") @@ -3412,11 +3394,10 @@ def build_beta_datasets_create_generation_job_request( # pylint: disable=name-t # 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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_datasets_cancel_generation_job_request( # pylint: disable=name-too-long @@ -3466,12 +3447,12 @@ def build_beta_datasets_delete_generation_job_request( # pylint: disable=name-t def build_beta_agents_create_optimization_job_request( # pylint: disable=name-too-long - *, operation_id: Optional[str] = None, **kwargs: Any + *, json: _types.OptimizationJob, 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)) + 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") @@ -3484,11 +3465,10 @@ def build_beta_agents_create_optimization_job_request( # pylint: disable=name-t # 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["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="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) def build_beta_agents_get_optimization_job_request( # pylint: disable=name-too-long @@ -3520,10 +3500,10 @@ def build_beta_agents_get_optimization_job_request( # pylint: disable=name-too- def build_beta_agents_list_optimization_jobs_request( # pylint: disable=name-too-long *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, after: Optional[str] = None, before: Optional[str] = None, - status: Optional[Union[str, _models.JobStatus]] = None, + status: Optional[types.JobStatus] = None, agent_name: Optional[str] = None, **kwargs: Any ) -> HttpRequest: @@ -3653,16 +3633,197 @@ 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, agent_name: str, **kwargs: Any) -> _models.AgentDetails: + def get(self, agent_name: str, **kwargs: Any) -> _types.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 + :return: AgentDetails + :rtype: ~azure.ai.projects.types.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3675,7 +3836,7 @@ def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentDetails] = kwargs.pop("cls", None) _request = build_agents_get_request( agent_name=agent_name, @@ -3703,16 +3864,19 @@ def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3720,7 +3884,7 @@ def get(self, agent_name: str, **kwargs: Any) -> _models.AgentDetails: return deserialized # type: ignore @distributed_trace - def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any) -> _models.DeleteAgentResponse: + def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any) -> _types.DeleteAgentResponse: """Delete an agent. Deletes an agent. For hosted agents, if any version has active sessions, the request is @@ -3734,9 +3898,19 @@ def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any ``false`` if a value is not specified by the caller. This value is not relevant for other Agent types. Default value is None. :paramtype force: bool - :return: DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteAgentResponse + :return: DeleteAgentResponse + :rtype: ~azure.ai.projects.types.DeleteAgentResponse :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3749,7 +3923,7 @@ def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteAgentResponse] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteAgentResponse] = kwargs.pop("cls", None) _request = build_agents_delete_request( agent_name=agent_name, @@ -3778,16 +3952,19 @@ def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteAgentResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3798,12 +3975,12 @@ def delete(self, agent_name: str, *, force: Optional[bool] = None, **kwargs: Any def list( self, *, - kind: Optional[Union[str, _models.AgentKind]] = None, + kind: Optional[types.AgentKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.AgentDetails"]: + ) -> ItemPaged["_types.AgentDetails"]: """List agents. Returns a paged collection of agent resources. @@ -3826,13 +4003,194 @@ def list( Default value is None. :paramtype before: str :return: An iterator like instance of AgentDetails - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentDetails] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.AgentDetails] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.AgentDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3862,10 +4220,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.AgentDetails], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -3881,9 +4236,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -3896,14 +4251,14 @@ def create_version( self, agent_name: str, *, - definition: _models.AgentDefinition, + definition: _types.AgentDefinition, content_type: str = "application/json", metadata: Optional[dict[str, str]] = None, description: Optional[str] = None, - blueprint_reference: Optional[_models.AgentBlueprintReference] = None, + blueprint_reference: Optional[_types.AgentBlueprintReference] = None, draft: Optional[bool] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.AgentVersionDetails: """Create an agent version. Creates a new version for the specified agent and returns the created version resource. @@ -3917,7 +4272,7 @@ def create_version( :type agent_name: str :keyword definition: The agent definition. This can be a workflow, hosted agent, or a simple agent definition. Required. - :paramtype definition: ~azure.ai.projects.models.AgentDefinition + :paramtype definition: ~azure.ai.projects.types.AgentDefinition :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3931,21 +4286,153 @@ def create_version( :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. - :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference + :paramtype blueprint_reference: ~azure.ai.projects.types.AgentBlueprintReference :keyword draft: (Preview) Whether this agent version is a draft (candidate) rather than a release. The service defaults to ``false`` if a value is not specified by the caller. Draft versions are recorded but excluded from default 'latest' resolution and are not auto-promoted. Default value is None. :paramtype draft: bool - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ @overload def create_version( - self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: + self, + agent_name: str, + body: _types.CreateAgentVersionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.AgentVersionDetails: """Create an agent version. Creates a new version for the specified agent and returns the created version resource. @@ -3958,53 +4445,264 @@ def create_version( * Must not exceed 63 characters. Required. :type agent_name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateAgentVersionRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create_version( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version. + Example: + .. code-block:: python - Creates a new version for the specified agent and returns the created version resource. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. 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/json". - :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template you can fill out and use as your body input. + body = { + "definition": agent_definition, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ @distributed_trace def create_version( self, agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateAgentVersionRequest] = _Unset, *, - definition: _models.AgentDefinition = _Unset, + definition: _types.AgentDefinition = _Unset, metadata: Optional[dict[str, str]] = None, description: Optional[str] = None, - blueprint_reference: Optional[_models.AgentBlueprintReference] = None, + blueprint_reference: Optional[_types.AgentBlueprintReference] = None, draft: Optional[bool] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.AgentVersionDetails: """Create an agent version. Creates a new version for the specified agent and returns the created version resource. @@ -4016,11 +4714,11 @@ def create_version( * Can contain hyphens in the middle * Must not exceed 63 characters. Required. :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateAgentVersionRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateAgentVersionRequest :keyword definition: The agent definition. This can be a workflow, hosted agent, or a simple agent definition. Required. - :paramtype definition: ~azure.ai.projects.models.AgentDefinition + :paramtype definition: ~azure.ai.projects.types.AgentDefinition :keyword metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. @@ -4031,29 +4729,265 @@ def create_version( :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str :keyword blueprint_reference: The blueprint reference for the agent. Default value is None. - :paramtype blueprint_reference: ~azure.ai.projects.models.AgentBlueprintReference + :paramtype blueprint_reference: ~azure.ai.projects.types.AgentBlueprintReference :keyword draft: (Preview) Whether this agent version is a draft (candidate) rather than a release. The service defaults to ``false`` if a value is not specified by the caller. Draft versions are recorded but excluded from default 'latest' resolution and are not auto-promoted. Default value is None. :paramtype draft: bool - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # JSON input template you can fill out and use as your body input. + body = { + "definition": agent_definition, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + """ + 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.AgentVersionDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentVersionDetails] = kwargs.pop("cls", None) if body is _Unset: if definition is _Unset: @@ -4067,17 +5001,17 @@ def create_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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_agents_create_version_request( agent_name=agent_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -4101,16 +5035,19 @@ def create_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4128,7 +5065,7 @@ def create_version_from_manifest( metadata: Optional[dict[str, str]] = None, description: Optional[str] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.AgentVersionDetails: """Create an agent version from manifest. Imports the provided manifest to create a new version for the specified agent. @@ -4157,15 +5094,147 @@ def create_version_from_manifest( :paramtype metadata: dict[str, str] :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ @overload def create_version_from_manifest( - self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: + self, + agent_name: str, + body: _types.CreateAgentVersionFromManifestRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.AgentVersionDetails: """Create an agent version from manifest. Imports the provided manifest to create a new version for the specified agent. @@ -4178,52 +5247,166 @@ def create_version_from_manifest( * Must not exceed 63 characters. Required. :type agent_name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateAgentVersionFromManifestRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create_version_from_manifest( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentVersionDetails: - """Create an agent version from manifest. + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "manifest_id": "str", + "parameter_values": { + "str": {} + }, + "description": "str", + "metadata": { + "str": "str" + } + } - Imports the provided manifest to create a new version for the specified agent. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": - :param agent_name: The unique name that identifies the agent. Name can be used to - retrieve/update/delete the agent. + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } - * Must start and end with alphanumeric characters, - * Can contain hyphens in the middle - * Must not exceed 63 characters. 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/json". - :paramtype content_type: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ @distributed_trace def create_version_from_manifest( self, agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateAgentVersionFromManifestRequest] = _Unset, *, manifest_id: str = _Unset, parameter_values: dict[str, Any] = _Unset, metadata: Optional[dict[str, str]] = None, description: Optional[str] = None, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.AgentVersionDetails: """Create an agent version from manifest. Imports the provided manifest to create a new version for the specified agent. @@ -4235,8 +5418,8 @@ def create_version_from_manifest( * Can contain hyphens in the middle * Must not exceed 63 characters. Required. :type agent_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateAgentVersionFromManifestRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateAgentVersionFromManifestRequest :keyword manifest_id: The manifest ID to import the agent version from. Required. :paramtype manifest_id: str :keyword parameter_values: The inputs to the manifest that will result in a fully materialized @@ -4251,9 +5434,148 @@ def create_version_from_manifest( :paramtype metadata: dict[str, str] :keyword description: A human-readable description of the agent. Default value is None. :paramtype description: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "manifest_id": "str", + "parameter_values": { + "str": {} + }, + "description": "str", + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4267,7 +5589,7 @@ def create_version_from_manifest( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentVersionDetails] = kwargs.pop("cls", None) if body is _Unset: if manifest_id is _Unset: @@ -4282,17 +5604,17 @@ def create_version_from_manifest( } 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_agents_create_version_from_manifest_request( agent_name=agent_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -4316,16 +5638,19 @@ def create_version_from_manifest( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4333,7 +5658,7 @@ def create_version_from_manifest( return deserialized # type: ignore @distributed_trace - def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _models.AgentVersionDetails: + def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _types.AgentVersionDetails: """Get an agent version. Retrieves the specified version of an agent by its agent name and version identifier. @@ -4342,9 +5667,136 @@ def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _mo :type agent_name: str :param agent_version: The version of the agent to retrieve. Required. :type agent_version: str - :return: AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentVersionDetails + :return: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4357,7 +5809,7 @@ def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentVersionDetails] = kwargs.pop("cls", None) _request = build_agents_get_version_request( agent_name=agent_name, @@ -4386,16 +5838,19 @@ def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _mo except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4405,7 +5860,7 @@ def get_version(self, agent_name: str, agent_version: str, **kwargs: Any) -> _mo @distributed_trace def delete_version( self, agent_name: str, agent_version: str, *, force: Optional[bool] = None, **kwargs: Any - ) -> _models.DeleteAgentVersionResponse: + ) -> _types.DeleteAgentVersionResponse: """Delete an agent version. Deletes a specific version of an agent. For hosted agents, if the version has active sessions, @@ -4421,10 +5876,20 @@ def delete_version( value is not specified by the caller. This value is not relevant for other Agent types. Default value is None. :paramtype force: bool - :return: DeleteAgentVersionResponse. The DeleteAgentVersionResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.DeleteAgentVersionResponse + :return: DeleteAgentVersionResponse + :rtype: ~azure.ai.projects.types.DeleteAgentVersionResponse :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4437,7 +5902,7 @@ def delete_version( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteAgentVersionResponse] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteAgentVersionResponse] = kwargs.pop("cls", None) _request = build_agents_delete_version_request( agent_name=agent_name, @@ -4467,16 +5932,19 @@ def delete_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteAgentVersionResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4489,11 +5957,11 @@ def list_versions( agent_name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, include_drafts: Optional[bool] = None, **kwargs: Any - ) -> ItemPaged["_models.AgentVersionDetails"]: + ) -> ItemPaged["_types.AgentVersionDetails"]: """List agent versions. Returns a paged collection of versions for the specified agent. @@ -4519,13 +5987,140 @@ def list_versions( versions are returned). Default value is None. :paramtype include_drafts: bool :return: An iterator like instance of AgentVersionDetails - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentVersionDetails] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.AgentVersionDetails] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentVersionDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.AgentVersionDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4556,10 +6151,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.AgentVersionDetails], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -4575,9 +6167,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -4591,10 +6183,10 @@ def update_details( agent_name: str, *, content_type: str = "application/merge-patch+json", - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, + agent_endpoint: Optional[_types.AgentEndpointConfig] = None, + agent_card: Optional[_types.AgentCard] = None, **kwargs: Any - ) -> _models.AgentDetails: + ) -> _types.AgentDetails: """Update an agent endpoint. Applies a merge-patch update to the specified agent endpoint configuration. @@ -4605,18 +6197,204 @@ def update_details( 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 + :paramtype agent_endpoint: ~azure.ai.projects.types.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 + :paramtype agent_card: ~azure.ai.projects.types.AgentCard + :return: AgentDetails + :rtype: ~azure.ai.projects.types.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ @overload def update_details( - self, agent_name: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: + self, + agent_name: str, + body: _types.PatchAgentObjectRequest, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _types.AgentDetails: """Update an agent endpoint. Applies a merge-patch update to the specified agent endpoint configuration. @@ -4624,60 +6402,484 @@ def update_details( :param agent_name: The name of the agent to retrieve. Required. :type agent_name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.PatchAgentObjectRequest :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 + :return: AgentDetails + :rtype: ~azure.ai.projects.types.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def update_details( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> _models.AgentDetails: - """Update an agent endpoint. + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + } + } - Applies a merge-patch update to the specified agent endpoint configuration. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": - :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: + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ @distributed_trace def update_details( self, agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.PatchAgentObjectRequest] = _Unset, *, - agent_endpoint: Optional[_models.AgentEndpointConfig] = None, - agent_card: Optional[_models.AgentCard] = None, + agent_endpoint: Optional[_types.AgentEndpointConfig] = None, + agent_card: Optional[_types.AgentCard] = None, **kwargs: Any - ) -> _models.AgentDetails: + ) -> _types.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: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a PatchAgentObjectRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.PatchAgentObjectRequest :keyword agent_endpoint: The endpoint configuration for the agent. Default value is None. - :paramtype agent_endpoint: ~azure.ai.projects.models.AgentEndpointConfig + :paramtype agent_endpoint: ~azure.ai.projects.types.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 + :paramtype agent_card: ~azure.ai.projects.types.AgentCard + :return: AgentDetails + :rtype: ~azure.ai.projects.types.AgentDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "id": "str", + "name": "str", + "object": "str", + "state": "str", + "versions": { + "latest": { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } + }, + "agent_card": { + "skills": [ + { + "id": "str", + "name": "str", + "description": "str", + "examples": [ + "str" + ], + "tags": [ + "str" + ] + } + ], + "version": "str", + "description": "str" + }, + "agent_endpoint": { + "authorization_schemes": [ + agent_endpoint_authorization_scheme + ], + "protocol_configuration": { + "a2a": {}, + "activity": { + "enable_m365_public_endpoint": bool + }, + "invocations": {}, + "invocations_ws": {}, + "mcp": {}, + "responses": {} + }, + "version_selector": { + "version_selection_rules": [ + version_selection_rule + ] + } + }, + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4691,23 +6893,23 @@ def update_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[_types.AgentDetails] = 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 = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_agents_update_details_request( agent_name=agent_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -4731,45 +6933,34 @@ def update_details( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def _create_version_from_code( - self, - agent_name: str, - content: _models._models._CreateAgentVersionFromCodeContent, - *, - code_zip_sha256: str, - **kwargs: Any - ) -> _models.AgentVersionDetails: ... - @overload - def _create_version_from_code( - self, agent_name: str, content: JSON, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentVersionDetails: ... - @distributed_trace def _create_version_from_code( self, agent_name: str, - content: Union[_models._models._CreateAgentVersionFromCodeContent, JSON], + content: _types._CreateAgentVersionFromCodeContent, *, code_zip_sha256: str, **kwargs: Any - ) -> _models.AgentVersionDetails: + ) -> _types.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 @@ -4784,14 +6975,223 @@ def _create_version_from_code( * 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._models._CreateAgentVersionFromCodeContent or JSON + :param content: Required. + :type content: ~azure.ai.projects.types._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: AgentVersionDetails + :rtype: ~azure.ai.projects.types.AgentVersionDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template you can fill out and use as your body input. + content = { + "code": filetype, + "metadata": { + "definition": { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + }, + "description": "str", + "metadata": { + "str": "str" + } + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "external": + agent_definition = { + "kind": "external", + "otel_agent_id": "str", + "rai_config": { + "rai_policy_name": "str" + } + } + + # JSON input template for discriminator value "hosted": + agent_definition = { + "cpu": "str", + "kind": "hosted", + "memory": "str", + "code_configuration": { + "dependency_resolution": "str", + "entry_point": [ + "str" + ], + "runtime": "str", + "content_hash": "str" + }, + "container_configuration": { + "image": "str" + }, + "environment_variables": { + "str": "str" + }, + "protocol_versions": [ + { + "protocol": "str", + "version": "str" + } + ], + "rai_config": { + "rai_policy_name": "str" + }, + "telemetry_config": { + "endpoints": [ + telemetry_endpoint + ] + } + } + + # JSON input template for discriminator value "prompt": + agent_definition = { + "kind": "prompt", + "model": "str", + "instructions": "str", + "rai_config": { + "rai_policy_name": "str" + }, + "reasoning": { + "context": "auto", + "effort": "none", + "generate_summary": "auto", + "summary": "auto" + }, + "structured_inputs": { + "str": { + "default_value": {}, + "description": "str", + "required": bool, + "schema": { + "str": {} + } + } + }, + "temperature": 0.0, + "text": { + "format": text_response_format + }, + "tool_choice": "str", + "tools": [ + tool + ], + "top_p": 0.0 + } + + # JSON input template for discriminator value "json_object": + text_response_format = { + "type": "json_object" + } + + # JSON input template for discriminator value "json_schema": + text_response_format = { + "name": "str", + "schema": { + "str": {} + }, + "type": "json_schema", + "description": "str", + "strict": bool + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": agent_definition, + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "object": "str", + "version": "str", + "agent_guid": "str", + "blueprint": { + "client_id": "str", + "principal_id": "str" + }, + "blueprint_reference": agent_blueprint_reference, + "description": "str", + "draft": bool, + "instance_identity": { + "client_id": "str", + "principal_id": "str" + }, + "status": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4804,9 +7204,11 @@ def _create_version_from_code( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentVersionDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentVersionDetails] = kwargs.pop("cls", None) - _body = content.as_dict() if isinstance(content, _Model) else content + if not isinstance(content, MutableMapping): + raise TypeError("content must be a mapping") + _body = content _file_fields: list[str] = ["code"] _data_fields: list[str] = ["metadata"] _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) @@ -4839,16 +7241,19 @@ 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4917,9 +7322,9 @@ def download_code(self, agent_name: str, *, agent_version: Optional[str] = None, except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -4981,9 +7386,9 @@ def enable(self, agent_name: str, **kwargs: Any) -> None: # pylint: disable=inc 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5038,9 +7443,9 @@ def disable(self, agent_name: str, **kwargs: Any) -> None: # pylint: disable=in 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5052,104 +7457,183 @@ def create_session( self, agent_name: str, *, - version_indicator: _models.VersionIndicator, + version_indicator: _types.VersionIndicator, content_type: str = "application/json", agent_session_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: + ) -> _types.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 user identity for + 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 :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :paramtype version_indicator: ~azure.ai.projects.types.VersionIndicator :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 + :return: AgentSessionResource + :rtype: ~azure.ai.projects.types.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create_session( - self, agent_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentSessionResource: - """Create a session. + Example: + .. code-block:: python - 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 user identity for - session-mutating operations. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - :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 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: + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 201 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ @overload def create_session( - self, agent_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentSessionResource: + self, + agent_name: str, + body: _types.CreateSessionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.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 user identity for + 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 content_type: Body Parameter content-type. Content type parameter for binary body. + :type body: ~azure.ai.projects.types.CreateSessionRequest + :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 + :return: AgentSessionResource + :rtype: ~azure.ai.projects.types.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # JSON input template you can fill out and use as your body input. + body = { + "version_indicator": version_indicator, + "agent_session_id": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 201 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ @distributed_trace def create_session( self, agent_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateSessionRequest] = _Unset, *, - version_indicator: _models.VersionIndicator = _Unset, + version_indicator: _types.VersionIndicator = _Unset, agent_session_id: Optional[str] = None, **kwargs: Any - ) -> _models.AgentSessionResource: + ) -> _types.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 user identity for + 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] + :param body: Is either a JSON type or a CreateSessionRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateSessionRequest :keyword version_indicator: Determines which agent version backs the session. Required. - :paramtype version_indicator: ~azure.ai.projects.models.VersionIndicator + :paramtype version_indicator: ~azure.ai.projects.types.VersionIndicator :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: AgentSessionResource + :rtype: ~azure.ai.projects.types.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # JSON input template you can fill out and use as your body input. + body = { + "version_indicator": version_indicator, + "agent_session_id": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 201 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5163,7 +7647,7 @@ 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[_types.AgentSessionResource] = kwargs.pop("cls", None) if body is _Unset: if version_indicator is _Unset: @@ -5171,17 +7655,17 @@ def create_session( 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_agents_create_session_request( agent_name=agent_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -5205,16 +7689,19 @@ def create_session( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5222,7 +7709,7 @@ def create_session( return deserialized # type: ignore @distributed_trace - def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _models.AgentSessionResource: + def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _types.AgentSessionResource: """Get a session. Retrieves the details of a hosted agent session by agent name and session identifier. @@ -5231,9 +7718,31 @@ def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _model :type agent_name: str :param session_id: The session identifier. Required. :type session_id: str - :return: AgentSessionResource. The AgentSessionResource is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.AgentSessionResource + :return: AgentSessionResource + :rtype: ~azure.ai.projects.types.AgentSessionResource :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 200 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5246,7 +7755,7 @@ def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentSessionResource] = kwargs.pop("cls", None) + cls: ClsType[_types.AgentSessionResource] = kwargs.pop("cls", None) _request = build_agents_get_session_request( agent_name=agent_name, @@ -5275,16 +7784,19 @@ def get_session(self, agent_name: str, session_id: str, **kwargs: Any) -> _model except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.AgentSessionResource, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5342,9 +7854,9 @@ def delete_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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5402,9 +7914,9 @@ 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5417,10 +7929,10 @@ def list_sessions( agent_name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.AgentSessionResource"]: + ) -> ItemPaged["_types.AgentSessionResource"]: """List sessions for an agent. Returns a paged collection of sessions associated with the specified agent endpoint. @@ -5442,13 +7954,35 @@ def list_sessions( Default value is None. :paramtype before: str :return: An iterator like instance of AgentSessionResource - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.AgentSessionResource] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.AgentSessionResource] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "version_ref": + version_indicator = { + "agent_version": "str", + "type": "version_ref" + } + + # response body for status code(s): 200 + response == { + "agent_session_id": "str", + "created_at": "2020-02-20 00:00:00", + "expires_at": "2020-02-20 00:00:00", + "last_accessed_at": "2020-02-20 00:00:00", + "status": "str", + "version_indicator": version_indicator + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentSessionResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.AgentSessionResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5478,10 +8012,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.AgentSessionResource], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -5497,9 +8028,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5510,7 +8041,7 @@ def get_next(_continuation_token=None): @distributed_trace def get_session_log_stream( self, agent_name: str, agent_version: str, session_id: str, **kwargs: Any - ) -> _models.SessionLogEvent: + ) -> _types.SessionLogEvent: """Stream console logs for a hosted agent session. Streams console logs (stdout / stderr) for a specific hosted agent session @@ -5546,9 +8077,18 @@ def get_session_log_stream( :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 + :return: SessionLogEvent + :rtype: ~azure.ai.projects.types.SessionLogEvent :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "data": "str", + "event": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5561,7 +8101,7 @@ def get_session_log_stream( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SessionLogEvent] = kwargs.pop("cls", None) + cls: ClsType[_types.SessionLogEvent] = kwargs.pop("cls", None) _request = build_agents_get_session_log_stream_request( agent_name=agent_name, @@ -5591,9 +8131,9 @@ def get_session_log_stream( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5603,7 +8143,10 @@ def get_session_log_stream( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SessionLogEvent, response.text()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -5613,7 +8156,7 @@ def get_session_log_stream( @distributed_trace def upload_session_file( self, agent_name: str, session_id: str, content: bytes, *, path: str, **kwargs: Any - ) -> _models.SessionFileWriteResult: + ) -> _types.SessionFileWriteResult: """Upload a session file. Uploads binary file content to the specified path in the session sandbox. The service stores @@ -5628,9 +8171,18 @@ def upload_session_file( :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 + :return: SessionFileWriteResult + :rtype: ~azure.ai.projects.types.SessionFileWriteResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 201 + response == { + "bytes_written": 0, + "path": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5644,9 +8196,9 @@ def upload_session_file( _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) + cls: ClsType[_types.SessionFileWriteResult] = kwargs.pop("cls", None) - _content = content + _json = content _request = build_agents_upload_session_file_request( agent_name=agent_name, @@ -5654,7 +8206,7 @@ def upload_session_file( path=path, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -5678,16 +8230,19 @@ def upload_session_file( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5753,9 +8308,9 @@ def download_session_file(self, agent_name: str, session_id: str, *, path: str, except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5774,10 +8329,10 @@ def list_session_files( *, path: Optional[str] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.SessionDirectoryEntry"]: + ) -> ItemPaged["_types.SessionDirectoryEntry"]: """List session files. Returns files and directories at the specified path in the session sandbox. The response @@ -5806,13 +8361,24 @@ def list_session_files( Default value is None. :paramtype before: str :return: An iterator like instance of SessionDirectoryEntry - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.SessionDirectoryEntry] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.SessionDirectoryEntry] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "is_directory": bool, + "modified_time": "2020-02-20 00:00:00", + "name": "str", + "size": 0 + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SessionDirectoryEntry]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.SessionDirectoryEntry]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5844,10 +8410,7 @@ 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_of_elem = 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) @@ -5863,9 +8426,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5932,9 +8495,9 @@ def delete_session_file( # 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -5960,16 +8523,52 @@ 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, id: str, **kwargs: Any) -> _models.EvaluationRule: + def get(self, id: str, **kwargs: Any) -> _types.EvaluationRule: """Get an evaluation rule. Retrieves the specified evaluation rule and its 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 + :return: EvaluationRule + :rtype: ~azure.ai.projects.types.EvaluationRule :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } + + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } + + # response body for status code(s): 200 + response == { + "action": evaluation_rule_action, + "enabled": bool, + "eventType": "str", + "id": "str", + "systemData": { + "str": "str" + }, + "description": "str", + "displayName": "str", + "filter": { + "agentName": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5982,7 +8581,7 @@ def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluationRule] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluationRule] = kwargs.pop("cls", None) _request = build_evaluation_rules_get_request( id=id, @@ -6015,7 +8614,10 @@ def get(self, id: str, **kwargs: Any) -> _models.EvaluationRule: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6072,10 +8674,8 @@ def delete(self, id: str, **kwargs: Any) -> None: # pylint: disable=inconsisten if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload - def create_or_update( - self, id: str, evaluation_rule: _models.EvaluationRule, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationRule: + @distributed_trace + def create_or_update(self, id: str, evaluation_rule: _types.EvaluationRule, **kwargs: Any) -> _types.EvaluationRule: """Create or update an evaluation rule. Creates a new evaluation rule, or replaces the existing rule when the identifier matches. @@ -6083,71 +8683,96 @@ def create_or_update( :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 + :type evaluation_rule: ~azure.ai.projects.types.EvaluationRule + :return: EvaluationRule + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :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: - """ + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } - @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. + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + # JSON input template you can fill out and use as your body input. + evaluation_rule = { + "action": evaluation_rule_action, + "enabled": bool, + "eventType": "str", + "id": "str", + "systemData": { + "str": "str" + }, + "description": "str", + "displayName": "str", + "filter": { + "agentName": "str" + } + } - :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: - """ + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - @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. + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } - Creates a new evaluation rule, or replaces the existing rule when the identifier matches. + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } - :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: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } + + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } + + # response body for status code(s): 201, 200 + response == { + "action": evaluation_rule_action, + "enabled": bool, + "eventType": "str", + "id": "str", + "systemData": { + "str": "str" + }, + "description": "str", + "displayName": "str", + "filter": { + "agentName": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6160,21 +8785,16 @@ def create_or_update( _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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.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 + _json = evaluation_rule _request = build_evaluation_rules_create_or_update_request( id=id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -6203,7 +8823,10 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationRule, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6214,11 +8837,11 @@ def create_or_update( def list( self, *, - action_type: Optional[Union[str, _models.EvaluationRuleActionType]] = None, + action_type: Optional[types.EvaluationRuleActionType] = None, agent_name: Optional[str] = None, enabled: Optional[bool] = None, **kwargs: Any - ) -> ItemPaged["_models.EvaluationRule"]: + ) -> ItemPaged["_types.EvaluationRule"]: """List evaluation rules. Returns the evaluation rules configured for the project, optionally filtered by action type, @@ -6232,13 +8855,49 @@ def list( :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] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.EvaluationRule] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "continuousEvaluation": + evaluation_rule_action = { + "evalId": "str", + "type": "continuousEvaluation", + "maxHourlyRuns": 0, + "samplingRate": 0.0 + } + + # JSON input template for discriminator value "humanEvaluationPreview": + evaluation_rule_action = { + "templateId": "str", + "type": "humanEvaluationPreview" + } + + # response body for status code(s): 200 + response == { + "action": evaluation_rule_action, + "enabled": bool, + "eventType": "str", + "id": "str", + "systemData": { + "str": "str" + }, + "description": "str", + "displayName": "str", + "filter": { + "agentName": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluationRule]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluationRule]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6293,10 +8952,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluationRule], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6337,7 +8993,7 @@ 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.Connection: + def _get(self, name: str, **kwargs: Any) -> _types.Connection: """Get a connection. Retrieves the specified connection and its configuration details without including credential @@ -6345,9 +9001,54 @@ def _get(self, name: str, **kwargs: Any) -> _models.Connection: :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 + :return: Connection + :rtype: ~azure.ai.projects.types.Connection :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AAD": + base_credentials = { + "type": "AAD" + } + + # JSON input template for discriminator value "AgenticIdentityToken_Preview": + base_credentials = { + "type": "AgenticIdentityToken_Preview" + } + + # JSON input template for discriminator value "ApiKey": + base_credentials = { + "type": "ApiKey", + "key": "str" + } + + # JSON input template for discriminator value "CustomKeys": + base_credentials = { + "type": "CustomKeys" + } + + # JSON input template for discriminator value "None": + base_credentials = { + "type": "None" + } + + # response body for status code(s): 200 + response == { + "credentials": base_credentials, + "id": "str", + "isDefault": bool, + "metadata": { + "str": "str" + }, + "name": "str", + "target": "str", + "type": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6360,7 +9061,7 @@ 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[_types.Connection] = kwargs.pop("cls", None) _request = build_connections_get_request( name=name, @@ -6398,7 +9099,10 @@ def _get(self, name: str, **kwargs: Any) -> _models.Connection: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Connection, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -6406,16 +9110,61 @@ def _get(self, name: str, **kwargs: Any) -> _models.Connection: return deserialized # type: ignore @distributed_trace - def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: + def _get_with_credentials(self, name: str, **kwargs: Any) -> _types.Connection: """Get a connection with credentials. Retrieves the specified connection together with its credential values. :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 + :return: Connection + :rtype: ~azure.ai.projects.types.Connection :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AAD": + base_credentials = { + "type": "AAD" + } + + # JSON input template for discriminator value "AgenticIdentityToken_Preview": + base_credentials = { + "type": "AgenticIdentityToken_Preview" + } + + # JSON input template for discriminator value "ApiKey": + base_credentials = { + "type": "ApiKey", + "key": "str" + } + + # JSON input template for discriminator value "CustomKeys": + base_credentials = { + "type": "CustomKeys" + } + + # JSON input template for discriminator value "None": + base_credentials = { + "type": "None" + } + + # response body for status code(s): 200 + response == { + "credentials": base_credentials, + "id": "str", + "isDefault": bool, + "metadata": { + "str": "str" + }, + "name": "str", + "target": "str", + "type": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6428,7 +9177,7 @@ def _get_with_credentials(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[_types.Connection] = kwargs.pop("cls", None) _request = build_connections_get_with_credentials_request( name=name, @@ -6466,7 +9215,10 @@ def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Connection, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -6477,10 +9229,10 @@ def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: def list( self, *, - connection_type: Optional[Union[str, _models.ConnectionType]] = None, + connection_type: Optional[types.ConnectionType] = None, default_connection: Optional[bool] = None, **kwargs: Any - ) -> ItemPaged["_models.Connection"]: + ) -> ItemPaged["_types.Connection"]: """List connections. Returns the connections available in the current project, optionally filtered by type or @@ -6494,13 +9246,58 @@ def list( None. :paramtype default_connection: bool :return: An iterator like instance of Connection - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Connection] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.Connection] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AAD": + base_credentials = { + "type": "AAD" + } + + # JSON input template for discriminator value "AgenticIdentityToken_Preview": + base_credentials = { + "type": "AgenticIdentityToken_Preview" + } + + # JSON input template for discriminator value "ApiKey": + base_credentials = { + "type": "ApiKey", + "key": "str" + } + + # JSON input template for discriminator value "CustomKeys": + base_credentials = { + "type": "CustomKeys" + } + + # JSON input template for discriminator value "None": + base_credentials = { + "type": "None" + } + + # response body for status code(s): 200 + response == { + "credentials": base_credentials, + "id": "str", + "isDefault": bool, + "metadata": { + "str": "str" + }, + "name": "str", + "target": "str", + "type": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Connection]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Connection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6554,10 +9351,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Connection], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6598,7 +9392,7 @@ def __init__(self, *args, **kwargs) -> None: 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.DatasetVersion"]: + def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_types.DatasetVersion"]: """List versions. List all versions of the given DatasetVersion. @@ -6606,13 +9400,52 @@ def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.DatasetV :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] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == dataset_version """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.DatasetVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6665,10 +9498,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.DatasetVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6691,19 +9521,58 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.DatasetVersion"]: + def list(self, **kwargs: Any) -> ItemPaged["_types.DatasetVersion"]: """List latest versions. List the latest version of each DatasetVersion. :return: An iterator like instance of DatasetVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == dataset_version """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DatasetVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.DatasetVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6755,10 +9624,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.DatasetVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -6781,7 +9647,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: + def get(self, name: str, version: str, **kwargs: Any) -> _types.DatasetVersion: """Get a version. Get the specific version of the DatasetVersion. The service returns 404 Not Found error if the @@ -6791,9 +9657,48 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: :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 + :return: DatasetVersion + :rtype: ~azure.ai.projects.types.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == dataset_version """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6806,7 +9711,7 @@ 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[_types.DatasetVersion] = kwargs.pop("cls", None) _request = build_datasets_get_request( name=name, @@ -6840,7 +9745,10 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.DatasetVersion: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6901,16 +9809,10 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload + @distributed_trace def create_or_update( - self, - name: str, - version: str, - dataset_version: _models.DatasetVersion, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.DatasetVersion: + self, name: str, version: str, dataset_version: _types.DatasetVersion, **kwargs: Any + ) -> _types.DatasetVersion: """Create or update a version. Create a new or update an existing DatasetVersion with the given version id. @@ -6920,89 +9822,118 @@ def create_or_update( :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 + :type dataset_version: ~azure.ai.projects.types.DatasetVersion + :return: DatasetVersion + :rtype: ~azure.ai.projects.types.DatasetVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - @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. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } - Create a new or update an existing DatasetVersion with the given version id. + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "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/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: - """ + # JSON input template you can fill out and use as your body input. + dataset_version = dataset_version + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } - @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: - """ + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } - @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. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "uri_file": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_file", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "str" + } + } - Create a new or update an existing DatasetVersion with the given version id. + # JSON input template for discriminator value "uri_folder": + dataset_version = { + "dataUri": "str", + "name": "str", + "type": "uri_folder", + "version": "str", + "connectionName": "str", + "description": "str", + "id": "str", + "isReference": bool, + "tags": { + "str": "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. 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: + # response body for status code(s): 201, 200 + response == dataset_version """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7015,22 +9946,17 @@ def create_or_update( _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.DatasetVersion] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/merge-patch+json")) + cls: ClsType[_types.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 + _json = dataset_version _request = build_datasets_create_or_update_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -7059,79 +9985,20 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None 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 + @distributed_trace def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResponse: + self, name: str, version: str, pending_upload_request: _types.PendingUploadRequest, **kwargs: Any + ) -> _types.PendingUploadResponse: """Start a pending upload. Initiates a new pending upload or retrieves an existing one for the specified dataset version. @@ -7141,38 +10008,35 @@ def pending_upload( :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 + :type pending_upload_request: ~azure.ai.projects.types.PendingUploadRequest + :return: PendingUploadResponse + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python - Initiates a new pending upload or retrieves an existing one for the specified dataset version. + # JSON input template you can fill out and use as your body input. + pending_upload_request = { + "pendingUploadType": "str", + "connectionName": "str", + "pendingUploadId": "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. 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: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + }, + "pendingUploadId": "str", + "pendingUploadType": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7185,22 +10049,17 @@ def pending_upload( _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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.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 + _json = pending_upload_request _request = build_datasets_pending_upload_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -7229,7 +10088,10 @@ def pending_upload( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PendingUploadResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7237,7 +10099,7 @@ def pending_upload( return deserialized # type: ignore @distributed_trace - def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.DatasetCredential: + def get_credentials(self, name: str, version: str, **kwargs: Any) -> _types.DatasetCredential: """Get dataset credentials. Gets the SAS credential to access the storage account associated with a Dataset version. @@ -7246,9 +10108,24 @@ def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.Dat :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 + :return: DatasetCredential + :rtype: ~azure.ai.projects.types.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7261,7 +10138,7 @@ 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[_types.DatasetCredential] = kwargs.pop("cls", None) _request = build_datasets_get_credentials_request( name=name, @@ -7295,7 +10172,10 @@ def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.Dat if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetCredential, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7321,16 +10201,45 @@ 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: + def get(self, name: str, **kwargs: Any) -> _types.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 + :return: Deployment + :rtype: ~azure.ai.projects.types.Deployment :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "ModelDeployment": + deployment = { + "capabilities": { + "str": "str" + }, + "modelName": "str", + "modelPublisher": "str", + "modelVersion": "str", + "name": "str", + "sku": { + "capacity": 0, + "family": "str", + "name": "str", + "size": "str", + "tier": "str" + }, + "type": "ModelDeployment", + "connectionName": "str" + } + + # response body for status code(s): 200 + response == deployment """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7343,7 +10252,7 @@ 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[_types.Deployment] = kwargs.pop("cls", None) _request = build_deployments_get_request( name=name, @@ -7381,7 +10290,10 @@ def get(self, name: str, **kwargs: Any) -> _models.Deployment: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Deployment, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -7394,9 +10306,9 @@ def list( *, model_publisher: Optional[str] = None, model_name: Optional[str] = None, - deployment_type: Optional[Union[str, _models.DeploymentType]] = None, + deployment_type: Optional[types.DeploymentType] = None, **kwargs: Any - ) -> ItemPaged["_models.Deployment"]: + ) -> ItemPaged["_types.Deployment"]: """List deployments. Returns the deployed models available in the current project, optionally filtered by publisher, @@ -7411,13 +10323,42 @@ def list( 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] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.Deployment] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "ModelDeployment": + deployment = { + "capabilities": { + "str": "str" + }, + "modelName": "str", + "modelPublisher": "str", + "modelVersion": "str", + "name": "str", + "sku": { + "capacity": 0, + "family": "str", + "name": "str", + "size": "str", + "tier": "str" + }, + "type": "ModelDeployment", + "connectionName": "str" + } + + # response body for status code(s): 200 + response == deployment """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Deployment]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7472,10 +10413,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Deployment], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -7516,7 +10454,7 @@ def __init__(self, *args, **kwargs) -> None: 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"]: + def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_types.Index"]: """List versions. List all versions of the given Index. @@ -7524,13 +10462,96 @@ def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.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] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.Index] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == index """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Index]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7583,10 +10604,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], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -7609,19 +10627,102 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Index"]: + def list(self, **kwargs: Any) -> ItemPaged["_types.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] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.Index] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == index """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Index]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Index]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7673,10 +10774,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], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -7699,7 +10797,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: + def get(self, name: str, version: str, **kwargs: Any) -> _types.Index: """Get a version. Get the specific version of the Index. The service returns 404 Not Found error if the Index @@ -7709,9 +10807,92 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: :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: Index + :rtype: ~azure.ai.projects.types.Index :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # response body for status code(s): 200 + response == index """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7724,7 +10905,7 @@ 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[_types.Index] = kwargs.pop("cls", None) _request = build_indexes_get_request( name=name, @@ -7758,7 +10939,10 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.Index: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Index, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7819,16 +11003,8 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis 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: + @distributed_trace + def create_or_update(self, name: str, version: str, index: _types.Index, **kwargs: Any) -> _types.Index: """Create or update a version. Create a new or update an existing Index with the given version id. @@ -7838,83 +11014,250 @@ def create_or_update( :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 + :type index: ~azure.ai.projects.types.Index + :return: Index + :rtype: ~azure.ai.projects.types.Index :raises ~azure.core.exceptions.HttpResponseError: - """ - @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. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } - Create a new or update an existing Index with the given version id. + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - :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: - """ + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - @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. + # JSON input template you can fill out and use as your body input. + index = index + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } - Create a new or update an existing Index with the given version id. + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - :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: - """ + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - @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. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureSearch": + index = { + "connectionName": "str", + "indexName": "str", + "name": "str", + "type": "AzureSearch", + "version": "str", + "description": "str", + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "id": "str", + "tags": { + "str": "str" + } + } - Create a new or update an existing Index with the given version id. + # JSON input template for discriminator value "CosmosDBNoSqlVectorStore": + index = { + "connectionName": "str", + "containerName": "str", + "databaseName": "str", + "embeddingConfiguration": { + "embeddingField": "str", + "modelDeploymentName": "str" + }, + "fieldMapping": { + "contentFields": [ + "str" + ], + "filepathField": "str", + "metadataFields": [ + "str" + ], + "titleField": "str", + "urlField": "str", + "vectorFields": [ + "str" + ] + }, + "name": "str", + "type": "CosmosDBNoSqlVectorStore", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } - :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: + # JSON input template for discriminator value "ManagedAzureSearch": + index = { + "name": "str", + "type": "ManagedAzureSearch", + "vectorStoreId": "str", + "version": "str", + "description": "str", + "id": "str", + "tags": { + "str": "str" + } + } + + # response body for status code(s): 201, 200 + response == index """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7927,22 +11270,17 @@ def create_or_update( _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.Index] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/merge-patch+json")) + cls: ClsType[_types.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 + _json = index _request = build_indexes_create_or_update_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -7971,7 +11309,10 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Index, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8001,14 +11342,14 @@ def create_version( self, name: str, *, - tools: List[_models.ToolboxTool], + tools: List[_types.ToolboxTool], 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, + skills: Optional[List[_types.ToolboxSkill]] = None, + policies: Optional[_types.ToolboxPolicies] = None, **kwargs: Any - ) -> _models.ToolboxVersionObject: + ) -> _types.ToolboxVersionObject: """Create a new version of a toolbox. Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. @@ -8017,7 +11358,7 @@ def create_version( Required. :type name: str :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.ToolboxTool] + :paramtype tools: list[~azure.ai.projects.types.ToolboxTool] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8029,18 +11370,49 @@ def create_version( :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] + :paramtype skills: list[~azure.ai.projects.types.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 + :paramtype policies: ~azure.ai.projects.types.ToolboxPolicies + :return: ToolboxVersionObject + :rtype: ~azure.ai.projects.types.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ @overload def create_version( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxVersionObject: + self, + name: str, + body: _types.CreateToolboxVersionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.ToolboxVersionObject: """Create a new version of a toolbox. Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. @@ -8049,49 +11421,73 @@ def create_version( Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateToolboxVersionRequest :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 + :return: ToolboxVersionObject + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "tools": [ + toolbox_tool + ], + "description": "str", + "metadata": { + "str": "str" + }, + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } - :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: + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ @distributed_trace def create_version( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateToolboxVersionRequest] = _Unset, *, - tools: List[_models.ToolboxTool] = _Unset, + tools: List[_types.ToolboxTool] = _Unset, description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, - skills: Optional[List[_models.ToolboxSkill]] = None, - policies: Optional[_models.ToolboxPolicies] = None, + skills: Optional[List[_types.ToolboxSkill]] = None, + policies: Optional[_types.ToolboxPolicies] = None, **kwargs: Any - ) -> _models.ToolboxVersionObject: + ) -> _types.ToolboxVersionObject: """Create a new version of a toolbox. Creates a new toolbox version, provisioning the toolbox itself if it does not already exist. @@ -8099,10 +11495,10 @@ def create_version( :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] + :param body: Is either a JSON type or a CreateToolboxVersionRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateToolboxVersionRequest :keyword tools: The list of tools to include in this version. Required. - :paramtype tools: list[~azure.ai.projects.models.ToolboxTool] + :paramtype tools: list[~azure.ai.projects.types.ToolboxTool] :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 @@ -8111,12 +11507,57 @@ def create_version( :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] + :paramtype skills: list[~azure.ai.projects.types.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 + :paramtype policies: ~azure.ai.projects.types.ToolboxPolicies + :return: ToolboxVersionObject + :rtype: ~azure.ai.projects.types.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "tools": [ + toolbox_tool + ], + "description": "str", + "metadata": { + "str": "str" + }, + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8130,7 +11571,7 @@ def create_version( _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) + cls: ClsType[_types.ToolboxVersionObject] = kwargs.pop("cls", None) if body is _Unset: if tools is _Unset: @@ -8144,17 +11585,17 @@ def create_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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_toolboxes_create_version_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -8178,16 +11619,19 @@ def create_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8195,16 +11639,26 @@ def create_version( return deserialized # type: ignore @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: + def get(self, name: str, **kwargs: Any) -> _types.ToolboxObject: """Retrieve a toolbox. Retrieves the specified toolbox and its current configuration. :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 + :return: ToolboxObject + :rtype: ~azure.ai.projects.types.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8217,7 +11671,7 @@ 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[_types.ToolboxObject] = kwargs.pop("cls", None) _request = build_toolboxes_get_request( name=name, @@ -8245,16 +11699,19 @@ def get(self, name: str, **kwargs: Any) -> _models.ToolboxObject: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8266,10 +11723,10 @@ def list( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ToolboxObject"]: + ) -> ItemPaged["_types.ToolboxObject"]: """List toolboxes. Returns the toolboxes available in the current project. @@ -8289,13 +11746,23 @@ def 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] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.ToolboxObject] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ToolboxObject]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ToolboxObject]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8324,10 +11791,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ToolboxObject], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -8343,9 +11807,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -8359,10 +11823,10 @@ def list_versions( name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ToolboxVersionObject"]: + ) -> ItemPaged["_types.ToolboxVersionObject"]: """List toolbox versions. Returns the available versions for the specified toolbox. @@ -8384,13 +11848,39 @@ def list_versions( Default value is None. :paramtype before: str :return: An iterator like instance of ToolboxVersionObject - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ToolboxVersionObject] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.ToolboxVersionObject] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ToolboxVersionObject]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ToolboxVersionObject]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8420,10 +11910,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], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -8439,9 +11926,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -8450,7 +11937,7 @@ 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: + def get_version(self, name: str, version: str, **kwargs: Any) -> _types.ToolboxVersionObject: """Retrieve a specific version of a toolbox. Retrieves the specified version of a toolbox by name and version identifier. @@ -8459,9 +11946,35 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Toolbox :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 + :return: ToolboxVersionObject + :rtype: ~azure.ai.projects.types.ToolboxVersionObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "metadata": { + "str": "str" + }, + "name": "str", + "tools": [ + toolbox_tool + ], + "version": "str", + "description": "str", + "policies": { + "rai_config": { + "rai_policy_name": "str" + } + }, + "skills": [ + toolbox_skill + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8474,7 +11987,7 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Toolbox _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ToolboxVersionObject] = kwargs.pop("cls", None) + cls: ClsType[_types.ToolboxVersionObject] = kwargs.pop("cls", None) _request = build_toolboxes_get_version_request( name=name, @@ -8503,16 +12016,19 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Toolbox except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8522,7 +12038,7 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Toolbox @overload def update( self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: + ) -> _types.ToolboxObject: """Update a toolbox to point to a specific version. Updates the toolbox's default version pointer to the specified version. @@ -8535,15 +12051,25 @@ def update( :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: ToolboxObject + :rtype: ~azure.ai.projects.types.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ @overload def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ToolboxObject: + self, name: str, body: _types.UpdateToolboxRequest1, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.ToolboxObject: """Update a toolbox to point to a specific version. Updates the toolbox's default version pointer to the specified version. @@ -8551,53 +12077,68 @@ def update( :param name: The name of the toolbox to update. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.UpdateToolboxRequest1 :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: ToolboxObject + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python - Updates the toolbox's default version pointer to the specified version. + # JSON input template you can fill out and use as your body input. + body = { + "default_version": "str" + } - :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: + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ @distributed_trace def update( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.ToolboxObject: + self, + name: str, + body: Union[JSON, _types.UpdateToolboxRequest1] = _Unset, + *, + default_version: str = _Unset, + **kwargs: Any + ) -> _types.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: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a UpdateToolboxRequest1 type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateToolboxRequest1 :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 + :return: ToolboxObject + :rtype: ~azure.ai.projects.types.ToolboxObject :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "default_version": "str" + } + + # response body for status code(s): 200 + response == { + "default_version": "str", + "id": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8611,7 +12152,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[_types.ToolboxObject] = kwargs.pop("cls", None) if body is _Unset: if default_version is _Unset: @@ -8619,17 +12160,17 @@ def update( 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_toolboxes_update_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -8653,16 +12194,19 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ToolboxObject, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8714,9 +12258,9 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -8773,9 +12317,9 @@ def delete_version( # 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -8801,16 +12345,96 @@ 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.EvaluationTaxonomy: + def get(self, name: str, **kwargs: Any) -> _types.EvaluationTaxonomy: """Get an evaluation taxonomy. Retrieves the specified evaluation taxonomy. :param name: The name of the resource. Required. :type name: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :return: EvaluationTaxonomy + :rtype: ~azure.ai.projects.types.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } + + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # response body for status code(s): 200 + response == { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8823,7 +12447,7 @@ def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluationTaxonomy] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluationTaxonomy] = kwargs.pop("cls", None) _request = build_beta_evaluation_taxonomies_get_request( name=name, @@ -8856,7 +12480,10 @@ def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8866,7 +12493,7 @@ def get(self, name: str, **kwargs: Any) -> _models.EvaluationTaxonomy: @distributed_trace def list( self, *, input_name: Optional[str] = None, input_type: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.EvaluationTaxonomy"]: + ) -> ItemPaged["_types.EvaluationTaxonomy"]: """List evaluation taxonomies. Returns the evaluation taxonomies available in the project, optionally filtered by input name @@ -8877,13 +12504,93 @@ def list( :keyword input_type: Filter by taxonomy input type. Default value is None. :paramtype input_type: str :return: An iterator like instance of EvaluationTaxonomy - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluationTaxonomy] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.EvaluationTaxonomy] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } + + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # response body for status code(s): 200 + response == { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluationTaxonomy]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluationTaxonomy]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8937,10 +12644,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluationTaxonomy], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -9012,10 +12716,8 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload - def create( - self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: + @distributed_trace + def create(self, name: str, taxonomy: _types.EvaluationTaxonomy, **kwargs: Any) -> _types.EvaluationTaxonomy: """Create an evaluation taxonomy. Creates or replaces the specified evaluation taxonomy with the provided definition. @@ -9023,71 +12725,207 @@ def create( :param name: The name of the evaluation taxonomy. Required. :type name: str :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :type taxonomy: ~azure.ai.projects.types.EvaluationTaxonomy + :return: EvaluationTaxonomy + :rtype: ~azure.ai.projects.types.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create( - self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + Example: + .. code-block:: python - Creates or replaces the specified evaluation taxonomy with the provided definition. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } - @overload - def create( - self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } - Creates or replaces the specified evaluation taxonomy with the provided definition. + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: 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: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template you can fill out and use as your body input. + taxonomy = { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } - @distributed_trace - def create( - self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Create an evaluation taxonomy. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - Creates or replaces the specified evaluation taxonomy with the provided definition. + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, - JSON, IO[bytes] Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } + + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # response body for status code(s): 201, 200 + response == { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9100,21 +12938,16 @@ def create( _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.EvaluationTaxonomy] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluationTaxonomy] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(taxonomy, (IOBase, bytes)): - _content = taxonomy - else: - _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = taxonomy _request = build_beta_evaluation_taxonomies_create_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -9143,17 +12976,18 @@ def create( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def update( - self, name: str, taxonomy: _models.EvaluationTaxonomy, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: + @distributed_trace + def update(self, name: str, taxonomy: _types.EvaluationTaxonomy, **kwargs: Any) -> _types.EvaluationTaxonomy: """Update an evaluation taxonomy. Update an evaluation taxonomy. @@ -9161,71 +12995,167 @@ def update( :param name: The name of the evaluation taxonomy. Required. :type name: str :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy + :type taxonomy: ~azure.ai.projects.types.EvaluationTaxonomy + :return: EvaluationTaxonomy + :rtype: ~azure.ai.projects.types.EvaluationTaxonomy :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def update( - self, name: str, taxonomy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + Example: + .. code-block:: python - Update an evaluation taxonomy. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } - @overload - def update( - self, name: str, taxonomy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } - Update an evaluation taxonomy. + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Required. - :type taxonomy: 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: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template you can fill out and use as your body input. + taxonomy = { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } - @distributed_trace - def update( - self, name: str, taxonomy: Union[_models.EvaluationTaxonomy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluationTaxonomy: - """Update an evaluation taxonomy. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - Update an evaluation taxonomy. + # JSON input template for discriminator value "agent": + evaluation_taxonomy_input = { + "riskCategories": [ + "str" + ], + "target": evaluation_target, + "type": "agent" + } - :param name: The name of the evaluation taxonomy. Required. - :type name: str - :param taxonomy: The evaluation taxonomy. Is one of the following types: EvaluationTaxonomy, - JSON, IO[bytes] Required. - :type taxonomy: ~azure.ai.projects.models.EvaluationTaxonomy or JSON or IO[bytes] - :return: EvaluationTaxonomy. The EvaluationTaxonomy is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluationTaxonomy - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "azure_ai_agent": + evaluation_target = { + "name": "str", + "type": "azure_ai_agent", + "tool_descriptions": [ + { + "description": "str", + "name": "str" + } + ], + "tools": [ + tool + ], + "version": "str" + } + + # JSON input template for discriminator value "azure_ai_model": + evaluation_target = { + "type": "azure_ai_model", + "model": "str", + "sampling_params": { + "max_completion_tokens": 0, + "seed": 0, + "temperature": 0.0, + "top_p": 0.0 + } + } + + # response body for status code(s): 200 + response == { + "name": "str", + "taxonomyInput": evaluation_taxonomy_input, + "version": "str", + "description": "str", + "id": "str", + "properties": { + "str": "str" + }, + "tags": { + "str": "str" + }, + "taxonomyCategories": [ + { + "id": "str", + "name": "str", + "riskCategory": "str", + "subCategories": [ + { + "enabled": bool, + "id": "str", + "name": "str", + "description": "str", + "properties": { + "str": "str" + } + } + ], + "description": "str", + "properties": { + "str": "str" + } + } + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9238,21 +13168,16 @@ def update( _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.EvaluationTaxonomy] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluationTaxonomy] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(taxonomy, (IOBase, bytes)): - _content = taxonomy - else: - _content = json.dumps(taxonomy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = taxonomy _request = build_beta_evaluation_taxonomies_update_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -9281,7 +13206,10 @@ def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluationTaxonomy, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9314,7 +13242,7 @@ def list_versions( type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, limit: Optional[int] = None, **kwargs: Any - ) -> ItemPaged["_models.EvaluatorVersion"]: + ) -> ItemPaged["_types.EvaluatorVersion"]: """List evaluator versions. Returns the available versions for the specified evaluator. @@ -9329,13 +13257,153 @@ def list_versions( 100, and the default is 20. Default value is None. :paramtype limit: int :return: An iterator like instance of EvaluatorVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluatorVersion] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.EvaluatorVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluatorVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9390,10 +13458,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluatorVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -9422,7 +13487,7 @@ def list( type: Optional[Union[Literal["builtin"], Literal["custom"], Literal["all"], str]] = None, limit: Optional[int] = None, **kwargs: Any - ) -> ItemPaged["_models.EvaluatorVersion"]: + ) -> ItemPaged["_types.EvaluatorVersion"]: """List latest evaluator versions. Lists the latest version of each evaluator. @@ -9435,13 +13500,153 @@ def list( 100, and the default is 20. Default value is None. :paramtype limit: int :return: An iterator like instance of EvaluatorVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluatorVersion] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.EvaluatorVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluatorVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluatorVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9495,10 +13700,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluatorVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -9521,7 +13723,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_version(self, name: str, version: str, **kwargs: Any) -> _models.EvaluatorVersion: + def get_version(self, name: str, version: str, **kwargs: Any) -> _types.EvaluatorVersion: """Get an evaluator version. Retrieves the specified evaluator version, returning 404 if it does not exist. @@ -9530,9 +13732,149 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Evaluat :type name: str :param version: The specific version id of the EvaluatorVersion to retrieve. Required. :type version: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :return: EvaluatorVersion + :rtype: ~azure.ai.projects.types.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9545,7 +13887,7 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Evaluat _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorVersion] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluatorVersion] = kwargs.pop("cls", None) _request = build_beta_evaluators_get_version_request( name=name, @@ -9579,7 +13921,10 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.Evaluat if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9641,15 +13986,10 @@ def delete_version( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload + @distributed_trace def create_version( - self, - name: str, - evaluator_version: _models.EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: + self, name: str, evaluator_version: _types.EvaluatorVersion, **kwargs: Any + ) -> _types.EvaluatorVersion: """Create an evaluator version. Creates a new evaluator version with an auto-incremented version identifier. @@ -9657,71 +13997,287 @@ def create_version( :param name: The name of the resource. Required. :type name: str :param evaluator_version: Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :type evaluator_version: ~azure.ai.projects.types.EvaluatorVersion + :return: EvaluatorVersion + :rtype: ~azure.ai.projects.types.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create_version( - self, name: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create an evaluator version. - - Creates a new evaluator version with an auto-incremented version identifier. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @overload - def create_version( - self, name: str, evaluator_version: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create an evaluator version. + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Creates a new evaluator version with an auto-incremented version identifier. + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Required. - :type evaluator_version: 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: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template you can fill out and use as your body input. + evaluator_version = { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } - @distributed_trace - def create_version( - self, name: str, evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EvaluatorVersion: - """Create an evaluator version. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Creates a new evaluator version with an auto-incremented version identifier. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param name: The name of the resource. Required. - :type name: str - :param evaluator_version: Is one of the following types: EvaluatorVersion, JSON, IO[bytes] - Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 201 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9734,21 +14290,16 @@ def create_version( _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.EvaluatorVersion] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluatorVersion] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(evaluator_version, (IOBase, bytes)): - _content = evaluator_version - else: - _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = evaluator_version _request = build_beta_evaluators_create_version_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -9777,23 +14328,20 @@ def create_version( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload + @distributed_trace def update_version( - self, - name: str, - version: str, - evaluator_version: _models.EvaluatorVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: + self, name: str, version: str, evaluator_version: _types.EvaluatorVersion, **kwargs: Any + ) -> _types.EvaluatorVersion: """Update an evaluator version. Updates the specified evaluator version in place. @@ -9803,87 +14351,287 @@ def update_version( :param version: The version of the EvaluatorVersion to update. Required. :type version: str :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion + :type evaluator_version: ~azure.ai.projects.types.EvaluatorVersion + :return: EvaluatorVersion + :rtype: ~azure.ai.projects.types.EvaluatorVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def update_version( - self, name: str, version: str, evaluator_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an evaluator version. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Updates the specified evaluator version in place. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @overload - def update_version( - self, - name: str, - version: str, - evaluator_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an evaluator version. + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } - Updates the specified evaluator version in place. + # JSON input template you can fill out and use as your body input. + evaluator_version = { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Required. - :type evaluator_version: 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: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @distributed_trace - def update_version( - self, - name: str, - version: str, - evaluator_version: Union[_models.EvaluatorVersion, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.EvaluatorVersion: - """Update an evaluator version. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Updates the specified evaluator version in place. + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param name: The name of the resource. Required. - :type name: str - :param version: The version of the EvaluatorVersion to update. Required. - :type version: str - :param evaluator_version: Evaluator resource. Is one of the following types: EvaluatorVersion, - JSON, IO[bytes] Required. - :type evaluator_version: ~azure.ai.projects.models.EvaluatorVersion or JSON or IO[bytes] - :return: EvaluatorVersion. The EvaluatorVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorVersion - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9896,22 +14644,17 @@ def update_version( _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.EvaluatorVersion] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluatorVersion] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(evaluator_version, (IOBase, bytes)): - _content = evaluator_version - else: - _content = json.dumps(evaluator_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = evaluator_version _request = build_beta_evaluators_update_version_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -9940,81 +14683,20 @@ def update_version( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None 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 evaluator - version. - - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion 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 evaluator - version. - - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion 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 + @distributed_trace def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PendingUploadResponse: + self, name: str, version: str, pending_upload_request: _types.PendingUploadRequest, **kwargs: Any + ) -> _types.PendingUploadResponse: """Start a pending upload. Initiates a new pending upload or retrieves an existing one for the specified evaluator @@ -10025,39 +14707,35 @@ def pending_upload( :param version: The specific version id of the EvaluatorVersion 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 + :type pending_upload_request: ~azure.ai.projects.types.PendingUploadRequest + :return: PendingUploadResponse + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python - Initiates a new pending upload or retrieves an existing one for the specified evaluator - version. + # JSON input template you can fill out and use as your body input. + pending_upload_request = { + "pendingUploadType": "str", + "connectionName": "str", + "pendingUploadId": "str" + } - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion 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: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + }, + "pendingUploadId": "str", + "pendingUploadType": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10070,22 +14748,17 @@ def pending_upload( _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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.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 + _json = pending_upload_request _request = build_beta_evaluators_pending_upload_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -10109,90 +14782,29 @@ def pending_upload( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PendingUploadResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: _models.EvaluatorCredentialRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: - """Get evaluator credentials. - - Retrieves SAS credentials for accessing the storage account associated with the specified - evaluator version. - - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion to operate on. Required. - :type version: str - :param credential_request: The credential request parameters. Required. - :type credential_request: ~azure.ai.projects.models.EvaluatorCredentialRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: - """Get evaluator credentials. - - Retrieves SAS credentials for accessing the storage account associated with the specified - evaluator version. - - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion to operate on. Required. - :type version: str - :param credential_request: The credential request parameters. Required. - :type credential_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: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload + @distributed_trace def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: + self, name: str, version: str, credential_request: _types.EvaluatorCredentialRequest, **kwargs: Any + ) -> _types.DatasetCredential: """Get evaluator credentials. Retrieves SAS credentials for accessing the storage account associated with the specified @@ -10203,39 +14815,30 @@ def get_credentials( :param version: The specific version id of the EvaluatorVersion to operate on. Required. :type version: str :param credential_request: The credential request parameters. Required. - :type credential_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: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential + :type credential_request: ~azure.ai.projects.types.EvaluatorCredentialRequest + :return: DatasetCredential + :rtype: ~azure.ai.projects.types.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def get_credentials( - self, - name: str, - version: str, - credential_request: Union[_models.EvaluatorCredentialRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.DatasetCredential: - """Get evaluator credentials. + Example: + .. code-block:: python - Retrieves SAS credentials for accessing the storage account associated with the specified - evaluator version. + # JSON input template you can fill out and use as your body input. + credential_request = { + "blob_uri": "str" + } - :param name: Required. - :type name: str - :param version: The specific version id of the EvaluatorVersion to operate on. Required. - :type version: str - :param credential_request: The credential request parameters. Is one of the following types: - EvaluatorCredentialRequest, JSON, IO[bytes] Required. - :type credential_request: ~azure.ai.projects.models.EvaluatorCredentialRequest or JSON or - IO[bytes] - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10248,22 +14851,17 @@ def get_credentials( _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.DatasetCredential] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.DatasetCredential] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(credential_request, (IOBase, bytes)): - _content = credential_request - else: - _content = json.dumps(credential_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = credential_request _request = build_beta_evaluators_get_credentials_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -10287,120 +14885,389 @@ def get_credentials( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetCredential, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload + @distributed_trace def create_generation_job( - self, - job: _models.EvaluatorGenerationJob, - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorGenerationJob: + self, job: _types.EvaluatorGenerationJob, *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _types.EvaluatorGenerationJob: """Create an evaluator generation job. Creates an evaluator generation job. The service generates rubric-based evaluator definitions from the provided source materials asynchronously. :param job: The job to create. Required. - :type job: ~azure.ai.projects.models.EvaluatorGenerationJob + :type job: ~azure.ai.projects.types.EvaluatorGenerationJob :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: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: EvaluatorGenerationJob + :rtype: ~azure.ai.projects.types.EvaluatorGenerationJob :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.EvaluatorGenerationJob: - """Create an evaluator generation job. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :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: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @overload - def create_generation_job( - self, - job: IO[bytes], - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Create an evaluator generation job. + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + # JSON input template you can fill out and use as your body input. + job = { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } - :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: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: - """ + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - @distributed_trace - def create_generation_job( - self, - job: Union[_models.EvaluatorGenerationJob, JSON, IO[bytes]], - *, - operation_id: Optional[str] = None, - **kwargs: Any - ) -> _models.EvaluatorGenerationJob: - """Create an evaluator generation job. + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - Creates an evaluator generation job. The service generates rubric-based evaluator definitions - from the provided source materials asynchronously. + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } - :param job: The job to create. Is one of the following types: EvaluatorGenerationJob, JSON, - IO[bytes] Required. - :type job: ~azure.ai.projects.models.EvaluatorGenerationJob 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: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 201 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10413,21 +15280,16 @@ def create_generation_job( _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.EvaluatorGenerationJob] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.EvaluatorGenerationJob] = 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 + _json = job _request = build_beta_evaluators_create_generation_job_request( operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -10451,9 +15313,9 @@ def create_generation_job( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -10464,7 +15326,10 @@ def create_generation_job( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -10472,16 +15337,191 @@ def create_generation_job( return deserialized # type: ignore @distributed_trace - def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: + def get_generation_job(self, job_id: str, **kwargs: Any) -> _types.EvaluatorGenerationJob: """Get an evaluator generation job. Gets the details of an evaluator generation job by its ID. :param job_id: The ID of the job. Required. :type job_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: EvaluatorGenerationJob + :rtype: ~azure.ai.projects.types.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10494,7 +15534,7 @@ def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGen _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluatorGenerationJob] = kwargs.pop("cls", None) _request = build_beta_evaluators_get_generation_job_request( job_id=job_id, @@ -10522,9 +15562,9 @@ def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGen except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -10534,7 +15574,10 @@ def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGen if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -10546,10 +15589,10 @@ def list_generation_jobs( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.EvaluatorGenerationJob"]: + ) -> ItemPaged["_types.EvaluatorGenerationJob"]: """List evaluator generation jobs. Returns a list of evaluator generation jobs. The List API has up to a few seconds of @@ -10571,13 +15614,188 @@ def list_generation_jobs( Default value is None. :paramtype before: str :return: An iterator like instance of EvaluatorGenerationJob - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.EvaluatorGenerationJob] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.EvaluatorGenerationJob] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EvaluatorGenerationJob]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.EvaluatorGenerationJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10606,10 +15824,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.EvaluatorGenerationJob], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -10625,9 +15840,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -10636,16 +15851,191 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) @distributed_trace - def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.EvaluatorGenerationJob: + def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _types.EvaluatorGenerationJob: """Cancel an evaluator generation job. Cancels an evaluator generation job by its ID. :param job_id: The ID of the job to cancel. Required. :type job_id: str - :return: EvaluatorGenerationJob. The EvaluatorGenerationJob is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.EvaluatorGenerationJob + :return: EvaluatorGenerationJob + :rtype: ~azure.ai.projects.types.EvaluatorGenerationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "code": + evaluator_definition = { + "type": "code", + "blob_uri": "str", + "code_text": "str", + "data_schema": { + "str": {} + }, + "entry_point": "str", + "image_tag": "str", + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "endpoint": + evaluator_definition = { + "connection_name": "str", + "type": "endpoint", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "prompt": + evaluator_definition = { + "prompt_text": "str", + "type": "prompt", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + } + } + + # JSON input template for discriminator value "rubric": + evaluator_definition = { + "dimensions": [ + { + "description": "str", + "id": "str", + "weight": 0, + "always_applicable": bool + } + ], + "type": "rubric", + "data_schema": { + "str": {} + }, + "init_parameters": { + "str": {} + }, + "metrics": { + "str": { + "desirable_direction": "str", + "is_primary": bool, + "max_value": 0.0, + "min_value": 0.0, + "threshold": 0.0, + "type": "str" + } + }, + "pass_threshold": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "evaluator_name": "str", + "model": "str", + "sources": [ + evaluator_generation_job_source + ], + "evaluator_description": "str", + "evaluator_display_name": "str" + }, + "result": { + "categories": [ + "str" + ], + "created_at": "2020-02-20 00:00:00", + "created_by": "str", + "definition": evaluator_definition, + "evaluator_type": "str", + "modified_at": "2020-02-20 00:00:00", + "name": "str", + "version": "str", + "description": "str", + "display_name": "str", + "generation_artifacts": { + "dataset": { + "name": "str", + "version": "str" + }, + "kinds": [ + "str" + ] + }, + "id": "str", + "metadata": { + "str": "str" + }, + "supported_evaluation_levels": [ + "str" + ], + "tags": { + "str": "str" + } + }, + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "total_tokens": 0 + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10658,7 +16048,7 @@ def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Evaluator _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EvaluatorGenerationJob] = kwargs.pop("cls", None) + cls: ClsType[_types.EvaluatorGenerationJob] = kwargs.pop("cls", None) _request = build_beta_evaluators_cancel_generation_job_request( job_id=job_id, @@ -10686,16 +16076,19 @@ def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.Evaluator except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EvaluatorGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10750,9 +16143,9 @@ def delete_generation_job( # 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -10777,71 +16170,263 @@ 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 generate( - self, insight: _models.Insight, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Insight: + @distributed_trace + def generate(self, insight: _types.Insight, **kwargs: Any) -> _types.Insight: """Generate insights. Generates an insights report from the provided evaluation configuration. :param insight: Complete evaluation configuration including data source, evaluators, and result settings. Required. - :type insight: ~azure.ai.projects.models.Insight - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :type insight: ~azure.ai.projects.types.Insight + :return: Insight + :rtype: ~azure.ai.projects.types.Insight :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def generate(self, insight: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.Insight: - """Generate insights. + Example: + .. code-block:: python - Generates an insights report from the provided evaluation configuration. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "AgentClusterInsight": + insight_request = { + "agentName": "str", + "type": "AgentClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } - @overload - def generate(self, insight: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.Insight: - """Generate insights. + # JSON input template for discriminator value "EvaluationComparison": + insight_request = { + "baselineRunId": "str", + "evalId": "str", + "treatmentRunIds": [ + "str" + ], + "type": "EvaluationComparison" + } - Generates an insights report from the provided evaluation configuration. + # JSON input template for discriminator value "EvaluationRunClusterInsight": + insight_request = { + "evalId": "str", + "runIds": [ + "str" + ], + "type": "EvaluationRunClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Required. - :type insight: 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: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "AgentClusterInsight": + insight_result = { + "clusterInsight": { + "clusters": [ + { + "description": "str", + "id": "str", + "label": "str", + "suggestion": "str", + "suggestionTitle": "str", + "weight": 0, + "samples": [ + insight_sample + ], + "subClusters": [ + ... + ] + } + ], + "summary": { + "method": "str", + "sampleCount": 0, + "uniqueClusterCount": 0, + "uniqueSubclusterCount": 0, + "usage": { + "inputTokenUsage": 0, + "outputTokenUsage": 0, + "totalTokenUsage": 0 + } + }, + "coordinates": { + "str": { + "size": 0, + "x": 0, + "y": 0 + } + } + }, + "type": "AgentClusterInsight" + } - @distributed_trace - def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: Any) -> _models.Insight: - """Generate insights. + # JSON input template for discriminator value "EvaluationComparison": + insight_result = { + "comparisons": [ + { + "baselineRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + }, + "compareItems": [ + { + "deltaEstimate": 0.0, + "pValue": 0.0, + "treatmentEffect": "str", + "treatmentRunId": "str", + "treatmentRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + } + } + ], + "evaluator": "str", + "metric": "str", + "testingCriteria": "str" + } + ], + "method": "str", + "type": "EvaluationComparison" + } - Generates an insights report from the provided evaluation configuration. + # JSON input template you can fill out and use as your body input. + insight = { + "displayName": "str", + "id": "str", + "metadata": { + "createdAt": "2020-02-20 00:00:00", + "completedAt": "2020-02-20 00:00:00" + }, + "request": insight_request, + "state": "str", + "result": insight_result + } - :param insight: Complete evaluation configuration including data source, evaluators, and result - settings. Is one of the following types: Insight, JSON, IO[bytes] Required. - :type insight: ~azure.ai.projects.models.Insight or JSON or IO[bytes] - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AgentClusterInsight": + insight_request = { + "agentName": "str", + "type": "AgentClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_request = { + "baselineRunId": "str", + "evalId": "str", + "treatmentRunIds": [ + "str" + ], + "type": "EvaluationComparison" + } + + # JSON input template for discriminator value "EvaluationRunClusterInsight": + insight_request = { + "evalId": "str", + "runIds": [ + "str" + ], + "type": "EvaluationRunClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "AgentClusterInsight": + insight_result = { + "clusterInsight": { + "clusters": [ + { + "description": "str", + "id": "str", + "label": "str", + "suggestion": "str", + "suggestionTitle": "str", + "weight": 0, + "samples": [ + insight_sample + ], + "subClusters": [ + ... + ] + } + ], + "summary": { + "method": "str", + "sampleCount": 0, + "uniqueClusterCount": 0, + "uniqueSubclusterCount": 0, + "usage": { + "inputTokenUsage": 0, + "outputTokenUsage": 0, + "totalTokenUsage": 0 + } + }, + "coordinates": { + "str": { + "size": 0, + "x": 0, + "y": 0 + } + } + }, + "type": "AgentClusterInsight" + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_result = { + "comparisons": [ + { + "baselineRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + }, + "compareItems": [ + { + "deltaEstimate": 0.0, + "pValue": 0.0, + "treatmentEffect": "str", + "treatmentRunId": "str", + "treatmentRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + } + } + ], + "evaluator": "str", + "metric": "str", + "testingCriteria": "str" + } + ], + "method": "str", + "type": "EvaluationComparison" + } + + # response body for status code(s): 201 + response == { + "displayName": "str", + "id": "str", + "metadata": { + "createdAt": "2020-02-20 00:00:00", + "completedAt": "2020-02-20 00:00:00" + }, + "request": insight_request, + "state": "str", + "result": insight_result + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10854,20 +16439,15 @@ def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: A _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.Insight] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.Insight] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(insight, (IOBase, bytes)): - _content = insight - else: - _content = json.dumps(insight, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = insight _request = build_beta_insights_generate_request( content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -10891,16 +16471,19 @@ def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: A except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Insight, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10908,7 +16491,7 @@ def generate(self, insight: Union[_models.Insight, JSON, IO[bytes]], **kwargs: A return deserialized # type: ignore @distributed_trace - def get(self, insight_id: str, *, include_coordinates: Optional[bool] = None, **kwargs: Any) -> _models.Insight: + def get(self, insight_id: str, *, include_coordinates: Optional[bool] = None, **kwargs: Any) -> _types.Insight: """Get an insight. Retrieves the specified insight report and its results. @@ -10918,9 +16501,133 @@ def get(self, insight_id: str, *, include_coordinates: Optional[bool] = None, ** :keyword include_coordinates: Whether to include coordinates for visualization in the response. Defaults to false. Default value is None. :paramtype include_coordinates: bool - :return: Insight. The Insight is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Insight + :return: Insight + :rtype: ~azure.ai.projects.types.Insight :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AgentClusterInsight": + insight_request = { + "agentName": "str", + "type": "AgentClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_request = { + "baselineRunId": "str", + "evalId": "str", + "treatmentRunIds": [ + "str" + ], + "type": "EvaluationComparison" + } + + # JSON input template for discriminator value "EvaluationRunClusterInsight": + insight_request = { + "evalId": "str", + "runIds": [ + "str" + ], + "type": "EvaluationRunClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "AgentClusterInsight": + insight_result = { + "clusterInsight": { + "clusters": [ + { + "description": "str", + "id": "str", + "label": "str", + "suggestion": "str", + "suggestionTitle": "str", + "weight": 0, + "samples": [ + insight_sample + ], + "subClusters": [ + ... + ] + } + ], + "summary": { + "method": "str", + "sampleCount": 0, + "uniqueClusterCount": 0, + "uniqueSubclusterCount": 0, + "usage": { + "inputTokenUsage": 0, + "outputTokenUsage": 0, + "totalTokenUsage": 0 + } + }, + "coordinates": { + "str": { + "size": 0, + "x": 0, + "y": 0 + } + } + }, + "type": "AgentClusterInsight" + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_result = { + "comparisons": [ + { + "baselineRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + }, + "compareItems": [ + { + "deltaEstimate": 0.0, + "pValue": 0.0, + "treatmentEffect": "str", + "treatmentRunId": "str", + "treatmentRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + } + } + ], + "evaluator": "str", + "metric": "str", + "testingCriteria": "str" + } + ], + "method": "str", + "type": "EvaluationComparison" + } + + # response body for status code(s): 200 + response == { + "displayName": "str", + "id": "str", + "metadata": { + "createdAt": "2020-02-20 00:00:00", + "completedAt": "2020-02-20 00:00:00" + }, + "request": insight_request, + "state": "str", + "result": insight_result + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10933,7 +16640,7 @@ def get(self, insight_id: str, *, include_coordinates: Optional[bool] = None, ** _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Insight] = kwargs.pop("cls", None) + cls: ClsType[_types.Insight] = kwargs.pop("cls", None) _request = build_beta_insights_get_request( insight_id=insight_id, @@ -10962,16 +16669,19 @@ def get(self, insight_id: str, *, include_coordinates: Optional[bool] = None, ** except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Insight, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10982,13 +16692,13 @@ def get(self, insight_id: str, *, include_coordinates: Optional[bool] = None, ** def list( self, *, - type: Optional[Union[str, _models.InsightType]] = None, + type: Optional[types.InsightType] = None, eval_id: Optional[str] = None, run_id: Optional[str] = None, agent_name: Optional[str] = None, include_coordinates: Optional[bool] = None, **kwargs: Any - ) -> ItemPaged["_models.Insight"]: + ) -> ItemPaged["_types.Insight"]: """List insights. Returns insights in reverse chronological order, with the most recent entries first. @@ -11006,13 +16716,137 @@ def list( Defaults to false. Default value is None. :paramtype include_coordinates: bool :return: An iterator like instance of Insight - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Insight] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.Insight] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AgentClusterInsight": + insight_request = { + "agentName": "str", + "type": "AgentClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_request = { + "baselineRunId": "str", + "evalId": "str", + "treatmentRunIds": [ + "str" + ], + "type": "EvaluationComparison" + } + + # JSON input template for discriminator value "EvaluationRunClusterInsight": + insight_request = { + "evalId": "str", + "runIds": [ + "str" + ], + "type": "EvaluationRunClusterInsight", + "modelConfiguration": { + "modelDeploymentName": "str" + } + } + + # JSON input template for discriminator value "AgentClusterInsight": + insight_result = { + "clusterInsight": { + "clusters": [ + { + "description": "str", + "id": "str", + "label": "str", + "suggestion": "str", + "suggestionTitle": "str", + "weight": 0, + "samples": [ + insight_sample + ], + "subClusters": [ + ... + ] + } + ], + "summary": { + "method": "str", + "sampleCount": 0, + "uniqueClusterCount": 0, + "uniqueSubclusterCount": 0, + "usage": { + "inputTokenUsage": 0, + "outputTokenUsage": 0, + "totalTokenUsage": 0 + } + }, + "coordinates": { + "str": { + "size": 0, + "x": 0, + "y": 0 + } + } + }, + "type": "AgentClusterInsight" + } + + # JSON input template for discriminator value "EvaluationComparison": + insight_result = { + "comparisons": [ + { + "baselineRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + }, + "compareItems": [ + { + "deltaEstimate": 0.0, + "pValue": 0.0, + "treatmentEffect": "str", + "treatmentRunId": "str", + "treatmentRunSummary": { + "average": 0.0, + "runId": "str", + "sampleCount": 0, + "standardDeviation": 0.0 + } + } + ], + "evaluator": "str", + "metric": "str", + "testingCriteria": "str" + } + ], + "method": "str", + "type": "EvaluationComparison" + } + + # response body for status code(s): 200 + response == { + "displayName": "str", + "id": "str", + "metadata": { + "createdAt": "2020-02-20 00:00:00", + "completedAt": "2020-02-20 00:00:00" + }, + "request": insight_request, + "state": "str", + "result": insight_result + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Insight]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Insight]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11069,10 +16903,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Insight], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -11088,9 +16919,9 @@ 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) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -11121,12 +16952,12 @@ def create( self, *, name: str, - definition: _models.MemoryStoreDefinition, + definition: _types.MemoryStoreDefinition, content_type: str = "application/json", description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: + ) -> _types.MemoryStoreDetails: """Create a memory store. Creates a memory store resource with the provided configuration. @@ -11134,7 +16965,7 @@ def create( :keyword name: The name of the memory store. Required. :paramtype name: str :keyword definition: The memory store definition. Required. - :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition + :paramtype definition: ~azure.ai.projects.types.MemoryStoreDefinition :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -11143,76 +16974,214 @@ def create( :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default value is None. :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ @overload def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: + self, body: _types.CreateMemoryStoreRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryStoreDetails: """Create a memory store. Creates a memory store resource with the provided configuration. :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateMemoryStoreRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Create a memory store. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } - Creates a memory store resource with the provided configuration. + # JSON input template you can fill out and use as your body input. + body = { + "definition": memory_store_definition, + "name": "str", + "description": "str", + "metadata": { + "str": "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: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ @distributed_trace def create( self, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateMemoryStoreRequest] = _Unset, *, name: str = _Unset, - definition: _models.MemoryStoreDefinition = _Unset, + definition: _types.MemoryStoreDefinition = _Unset, description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: + ) -> _types.MemoryStoreDetails: """Create a memory store. Creates a memory store resource with the provided configuration. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateMemoryStoreRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateMemoryStoreRequest :keyword name: The name of the memory store. Required. :paramtype name: str :keyword definition: The memory store definition. Required. - :paramtype definition: ~azure.ai.projects.models.MemoryStoreDefinition + :paramtype definition: ~azure.ai.projects.types.MemoryStoreDefinition :keyword description: A human-readable description of the memory store. Default value is None. :paramtype description: str :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default value is None. :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # JSON input template you can fill out and use as your body input. + body = { + "definition": memory_store_definition, + "name": "str", + "description": "str", + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11226,7 +17195,7 @@ def create( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreDetails] = kwargs.pop("cls", None) if body is _Unset: if name is _Unset: @@ -11236,16 +17205,16 @@ def create( body = {"definition": definition, "description": description, "metadata": metadata, "name": name} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_create_request( content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -11269,16 +17238,19 @@ def create( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11294,7 +17266,7 @@ def update( description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: + ) -> _types.MemoryStoreDetails: """Update a memory store. Updates the specified memory store with the supplied configuration changes. @@ -11309,15 +17281,49 @@ def update( :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default value is None. :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ @overload def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: + self, name: str, body: _types.UpdateMemoryStoreRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryStoreDetails: """Update a memory store. Updates the specified memory store with the supplied configuration changes. @@ -11325,61 +17331,125 @@ def update( :param name: The name of the memory store to update. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.UpdateMemoryStoreRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def update( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDetails: - """Update a memory store. + Example: + .. code-block:: python - Updates the specified memory store with the supplied configuration changes. + # JSON input template you can fill out and use as your body input. + body = { + "description": "str", + "metadata": { + "str": "str" + } + } - :param name: The name of the memory store 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: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ @distributed_trace def update( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.UpdateMemoryStoreRequest] = _Unset, *, description: Optional[str] = None, metadata: Optional[dict[str, str]] = None, **kwargs: Any - ) -> _models.MemoryStoreDetails: + ) -> _types.MemoryStoreDetails: """Update a memory store. Updates the specified memory store with the supplied configuration changes. :param name: The name of the memory store 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] + :param body: Is either a JSON type or a UpdateMemoryStoreRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateMemoryStoreRequest :keyword description: A human-readable description of the memory store. Default value is None. :paramtype description: str :keyword metadata: Arbitrary key-value metadata to associate with the memory store. Default value is None. :paramtype metadata: dict[str, str] - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "description": "str", + "metadata": { + "str": "str" + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11393,23 +17463,23 @@ def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreDetails] = kwargs.pop("cls", None) if body is _Unset: body = {"description": description, "metadata": metadata} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_update_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -11433,16 +17503,19 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11450,16 +17523,50 @@ def update( return deserialized # type: ignore @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: + def get(self, name: str, **kwargs: Any) -> _types.MemoryStoreDetails: """Get a memory store. Retrieves the specified memory store and its current configuration. :param name: The name of the memory store to retrieve. Required. :type name: str - :return: MemoryStoreDetails. The MemoryStoreDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDetails + :return: MemoryStoreDetails + :rtype: ~azure.ai.projects.types.MemoryStoreDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11472,7 +17579,7 @@ def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MemoryStoreDetails] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreDetails] = kwargs.pop("cls", None) _request = build_beta_memory_stores_get_request( name=name, @@ -11500,16 +17607,19 @@ def get(self, name: str, **kwargs: Any) -> _models.MemoryStoreDetails: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11521,10 +17631,10 @@ def list( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.MemoryStoreDetails"]: + ) -> ItemPaged["_types.MemoryStoreDetails"]: """List memory stores. Returns the memory stores available to the caller. @@ -11544,13 +17654,47 @@ def list( Default value is None. :paramtype before: str :return: An iterator like instance of MemoryStoreDetails - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.MemoryStoreDetails] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.MemoryStoreDetails] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "default": + memory_store_definition = { + "chat_model": "str", + "embedding_model": "str", + "kind": "default", + "options": { + "chat_summary_enabled": bool, + "user_profile_enabled": bool, + "default_ttl_seconds": "1 day, 0:00:00", + "procedural_memory_enabled": bool, + "user_profile_details": "str" + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "definition": memory_store_definition, + "id": "str", + "name": "str", + "object": "str", + "updated_at": "2020-02-20 00:00:00", + "description": "str", + "metadata": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MemoryStoreDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.MemoryStoreDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11579,10 +17723,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.MemoryStoreDetails], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -11598,9 +17739,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -11609,16 +17750,26 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) @distributed_trace - def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: + def delete(self, name: str, **kwargs: Any) -> _types.DeleteMemoryStoreResult: """Delete a memory store. Deletes the specified memory store. :param name: The name of the memory store to delete. Required. :type name: str - :return: DeleteMemoryStoreResult. The DeleteMemoryStoreResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteMemoryStoreResult + :return: DeleteMemoryStoreResult + :rtype: ~azure.ai.projects.types.DeleteMemoryStoreResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11631,7 +17782,7 @@ def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteMemoryStoreResult] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteMemoryStoreResult] = kwargs.pop("cls", None) _request = build_beta_memory_stores_delete_request( name=name, @@ -11659,16 +17810,19 @@ def delete(self, name: str, **kwargs: Any) -> _models.DeleteMemoryStoreResult: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteMemoryStoreResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11684,38 +17838,34 @@ def _search_memories( content_type: str = "application/json", items: Optional[List[dict[str, Any]]] = None, previous_search_id: Optional[str] = None, - options: Optional[_models.MemorySearchOptions] = None, + options: Optional[_types.MemorySearchOptions] = None, **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... + ) -> _types.MemoryStoreSearchResult: ... @overload def _search_memories( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... - @overload - def _search_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: ... + self, name: str, body: _types.SearchMemoriesRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryStoreSearchResult: ... @distributed_trace def _search_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.SearchMemoriesRequest] = _Unset, *, scope: str = _Unset, items: Optional[List[dict[str, Any]]] = None, previous_search_id: Optional[str] = None, - options: Optional[_models.MemorySearchOptions] = None, + options: Optional[_types.MemorySearchOptions] = None, **kwargs: Any - ) -> _models.MemoryStoreSearchResult: + ) -> _types.MemoryStoreSearchResult: """Search memories. Searches the specified memory store for memories relevant to the provided conversation context. :param name: The name of the memory store to search. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a SearchMemoriesRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.SearchMemoriesRequest :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -11725,10 +17875,49 @@ def _search_memories( memory search from where the last operation left off. Default value is None. :paramtype previous_search_id: str :keyword options: Memory search options. Default value is None. - :paramtype options: ~azure.ai.projects.models.MemorySearchOptions - :return: MemoryStoreSearchResult. The MemoryStoreSearchResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult + :paramtype options: ~azure.ai.projects.types.MemorySearchOptions + :return: MemoryStoreSearchResult + :rtype: ~azure.ai.projects.types.MemoryStoreSearchResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str", + "items": [ + { + "str": {} + } + ], + "options": { + "max_memories": 0 + }, + "previous_search_id": "str" + } + + # response body for status code(s): 200 + response == { + "memories": [ + { + "memory_item": memory_item + } + ], + "search_id": "str", + "usage": { + "embedding_tokens": 0, + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11742,7 +17931,7 @@ def _search_memories( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreSearchResult] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreSearchResult] = kwargs.pop("cls", None) if body is _Unset: if scope is _Unset: @@ -11750,17 +17939,17 @@ def _search_memories( body = {"items": items, "options": options, "previous_search_id": previous_search_id, "scope": scope} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_search_memories_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -11784,16 +17973,19 @@ def _search_memories( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreSearchResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11803,7 +17995,7 @@ def _search_memories( def _update_memories_initial( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.UpdateMemoriesRequest] = _Unset, *, scope: str = _Unset, items: Optional[List[dict[str, Any]]] = None, @@ -11836,17 +18028,17 @@ def _update_memories_initial( } 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_update_memories_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -11869,9 +18061,9 @@ def _update_memories_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -11896,28 +18088,24 @@ def _begin_update_memories( previous_update_id: Optional[str] = None, update_delay: Optional[int] = None, **kwargs: Any - ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: ... - @overload - def _begin_update_memories( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + ) -> LROPoller[_types.MemoryStoreUpdateCompletedResult]: ... @overload def _begin_update_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: ... + self, name: str, body: _types.UpdateMemoriesRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_types.MemoryStoreUpdateCompletedResult]: ... @distributed_trace def _begin_update_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.UpdateMemoriesRequest] = _Unset, *, scope: str = _Unset, items: Optional[List[dict[str, Any]]] = None, previous_update_id: Optional[str] = None, update_delay: Optional[int] = None, **kwargs: Any - ) -> LROPoller[_models.MemoryStoreUpdateCompletedResult]: + ) -> LROPoller[_types.MemoryStoreUpdateCompletedResult]: """Update memories. Starts an update that writes conversation memories into the specified memory store. The @@ -11925,8 +18113,8 @@ def _begin_update_memories( :param name: The name of the memory store 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] + :param body: Is either a JSON type or a UpdateMemoriesRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateMemoriesRequest :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -11941,17 +18129,53 @@ def _begin_update_memories( Set to 0 to immediately trigger the update without delay. Defaults to 300 (5 minutes). Default value is None. :paramtype update_delay: int - :return: An instance of LROPoller that returns MemoryStoreUpdateCompletedResult. The - MemoryStoreUpdateCompletedResult is compatible with MutableMapping + :return: An instance of LROPoller that returns MemoryStoreUpdateCompletedResult :rtype: - ~azure.core.polling.LROPoller[~azure.ai.projects.models.MemoryStoreUpdateCompletedResult] + ~azure.core.polling.LROPoller[~azure.ai.projects.types.MemoryStoreUpdateCompletedResult] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str", + "items": [ + { + "str": {} + } + ], + "previous_update_id": "str", + "update_delay": 0 + } + + # response body for status code(s): 202 + response == { + "memory_operations": [ + { + "kind": "str", + "memory_item": memory_item + } + ], + "usage": { + "embedding_tokens": 0, + "input_tokens": 0, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + } + } """ _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.MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -11979,7 +18203,10 @@ def get_long_running_output(pipeline_response): "str", response.headers.get("Operation-Location") ) - deserialized = _deserialize(_models.MemoryStoreUpdateCompletedResult, response.json().get("result", {})) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -11997,20 +18224,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.MemoryStoreUpdateCompletedResult].from_continuation_token( + return LROPoller[_types.MemoryStoreUpdateCompletedResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.MemoryStoreUpdateCompletedResult]( + return LROPoller[_types.MemoryStoreUpdateCompletedResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @overload def delete_scope( self, name: str, *, scope: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: + ) -> _types.MemoryStoreDeleteScopeResult: """Delete memories by scope. Deletes all memories in the specified memory store that are associated with the provided scope. @@ -12023,16 +18250,26 @@ def delete_scope( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :return: MemoryStoreDeleteScopeResult + :rtype: ~azure.ai.projects.types.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str", + "scope": "str" + } """ @overload def delete_scope( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: + self, name: str, body: _types.DeleteScopeRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryStoreDeleteScopeResult: """Delete memories by scope. Deletes all memories in the specified memory store that are associated with the provided scope. @@ -12040,56 +18277,65 @@ def delete_scope( :param name: The name of the memory store. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.DeleteScopeRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :return: MemoryStoreDeleteScopeResult + :rtype: ~azure.ai.projects.types.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def delete_scope( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: - """Delete memories by scope. + Example: + .. code-block:: python - Deletes all memories in the specified memory store that are associated with the provided scope. + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str" + } - :param name: The name of the memory store. 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: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str", + "scope": "str" + } """ @distributed_trace def delete_scope( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, scope: str = _Unset, **kwargs: Any - ) -> _models.MemoryStoreDeleteScopeResult: + self, name: str, body: Union[JSON, _types.DeleteScopeRequest] = _Unset, *, scope: str = _Unset, **kwargs: Any + ) -> _types.MemoryStoreDeleteScopeResult: """Delete memories by scope. Deletes all memories in the specified memory store that are associated with the provided scope. :param name: The name of the memory store. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a DeleteScopeRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.DeleteScopeRequest :keyword scope: The namespace that logically groups and isolates memories to delete, such as a user ID. Required. :paramtype scope: str - :return: MemoryStoreDeleteScopeResult. The MemoryStoreDeleteScopeResult is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreDeleteScopeResult + :return: MemoryStoreDeleteScopeResult + :rtype: ~azure.ai.projects.types.MemoryStoreDeleteScopeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str" + } + + # response body for status code(s): 200 + response == { + "deleted": bool, + "name": "str", + "object": "str", + "scope": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12103,7 +18349,7 @@ def delete_scope( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryStoreDeleteScopeResult] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryStoreDeleteScopeResult] = kwargs.pop("cls", None) if body is _Unset: if scope is _Unset: @@ -12111,17 +18357,17 @@ def delete_scope( body = {"scope": scope} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_delete_scope_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -12145,16 +18391,19 @@ def delete_scope( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryStoreDeleteScopeResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12168,10 +18417,10 @@ def create_memory( *, scope: str, content: str, - kind: Union[str, _models.MemoryItemKind], + kind: types.MemoryItemKind, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: + ) -> _types.MemoryItem: """Create a memory item. Creates a memory item in the specified memory store. @@ -12189,15 +18438,51 @@ def create_memory( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @overload def create_memory( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: + self, name: str, body: _types.CreateMemoryRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.MemoryItem: """Create a memory item. Creates a memory item in the specified memory store. @@ -12205,54 +18490,77 @@ def create_memory( :param name: The name of the memory store. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.CreateMemoryRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create_memory( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: - """Create a memory item. + Example: + .. code-block:: python - Creates a memory item in the specified memory store. + # JSON input template you can fill out and use as your body input. + body = { + "content": "str", + "kind": "str", + "scope": "str" + } - :param name: The name of the memory store. 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: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @distributed_trace def create_memory( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateMemoryRequest] = _Unset, *, scope: str = _Unset, content: str = _Unset, - kind: Union[str, _models.MemoryItemKind] = _Unset, + kind: types.MemoryItemKind = _Unset, **kwargs: Any - ) -> _models.MemoryItem: + ) -> _types.MemoryItem: """Create a memory item. Creates a memory item in the specified memory store. :param name: The name of the memory store. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateMemoryRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateMemoryRequest :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -12261,9 +18569,52 @@ def create_memory( :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", and "procedural". Required. :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "content": "str", + "kind": "str", + "scope": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12277,7 +18628,7 @@ def create_memory( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryItem] = kwargs.pop("cls", None) if body is _Unset: if scope is _Unset: @@ -12289,17 +18640,17 @@ def create_memory( body = {"content": content, "kind": kind, "scope": scope} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_create_memory_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -12323,16 +18674,19 @@ def create_memory( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryItem, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12342,7 +18696,7 @@ def create_memory( @overload def update_memory( self, name: str, memory_id: str, *, content: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: + ) -> _types.MemoryItem: """Update a memory item. Updates the specified memory item in the memory store. @@ -12356,15 +18710,57 @@ def update_memory( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @overload def update_memory( - self, name: str, memory_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: + self, + name: str, + memory_id: str, + body: _types.UpdateMemoryRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.MemoryItem: """Update a memory item. Updates the specified memory item in the memory store. @@ -12374,41 +18770,66 @@ def update_memory( :param memory_id: The ID of the memory item to update. Required. :type memory_id: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.UpdateMemoryRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def update_memory( - self, name: str, memory_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryItem: - """Update a memory item. + Example: + .. code-block:: python - Updates the specified memory item in the memory store. + # JSON input template you can fill out and use as your body input. + body = { + "content": "str" + } - :param name: The name of the memory store. Required. - :type name: str - :param memory_id: The ID of the memory item to update. Required. - :type memory_id: 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: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @distributed_trace def update_memory( - self, name: str, memory_id: str, body: Union[JSON, IO[bytes]] = _Unset, *, content: str = _Unset, **kwargs: Any - ) -> _models.MemoryItem: + self, + name: str, + memory_id: str, + body: Union[JSON, _types.UpdateMemoryRequest] = _Unset, + *, + content: str = _Unset, + **kwargs: Any + ) -> _types.MemoryItem: """Update a memory item. Updates the specified memory item in the memory store. @@ -12417,13 +18838,54 @@ def update_memory( :type name: str :param memory_id: The ID of the memory item to update. Required. :type memory_id: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a UpdateMemoryRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateMemoryRequest :keyword content: The updated content of the memory. Required. :paramtype content: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "content": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12437,7 +18899,7 @@ def update_memory( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryItem] = kwargs.pop("cls", None) if body is _Unset: if content is _Unset: @@ -12445,18 +18907,18 @@ def update_memory( body = {"content": 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_memory_stores_update_memory_request( name=name, memory_id=memory_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -12480,16 +18942,19 @@ def update_memory( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryItem, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12497,7 +18962,7 @@ def update_memory( return deserialized # type: ignore @distributed_trace - def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.MemoryItem: + def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _types.MemoryItem: """Get a memory item. Retrieves the specified memory item from the memory store. @@ -12506,9 +18971,45 @@ def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.Memory :type name: str :param memory_id: The ID of the memory item to retrieve. Required. :type memory_id: str - :return: MemoryItem. The MemoryItem is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryItem + :return: MemoryItem + :rtype: ~azure.ai.projects.types.MemoryItem :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12521,7 +19022,7 @@ def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.Memory _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MemoryItem] = kwargs.pop("cls", None) + cls: ClsType[_types.MemoryItem] = kwargs.pop("cls", None) _request = build_beta_memory_stores_get_memory_request( name=name, @@ -12550,16 +19051,19 @@ def get_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.Memory except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MemoryItem, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12572,13 +19076,13 @@ def list_memories( name: str, *, scope: str, - kind: Optional[Union[str, _models.MemoryItemKind]] = None, + kind: Optional[types.MemoryItemKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> ItemPaged["_models.MemoryItem"]: + ) -> ItemPaged["_types.MemoryItem"]: """List memory items. Returns memory items from the specified memory store. @@ -12609,23 +19113,59 @@ def list_memories( Default value is "application/json". :paramtype content_type: str :return: An iterator like instance of MemoryItem - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.MemoryItem] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.MemoryItem] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @overload def list_memories( self, name: str, - body: JSON, + body: _types.ListMemoriesRequest, *, - kind: Optional[Union[str, _models.MemoryItemKind]] = None, + kind: Optional[types.MemoryItemKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> ItemPaged["_models.MemoryItem"]: + ) -> ItemPaged["_types.MemoryItem"]: """List memory items. Returns memory items from the specified memory store. @@ -12633,7 +19173,7 @@ def list_memories( :param name: The name of the memory store. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.ListMemoriesRequest :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", and "procedural". Default value is None. :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind @@ -12655,77 +19195,72 @@ def list_memories( Default value is "application/json". :paramtype content_type: str :return: An iterator like instance of MemoryItem - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.MemoryItem] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.MemoryItem] :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def list_memories( - self, - name: str, - body: IO[bytes], - *, - kind: Optional[Union[str, _models.MemoryItemKind]] = None, - limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, - before: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> ItemPaged["_models.MemoryItem"]: - """List memory items. + Example: + .. code-block:: python - Returns memory items from the specified memory store. + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str" + } - :param name: The name of the memory store. Required. - :type name: str - :param body: Required. - :type body: IO[bytes] - :keyword kind: The kind of the memory item. Known values are: "user_profile", "chat_summary", - and "procedural". Default value is None. - :paramtype kind: str or ~azure.ai.projects.models.MemoryItemKind - :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 content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of MemoryItem - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.MemoryItem] - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ @distributed_trace def list_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.ListMemoriesRequest] = _Unset, *, scope: str = _Unset, - kind: Optional[Union[str, _models.MemoryItemKind]] = None, + kind: Optional[types.MemoryItemKind] = None, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.MemoryItem"]: + ) -> ItemPaged["_types.MemoryItem"]: """List memory items. Returns memory items from the specified memory store. :param name: The name of the memory store. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a ListMemoriesRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.ListMemoriesRequest :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -12747,14 +19282,55 @@ def list_memories( Default value is None. :paramtype before: str :return: An iterator like instance of MemoryItem - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.MemoryItem] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.MemoryItem] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "scope": "str" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "kind": + + # JSON input template for discriminator value "chat_summary": + memory_item = { + "content": "str", + "kind": "chat_summary", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "procedural": + memory_item = { + "content": "str", + "kind": "procedural", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # JSON input template for discriminator value "user_profile": + memory_item = { + "content": "str", + "kind": "user_profile", + "memory_id": "str", + "scope": "str", + "updated_at": "2020-02-20 00:00:00" + } + + # response body for status code(s): 200 + response == memory_item """ _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[List[_models.MemoryItem]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.MemoryItem]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12769,11 +19345,11 @@ def list_memories( body = {"scope": scope} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body def prepare_request(_continuation_token=None): @@ -12786,7 +19362,7 @@ def prepare_request(_continuation_token=None): before=before, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -12798,10 +19374,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.MemoryItem], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -12817,9 +19390,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -12828,7 +19401,7 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) @distributed_trace - def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.DeleteMemoryResult: + def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _types.DeleteMemoryResult: """Delete a memory item. Deletes the specified memory item from the memory store. @@ -12837,9 +19410,19 @@ def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.Del :type name: str :param memory_id: The ID of the memory item to delete. Required. :type memory_id: str - :return: DeleteMemoryResult. The DeleteMemoryResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteMemoryResult + :return: DeleteMemoryResult + :rtype: ~azure.ai.projects.types.DeleteMemoryResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "memory_id": "str", + "object": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12852,7 +19435,7 @@ def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.Del _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteMemoryResult] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteMemoryResult] = kwargs.pop("cls", None) _request = build_beta_memory_stores_delete_memory_request( name=name, @@ -12881,16 +19464,19 @@ def delete_memory(self, name: str, memory_id: str, **kwargs: Any) -> _models.Del except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteMemoryResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12916,7 +19502,7 @@ def __init__(self, *args, **kwargs) -> None: 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.ModelVersion"]: + def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_types.ModelVersion"]: """List versions. List all versions of the given ModelVersion. @@ -12924,13 +19510,54 @@ def list_versions(self, name: str, **kwargs: Any) -> ItemPaged["_models.ModelVer :param name: The name of the resource. Required. :type name: str :return: An iterator like instance of ModelVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ModelVersion] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.ModelVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ModelVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ModelVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12983,10 +19610,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ModelVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -13009,19 +19633,60 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.ModelVersion"]: + def list(self, **kwargs: Any) -> ItemPaged["_types.ModelVersion"]: """List latest versions. List the latest version of each ModelVersion. :return: An iterator like instance of ModelVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ModelVersion] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.ModelVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ModelVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ModelVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13073,10 +19738,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ModelVersion], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -13099,7 +19761,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get(self, name: str, version: str, **kwargs: Any) -> _models.ModelVersion: + def get(self, name: str, version: str, **kwargs: Any) -> _types.ModelVersion: """Get a model version. Retrieves the specified model version, returning 404 if it does not exist. @@ -13108,9 +19770,50 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.ModelVersion: :type name: str :param version: The specific version id of the ModelVersion to retrieve. Required. :type version: str - :return: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion + :return: ModelVersion + :rtype: ~azure.ai.projects.types.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13123,7 +19826,7 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.ModelVersion: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) + cls: ClsType[_types.ModelVersion] = kwargs.pop("cls", None) _request = build_beta_models_get_request( name=name, @@ -13157,7 +19860,10 @@ def get(self, name: str, version: str, **kwargs: Any) -> _models.ModelVersion: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ModelVersion, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13218,74 +19924,10 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis if cls: return cls(pipeline_response, None, {}) # type: ignore - @overload - def update( - self, - name: str, - version: str, - model_version_update: _models.UpdateModelVersionRequest, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.ModelVersion: - """Update a model version. - - Update an existing ModelVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the UpdateModelVersionRequest to create or update. - Required. - :type version: str - :param model_version_update: The UpdateModelVersionRequest to create or update. Required. - :type model_version_update: ~azure.ai.projects.models.UpdateModelVersionRequest - :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: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - name: str, - version: str, - model_version_update: JSON, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.ModelVersion: - """Update a model version. - - Update an existing ModelVersion with the given version id. - - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the UpdateModelVersionRequest to create or update. - Required. - :type version: str - :param model_version_update: The UpdateModelVersionRequest to create or update. Required. - :type model_version_update: 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: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload + @distributed_trace def update( - self, - name: str, - version: str, - model_version_update: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> _models.ModelVersion: + self, name: str, version: str, model_version_update: _types.UpdateModelVersionRequest, **kwargs: Any + ) -> _types.ModelVersion: """Update a model version. Update an existing ModelVersion with the given version id. @@ -13296,39 +19938,59 @@ def update( Required. :type version: str :param model_version_update: The UpdateModelVersionRequest to create or update. Required. - :type model_version_update: 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: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion + :type model_version_update: ~azure.ai.projects.types.UpdateModelVersionRequest + :return: ModelVersion + :rtype: ~azure.ai.projects.types.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def update( - self, - name: str, - version: str, - model_version_update: Union[_models.UpdateModelVersionRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.ModelVersion: - """Update a model version. + Example: + .. code-block:: python - Update an existing ModelVersion with the given version id. + # JSON input template you can fill out and use as your body input. + model_version_update = { + "description": "str", + "tags": { + "str": "str" + } + } - :param name: The name of the resource. Required. - :type name: str - :param version: The specific version id of the UpdateModelVersionRequest to create or update. - Required. - :type version: str - :param model_version_update: The UpdateModelVersionRequest to create or update. Is one of the - following types: UpdateModelVersionRequest, JSON, IO[bytes] Required. - :type model_version_update: ~azure.ai.projects.models.UpdateModelVersionRequest or JSON or - IO[bytes] - :return: ModelVersion. The ModelVersion is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ModelVersion - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 201, 200 + response == { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13341,22 +20003,17 @@ def update( _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.ModelVersion] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/merge-patch+json")) + cls: ClsType[_types.ModelVersion] = kwargs.pop("cls", None) - content_type = content_type or "application/merge-patch+json" - _content = None - if isinstance(model_version_update, (IOBase, bytes)): - _content = model_version_update - else: - _content = json.dumps(model_version_update, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = model_version_update _request = build_beta_models_update_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -13385,75 +20042,20 @@ def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ModelVersion, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def pending_create_version( - self, - name: str, - version: str, - model_version: _models.ModelVersion, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CreateAsyncResponse: - """Create a model version async. - - Creates a model version asynchronously with blob content validation. Returns 202 Accepted with - a location header for polling the operation status. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param model_version: Model version to create. Required. - :type model_version: ~azure.ai.projects.models.ModelVersion - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.CreateAsyncResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def pending_create_version( - self, name: str, version: str, model_version: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CreateAsyncResponse: - """Create a model version async. + if response.content: + deserialized = response.json() + else: + deserialized = None - Creates a model version asynchronously with blob content validation. Returns 202 Accepted with - a location header for polling the operation status. + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param model_version: Model version to create. Required. - :type model_version: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.CreateAsyncResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore - @overload + @distributed_trace def pending_create_version( - self, - name: str, - version: str, - model_version: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CreateAsyncResponse: + self, name: str, version: str, model_version: _types.ModelVersion, **kwargs: Any + ) -> _types.CreateAsyncResponse: """Create a model version async. Creates a model version asynchronously with blob content validation. Returns 202 Accepted with @@ -13464,34 +20066,57 @@ def pending_create_version( :param version: Version of the model. Required. :type version: str :param model_version: Model version to create. Required. - :type model_version: 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: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.CreateAsyncResponse + :type model_version: ~azure.ai.projects.types.ModelVersion + :return: CreateAsyncResponse + :rtype: ~azure.ai.projects.types.CreateAsyncResponse :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def pending_create_version( - self, name: str, version: str, model_version: Union[_models.ModelVersion, JSON, IO[bytes]], **kwargs: Any - ) -> _models.CreateAsyncResponse: - """Create a model version async. - Creates a model version asynchronously with blob content validation. Returns 202 Accepted with - a location header for polling the operation status. + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + model_version = { + "blobUri": "str", + "name": "str", + "version": "str", + "artifactProfile": { + "category": "str", + "signals": [ + "str" + ] + }, + "baseModel": "str", + "description": "str", + "id": "str", + "loraConfig": { + "alpha": 0, + "dropout": 0.0, + "rank": 0, + "targetModules": [ + "str" + ] + }, + "source": { + "jobId": "str", + "sourceType": "str" + }, + "tags": { + "str": "str" + }, + "warnings": [ + { + "code": "str", + "message": "str" + } + ], + "weightType": "str" + } - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param model_version: Model version to create. Is one of the following types: ModelVersion, - JSON, IO[bytes] Required. - :type model_version: ~azure.ai.projects.models.ModelVersion or JSON or IO[bytes] - :return: CreateAsyncResponse. The CreateAsyncResponse is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.CreateAsyncResponse - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 202 + response == { + "location": "str", + "operationResult": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13504,22 +20129,17 @@ def pending_create_version( _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.CreateAsyncResponse] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.CreateAsyncResponse] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(model_version, (IOBase, bytes)): - _content = model_version - else: - _content = json.dumps(model_version, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = model_version _request = build_beta_models_pending_create_version_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -13551,81 +20171,20 @@ def pending_create_version( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CreateAsyncResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: _models.ModelPendingUploadRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ModelPendingUploadResponse: - """Start a pending upload. - - Initiates a new pending upload or retrieves an existing one for the specified model version. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param pending_upload_request: Required. - :type pending_upload_request: ~azure.ai.projects.models.ModelPendingUploadRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse - :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.ModelPendingUploadResponse: - """Start a pending upload. - - Initiates a new pending upload or retrieves an existing one for the specified model version. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param pending_upload_request: 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: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload + @distributed_trace def pending_upload( - self, - name: str, - version: str, - pending_upload_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ModelPendingUploadResponse: + self, name: str, version: str, pending_upload_request: _types.ModelPendingUploadRequest, **kwargs: Any + ) -> _types.ModelPendingUploadResponse: """Start a pending upload. Initiates a new pending upload or retrieves an existing one for the specified model version. @@ -13635,40 +20194,35 @@ def pending_upload( :param version: Version of the model. Required. :type version: str :param pending_upload_request: 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: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse + :type pending_upload_request: ~azure.ai.projects.types.ModelPendingUploadRequest + :return: ModelPendingUploadResponse + :rtype: ~azure.ai.projects.types.ModelPendingUploadResponse :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def pending_upload( - self, - name: str, - version: str, - pending_upload_request: Union[_models.ModelPendingUploadRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.ModelPendingUploadResponse: - """Start a pending upload. + Example: + .. code-block:: python - Initiates a new pending upload or retrieves an existing one for the specified model version. + # JSON input template you can fill out and use as your body input. + pending_upload_request = { + "pendingUploadType": "str", + "connectionName": "str", + "pendingUploadId": "str" + } - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param pending_upload_request: Is one of the following types: ModelPendingUploadRequest, JSON, - IO[bytes] Required. - :type pending_upload_request: ~azure.ai.projects.models.ModelPendingUploadRequest or JSON or - IO[bytes] - :return: ModelPendingUploadResponse. The ModelPendingUploadResponse is compatible with - MutableMapping - :rtype: ~azure.ai.projects.models.ModelPendingUploadResponse - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + }, + "pendingUploadId": "str", + "pendingUploadType": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13681,22 +20235,17 @@ def pending_upload( _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.ModelPendingUploadResponse] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.ModelPendingUploadResponse] = 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 + _json = pending_upload_request _request = build_beta_models_pending_upload_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -13725,79 +20274,20 @@ def pending_upload( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ModelPendingUploadResponse, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: _models.ModelCredentialRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: - """Get model asset credentials. - - Retrieves temporary credentials for accessing the storage backing the specified model version. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param credential_request: Required. - :type credential_request: ~azure.ai.projects.models.ModelCredentialRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def get_credentials( - self, - name: str, - version: str, - credential_request: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: - """Get model asset credentials. - - Retrieves temporary credentials for accessing the storage backing the specified model version. - - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param credential_request: Required. - :type credential_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: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload + @distributed_trace def get_credentials( - self, - name: str, - version: str, - credential_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DatasetCredential: + self, name: str, version: str, credential_request: _types.ModelCredentialRequest, **kwargs: Any + ) -> _types.DatasetCredential: """Get model asset credentials. Retrieves temporary credentials for accessing the storage backing the specified model version. @@ -13807,37 +20297,30 @@ def get_credentials( :param version: Version of the model. Required. :type version: str :param credential_request: Required. - :type credential_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: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential + :type credential_request: ~azure.ai.projects.types.ModelCredentialRequest + :return: DatasetCredential + :rtype: ~azure.ai.projects.types.DatasetCredential :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def get_credentials( - self, - name: str, - version: str, - credential_request: Union[_models.ModelCredentialRequest, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.DatasetCredential: - """Get model asset credentials. + Example: + .. code-block:: python - Retrieves temporary credentials for accessing the storage backing the specified model version. + # JSON input template you can fill out and use as your body input. + credential_request = { + "blobUri": "str" + } - :param name: Name of the model. Required. - :type name: str - :param version: Version of the model. Required. - :type version: str - :param credential_request: Is one of the following types: ModelCredentialRequest, JSON, - IO[bytes] Required. - :type credential_request: ~azure.ai.projects.models.ModelCredentialRequest or JSON or IO[bytes] - :return: DatasetCredential. The DatasetCredential is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DatasetCredential - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "blobReference": { + "blobUri": "str", + "credential": { + "sasUri": "str", + "type": "SAS" + }, + "storageAccountArmId": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13850,22 +20333,17 @@ def get_credentials( _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.DatasetCredential] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.DatasetCredential] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(credential_request, (IOBase, bytes)): - _content = credential_request - else: - _content = json.dumps(credential_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = credential_request _request = build_beta_models_get_credentials_request( name=name, version=version, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -13894,7 +20372,10 @@ def get_credentials( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DatasetCredential, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13920,16 +20401,51 @@ 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.RedTeam: + def get(self, name: str, **kwargs: Any) -> _types.RedTeam: """Get a redteam. Retrieves the specified redteam and its configuration. :param name: Identifier of the red team run. Required. :type name: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam + :return: RedTeam + :rtype: ~azure.ai.projects.types.RedTeam :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureOpenAIModel": + red_team_target_config = { + "modelDeploymentName": "str", + "type": "AzureOpenAIModel" + } + + # response body for status code(s): 200 + response == { + "id": "str", + "target": red_team_target_config, + "applicationScenario": "str", + "attackStrategies": [ + "str" + ], + "displayName": "str", + "numTurns": 0, + "properties": { + "str": "str" + }, + "riskCategories": [ + "str" + ], + "simulationOnly": bool, + "status": "str", + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13942,7 +20458,7 @@ def get(self, name: str, **kwargs: Any) -> _models.RedTeam: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RedTeam] = kwargs.pop("cls", None) + cls: ClsType[_types.RedTeam] = kwargs.pop("cls", None) _request = build_beta_red_teams_get_request( name=name, @@ -13975,7 +20491,10 @@ def get(self, name: str, **kwargs: Any) -> _models.RedTeam: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RedTeam, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13983,19 +20502,54 @@ def get(self, name: str, **kwargs: Any) -> _models.RedTeam: return deserialized # type: ignore @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.RedTeam"]: + def list(self, **kwargs: Any) -> ItemPaged["_types.RedTeam"]: """List redteams. Returns the redteams available in the current project. :return: An iterator like instance of RedTeam - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.RedTeam] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.RedTeam] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "AzureOpenAIModel": + red_team_target_config = { + "modelDeploymentName": "str", + "type": "AzureOpenAIModel" + } + + # response body for status code(s): 200 + response == { + "id": "str", + "target": red_team_target_config, + "applicationScenario": "str", + "attackStrategies": [ + "str" + ], + "displayName": "str", + "numTurns": 0, + "properties": { + "str": "str" + }, + "riskCategories": [ + "str" + ], + "simulationOnly": bool, + "status": "str", + "tags": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RedTeam]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.RedTeam]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14047,10 +20601,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RedTeam], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -14072,68 +20623,84 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - @overload - def create( - self, red_team: _models.RedTeam, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RedTeam: + @distributed_trace + def create(self, red_team: _types.RedTeam, **kwargs: Any) -> _types.RedTeam: """Create a redteam run. Submits a new redteam run for execution with the provided configuration. :param red_team: Redteam to be run. Required. - :type red_team: ~azure.ai.projects.models.RedTeam - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam + :type red_team: ~azure.ai.projects.types.RedTeam + :return: RedTeam + :rtype: ~azure.ai.projects.types.RedTeam :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create(self, red_team: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.RedTeam: - """Create a redteam run. - - Submits a new redteam run for execution with the provided configuration. - :param red_team: Redteam to be run. Required. - :type red_team: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam - :raises ~azure.core.exceptions.HttpResponseError: - """ + Example: + .. code-block:: python - @overload - def create(self, red_team: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.RedTeam: - """Create a redteam run. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - Submits a new redteam run for execution with the provided configuration. + # JSON input template for discriminator value "AzureOpenAIModel": + red_team_target_config = { + "modelDeploymentName": "str", + "type": "AzureOpenAIModel" + } - :param red_team: Redteam to be run. Required. - :type red_team: 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: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template you can fill out and use as your body input. + red_team = { + "id": "str", + "target": red_team_target_config, + "applicationScenario": "str", + "attackStrategies": [ + "str" + ], + "displayName": "str", + "numTurns": 0, + "properties": { + "str": "str" + }, + "riskCategories": [ + "str" + ], + "simulationOnly": bool, + "status": "str", + "tags": { + "str": "str" + } + } - @distributed_trace - def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: Any) -> _models.RedTeam: - """Create a redteam run. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - Submits a new redteam run for execution with the provided configuration. + # JSON input template for discriminator value "AzureOpenAIModel": + red_team_target_config = { + "modelDeploymentName": "str", + "type": "AzureOpenAIModel" + } - :param red_team: Redteam to be run. Is one of the following types: RedTeam, JSON, IO[bytes] - Required. - :type red_team: ~azure.ai.projects.models.RedTeam or JSON or IO[bytes] - :return: RedTeam. The RedTeam is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.RedTeam - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 201 + response == { + "id": "str", + "target": red_team_target_config, + "applicationScenario": "str", + "attackStrategies": [ + "str" + ], + "displayName": "str", + "numTurns": 0, + "properties": { + "str": "str" + }, + "riskCategories": [ + "str" + ], + "simulationOnly": bool, + "status": "str", + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14146,20 +20713,15 @@ def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: An _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.RedTeam] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.RedTeam] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(red_team, (IOBase, bytes)): - _content = red_team - else: - _content = json.dumps(red_team, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = red_team _request = build_beta_red_teams_create_request( content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -14183,16 +20745,19 @@ def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: An except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RedTeam, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14225,10 +20790,10 @@ def create_or_update( content_type: str = "application/json", description: Optional[str] = None, enabled: Optional[bool] = None, - triggers: Optional[dict[str, _models.RoutineTrigger]] = None, - action: Optional[_models.RoutineAction] = None, + triggers: Optional[dict[str, _types.RoutineTrigger]] = None, + action: Optional[_types.RoutineAction] = None, **kwargs: Any - ) -> _models.Routine: + ) -> _types.Routine: """Create or update a routine. Creates a new routine or replaces an existing routine with the supplied definition. @@ -14244,38 +20809,60 @@ def create_or_update( :paramtype enabled: bool :keyword triggers: The triggers configured for the routine. In v1, exactly one trigger entry is supported. Default value is None. - :paramtype triggers: dict[str, ~azure.ai.projects.models.RoutineTrigger] + :paramtype triggers: dict[str, ~azure.ai.projects.types.RoutineTrigger] :keyword action: The action executed when the routine fires. Default value is None. - :paramtype action: ~azure.ai.projects.models.RoutineAction - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :paramtype action: ~azure.ai.projects.types.RoutineAction + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create_or_update( - self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Routine: - """Create or update a routine. + Example: + .. code-block:: python - Creates a new routine or replaces an existing routine with the supplied definition. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": - :param routine_name: The unique name of the routine. Required. - :type routine_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: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ @overload def create_or_update( - self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Routine: + self, + routine_name: str, + body: _types.CreateOrUpdateRoutineRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.Routine: """Create or update a routine. Creates a new routine or replaces an existing routine with the supplied definition. @@ -14283,47 +20870,183 @@ def create_or_update( :param routine_name: The unique name of the routine. Required. :type routine_name: str :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + :type body: ~azure.ai.projects.types.CreateOrUpdateRoutineRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # JSON input template you can fill out and use as your body input. + body = { + "action": routine_action, + "description": "str", + "enabled": bool, + "triggers": { + "str": routine_trigger + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ @distributed_trace def create_or_update( self, routine_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateOrUpdateRoutineRequest] = _Unset, *, description: Optional[str] = None, enabled: Optional[bool] = None, - triggers: Optional[dict[str, _models.RoutineTrigger]] = None, - action: Optional[_models.RoutineAction] = None, + triggers: Optional[dict[str, _types.RoutineTrigger]] = None, + action: Optional[_types.RoutineAction] = None, **kwargs: Any - ) -> _models.Routine: + ) -> _types.Routine: """Create or update a routine. Creates a new routine or replaces an existing routine with the supplied definition. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateOrUpdateRoutineRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateOrUpdateRoutineRequest :keyword description: A human-readable description of the routine. Default value is None. :paramtype description: str :keyword enabled: Whether the routine is enabled. Default value is None. :paramtype enabled: bool :keyword triggers: The triggers configured for the routine. In v1, exactly one trigger entry is supported. Default value is None. - :paramtype triggers: dict[str, ~azure.ai.projects.models.RoutineTrigger] + :paramtype triggers: dict[str, ~azure.ai.projects.types.RoutineTrigger] :keyword action: The action executed when the routine fires. Default value is None. - :paramtype action: ~azure.ai.projects.models.RoutineAction - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :paramtype action: ~azure.ai.projects.types.RoutineAction + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # JSON input template you can fill out and use as your body input. + body = { + "action": routine_action, + "description": "str", + "enabled": bool, + "triggers": { + "str": routine_trigger + } + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14337,23 +21060,23 @@ 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.Routine] = kwargs.pop("cls", None) + cls: ClsType[_types.Routine] = kwargs.pop("cls", None) if body is _Unset: body = {"action": action, "description": description, "enabled": enabled, "triggers": triggers} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_routines_create_or_update_request( routine_name=routine_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -14377,16 +21100,19 @@ def create_or_update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Routine, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14394,16 +21120,53 @@ def create_or_update( return deserialized # type: ignore @distributed_trace - def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: + def get(self, routine_name: str, **kwargs: Any) -> _types.Routine: """Get a routine. Retrieves the specified routine and its current configuration. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14416,7 +21179,7 @@ def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + cls: ClsType[_types.Routine] = kwargs.pop("cls", None) _request = build_beta_routines_get_request( routine_name=routine_name, @@ -14444,16 +21207,19 @@ def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Routine, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14461,16 +21227,53 @@ def get(self, routine_name: str, **kwargs: Any) -> _models.Routine: return deserialized # type: ignore @distributed_trace - def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: + def enable(self, routine_name: str, **kwargs: Any) -> _types.Routine: """Enable a routine. Enables the specified routine so it can be dispatched. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14483,7 +21286,7 @@ def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + cls: ClsType[_types.Routine] = kwargs.pop("cls", None) _request = build_beta_routines_enable_request( routine_name=routine_name, @@ -14511,16 +21314,19 @@ def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Routine, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14528,16 +21334,53 @@ def enable(self, routine_name: str, **kwargs: Any) -> _models.Routine: return deserialized # type: ignore @distributed_trace - def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: + def disable(self, routine_name: str, **kwargs: Any) -> _types.Routine: """Disable a routine. Disables the specified routine so it no longer runs. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :return: Routine. The Routine is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Routine + :return: Routine + :rtype: ~azure.ai.projects.types.Routine :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14550,7 +21393,7 @@ def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Routine] = kwargs.pop("cls", None) + cls: ClsType[_types.Routine] = kwargs.pop("cls", None) _request = build_beta_routines_disable_request( routine_name=routine_name, @@ -14578,16 +21421,19 @@ def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Routine, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14597,7 +21443,7 @@ def disable(self, routine_name: str, **kwargs: Any) -> _models.Routine: @distributed_trace def list( self, *, limit: Optional[int] = None, before: Optional[str] = None, order: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Routine"]: + ) -> ItemPaged["_types.Routine"]: """List routines. Returns the routines available in the current project. @@ -14611,13 +21457,50 @@ def list( None. :paramtype order: str :return: An iterator like instance of Routine - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Routine] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.Routine] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_action = { + "type": "invoke_agent_invocations_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "input": {}, + "session_id": "str" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_action = { + "type": "invoke_agent_responses_api", + "agent_endpoint_id": "str", + "agent_name": "str", + "conversation": "str", + "input": {} + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "action": routine_action, + "created_at": "2020-02-20 00:00:00", + "description": "str", + "name": "str", + "triggers": { + "str": routine_trigger + }, + "updated_at": "2020-02-20 00:00:00" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Routine]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Routine]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14646,10 +21529,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Routine], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -14665,9 +21545,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -14720,9 +21600,9 @@ def delete(self, routine_name: str, **kwargs: Any) -> None: # pylint: disable=i 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -14739,7 +21619,7 @@ def list_runs( before: Optional[str] = None, order: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.RoutineRun"]: + ) -> ItemPaged["_types.RoutineRun"]: """List prior runs for a routine. Returns prior runs recorded for the specified routine. @@ -14758,13 +21638,45 @@ def list_runs( None. :paramtype order: str :return: An iterator like instance of RoutineRun - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.RoutineRun] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.RoutineRun] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "action_correlation_id": "str", + "action_type": "str", + "agent_endpoint_id": "str", + "agent_id": "str", + "attempt_source": "str", + "conversation_id": "str", + "dispatch_id": "str", + "ended_at": "2020-02-20 00:00:00", + "error_message": "str", + "error_status_code": 0, + "error_type": "str", + "phase": "str", + "response_id": "str", + "scheduled_fire_at": "2020-02-20 00:00:00", + "session_id": "str", + "started_at": "2020-02-20 00:00:00", + "status": "str", + "task_id": "str", + "trigger_event_payload": { + "str": {} + }, + "trigger_name": "str", + "trigger_type": "str", + "triggered_at": "2020-02-20 00:00:00" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RoutineRun]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.RoutineRun]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14795,10 +21707,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RoutineRun], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -14814,9 +21723,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -14830,9 +21739,9 @@ def dispatch( routine_name: str, *, content_type: str = "application/json", - payload: Optional[_models.RoutineDispatchPayload] = None, + payload: Optional[_types.RoutineDispatchPayload] = None, **kwargs: Any - ) -> _models.DispatchRoutineResult: + ) -> _types.DispatchRoutineResult: """Queue an asynchronous routine dispatch. Queues an asynchronous dispatch for the specified routine. @@ -14844,16 +21753,31 @@ def dispatch( :paramtype content_type: str :keyword payload: A direct action-input override sent downstream when testing a routine. Default value is None. - :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload - :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResult + :paramtype payload: ~azure.ai.projects.types.RoutineDispatchPayload + :return: DispatchRoutineResult + :rtype: ~azure.ai.projects.types.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "action_correlation_id": "str", + "dispatch_id": "str", + "task_id": "str" + } """ @overload def dispatch( - self, routine_name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DispatchRoutineResult: + self, + routine_name: str, + body: _types.DispatchRoutineAsyncRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.DispatchRoutineResult: """Queue an asynchronous routine dispatch. Queues an asynchronous dispatch for the specified routine. @@ -14861,58 +21785,98 @@ def dispatch( :param routine_name: The unique name of the routine. Required. :type routine_name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.DispatchRoutineAsyncRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResult + :return: DispatchRoutineResult + :rtype: ~azure.ai.projects.types.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def dispatch( - self, routine_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DispatchRoutineResult: - """Queue an asynchronous routine dispatch. + Example: + .. code-block:: python - Queues an asynchronous dispatch for the specified routine. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param routine_name: The unique name of the routine. Required. - :type routine_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: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResult - :raises ~azure.core.exceptions.HttpResponseError: + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_dispatch_payload = { + "input": {}, + "type": "invoke_agent_invocations_api" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_dispatch_payload = { + "input": {}, + "type": "invoke_agent_responses_api" + } + + # JSON input template you can fill out and use as your body input. + body = { + "payload": routine_dispatch_payload + } + + # response body for status code(s): 200 + response == { + "action_correlation_id": "str", + "dispatch_id": "str", + "task_id": "str" + } """ @distributed_trace def dispatch( self, routine_name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.DispatchRoutineAsyncRequest] = _Unset, *, - payload: Optional[_models.RoutineDispatchPayload] = None, + payload: Optional[_types.RoutineDispatchPayload] = None, **kwargs: Any - ) -> _models.DispatchRoutineResult: + ) -> _types.DispatchRoutineResult: """Queue an asynchronous routine dispatch. Queues an asynchronous dispatch for the specified routine. :param routine_name: The unique name of the routine. Required. :type routine_name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a DispatchRoutineAsyncRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.DispatchRoutineAsyncRequest :keyword payload: A direct action-input override sent downstream when testing a routine. Default value is None. - :paramtype payload: ~azure.ai.projects.models.RoutineDispatchPayload - :return: DispatchRoutineResult. The DispatchRoutineResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DispatchRoutineResult + :paramtype payload: ~azure.ai.projects.types.RoutineDispatchPayload + :return: DispatchRoutineResult + :rtype: ~azure.ai.projects.types.DispatchRoutineResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "invoke_agent_invocations_api": + routine_dispatch_payload = { + "input": {}, + "type": "invoke_agent_invocations_api" + } + + # JSON input template for discriminator value "invoke_agent_responses_api": + routine_dispatch_payload = { + "input": {}, + "type": "invoke_agent_responses_api" + } + + # JSON input template you can fill out and use as your body input. + body = { + "payload": routine_dispatch_payload + } + + # response body for status code(s): 200 + response == { + "action_correlation_id": "str", + "dispatch_id": "str", + "task_id": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14926,23 +21890,23 @@ def dispatch( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DispatchRoutineResult] = kwargs.pop("cls", None) + cls: ClsType[_types.DispatchRoutineResult] = kwargs.pop("cls", None) if body is _Unset: body = {"payload": payload} 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_routines_dispatch_request( routine_name=routine_name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -14966,16 +21930,19 @@ def dispatch( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DispatchRoutineResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15051,16 +22018,81 @@ def delete(self, schedule_id: str, **kwargs: Any) -> None: # pylint: disable=in return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: + def get(self, schedule_id: str, **kwargs: Any) -> _types.Schedule: """Get a schedule. Retrieves the specified schedule resource. :param schedule_id: Identifier of the schedule. Required. :type schedule_id: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :return: Schedule + :rtype: ~azure.ai.projects.types.Schedule :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } + + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } + + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "id": "str", + "systemData": { + "str": "str" + }, + "task": schedule_task, + "trigger": trigger, + "description": "str", + "displayName": "str", + "properties": { + "str": "str" + }, + "provisioningStatus": "str", + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15073,7 +22105,7 @@ def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) + cls: ClsType[_types.Schedule] = kwargs.pop("cls", None) _request = build_beta_schedules_get_request( schedule_id=schedule_id, @@ -15106,7 +22138,10 @@ def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Schedule, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15115,12 +22150,8 @@ def get(self, schedule_id: str, **kwargs: Any) -> _models.Schedule: @distributed_trace def list( - self, - *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, - enabled: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Schedule"]: + self, *, type: Optional[types.ScheduleTaskType] = None, enabled: Optional[bool] = None, **kwargs: Any + ) -> ItemPaged["_types.Schedule"]: """List schedules. Returns schedules that match the supplied type and enabled filters. @@ -15131,13 +22162,78 @@ def list( :keyword enabled: Filter by the enabled status. Default value is None. :paramtype enabled: bool :return: An iterator like instance of Schedule - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Schedule] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.Schedule] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } + + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } + + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } + + # response body for status code(s): 200 + response == { + "enabled": bool, + "id": "str", + "systemData": { + "str": "str" + }, + "task": schedule_task, + "trigger": trigger, + "description": "str", + "displayName": "str", + "properties": { + "str": "str" + }, + "provisioningStatus": "str", + "tags": { + "str": "str" + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Schedule]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.Schedule]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15191,10 +22287,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Schedule], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -15216,10 +22309,8 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - @overload - def create_or_update( - self, schedule_id: str, schedule: _models.Schedule, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: + @distributed_trace + def create_or_update(self, schedule_id: str, schedule: _types.Schedule, **kwargs: Any) -> _types.Schedule: """Create or update a schedule. Creates a new schedule or updates an existing schedule with the supplied definition. @@ -15227,71 +22318,179 @@ def create_or_update( :param schedule_id: Identifier of the schedule. Required. :type schedule_id: str :param schedule: The resource instance. Required. - :type schedule: ~azure.ai.projects.models.Schedule - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule + :type schedule: ~azure.ai.projects.types.Schedule + :return: Schedule + :rtype: ~azure.ai.projects.types.Schedule :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - def create_or_update( - self, schedule_id: str, schedule: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update a schedule. + Example: + .. code-block:: python - Creates a new schedule or updates an existing schedule with the supplied definition. + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } - @overload - def create_or_update( - self, schedule_id: str, schedule: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Schedule: - """Create or update a schedule. + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } - Creates a new schedule or updates an existing schedule with the supplied definition. + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Required. - :type schedule: 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: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: - """ + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } - @distributed_trace - def create_or_update( - self, schedule_id: str, schedule: Union[_models.Schedule, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Schedule: - """Create or update a schedule. + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } - Creates a new schedule or updates an existing schedule with the supplied definition. + # JSON input template you can fill out and use as your body input. + schedule = { + "enabled": bool, + "id": "str", + "systemData": { + "str": "str" + }, + "task": schedule_task, + "trigger": trigger, + "description": "str", + "displayName": "str", + "properties": { + "str": "str" + }, + "provisioningStatus": "str", + "tags": { + "str": "str" + } + } - :param schedule_id: Identifier of the schedule. Required. - :type schedule_id: str - :param schedule: The resource instance. Is one of the following types: Schedule, JSON, - IO[bytes] Required. - :type schedule: ~azure.ai.projects.models.Schedule or JSON or IO[bytes] - :return: Schedule. The Schedule is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.Schedule - :raises ~azure.core.exceptions.HttpResponseError: + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } + + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } + + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "Cron": + trigger = { + "expression": "str", + "type": "Cron", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "OneTime": + trigger = { + "triggerAt": "2020-02-20 00:00:00", + "type": "OneTime", + "timeZone": "str" + } + + # JSON input template for discriminator value "Recurrence": + trigger = { + "interval": 0, + "schedule": recurrence_schedule, + "type": "Recurrence", + "endTime": "2020-02-20 00:00:00", + "startTime": "2020-02-20 00:00:00", + "timeZone": "str" + } + + # JSON input template for discriminator value "Daily": + recurrence_schedule = { + "hours": [ + 0 + ], + "type": "Daily" + } + + # JSON input template for discriminator value "Hourly": + recurrence_schedule = { + "type": "Hourly" + } + + # response body for status code(s): 201, 200 + response == { + "enabled": bool, + "id": "str", + "systemData": { + "str": "str" + }, + "task": schedule_task, + "trigger": trigger, + "description": "str", + "displayName": "str", + "properties": { + "str": "str" + }, + "provisioningStatus": "str", + "tags": { + "str": "str" + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15304,21 +22503,16 @@ def create_or_update( _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.Schedule] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.Schedule] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(schedule, (IOBase, bytes)): - _content = schedule - else: - _content = json.dumps(schedule, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _json = schedule _request = build_beta_schedules_create_or_update_request( schedule_id=schedule_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -15347,7 +22541,10 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Schedule, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15355,7 +22552,7 @@ def create_or_update( return deserialized # type: ignore @distributed_trace - def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.ScheduleRun: + def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _types.ScheduleRun: """Get a schedule run. Retrieves the specified run for a schedule. @@ -15364,9 +22561,24 @@ def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.Sched :type schedule_id: str :param run_id: The unique identifier of the schedule run. Required. :type run_id: str - :return: ScheduleRun. The ScheduleRun is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.ScheduleRun + :return: ScheduleRun + :rtype: ~azure.ai.projects.types.ScheduleRun :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "properties": { + "str": "str" + }, + "scheduleId": "str", + "success": bool, + "error": "str", + "triggerTime": "2020-02-20 00:00:00" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15379,7 +22591,7 @@ def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.Sched _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ScheduleRun] = kwargs.pop("cls", None) + cls: ClsType[_types.ScheduleRun] = kwargs.pop("cls", None) _request = build_beta_schedules_get_run_request( schedule_id=schedule_id, @@ -15408,16 +22620,19 @@ def get_run(self, schedule_id: str, run_id: str, **kwargs: Any) -> _models.Sched except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ScheduleRun, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15429,10 +22644,10 @@ def list_runs( self, schedule_id: str, *, - type: Optional[Union[str, _models.ScheduleTaskType]] = None, + type: Optional[types.ScheduleTaskType] = None, enabled: Optional[bool] = None, **kwargs: Any - ) -> ItemPaged["_models.ScheduleRun"]: + ) -> ItemPaged["_types.ScheduleRun"]: """List schedule runs. Returns schedule runs that match the supplied filters. @@ -15445,13 +22660,28 @@ def list_runs( :keyword enabled: Filter by the enabled status. Default value is None. :paramtype enabled: bool :return: An iterator like instance of ScheduleRun - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.ScheduleRun] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.ScheduleRun] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", + "properties": { + "str": "str" + }, + "scheduleId": "str", + "success": bool, + "error": "str", + "triggerTime": "2020-02-20 00:00:00" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ScheduleRun]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.ScheduleRun]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15506,10 +22736,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ScheduleRun], - deserialized.get("value", []), - ) + list_of_elem = deserialized.get("value", []) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -15550,16 +22777,29 @@ 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.SkillDetails: + def get(self, name: str, **kwargs: Any) -> _types.SkillDetails: """Retrieve a skill. Retrieves the specified skill and its current configuration. :param name: The unique name of the skill. Required. :type name: str - :return: SkillDetails. The SkillDetails is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.SkillDetails + :return: SkillDetails + :rtype: ~azure.ai.projects.types.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15572,7 +22812,7 @@ 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[_types.SkillDetails] = kwargs.pop("cls", None) _request = build_beta_skills_get_request( name=name, @@ -15600,16 +22840,19 @@ def get(self, name: str, **kwargs: Any) -> _models.SkillDetails: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15621,10 +22864,10 @@ def list( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.SkillDetails"]: + ) -> ItemPaged["_types.SkillDetails"]: """List skills. Returns the skills available in the current project. @@ -15644,13 +22887,26 @@ def 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] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.SkillDetails] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SkillDetails]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.SkillDetails]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15679,10 +22935,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], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -15698,9 +22951,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -15711,7 +22964,7 @@ def get_next(_continuation_token=None): @overload def update( self, name: str, *, default_version: str, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: + ) -> _types.SkillDetails: """Update a skill. Modifies the specified skill's configuration. @@ -15724,15 +22977,28 @@ def update( :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 + :return: SkillDetails + :rtype: ~azure.ai.projects.types.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ @overload def update( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillDetails: + self, name: str, body: _types.UpdateSkillRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _types.SkillDetails: """Update a skill. Modifies the specified skill's configuration. @@ -15740,53 +23006,74 @@ def update( :param name: The name of the skill to update. Required. :type name: str :param body: Required. - :type body: JSON + :type body: ~azure.ai.projects.types.UpdateSkillRequest :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 + :return: SkillDetails + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python - Modifies the specified skill's configuration. + # JSON input template you can fill out and use as your body input. + body = { + "default_version": "str" + } - :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: + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ @distributed_trace def update( - self, name: str, body: Union[JSON, IO[bytes]] = _Unset, *, default_version: str = _Unset, **kwargs: Any - ) -> _models.SkillDetails: + self, + name: str, + body: Union[JSON, _types.UpdateSkillRequest] = _Unset, + *, + default_version: str = _Unset, + **kwargs: Any + ) -> _types.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: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a UpdateSkillRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.UpdateSkillRequest :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 + :return: SkillDetails + :rtype: ~azure.ai.projects.types.SkillDetails :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "default_version": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "default_version": "str", + "description": "str", + "id": "str", + "latest_version": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15800,7 +23087,7 @@ def update( _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) + cls: ClsType[_types.SkillDetails] = kwargs.pop("cls", None) if body is _Unset: if default_version is _Unset: @@ -15808,17 +23095,17 @@ def update( 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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_skills_update_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -15842,16 +23129,19 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SkillDetails, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15859,16 +23149,26 @@ def update( return deserialized # type: ignore @distributed_trace - def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: + def delete(self, name: str, **kwargs: Any) -> _types.DeleteSkillResult: """Delete a skill. Removes the specified skill and its associated versions. :param name: The unique name of the skill. Required. :type name: str - :return: DeleteSkillResult. The DeleteSkillResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.DeleteSkillResult + :return: DeleteSkillResult + :rtype: ~azure.ai.projects.types.DeleteSkillResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "id": "str", + "name": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15881,7 +23181,7 @@ 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[_types.DeleteSkillResult] = kwargs.pop("cls", None) _request = build_beta_skills_delete_request( name=name, @@ -15909,16 +23209,19 @@ def delete(self, name: str, **kwargs: Any) -> _models.DeleteSkillResult: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15931,10 +23234,10 @@ def create( name: str, *, content_type: str = "application/json", - inline_content: Optional[_models.SkillInlineContent] = None, + inline_content: Optional[_types.SkillInlineContent] = None, default: Optional[bool] = None, **kwargs: Any - ) -> _models.SkillVersion: + ) -> _types.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. @@ -15946,18 +23249,36 @@ def create( :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 + :paramtype inline_content: ~azure.ai.projects.types.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 + :return: SkillVersion + :rtype: ~azure.ai.projects.types.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ @overload def create( - self, name: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SkillVersion: + self, + name: str, + body: _types.CreateSkillVersionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _types.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. @@ -15965,61 +23286,101 @@ def create( :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 + :type body: ~azure.ai.projects.types.CreateSkillVersionRequest :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 + :return: SkillVersion + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "default": bool, + "inline_content": { + "description": "str", + "instructions": "str", + "allowed_tools": [ + "str" + ], + "compatibility": "str", + "license": "str", + "metadata": { + "str": "str" + } + } + } - :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: + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ @distributed_trace def create( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types.CreateSkillVersionRequest] = _Unset, *, - inline_content: Optional[_models.SkillInlineContent] = None, + inline_content: Optional[_types.SkillInlineContent] = None, default: Optional[bool] = None, **kwargs: Any - ) -> _models.SkillVersion: + ) -> _types.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: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is either a JSON type or a CreateSkillVersionRequest type. Required. + :type body: JSON or ~azure.ai.projects.types.CreateSkillVersionRequest :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 + :paramtype inline_content: ~azure.ai.projects.types.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 + :return: SkillVersion + :rtype: ~azure.ai.projects.types.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "default": bool, + "inline_content": { + "description": "str", + "instructions": "str", + "allowed_tools": [ + "str" + ], + "compatibility": "str", + "license": "str", + "metadata": { + "str": "str" + } + } + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16033,23 +23394,23 @@ def create( _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) + cls: ClsType[_types.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 + _json = None + if isinstance(body, MutableMapping): + _json = body + elif isinstance(body, MutableMapping): + _json = body _request = build_beta_skills_create_request( name=name, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -16073,41 +23434,29 @@ def create( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload + @distributed_trace 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: + self, name: str, content: _types.CreateSkillVersionFromFilesBody, **kwargs: Any + ) -> _types.SkillVersion: """Create a skill version from uploaded files. Creates a new version of a skill from uploaded files via multipart form data. @@ -16115,27 +23464,31 @@ def create_from_files(self, name: str, content: JSON, **kwargs: Any) -> _models. :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 + :type content: ~azure.ai.projects.types.CreateSkillVersionFromFilesBody + :return: SkillVersion + :rtype: ~azure.ai.projects.types.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: - """ - @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. + Example: + .. code-block:: python - Creates a new version of a skill from uploaded files via multipart form data. + # JSON input template you can fill out and use as your body input. + content = { + "files": [ + filetype + ], + "default": bool + } - :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 - :raises ~azure.core.exceptions.HttpResponseError: + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16148,9 +23501,11 @@ def create_from_files( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) + cls: ClsType[_types.SkillVersion] = kwargs.pop("cls", None) - _body = content.as_dict() if isinstance(content, _Model) else content + if not isinstance(content, MutableMapping): + raise TypeError("content must be a mapping") + _body = content _file_fields: list[str] = ["files"] _data_fields: list[str] = ["default"] _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) @@ -16182,16 +23537,19 @@ def create_from_files( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16204,10 +23562,10 @@ def list_versions( name: str, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.SkillVersion"]: + ) -> ItemPaged["_types.SkillVersion"]: """List skill versions. Returns the available versions for the specified skill. @@ -16229,13 +23587,26 @@ def list_versions( Default value is None. :paramtype before: str :return: An iterator like instance of SkillVersion - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.SkillVersion] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.SkillVersion] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SkillVersion]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.SkillVersion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16265,10 +23636,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], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -16284,9 +23652,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -16295,7 +23663,7 @@ 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.SkillVersion: + def get_version(self, name: str, version: str, **kwargs: Any) -> _types.SkillVersion: """Retrieve a specific version of a skill. Retrieves the specified version of a skill by name and version identifier. @@ -16304,9 +23672,22 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVe :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 + :return: SkillVersion + :rtype: ~azure.ai.projects.types.SkillVersion :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "description": "str", + "id": "str", + "name": "str", + "skill_id": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16319,7 +23700,7 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVe _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SkillVersion] = kwargs.pop("cls", None) + cls: ClsType[_types.SkillVersion] = kwargs.pop("cls", None) _request = build_beta_skills_get_version_request( name=name, @@ -16348,16 +23729,19 @@ def get_version(self, name: str, version: str, **kwargs: Any) -> _models.SkillVe except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16415,9 +23799,9 @@ def download(self, name: str, **kwargs: Any) -> Iterator[bytes]: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -16485,9 +23869,9 @@ def download_version(self, name: str, version: str, **kwargs: Any) -> Iterator[b except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -16502,7 +23886,7 @@ def download_version(self, name: str, version: str, **kwargs: Any) -> Iterator[b return deserialized # type: ignore @distributed_trace - def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.DeleteSkillVersionResult: + def delete_version(self, name: str, version: str, **kwargs: Any) -> _types.DeleteSkillVersionResult: """Delete a specific version of a skill. Removes the specified version of a skill. @@ -16511,10 +23895,20 @@ def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.Dele :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 + :return: DeleteSkillVersionResult + :rtype: ~azure.ai.projects.types.DeleteSkillVersionResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "deleted": bool, + "id": "str", + "name": "str", + "version": "str" + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16527,7 +23921,7 @@ def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.Dele _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DeleteSkillVersionResult] = kwargs.pop("cls", None) + cls: ClsType[_types.DeleteSkillVersionResult] = kwargs.pop("cls", None) _request = build_beta_skills_delete_version_request( name=name, @@ -16556,16 +23950,19 @@ def delete_version(self, name: str, version: str, **kwargs: Any) -> _models.Dele except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DeleteSkillVersionResult, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16591,16 +23988,104 @@ def __init__(self, *args, **kwargs) -> None: 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: + def get_generation_job(self, job_id: str, **kwargs: Any) -> _types.DataGenerationJob: """Get a data generation job. Retrieves the specified data generation job and its current status. :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: DataGenerationJob + :rtype: ~azure.ai.projects.types.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } + + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16613,7 +24098,7 @@ 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[_types.DataGenerationJob] = kwargs.pop("cls", None) _request = build_beta_datasets_get_generation_job_request( job_id=job_id, @@ -16641,9 +24126,9 @@ def get_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerati except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -16653,7 +24138,10 @@ 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()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -16665,10 +24153,10 @@ def list_generation_jobs( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.DataGenerationJob"]: + ) -> ItemPaged["_types.DataGenerationJob"]: """List data generation jobs. Returns a list of data generation jobs. @@ -16688,13 +24176,101 @@ def list_generation_jobs( Default value is None. :paramtype before: str :return: An iterator like instance of DataGenerationJob - :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DataGenerationJob] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.DataGenerationJob] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } + + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DataGenerationJob]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.DataGenerationJob]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16723,10 +24299,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], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -16742,9 +24315,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -16752,100 +24325,195 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) - @overload + @distributed_trace def create_generation_job( - self, - job: _models.DataGenerationJob, - *, - operation_id: Optional[str] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DataGenerationJob: + self, job: _types.DataGenerationJob, *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _types.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 + :type job: ~azure.ai.projects.types.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 + :return: DataGenerationJob + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } - :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: - """ + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } - @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. + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } - Submits a new data generation job for asynchronous execution. + # JSON input template you can fill out and use as your body input. + job = { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } - :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: - """ + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } - @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. + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } - Submits a new data generation job for asynchronous execution. + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } - :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: + # response body for status code(s): 201 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16858,21 +24526,16 @@ def create_generation_job( _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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.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 + _json = job _request = build_beta_datasets_create_generation_job_request( operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -16896,9 +24559,9 @@ def create_generation_job( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -16909,7 +24572,10 @@ def create_generation_job( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -16917,16 +24583,104 @@ def create_generation_job( return deserialized # type: ignore @distributed_trace - def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGenerationJob: + def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _types.DataGenerationJob: """Cancel a data generation job. Cancels the specified data generation job if it is still in progress. :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: DataGenerationJob + :rtype: ~azure.ai.projects.types.DataGenerationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "simple_qna": + data_generation_job_options = { + "max_samples": 0, + "type": "simple_qna", + "model_options": { + "model": "str" + }, + "question_types": [ + "str" + ], + "train_split": 0.0 + } + + # JSON input template for discriminator value "tool_use": + data_generation_job_options = { + "max_samples": 0, + "type": "tool_use", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # JSON input template for discriminator value "traces": + data_generation_job_options = { + "max_samples": 0, + "type": "traces", + "model_options": { + "model": "str" + }, + "train_split": 0.0 + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "finished_at": "2020-02-20 00:00:00", + "inputs": { + "name": "str", + "options": data_generation_job_options, + "scenario": "str", + "sources": [ + data_generation_job_source + ], + "output_options": { + "description": "str", + "name": "str", + "tags": { + "str": "str" + } + } + }, + "result": { + "generated_samples": 0, + "outputs": [ + data_generation_job_output + ], + "token_usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } + } + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16939,7 +24693,7 @@ 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[_types.DataGenerationJob] = kwargs.pop("cls", None) _request = build_beta_datasets_cancel_generation_job_request( job_id=job_id, @@ -16967,16 +24721,19 @@ def cancel_generation_job(self, job_id: str, **kwargs: Any) -> _models.DataGener except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DataGenerationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17030,9 +24787,9 @@ def delete_generation_job( # 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -17057,100 +24814,234 @@ 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 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 + @distributed_trace def create_optimization_job( - self, job: JSON, *, operation_id: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.OptimizationJob: + self, job: _types.OptimizationJob, *, operation_id: Optional[str] = None, **kwargs: Any + ) -> _types.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 + :type job: ~azure.ai.projects.types.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 + :return: OptimizationJob + :rtype: ~azure.ai.projects.types.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. + Example: + .. code-block:: python + + # The input is polymorphic. The following are possible polymorphic inputs based off + discriminator "type": + + # JSON input template for discriminator value "inline": + optimization_dataset_input = { + "items": [ + { + "criteria": [ + { + "instruction": "str", + "name": "str" + } + ], + "desired_num_turns": 0, + "ground_truth": "str", + "query": "str" + } + ], + "type": "inline" + } - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. + # JSON input template for discriminator value "reference": + optimization_dataset_input = { + "name": "str", + "type": "reference", + "version": "str" + } - :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: - """ + # JSON input template you can fill out and use as your body input. + job = { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "inputs": { + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "evaluators": [ + { + "name": "str", + "version": "str" + } + ], + "train_dataset": optimization_dataset_input, + "options": { + "eval_model": "str", + "evaluation_level": "str", + "max_candidates": 0, + "optimization_config": { + "str": {} + }, + "optimization_model": "str" + }, + "validation_dataset": optimization_dataset_input + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + }, + "result": { + "baseline": "str", + "best": "str", + "candidates": [ + { + "avg_score": 0.0, + "avg_tokens": 0.0, + "name": "str", + "candidate_id": "str", + "eval_id": "str", + "eval_run_id": "str", + "mutations": { + "str": {} + }, + "promotion": { + "agent_name": "str", + "agent_version": "str", + "promoted_at": "2020-02-20 00:00:00" + } + } + ] + }, + "warnings": [ + "str" + ] + } - @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. + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "inline": + optimization_dataset_input = { + "items": [ + { + "criteria": [ + { + "instruction": "str", + "name": "str" + } + ], + "desired_num_turns": 0, + "ground_truth": "str", + "query": "str" + } + ], + "type": "inline" + } - Create an optimization job. Returns 201 with the queued job. Honours ``Operation-Id`` for - idempotent retry. + # JSON input template for discriminator value "reference": + optimization_dataset_input = { + "name": "str", + "type": "reference", + "version": "str" + } - :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: + # response body for status code(s): 201 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "inputs": { + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "evaluators": [ + { + "name": "str", + "version": "str" + } + ], + "train_dataset": optimization_dataset_input, + "options": { + "eval_model": "str", + "evaluation_level": "str", + "max_candidates": 0, + "optimization_config": { + "str": {} + }, + "optimization_model": "str" + }, + "validation_dataset": optimization_dataset_input + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + }, + "result": { + "baseline": "str", + "best": "str", + "candidates": [ + { + "avg_score": 0.0, + "avg_tokens": 0.0, + "name": "str", + "candidate_id": "str", + "eval_id": "str", + "eval_run_id": "str", + "mutations": { + "str": {} + }, + "promotion": { + "agent_name": "str", + "agent_version": "str", + "promoted_at": "2020-02-20 00:00:00" + } + } + ] + }, + "warnings": [ + "str" + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17163,21 +25054,16 @@ def create_optimization_job( _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.OptimizationJob] = kwargs.pop("cls", None) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_types.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 + _json = job _request = build_beta_agents_create_optimization_job_request( operation_id=operation_id, content_type=content_type, api_version=self._config.api_version, - content=_content, + json=_json, headers=_headers, params=_params, ) @@ -17201,9 +25087,9 @@ def create_optimization_job( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -17214,7 +25100,10 @@ def create_optimization_job( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -17222,16 +25111,123 @@ def create_optimization_job( return deserialized # type: ignore @distributed_trace - def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + def get_optimization_job(self, job_id: str, **kwargs: Any) -> _types.OptimizationJob: """Get info about an agent optimization job. Get an optimization job by id. :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 + :return: OptimizationJob + :rtype: ~azure.ai.projects.types.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "inline": + optimization_dataset_input = { + "items": [ + { + "criteria": [ + { + "instruction": "str", + "name": "str" + } + ], + "desired_num_turns": 0, + "ground_truth": "str", + "query": "str" + } + ], + "type": "inline" + } + + # JSON input template for discriminator value "reference": + optimization_dataset_input = { + "name": "str", + "type": "reference", + "version": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "inputs": { + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "evaluators": [ + { + "name": "str", + "version": "str" + } + ], + "train_dataset": optimization_dataset_input, + "options": { + "eval_model": "str", + "evaluation_level": "str", + "max_candidates": 0, + "optimization_config": { + "str": {} + }, + "optimization_model": "str" + }, + "validation_dataset": optimization_dataset_input + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + }, + "result": { + "baseline": "str", + "best": "str", + "candidates": [ + { + "avg_score": 0.0, + "avg_tokens": 0.0, + "name": "str", + "candidate_id": "str", + "eval_id": "str", + "eval_run_id": "str", + "mutations": { + "str": {} + }, + "promotion": { + "agent_name": "str", + "agent_version": "str", + "promoted_at": "2020-02-20 00:00:00" + } + } + ] + }, + "warnings": [ + "str" + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17244,7 +25240,7 @@ def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimizati _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.OptimizationJob] = kwargs.pop("cls", None) + cls: ClsType[_types.OptimizationJob] = kwargs.pop("cls", None) _request = build_beta_agents_get_optimization_job_request( job_id=job_id, @@ -17272,9 +25268,9 @@ def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimizati except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -17284,7 +25280,10 @@ def get_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimizati if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.OptimizationJob, response.json()) + if response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -17296,12 +25295,12 @@ def list_optimization_jobs( self, *, limit: Optional[int] = None, - order: Optional[Union[str, _models.PageOrder]] = None, + order: Optional[types.PageOrder] = None, before: Optional[str] = None, - status: Optional[Union[str, _models.JobStatus]] = None, + status: Optional[types.JobStatus] = None, agent_name: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.OptimizationJobListItem"]: + ) -> ItemPaged["_types.OptimizationJobListItem"]: """Returns a list of agent optimization jobs. List optimization jobs. Supports cursor pagination and optional status / agent_name filters. @@ -17326,13 +25325,48 @@ def list_optimization_jobs( :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] + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.types.OptimizationJobListItem] :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + } + } """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.OptimizationJobListItem]] = kwargs.pop("cls", None) + cls: ClsType[List[_types.OptimizationJobListItem]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17363,10 +25397,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.OptimizationJobListItem], - deserialized.get("data", []), - ) + list_of_elem = 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) @@ -17382,9 +25413,9 @@ def get_next(_continuation_token=None): 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) @@ -17393,7 +25424,7 @@ def get_next(_continuation_token=None): return ItemPaged(get_next, extract_data) @distributed_trace - def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.OptimizationJob: + def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _types.OptimizationJob: """Cancels an agent optimization job. Request cancellation of a running or queued job. Returns an error if the job is already in a @@ -17401,9 +25432,116 @@ def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimiz :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 + :return: OptimizationJob + :rtype: ~azure.ai.projects.types.OptimizationJob :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # The response is polymorphic. The following are possible polymorphic responses based + off discriminator "type": + + # JSON input template for discriminator value "inline": + optimization_dataset_input = { + "items": [ + { + "criteria": [ + { + "instruction": "str", + "name": "str" + } + ], + "desired_num_turns": 0, + "ground_truth": "str", + "query": "str" + } + ], + "type": "inline" + } + + # JSON input template for discriminator value "reference": + optimization_dataset_input = { + "name": "str", + "type": "reference", + "version": "str" + } + + # response body for status code(s): 200 + response == { + "created_at": "2020-02-20 00:00:00", + "id": "str", + "status": "str", + "updated_at": "2020-02-20 00:00:00", + "error": { + "code": "str", + "message": "str", + "additionalInfo": { + "str": {} + }, + "debugInfo": { + "str": {} + }, + "details": [ + ... + ], + "param": "str", + "type": "str" + }, + "inputs": { + "agent": { + "agent_name": "str", + "agent_version": "str" + }, + "evaluators": [ + { + "name": "str", + "version": "str" + } + ], + "train_dataset": optimization_dataset_input, + "options": { + "eval_model": "str", + "evaluation_level": "str", + "max_candidates": 0, + "optimization_config": { + "str": {} + }, + "optimization_model": "str" + }, + "validation_dataset": optimization_dataset_input + }, + "progress": { + "best_score": 0.0, + "candidates_completed": 0, + "elapsed_seconds": 0.0 + }, + "result": { + "baseline": "str", + "best": "str", + "candidates": [ + { + "avg_score": 0.0, + "avg_tokens": 0.0, + "name": "str", + "candidate_id": "str", + "eval_id": "str", + "eval_run_id": "str", + "mutations": { + "str": {} + }, + "promotion": { + "agent_name": "str", + "agent_version": "str", + "promoted_at": "2020-02-20 00:00:00" + } + } + ] + }, + "warnings": [ + "str" + ] + } """ error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17416,7 +25554,7 @@ 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[_types.OptimizationJob] = kwargs.pop("cls", None) _request = build_beta_agents_cancel_optimization_job_request( job_id=job_id, @@ -17444,16 +25582,19 @@ def cancel_optimization_job(self, job_id: str, **kwargs: Any) -> _models.Optimiz except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ApiErrorResponse, - response, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) 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 response.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17507,9 +25648,9 @@ def delete_optimization_job( # 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, + error = self._deserialize.failsafe_deserialize( + _types.ApiErrorResponse, + pipeline_response, ) raise HttpResponseError(response=response, model=error) 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 d72e81cf077d..beb6426725cc 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 @@ -24,6 +24,21 @@ ) +def _build_create_version_from_code_content( + *, + definition: _models.HostedAgentDefinition, + code: IO[bytes], + description: Optional[str], + metadata: Optional[dict[str, str]], +) -> dict[str, Any]: + metadata_body: dict[str, Any] = {"definition": definition} + if description is not None: + metadata_body["description"] = description + if metadata is not None: + metadata_body["metadata"] = metadata + return {"metadata": metadata_body, "code": code} + + def _compute_sha256_from_stream(stream: IO[bytes], *, chunk_size: int = 1024 * 1024) -> str: if not isinstance(stream, IOBase) or not stream.seekable(): raise TypeError("'code' must be provided as a seekable IO[bytes] stream.") @@ -307,16 +322,12 @@ def create_version_from_code( if code_zip_sha256 is None: code_zip_sha256 = _compute_sha256_from_stream(code) - # Build content from expanded parameters using internal model classes - metadata_obj = _models._models._CreateAgentVersionFromCodeMetadata( # pylint: disable=protected-access + content = _build_create_version_from_code_content( definition=definition, + code=code, description=description, metadata=metadata, ) - content = _models._models._CreateAgentVersionFromCodeContent( # pylint: disable=protected-access - metadata=metadata_obj, - code=code, - ) if getattr(self._config, "allow_preview", False): # Add Foundry-Features header if not already present diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_memories.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_memories.py index 33b932900a35..31ef6fcb23fa 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_memories.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_memories.py @@ -8,8 +8,10 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Union, Optional, Any, List, overload, IO, cast -from openai.types.responses import ResponseInputParam +from collections.abc import Mapping +from typing import Union, Optional, Any, List, overload, cast +from azure.ai.extensions.openai import to_wire_dict +from azure.ai.extensions.openai.types import ResponseInputParam from azure.core.tracing.decorator import distributed_trace from azure.core.polling import NoPolling from azure.core.utils import case_insensitive_dict @@ -28,7 +30,7 @@ ) from ._operations import JSON, _Unset, ClsType, BetaMemoryStoresOperations as GenerateBetaMemoryStoresOperations from .._validation import api_version_validation -from .._utils.model_base import _deserialize, _serialize +from .._utils.model_base import _deserialize def _serialize_memory_input_items( @@ -37,7 +39,7 @@ def _serialize_memory_input_items( """Serialize OpenAI response input items to the payload shape expected by memory APIs. :param items: The items to serialize. Can be a plain string or an OpenAI ResponseInputParam. - :type items: Optional[Union[str, openai.types.responses.ResponseInputParam]] + :type items: Optional[Union[str, azure.ai.extensions.openai.types.ResponseInputParam]] :return: A list of serialized item dictionaries, or None if items is None. :rtype: Optional[List[dict[str, Any]]] """ @@ -53,15 +55,9 @@ def _serialize_memory_input_items( serialized_items: List[dict[str, Any]] = [] for item in items: - if hasattr(item, "model_dump"): - item = cast(Any, item).model_dump() - elif hasattr(item, "as_dict"): - item = cast(Any, item).as_dict() - - serialized_item = _serialize(item) - if not isinstance(serialized_item, dict): - raise TypeError("items must serialize to a dictionary .") - serialized_items.append(serialized_item) + if not isinstance(item, Mapping): + raise TypeError("items must be dictionaries.") + serialized_items.append(to_wire_dict(item)) return serialized_items @@ -92,7 +88,7 @@ def search_memories( keys. For example: {"role": "user", "type": "message", "content": "my user message"}. Only messages with `type` equals `message` are currently processed. Others are ignored. Default value is None. - :paramtype items: Union[str, openai.types.responses.ResponseInputParam] + :paramtype items: Union[str, azure.ai.extensions.openai.types.ResponseInputParam] :keyword previous_search_id: The unique ID of the previous search request, enabling incremental memory search from where the last operation left off. Default value is None. :paramtype previous_search_id: str @@ -124,29 +120,11 @@ def search_memories( :raises ~azure.core.exceptions.HttpResponseError: """ - @overload - def search_memories( - self, name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MemoryStoreSearchResult: - """Search for relevant memories from a memory store based on conversation context. - - :param name: The name of the memory store to search. 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: MemoryStoreSearchResult. The MemoryStoreSearchResult is compatible with MutableMapping - :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace def search_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: JSON = _Unset, *, scope: str = _Unset, items: Optional[Union[str, ResponseInputParam]] = None, @@ -158,8 +136,8 @@ def search_memories( :param name: The name of the memory store to search. Required. :type name: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: JSON request body. Required. + :type body: JSON :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -168,7 +146,7 @@ def search_memories( keys. For example: {"role": "user", "type": "message", "content": "my user message"}. Only messages with `type` equals `message` are currently processed. Others are ignored. Default value is None. - :paramtype items: Union[str, openai.types.responses.ResponseInputParam] + :paramtype items: Union[str, azure.ai.extensions.openai.types.ResponseInputParam] :keyword previous_search_id: The unique ID of the previous search request, enabling incremental memory search from where the last operation left off. Default value is None. :paramtype previous_search_id: str @@ -178,6 +156,9 @@ def search_memories( :rtype: ~azure.ai.projects.models.MemoryStoreSearchResult :raises ~azure.core.exceptions.HttpResponseError: """ + if body is not _Unset and not isinstance(body, Mapping): + raise TypeError("body must be a JSON mapping.") + return super()._search_memories( name=name, body=body, @@ -212,7 +193,7 @@ def begin_update_memories( keys. For example: {"role": "user", "type": "message", "content": "my user message"}. Only messages with `type` equals `message` are currently processed. Others are ignored. Default value is None. - :paramtype items: Union[str, openai.types.responses.ResponseInputParam] + :paramtype items: Union[str, azure.ai.extensions.openai.types.ResponseInputParam] :keyword previous_update_id: The unique ID of the previous update request, enabling incremental memory updates from where the last operation left off. Default value is None. :paramtype previous_update_id: str @@ -257,31 +238,6 @@ def begin_update_memories( :raises ~azure.core.exceptions.HttpResponseError: """ - @overload - def begin_update_memories( - self, - name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any, - ) -> UpdateMemoriesLROPoller: - """Update memory store with conversation memories. - - :param name: The name of the memory store 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: An instance of UpdateMemoriesLROPoller that returns MemoryStoreUpdateCompletedResult. The - MemoryStoreUpdateCompletedResult is compatible with MutableMapping - :rtype: - ~azure.ai.projects.models.UpdateMemoriesLROPoller - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace @api_version_validation( method_added_on="v1", @@ -291,7 +247,7 @@ def begin_update_memories( def begin_update_memories( self, name: str, - body: Union[JSON, IO[bytes]] = _Unset, + body: JSON = _Unset, *, scope: str = _Unset, items: Optional[Union[str, ResponseInputParam]] = None, @@ -303,8 +259,8 @@ def begin_update_memories( :param name: The name of the memory store 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] + :param body: JSON request body. Required. + :type body: JSON :keyword scope: The namespace that logically groups and isolates memories, such as a user ID. Required. :paramtype scope: str @@ -313,7 +269,7 @@ def begin_update_memories( keys. For example: {"role": "user", "type": "message", "content": "my user message"}. Only messages with `type` equals `message` are currently processed. Others are ignored. Default value is None. - :paramtype items: Union[str, openai.types.responses.ResponseInputParam] + :paramtype items: Union[str, azure.ai.extensions.openai.types.ResponseInputParam] :keyword previous_update_id: The unique ID of the previous update request, enabling incremental memory updates from where the last operation left off. Default value is None. :paramtype previous_update_id: str @@ -332,6 +288,9 @@ def begin_update_memories( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + if body is not _Unset and not isinstance(body, Mapping): + raise TypeError("body must be a JSON mapping.") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[MemoryStoreUpdateCompletedResult] = kwargs.pop("cls", None) polling = kwargs.pop("polling", True) @@ -365,9 +324,7 @@ def begin_update_memories( def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Operation-Location"] = self._deserialize( - "str", response.headers.get("Operation-Location") - ) + response_headers["Operation-Location"] = response.headers.get("Operation-Location") deserialized = _deserialize(MemoryStoreUpdateCompletedResult, response.json().get("result", None)) if deserialized is None: diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_models.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_models.py index 7cd83ca71a8e..79eebf7f5143 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_models.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_patch_models.py @@ -57,15 +57,19 @@ def _extract_pending_upload_targets( :return: A tuple of ``(sas_uri, container_blob_uri, pending_upload_id)``. :rtype: tuple[str, str, str or None] """ - payload = dict(response) if isinstance(response, dict) else response.as_dict() - - blob_ref = payload.get("blobReferenceForConsumption") or payload.get("blobReference") or {} - sas_uri = (blob_ref.get("credential") or {}).get("sasUri") - container_blob_uri = blob_ref.get("blobUri") - pending_upload_id = payload.get("temporaryDataReferenceId") or payload.get("pendingUploadId") + if isinstance(response, dict): + blob_ref = response.get("blobReferenceForConsumption") or response.get("blobReference") or {} + sas_uri = (blob_ref.get("credential") or {}).get("sasUri") + container_blob_uri = blob_ref.get("blobUri") + pending_upload_id = response.get("temporaryDataReferenceId") or response.get("pendingUploadId") + else: + blob_ref = response.blob_reference + sas_uri = blob_ref.credential.sas_uri + container_blob_uri = blob_ref.blob_uri + pending_upload_id = response.pending_upload_id if not sas_uri or not container_blob_uri: - raise ValueError("Could not locate SAS URI / blob URI in pending_upload response: " f"{payload!r}") + raise ValueError("Could not locate SAS URI / blob URI in pending_upload response: " f"{response!r}") return sas_uri, container_blob_uri, pending_upload_id @staticmethod diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/types.py b/sdk/ai/azure-ai-projects/azure/ai/projects/types.py new file mode 100644 index 000000000000..2116f5de9baf --- /dev/null +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/types.py @@ -0,0 +1,10 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. +"""Compatibility re-export for extension-owned Azure AI Projects generated types.""" + +from azure.ai.extensions.openai.projects._generated import types as _extension_types +from azure.ai.extensions.openai.projects._generated.types import * # type: ignore # noqa: F401,F403 + +for _name in dir(_extension_types): + if not _name.startswith("__"): + globals()[_name] = getattr(_extension_types, _name) diff --git a/sdk/ai/azure-ai-projects/pyproject.toml b/sdk/ai/azure-ai-projects/pyproject.toml index 3cc1de11d7af..145f91f75823 100644 --- a/sdk/ai/azure-ai-projects/pyproject.toml +++ b/sdk/ai/azure-ai-projects/pyproject.toml @@ -36,7 +36,7 @@ dependencies = [ "azure-core>=1.37.0", "typing-extensions>=4.11", "azure-identity>=1.15.0", - "openai>=2.8.0", + "azure-ai-extensions-openai>=1.0.0b1", "azure-storage-blob>=12.15.0", ] dynamic = [ @@ -67,9 +67,11 @@ pytyped = ["py.typed"] [tool.azure-sdk-build] verifytypes = false +[tool.uv.sources] +azure-ai-extensions-openai = { path = "../azure-ai-extensions-openai", editable = true } + [tool.mypy] exclude = '.*samples[\\/]hosted_agents[\\/]assets[\\/].*main\.py$' [tool.azure-sdk-conda] in_bundle = false - diff --git a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_user_identity_isolation.py b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_user_identity_isolation.py index e46d43a3a8b3..16762cf6fe18 100644 --- a/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_user_identity_isolation.py +++ b/sdk/ai/azure-ai-projects/samples/hosted_agents/sample_agent_user_identity_isolation.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. diff --git a/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py b/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py index 085f5b5f1ec6..8211f50ab60c 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py +++ b/sdk/ai/azure-ai-projects/tests/samples/llm_instructions.py @@ -18,7 +18,8 @@ from typing import Final -agent_tools_instructions: Final[str] = """ +agent_tools_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for a tool-driven assistant workflow. @@ -43,9 +44,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -memories_instructions: Final[str] = """ +memories_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for a memories workflow. @@ -70,9 +73,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -agents_instructions: Final[str] = """ +agents_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct. @@ -103,9 +108,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -chat_completions_instructions: Final[str] = """ +chat_completions_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for Chat Completions scenarios. @@ -124,9 +131,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -resource_management_instructions: Final[str] = """ +resource_management_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for resource-management samples (for example connections, files, and deployments). @@ -152,9 +161,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -fine_tuning_instructions: Final[str] = """ +fine_tuning_instructions: Final[str] = ( + """ We just ran Python code and captured print/log output in an attached log file (TXT). Validate whether sample execution/output is correct for a fine-tuning workflow. @@ -178,9 +189,11 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) -evaluations_instructions: Final[str] = """ +evaluations_instructions: Final[str] = ( + """ We just ran Python code for an evaluation sample and captured print/log output in an attached log file (TXT). Your job: determine if the sample code executed to completion WITHOUT throwing an unhandled exception. @@ -202,9 +215,11 @@ Always respond with `reason` indicating the reason for the response. """.strip() +) -hosted_agents_instructions: Final[str] = """ +hosted_agents_instructions: Final[str] = ( + """ We just ran Python code for a hosted-agent sample and captured print/log output in an attached log file (TXT). Validate whether the sample executed correctly. @@ -226,6 +241,7 @@ Always include `reason` with a concise explanation tied to the observed print output. """.strip() +) # Folder (under samples/) -> instructions.