Skip to content

Commit d6bc9fb

Browse files
hkt74copybara-github
authored andcommitted
fix: change interactions media mime type to enum (breaking change for experimental feature)
PiperOrigin-RevId: 871564751
1 parent 3e8eef8 commit d6bc9fb

18 files changed

Lines changed: 46 additions & 258 deletions

google/genai/_interactions/types/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,12 @@
4444
from .video_content import VideoContent as VideoContent
4545
from .function_param import FunctionParam as FunctionParam
4646
from .thinking_level import ThinkingLevel as ThinkingLevel
47-
from .audio_mime_type import AudioMimeType as AudioMimeType
48-
from .image_mime_type import ImageMimeType as ImageMimeType
4947
from .thought_content import ThoughtContent as ThoughtContent
50-
from .video_mime_type import VideoMimeType as VideoMimeType
5148
from .annotation_param import AnnotationParam as AnnotationParam
5249
from .document_content import DocumentContent as DocumentContent
5350
from .tool_choice_type import ToolChoiceType as ToolChoiceType
5451
from .generation_config import GenerationConfig as GenerationConfig
5552
from .tool_choice_param import ToolChoiceParam as ToolChoiceParam
56-
from .document_mime_type import DocumentMimeType as DocumentMimeType
5753
from .image_config_param import ImageConfigParam as ImageConfigParam
5854
from .text_content_param import TextContentParam as TextContentParam
5955
from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig
@@ -65,18 +61,14 @@
6561
from .video_content_param import VideoContentParam as VideoContentParam
6662
from .dynamic_agent_config import DynamicAgentConfig as DynamicAgentConfig
6763
from .google_search_result import GoogleSearchResult as GoogleSearchResult
68-
from .audio_mime_type_param import AudioMimeTypeParam as AudioMimeTypeParam
6964
from .function_call_content import FunctionCallContent as FunctionCallContent
70-
from .image_mime_type_param import ImageMimeTypeParam as ImageMimeTypeParam
7165
from .interaction_sse_event import InteractionSSEEvent as InteractionSSEEvent
7266
from .thought_content_param import ThoughtContentParam as ThoughtContentParam
73-
from .video_mime_type_param import VideoMimeTypeParam as VideoMimeTypeParam
7467
from .document_content_param import DocumentContentParam as DocumentContentParam
7568
from .interaction_get_params import InteractionGetParams as InteractionGetParams
7669
from .function_result_content import FunctionResultContent as FunctionResultContent
7770
from .generation_config_param import GenerationConfigParam as GenerationConfigParam
7871
from .interaction_start_event import InteractionStartEvent as InteractionStartEvent
79-
from .document_mime_type_param import DocumentMimeTypeParam as DocumentMimeTypeParam
8072
from .file_search_call_content import FileSearchCallContent as FileSearchCallContent
8173
from .tool_choice_config_param import ToolChoiceConfigParam as ToolChoiceConfigParam
8274
from .url_context_call_content import URLContextCallContent as URLContextCallContent

google/genai/_interactions/types/audio_content.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from typing_extensions import Literal
2020

2121
from .._models import BaseModel
22-
from .audio_mime_type import AudioMimeType
2322

2423
__all__ = ["AudioContent"]
2524

@@ -32,7 +31,7 @@ class AudioContent(BaseModel):
3231
data: Optional[str] = None
3332
"""The audio content."""
3433

35-
mime_type: Optional[AudioMimeType] = None
34+
mime_type: Optional[Literal["audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac"]] = None
3635
"""The mime type of the audio."""
3736

3837
uri: Optional[str] = None

google/genai/_interactions/types/audio_content_param.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from .._types import Base64FileInput
2424
from .._utils import PropertyInfo
2525
from .._models import set_pydantic_config
26-
from .audio_mime_type_param import AudioMimeTypeParam
2726

2827
__all__ = ["AudioContentParam"]
2928

