google-genai 1.53.0__py3-none-any.whl → 1.55.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.
Files changed (324) hide show
  1. google/genai/__init__.py +1 -0
  2. google/genai/_api_client.py +6 -6
  3. google/genai/_interactions/__init__.py +117 -0
  4. google/genai/_interactions/_base_client.py +2019 -0
  5. google/genai/_interactions/_client.py +511 -0
  6. google/genai/_interactions/_compat.py +234 -0
  7. google/genai/_interactions/_constants.py +29 -0
  8. google/genai/_interactions/_exceptions.py +122 -0
  9. google/genai/_interactions/_files.py +139 -0
  10. google/genai/_interactions/_models.py +873 -0
  11. google/genai/_interactions/_qs.py +165 -0
  12. google/genai/_interactions/_resource.py +58 -0
  13. google/genai/_interactions/_response.py +847 -0
  14. google/genai/_interactions/_streaming.py +354 -0
  15. google/genai/_interactions/_types.py +276 -0
  16. google/genai/_interactions/_utils/__init__.py +79 -0
  17. google/genai/_interactions/_utils/_compat.py +61 -0
  18. google/genai/_interactions/_utils/_datetime_parse.py +151 -0
  19. google/genai/_interactions/_utils/_logs.py +40 -0
  20. google/genai/_interactions/_utils/_proxy.py +80 -0
  21. google/genai/_interactions/_utils/_reflection.py +57 -0
  22. google/genai/_interactions/_utils/_resources_proxy.py +39 -0
  23. google/genai/_interactions/_utils/_streams.py +27 -0
  24. google/genai/_interactions/_utils/_sync.py +73 -0
  25. google/genai/_interactions/_utils/_transform.py +472 -0
  26. google/genai/_interactions/_utils/_typing.py +172 -0
  27. google/genai/_interactions/_utils/_utils.py +437 -0
  28. google/genai/_interactions/_version.py +18 -0
  29. google/genai/_interactions/resources/__init__.py +34 -0
  30. google/genai/_interactions/resources/interactions.py +1350 -0
  31. google/genai/_interactions/types/__init__.py +107 -0
  32. google/genai/_interactions/types/allowed_tools.py +33 -0
  33. google/genai/_interactions/types/allowed_tools_param.py +35 -0
  34. google/genai/_interactions/types/annotation.py +42 -0
  35. google/genai/_interactions/types/annotation_param.py +42 -0
  36. google/genai/_interactions/types/audio_content.py +38 -0
  37. google/genai/_interactions/types/audio_content_param.py +45 -0
  38. google/genai/_interactions/types/audio_mime_type.py +25 -0
  39. google/genai/_interactions/types/audio_mime_type_param.py +27 -0
  40. google/genai/_interactions/types/code_execution_call_arguments.py +33 -0
  41. google/genai/_interactions/types/code_execution_call_arguments_param.py +32 -0
  42. google/genai/_interactions/types/code_execution_call_content.py +37 -0
  43. google/genai/_interactions/types/code_execution_call_content_param.py +37 -0
  44. google/genai/_interactions/types/code_execution_result_content.py +42 -0
  45. google/genai/_interactions/types/code_execution_result_content_param.py +41 -0
  46. google/genai/_interactions/types/content_delta.py +358 -0
  47. google/genai/_interactions/types/content_start.py +79 -0
  48. google/genai/_interactions/types/content_stop.py +35 -0
  49. google/genai/_interactions/types/deep_research_agent_config.py +33 -0
  50. google/genai/_interactions/types/deep_research_agent_config_param.py +32 -0
  51. google/genai/_interactions/types/document_content.py +36 -0
  52. google/genai/_interactions/types/document_content_param.py +43 -0
  53. google/genai/_interactions/types/dynamic_agent_config.py +44 -0
  54. google/genai/_interactions/types/dynamic_agent_config_param.py +33 -0
  55. google/genai/_interactions/types/error_event.py +46 -0
  56. google/genai/_interactions/types/file_search_result_content.py +46 -0
  57. google/genai/_interactions/types/file_search_result_content_param.py +46 -0
  58. google/genai/_interactions/types/function.py +38 -0
  59. google/genai/_interactions/types/function_call_content.py +39 -0
  60. google/genai/_interactions/types/function_call_content_param.py +39 -0
  61. google/genai/_interactions/types/function_param.py +37 -0
  62. google/genai/_interactions/types/function_result_content.py +52 -0
  63. google/genai/_interactions/types/function_result_content_param.py +54 -0
  64. google/genai/_interactions/types/generation_config.py +57 -0
  65. google/genai/_interactions/types/generation_config_param.py +59 -0
  66. google/genai/_interactions/types/google_search_call_arguments.py +29 -0
  67. google/genai/_interactions/types/google_search_call_arguments_param.py +31 -0
  68. google/genai/_interactions/types/google_search_call_content.py +37 -0
  69. google/genai/_interactions/types/google_search_call_content_param.py +37 -0
  70. google/genai/_interactions/types/google_search_result.py +35 -0
  71. google/genai/_interactions/types/google_search_result_content.py +43 -0
  72. google/genai/_interactions/types/google_search_result_content_param.py +44 -0
  73. google/genai/_interactions/types/google_search_result_param.py +35 -0
  74. google/genai/_interactions/types/image_content.py +41 -0
  75. google/genai/_interactions/types/image_content_param.py +48 -0
  76. google/genai/_interactions/types/image_mime_type.py +23 -0
  77. google/genai/_interactions/types/image_mime_type_param.py +25 -0
  78. google/genai/_interactions/types/interaction.py +165 -0
  79. google/genai/_interactions/types/interaction_create_params.py +212 -0
  80. google/genai/_interactions/types/interaction_event.py +37 -0
  81. google/genai/_interactions/types/interaction_get_params.py +46 -0
  82. google/genai/_interactions/types/interaction_sse_event.py +32 -0
  83. google/genai/_interactions/types/interaction_status_update.py +37 -0
  84. google/genai/_interactions/types/mcp_server_tool_call_content.py +42 -0
  85. google/genai/_interactions/types/mcp_server_tool_call_content_param.py +42 -0
  86. google/genai/_interactions/types/mcp_server_tool_result_content.py +52 -0
  87. google/genai/_interactions/types/mcp_server_tool_result_content_param.py +54 -0
  88. google/genai/_interactions/types/model.py +36 -0
  89. google/genai/_interactions/types/model_param.py +38 -0
  90. google/genai/_interactions/types/speech_config.py +35 -0
  91. google/genai/_interactions/types/speech_config_param.py +35 -0
  92. google/genai/_interactions/types/text_content.py +37 -0
  93. google/genai/_interactions/types/text_content_param.py +38 -0
  94. google/genai/_interactions/types/thinking_level.py +22 -0
  95. google/genai/_interactions/types/thought_content.py +41 -0
  96. google/genai/_interactions/types/thought_content_param.py +47 -0
  97. google/genai/_interactions/types/tool.py +100 -0
  98. google/genai/_interactions/types/tool_choice.py +26 -0
  99. google/genai/_interactions/types/tool_choice_config.py +28 -0
  100. google/genai/_interactions/types/tool_choice_config_param.py +29 -0
  101. google/genai/_interactions/types/tool_choice_param.py +28 -0
  102. google/genai/_interactions/types/tool_choice_type.py +22 -0
  103. google/genai/_interactions/types/tool_param.py +97 -0
  104. google/genai/_interactions/types/turn.py +76 -0
  105. google/genai/_interactions/types/turn_param.py +73 -0
  106. google/genai/_interactions/types/url_context_call_arguments.py +29 -0
  107. google/genai/_interactions/types/url_context_call_arguments_param.py +31 -0
  108. google/genai/_interactions/types/url_context_call_content.py +37 -0
  109. google/genai/_interactions/types/url_context_call_content_param.py +37 -0
  110. google/genai/_interactions/types/url_context_result.py +33 -0
  111. google/genai/_interactions/types/url_context_result_content.py +43 -0
  112. google/genai/_interactions/types/url_context_result_content_param.py +44 -0
  113. google/genai/_interactions/types/url_context_result_param.py +32 -0
  114. google/genai/_interactions/types/usage.py +106 -0
  115. google/genai/_interactions/types/usage_param.py +106 -0
  116. google/genai/_interactions/types/video_content.py +41 -0
  117. google/genai/_interactions/types/video_content_param.py +48 -0
  118. google/genai/_interactions/types/video_mime_type.py +36 -0
  119. google/genai/_interactions/types/video_mime_type_param.py +38 -0
  120. google/genai/_live_converters.py +34 -3
  121. google/genai/_tokens_converters.py +5 -0
  122. google/genai/batches.py +62 -55
  123. google/genai/client.py +223 -0
  124. google/genai/errors.py +16 -1
  125. google/genai/file_search_stores.py +60 -60
  126. google/genai/files.py +56 -56
  127. google/genai/interactions.py +17 -0
  128. google/genai/live.py +4 -3
  129. google/genai/models.py +15 -3
  130. google/genai/tests/__init__.py +21 -0
  131. google/genai/tests/afc/__init__.py +21 -0
  132. google/genai/tests/afc/test_convert_if_exist_pydantic_model.py +309 -0
  133. google/genai/tests/afc/test_convert_number_values_for_function_call_args.py +63 -0
  134. google/genai/tests/afc/test_find_afc_incompatible_tool_indexes.py +240 -0
  135. google/genai/tests/afc/test_generate_content_stream_afc.py +530 -0
  136. google/genai/tests/afc/test_generate_content_stream_afc_thoughts.py +77 -0
  137. google/genai/tests/afc/test_get_function_map.py +176 -0
  138. google/genai/tests/afc/test_get_function_response_parts.py +277 -0
  139. google/genai/tests/afc/test_get_max_remote_calls_for_afc.py +130 -0
  140. google/genai/tests/afc/test_invoke_function_from_dict_args.py +241 -0
  141. google/genai/tests/afc/test_raise_error_for_afc_incompatible_config.py +159 -0
  142. google/genai/tests/afc/test_should_append_afc_history.py +53 -0
  143. google/genai/tests/afc/test_should_disable_afc.py +214 -0
  144. google/genai/tests/batches/__init__.py +17 -0
  145. google/genai/tests/batches/test_cancel.py +77 -0
  146. google/genai/tests/batches/test_create.py +78 -0
  147. google/genai/tests/batches/test_create_with_bigquery.py +113 -0
  148. google/genai/tests/batches/test_create_with_file.py +82 -0
  149. google/genai/tests/batches/test_create_with_gcs.py +125 -0
  150. google/genai/tests/batches/test_create_with_inlined_requests.py +255 -0
  151. google/genai/tests/batches/test_delete.py +86 -0
  152. google/genai/tests/batches/test_embedding.py +157 -0
  153. google/genai/tests/batches/test_get.py +78 -0
  154. google/genai/tests/batches/test_list.py +79 -0
  155. google/genai/tests/caches/__init__.py +17 -0
  156. google/genai/tests/caches/constants.py +29 -0
  157. google/genai/tests/caches/test_create.py +210 -0
  158. google/genai/tests/caches/test_create_custom_url.py +105 -0
  159. google/genai/tests/caches/test_delete.py +54 -0
  160. google/genai/tests/caches/test_delete_custom_url.py +52 -0
  161. google/genai/tests/caches/test_get.py +94 -0
  162. google/genai/tests/caches/test_get_custom_url.py +52 -0
  163. google/genai/tests/caches/test_list.py +68 -0
  164. google/genai/tests/caches/test_update.py +70 -0
  165. google/genai/tests/caches/test_update_custom_url.py +58 -0
  166. google/genai/tests/chats/__init__.py +1 -0
  167. google/genai/tests/chats/test_get_history.py +597 -0
  168. google/genai/tests/chats/test_send_message.py +844 -0
  169. google/genai/tests/chats/test_validate_response.py +90 -0
  170. google/genai/tests/client/__init__.py +17 -0
  171. google/genai/tests/client/test_async_stream.py +427 -0
  172. google/genai/tests/client/test_client_close.py +197 -0
  173. google/genai/tests/client/test_client_initialization.py +1687 -0
  174. google/genai/tests/client/test_client_requests.py +355 -0
  175. google/genai/tests/client/test_custom_client.py +77 -0
  176. google/genai/tests/client/test_http_options.py +178 -0
  177. google/genai/tests/client/test_replay_client_equality.py +168 -0
  178. google/genai/tests/client/test_retries.py +846 -0
  179. google/genai/tests/client/test_upload_errors.py +136 -0
  180. google/genai/tests/common/__init__.py +17 -0
  181. google/genai/tests/common/test_common.py +954 -0
  182. google/genai/tests/conftest.py +162 -0
  183. google/genai/tests/documents/__init__.py +17 -0
  184. google/genai/tests/documents/test_delete.py +51 -0
  185. google/genai/tests/documents/test_get.py +85 -0
  186. google/genai/tests/documents/test_list.py +72 -0
  187. google/genai/tests/errors/__init__.py +1 -0
  188. google/genai/tests/errors/test_api_error.py +417 -0
  189. google/genai/tests/file_search_stores/__init__.py +17 -0
  190. google/genai/tests/file_search_stores/test_create.py +66 -0
  191. google/genai/tests/file_search_stores/test_delete.py +64 -0
  192. google/genai/tests/file_search_stores/test_get.py +94 -0
  193. google/genai/tests/file_search_stores/test_import_file.py +112 -0
  194. google/genai/tests/file_search_stores/test_list.py +57 -0
  195. google/genai/tests/file_search_stores/test_upload_to_file_search_store.py +141 -0
  196. google/genai/tests/files/__init__.py +17 -0
  197. google/genai/tests/files/test_delete.py +46 -0
  198. google/genai/tests/files/test_download.py +85 -0
  199. google/genai/tests/files/test_get.py +46 -0
  200. google/genai/tests/files/test_list.py +72 -0
  201. google/genai/tests/files/test_upload.py +255 -0
  202. google/genai/tests/imports/test_no_optional_imports.py +28 -0
  203. google/genai/tests/interactions/__init__.py +0 -0
  204. google/genai/tests/interactions/test_integration.py +80 -0
  205. google/genai/tests/live/__init__.py +16 -0
  206. google/genai/tests/live/test_live.py +2177 -0
  207. google/genai/tests/live/test_live_music.py +362 -0
  208. google/genai/tests/live/test_live_response.py +163 -0
  209. google/genai/tests/live/test_send_client_content.py +147 -0
  210. google/genai/tests/live/test_send_realtime_input.py +268 -0
  211. google/genai/tests/live/test_send_tool_response.py +222 -0
  212. google/genai/tests/local_tokenizer/__init__.py +17 -0
  213. google/genai/tests/local_tokenizer/test_local_tokenizer.py +343 -0
  214. google/genai/tests/local_tokenizer/test_local_tokenizer_loader.py +235 -0
  215. google/genai/tests/mcp/__init__.py +17 -0
  216. google/genai/tests/mcp/test_has_mcp_tool_usage.py +89 -0
  217. google/genai/tests/mcp/test_mcp_to_gemini_tools.py +191 -0
  218. google/genai/tests/mcp/test_parse_config_for_mcp_sessions.py +201 -0
  219. google/genai/tests/mcp/test_parse_config_for_mcp_usage.py +130 -0
  220. google/genai/tests/mcp/test_set_mcp_usage_header.py +72 -0
  221. google/genai/tests/models/__init__.py +17 -0
  222. google/genai/tests/models/constants.py +8 -0
  223. google/genai/tests/models/test_compute_tokens.py +120 -0
  224. google/genai/tests/models/test_count_tokens.py +159 -0
  225. google/genai/tests/models/test_delete.py +107 -0
  226. google/genai/tests/models/test_edit_image.py +264 -0
  227. google/genai/tests/models/test_embed_content.py +94 -0
  228. google/genai/tests/models/test_function_call_streaming.py +442 -0
  229. google/genai/tests/models/test_generate_content.py +2502 -0
  230. google/genai/tests/models/test_generate_content_cached_content.py +132 -0
  231. google/genai/tests/models/test_generate_content_config_zero_value.py +103 -0
  232. google/genai/tests/models/test_generate_content_from_apikey.py +44 -0
  233. google/genai/tests/models/test_generate_content_http_options.py +40 -0
  234. google/genai/tests/models/test_generate_content_image_generation.py +143 -0
  235. google/genai/tests/models/test_generate_content_mcp.py +343 -0
  236. google/genai/tests/models/test_generate_content_media_resolution.py +97 -0
  237. google/genai/tests/models/test_generate_content_model.py +139 -0
  238. google/genai/tests/models/test_generate_content_part.py +821 -0
  239. google/genai/tests/models/test_generate_content_thought.py +76 -0
  240. google/genai/tests/models/test_generate_content_tools.py +1761 -0
  241. google/genai/tests/models/test_generate_images.py +191 -0
  242. google/genai/tests/models/test_generate_videos.py +759 -0
  243. google/genai/tests/models/test_get.py +104 -0
  244. google/genai/tests/models/test_list.py +233 -0
  245. google/genai/tests/models/test_recontext_image.py +189 -0
  246. google/genai/tests/models/test_segment_image.py +148 -0
  247. google/genai/tests/models/test_update.py +95 -0
  248. google/genai/tests/models/test_upscale_image.py +157 -0
  249. google/genai/tests/operations/__init__.py +17 -0
  250. google/genai/tests/operations/test_get.py +38 -0
  251. google/genai/tests/public_samples/__init__.py +17 -0
  252. google/genai/tests/public_samples/test_gemini_text_only.py +34 -0
  253. google/genai/tests/pytest_helper.py +229 -0
  254. google/genai/tests/shared/__init__.py +16 -0
  255. google/genai/tests/shared/batches/__init__.py +14 -0
  256. google/genai/tests/shared/batches/test_create_delete.py +57 -0
  257. google/genai/tests/shared/batches/test_create_get_cancel.py +56 -0
  258. google/genai/tests/shared/batches/test_list.py +40 -0
  259. google/genai/tests/shared/caches/__init__.py +14 -0
  260. google/genai/tests/shared/caches/test_create_get_delete.py +67 -0
  261. google/genai/tests/shared/caches/test_create_update_get.py +71 -0
  262. google/genai/tests/shared/caches/test_list.py +40 -0
  263. google/genai/tests/shared/chats/__init__.py +14 -0
  264. google/genai/tests/shared/chats/test_send_message.py +48 -0
  265. google/genai/tests/shared/chats/test_send_message_stream.py +50 -0
  266. google/genai/tests/shared/files/__init__.py +14 -0
  267. google/genai/tests/shared/files/test_list.py +41 -0
  268. google/genai/tests/shared/files/test_upload_get_delete.py +54 -0
  269. google/genai/tests/shared/models/__init__.py +14 -0
  270. google/genai/tests/shared/models/test_compute_tokens.py +41 -0
  271. google/genai/tests/shared/models/test_count_tokens.py +40 -0
  272. google/genai/tests/shared/models/test_edit_image.py +67 -0
  273. google/genai/tests/shared/models/test_embed.py +40 -0
  274. google/genai/tests/shared/models/test_generate_content.py +39 -0
  275. google/genai/tests/shared/models/test_generate_content_stream.py +54 -0
  276. google/genai/tests/shared/models/test_generate_images.py +40 -0
  277. google/genai/tests/shared/models/test_generate_videos.py +38 -0
  278. google/genai/tests/shared/models/test_list.py +37 -0
  279. google/genai/tests/shared/models/test_recontext_image.py +55 -0
  280. google/genai/tests/shared/models/test_segment_image.py +52 -0
  281. google/genai/tests/shared/models/test_upscale_image.py +52 -0
  282. google/genai/tests/shared/tunings/__init__.py +16 -0
  283. google/genai/tests/shared/tunings/test_create.py +46 -0
  284. google/genai/tests/shared/tunings/test_create_get_cancel.py +56 -0
  285. google/genai/tests/shared/tunings/test_list.py +39 -0
  286. google/genai/tests/tokens/__init__.py +16 -0
  287. google/genai/tests/tokens/test_create.py +154 -0
  288. google/genai/tests/transformers/__init__.py +17 -0
  289. google/genai/tests/transformers/test_blobs.py +71 -0
  290. google/genai/tests/transformers/test_bytes.py +15 -0
  291. google/genai/tests/transformers/test_duck_type.py +96 -0
  292. google/genai/tests/transformers/test_function_responses.py +72 -0
  293. google/genai/tests/transformers/test_schema.py +653 -0
  294. google/genai/tests/transformers/test_t_batch.py +286 -0
  295. google/genai/tests/transformers/test_t_content.py +160 -0
  296. google/genai/tests/transformers/test_t_contents.py +398 -0
  297. google/genai/tests/transformers/test_t_part.py +85 -0
  298. google/genai/tests/transformers/test_t_parts.py +87 -0
  299. google/genai/tests/transformers/test_t_tool.py +157 -0
  300. google/genai/tests/transformers/test_t_tools.py +195 -0
  301. google/genai/tests/tunings/__init__.py +16 -0
  302. google/genai/tests/tunings/test_cancel.py +39 -0
  303. google/genai/tests/tunings/test_end_to_end.py +106 -0
  304. google/genai/tests/tunings/test_get.py +67 -0
  305. google/genai/tests/tunings/test_list.py +75 -0
  306. google/genai/tests/tunings/test_tune.py +268 -0
  307. google/genai/tests/types/__init__.py +16 -0
  308. google/genai/tests/types/test_bytes_internal.py +271 -0
  309. google/genai/tests/types/test_bytes_type.py +152 -0
  310. google/genai/tests/types/test_future.py +101 -0
  311. google/genai/tests/types/test_optional_types.py +36 -0
  312. google/genai/tests/types/test_part_type.py +616 -0
  313. google/genai/tests/types/test_schema_from_json_schema.py +417 -0
  314. google/genai/tests/types/test_schema_json_schema.py +468 -0
  315. google/genai/tests/types/test_types.py +2903 -0
  316. google/genai/tunings.py +57 -57
  317. google/genai/types.py +229 -121
  318. google/genai/version.py +1 -1
  319. {google_genai-1.53.0.dist-info → google_genai-1.55.0.dist-info}/METADATA +4 -2
  320. google_genai-1.55.0.dist-info/RECORD +345 -0
  321. google_genai-1.53.0.dist-info/RECORD +0 -41
  322. {google_genai-1.53.0.dist-info → google_genai-1.55.0.dist-info}/WHEEL +0 -0
  323. {google_genai-1.53.0.dist-info → google_genai-1.55.0.dist-info}/licenses/LICENSE +0 -0
  324. {google_genai-1.53.0.dist-info → google_genai-1.55.0.dist-info}/top_level.txt +0 -0
