google-genai 1.57.0__py3-none-any.whl → 1.59.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/genai/_api_client.py +19 -10
- google/genai/_interactions/__init__.py +3 -0
- google/genai/_interactions/_base_client.py +134 -11
- google/genai/_interactions/_client.py +57 -3
- google/genai/_interactions/_client_adapter.py +48 -0
- google/genai/_interactions/_models.py +16 -1
- google/genai/_interactions/_types.py +9 -0
- google/genai/_interactions/types/__init__.py +4 -0
- google/genai/_interactions/types/audio_content.py +2 -0
- google/genai/_interactions/types/audio_content_param.py +2 -0
- google/genai/_interactions/types/content.py +2 -0
- google/genai/_interactions/types/content_delta.py +10 -2
- google/genai/_interactions/types/content_param.py +2 -0
- google/genai/_interactions/types/content_start.py +1 -2
- google/genai/_interactions/types/content_stop.py +1 -2
- google/genai/_interactions/types/document_content.py +2 -0
- google/genai/_interactions/types/document_content_param.py +2 -0
- google/genai/_interactions/types/error_event.py +1 -2
- google/genai/_interactions/types/file_search_call_content.py +32 -0
- google/genai/_interactions/types/file_search_call_content_param.py +31 -0
- google/genai/_interactions/types/generation_config.py +4 -0
- google/genai/_interactions/types/generation_config_param.py +4 -0
- google/genai/_interactions/types/image_config.py +31 -0
- google/genai/_interactions/types/image_config_param.py +30 -0
- google/genai/_interactions/types/image_content.py +2 -0
- google/genai/_interactions/types/image_content_param.py +2 -0
- google/genai/_interactions/types/interaction.py +2 -0
- google/genai/_interactions/types/interaction_create_params.py +2 -0
- google/genai/_interactions/types/interaction_event.py +1 -2
- google/genai/_interactions/types/interaction_sse_event.py +5 -3
- google/genai/_interactions/types/interaction_status_update.py +1 -2
- google/genai/_interactions/types/video_content.py +2 -0
- google/genai/_interactions/types/video_content_param.py +2 -0
- google/genai/_live_converters.py +84 -0
- google/genai/_transformers.py +15 -21
- google/genai/client.py +61 -55
- google/genai/live.py +1 -1
- google/genai/tests/client/test_custom_client.py +27 -0
- google/genai/tests/client/test_http_options.py +1 -1
- google/genai/tests/interactions/test_auth.py +1 -4
- google/genai/tests/interactions/test_integration.py +2 -0
- google/genai/tests/transformers/test_blobs.py +16 -3
- google/genai/types.py +58 -2
- google/genai/version.py +1 -1
- {google_genai-1.57.0.dist-info → google_genai-1.59.0.dist-info}/METADATA +6 -11
- {google_genai-1.57.0.dist-info → google_genai-1.59.0.dist-info}/RECORD +49 -44
- {google_genai-1.57.0.dist-info → google_genai-1.59.0.dist-info}/WHEEL +0 -0
- {google_genai-1.57.0.dist-info → google_genai-1.59.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.57.0.dist-info → google_genai-1.59.0.dist-info}/top_level.txt +0 -0
|
@@ -32,6 +32,7 @@ from .model_param import ModelParam as ModelParam
|
|
|
32
32
|
from .tool_choice import ToolChoice as ToolChoice
|
|
33
33
|
from .usage_param import UsageParam as UsageParam
|
|
34
34
|
from .content_stop import ContentStop as ContentStop
|
|
35
|
+
from .image_config import ImageConfig as ImageConfig
|
|
35
36
|
from .text_content import TextContent as TextContent
|
|
36
37
|
from .allowed_tools import AllowedTools as AllowedTools
|
|
37
38
|
from .audio_content import AudioContent as AudioContent
|
|
@@ -54,6 +55,7 @@ from .generation_config import GenerationConfig as GenerationConfig
|
|
|
54
55
|
from .interaction_event import InteractionEvent as InteractionEvent
|
|
55
56
|
from .tool_choice_param import ToolChoiceParam as ToolChoiceParam
|
|
56
57
|
from .document_mime_type import DocumentMimeType as DocumentMimeType
|
|
58
|
+
from .image_config_param import ImageConfigParam as ImageConfigParam
|
|
57
59
|
from .text_content_param import TextContentParam as TextContentParam
|
|
58
60
|
from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig
|
|
59
61
|
from .url_context_result import URLContextResult as URLContextResult
|
|
@@ -75,6 +77,7 @@ from .interaction_get_params import InteractionGetParams as InteractionGetParams
|
|
|
75
77
|
from .function_result_content import FunctionResultContent as FunctionResultContent
|
|
76
78
|
from .generation_config_param import GenerationConfigParam as GenerationConfigParam
|
|
77
79
|
from .document_mime_type_param import DocumentMimeTypeParam as DocumentMimeTypeParam
|
|
80
|
+
from .file_search_call_content import FileSearchCallContent as FileSearchCallContent
|
|
78
81
|
from .tool_choice_config_param import ToolChoiceConfigParam as ToolChoiceConfigParam
|
|
79
82
|
from .url_context_call_content import URLContextCallContent as URLContextCallContent
|
|
80
83
|
from .url_context_result_param import URLContextResultParam as URLContextResultParam
|
|
@@ -95,6 +98,7 @@ from .mcp_server_tool_call_content import MCPServerToolCallContent as MCPServerT
|
|
|
95
98
|
from .code_execution_call_arguments import CodeExecutionCallArguments as CodeExecutionCallArguments
|
|
96
99
|
from .code_execution_result_content import CodeExecutionResultContent as CodeExecutionResultContent
|
|
97
100
|
from .function_result_content_param import FunctionResultContentParam as FunctionResultContentParam
|
|
101
|
+
from .file_search_call_content_param import FileSearchCallContentParam as FileSearchCallContentParam
|
|
98
102
|
from .mcp_server_tool_result_content import MCPServerToolResultContent as MCPServerToolResultContent
|
|
99
103
|
from .url_context_call_content_param import URLContextCallContentParam as URLContextCallContentParam
|
|
100
104
|
from .deep_research_agent_config_param import DeepResearchAgentConfigParam as DeepResearchAgentConfigParam
|
|
@@ -30,8 +30,10 @@ class AudioContent(BaseModel):
|
|
|
30
30
|
type: Literal["audio"]
|
|
31
31
|
|
|
32
32
|
data: Optional[str] = None
|
|
33
|
+
"""The audio content."""
|
|
33
34
|
|
|
34
35
|
mime_type: Optional[AudioMimeType] = None
|
|
35
36
|
"""The mime type of the audio."""
|
|
36
37
|
|
|
37
38
|
uri: Optional[str] = None
|
|
39
|
+
"""The URI of the audio."""
|
|
@@ -34,11 +34,13 @@ class AudioContentParam(TypedDict, total=False):
|
|
|
34
34
|
type: Required[Literal["audio"]]
|
|
35
35
|
|
|
36
36
|
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
|
|
37
|
+
"""The audio content."""
|
|
37
38
|
|
|
38
39
|
mime_type: AudioMimeTypeParam
|
|
39
40
|
"""The mime type of the audio."""
|
|
40
41
|
|
|
41
42
|
uri: str
|
|
43
|
+
"""The URI of the audio."""
|
|
42
44
|
|
|
43
45
|
|
|
44
46
|
set_pydantic_config(AudioContentParam, {"arbitrary_types_allowed": True})
|
|
@@ -27,6 +27,7 @@ from .thought_content import ThoughtContent
|
|
|
27
27
|
from .document_content import DocumentContent
|
|
28
28
|
from .function_call_content import FunctionCallContent
|
|
29
29
|
from .function_result_content import FunctionResultContent
|
|
30
|
+
from .file_search_call_content import FileSearchCallContent
|
|
30
31
|
from .url_context_call_content import URLContextCallContent
|
|
31
32
|
from .file_search_result_content import FileSearchResultContent
|
|
32
33
|
from .google_search_call_content import GoogleSearchCallContent
|
|
@@ -57,6 +58,7 @@ Content: TypeAlias = Annotated[
|
|
|
57
58
|
GoogleSearchResultContent,
|
|
58
59
|
MCPServerToolCallContent,
|
|
59
60
|
MCPServerToolResultContent,
|
|
61
|
+
FileSearchCallContent,
|
|
60
62
|
FileSearchResultContent,
|
|
61
63
|
],
|
|
62
64
|
PropertyInfo(discriminator="type"),
|
|
@@ -60,6 +60,7 @@ __all__ = [
|
|
|
60
60
|
"DeltaMCPServerToolResultDeltaResult",
|
|
61
61
|
"DeltaMCPServerToolResultDeltaResultItems",
|
|
62
62
|
"DeltaMCPServerToolResultDeltaResultItemsItem",
|
|
63
|
+
"DeltaFileSearchCallDelta",
|
|
63
64
|
"DeltaFileSearchResultDelta",
|
|
64
65
|
"DeltaFileSearchResultDeltaResult",
|
|
65
66
|
]
|
|
@@ -284,6 +285,13 @@ class DeltaMCPServerToolResultDelta(BaseModel):
|
|
|
284
285
|
server_name: Optional[str] = None
|
|
285
286
|
|
|
286
287
|
|
|
288
|
+
class DeltaFileSearchCallDelta(BaseModel):
|
|
289
|
+
type: Literal["file_search_call"]
|
|
290
|
+
|
|
291
|
+
id: Optional[str] = None
|
|
292
|
+
"""A unique ID for this specific tool call."""
|
|
293
|
+
|
|
294
|
+
|
|
287
295
|
class DeltaFileSearchResultDeltaResult(BaseModel):
|
|
288
296
|
"""The result of the File Search."""
|
|
289
297
|
|
|
@@ -322,6 +330,7 @@ Delta: TypeAlias = Annotated[
|
|
|
322
330
|
DeltaGoogleSearchResultDelta,
|
|
323
331
|
DeltaMCPServerToolCallDelta,
|
|
324
332
|
DeltaMCPServerToolResultDelta,
|
|
333
|
+
DeltaFileSearchCallDelta,
|
|
325
334
|
DeltaFileSearchResultDelta,
|
|
326
335
|
],
|
|
327
336
|
PropertyInfo(discriminator="type"),
|
|
@@ -333,8 +342,7 @@ class ContentDelta(BaseModel):
|
|
|
333
342
|
|
|
334
343
|
event_id: Optional[str] = None
|
|
335
344
|
"""
|
|
336
|
-
The event_id token to be used to resume the interaction stream, from
|
|
337
|
-
this event.
|
|
345
|
+
The event_id token to be used to resume the interaction stream, from this event.
|
|
338
346
|
"""
|
|
339
347
|
|
|
340
348
|
event_type: Optional[Literal["content.delta"]] = None
|
|
@@ -28,6 +28,7 @@ from .thought_content_param import ThoughtContentParam
|
|
|
28
28
|
from .document_content_param import DocumentContentParam
|
|
29
29
|
from .function_call_content_param import FunctionCallContentParam
|
|
30
30
|
from .function_result_content_param import FunctionResultContentParam
|
|
31
|
+
from .file_search_call_content_param import FileSearchCallContentParam
|
|
31
32
|
from .url_context_call_content_param import URLContextCallContentParam
|
|
32
33
|
from .file_search_result_content_param import FileSearchResultContentParam
|
|
33
34
|
from .google_search_call_content_param import GoogleSearchCallContentParam
|
|
@@ -57,5 +58,6 @@ ContentParam: TypeAlias = Union[
|
|
|
57
58
|
GoogleSearchResultContentParam,
|
|
58
59
|
MCPServerToolCallContentParam,
|
|
59
60
|
MCPServerToolResultContentParam,
|
|
61
|
+
FileSearchCallContentParam,
|
|
60
62
|
FileSearchResultContentParam,
|
|
61
63
|
]
|
|
@@ -30,8 +30,7 @@ class ContentStart(BaseModel):
|
|
|
30
30
|
|
|
31
31
|
event_id: Optional[str] = None
|
|
32
32
|
"""
|
|
33
|
-
The event_id token to be used to resume the interaction stream, from
|
|
34
|
-
this event.
|
|
33
|
+
The event_id token to be used to resume the interaction stream, from this event.
|
|
35
34
|
"""
|
|
36
35
|
|
|
37
36
|
event_type: Optional[Literal["content.start"]] = None
|
|
@@ -26,8 +26,7 @@ __all__ = ["ContentStop"]
|
|
|
26
26
|
class ContentStop(BaseModel):
|
|
27
27
|
event_id: Optional[str] = None
|
|
28
28
|
"""
|
|
29
|
-
The event_id token to be used to resume the interaction stream, from
|
|
30
|
-
this event.
|
|
29
|
+
The event_id token to be used to resume the interaction stream, from this event.
|
|
31
30
|
"""
|
|
32
31
|
|
|
33
32
|
event_type: Optional[Literal["content.stop"]] = None
|
|
@@ -30,8 +30,10 @@ class DocumentContent(BaseModel):
|
|
|
30
30
|
type: Literal["document"]
|
|
31
31
|
|
|
32
32
|
data: Optional[str] = None
|
|
33
|
+
"""The document content."""
|
|
33
34
|
|
|
34
35
|
mime_type: Optional[DocumentMimeType] = None
|
|
35
36
|
"""The mime type of the document."""
|
|
36
37
|
|
|
37
38
|
uri: Optional[str] = None
|
|
39
|
+
"""The URI of the document."""
|
|
@@ -34,11 +34,13 @@ class DocumentContentParam(TypedDict, total=False):
|
|
|
34
34
|
type: Required[Literal["document"]]
|
|
35
35
|
|
|
36
36
|
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
|
|
37
|
+
"""The document content."""
|
|
37
38
|
|
|
38
39
|
mime_type: DocumentMimeTypeParam
|
|
39
40
|
"""The mime type of the document."""
|
|
40
41
|
|
|
41
42
|
uri: str
|
|
43
|
+
"""The URI of the document."""
|
|
42
44
|
|
|
43
45
|
|
|
44
46
|
set_pydantic_config(DocumentContentParam, {"arbitrary_types_allowed": True})
|
|
@@ -39,8 +39,7 @@ class ErrorEvent(BaseModel):
|
|
|
39
39
|
|
|
40
40
|
event_id: Optional[str] = None
|
|
41
41
|
"""
|
|
42
|
-
The event_id token to be used to resume the interaction stream, from
|
|
43
|
-
this event.
|
|
42
|
+
The event_id token to be used to resume the interaction stream, from this event.
|
|
44
43
|
"""
|
|
45
44
|
|
|
46
45
|
event_type: Optional[Literal["error"]] = None
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
17
|
+
|
|
18
|
+
from typing import Optional
|
|
19
|
+
from typing_extensions import Literal
|
|
20
|
+
|
|
21
|
+
from .._models import BaseModel
|
|
22
|
+
|
|
23
|
+
__all__ = ["FileSearchCallContent"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class FileSearchCallContent(BaseModel):
|
|
27
|
+
"""File Search content."""
|
|
28
|
+
|
|
29
|
+
type: Literal["file_search_call"]
|
|
30
|
+
|
|
31
|
+
id: Optional[str] = None
|
|
32
|
+
"""A unique ID for this specific tool call."""
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
21
|
+
|
|
22
|
+
__all__ = ["FileSearchCallContentParam"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class FileSearchCallContentParam(TypedDict, total=False):
|
|
26
|
+
"""File Search content."""
|
|
27
|
+
|
|
28
|
+
type: Required[Literal["file_search_call"]]
|
|
29
|
+
|
|
30
|
+
id: str
|
|
31
|
+
"""A unique ID for this specific tool call."""
|
|
@@ -20,6 +20,7 @@ from typing_extensions import Literal
|
|
|
20
20
|
|
|
21
21
|
from .._models import BaseModel
|
|
22
22
|
from .tool_choice import ToolChoice
|
|
23
|
+
from .image_config import ImageConfig
|
|
23
24
|
from .speech_config import SpeechConfig
|
|
24
25
|
from .thinking_level import ThinkingLevel
|
|
25
26
|
|
|
@@ -29,6 +30,9 @@ __all__ = ["GenerationConfig"]
|
|
|
29
30
|
class GenerationConfig(BaseModel):
|
|
30
31
|
"""Configuration parameters for model interactions."""
|
|
31
32
|
|
|
33
|
+
image_config: Optional[ImageConfig] = None
|
|
34
|
+
"""Configuration for image interaction."""
|
|
35
|
+
|
|
32
36
|
max_output_tokens: Optional[int] = None
|
|
33
37
|
"""The maximum number of tokens to include in the response."""
|
|
34
38
|
|
|
@@ -23,6 +23,7 @@ from typing_extensions import Literal, TypedDict
|
|
|
23
23
|
from .._types import SequenceNotStr
|
|
24
24
|
from .thinking_level import ThinkingLevel
|
|
25
25
|
from .tool_choice_param import ToolChoiceParam
|
|
26
|
+
from .image_config_param import ImageConfigParam
|
|
26
27
|
from .speech_config_param import SpeechConfigParam
|
|
27
28
|
|
|
28
29
|
__all__ = ["GenerationConfigParam"]
|
|
@@ -31,6 +32,9 @@ __all__ = ["GenerationConfigParam"]
|
|
|
31
32
|
class GenerationConfigParam(TypedDict, total=False):
|
|
32
33
|
"""Configuration parameters for model interactions."""
|
|
33
34
|
|
|
35
|
+
image_config: ImageConfigParam
|
|
36
|
+
"""Configuration for image interaction."""
|
|
37
|
+
|
|
34
38
|
max_output_tokens: int
|
|
35
39
|
"""The maximum number of tokens to include in the response."""
|
|
36
40
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
17
|
+
|
|
18
|
+
from typing import Optional
|
|
19
|
+
from typing_extensions import Literal
|
|
20
|
+
|
|
21
|
+
from .._models import BaseModel
|
|
22
|
+
|
|
23
|
+
__all__ = ["ImageConfig"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ImageConfig(BaseModel):
|
|
27
|
+
"""The configuration for image interaction."""
|
|
28
|
+
|
|
29
|
+
aspect_ratio: Optional[Literal["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"]] = None
|
|
30
|
+
|
|
31
|
+
image_size: Optional[Literal["1K", "2K", "4K"]] = None
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from typing_extensions import Literal, TypedDict
|
|
21
|
+
|
|
22
|
+
__all__ = ["ImageConfigParam"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ImageConfigParam(TypedDict, total=False):
|
|
26
|
+
"""The configuration for image interaction."""
|
|
27
|
+
|
|
28
|
+
aspect_ratio: Literal["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"]
|
|
29
|
+
|
|
30
|
+
image_size: Literal["1K", "2K", "4K"]
|
|
@@ -30,6 +30,7 @@ class ImageContent(BaseModel):
|
|
|
30
30
|
type: Literal["image"]
|
|
31
31
|
|
|
32
32
|
data: Optional[str] = None
|
|
33
|
+
"""The image content."""
|
|
33
34
|
|
|
34
35
|
mime_type: Optional[ImageMimeType] = None
|
|
35
36
|
"""The mime type of the image."""
|
|
@@ -38,3 +39,4 @@ class ImageContent(BaseModel):
|
|
|
38
39
|
"""The resolution of the media."""
|
|
39
40
|
|
|
40
41
|
uri: Optional[str] = None
|
|
42
|
+
"""The URI of the image."""
|
|
@@ -34,6 +34,7 @@ class ImageContentParam(TypedDict, total=False):
|
|
|
34
34
|
type: Required[Literal["image"]]
|
|
35
35
|
|
|
36
36
|
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
|
|
37
|
+
"""The image content."""
|
|
37
38
|
|
|
38
39
|
mime_type: ImageMimeTypeParam
|
|
39
40
|
"""The mime type of the image."""
|
|
@@ -42,6 +43,7 @@ class ImageContentParam(TypedDict, total=False):
|
|
|
42
43
|
"""The resolution of the media."""
|
|
43
44
|
|
|
44
45
|
uri: str
|
|
46
|
+
"""The URI of the image."""
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
set_pydantic_config(ImageContentParam, {"arbitrary_types_allowed": True})
|
|
@@ -34,6 +34,7 @@ from .document_content import DocumentContent
|
|
|
34
34
|
from .dynamic_agent_config import DynamicAgentConfig
|
|
35
35
|
from .function_call_content import FunctionCallContent
|
|
36
36
|
from .function_result_content import FunctionResultContent
|
|
37
|
+
from .file_search_call_content import FileSearchCallContent
|
|
37
38
|
from .url_context_call_content import URLContextCallContent
|
|
38
39
|
from .deep_research_agent_config import DeepResearchAgentConfig
|
|
39
40
|
from .file_search_result_content import FileSearchResultContent
|
|
@@ -71,6 +72,7 @@ Input: TypeAlias = Union[
|
|
|
71
72
|
GoogleSearchResultContent,
|
|
72
73
|
MCPServerToolCallContent,
|
|
73
74
|
MCPServerToolResultContent,
|
|
75
|
+
FileSearchCallContent,
|
|
74
76
|
FileSearchResultContent,
|
|
75
77
|
]
|
|
76
78
|
|
|
@@ -34,6 +34,7 @@ from .generation_config_param import GenerationConfigParam
|
|
|
34
34
|
from .dynamic_agent_config_param import DynamicAgentConfigParam
|
|
35
35
|
from .function_call_content_param import FunctionCallContentParam
|
|
36
36
|
from .function_result_content_param import FunctionResultContentParam
|
|
37
|
+
from .file_search_call_content_param import FileSearchCallContentParam
|
|
37
38
|
from .url_context_call_content_param import URLContextCallContentParam
|
|
38
39
|
from .deep_research_agent_config_param import DeepResearchAgentConfigParam
|
|
39
40
|
from .file_search_result_content_param import FileSearchResultContentParam
|
|
@@ -117,6 +118,7 @@ Input: TypeAlias = Union[
|
|
|
117
118
|
GoogleSearchResultContentParam,
|
|
118
119
|
MCPServerToolCallContentParam,
|
|
119
120
|
MCPServerToolResultContentParam,
|
|
121
|
+
FileSearchCallContentParam,
|
|
120
122
|
FileSearchResultContentParam,
|
|
121
123
|
]
|
|
122
124
|
|
|
@@ -27,8 +27,7 @@ __all__ = ["InteractionEvent"]
|
|
|
27
27
|
class InteractionEvent(BaseModel):
|
|
28
28
|
event_id: Optional[str] = None
|
|
29
29
|
"""
|
|
30
|
-
The event_id token to be used to resume the interaction stream, from
|
|
31
|
-
this event.
|
|
30
|
+
The event_id token to be used to resume the interaction stream, from this event.
|
|
32
31
|
"""
|
|
33
32
|
|
|
34
33
|
event_type: Optional[Literal["interaction.start", "interaction.complete"]] = None
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
17
17
|
|
|
18
18
|
from typing import Union
|
|
19
|
-
from typing_extensions import TypeAlias
|
|
19
|
+
from typing_extensions import Annotated, TypeAlias
|
|
20
20
|
|
|
21
|
+
from .._utils import PropertyInfo
|
|
21
22
|
from .error_event import ErrorEvent
|
|
22
23
|
from .content_stop import ContentStop
|
|
23
24
|
from .content_delta import ContentDelta
|
|
@@ -27,6 +28,7 @@ from .interaction_status_update import InteractionStatusUpdate
|
|
|
27
28
|
|
|
28
29
|
__all__ = ["InteractionSSEEvent"]
|
|
29
30
|
|
|
30
|
-
InteractionSSEEvent: TypeAlias =
|
|
31
|
-
InteractionEvent, InteractionStatusUpdate, ContentStart, ContentDelta, ContentStop, ErrorEvent
|
|
31
|
+
InteractionSSEEvent: TypeAlias = Annotated[
|
|
32
|
+
Union[InteractionEvent, InteractionStatusUpdate, ContentStart, ContentDelta, ContentStop, ErrorEvent],
|
|
33
|
+
PropertyInfo(discriminator="event_type"),
|
|
32
34
|
]
|
|
@@ -26,8 +26,7 @@ __all__ = ["InteractionStatusUpdate"]
|
|
|
26
26
|
class InteractionStatusUpdate(BaseModel):
|
|
27
27
|
event_id: Optional[str] = None
|
|
28
28
|
"""
|
|
29
|
-
The event_id token to be used to resume the interaction stream, from
|
|
30
|
-
this event.
|
|
29
|
+
The event_id token to be used to resume the interaction stream, from this event.
|
|
31
30
|
"""
|
|
32
31
|
|
|
33
32
|
event_type: Optional[Literal["interaction.status_update"]] = None
|
|
@@ -30,6 +30,7 @@ class VideoContent(BaseModel):
|
|
|
30
30
|
type: Literal["video"]
|
|
31
31
|
|
|
32
32
|
data: Optional[str] = None
|
|
33
|
+
"""The video content."""
|
|
33
34
|
|
|
34
35
|
mime_type: Optional[VideoMimeType] = None
|
|
35
36
|
"""The mime type of the video."""
|
|
@@ -38,3 +39,4 @@ class VideoContent(BaseModel):
|
|
|
38
39
|
"""The resolution of the media."""
|
|
39
40
|
|
|
40
41
|
uri: Optional[str] = None
|
|
42
|
+
"""The URI of the video."""
|
|
@@ -34,6 +34,7 @@ class VideoContentParam(TypedDict, total=False):
|
|
|
34
34
|
type: Required[Literal["video"]]
|
|
35
35
|
|
|
36
36
|
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
|
|
37
|
+
"""The video content."""
|
|
37
38
|
|
|
38
39
|
mime_type: VideoMimeTypeParam
|
|
39
40
|
"""The mime type of the video."""
|
|
@@ -42,6 +43,7 @@ class VideoContentParam(TypedDict, total=False):
|
|
|
42
43
|
"""The resolution of the media."""
|
|
43
44
|
|
|
44
45
|
uri: str
|
|
46
|
+
"""The URI of the video."""
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
set_pydantic_config(VideoContentParam, {"arbitrary_types_allowed": True})
|
google/genai/_live_converters.py
CHANGED
|
@@ -1151,6 +1151,59 @@ def _LiveSendRealtimeInputParameters_to_vertex(
|
|
|
1151
1151
|
return to_object
|
|
1152
1152
|
|
|
1153
1153
|
|
|
1154
|
+
def _LiveServerMessage_from_mldev(
|
|
1155
|
+
from_object: Union[dict[str, Any], object],
|
|
1156
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
1157
|
+
) -> dict[str, Any]:
|
|
1158
|
+
to_object: dict[str, Any] = {}
|
|
1159
|
+
if getv(from_object, ['setupComplete']) is not None:
|
|
1160
|
+
setv(to_object, ['setup_complete'], getv(from_object, ['setupComplete']))
|
|
1161
|
+
|
|
1162
|
+
if getv(from_object, ['serverContent']) is not None:
|
|
1163
|
+
setv(to_object, ['server_content'], getv(from_object, ['serverContent']))
|
|
1164
|
+
|
|
1165
|
+
if getv(from_object, ['toolCall']) is not None:
|
|
1166
|
+
setv(to_object, ['tool_call'], getv(from_object, ['toolCall']))
|
|
1167
|
+
|
|
1168
|
+
if getv(from_object, ['toolCallCancellation']) is not None:
|
|
1169
|
+
setv(
|
|
1170
|
+
to_object,
|
|
1171
|
+
['tool_call_cancellation'],
|
|
1172
|
+
getv(from_object, ['toolCallCancellation']),
|
|
1173
|
+
)
|
|
1174
|
+
|
|
1175
|
+
if getv(from_object, ['usageMetadata']) is not None:
|
|
1176
|
+
setv(to_object, ['usage_metadata'], getv(from_object, ['usageMetadata']))
|
|
1177
|
+
|
|
1178
|
+
if getv(from_object, ['goAway']) is not None:
|
|
1179
|
+
setv(to_object, ['go_away'], getv(from_object, ['goAway']))
|
|
1180
|
+
|
|
1181
|
+
if getv(from_object, ['sessionResumptionUpdate']) is not None:
|
|
1182
|
+
setv(
|
|
1183
|
+
to_object,
|
|
1184
|
+
['session_resumption_update'],
|
|
1185
|
+
getv(from_object, ['sessionResumptionUpdate']),
|
|
1186
|
+
)
|
|
1187
|
+
|
|
1188
|
+
if getv(from_object, ['voiceActivityDetectionSignal']) is not None:
|
|
1189
|
+
setv(
|
|
1190
|
+
to_object,
|
|
1191
|
+
['voice_activity_detection_signal'],
|
|
1192
|
+
getv(from_object, ['voiceActivityDetectionSignal']),
|
|
1193
|
+
)
|
|
1194
|
+
|
|
1195
|
+
if getv(from_object, ['voiceActivity']) is not None:
|
|
1196
|
+
setv(
|
|
1197
|
+
to_object,
|
|
1198
|
+
['voice_activity'],
|
|
1199
|
+
_VoiceActivity_from_mldev(
|
|
1200
|
+
getv(from_object, ['voiceActivity']), to_object
|
|
1201
|
+
),
|
|
1202
|
+
)
|
|
1203
|
+
|
|
1204
|
+
return to_object
|
|
1205
|
+
|
|
1206
|
+
|
|
1154
1207
|
def _LiveServerMessage_from_vertex(
|
|
1155
1208
|
from_object: Union[dict[str, Any], object],
|
|
1156
1209
|
parent_object: Optional[dict[str, Any]] = None,
|
|
@@ -1198,6 +1251,15 @@ def _LiveServerMessage_from_vertex(
|
|
|
1198
1251
|
getv(from_object, ['voiceActivityDetectionSignal']),
|
|
1199
1252
|
)
|
|
1200
1253
|
|
|
1254
|
+
if getv(from_object, ['voiceActivity']) is not None:
|
|
1255
|
+
setv(
|
|
1256
|
+
to_object,
|
|
1257
|
+
['voice_activity'],
|
|
1258
|
+
_VoiceActivity_from_vertex(
|
|
1259
|
+
getv(from_object, ['voiceActivity']), to_object
|
|
1260
|
+
),
|
|
1261
|
+
)
|
|
1262
|
+
|
|
1201
1263
|
return to_object
|
|
1202
1264
|
|
|
1203
1265
|
|
|
@@ -1468,3 +1530,25 @@ def _UsageMetadata_from_vertex(
|
|
|
1468
1530
|
setv(to_object, ['traffic_type'], getv(from_object, ['trafficType']))
|
|
1469
1531
|
|
|
1470
1532
|
return to_object
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
def _VoiceActivity_from_mldev(
|
|
1536
|
+
from_object: Union[dict[str, Any], object],
|
|
1537
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
1538
|
+
) -> dict[str, Any]:
|
|
1539
|
+
to_object: dict[str, Any] = {}
|
|
1540
|
+
if getv(from_object, ['type']) is not None:
|
|
1541
|
+
setv(to_object, ['voice_activity_type'], getv(from_object, ['type']))
|
|
1542
|
+
|
|
1543
|
+
return to_object
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
def _VoiceActivity_from_vertex(
|
|
1547
|
+
from_object: Union[dict[str, Any], object],
|
|
1548
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
1549
|
+
) -> dict[str, Any]:
|
|
1550
|
+
to_object: dict[str, Any] = {}
|
|
1551
|
+
if getv(from_object, ['type']) is not None:
|
|
1552
|
+
setv(to_object, ['voice_activity_type'], getv(from_object, ['type']))
|
|
1553
|
+
|
|
1554
|
+
return to_object
|
google/genai/_transformers.py
CHANGED
|
@@ -285,29 +285,23 @@ def t_caches_model(
|
|
|
285
285
|
return model
|
|
286
286
|
|
|
287
287
|
|
|
288
|
-
def pil_to_blob(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
import PIL.PngImagePlugin
|
|
292
|
-
|
|
293
|
-
PngImagePlugin = PIL.PngImagePlugin
|
|
294
|
-
except ImportError:
|
|
295
|
-
PngImagePlugin = None
|
|
296
|
-
|
|
297
|
-
bytesio = io.BytesIO()
|
|
288
|
+
def pil_to_blob(image: Any) -> types.Blob:
|
|
289
|
+
image_format = 'PNG'
|
|
290
|
+
save_params: dict[str, Any] = dict()
|
|
298
291
|
if (
|
|
299
|
-
|
|
300
|
-
and
|
|
301
|
-
|
|
292
|
+
image.format == 'JPEG'
|
|
293
|
+
and getattr(image, 'filename', '')
|
|
294
|
+
and image.mode in ['1', 'L', 'RGB', 'RGBX', 'CMYK']
|
|
302
295
|
):
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
296
|
+
image_format = 'JPEG'
|
|
297
|
+
save_params.update(quality='keep')
|
|
298
|
+
|
|
299
|
+
image_io = io.BytesIO()
|
|
300
|
+
image.save(image_io, image_format, **save_params)
|
|
301
|
+
image_bytes = image_io.getvalue()
|
|
302
|
+
mime_type = f'image/{image_format.lower()}'
|
|
303
|
+
|
|
304
|
+
return types.Blob(data=image_bytes, mime_type=mime_type)
|
|
311
305
|
|
|
312
306
|
|
|
313
307
|
def t_function_response(
|