From 44e5d28f1f02e59cf4037148c320bfa149140823 Mon Sep 17 00:00:00 2001 From: jhakulin Date: Wed, 14 May 2025 09:44:28 -0700 Subject: [PATCH 1/2] update agent error details --- sdk/ai/azure-ai-agents/CHANGELOG.md | 6 ++ .../azure-ai-agents/apiview-properties.json | 2 +- .../azure/ai/agents/_version.py | 2 +- .../azure/ai/agents/models/__init__.py | 4 +- .../azure/ai/agents/models/_models.py | 88 ++++++++++--------- sdk/ai/azure-ai-agents/tsp-location.yaml | 2 +- 6 files changed, 57 insertions(+), 47 deletions(-) diff --git a/sdk/ai/azure-ai-agents/CHANGELOG.md b/sdk/ai/azure-ai-agents/CHANGELOG.md index 8aac5d40e7b4..3f4686335c4f 100644 --- a/sdk/ai/azure-ai-agents/CHANGELOG.md +++ b/sdk/ai/azure-ai-agents/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.0.0b3 (2025-05-14) + +### Changes + +- Internal updates based on TypeSpec finalization. + ## 1.0.0b2 (2025-05-13) ### Breaking Changes diff --git a/sdk/ai/azure-ai-agents/apiview-properties.json b/sdk/ai/azure-ai-agents/apiview-properties.json index 58d555082a72..1ab461defcf4 100644 --- a/sdk/ai/azure-ai-agents/apiview-properties.json +++ b/sdk/ai/azure-ai-agents/apiview-properties.json @@ -2,12 +2,12 @@ "CrossLanguagePackageId": "Azure.AI.Agents", "CrossLanguageDefinitionId": { "azure.ai.agents.models.Agent": "Azure.AI.Agents.Agent", + "azure.ai.agents.models.AgentErrorDetail": "Azure.AI.Agents.AgentErrorDetail", "azure.ai.agents.models.AgentsNamedToolChoice": "Azure.AI.Agents.AgentsNamedToolChoice", "azure.ai.agents.models.AgentsResponseFormat": "Azure.AI.Agents.AgentsResponseFormat", "azure.ai.agents.models.AgentThread": "Azure.AI.Agents.AgentThread", "azure.ai.agents.models.AgentThreadCreationOptions": "Azure.AI.Agents.AgentThreadCreationOptions", "azure.ai.agents.models.AgentV1Error": "Azure.AI.Agents.AgentV1Error", - "azure.ai.agents.models.AgentV1ErrorError": "Azure.AI.Agents.AgentV1Error.error.anonymous", "azure.ai.agents.models.AISearchIndexResource": "Azure.AI.Agents.AISearchIndexResource", "azure.ai.agents.models.ToolDefinition": "Azure.AI.Agents.ToolDefinition", "azure.ai.agents.models.AzureAISearchToolDefinition": "Azure.AI.Agents.AzureAISearchToolDefinition", diff --git a/sdk/ai/azure-ai-agents/azure/ai/agents/_version.py b/sdk/ai/azure-ai-agents/azure/ai/agents/_version.py index bbcd28b4aa67..c43fdbc2e239 100644 --- a/sdk/ai/azure-ai-agents/azure/ai/agents/_version.py +++ b/sdk/ai/azure-ai-agents/azure/ai/agents/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b3" diff --git a/sdk/ai/azure-ai-agents/azure/ai/agents/models/__init__.py b/sdk/ai/azure-ai-agents/azure/ai/agents/models/__init__.py index 5721a5ff90c2..76aab677709f 100644 --- a/sdk/ai/azure-ai-agents/azure/ai/agents/models/__init__.py +++ b/sdk/ai/azure-ai-agents/azure/ai/agents/models/__init__.py @@ -16,10 +16,10 @@ from ._models import ( # type: ignore AISearchIndexResource, Agent, + AgentErrorDetail, AgentThread, AgentThreadCreationOptions, AgentV1Error, - AgentV1ErrorError, AgentsNamedToolChoice, AgentsResponseFormat, AzureAISearchToolDefinition, @@ -207,10 +207,10 @@ __all__ = [ "AISearchIndexResource", "Agent", + "AgentErrorDetail", "AgentThread", "AgentThreadCreationOptions", "AgentV1Error", - "AgentV1ErrorError", "AgentsNamedToolChoice", "AgentsResponseFormat", "AzureAISearchToolDefinition", diff --git a/sdk/ai/azure-ai-agents/azure/ai/agents/models/_models.py b/sdk/ai/azure-ai-agents/azure/ai/agents/models/_models.py index 9c77fb155247..8f6fdd1d8f4e 100644 --- a/sdk/ai/azure-ai-agents/azure/ai/agents/models/_models.py +++ b/sdk/ai/azure-ai-agents/azure/ai/agents/models/_models.py @@ -187,6 +187,49 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.object: Literal["assistant.deleted"] = "assistant.deleted" +class AgentErrorDetail(_Model): + """Describes the error information returned by the agents API. + + :ivar message: Human-readable description of the error. + :vartype message: str + :ivar type: Error type identifier (e.g. ``invalid_request_error``). + :vartype type: str + :ivar param: Name of the parameter that caused the error, if applicable. + :vartype param: str + :ivar code: Machine-readable error code. + :vartype code: str + """ + + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Human-readable description of the error.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error type identifier (e.g. ``invalid_request_error``).""" + param: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the parameter that caused the error, if applicable.""" + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Machine-readable error code.""" + + @overload + def __init__( + self, + *, + message: Optional[str] = None, + type: Optional[str] = None, + param: Optional[str] = None, + code: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class AgentsNamedToolChoice(_Model): """Specifies a tool the model should use. Use to force the model to call a specific tool. @@ -380,56 +423,17 @@ class AgentV1Error(_Model): """Error payload returned by the agents API. :ivar error: Represents the error. Required. - :vartype error: ~azure.ai.agents.models.AgentV1ErrorError + :vartype error: ~azure.ai.agents.models.AgentErrorDetail """ - error: "_models.AgentV1ErrorError" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + error: "_models.AgentErrorDetail" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Represents the error. Required.""" @overload def __init__( self, *, - error: "_models.AgentV1ErrorError", - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class AgentV1ErrorError(_Model): - """AgentV1ErrorError. - - :ivar message: - :vartype message: str - :ivar type: - :vartype type: str - :ivar param: - :vartype param: str - :ivar code: - :vartype code: str - """ - - message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - param: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - - @overload - def __init__( - self, - *, - message: Optional[str] = None, - type: Optional[str] = None, - param: Optional[str] = None, - code: Optional[str] = None, + error: "_models.AgentErrorDetail", ) -> None: ... @overload diff --git a/sdk/ai/azure-ai-agents/tsp-location.yaml b/sdk/ai/azure-ai-agents/tsp-location.yaml index 4682293a1a51..bb4c9baca216 100644 --- a/sdk/ai/azure-ai-agents/tsp-location.yaml +++ b/sdk/ai/azure-ai-agents/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai/Azure.AI.Agents -commit: fc0116e3fbb1ecd647a4f412f5e82eb30c11ad51 +commit: b9b2b55cc99daf6e107471448a281a03e83884ec repo: Azure/azure-rest-api-specs additionalDirectories: From bf310da2c212de3d073735f39af56d2c8f55c3b3 Mon Sep 17 00:00:00 2001 From: jhakulin Date: Wed, 14 May 2025 10:19:16 -0700 Subject: [PATCH 2/2] update ChangeLog --- sdk/ai/azure-ai-agents/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/ai/azure-ai-agents/CHANGELOG.md b/sdk/ai/azure-ai-agents/CHANGELOG.md index 3f4686335c4f..3bf63b759fb7 100644 --- a/sdk/ai/azure-ai-agents/CHANGELOG.md +++ b/sdk/ai/azure-ai-agents/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.0.0b3 (2025-05-14) -### Changes +### Features Added - Internal updates based on TypeSpec finalization.