google/genai/tunings.py CHANGED
@@ -867,12 +867,12 @@ def _SpeechConfig_to_vertex(
867
867
  root_object: Optional[Union[dict[str, Any], object]] = None,
868
868
  ) -> dict[str, Any]:
869
869
  to_object: dict[str, Any] = {}
870
- if getv(from_object, ['language_code']) is not None:
871
- setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
872
-
873
870
  if getv(from_object, ['voice_config']) is not None:
874
871
  setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config']))
875
872
 
873
+ if getv(from_object, ['language_code']) is not None:
874
+ setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
875
+
876
876
  if getv(from_object, ['multi_speaker_voice_config']) is not None:
877
877
  raise ValueError(
878
878
  'multi_speaker_voice_config parameter is not supported in Vertex AI.'
@@ -1555,33 +1555,6 @@ class Tunings(_api_module.BaseModule):
1555
1555
  self._api_client._verify_response(return_value)
1556
1556
  return return_value
1557
1557
 
1558
- def list(
1559
- self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
1560
- ) -> Pager[types.TuningJob]:
1561
- """Lists `TuningJob` objects.
1562
-
1563
- Args:
1564
- config: The configuration for the list request.
1565
-
1566
- Returns:
1567
- A Pager object that contains one page of tuning jobs. When iterating over
1568
- the pager, it automatically fetches the next page if there are more.
1569
-
1570
- Usage:
1571
-
1572
- .. code-block:: python
1573
- for tuning_job in client.tunings.list():
1574
- print(tuning_job.name)
1575
- """
1576
-
1577
- list_request = self._list
1578
- return Pager(
1579
- 'tuning_jobs',
1580
- list_request,
1581
- self._list(config=config),
1582
- config,
1583
- )
1584
-
1585
1558
  def get(
1586
1559
  self,
1587
1560
  *,
@@ -1683,6 +1656,33 @@ class Tunings(_api_module.BaseModule):
1683
1656
  )
1684
1657
  return tuning_job
1685
1658
 
1659
+ def list(
1660
+ self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
1661
+ ) -> Pager[types.TuningJob]:
1662
+ """Lists `TuningJob` objects.
1663
+
1664
+ Args:
1665
+ config: The configuration for the list request.
1666
+
1667
+ Returns:
1668
+ A Pager object that contains one page of tuning jobs. When iterating over
1669
+ the pager, it automatically fetches the next page if there are more.
1670
+
1671
+ Usage:
1672
+
1673
+ .. code-block:: python
1674
+ for tuning_job in client.tunings.list():
1675
+ print(tuning_job.name)
1676
+ """
1677
+
1678
+ list_request = self._list
1679
+ return Pager(
1680
+ 'tuning_jobs',
1681
+ list_request,
1682
+ self._list(config=config),
1683
+ config,
1684
+ )
1685
+
1686
1686
 
1687
1687
  class AsyncTunings(_api_module.BaseModule):
1688
1688
 
@@ -2049,33 +2049,6 @@ class AsyncTunings(_api_module.BaseModule):
2049
2049
  self._api_client._verify_response(return_value)
2050
2050
  return return_value
2051
2051
 
2052
- async def list(
2053
- self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
2054
- ) -> AsyncPager[types.TuningJob]:
2055
- """Lists `TuningJob` objects asynchronously.
2056
-
2057
- Args:
2058
- config: The configuration for the list request.
2059
-
2060
- Returns:
2061
- A Pager object that contains one page of tuning jobs. When iterating over
2062
- the pager, it automatically fetches the next page if there are more.
2063
-
2064
- Usage:
2065
-
2066
- .. code-block:: python
2067
- async for tuning_job in await client.aio.tunings.list():
2068
- print(tuning_job.name)
2069
- """
2070
-
2071
- list_request = self._list
2072
- return AsyncPager(
2073
- 'tuning_jobs',
2074
- list_request,
2075
- await self._list(config=config),
2076
- config,
2077
- )
2078
-
2079
2052
  async def get(
2080
2053
  self,
2081
2054
  *,
@@ -2171,6 +2144,33 @@ class AsyncTunings(_api_module.BaseModule):
2171
2144
  )
2172
2145
  return tuning_job
2173
2146
 
2147
+ async def list(
2148
+ self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
2149
+ ) -> AsyncPager[types.TuningJob]:
2150
+ """Lists `TuningJob` objects asynchronously.
2151
+
2152
+ Args:
2153
+ config: The configuration for the list request.
2154
+
2155
+ Returns:
2156
+ A Pager object that contains one page of tuning jobs. When iterating over
2157
+ the pager, it automatically fetches the next page if there are more.
2158
+
2159
+ Usage:
2160
+
2161
+ .. code-block:: python
2162
+ async for tuning_job in await client.aio.tunings.list():
2163
+ print(tuning_job.name)
2164
+ """
2165
+
2166
+ list_request = self._list
2167
+ return AsyncPager(
2168
+ 'tuning_jobs',
2169
+ list_request,
2170
+ await self._list(config=config),
2171
+ config,
2172
+ )
2173
+
2174
2174
 
2175
2175
  class _IpythonUtils:
2176
2176
  """Temporary class to hold the IPython related functions."""
google/genai/types.py CHANGED
@@ -376,6 +376,10 @@ class FinishReason(_common.CaseInSensitiveEnum):
376
376
  """Image generation stopped because the generated images have prohibited content."""
377
377
  NO_IMAGE = 'NO_IMAGE'
378
378
  """The model was expected to generate an image, but none was generated."""
379
+ IMAGE_RECITATION = 'IMAGE_RECITATION'
380
+ """Image generation stopped because the generated image may be a recitation from a source."""
381
+ IMAGE_OTHER = 'IMAGE_OTHER'
382
+ """Image generation stopped for a reason not otherwise specified."""
379
383
 
380
384
 
381
385
  class HarmProbability(_common.CaseInSensitiveEnum):
@@ -857,6 +861,17 @@ class MediaModality(_common.CaseInSensitiveEnum):
857
861
  """Document, e.g. PDF."""
858
862
 
859
863
 
864
+ class VadSignalType(_common.CaseInSensitiveEnum):
865
+ """The type of the VAD signal."""
866
+
867
+ VAD_SIGNAL_TYPE_UNSPECIFIED = 'VAD_SIGNAL_TYPE_UNSPECIFIED'
868
+ """The default is VAD_SIGNAL_TYPE_UNSPECIFIED."""
869
+ VAD_SIGNAL_TYPE_SOS = 'VAD_SIGNAL_TYPE_SOS'
870
+ """Start of sentence signal."""
871
+ VAD_SIGNAL_TYPE_EOS = 'VAD_SIGNAL_TYPE_EOS'
872
+ """End of sentence signal."""
873
+
874
+
860
875
  class StartSensitivity(_common.CaseInSensitiveEnum):
861
876
  """Start of speech sensitivity."""
862
877
 
@@ -4368,6 +4383,163 @@ class ToolConfigDict(TypedDict, total=False):
4368
4383
  ToolConfigOrDict = Union[ToolConfig, ToolConfigDict]
4369
4384
 
4370
4385
 
4386
+ class ReplicatedVoiceConfig(_common.BaseModel):
4387
+ """ReplicatedVoiceConfig is used to configure replicated voice."""
4388
+
4389
+ mime_type: Optional[str] = Field(
4390
+ default=None,
4391
+ description="""The mime type of the replicated voice.
4392
+ """,
4393
+ )
4394
+ voice_sample_audio: Optional[bytes] = Field(
4395
+ default=None,
4396
+ description="""The sample audio of the replicated voice.
4397
+ """,
4398
+ )
4399
+
4400
+
4401
+ class ReplicatedVoiceConfigDict(TypedDict, total=False):
4402
+ """ReplicatedVoiceConfig is used to configure replicated voice."""
4403
+
4404
+ mime_type: Optional[str]
4405
+ """The mime type of the replicated voice.
4406
+ """
4407
+
4408
+ voice_sample_audio: Optional[bytes]
4409
+ """The sample audio of the replicated voice.
4410
+ """
4411
+
4412
+
4413
+ ReplicatedVoiceConfigOrDict = Union[
4414
+ ReplicatedVoiceConfig, ReplicatedVoiceConfigDict
4415
+ ]
4416
+
4417
+
4418
+ class PrebuiltVoiceConfig(_common.BaseModel):
4419
+ """The configuration for the prebuilt speaker to use."""
4420
+
4421
+ voice_name: Optional[str] = Field(
4422
+ default=None, description="""The name of the preset voice to use."""
4423
+ )
4424
+
4425
+
4426
+ class PrebuiltVoiceConfigDict(TypedDict, total=False):
4427
+ """The configuration for the prebuilt speaker to use."""
4428
+
4429
+ voice_name: Optional[str]
4430
+ """The name of the preset voice to use."""
4431
+
4432
+
4433
+ PrebuiltVoiceConfigOrDict = Union[PrebuiltVoiceConfig, PrebuiltVoiceConfigDict]
4434
+
4435
+
4436
+ class VoiceConfig(_common.BaseModel):
4437
+
4438
+ replicated_voice_config: Optional[ReplicatedVoiceConfig] = Field(
4439
+ default=None,
4440
+ description="""If true, the model will use a replicated voice for the response.""",
4441
+ )
4442
+ prebuilt_voice_config: Optional[PrebuiltVoiceConfig] = Field(
4443
+ default=None,
4444
+ description="""The configuration for the prebuilt voice to use.""",
4445
+ )
4446
+
4447
+
4448
+ class VoiceConfigDict(TypedDict, total=False):
4449
+
4450
+ replicated_voice_config: Optional[ReplicatedVoiceConfigDict]
4451
+ """If true, the model will use a replicated voice for the response."""
4452
+
4453
+ prebuilt_voice_config: Optional[PrebuiltVoiceConfigDict]
4454
+ """The configuration for the prebuilt voice to use."""
4455
+
4456
+
4457
+ VoiceConfigOrDict = Union[VoiceConfig, VoiceConfigDict]
4458
+
4459
+
4460
+ class SpeakerVoiceConfig(_common.BaseModel):
4461
+ """Configuration for a single speaker in a multi speaker setup."""
4462
+
4463
+ speaker: Optional[str] = Field(
4464
+ default=None,
4465
+ description="""Required. The name of the speaker. This should be the same as the speaker name used in the prompt.""",
4466
+ )
4467
+ voice_config: Optional[VoiceConfig] = Field(
4468
+ default=None,
4469
+ description="""Required. The configuration for the voice of this speaker.""",
4470
+ )
4471
+
4472
+
4473
+ class SpeakerVoiceConfigDict(TypedDict, total=False):
4474
+ """Configuration for a single speaker in a multi speaker setup."""
4475
+
4476
+ speaker: Optional[str]
4477
+ """Required. The name of the speaker. This should be the same as the speaker name used in the prompt."""
4478
+
4479
+ voice_config: Optional[VoiceConfigDict]
4480
+ """Required. The configuration for the voice of this speaker."""
4481
+
4482
+
4483
+ SpeakerVoiceConfigOrDict = Union[SpeakerVoiceConfig, SpeakerVoiceConfigDict]
4484
+
4485
+
4486
+ class MultiSpeakerVoiceConfig(_common.BaseModel):
4487
+ """The configuration for the multi-speaker setup.
4488
+
4489
+ This data type is not supported in Vertex AI.
4490
+ """
4491
+
4492
+ speaker_voice_configs: Optional[list[SpeakerVoiceConfig]] = Field(
4493
+ default=None, description="""Required. All the enabled speaker voices."""
4494
+ )
4495
+
4496
+
4497
+ class MultiSpeakerVoiceConfigDict(TypedDict, total=False):
4498
+ """The configuration for the multi-speaker setup.
4499
+
4500
+ This data type is not supported in Vertex AI.
4501
+ """
4502
+
4503
+ speaker_voice_configs: Optional[list[SpeakerVoiceConfigDict]]
4504
+ """Required. All the enabled speaker voices."""
4505
+
4506
+
4507
+ MultiSpeakerVoiceConfigOrDict = Union[
4508
+ MultiSpeakerVoiceConfig, MultiSpeakerVoiceConfigDict
4509
+ ]
4510
+
4511
+
4512
+ class SpeechConfig(_common.BaseModel):
4513
+
4514
+ voice_config: Optional[VoiceConfig] = Field(
4515
+ default=None,
4516
+ description="""Configuration for the voice of the response.""",
4517
+ )
4518
+ language_code: Optional[str] = Field(
4519
+ default=None,
4520
+ description="""Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization.""",
4521
+ )
4522
+ multi_speaker_voice_config: Optional[MultiSpeakerVoiceConfig] = Field(
4523
+ default=None,
4524
+ description="""Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI.""",
4525
+ )
4526
+
4527
+
4528
+ class SpeechConfigDict(TypedDict, total=False):
4529
+
4530
+ voice_config: Optional[VoiceConfigDict]
4531
+ """Configuration for the voice of the response."""
4532
+
4533
+ language_code: Optional[str]
4534
+ """Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization."""
4535
+
4536
+ multi_speaker_voice_config: Optional[MultiSpeakerVoiceConfigDict]
4537
+ """Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI."""
4538
+
4539
+
4540
+ SpeechConfigOrDict = Union[SpeechConfig, SpeechConfigDict]
4541
+
4542
+
4371
4543
  class AutomaticFunctionCallingConfig(_common.BaseModel):
4372
4544
  """The configuration for automatic function calling."""
4373
4545
 
@@ -4792,38 +4964,6 @@ class SafetySettingDict(TypedDict, total=False):
4792
4964
  SafetySettingOrDict = Union[SafetySetting, SafetySettingDict]
4793
4965
 
4794
4966
 
4795
- class SpeechConfig(_common.BaseModel):
4796
- """The speech generation config."""
4797
-
4798
- language_code: Optional[str] = Field(
4799
- default=None,
4800
- description="""Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization.""",
4801
- )
4802
- voice_config: Optional['VoiceConfig'] = Field(
4803
- default=None, description="""The configuration for the speaker to use."""
4804
- )
4805
- multi_speaker_voice_config: Optional['MultiSpeakerVoiceConfig'] = Field(
4806
- default=None,
4807
- description="""Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI.""",
4808
- )
4809
-
4810
-
4811
- class SpeechConfigDict(TypedDict, total=False):
4812
- """The speech generation config."""
4813
-
4814
- language_code: Optional[str]
4815
- """Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization."""
4816
-
4817
- voice_config: Optional['VoiceConfigDict']
4818
- """The configuration for the speaker to use."""
4819
-
4820
- multi_speaker_voice_config: Optional['MultiSpeakerVoiceConfigDict']
4821
- """Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI."""
4822
-
4823
-
4824
- SpeechConfigOrDict = Union[SpeechConfig, SpeechConfigDict]
4825
-
4826
-
4827
4967
  SpeechConfigUnion = Union[str, SpeechConfig]
4828
4968
 
4829
4969
 
@@ -5040,6 +5180,12 @@ class GenerateContentConfig(_common.BaseModel):
5040
5180
  description="""The image generation configuration.
5041
5181
  """,
5042
5182
  )
