google-genai 1.56.0__tar.gz → 1.58.0__tar.gz
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-1.56.0/google_genai.egg-info → google_genai-1.58.0}/PKG-INFO +6 -11
- {google_genai-1.56.0 → google_genai-1.58.0}/README.md +4 -9
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_api_client.py +49 -26
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/__init__.py +3 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_base_client.py +1 -1
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_client.py +57 -3
- google_genai-1.58.0/google/genai/_interactions/_client_adapter.py +48 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/__init__.py +6 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/audio_content.py +2 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/audio_content_param.py +2 -0
- google_genai-1.56.0/google/genai/_interactions/types/turn.py → google_genai-1.58.0/google/genai/_interactions/types/content.py +5 -16
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/content_delta.py +10 -2
- google_genai-1.56.0/google/genai/_interactions/types/turn_param.py → google_genai-1.58.0/google/genai/_interactions/types/content_param.py +6 -16
- google_genai-1.58.0/google/genai/_interactions/types/content_start.py +38 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/content_stop.py +1 -2
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/document_content.py +2 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/document_content_param.py +2 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/error_event.py +1 -2
- google_genai-1.58.0/google/genai/_interactions/types/file_search_call_content.py +32 -0
- google_genai-1.58.0/google/genai/_interactions/types/file_search_call_content_param.py +31 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/generation_config.py +4 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/generation_config_param.py +4 -0
- google_genai-1.58.0/google/genai/_interactions/types/image_config.py +31 -0
- google_genai-1.58.0/google/genai/_interactions/types/image_config_param.py +30 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/image_content.py +2 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/image_content_param.py +2 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/interaction.py +6 -52
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/interaction_create_params.py +4 -22
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/interaction_event.py +1 -2
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/interaction_sse_event.py +5 -3
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/interaction_status_update.py +1 -2
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/model.py +1 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/model_param.py +1 -0
- google_genai-1.58.0/google/genai/_interactions/types/turn.py +35 -0
- google_genai-1.58.0/google/genai/_interactions/types/turn_param.py +37 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/usage.py +1 -1
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/usage_param.py +1 -1
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/video_content.py +2 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/video_content_param.py +2 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_live_converters.py +118 -34
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_local_tokenizer_loader.py +1 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_transformers.py +15 -21
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/batches.py +27 -22
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/chats.py +0 -2
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/client.py +61 -55
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/files.py +224 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/live.py +1 -1
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/models.py +56 -44
- google_genai-1.58.0/google/genai/tests/__init__.py +21 -0
- google_genai-1.58.0/google/genai/tests/afc/__init__.py +21 -0
- google_genai-1.58.0/google/genai/tests/afc/test_convert_if_exist_pydantic_model.py +309 -0
- google_genai-1.58.0/google/genai/tests/afc/test_convert_number_values_for_function_call_args.py +63 -0
- google_genai-1.58.0/google/genai/tests/afc/test_find_afc_incompatible_tool_indexes.py +240 -0
- google_genai-1.58.0/google/genai/tests/afc/test_generate_content_stream_afc.py +530 -0
- google_genai-1.58.0/google/genai/tests/afc/test_generate_content_stream_afc_thoughts.py +77 -0
- google_genai-1.58.0/google/genai/tests/afc/test_get_function_map.py +176 -0
- google_genai-1.58.0/google/genai/tests/afc/test_get_function_response_parts.py +277 -0
- google_genai-1.58.0/google/genai/tests/afc/test_get_max_remote_calls_for_afc.py +130 -0
- google_genai-1.58.0/google/genai/tests/afc/test_invoke_function_from_dict_args.py +241 -0
- google_genai-1.58.0/google/genai/tests/afc/test_raise_error_for_afc_incompatible_config.py +159 -0
- google_genai-1.58.0/google/genai/tests/afc/test_should_append_afc_history.py +53 -0
- google_genai-1.58.0/google/genai/tests/afc/test_should_disable_afc.py +214 -0
- google_genai-1.58.0/google/genai/tests/batches/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/batches/test_cancel.py +77 -0
- google_genai-1.58.0/google/genai/tests/batches/test_create.py +78 -0
- google_genai-1.58.0/google/genai/tests/batches/test_create_with_bigquery.py +113 -0
- google_genai-1.58.0/google/genai/tests/batches/test_create_with_file.py +82 -0
- google_genai-1.58.0/google/genai/tests/batches/test_create_with_gcs.py +125 -0
- google_genai-1.58.0/google/genai/tests/batches/test_create_with_inlined_requests.py +255 -0
- google_genai-1.58.0/google/genai/tests/batches/test_delete.py +86 -0
- google_genai-1.58.0/google/genai/tests/batches/test_embedding.py +157 -0
- google_genai-1.58.0/google/genai/tests/batches/test_get.py +78 -0
- google_genai-1.58.0/google/genai/tests/batches/test_list.py +79 -0
- google_genai-1.58.0/google/genai/tests/caches/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/caches/constants.py +29 -0
- google_genai-1.58.0/google/genai/tests/caches/test_create.py +210 -0
- google_genai-1.58.0/google/genai/tests/caches/test_create_custom_url.py +105 -0
- google_genai-1.58.0/google/genai/tests/caches/test_delete.py +54 -0
- google_genai-1.58.0/google/genai/tests/caches/test_delete_custom_url.py +52 -0
- google_genai-1.58.0/google/genai/tests/caches/test_get.py +94 -0
- google_genai-1.58.0/google/genai/tests/caches/test_get_custom_url.py +52 -0
- google_genai-1.58.0/google/genai/tests/caches/test_list.py +68 -0
- google_genai-1.58.0/google/genai/tests/caches/test_update.py +70 -0
- google_genai-1.58.0/google/genai/tests/caches/test_update_custom_url.py +58 -0
- google_genai-1.58.0/google/genai/tests/chats/__init__.py +1 -0
- google_genai-1.58.0/google/genai/tests/chats/test_get_history.py +598 -0
- google_genai-1.58.0/google/genai/tests/chats/test_send_message.py +844 -0
- google_genai-1.58.0/google/genai/tests/chats/test_validate_response.py +90 -0
- google_genai-1.58.0/google/genai/tests/client/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/client/test_async_stream.py +427 -0
- google_genai-1.58.0/google/genai/tests/client/test_client_close.py +197 -0
- google_genai-1.58.0/google/genai/tests/client/test_client_initialization.py +1687 -0
- google_genai-1.58.0/google/genai/tests/client/test_client_requests.py +221 -0
- google_genai-1.58.0/google/genai/tests/client/test_custom_client.py +104 -0
- google_genai-1.58.0/google/genai/tests/client/test_http_options.py +178 -0
- google_genai-1.58.0/google/genai/tests/client/test_replay_client_equality.py +168 -0
- google_genai-1.58.0/google/genai/tests/client/test_retries.py +846 -0
- google_genai-1.58.0/google/genai/tests/client/test_upload_errors.py +136 -0
- google_genai-1.58.0/google/genai/tests/common/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/common/test_common.py +954 -0
- google_genai-1.58.0/google/genai/tests/conftest.py +162 -0
- google_genai-1.58.0/google/genai/tests/documents/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/documents/test_delete.py +51 -0
- google_genai-1.58.0/google/genai/tests/documents/test_get.py +85 -0
- google_genai-1.58.0/google/genai/tests/documents/test_list.py +72 -0
- google_genai-1.58.0/google/genai/tests/errors/__init__.py +1 -0
- google_genai-1.58.0/google/genai/tests/errors/test_api_error.py +417 -0
- google_genai-1.58.0/google/genai/tests/file_search_stores/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/file_search_stores/test_create.py +66 -0
- google_genai-1.58.0/google/genai/tests/file_search_stores/test_delete.py +64 -0
- google_genai-1.58.0/google/genai/tests/file_search_stores/test_get.py +94 -0
- google_genai-1.58.0/google/genai/tests/file_search_stores/test_import_file.py +112 -0
- google_genai-1.58.0/google/genai/tests/file_search_stores/test_list.py +57 -0
- google_genai-1.58.0/google/genai/tests/file_search_stores/test_upload_to_file_search_store.py +141 -0
- google_genai-1.58.0/google/genai/tests/files/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/files/test_delete.py +46 -0
- google_genai-1.58.0/google/genai/tests/files/test_download.py +85 -0
- google_genai-1.58.0/google/genai/tests/files/test_get.py +46 -0
- google_genai-1.58.0/google/genai/tests/files/test_list.py +72 -0
- google_genai-1.58.0/google/genai/tests/files/test_register.py +272 -0
- google_genai-1.58.0/google/genai/tests/files/test_register_table.py +70 -0
- google_genai-1.58.0/google/genai/tests/files/test_upload.py +255 -0
- google_genai-1.58.0/google/genai/tests/imports/test_no_optional_imports.py +28 -0
- google_genai-1.58.0/google/genai/tests/interactions/test_auth.py +476 -0
- google_genai-1.58.0/google/genai/tests/interactions/test_integration.py +84 -0
- google_genai-1.58.0/google/genai/tests/interactions/test_paths.py +105 -0
- google_genai-1.58.0/google/genai/tests/live/__init__.py +16 -0
- google_genai-1.58.0/google/genai/tests/live/test_live.py +2143 -0
- google_genai-1.58.0/google/genai/tests/live/test_live_music.py +362 -0
- google_genai-1.58.0/google/genai/tests/live/test_live_response.py +163 -0
- google_genai-1.58.0/google/genai/tests/live/test_send_client_content.py +147 -0
- google_genai-1.58.0/google/genai/tests/live/test_send_realtime_input.py +268 -0
- google_genai-1.58.0/google/genai/tests/live/test_send_tool_response.py +222 -0
- google_genai-1.58.0/google/genai/tests/local_tokenizer/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/local_tokenizer/test_local_tokenizer.py +343 -0
- google_genai-1.58.0/google/genai/tests/local_tokenizer/test_local_tokenizer_loader.py +235 -0
- google_genai-1.58.0/google/genai/tests/mcp/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/mcp/test_has_mcp_tool_usage.py +89 -0
- google_genai-1.58.0/google/genai/tests/mcp/test_mcp_to_gemini_tools.py +191 -0
- google_genai-1.58.0/google/genai/tests/mcp/test_parse_config_for_mcp_sessions.py +201 -0
- google_genai-1.58.0/google/genai/tests/mcp/test_parse_config_for_mcp_usage.py +130 -0
- google_genai-1.58.0/google/genai/tests/mcp/test_set_mcp_usage_header.py +72 -0
- google_genai-1.58.0/google/genai/tests/models/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/models/constants.py +8 -0
- google_genai-1.58.0/google/genai/tests/models/test_compute_tokens.py +120 -0
- google_genai-1.58.0/google/genai/tests/models/test_count_tokens.py +159 -0
- google_genai-1.58.0/google/genai/tests/models/test_delete.py +107 -0
- google_genai-1.58.0/google/genai/tests/models/test_edit_image.py +264 -0
- google_genai-1.58.0/google/genai/tests/models/test_embed_content.py +94 -0
- google_genai-1.58.0/google/genai/tests/models/test_function_call_streaming.py +442 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content.py +2501 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_cached_content.py +132 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_config_zero_value.py +103 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_from_apikey.py +44 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_http_options.py +40 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_image_generation.py +143 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_mcp.py +343 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_media_resolution.py +97 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_model.py +139 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_part.py +821 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_thought.py +76 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_content_tools.py +1761 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_images.py +191 -0
- google_genai-1.58.0/google/genai/tests/models/test_generate_videos.py +759 -0
- google_genai-1.58.0/google/genai/tests/models/test_get.py +104 -0
- google_genai-1.58.0/google/genai/tests/models/test_list.py +233 -0
- google_genai-1.58.0/google/genai/tests/models/test_recontext_image.py +189 -0
- google_genai-1.58.0/google/genai/tests/models/test_segment_image.py +148 -0
- google_genai-1.58.0/google/genai/tests/models/test_update.py +95 -0
- google_genai-1.58.0/google/genai/tests/models/test_upscale_image.py +157 -0
- google_genai-1.58.0/google/genai/tests/operations/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/operations/test_get.py +38 -0
- google_genai-1.58.0/google/genai/tests/public_samples/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/public_samples/test_gemini_text_only.py +34 -0
- google_genai-1.58.0/google/genai/tests/pytest_helper.py +246 -0
- google_genai-1.58.0/google/genai/tests/shared/__init__.py +16 -0
- google_genai-1.58.0/google/genai/tests/shared/batches/__init__.py +14 -0
- google_genai-1.58.0/google/genai/tests/shared/batches/test_create_delete.py +57 -0
- google_genai-1.58.0/google/genai/tests/shared/batches/test_create_get_cancel.py +56 -0
- google_genai-1.58.0/google/genai/tests/shared/batches/test_list.py +40 -0
- google_genai-1.58.0/google/genai/tests/shared/caches/__init__.py +14 -0
- google_genai-1.58.0/google/genai/tests/shared/caches/test_create_get_delete.py +67 -0
- google_genai-1.58.0/google/genai/tests/shared/caches/test_create_update_get.py +71 -0
- google_genai-1.58.0/google/genai/tests/shared/caches/test_list.py +40 -0
- google_genai-1.58.0/google/genai/tests/shared/chats/__init__.py +14 -0
- google_genai-1.58.0/google/genai/tests/shared/chats/test_send_message.py +48 -0
- google_genai-1.58.0/google/genai/tests/shared/chats/test_send_message_stream.py +50 -0
- google_genai-1.58.0/google/genai/tests/shared/files/__init__.py +14 -0
- google_genai-1.58.0/google/genai/tests/shared/files/test_list.py +41 -0
- google_genai-1.58.0/google/genai/tests/shared/files/test_upload_get_delete.py +54 -0
- google_genai-1.58.0/google/genai/tests/shared/models/__init__.py +14 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_compute_tokens.py +41 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_count_tokens.py +40 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_edit_image.py +67 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_embed.py +40 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_generate_content.py +39 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_generate_content_stream.py +54 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_generate_images.py +40 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_generate_videos.py +38 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_list.py +37 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_recontext_image.py +55 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_segment_image.py +52 -0
- google_genai-1.58.0/google/genai/tests/shared/models/test_upscale_image.py +52 -0
- google_genai-1.58.0/google/genai/tests/shared/tunings/__init__.py +16 -0
- google_genai-1.58.0/google/genai/tests/shared/tunings/test_create.py +46 -0
- google_genai-1.58.0/google/genai/tests/shared/tunings/test_create_get_cancel.py +56 -0
- google_genai-1.58.0/google/genai/tests/shared/tunings/test_list.py +39 -0
- google_genai-1.58.0/google/genai/tests/tokens/__init__.py +16 -0
- google_genai-1.58.0/google/genai/tests/tokens/test_create.py +154 -0
- google_genai-1.58.0/google/genai/tests/transformers/__init__.py +17 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_blobs.py +84 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_bytes.py +15 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_duck_type.py +96 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_function_responses.py +72 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_schema.py +653 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_t_batch.py +286 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_t_content.py +160 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_t_contents.py +398 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_t_part.py +85 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_t_parts.py +87 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_t_tool.py +157 -0
- google_genai-1.58.0/google/genai/tests/transformers/test_t_tools.py +195 -0
- google_genai-1.58.0/google/genai/tests/tunings/__init__.py +16 -0
- google_genai-1.58.0/google/genai/tests/tunings/test_cancel.py +39 -0
- google_genai-1.58.0/google/genai/tests/tunings/test_end_to_end.py +106 -0
- google_genai-1.58.0/google/genai/tests/tunings/test_get.py +67 -0
- google_genai-1.58.0/google/genai/tests/tunings/test_list.py +75 -0
- google_genai-1.58.0/google/genai/tests/tunings/test_tune.py +268 -0
- google_genai-1.58.0/google/genai/tests/types/__init__.py +16 -0
- google_genai-1.58.0/google/genai/tests/types/test_bytes_internal.py +271 -0
- google_genai-1.58.0/google/genai/tests/types/test_bytes_type.py +152 -0
- google_genai-1.58.0/google/genai/tests/types/test_future.py +101 -0
- google_genai-1.58.0/google/genai/tests/types/test_optional_types.py +36 -0
- google_genai-1.58.0/google/genai/tests/types/test_part_type.py +616 -0
- google_genai-1.58.0/google/genai/tests/types/test_schema_from_json_schema.py +417 -0
- google_genai-1.58.0/google/genai/tests/types/test_schema_json_schema.py +468 -0
- google_genai-1.58.0/google/genai/tests/types/test_types.py +2903 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/types.py +631 -488
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/version.py +1 -1
- {google_genai-1.56.0 → google_genai-1.58.0/google_genai.egg-info}/PKG-INFO +6 -11
- google_genai-1.58.0/google_genai.egg-info/SOURCES.txt +363 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google_genai.egg-info/requires.txt +1 -1
- {google_genai-1.56.0 → google_genai-1.58.0}/pyproject.toml +5 -5
- google_genai-1.56.0/google/genai/_interactions/types/content_start.py +0 -79
- google_genai-1.56.0/google_genai.egg-info/SOURCES.txt +0 -167
- {google_genai-1.56.0 → google_genai-1.58.0}/LICENSE +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/MANIFEST.in +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/__init__.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_adapters.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_api_module.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_automatic_function_calling_util.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_base_transformers.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_base_url.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_common.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_extra_utils.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_compat.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_constants.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_exceptions.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_files.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_models.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_qs.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_resource.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_response.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_streaming.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_types.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/__init__.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_compat.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_datetime_parse.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_logs.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_proxy.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_reflection.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_resources_proxy.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_streams.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_sync.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_transform.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_typing.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_utils/_utils.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/_version.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/resources/__init__.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/resources/interactions.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/allowed_tools.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/allowed_tools_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/annotation.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/annotation_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/audio_mime_type.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/audio_mime_type_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/code_execution_call_arguments.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/code_execution_call_arguments_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/code_execution_call_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/code_execution_call_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/code_execution_result_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/code_execution_result_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/deep_research_agent_config.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/deep_research_agent_config_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/document_mime_type.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/document_mime_type_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/dynamic_agent_config.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/dynamic_agent_config_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/file_search_result_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/file_search_result_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/function.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/function_call_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/function_call_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/function_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/function_result_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/function_result_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/google_search_call_arguments.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/google_search_call_arguments_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/google_search_call_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/google_search_call_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/google_search_result.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/google_search_result_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/google_search_result_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/google_search_result_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/image_mime_type.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/image_mime_type_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/interaction_get_params.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/mcp_server_tool_call_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/mcp_server_tool_call_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/mcp_server_tool_result_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/mcp_server_tool_result_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/speech_config.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/speech_config_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/text_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/text_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/thinking_level.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/thought_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/thought_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/tool.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/tool_choice.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/tool_choice_config.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/tool_choice_config_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/tool_choice_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/tool_choice_type.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/tool_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/url_context_call_arguments.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/url_context_call_arguments_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/url_context_call_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/url_context_call_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/url_context_result.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/url_context_result_content.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/url_context_result_content_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/url_context_result_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/video_mime_type.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/video_mime_type_param.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_mcp_utils.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_operations_converters.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_replay_api_client.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_test_api_client.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_tokens_converters.py +14 -14
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/caches.py +42 -42
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/documents.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/errors.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/file_search_stores.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/interactions.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/live_music.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/local_tokenizer.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/operations.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/pagers.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/py.typed +0 -0
- /google_genai-1.56.0/google/genai/_interactions/py.typed → /google_genai-1.58.0/google/genai/tests/interactions/__init__.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/tokens.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google/genai/tunings.py +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google_genai.egg-info/dependency_links.txt +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/google_genai.egg-info/top_level.txt +0 -0
- {google_genai-1.56.0 → google_genai-1.58.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-genai
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.58.0
|
|
4
4
|
Summary: GenAI Python SDK
|
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -20,7 +20,7 @@ Requires-Python: >=3.10
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: anyio<5.0.0,>=4.8.0
|
|
23
|
-
Requires-Dist: google-auth[requests]<3.0.0,>=2.
|
|
23
|
+
Requires-Dist: google-auth[requests]<3.0.0,>=2.47.0
|
|
24
24
|
Requires-Dist: httpx<1.0.0,>=0.28.1
|
|
25
25
|
Requires-Dist: pydantic<3.0.0,>=2.9.0
|
|
26
26
|
Requires-Dist: requests<3.0.0,>=2.28.1
|
|
@@ -112,7 +112,7 @@ Below is an example `generate_content()` call using types from the types module:
|
|
|
112
112
|
|
|
113
113
|
```python
|
|
114
114
|
response = client.models.generate_content(
|
|
115
|
-
model='gemini-2.
|
|
115
|
+
model='gemini-2.5-flash',
|
|
116
116
|
contents=types.Part.from_text(text='Why is the sky blue?'),
|
|
117
117
|
config=types.GenerateContentConfig(
|
|
118
118
|
temperature=0,
|
|
@@ -127,7 +127,7 @@ types:
|
|
|
127
127
|
|
|
128
128
|
```python
|
|
129
129
|
response = client.models.generate_content(
|
|
130
|
-
model='gemini-2.
|
|
130
|
+
model='gemini-2.5-flash',
|
|
131
131
|
contents={'text': 'Why is the sky blue?'},
|
|
132
132
|
config={
|
|
133
133
|
'temperature': 0,
|
|
@@ -621,7 +621,7 @@ and [Gemini API docs](https://ai.google.dev/gemini-api/docs/models) respectively
|
|
|
621
621
|
from google.genai import types
|
|
622
622
|
|
|
623
623
|
response = client.models.generate_content(
|
|
624
|
-
model='gemini-2.
|
|
624
|
+
model='gemini-2.5-flash',
|
|
625
625
|
contents='high',
|
|
626
626
|
config=types.GenerateContentConfig(
|
|
627
627
|
system_instruction='I say high, you say low',
|
|
@@ -1238,7 +1238,6 @@ print(response)
|
|
|
1238
1238
|
```python
|
|
1239
1239
|
from google.genai import types
|
|
1240
1240
|
|
|
1241
|
-
# multiple contents with config
|
|
1242
1241
|
response = client.models.embed_content(
|
|
1243
1242
|
model='gemini-embedding-001',
|
|
1244
1243
|
contents=['why is the sky blue?', 'What is your age?'],
|
|
@@ -1252,12 +1251,9 @@ print(response)
|
|
|
1252
1251
|
|
|
1253
1252
|
#### Generate Images
|
|
1254
1253
|
|
|
1255
|
-
Support for generate images in Gemini Developer API is behind an allowlist
|
|
1256
|
-
|
|
1257
1254
|
```python
|
|
1258
1255
|
from google.genai import types
|
|
1259
1256
|
|
|
1260
|
-
# Generate Image
|
|
1261
1257
|
response1 = client.models.generate_images(
|
|
1262
1258
|
model='imagen-4.0-generate-001',
|
|
1263
1259
|
prompt='An umbrella in the foreground, and a rainy night sky in the background',
|
|
@@ -1277,7 +1273,6 @@ Upscale image is only supported in Vertex AI.
|
|
|
1277
1273
|
```python
|
|
1278
1274
|
from google.genai import types
|
|
1279
1275
|
|
|
1280
|
-
# Upscale the generated image from above
|
|
1281
1276
|
response2 = client.models.upscale_image(
|
|
1282
1277
|
model='imagen-4.0-upscale-preview',
|
|
1283
1278
|
image=response1.generated_images[0].image,
|
|
@@ -1977,7 +1972,7 @@ file = client.files.upload(
|
|
|
1977
1972
|
|
|
1978
1973
|
# Create a batch job with file name
|
|
1979
1974
|
batch_job = client.batches.create(
|
|
1980
|
-
model="gemini-2.
|
|
1975
|
+
model="gemini-2.5-flash",
|
|
1981
1976
|
src="files/test-json",
|
|
1982
1977
|
)
|
|
1983
1978
|
```
|
|
@@ -74,7 +74,7 @@ Below is an example `generate_content()` call using types from the types module:
|
|
|
74
74
|
|
|
75
75
|
```python
|
|
76
76
|
response = client.models.generate_content(
|
|
77
|
-
model='gemini-2.
|
|
77
|
+
model='gemini-2.5-flash',
|
|
78
78
|
contents=types.Part.from_text(text='Why is the sky blue?'),
|
|
79
79
|
config=types.GenerateContentConfig(
|
|
80
80
|
temperature=0,
|
|
@@ -89,7 +89,7 @@ types:
|
|
|
89
89
|
|
|
90
90
|
```python
|
|
91
91
|
response = client.models.generate_content(
|
|
92
|
-
model='gemini-2.
|
|
92
|
+
model='gemini-2.5-flash',
|
|
93
93
|
contents={'text': 'Why is the sky blue?'},
|
|
94
94
|
config={
|
|
95
95
|
'temperature': 0,
|
|
@@ -583,7 +583,7 @@ and [Gemini API docs](https://ai.google.dev/gemini-api/docs/models) respectively
|
|
|
583
583
|
from google.genai import types
|
|
584
584
|
|
|
585
585
|
response = client.models.generate_content(
|
|
586
|
-
model='gemini-2.
|
|
586
|
+
model='gemini-2.5-flash',
|
|
587
587
|
contents='high',
|
|
588
588
|
config=types.GenerateContentConfig(
|
|
589
589
|
system_instruction='I say high, you say low',
|
|
@@ -1200,7 +1200,6 @@ print(response)
|
|
|
1200
1200
|
```python
|
|
1201
1201
|
from google.genai import types
|
|
1202
1202
|
|
|
1203
|
-
# multiple contents with config
|
|
1204
1203
|
response = client.models.embed_content(
|
|
1205
1204
|
model='gemini-embedding-001',
|
|
1206
1205
|
contents=['why is the sky blue?', 'What is your age?'],
|
|
@@ -1214,12 +1213,9 @@ print(response)
|
|
|
1214
1213
|
|
|
1215
1214
|
#### Generate Images
|
|
1216
1215
|
|
|
1217
|
-
Support for generate images in Gemini Developer API is behind an allowlist
|
|
1218
|
-
|
|
1219
1216
|
```python
|
|
1220
1217
|
from google.genai import types
|
|
1221
1218
|
|
|
1222
|
-
# Generate Image
|
|
1223
1219
|
response1 = client.models.generate_images(
|
|
1224
1220
|
model='imagen-4.0-generate-001',
|
|
1225
1221
|
prompt='An umbrella in the foreground, and a rainy night sky in the background',
|
|
@@ -1239,7 +1235,6 @@ Upscale image is only supported in Vertex AI.
|
|
|
1239
1235
|
```python
|
|
1240
1236
|
from google.genai import types
|
|
1241
1237
|
|
|
1242
|
-
# Upscale the generated image from above
|
|
1243
1238
|
response2 = client.models.upscale_image(
|
|
1244
1239
|
model='imagen-4.0-upscale-preview',
|
|
1245
1240
|
image=response1.generated_images[0].image,
|
|
@@ -1939,7 +1934,7 @@ file = client.files.upload(
|
|
|
1939
1934
|
|
|
1940
1935
|
# Create a batch job with file name
|
|
1941
1936
|
batch_job = client.batches.create(
|
|
1942
|
-
model="gemini-2.
|
|
1937
|
+
model="gemini-2.5-flash",
|
|
1943
1938
|
src="files/test-json",
|
|
1944
1939
|
)
|
|
1945
1940
|
```
|
|
@@ -715,19 +715,23 @@ class BaseApiClient:
|
|
|
715
715
|
self._async_httpx_client = self._http_options.httpx_async_client
|
|
716
716
|
else:
|
|
717
717
|
self._async_httpx_client = AsyncHttpxClient(**async_client_args)
|
|
718
|
+
|
|
719
|
+
# Initialize the aiohttp client session.
|
|
720
|
+
self._aiohttp_session: Optional[aiohttp.ClientSession] = None
|
|
718
721
|
if self._use_aiohttp():
|
|
719
722
|
try:
|
|
720
723
|
import aiohttp # pylint: disable=g-import-not-at-top
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
724
|
+
|
|
725
|
+
if self._http_options.aiohttp_client:
|
|
726
|
+
self._aiohttp_session = self._http_options.aiohttp_client
|
|
727
|
+
else:
|
|
728
|
+
# Do it once at the genai.Client level. Share among all requests.
|
|
729
|
+
self._async_client_session_request_args = (
|
|
730
|
+
self._ensure_aiohttp_ssl_ctx(self._http_options)
|
|
731
|
+
)
|
|
725
732
|
except ImportError:
|
|
726
733
|
pass
|
|
727
734
|
|
|
728
|
-
# Initialize the aiohttp client session.
|
|
729
|
-
self._aiohttp_session: Optional[aiohttp.ClientSession] = None
|
|
730
|
-
|
|
731
735
|
retry_kwargs = retry_args(self._http_options.retry_options)
|
|
732
736
|
self._websocket_ssl_ctx = self._ensure_websocket_ssl_ctx(self._http_options)
|
|
733
737
|
self._retry = tenacity.Retrying(**retry_kwargs)
|
|
@@ -984,12 +988,7 @@ class BaseApiClient:
|
|
|
984
988
|
self.project = project
|
|
985
989
|
|
|
986
990
|
if self._credentials:
|
|
987
|
-
|
|
988
|
-
# Only refresh when it needs to. Default expiration is 3600 seconds.
|
|
989
|
-
refresh_auth(self._credentials)
|
|
990
|
-
if not self._credentials.token:
|
|
991
|
-
raise RuntimeError('Could not resolve API token from the environment')
|
|
992
|
-
return self._credentials.token # type: ignore[no-any-return]
|
|
991
|
+
return get_token_from_credentials(self, self._credentials) # type: ignore[no-any-return]
|
|
993
992
|
else:
|
|
994
993
|
raise RuntimeError('Could not resolve API token from the environment')
|
|
995
994
|
|
|
@@ -1034,18 +1033,10 @@ class BaseApiClient:
|
|
|
1034
1033
|
self.project = project
|
|
1035
1034
|
|
|
1036
1035
|
if self._credentials:
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
if self._credentials.expired or not self._credentials.token:
|
|
1042
|
-
# Double check that the credentials expired before refreshing.
|
|
1043
|
-
await asyncio.to_thread(refresh_auth, self._credentials)
|
|
1044
|
-
|
|
1045
|
-
if not self._credentials.token:
|
|
1046
|
-
raise RuntimeError('Could not resolve API token from the environment')
|
|
1047
|
-
|
|
1048
|
-
return self._credentials.token
|
|
1036
|
+
return await async_get_token_from_credentials(
|
|
1037
|
+
self,
|
|
1038
|
+
self._credentials
|
|
1039
|
+
) # type: ignore[no-any-return]
|
|
1049
1040
|
else:
|
|
1050
1041
|
raise RuntimeError('Could not resolve API token from the environment')
|
|
1051
1042
|
|
|
@@ -1905,7 +1896,7 @@ class BaseApiClient:
|
|
|
1905
1896
|
# close the client when the object is garbage collected.
|
|
1906
1897
|
if not self._http_options.httpx_async_client:
|
|
1907
1898
|
await self._async_httpx_client.aclose()
|
|
1908
|
-
if self._aiohttp_session:
|
|
1899
|
+
if self._aiohttp_session and not self._http_options.aiohttp_client:
|
|
1909
1900
|
await self._aiohttp_session.close()
|
|
1910
1901
|
|
|
1911
1902
|
def __del__(self) -> None:
|
|
@@ -1925,3 +1916,35 @@ class BaseApiClient:
|
|
|
1925
1916
|
asyncio.get_running_loop().create_task(self.aclose())
|
|
1926
1917
|
except Exception: # pylint: disable=broad-except
|
|
1927
1918
|
pass
|
|
1919
|
+
|
|
1920
|
+
def get_token_from_credentials(
|
|
1921
|
+
client: 'BaseApiClient',
|
|
1922
|
+
credentials: google.auth.credentials.Credentials
|
|
1923
|
+
) -> str:
|
|
1924
|
+
"""Refreshes the authentication token for the given credentials."""
|
|
1925
|
+
if credentials.expired or not credentials.token:
|
|
1926
|
+
# Only refresh when it needs to. Default expiration is 3600 seconds.
|
|
1927
|
+
refresh_auth(credentials)
|
|
1928
|
+
if not credentials.token:
|
|
1929
|
+
raise RuntimeError('Could not resolve API token from the environment')
|
|
1930
|
+
return credentials.token # type: ignore[no-any-return]
|
|
1931
|
+
|
|
1932
|
+
async def async_get_token_from_credentials(
|
|
1933
|
+
client: 'BaseApiClient',
|
|
1934
|
+
credentials: google.auth.credentials.Credentials
|
|
1935
|
+
) -> str:
|
|
1936
|
+
"""Refreshes the authentication token for the given credentials."""
|
|
1937
|
+
if credentials.expired or not credentials.token:
|
|
1938
|
+
# Only refresh when it needs to. Default expiration is 3600 seconds.
|
|
1939
|
+
async_auth_lock = await client._get_async_auth_lock()
|
|
1940
|
+
async with async_auth_lock:
|
|
1941
|
+
if credentials.expired or not credentials.token:
|
|
1942
|
+
# Double check that the credentials expired before refreshing.
|
|
1943
|
+
await asyncio.to_thread(refresh_auth, credentials)
|
|
1944
|
+
|
|
1945
|
+
if not credentials.token:
|
|
1946
|
+
raise RuntimeError('Could not resolve API token from the environment')
|
|
1947
|
+
|
|
1948
|
+
return credentials.token # type: ignore[no-any-return]
|
|
1949
|
+
|
|
1950
|
+
|
|
@@ -53,6 +53,7 @@ from ._exceptions import (
|
|
|
53
53
|
)
|
|
54
54
|
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
|
|
55
55
|
from ._utils._logs import setup_logging as _setup_logging
|
|
56
|
+
from ._client_adapter import GeminiNextGenAPIClientAdapter, AsyncGeminiNextGenAPIClientAdapter
|
|
56
57
|
|
|
57
58
|
__all__ = [
|
|
58
59
|
"types",
|
|
@@ -96,6 +97,8 @@ __all__ = [
|
|
|
96
97
|
"DefaultHttpxClient",
|
|
97
98
|
"DefaultAsyncHttpxClient",
|
|
98
99
|
"DefaultAioHttpClient",
|
|
100
|
+
"AsyncGeminiNextGenAPIClientAdapter",
|
|
101
|
+
"GeminiNextGenAPIClientAdapter"
|
|
99
102
|
]
|
|
100
103
|
|
|
101
104
|
if not _t.TYPE_CHECKING:
|
|
@@ -1798,7 +1798,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1798
1798
|
options: RequestOptions = {},
|
|
1799
1799
|
) -> ResponseT:
|
|
1800
1800
|
opts = FinalRequestOptions.construct(
|
|
1801
|
-
method="patch", url=path, json_data=body, files=
|
|
1801
|
+
method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options
|
|
1802
1802
|
)
|
|
1803
1803
|
return await self.request(cast_to, opts)
|
|
1804
1804
|
|
|
@@ -37,6 +37,7 @@ from ._types import (
|
|
|
37
37
|
)
|
|
38
38
|
from ._utils import is_given, get_async_library
|
|
39
39
|
from ._compat import cached_property
|
|
40
|
+
from ._models import FinalRequestOptions
|
|
40
41
|
from ._version import __version__
|
|
41
42
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
42
43
|
from ._exceptions import APIStatusError
|
|
@@ -45,6 +46,7 @@ from ._base_client import (
|
|
|
45
46
|
SyncAPIClient,
|
|
46
47
|
AsyncAPIClient,
|
|
47
48
|
)
|
|
49
|
+
from ._client_adapter import GeminiNextGenAPIClientAdapter, AsyncGeminiNextGenAPIClientAdapter
|
|
48
50
|
|
|
49
51
|
if TYPE_CHECKING:
|
|
50
52
|
from .resources import interactions
|
|
@@ -66,6 +68,7 @@ class GeminiNextGenAPIClient(SyncAPIClient):
|
|
|
66
68
|
# client options
|
|
67
69
|
api_key: str | None
|
|
68
70
|
api_version: str
|
|
71
|
+
client_adapter: GeminiNextGenAPIClientAdapter | None
|
|
69
72
|
|
|
70
73
|
def __init__(
|
|
71
74
|
self,
|
|
@@ -81,6 +84,7 @@ class GeminiNextGenAPIClient(SyncAPIClient):
|
|
|
81
84
|
# We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
|
|
82
85
|
# See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
|
|
83
86
|
http_client: httpx.Client | None = None,
|
|
87
|
+
client_adapter: GeminiNextGenAPIClientAdapter | None = None,
|
|
84
88
|
# Enable or disable schema validation for data returned by the API.
|
|
85
89
|
# When enabled an error APIResponseValidationError is raised
|
|
86
90
|
# if the API responds with invalid data for the expected schema.
|
|
@@ -108,6 +112,8 @@ class GeminiNextGenAPIClient(SyncAPIClient):
|
|
|
108
112
|
if base_url is None:
|
|
109
113
|
base_url = f"https://generativelanguage.googleapis.com"
|
|
110
114
|
|
|
115
|
+
self.client_adapter = client_adapter
|
|
116
|
+
|
|
111
117
|
super().__init__(
|
|
112
118
|
version=__version__,
|
|
113
119
|
base_url=base_url,
|
|
@@ -159,15 +165,35 @@ class GeminiNextGenAPIClient(SyncAPIClient):
|
|
|
159
165
|
|
|
160
166
|
@override
|
|
161
167
|
def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
|
|
168
|
+
if headers.get("Authorization") or custom_headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit):
|
|
169
|
+
return
|
|
162
170
|
if self.api_key and headers.get("x-goog-api-key"):
|
|
163
171
|
return
|
|
164
|
-
if isinstance(custom_headers.get("x-goog-api-key"), Omit):
|
|
172
|
+
if custom_headers.get("x-goog-api-key") or isinstance(custom_headers.get("x-goog-api-key"), Omit):
|
|
165
173
|
return
|
|
166
174
|
|
|
167
175
|
raise TypeError(
|
|
168
176
|
'"Could not resolve authentication method. Expected the api_key to be set. Or for the `x-goog-api-key` headers to be explicitly omitted"'
|
|
169
177
|
)
|
|
170
|
-
|
|
178
|
+
|
|
179
|
+
@override
|
|
180
|
+
def _prepare_options(self, options: FinalRequestOptions) -> FinalRequestOptions:
|
|
181
|
+
if not self.client_adapter or not self.client_adapter.is_vertex_ai():
|
|
182
|
+
return options
|
|
183
|
+
|
|
184
|
+
headers = options.headers or {}
|
|
185
|
+
has_auth = headers.get("Authorization") or headers.get("x-goog-api-key") # pytype: disable=attribute-error
|
|
186
|
+
if has_auth:
|
|
187
|
+
return options
|
|
188
|
+
|
|
189
|
+
adapted_headers = self.client_adapter.get_auth_headers()
|
|
190
|
+
if adapted_headers:
|
|
191
|
+
options.headers = {
|
|
192
|
+
**adapted_headers,
|
|
193
|
+
**headers
|
|
194
|
+
}
|
|
195
|
+
return options
|
|
196
|
+
|
|
171
197
|
def copy(
|
|
172
198
|
self,
|
|
173
199
|
*,
|
|
@@ -181,6 +207,7 @@ class GeminiNextGenAPIClient(SyncAPIClient):
|
|
|
181
207
|
set_default_headers: Mapping[str, str] | None = None,
|
|
182
208
|
default_query: Mapping[str, object] | None = None,
|
|
183
209
|
set_default_query: Mapping[str, object] | None = None,
|
|
210
|
+
client_adapter: GeminiNextGenAPIClientAdapter | None = None,
|
|
184
211
|
_extra_kwargs: Mapping[str, Any] = {},
|
|
185
212
|
) -> Self:
|
|
186
213
|
"""
|
|
@@ -214,6 +241,7 @@ class GeminiNextGenAPIClient(SyncAPIClient):
|
|
|
214
241
|
max_retries=max_retries if is_given(max_retries) else self.max_retries,
|
|
215
242
|
default_headers=headers,
|
|
216
243
|
default_query=params,
|
|
244
|
+
client_adapter=self.client_adapter or client_adapter,
|
|
217
245
|
**_extra_kwargs,
|
|
218
246
|
)
|
|
219
247
|
|
|
@@ -262,6 +290,7 @@ class AsyncGeminiNextGenAPIClient(AsyncAPIClient):
|
|
|
262
290
|
# client options
|
|
263
291
|
api_key: str | None
|
|
264
292
|
api_version: str
|
|
293
|
+
client_adapter: AsyncGeminiNextGenAPIClientAdapter | None
|
|
265
294
|
|
|
266
295
|
def __init__(
|
|
267
296
|
self,
|
|
@@ -277,6 +306,7 @@ class AsyncGeminiNextGenAPIClient(AsyncAPIClient):
|
|
|
277
306
|
# We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
|
|
278
307
|
# See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details.
|
|
279
308
|
http_client: httpx.AsyncClient | None = None,
|
|
309
|
+
client_adapter: AsyncGeminiNextGenAPIClientAdapter | None = None,
|
|
280
310
|
# Enable or disable schema validation for data returned by the API.
|
|
281
311
|
# When enabled an error APIResponseValidationError is raised
|
|
282
312
|
# if the API responds with invalid data for the expected schema.
|
|
@@ -304,6 +334,8 @@ class AsyncGeminiNextGenAPIClient(AsyncAPIClient):
|
|
|
304
334
|
if base_url is None:
|
|
305
335
|
base_url = f"https://generativelanguage.googleapis.com"
|
|
306
336
|
|
|
337
|
+
self.client_adapter = client_adapter
|
|
338
|
+
|
|
307
339
|
super().__init__(
|
|
308
340
|
version=__version__,
|
|
309
341
|
base_url=base_url,
|
|
@@ -355,14 +387,34 @@ class AsyncGeminiNextGenAPIClient(AsyncAPIClient):
|
|
|
355
387
|
|
|
356
388
|
@override
|
|
357
389
|
def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
|
|
390
|
+
if headers.get("Authorization") or custom_headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit):
|
|
391
|
+
return
|
|
358
392
|
if self.api_key and headers.get("x-goog-api-key"):
|
|
359
393
|
return
|
|
360
|
-
if isinstance(custom_headers.get("x-goog-api-key"), Omit):
|
|
394
|
+
if custom_headers.get("x-goog-api-key") or isinstance(custom_headers.get("x-goog-api-key"), Omit):
|
|
361
395
|
return
|
|
362
396
|
|
|
363
397
|
raise TypeError(
|
|
364
398
|
'"Could not resolve authentication method. Expected the api_key to be set. Or for the `x-goog-api-key` headers to be explicitly omitted"'
|
|
365
399
|
)
|
|
400
|
+
|
|
401
|
+
@override
|
|
402
|
+
async def _prepare_options(self, options: FinalRequestOptions) -> FinalRequestOptions:
|
|
403
|
+
if not self.client_adapter or not self.client_adapter.is_vertex_ai():
|
|
404
|
+
return options
|
|
405
|
+
|
|
406
|
+
headers = options.headers or {}
|
|
407
|
+
has_auth = headers.get("Authorization") or headers.get("x-goog-api-key") # pytype: disable=attribute-error
|
|
408
|
+
if has_auth:
|
|
409
|
+
return options
|
|
410
|
+
|
|
411
|
+
adapted_headers = await self.client_adapter.async_get_auth_headers()
|
|
412
|
+
if adapted_headers:
|
|
413
|
+
options.headers = {
|
|
414
|
+
**adapted_headers,
|
|
415
|
+
**headers
|
|
416
|
+
}
|
|
417
|
+
return options
|
|
366
418
|
|
|
367
419
|
def copy(
|
|
368
420
|
self,
|
|
@@ -377,6 +429,7 @@ class AsyncGeminiNextGenAPIClient(AsyncAPIClient):
|
|
|
377
429
|
set_default_headers: Mapping[str, str] | None = None,
|
|
378
430
|
default_query: Mapping[str, object] | None = None,
|
|
379
431
|
set_default_query: Mapping[str, object] | None = None,
|
|
432
|
+
client_adapter: AsyncGeminiNextGenAPIClientAdapter | None = None,
|
|
380
433
|
_extra_kwargs: Mapping[str, Any] = {},
|
|
381
434
|
) -> Self:
|
|
382
435
|
"""
|
|
@@ -410,6 +463,7 @@ class AsyncGeminiNextGenAPIClient(AsyncAPIClient):
|
|
|
410
463
|
max_retries=max_retries if is_given(max_retries) else self.max_retries,
|
|
411
464
|
default_headers=headers,
|
|
412
465
|
default_query=params,
|
|
466
|
+
client_adapter=self.client_adapter or client_adapter,
|
|
413
467
|
**_extra_kwargs,
|
|
414
468
|
)
|
|
415
469
|
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from abc import ABC, abstractmethod
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"GeminiNextGenAPIClientAdapter",
|
|
22
|
+
"AsyncGeminiNextGenAPIClientAdapter"
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
class BaseGeminiNextGenAPIClientAdapter(ABC):
|
|
26
|
+
@abstractmethod
|
|
27
|
+
def is_vertex_ai(self) -> bool:
|
|
28
|
+
...
|
|
29
|
+
|
|
30
|
+
@abstractmethod
|
|
31
|
+
def get_project(self) -> str | None:
|
|
32
|
+
...
|
|
33
|
+
|
|
34
|
+
@abstractmethod
|
|
35
|
+
def get_location(self) -> str | None:
|
|
36
|
+
...
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class AsyncGeminiNextGenAPIClientAdapter(BaseGeminiNextGenAPIClientAdapter):
|
|
40
|
+
@abstractmethod
|
|
41
|
+
async def async_get_auth_headers(self) -> dict[str, str] | None:
|
|
42
|
+
...
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class GeminiNextGenAPIClientAdapter(BaseGeminiNextGenAPIClientAdapter):
|
|
46
|
+
@abstractmethod
|
|
47
|
+
def get_auth_headers(self) -> dict[str, str] | None:
|
|
48
|
+
...
|
|
@@ -21,6 +21,7 @@ from .tool import Tool as Tool
|
|
|
21
21
|
from .turn import Turn as Turn
|
|
22
22
|
from .model import Model as Model
|
|
23
23
|
from .usage import Usage as Usage
|
|
24
|
+
from .content import Content as Content
|
|
24
25
|
from .function import Function as Function
|
|
25
26
|
from .annotation import Annotation as Annotation
|
|
26
27
|
from .tool_param import ToolParam as ToolParam
|
|
@@ -31,10 +32,12 @@ from .model_param import ModelParam as ModelParam
|
|
|
31
32
|
from .tool_choice import ToolChoice as ToolChoice
|
|
32
33
|
from .usage_param import UsageParam as UsageParam
|
|
33
34
|
from .content_stop import ContentStop as ContentStop
|
|
35
|
+
from .image_config import ImageConfig as ImageConfig
|
|
34
36
|
from .text_content import TextContent as TextContent
|
|
35
37
|
from .allowed_tools import AllowedTools as AllowedTools
|
|
36
38
|
from .audio_content import AudioContent as AudioContent
|
|
37
39
|
from .content_delta import ContentDelta as ContentDelta
|
|
40
|
+
from .content_param import ContentParam as ContentParam
|
|
38
41
|
from .content_start import ContentStart as ContentStart
|
|
39
42
|
from .image_content import ImageContent as ImageContent
|
|
40
43
|
from .speech_config import SpeechConfig as SpeechConfig
|
|
@@ -52,6 +55,7 @@ from .generation_config import GenerationConfig as GenerationConfig
|
|
|
52
55
|
from .interaction_event import InteractionEvent as InteractionEvent
|
|
53
56
|
from .tool_choice_param import ToolChoiceParam as ToolChoiceParam
|
|
54
57
|
from .document_mime_type import DocumentMimeType as DocumentMimeType
|
|
58
|
+
from .image_config_param import ImageConfigParam as ImageConfigParam
|
|
55
59
|
from .text_content_param import TextContentParam as TextContentParam
|
|
56
60
|
from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig
|
|
57
61
|
from .url_context_result import URLContextResult as URLContextResult
|
|
@@ -73,6 +77,7 @@ from .interaction_get_params import InteractionGetParams as InteractionGetParams
|
|
|
73
77
|
from .function_result_content import FunctionResultContent as FunctionResultContent
|
|
74
78
|
from .generation_config_param import GenerationConfigParam as GenerationConfigParam
|
|
75
79
|
from .document_mime_type_param import DocumentMimeTypeParam as DocumentMimeTypeParam
|
|
80
|
+
from .file_search_call_content import FileSearchCallContent as FileSearchCallContent
|
|
76
81
|
from .tool_choice_config_param import ToolChoiceConfigParam as ToolChoiceConfigParam
|
|
77
82
|
from .url_context_call_content import URLContextCallContent as URLContextCallContent
|
|
78
83
|
from .url_context_result_param import URLContextResultParam as URLContextResultParam
|
|
@@ -93,6 +98,7 @@ from .mcp_server_tool_call_content import MCPServerToolCallContent as MCPServerT
|
|
|
93
98
|
from .code_execution_call_arguments import CodeExecutionCallArguments as CodeExecutionCallArguments
|
|
94
99
|
from .code_execution_result_content import CodeExecutionResultContent as CodeExecutionResultContent
|
|
95
100
|
from .function_result_content_param import FunctionResultContentParam as FunctionResultContentParam
|
|
101
|
+
from .file_search_call_content_param import FileSearchCallContentParam as FileSearchCallContentParam
|
|
96
102
|
from .mcp_server_tool_result_content import MCPServerToolResultContent as MCPServerToolResultContent
|
|
97
103
|
from .url_context_call_content_param import URLContextCallContentParam as URLContextCallContentParam
|
|
98
104
|
from .deep_research_agent_config_param import DeepResearchAgentConfigParam as DeepResearchAgentConfigParam
|
{google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/audio_content.py
RENAMED
|
@@ -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."""
|
{google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/audio_content_param.py
RENAMED
|
@@ -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})
|
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
17
17
|
|
|
18
|
-
from typing import
|
|
18
|
+
from typing import Union
|
|
19
19
|
from typing_extensions import Annotated, TypeAlias
|
|
20
20
|
|
|
21
21
|
from .._utils import PropertyInfo
|
|
22
|
-
from .._models import BaseModel
|
|
23
22
|
from .text_content import TextContent
|
|
24
23
|
from .audio_content import AudioContent
|
|
25
24
|
from .image_content import ImageContent
|
|
@@ -28,6 +27,7 @@ from .thought_content import ThoughtContent
|
|
|
28
27
|
from .document_content import DocumentContent
|
|
29
28
|
from .function_call_content import FunctionCallContent
|
|
30
29
|
from .function_result_content import FunctionResultContent
|
|
30
|
+
from .file_search_call_content import FileSearchCallContent
|
|
31
31
|
from .url_context_call_content import URLContextCallContent
|
|
32
32
|
from .file_search_result_content import FileSearchResultContent
|
|
33
33
|
from .google_search_call_content import GoogleSearchCallContent
|
|
@@ -38,9 +38,9 @@ from .mcp_server_tool_call_content import MCPServerToolCallContent
|
|
|
38
38
|
from .code_execution_result_content import CodeExecutionResultContent
|
|
39
39
|
from .mcp_server_tool_result_content import MCPServerToolResultContent
|
|
40
40
|
|
|
41
|
-
__all__ = ["
|
|
41
|
+
__all__ = ["Content"]
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
Content: TypeAlias = Annotated[
|
|
44
44
|
Union[
|
|
45
45
|
TextContent,
|
|
46
46
|
ImageContent,
|
|
@@ -58,19 +58,8 @@ ContentUnionMember1: TypeAlias = Annotated[
|
|
|
58
58
|
GoogleSearchResultContent,
|
|
59
59
|
MCPServerToolCallContent,
|
|
60
60
|
MCPServerToolResultContent,
|
|
61
|
+
FileSearchCallContent,
|
|
61
62
|
FileSearchResultContent,
|
|
62
63
|
],
|
|
63
64
|
PropertyInfo(discriminator="type"),
|
|
64
65
|
]
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class Turn(BaseModel):
|
|
68
|
-
content: Union[str, List[ContentUnionMember1], None] = None
|
|
69
|
-
"""The content of the turn."""
|
|
70
|
-
|
|
71
|
-
role: Optional[str] = None
|
|
72
|
-
"""The originator of this turn.
|
|
73
|
-
|
|
74
|
-
Must be user for input or model for
|
|
75
|
-
model output.
|
|
76
|
-
"""
|
{google_genai-1.56.0 → google_genai-1.58.0}/google/genai/_interactions/types/content_delta.py
RENAMED
|
@@ -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
|