google-genai 1.55.0__py3-none-any.whl → 1.56.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/_interactions/_base_client.py +8 -2
- google/genai/_interactions/resources/interactions.py +6 -6
- google/genai/_interactions/types/__init__.py +2 -0
- google/genai/_interactions/types/audio_content.py +0 -1
- google/genai/_interactions/types/audio_content_param.py +0 -1
- google/genai/_interactions/types/code_execution_call_content.py +0 -1
- google/genai/_interactions/types/code_execution_call_content_param.py +0 -1
- google/genai/_interactions/types/code_execution_result_content.py +0 -1
- google/genai/_interactions/types/code_execution_result_content_param.py +0 -1
- google/genai/_interactions/types/content_delta.py +7 -23
- google/genai/_interactions/types/deep_research_agent_config.py +0 -1
- google/genai/_interactions/types/deep_research_agent_config_param.py +0 -1
- google/genai/_interactions/types/document_content.py +3 -2
- google/genai/_interactions/types/document_content_param.py +3 -2
- google/genai/{tests/__init__.py → _interactions/types/document_mime_type.py} +5 -3
- google/genai/{tests/afc/__init__.py → _interactions/types/document_mime_type_param.py} +8 -4
- google/genai/_interactions/types/dynamic_agent_config.py +0 -1
- google/genai/_interactions/types/dynamic_agent_config_param.py +0 -1
- google/genai/_interactions/types/file_search_result_content.py +0 -1
- google/genai/_interactions/types/file_search_result_content_param.py +0 -1
- google/genai/_interactions/types/function_call_content.py +0 -1
- google/genai/_interactions/types/function_call_content_param.py +0 -1
- google/genai/_interactions/types/function_result_content.py +1 -2
- google/genai/_interactions/types/function_result_content_param.py +1 -2
- google/genai/_interactions/types/google_search_call_content.py +0 -1
- google/genai/_interactions/types/google_search_call_content_param.py +0 -1
- google/genai/_interactions/types/google_search_result_content.py +0 -1
- google/genai/_interactions/types/google_search_result_content_param.py +0 -1
- google/genai/_interactions/types/image_content.py +1 -2
- google/genai/_interactions/types/image_content_param.py +1 -2
- google/genai/_interactions/types/mcp_server_tool_call_content.py +0 -1
- google/genai/_interactions/types/mcp_server_tool_call_content_param.py +0 -1
- google/genai/_interactions/types/mcp_server_tool_result_content.py +1 -2
- google/genai/_interactions/types/mcp_server_tool_result_content_param.py +1 -2
- google/genai/_interactions/types/text_content.py +0 -1
- google/genai/_interactions/types/text_content_param.py +0 -1
- google/genai/_interactions/types/thinking_level.py +1 -1
- google/genai/_interactions/types/thought_content.py +0 -1
- google/genai/_interactions/types/thought_content_param.py +0 -1
- google/genai/_interactions/types/url_context_call_content.py +0 -1
- google/genai/_interactions/types/url_context_call_content_param.py +0 -1
- google/genai/_interactions/types/url_context_result_content.py +0 -1
- google/genai/_interactions/types/url_context_result_content_param.py +0 -1
- google/genai/_interactions/types/video_content.py +1 -2
- google/genai/_interactions/types/video_content_param.py +1 -2
- google/genai/_live_converters.py +2 -30
- google/genai/client.py +3 -1
- google/genai/models.py +2 -29
- google/genai/tunings.py +1 -27
- google/genai/types.py +20 -22
- google/genai/version.py +1 -1
- {google_genai-1.55.0.dist-info → google_genai-1.56.0.dist-info}/METADATA +224 -22
- google_genai-1.56.0.dist-info/RECORD +162 -0
- google/genai/tests/afc/test_convert_if_exist_pydantic_model.py +0 -309
- google/genai/tests/afc/test_convert_number_values_for_function_call_args.py +0 -63
- google/genai/tests/afc/test_find_afc_incompatible_tool_indexes.py +0 -240
- google/genai/tests/afc/test_generate_content_stream_afc.py +0 -530
- google/genai/tests/afc/test_generate_content_stream_afc_thoughts.py +0 -77
- google/genai/tests/afc/test_get_function_map.py +0 -176
- google/genai/tests/afc/test_get_function_response_parts.py +0 -277
- google/genai/tests/afc/test_get_max_remote_calls_for_afc.py +0 -130
- google/genai/tests/afc/test_invoke_function_from_dict_args.py +0 -241
- google/genai/tests/afc/test_raise_error_for_afc_incompatible_config.py +0 -159
- google/genai/tests/afc/test_should_append_afc_history.py +0 -53
- google/genai/tests/afc/test_should_disable_afc.py +0 -214
- google/genai/tests/batches/__init__.py +0 -17
- google/genai/tests/batches/test_cancel.py +0 -77
- google/genai/tests/batches/test_create.py +0 -78
- google/genai/tests/batches/test_create_with_bigquery.py +0 -113
- google/genai/tests/batches/test_create_with_file.py +0 -82
- google/genai/tests/batches/test_create_with_gcs.py +0 -125
- google/genai/tests/batches/test_create_with_inlined_requests.py +0 -255
- google/genai/tests/batches/test_delete.py +0 -86
- google/genai/tests/batches/test_embedding.py +0 -157
- google/genai/tests/batches/test_get.py +0 -78
- google/genai/tests/batches/test_list.py +0 -79
- google/genai/tests/caches/__init__.py +0 -17
- google/genai/tests/caches/constants.py +0 -29
- google/genai/tests/caches/test_create.py +0 -210
- google/genai/tests/caches/test_create_custom_url.py +0 -105
- google/genai/tests/caches/test_delete.py +0 -54
- google/genai/tests/caches/test_delete_custom_url.py +0 -52
- google/genai/tests/caches/test_get.py +0 -94
- google/genai/tests/caches/test_get_custom_url.py +0 -52
- google/genai/tests/caches/test_list.py +0 -68
- google/genai/tests/caches/test_update.py +0 -70
- google/genai/tests/caches/test_update_custom_url.py +0 -58
- google/genai/tests/chats/__init__.py +0 -1
- google/genai/tests/chats/test_get_history.py +0 -597
- google/genai/tests/chats/test_send_message.py +0 -844
- google/genai/tests/chats/test_validate_response.py +0 -90
- google/genai/tests/client/__init__.py +0 -17
- google/genai/tests/client/test_async_stream.py +0 -427
- google/genai/tests/client/test_client_close.py +0 -197
- google/genai/tests/client/test_client_initialization.py +0 -1687
- google/genai/tests/client/test_client_requests.py +0 -355
- google/genai/tests/client/test_custom_client.py +0 -77
- google/genai/tests/client/test_http_options.py +0 -178
- google/genai/tests/client/test_replay_client_equality.py +0 -168
- google/genai/tests/client/test_retries.py +0 -846
- google/genai/tests/client/test_upload_errors.py +0 -136
- google/genai/tests/common/__init__.py +0 -17
- google/genai/tests/common/test_common.py +0 -954
- google/genai/tests/conftest.py +0 -162
- google/genai/tests/documents/__init__.py +0 -17
- google/genai/tests/documents/test_delete.py +0 -51
- google/genai/tests/documents/test_get.py +0 -85
- google/genai/tests/documents/test_list.py +0 -72
- google/genai/tests/errors/__init__.py +0 -1
- google/genai/tests/errors/test_api_error.py +0 -417
- google/genai/tests/file_search_stores/__init__.py +0 -17
- google/genai/tests/file_search_stores/test_create.py +0 -66
- google/genai/tests/file_search_stores/test_delete.py +0 -64
- google/genai/tests/file_search_stores/test_get.py +0 -94
- google/genai/tests/file_search_stores/test_import_file.py +0 -112
- google/genai/tests/file_search_stores/test_list.py +0 -57
- google/genai/tests/file_search_stores/test_upload_to_file_search_store.py +0 -141
- google/genai/tests/files/__init__.py +0 -17
- google/genai/tests/files/test_delete.py +0 -46
- google/genai/tests/files/test_download.py +0 -85
- google/genai/tests/files/test_get.py +0 -46
- google/genai/tests/files/test_list.py +0 -72
- google/genai/tests/files/test_upload.py +0 -255
- google/genai/tests/imports/test_no_optional_imports.py +0 -28
- google/genai/tests/interactions/test_integration.py +0 -80
- google/genai/tests/live/__init__.py +0 -16
- google/genai/tests/live/test_live.py +0 -2177
- google/genai/tests/live/test_live_music.py +0 -362
- google/genai/tests/live/test_live_response.py +0 -163
- google/genai/tests/live/test_send_client_content.py +0 -147
- google/genai/tests/live/test_send_realtime_input.py +0 -268
- google/genai/tests/live/test_send_tool_response.py +0 -222
- google/genai/tests/local_tokenizer/__init__.py +0 -17
- google/genai/tests/local_tokenizer/test_local_tokenizer.py +0 -343
- google/genai/tests/local_tokenizer/test_local_tokenizer_loader.py +0 -235
- google/genai/tests/mcp/__init__.py +0 -17
- google/genai/tests/mcp/test_has_mcp_tool_usage.py +0 -89
- google/genai/tests/mcp/test_mcp_to_gemini_tools.py +0 -191
- google/genai/tests/mcp/test_parse_config_for_mcp_sessions.py +0 -201
- google/genai/tests/mcp/test_parse_config_for_mcp_usage.py +0 -130
- google/genai/tests/mcp/test_set_mcp_usage_header.py +0 -72
- google/genai/tests/models/__init__.py +0 -17
- google/genai/tests/models/constants.py +0 -8
- google/genai/tests/models/test_compute_tokens.py +0 -120
- google/genai/tests/models/test_count_tokens.py +0 -159
- google/genai/tests/models/test_delete.py +0 -107
- google/genai/tests/models/test_edit_image.py +0 -264
- google/genai/tests/models/test_embed_content.py +0 -94
- google/genai/tests/models/test_function_call_streaming.py +0 -442
- google/genai/tests/models/test_generate_content.py +0 -2502
- google/genai/tests/models/test_generate_content_cached_content.py +0 -132
- google/genai/tests/models/test_generate_content_config_zero_value.py +0 -103
- google/genai/tests/models/test_generate_content_from_apikey.py +0 -44
- google/genai/tests/models/test_generate_content_http_options.py +0 -40
- google/genai/tests/models/test_generate_content_image_generation.py +0 -143
- google/genai/tests/models/test_generate_content_mcp.py +0 -343
- google/genai/tests/models/test_generate_content_media_resolution.py +0 -97
- google/genai/tests/models/test_generate_content_model.py +0 -139
- google/genai/tests/models/test_generate_content_part.py +0 -821
- google/genai/tests/models/test_generate_content_thought.py +0 -76
- google/genai/tests/models/test_generate_content_tools.py +0 -1761
- google/genai/tests/models/test_generate_images.py +0 -191
- google/genai/tests/models/test_generate_videos.py +0 -759
- google/genai/tests/models/test_get.py +0 -104
- google/genai/tests/models/test_list.py +0 -233
- google/genai/tests/models/test_recontext_image.py +0 -189
- google/genai/tests/models/test_segment_image.py +0 -148
- google/genai/tests/models/test_update.py +0 -95
- google/genai/tests/models/test_upscale_image.py +0 -157
- google/genai/tests/operations/__init__.py +0 -17
- google/genai/tests/operations/test_get.py +0 -38
- google/genai/tests/public_samples/__init__.py +0 -17
- google/genai/tests/public_samples/test_gemini_text_only.py +0 -34
- google/genai/tests/pytest_helper.py +0 -229
- google/genai/tests/shared/__init__.py +0 -16
- google/genai/tests/shared/batches/__init__.py +0 -14
- google/genai/tests/shared/batches/test_create_delete.py +0 -57
- google/genai/tests/shared/batches/test_create_get_cancel.py +0 -56
- google/genai/tests/shared/batches/test_list.py +0 -40
- google/genai/tests/shared/caches/__init__.py +0 -14
- google/genai/tests/shared/caches/test_create_get_delete.py +0 -67
- google/genai/tests/shared/caches/test_create_update_get.py +0 -71
- google/genai/tests/shared/caches/test_list.py +0 -40
- google/genai/tests/shared/chats/__init__.py +0 -14
- google/genai/tests/shared/chats/test_send_message.py +0 -48
- google/genai/tests/shared/chats/test_send_message_stream.py +0 -50
- google/genai/tests/shared/files/__init__.py +0 -14
- google/genai/tests/shared/files/test_list.py +0 -41
- google/genai/tests/shared/files/test_upload_get_delete.py +0 -54
- google/genai/tests/shared/models/__init__.py +0 -14
- google/genai/tests/shared/models/test_compute_tokens.py +0 -41
- google/genai/tests/shared/models/test_count_tokens.py +0 -40
- google/genai/tests/shared/models/test_edit_image.py +0 -67
- google/genai/tests/shared/models/test_embed.py +0 -40
- google/genai/tests/shared/models/test_generate_content.py +0 -39
- google/genai/tests/shared/models/test_generate_content_stream.py +0 -54
- google/genai/tests/shared/models/test_generate_images.py +0 -40
- google/genai/tests/shared/models/test_generate_videos.py +0 -38
- google/genai/tests/shared/models/test_list.py +0 -37
- google/genai/tests/shared/models/test_recontext_image.py +0 -55
- google/genai/tests/shared/models/test_segment_image.py +0 -52
- google/genai/tests/shared/models/test_upscale_image.py +0 -52
- google/genai/tests/shared/tunings/__init__.py +0 -16
- google/genai/tests/shared/tunings/test_create.py +0 -46
- google/genai/tests/shared/tunings/test_create_get_cancel.py +0 -56
- google/genai/tests/shared/tunings/test_list.py +0 -39
- google/genai/tests/tokens/__init__.py +0 -16
- google/genai/tests/tokens/test_create.py +0 -154
- google/genai/tests/transformers/__init__.py +0 -17
- google/genai/tests/transformers/test_blobs.py +0 -71
- google/genai/tests/transformers/test_bytes.py +0 -15
- google/genai/tests/transformers/test_duck_type.py +0 -96
- google/genai/tests/transformers/test_function_responses.py +0 -72
- google/genai/tests/transformers/test_schema.py +0 -653
- google/genai/tests/transformers/test_t_batch.py +0 -286
- google/genai/tests/transformers/test_t_content.py +0 -160
- google/genai/tests/transformers/test_t_contents.py +0 -398
- google/genai/tests/transformers/test_t_part.py +0 -85
- google/genai/tests/transformers/test_t_parts.py +0 -87
- google/genai/tests/transformers/test_t_tool.py +0 -157
- google/genai/tests/transformers/test_t_tools.py +0 -195
- google/genai/tests/tunings/__init__.py +0 -16
- google/genai/tests/tunings/test_cancel.py +0 -39
- google/genai/tests/tunings/test_end_to_end.py +0 -106
- google/genai/tests/tunings/test_get.py +0 -67
- google/genai/tests/tunings/test_list.py +0 -75
- google/genai/tests/tunings/test_tune.py +0 -268
- google/genai/tests/types/__init__.py +0 -16
- google/genai/tests/types/test_bytes_internal.py +0 -271
- google/genai/tests/types/test_bytes_type.py +0 -152
- google/genai/tests/types/test_future.py +0 -101
- google/genai/tests/types/test_optional_types.py +0 -36
- google/genai/tests/types/test_part_type.py +0 -616
- google/genai/tests/types/test_schema_from_json_schema.py +0 -417
- google/genai/tests/types/test_schema_json_schema.py +0 -468
- google/genai/tests/types/test_types.py +0 -2903
- google_genai-1.55.0.dist-info/RECORD +0 -345
- /google/genai/{tests/interactions/__init__.py → _interactions/py.typed} +0 -0
- {google_genai-1.55.0.dist-info → google_genai-1.56.0.dist-info}/WHEEL +0 -0
- {google_genai-1.55.0.dist-info → google_genai-1.56.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.55.0.dist-info → google_genai-1.56.0.dist-info}/top_level.txt +0 -0
|
@@ -29,7 +29,6 @@ class TextContentParam(TypedDict, total=False):
|
|
|
29
29
|
"""A text content block."""
|
|
30
30
|
|
|
31
31
|
type: Required[Literal["text"]]
|
|
32
|
-
"""Used as the OpenAPI type discriminator for the content oneof."""
|
|
33
32
|
|
|
34
33
|
annotations: Iterable[AnnotationParam]
|
|
35
34
|
"""Citation information for model-generated content."""
|
|
@@ -32,7 +32,6 @@ class ThoughtContent(BaseModel):
|
|
|
32
32
|
"""A thought content block."""
|
|
33
33
|
|
|
34
34
|
type: Literal["thought"]
|
|
35
|
-
"""Used as the OpenAPI type discriminator for the content oneof."""
|
|
36
35
|
|
|
37
36
|
signature: Optional[str] = None
|
|
38
37
|
"""Signature to match the backend source to be part of the generation."""
|
|
@@ -35,7 +35,6 @@ class ThoughtContentParam(TypedDict, total=False):
|
|
|
35
35
|
"""A thought content block."""
|
|
36
36
|
|
|
37
37
|
type: Required[Literal["thought"]]
|
|
38
|
-
"""Used as the OpenAPI type discriminator for the content oneof."""
|
|
39
38
|
|
|
40
39
|
signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
|
|
41
40
|
"""Signature to match the backend source to be part of the generation."""
|
|
@@ -28,7 +28,6 @@ class URLContextCallContentParam(TypedDict, total=False):
|
|
|
28
28
|
"""URL context content."""
|
|
29
29
|
|
|
30
30
|
type: Required[Literal["url_context_call"]]
|
|
31
|
-
"""Used as the OpenAPI type discriminator for the content oneof."""
|
|
32
31
|
|
|
33
32
|
id: str
|
|
34
33
|
"""A unique ID for this specific tool call."""
|
|
@@ -28,7 +28,6 @@ class URLContextResultContent(BaseModel):
|
|
|
28
28
|
"""URL context result content."""
|
|
29
29
|
|
|
30
30
|
type: Literal["url_context_result"]
|
|
31
|
-
"""Used as the OpenAPI type discriminator for the content oneof."""
|
|
32
31
|
|
|
33
32
|
call_id: Optional[str] = None
|
|
34
33
|
"""ID to match the ID from the url context call block."""
|
|
@@ -29,7 +29,6 @@ class URLContextResultContentParam(TypedDict, total=False):
|
|
|
29
29
|
"""URL context result content."""
|
|
30
30
|
|
|
31
31
|
type: Required[Literal["url_context_result"]]
|
|
32
|
-
"""Used as the OpenAPI type discriminator for the content oneof."""
|
|
33
32
|
|
|
34
33
|
call_id: str
|
|
35
34
|
"""ID to match the ID from the url context call block."""
|
|
@@ -28,14 +28,13 @@ class VideoContent(BaseModel):
|
|
|
28
28
|
"""A video content block."""
|
|
29
29
|
|
|
30
30
|
type: Literal["video"]
|
|
31
|
-
"""Used as the OpenAPI type discriminator for the content oneof."""
|
|
32
31
|
|
|
33
32
|
data: Optional[str] = None
|
|
34
33
|
|
|
35
34
|
mime_type: Optional[VideoMimeType] = None
|
|
36
35
|
"""The mime type of the video."""
|
|
37
36
|
|
|
38
|
-
resolution: Optional[Literal["low", "medium", "high"]] = None
|
|
37
|
+
resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None
|
|
39
38
|
"""The resolution of the media."""
|
|
40
39
|
|
|
41
40
|
uri: Optional[str] = None
|
|
@@ -32,14 +32,13 @@ class VideoContentParam(TypedDict, total=False):
|
|
|
32
32
|
"""A video content block."""
|
|
33
33
|
|
|
34
34
|
type: Required[Literal["video"]]
|
|
35
|
-
"""Used as the OpenAPI type discriminator for the content oneof."""
|
|
36
35
|
|
|
37
36
|
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
|
|
38
37
|
|
|
39
38
|
mime_type: VideoMimeTypeParam
|
|
40
39
|
"""The mime type of the video."""
|
|
41
40
|
|
|
42
|
-
resolution: Literal["low", "medium", "high"]
|
|
41
|
+
resolution: Literal["low", "medium", "high", "ultra_high"]
|
|
43
42
|
"""The resolution of the media."""
|
|
44
43
|
|
|
45
44
|
uri: str
|
google/genai/_live_converters.py
CHANGED
|
@@ -226,13 +226,7 @@ def _GenerationConfig_to_vertex(
|
|
|
226
226
|
setv(to_object, ['seed'], getv(from_object, ['seed']))
|
|
227
227
|
|
|
228
228
|
if getv(from_object, ['speech_config']) is not None:
|
|
229
|
-
setv(
|
|
230
|
-
to_object,
|
|
231
|
-
['speechConfig'],
|
|
232
|
-
_SpeechConfig_to_vertex(
|
|
233
|
-
getv(from_object, ['speech_config']), to_object
|
|
234
|
-
),
|
|
235
|
-
)
|
|
229
|
+
setv(to_object, ['speechConfig'], getv(from_object, ['speech_config']))
|
|
236
230
|
|
|
237
231
|
if getv(from_object, ['stop_sequences']) is not None:
|
|
238
232
|
setv(to_object, ['stopSequences'], getv(from_object, ['stop_sequences']))
|
|
@@ -842,10 +836,7 @@ def _LiveConnectConfig_to_vertex(
|
|
|
842
836
|
setv(
|
|
843
837
|
parent_object,
|
|
844
838
|
['setup', 'generationConfig', 'speechConfig'],
|
|
845
|
-
|
|
846
|
-
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
|
847
|
-
to_object,
|
|
848
|
-
),
|
|
839
|
+
t.t_live_speech_config(getv(from_object, ['speech_config'])),
|
|
849
840
|
)
|
|
850
841
|
|
|
851
842
|
if getv(from_object, ['thinking_config']) is not None:
|
|
@@ -1291,25 +1282,6 @@ def _SessionResumptionConfig_to_mldev(
|
|
|
1291
1282
|
return to_object
|
|
1292
1283
|
|
|
1293
1284
|
|
|
1294
|
-
def _SpeechConfig_to_vertex(
|
|
1295
|
-
from_object: Union[dict[str, Any], object],
|
|
1296
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
1297
|
-
) -> dict[str, Any]:
|
|
1298
|
-
to_object: dict[str, Any] = {}
|
|
1299
|
-
if getv(from_object, ['voice_config']) is not None:
|
|
1300
|
-
setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config']))
|
|
1301
|
-
|
|
1302
|
-
if getv(from_object, ['language_code']) is not None:
|
|
1303
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
|
1304
|
-
|
|
1305
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
|
1306
|
-
raise ValueError(
|
|
1307
|
-
'multi_speaker_voice_config parameter is not supported in Vertex AI.'
|
|
1308
|
-
)
|
|
1309
|
-
|
|
1310
|
-
return to_object
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
1285
|
def _Tool_to_mldev(
|
|
1314
1286
|
from_object: Union[dict[str, Any], object],
|
|
1315
1287
|
parent_object: Optional[dict[str, Any]] = None,
|
google/genai/client.py
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import asyncio
|
|
17
17
|
import os
|
|
18
18
|
from types import TracebackType
|
|
19
|
-
from typing import Optional, Union
|
|
19
|
+
from typing import Optional, Union, cast
|
|
20
20
|
|
|
21
21
|
import google.auth
|
|
22
22
|
import pydantic
|
|
@@ -116,6 +116,7 @@ class AsyncClient:
|
|
|
116
116
|
self._nextgen_client_instance = AsyncGeminiNextGenAPIClient(
|
|
117
117
|
base_url=http_opts.base_url,
|
|
118
118
|
api_key=self._api_client.api_key,
|
|
119
|
+
api_version=http_opts.api_version,
|
|
119
120
|
default_headers=http_opts.headers,
|
|
120
121
|
http_client=http_client,
|
|
121
122
|
# uSDk expects ms, nextgen uses a httpx Timeout -> expects seconds.
|
|
@@ -485,6 +486,7 @@ class Client:
|
|
|
485
486
|
self._nextgen_client_instance = GeminiNextGenAPIClient(
|
|
486
487
|
base_url=http_opts.base_url,
|
|
487
488
|
api_key=self._api_client.api_key,
|
|
489
|
+
api_version=http_opts.api_version,
|
|
488
490
|
default_headers=http_opts.headers,
|
|
489
491
|
http_client=self._api_client._httpx_client,
|
|
490
492
|
# uSDk expects ms, nextgen uses a httpx Timeout -> expects seconds.
|
google/genai/models.py
CHANGED
|
@@ -1258,9 +1258,7 @@ def _GenerateContentConfig_to_vertex(
|
|
|
1258
1258
|
setv(
|
|
1259
1259
|
to_object,
|
|
1260
1260
|
['speechConfig'],
|
|
1261
|
-
|
|
1262
|
-
t.t_speech_config(getv(from_object, ['speech_config'])), to_object
|
|
1263
|
-
),
|
|
1261
|
+
t.t_speech_config(getv(from_object, ['speech_config'])),
|
|
1264
1262
|
)
|
|
1265
1263
|
|
|
1266
1264
|
if getv(from_object, ['audio_timestamp']) is not None:
|
|
@@ -2446,13 +2444,7 @@ def _GenerationConfig_to_vertex(
|
|
|
2446
2444
|
setv(to_object, ['seed'], getv(from_object, ['seed']))
|
|
2447
2445
|
|
|
2448
2446
|
if getv(from_object, ['speech_config']) is not None:
|
|
2449
|
-
setv(
|
|
2450
|
-
to_object,
|
|
2451
|
-
['speechConfig'],
|
|
2452
|
-
_SpeechConfig_to_vertex(
|
|
2453
|
-
getv(from_object, ['speech_config']), to_object
|
|
2454
|
-
),
|
|
2455
|
-
)
|
|
2447
|
+
setv(to_object, ['speechConfig'], getv(from_object, ['speech_config']))
|
|
2456
2448
|
|
|
2457
2449
|
if getv(from_object, ['stop_sequences']) is not None:
|
|
2458
2450
|
setv(to_object, ['stopSequences'], getv(from_object, ['stop_sequences']))
|
|
@@ -3427,25 +3419,6 @@ def _SegmentImageSource_to_vertex(
|
|
|
3427
3419
|
return to_object
|
|
3428
3420
|
|
|
3429
3421
|
|
|
3430
|
-
def _SpeechConfig_to_vertex(
|
|
3431
|
-
from_object: Union[dict[str, Any], object],
|
|
3432
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
3433
|
-
) -> dict[str, Any]:
|
|
3434
|
-
to_object: dict[str, Any] = {}
|
|
3435
|
-
if getv(from_object, ['voice_config']) is not None:
|
|
3436
|
-
setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config']))
|
|
3437
|
-
|
|
3438
|
-
if getv(from_object, ['language_code']) is not None:
|
|
3439
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
|
3440
|
-
|
|
3441
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
|
3442
|
-
raise ValueError(
|
|
3443
|
-
'multi_speaker_voice_config parameter is not supported in Vertex AI.'
|
|
3444
|
-
)
|
|
3445
|
-
|
|
3446
|
-
return to_object
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
3422
|
def _ToolConfig_to_mldev(
|
|
3450
3423
|
from_object: Union[dict[str, Any], object],
|
|
3451
3424
|
parent_object: Optional[dict[str, Any]] = None,
|
google/genai/tunings.py
CHANGED
|
@@ -674,13 +674,7 @@ def _GenerationConfig_to_vertex(
|
|
|
674
674
|
setv(to_object, ['seed'], getv(from_object, ['seed']))
|
|
675
675
|
|
|
676
676
|
if getv(from_object, ['speech_config']) is not None:
|
|
677
|
-
setv(
|
|
678
|
-
to_object,
|
|
679
|
-
['speechConfig'],
|
|
680
|
-
_SpeechConfig_to_vertex(
|
|
681
|
-
getv(from_object, ['speech_config']), to_object, root_object
|
|
682
|
-
),
|
|
683
|
-
)
|
|
677
|
+
setv(to_object, ['speechConfig'], getv(from_object, ['speech_config']))
|
|
684
678
|
|
|
685
679
|
if getv(from_object, ['stop_sequences']) is not None:
|
|
686
680
|
setv(to_object, ['stopSequences'], getv(from_object, ['stop_sequences']))
|
|
@@ -861,26 +855,6 @@ def _ListTuningJobsResponse_from_vertex(
|
|
|
861
855
|
return to_object
|
|
862
856
|
|
|
863
857
|
|
|
864
|
-
def _SpeechConfig_to_vertex(
|
|
865
|
-
from_object: Union[dict[str, Any], object],
|
|
866
|
-
parent_object: Optional[dict[str, Any]] = None,
|
|
867
|
-
root_object: Optional[Union[dict[str, Any], object]] = None,
|
|
868
|
-
) -> dict[str, Any]:
|
|
869
|
-
to_object: dict[str, Any] = {}
|
|
870
|
-
if getv(from_object, ['voice_config']) is not None:
|
|
871
|
-
setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config']))
|
|
872
|
-
|
|
873
|
-
if getv(from_object, ['language_code']) is not None:
|
|
874
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
|
875
|
-
|
|
876
|
-
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
|
877
|
-
raise ValueError(
|
|
878
|
-
'multi_speaker_voice_config parameter is not supported in Vertex AI.'
|
|
879
|
-
)
|
|
880
|
-
|
|
881
|
-
return to_object
|
|
882
|
-
|
|
883
|
-
|
|
884
858
|
def _TunedModel_from_mldev(
|
|
885
859
|
from_object: Union[dict[str, Any], object],
|
|
886
860
|
parent_object: Optional[dict[str, Any]] = None,
|
google/genai/types.py
CHANGED
|
@@ -86,11 +86,6 @@ else:
|
|
|
86
86
|
|
|
87
87
|
if typing.TYPE_CHECKING:
|
|
88
88
|
import yaml
|
|
89
|
-
else:
|
|
90
|
-
try:
|
|
91
|
-
import yaml
|
|
92
|
-
except ImportError:
|
|
93
|
-
yaml = None
|
|
94
89
|
|
|
95
90
|
_is_httpx_imported = False
|
|
96
91
|
if typing.TYPE_CHECKING:
|
|
@@ -267,14 +262,18 @@ class PhishBlockThreshold(_common.CaseInSensitiveEnum):
|
|
|
267
262
|
|
|
268
263
|
|
|
269
264
|
class ThinkingLevel(_common.CaseInSensitiveEnum):
|
|
270
|
-
"""The
|
|
265
|
+
"""The number of thoughts tokens that the model should generate."""
|
|
271
266
|
|
|
272
267
|
THINKING_LEVEL_UNSPECIFIED = 'THINKING_LEVEL_UNSPECIFIED'
|
|
273
|
-
"""
|
|
268
|
+
"""Unspecified thinking level."""
|
|
274
269
|
LOW = 'LOW'
|
|
275
270
|
"""Low thinking level."""
|
|
271
|
+
MEDIUM = 'MEDIUM'
|
|
272
|
+
"""Medium thinking level."""
|
|
276
273
|
HIGH = 'HIGH'
|
|
277
274
|
"""High thinking level."""
|
|
275
|
+
MINIMAL = 'MINIMAL'
|
|
276
|
+
"""MINIMAL thinking level."""
|
|
278
277
|
|
|
279
278
|
|
|
280
279
|
class HarmCategory(_common.CaseInSensitiveEnum):
|
|
@@ -577,6 +576,8 @@ class PartMediaResolutionLevel(_common.CaseInSensitiveEnum):
|
|
|
577
576
|
"""Media resolution set to medium."""
|
|
578
577
|
MEDIA_RESOLUTION_HIGH = 'MEDIA_RESOLUTION_HIGH'
|
|
579
578
|
"""Media resolution set to high."""
|
|
579
|
+
MEDIA_RESOLUTION_ULTRA_HIGH = 'MEDIA_RESOLUTION_ULTRA_HIGH'
|
|
580
|
+
"""Media resolution set to ultra high."""
|
|
580
581
|
|
|
581
582
|
|
|
582
583
|
class ResourceScope(_common.CaseInSensitiveEnum):
|
|
@@ -4484,24 +4485,19 @@ SpeakerVoiceConfigOrDict = Union[SpeakerVoiceConfig, SpeakerVoiceConfigDict]
|
|
|
4484
4485
|
|
|
4485
4486
|
|
|
4486
4487
|
class MultiSpeakerVoiceConfig(_common.BaseModel):
|
|
4487
|
-
"""
|
|
4488
|
-
|
|
4489
|
-
This data type is not supported in Vertex AI.
|
|
4490
|
-
"""
|
|
4488
|
+
"""Configuration for a multi-speaker text-to-speech request."""
|
|
4491
4489
|
|
|
4492
4490
|
speaker_voice_configs: Optional[list[SpeakerVoiceConfig]] = Field(
|
|
4493
|
-
default=None,
|
|
4491
|
+
default=None,
|
|
4492
|
+
description="""Required. A list of configurations for the voices of the speakers. Exactly two speaker voice configurations must be provided.""",
|
|
4494
4493
|
)
|
|
4495
4494
|
|
|
4496
4495
|
|
|
4497
4496
|
class MultiSpeakerVoiceConfigDict(TypedDict, total=False):
|
|
4498
|
-
"""
|
|
4499
|
-
|
|
4500
|
-
This data type is not supported in Vertex AI.
|
|
4501
|
-
"""
|
|
4497
|
+
"""Configuration for a multi-speaker text-to-speech request."""
|
|
4502
4498
|
|
|
4503
4499
|
speaker_voice_configs: Optional[list[SpeakerVoiceConfigDict]]
|
|
4504
|
-
"""Required.
|
|
4500
|
+
"""Required. A list of configurations for the voices of the speakers. Exactly two speaker voice configurations must be provided."""
|
|
4505
4501
|
|
|
4506
4502
|
|
|
4507
4503
|
MultiSpeakerVoiceConfigOrDict = Union[
|
|
@@ -4521,7 +4517,7 @@ class SpeechConfig(_common.BaseModel):
|
|
|
4521
4517
|
)
|
|
4522
4518
|
multi_speaker_voice_config: Optional[MultiSpeakerVoiceConfig] = Field(
|
|
4523
4519
|
default=None,
|
|
4524
|
-
description="""
|
|
4520
|
+
description="""The configuration for a multi-speaker text-to-speech request. This field is mutually exclusive with `voice_config`.""",
|
|
4525
4521
|
)
|
|
4526
4522
|
|
|
4527
4523
|
|
|
@@ -4534,7 +4530,7 @@ class SpeechConfigDict(TypedDict, total=False):
|
|
|
4534
4530
|
"""Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization."""
|
|
4535
4531
|
|
|
4536
4532
|
multi_speaker_voice_config: Optional[MultiSpeakerVoiceConfigDict]
|
|
4537
|
-
"""
|
|
4533
|
+
"""The configuration for a multi-speaker text-to-speech request. This field is mutually exclusive with `voice_config`."""
|
|
4538
4534
|
|
|
4539
4535
|
|
|
4540
4536
|
SpeechConfigOrDict = Union[SpeechConfig, SpeechConfigDict]
|
|
@@ -4614,7 +4610,7 @@ class ThinkingConfig(_common.BaseModel):
|
|
|
4614
4610
|
)
|
|
4615
4611
|
thinking_level: Optional[ThinkingLevel] = Field(
|
|
4616
4612
|
default=None,
|
|
4617
|
-
description="""Optional. The
|
|
4613
|
+
description="""Optional. The number of thoughts tokens that the model should generate.""",
|
|
4618
4614
|
)
|
|
4619
4615
|
|
|
4620
4616
|
|
|
@@ -4630,7 +4626,7 @@ class ThinkingConfigDict(TypedDict, total=False):
|
|
|
4630
4626
|
"""
|
|
4631
4627
|
|
|
4632
4628
|
thinking_level: Optional[ThinkingLevel]
|
|
4633
|
-
"""Optional. The
|
|
4629
|
+
"""Optional. The number of thoughts tokens that the model should generate."""
|
|
4634
4630
|
|
|
4635
4631
|
|
|
4636
4632
|
ThinkingConfigOrDict = Union[ThinkingConfig, ThinkingConfigDict]
|
|
@@ -10645,7 +10641,9 @@ class Metric(_common.BaseModel):
|
|
|
10645
10641
|
Raises:
|
|
10646
10642
|
ImportError: If the pyyaml library is not installed.
|
|
10647
10643
|
"""
|
|
10648
|
-
|
|
10644
|
+
try:
|
|
10645
|
+
import yaml
|
|
10646
|
+
except ImportError:
|
|
10649
10647
|
raise ImportError(
|
|
10650
10648
|
'YAML serialization requires the pyyaml library. Please install'
|
|
10651
10649
|
" it using 'pip install google-cloud-aiplatform[evaluation]'."
|
google/genai/version.py
CHANGED