5183
+ enable_enhanced_civic_answers: Optional[bool] = Field(
5184
+ default=None,
5185
+ description="""Enables enhanced civic answers. It may not be available for all
5186
+ models. This field is not supported in Vertex AI.
5187
+ """,
5188
+ )
5043
5189
 
5044
5190
  @pydantic.field_validator('response_schema', mode='before')
5045
5191
  @classmethod
@@ -5245,6 +5391,11 @@ class GenerateContentConfigDict(TypedDict, total=False):
5245
5391
  """The image generation configuration.
5246
5392
  """
5247
5393
 
5394
+ enable_enhanced_civic_answers: Optional[bool]
5395
+ """Enables enhanced civic answers. It may not be available for all
5396
+ models. This field is not supported in Vertex AI.
5397
+ """
5398
+
5248
5399
 
5249
5400
  GenerateContentConfigOrDict = Union[
5250
5401
  GenerateContentConfig, GenerateContentConfigDict
@@ -9068,95 +9219,6 @@ class DeleteModelResponseDict(TypedDict, total=False):
9068
9219
  DeleteModelResponseOrDict = Union[DeleteModelResponse, DeleteModelResponseDict]
9069
9220
 
9070
9221
 
9071
- class PrebuiltVoiceConfig(_common.BaseModel):
9072
- """The configuration for the prebuilt speaker to use."""
9073
-
9074
- voice_name: Optional[str] = Field(
9075
- default=None, description="""The name of the preset voice to use."""
9076
- )
9077
-
9078
-
9079
- class PrebuiltVoiceConfigDict(TypedDict, total=False):
9080
- """The configuration for the prebuilt speaker to use."""
9081
-
9082
- voice_name: Optional[str]
9083
- """The name of the preset voice to use."""
9084
-
9085
-
9086
- PrebuiltVoiceConfigOrDict = Union[PrebuiltVoiceConfig, PrebuiltVoiceConfigDict]
9087
-
9088
-
9089
- class VoiceConfig(_common.BaseModel):
9090
- """The configuration for the voice to use."""
9091
-
9092
- prebuilt_voice_config: Optional[PrebuiltVoiceConfig] = Field(
9093
- default=None,
9094
- description="""The configuration for the prebuilt voice to use.""",
9095
- )
9096
-
9097
-
9098
- class VoiceConfigDict(TypedDict, total=False):
9099
- """The configuration for the voice to use."""
9100
-
9101
- prebuilt_voice_config: Optional[PrebuiltVoiceConfigDict]
9102
- """The configuration for the prebuilt voice to use."""
9103
-
9104
-
9105
- VoiceConfigOrDict = Union[VoiceConfig, VoiceConfigDict]
9106
-
9107
-
9108
- class SpeakerVoiceConfig(_common.BaseModel):
9109
- """Configuration for a single speaker in a multi speaker setup."""
9110
-
9111
- speaker: Optional[str] = Field(
9112
- default=None,
9113
- description="""Required. The name of the speaker. This should be the same as the speaker name used in the prompt.""",
9114
- )
9115
- voice_config: Optional[VoiceConfig] = Field(
9116
- default=None,
9117
- description="""Required. The configuration for the voice of this speaker.""",
9118
- )
9119
-
9120
-
9121
- class SpeakerVoiceConfigDict(TypedDict, total=False):
9122
- """Configuration for a single speaker in a multi speaker setup."""
9123
-
9124
- speaker: Optional[str]
9125
- """Required. The name of the speaker. This should be the same as the speaker name used in the prompt."""
9126
-
9127
- voice_config: Optional[VoiceConfigDict]
9128
- """Required. The configuration for the voice of this speaker."""
9129
-
9130
-
9131
- SpeakerVoiceConfigOrDict = Union[SpeakerVoiceConfig, SpeakerVoiceConfigDict]
9132
-
9133
-
9134
- class MultiSpeakerVoiceConfig(_common.BaseModel):
9135
- """The configuration for the multi-speaker setup.
9136
-
9137
- This data type is not supported in Vertex AI.
9138
- """
9139
-
9140
- speaker_voice_configs: Optional[list[SpeakerVoiceConfig]] = Field(
9141
- default=None, description="""Required. All the enabled speaker voices."""
9142
- )
9143
-
9144
-
9145
- class MultiSpeakerVoiceConfigDict(TypedDict, total=False):
9146
- """The configuration for the multi-speaker setup.
9147
-
9148
- This data type is not supported in Vertex AI.
9149
- """
9150
-
9151
- speaker_voice_configs: Optional[list[SpeakerVoiceConfigDict]]
9152
- """Required. All the enabled speaker voices."""
9153
-
9154
-
9155
- MultiSpeakerVoiceConfigOrDict = Union[
9156
- MultiSpeakerVoiceConfig, MultiSpeakerVoiceConfigDict
9157
- ]
9158
-
9159
-
9160
9222
  class GenerationConfig(_common.BaseModel):
9161
9223
  """Generation config."""
9162
9224
 
@@ -16182,6 +16244,24 @@ LiveServerSessionResumptionUpdateOrDict = Union[
16182
16244
  ]
16183
16245
 
16184
16246
 
16247
+ class VoiceActivityDetectionSignal(_common.BaseModel):
16248
+
16249
+ vad_signal_type: Optional[VadSignalType] = Field(
16250
+ default=None, description="""The type of the VAD signal."""
16251
+ )
16252
+
16253
+
16254
+ class VoiceActivityDetectionSignalDict(TypedDict, total=False):
16255
+
16256
+ vad_signal_type: Optional[VadSignalType]
16257
+ """The type of the VAD signal."""
16258
+
16259
+
16260
+ VoiceActivityDetectionSignalOrDict = Union[
16261
+ VoiceActivityDetectionSignal, VoiceActivityDetectionSignalDict
16262
+ ]
16263
+
16264
+
16185
16265
  class LiveServerMessage(_common.BaseModel):
16186
16266
  """Response message for API call."""
16187
16267
 
@@ -16213,6 +16293,9 @@ class LiveServerMessage(_common.BaseModel):
16213
16293
  description="""Update of the session resumption state.""",
16214
16294
  )
