Skip to content

Commit e126c91

Browse files
google-genai-botcopybara-github
authored andcommitted
fix: Update response_format field names to snake_case.
PiperOrigin-RevId: 912616683
1 parent 00d76d1 commit e126c91

8 files changed

Lines changed: 21 additions & 38 deletions

google/genai/_interactions/types/audio_response_format.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
from typing import Optional
1919
from typing_extensions import Literal
2020

21-
from pydantic import Field as FieldInfo
22-
2321
from .._models import BaseModel
2422

2523
__all__ = ["AudioResponseFormat"]
@@ -30,7 +28,7 @@ class AudioResponseFormat(BaseModel):
3028

3129
type: Literal["audio"]
3230

33-
bit_rate: Optional[int] = FieldInfo(alias="bitRate", default=None)
31+
bit_rate: Optional[int] = None
3432
"""Bit rate in bits per second (bps).
3533
3634
Only applicable for compressed formats (MP3, Opus).
@@ -41,8 +39,8 @@ class AudioResponseFormat(BaseModel):
4139

4240
mime_type: Optional[
4341
Literal["audio/mp3", "audio/ogg_opus", "audio/l16", "audio/wav", "audio/alaw", "audio/mulaw"]
44-
] = FieldInfo(alias="mimeType", default=None)
42+
] = None
4543
"""The MIME type of the audio output."""
4644

47-
sample_rate: Optional[int] = FieldInfo(alias="sampleRate", default=None)
45+
sample_rate: Optional[int] = None
4846
"""Sample rate in Hz."""

google/genai/_interactions/types/audio_response_format_param.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717

1818
from __future__ import annotations
1919

20-
from typing_extensions import Literal, Required, Annotated, TypedDict
21-
22-
from .._utils import PropertyInfo
20+
from typing_extensions import Literal, Required, TypedDict
2321

2422
__all__ = ["AudioResponseFormatParam"]
2523

@@ -29,7 +27,7 @@ class AudioResponseFormatParam(TypedDict, total=False):
2927

3028
type: Required[Literal["audio"]]
3129

32-
bit_rate: Annotated[int, PropertyInfo(alias="bitRate")]
30+
bit_rate: int
3331
"""Bit rate in bits per second (bps).
3432
3533
Only applicable for compressed formats (MP3, Opus).
@@ -38,11 +36,8 @@ class AudioResponseFormatParam(TypedDict, total=False):
3836
delivery: Literal["inline", "url"]
3937
"""The delivery mode for the audio output."""
4038

41-
mime_type: Annotated[
42-
Literal["audio/mp3", "audio/ogg_opus", "audio/l16", "audio/wav", "audio/alaw", "audio/mulaw"],
43-
PropertyInfo(alias="mimeType"),
44-
]
39+
mime_type: Literal["audio/mp3", "audio/ogg_opus", "audio/l16", "audio/wav", "audio/alaw", "audio/mulaw"]
4540
"""The MIME type of the audio output."""
4641

47-
sample_rate: Annotated[int, PropertyInfo(alias="sampleRate")]
42+
sample_rate: int
4843
"""Sample rate in Hz."""

google/genai/_interactions/types/image_response_format.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
from typing import Optional
1919
from typing_extensions import Literal
2020

21-
from pydantic import Field as FieldInfo
22-
2321
from .._models import BaseModel
2422

2523
__all__ = ["ImageResponseFormat"]
@@ -32,14 +30,14 @@ class ImageResponseFormat(BaseModel):
3230

3331
aspect_ratio: Optional[
3432
Literal["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:8", "8:1", "1:4", "4:1"]
35-
] = FieldInfo(alias="aspectRatio", default=None)
33+
] = None
3634
"""The aspect ratio for the image output."""
3735

3836
delivery: Optional[Literal["inline", "url"]] = None
3937
"""The delivery mode for the image output."""
4038

41-
image_size: Optional[Literal["512", "1K", "2K", "4K"]] = FieldInfo(alias="imageSize", default=None)
39+
image_size: Optional[Literal["512", "1K", "2K", "4K"]] = None
4240
"""The size of the image output."""
4341

44-
mime_type: Optional[Literal["image/jpeg"]] = FieldInfo(alias="mimeType", default=None)
42+
mime_type: Optional[Literal["image/jpeg"]] = None
4543
"""The MIME type of the image output."""

