Skip to content

Commit 4712be1

Browse files
authored
Fix emitted enum value A2_A_PREVIEW to A2A_PREVIEW (#43853)
1 parent 17c996f commit 4712be1

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ class ToolType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
761761
OPENAPI = "openapi"
762762
BING_CUSTOM_SEARCH_PREVIEW = "bing_custom_search_preview"
763763
CAPTURE_STRUCTURED_OUTPUTS = "capture_structured_outputs"
764-
A2_A_PREVIEW = "a2a_preview"
764+
A2A_PREVIEW = "a2a_preview"
765765
AZURE_FUNCTION = "azure_function"
766766
MEMORY_SEARCH = "memory_search"
767767

sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class A2ATool(Tool, discriminator="a2a_preview"):
9999
"""An agent implementing the A2A protocol.
100100

101101
:ivar type: The type of the tool. Always ``a2a``. Required.
102-
:vartype type: str or ~azure.ai.projects.models.A2_A_PREVIEW
102+
:vartype type: str or ~azure.ai.projects.models.A2A_PREVIEW
103103
:ivar base_url: Base URL of the agent.
104104
:vartype base_url: str
105105
:ivar agent_card_path: The path to the agent card relative to the ``base_url``.
@@ -111,7 +111,7 @@ class A2ATool(Tool, discriminator="a2a_preview"):
111111
:vartype project_connection_id: str
112112
"""
113113

114-
type: Literal[ToolType.A2_A_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore
114+
type: Literal[ToolType.A2A_PREVIEW] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore
115115
"""The type of the tool. Always ``a2a``. Required."""
116116
base_url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
117117
"""Base URL of the agent."""
@@ -141,7 +141,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
141141

142142
def __init__(self, *args: Any, **kwargs: Any) -> None:
143143
super().__init__(*args, **kwargs)
144-
self.type = ToolType.A2_A_PREVIEW # type: ignore
144+
self.type = ToolType.A2A_PREVIEW # type: ignore
145145

146146

147147
class InsightResult(_Model):

sdk/ai/azure-ai-projects/post-emitter-fixes.cmd

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ REM Revert this, as we want to keep some edits to these file.
1212
git restore pyproject.toml
1313
git restore azure\ai\projects\_version.py
1414

15-
REM We don't use auto-generated tests. Can this TypeSpec be change to no generate them?
16-
REM rmdir /s /q generated_tests
15+
REM Rename "A2_A_PREVIEW" to "A2A_PREVIEW". Since this value is an extension to OpenAI.ToolType enum, we can't use @className in client.tsp to do the rename.
16+
powershell -Command "(Get-Content azure\ai\projects\models\_models.py) -replace 'A2_A_PREVIEW', 'A2A_PREVIEW' | Set-Content azure\ai\projects\models\_models.py"
17+
powershell -Command "(Get-Content azure\ai\projects\models\_enums.py) -replace 'A2_A_PREVIEW', 'A2A_PREVIEW' | Set-Content azure\ai\projects\models\_enums.py"
1718

1819
REM Add quotation marks around "str" in the expression: content: Union[str, list["_models.ItemContent"]] = rest_field(
1920
REM This fixes the serialization of this expression: item_param: ItemParam = ResponsesUserMessageItemParam(content="my text")
@@ -25,10 +26,5 @@ powershell -Command "(Get-Content azure\ai\projects\models\_models.py) -replace
2526
REM Add additional pylint disables to the model_base.py file
2627
powershell -Command "(Get-Content azure\ai\projects\_utils\model_base.py) -replace '# pylint: disable=protected-access, broad-except', '# pylint: disable=protected-access, broad-except, import-error, no-value-for-parameter' | Set-Content azure\ai\projects\_utils\model_base.py"
2728

28-
REM Disable the version validation
29-
REM No longer needed, since the service now supports api-version "2025-11-15-preview"
30-
REM powershell -Command "(Get-Content azure\ai\projects\_validation.py) -replace 'if _index_with_default\(method_added_on\) > _index_with_default\(client_api_version\):', 'if False: # pylint: disable=using-constant-test' | Set-Content azure\ai\projects\_validation.py"
31-
REM powershell -Command "(Get-Content azure\ai\projects\_validation.py) -replace 'if unsupported:', 'if False: # pylint: disable=using-constant-test' | Set-Content azure\ai\projects\_validation.py"
32-
3329
echo Now do these additional changes manually, if you want the "Generate docs" job to succeed in PR pipeline
3430
REM 1. Remove `generate_summary` from class `Reasoning`. It's deprecated but causes two types of errors. Consider removing it from TypeSpec.

0 commit comments

Comments
 (0)