16215
16295
  )
16296
+ voice_activity_detection_signal: Optional[VoiceActivityDetectionSignal] = (
16297
+ Field(default=None, description="""Voice activity detection signal.""")
16298
+ )
16216
16299
 
16217
16300
  @property
16218
16301
  def text(self) -> Optional[str]:
@@ -16309,6 +16392,9 @@ class LiveServerMessageDict(TypedDict, total=False):
16309
16392
  session_resumption_update: Optional[LiveServerSessionResumptionUpdateDict]
16310
16393
  """Update of the session resumption state."""
16311
16394
 
16395
+ voice_activity_detection_signal: Optional[VoiceActivityDetectionSignalDict]
16396
+ """Voice activity detection signal."""
16397
+
16312
16398
 
16313
16399
  LiveServerMessageOrDict = Union[LiveServerMessage, LiveServerMessageDict]
16314
16400
 
@@ -16598,6 +16684,12 @@ class LiveClientSetup(_common.BaseModel):
16598
16684
  description="""Configures the proactivity of the model. This allows the model to respond proactively to
16599
16685
  the input and to ignore irrelevant input.""",
16600
16686
  )
16687
+ explicit_vad_signal: Optional[bool] = Field(
16688
+ default=None,
16689
+ description="""Configures the explicit VAD signal. If enabled, the client will send
16690
+ vad_signal to indicate the start and end of speech. This allows the server
16691
+ to process the audio more efficiently.""",
16692
+ )
16601
16693
 