google/genai/_interactions/types/image_response_format_param.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717

1818
from __future__ import annotations
1919

20-
from typing_extensions import Literal, Required, Annotated, TypedDict
21-
22-
from .._utils import PropertyInfo
20+
from typing_extensions import Literal, Required, TypedDict
2321

2422
__all__ = ["ImageResponseFormatParam"]
2523

@@ -29,17 +27,16 @@ class ImageResponseFormatParam(TypedDict, total=False):
2927

3028
type: Required[Literal["image"]]
3129

32-
aspect_ratio: Annotated[
33-
Literal["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:8", "8:1", "1:4", "4:1"],
34-
PropertyInfo(alias="aspectRatio"),
30+
aspect_ratio: Literal[
31+
"1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:8", "8:1", "1:4", "4:1"
3532
]
3633
"""The aspect ratio for the image output."""
3734

3835
delivery: Literal["inline", "url"]
3936
"""The delivery mode for the image output."""
4037

41-
image_size: Annotated[Literal["512", "1K", "2K", "4K"], PropertyInfo(alias="imageSize")]
38+
image_size: Literal["512", "1K", "2K", "4K"]
4239
"""The size of the image output."""
4340

44-
mime_type: Annotated[Literal["image/jpeg"], PropertyInfo(alias="mimeType")]
41+
mime_type: Literal["image/jpeg"]
4542
"""The MIME type of the image output."""

google/genai/_interactions/types/text_response_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TextResponseFormat(BaseModel):
3030

3131
type: Literal["text"]
3232

33-
mime_type: Optional[Literal["application/json", "text/plain"]] = FieldInfo(alias="mimeType", default=None)
33+
mime_type: Optional[Literal["application/json", "text/plain"]] = None
3434
"""The MIME type of the text output."""
3535

3636
schema_: Optional[Dict[str, object]] = FieldInfo(alias="schema", default=None)

google/genai/_interactions/types/text_response_format_param.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
from __future__ import annotations
1919

2020
from typing import Dict
21-
from typing_extensions import Literal, Required, Annotated, TypedDict
22-
23-
from .._utils import PropertyInfo
21+
from typing_extensions import Literal, Required, TypedDict
2422

2523
__all__ = ["TextResponseFormatParam"]
2624

@@ -30,7 +28,7 @@ class TextResponseFormatParam(TypedDict, total=False):
3028

3129
type: Required[Literal["text"]]
3230

33-
mime_type: Annotated[Literal["application/json", "text/plain"], PropertyInfo(alias="mimeType")]
31+
mime_type: Literal["application/json", "text/plain"]
3432
"""The MIME type of the text output."""
3533

3634
schema: Dict[str, object]

google/genai/_interactions/types/tool.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
from typing import Dict, List, Union, Optional
1919
from typing_extensions import Literal, Annotated, TypeAlias
2020

21-
from pydantic import Field as FieldInfo
22-
2321
from .._utils import PropertyInfo
2422
from .._models import BaseModel
2523
from .function import Function
@@ -59,7 +57,7 @@ class ComputerUse(BaseModel):
5957
environment: Optional[Literal["browser"]] = None
6058
"""The environment being operated."""
6159

62-
excluded_predefined_functions: Optional[List[str]] = FieldInfo(alias="excludedPredefinedFunctions", default=None)
60+
excluded_predefined_functions: Optional[List[str]] = None
6361
"""The list of predefined functions that are excluded from the model call."""
6462

6563

google/genai/_interactions/types/tool_param.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
from __future__ import annotations
1919

2020
from typing import Dict, List, Union, Iterable
21-
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
21+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
2222

2323
from .._types import SequenceNotStr
24-
from .._utils import PropertyInfo
2524
from .function_param import FunctionParam
2625
from .allowed_tools_param import AllowedToolsParam
2726

@@ -59,7 +58,7 @@ class ComputerUse(TypedDict, total=False):
5958
environment: Literal["browser"]
6059
"""The environment being operated."""
6160

62-
excluded_predefined_functions: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludedPredefinedFunctions")]
61+
excluded_predefined_functions: SequenceNotStr[str]
6362
"""The list of predefined functions that are excluded from the model call."""
6463

6564

0 commit comments

Comments
 (0)