@@ -36,7 +35,7 @@ class AudioContentParam(TypedDict, total=False):
3635
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
3736
"""The audio content."""
3837

39-
mime_type: AudioMimeTypeParam
38+
mime_type: Literal["audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac"]
4039
"""The mime type of the audio."""
4140

4241
uri: str

google/genai/_interactions/types/audio_mime_type.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

google/genai/_interactions/types/audio_mime_type_param.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

google/genai/_interactions/types/content_delta.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
from .annotation import Annotation
2424
from .text_content import TextContent
2525
from .image_content import ImageContent
26-
from .audio_mime_type import AudioMimeType
27-
from .image_mime_type import ImageMimeType
28-
from .video_mime_type import VideoMimeType
29-
from .document_mime_type import DocumentMimeType
3026
from .url_context_result import URLContextResult
3127
from .google_search_result import GoogleSearchResult
3228
from .url_context_call_arguments import URLContextCallArguments
@@ -80,8 +76,7 @@ class DeltaImageDelta(BaseModel):
8076

8177
data: Optional[str] = None
8278

83-
mime_type: Optional[ImageMimeType] = None
84-
"""The mime type of the image."""
79+
mime_type: Optional[Literal["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif"]] = None
8580

8681
resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None
8782
"""The resolution of the media."""
@@ -94,8 +89,7 @@ class DeltaAudioDelta(BaseModel):
9489

9590
data: Optional[str] = None
9691

97-
mime_type: Optional[AudioMimeType] = None
98-
"""The mime type of the audio."""
92+
mime_type: Optional[Literal["audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac"]] = None
9993

10094
uri: Optional[str] = None
10195

@@ -105,8 +99,7 @@ class DeltaDocumentDelta(BaseModel):
10599

106100
data: Optional[str] = None
107101

108-
mime_type: Optional[DocumentMimeType] = None
109-
"""The mime type of the document."""
102+
mime_type: Optional[Literal["application/pdf"]] = None
110103

111104
uri: Optional[str] = None
112105

@@ -116,8 +109,19 @@ class DeltaVideoDelta(BaseModel):
116109

117110
data: Optional[str] = None
118111

119-
mime_type: Optional[VideoMimeType] = None
120-
"""The mime type of the video."""
112+
mime_type: Optional[
113+
Literal[
114+
"video/mp4",
115+
"video/mpeg",
116+
"video/mpg",
117+
"video/mov",
118+
"video/avi",
119+
"video/x-flv",
120+
"video/webm",
121+
"video/wmv",
122+
"video/3gpp",
123+
]
124+
] = None
121125

122126
resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None
123127
"""The resolution of the media."""

google/genai/_interactions/types/document_content.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from typing_extensions import Literal
2020

2121
from .._models import BaseModel
22-
from .document_mime_type import DocumentMimeType
2322

2423
__all__ = ["DocumentContent"]
2524

@@ -32,7 +31,7 @@ class DocumentContent(BaseModel):
3231
data: Optional[str] = None
3332
"""The document content."""
3433

35-
mime_type: Optional[DocumentMimeType] = None
34+
mime_type: Optional[Literal["application/pdf"]] = None
3635
"""The mime type of the document."""
3736

3837
uri: Optional[str] = None

google/genai/_interactions/types/document_content_param.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from .._types import Base64FileInput
2424
from .._utils import PropertyInfo
2525
from .._models import set_pydantic_config
26-
from .document_mime_type_param import DocumentMimeTypeParam
2726

2827
__all__ = ["DocumentContentParam"]
2928

@@ -36,7 +35,7 @@ class DocumentContentParam(TypedDict, total=False):
3635
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
3736
"""The document content."""
3837

39-
mime_type: DocumentMimeTypeParam
38+
mime_type: Literal["application/pdf"]
4039
"""The mime type of the document."""
4140

4241
uri: str

google/genai/_interactions/types/document_mime_type.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

google/genai/_interactions/types/document_mime_type_param.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)