16602
16694
 
16603
16695
  class LiveClientSetupDict(TypedDict, total=False):
@@ -16649,6 +16741,11 @@ class LiveClientSetupDict(TypedDict, total=False):
16649
16741
  """Configures the proactivity of the model. This allows the model to respond proactively to
16650
16742
  the input and to ignore irrelevant input."""
16651
16743
 
16744
+ explicit_vad_signal: Optional[bool]
16745
+ """Configures the explicit VAD signal. If enabled, the client will send
16746
+ vad_signal to indicate the start and end of speech. This allows the server
16747
+ to process the audio more efficiently."""
16748
+
16652
16749
 
16653
16750
  LiveClientSetupOrDict = Union[LiveClientSetup, LiveClientSetupDict]
16654
16751
 
@@ -17133,6 +17230,12 @@ If included the server will send SessionResumptionUpdate messages.""",
17133
17230
  description="""Configures the proactivity of the model. This allows the model to respond proactively to
17134
17231
  the input and to ignore irrelevant input.""",
17135
17232
  )
17233
+ explicit_vad_signal: Optional[bool] = Field(
17234
+ default=None,
17235
+ description="""Configures the explicit VAD signal. If enabled, the client will send
17236
+ vad_signal to indicate the start and end of speech. This allows the server
17237
+ to process the audio more efficiently.""",
17238
+ )
17136
17239
 
17137
17240
 
17138
17241
  class LiveConnectConfigDict(TypedDict, total=False):
@@ -17235,6 +17338,11 @@ If included the server will send SessionResumptionUpdate messages."""
17235
17338
  """Configures the proactivity of the model. This allows the model to respond proactively to
17236
17339
  the input and to ignore irrelevant input."""
