Skip to content

Commit 8ec977c

Browse files
Annhiluccopybara-github
authored andcommitted
feat: Add support for more image and audio MIME types in Interactions content
PiperOrigin-RevId: 889325312
1 parent f4bcca4 commit 8ec977c

File tree

5 files changed

+46
-6
lines changed

5 files changed

+46
-6
lines changed

google/genai/_interactions/types/audio_content.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ class AudioContent(BaseModel):
3232
"""The audio content."""
3333

3434
mime_type: Optional[
35-
Literal["audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac", "audio/mpeg"]
35+
Literal[
36+
"audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac", "audio/mpeg", "audio/m4a"
37+
]
3638
] = None
3739
"""The mime type of the audio."""
3840

google/genai/_interactions/types/audio_content_param.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ class AudioContentParam(TypedDict, total=False):
3535
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
3636
"""The audio content."""
3737

38-
mime_type: Literal["audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac", "audio/mpeg"]
38+
mime_type: Literal[
39+
"audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac", "audio/mpeg", "audio/m4a"
40+
]
3941
"""The mime type of the audio."""
4042

4143
uri: str

google/genai/_interactions/types/content_delta.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,19 @@ class DeltaImage(BaseModel):
7575

7676
data: Optional[str] = None
7777

78-
mime_type: Optional[Literal["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif"]] = None
78+
mime_type: Optional[
79+
Literal[
80+
"image/png",
81+
"image/jpeg",
82+
"image/webp",
83+
"image/heic",
84+
"image/heif",
85+
"image/jpg",
86+
"image/gif",
87+
"image/bmp",
88+
"image/tiff",
89+
]
90+
] = None
7991

8092
resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None
8193
"""The resolution of the media."""
@@ -89,7 +101,9 @@ class DeltaAudio(BaseModel):
89101
data: Optional[str] = None
90102

91103
mime_type: Optional[
92-
Literal["audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac", "audio/mpeg"]
104+
Literal[
105+
"audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac", "audio/mpeg", "audio/m4a"
106+
]
93107
] = None
94108

95109
uri: Optional[str] = None

google/genai/_interactions/types/image_content.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,19 @@ class ImageContent(BaseModel):
3131
data: Optional[str] = None
3232
"""The image content."""
3333

34-
mime_type: Optional[Literal["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif"]] = None
34+
mime_type: Optional[
35+
Literal[
36+
"image/png",
37+
"image/jpeg",
38+
"image/webp",
39+
"image/heic",
40+
"image/heif",
41+
"image/jpg",
42+
"image/gif",
43+
"image/bmp",
44+
"image/tiff",
45+
]
46+
] = None
3547
"""The mime type of the image."""
3648

3749
resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None

google/genai/_interactions/types/image_content_param.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@ class ImageContentParam(TypedDict, total=False):
3535
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
3636
"""The image content."""
3737

38-
mime_type: Literal["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif"]
38+
mime_type: Literal[
39+
"image/png",
40+
"image/jpeg",
41+
"image/webp",
42+
"image/heic",
43+
"image/heif",
44+
"image/jpg",
45+
"image/gif",
46+
"image/bmp",
47+
"image/tiff",
48+
]
3949
"""The mime type of the image."""
4050

4151
resolution: Literal["low", "medium", "high", "ultra_high"]

0 commit comments

Comments
 (0)