17237
17340
 
17341
+ explicit_vad_signal: Optional[bool]
17342
+ """Configures the explicit VAD signal. If enabled, the client will send
17343
+ vad_signal to indicate the start and end of speech. This allows the server
17344
+ to process the audio more efficiently."""
17345
+
17238
17346
 
17239
17347
  LiveConnectConfigOrDict = Union[LiveConnectConfig, LiveConnectConfigDict]
17240
17348
 
google/genai/version.py CHANGED
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
  #
15
15
 
16
- __version__ = '1.53.0' # x-release-please-version
16
+ __version__ = '1.55.0' # x-release-please-version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-genai
3
- Version: 1.53.0
3
+ Version: 1.55.0
4
4
  Summary: GenAI Python SDK
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License-Expression: Apache-2.0
@@ -27,6 +27,8 @@ Requires-Dist: requests<3.0.0,>=2.28.1
27
27
  Requires-Dist: tenacity<9.2.0,>=8.2.3
28
28
  Requires-Dist: websockets<15.1.0,>=13.0.0
29
29
  Requires-Dist: typing-extensions<5.0.0,>=4.11.0
30
+ Requires-Dist: distro<2,>=1.7.0
31
+ Requires-Dist: sniffio
30
32
  Provides-Extra: aiohttp
31
33
  Requires-Dist: aiohttp<3.13.3; extra == "aiohttp"
32
34
  Provides-Extra: local-tokenizer
@@ -213,7 +215,7 @@ await aclient.aclose()
213
215
  ## Client context managers
214
216
 
215
217
  By using the sync client context manager, it will close the underlying
216
- sync client when exiting the with block.
218
+ sync client when exiting the with block and avoid httpx "client has been closed" error like [issues#1763](https://github.com/googleapis/python-genai/issues/1763).
217
219
 
218
220
  ```python
219
221
  from google.genai import Client