google-genai 1.46.0__tar.gz → 1.47.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.
Files changed (45) hide show
  1. {google_genai-1.46.0/google_genai.egg-info → google_genai-1.47.0}/PKG-INFO +151 -161
  2. {google_genai-1.46.0 → google_genai-1.47.0}/README.md +149 -159
  3. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_api_client.py +38 -15
  4. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_extra_utils.py +4 -0
  5. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_transformers.py +10 -1
  6. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/client.py +4 -1
  7. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/live.py +28 -18
  8. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/models.py +89 -71
  9. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/tunings.py +269 -94
  10. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/types.py +1386 -1003
  11. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/version.py +1 -1
  12. {google_genai-1.46.0 → google_genai-1.47.0/google_genai.egg-info}/PKG-INFO +151 -161
  13. {google_genai-1.46.0 → google_genai-1.47.0}/google_genai.egg-info/requires.txt +1 -1
  14. {google_genai-1.46.0 → google_genai-1.47.0}/pyproject.toml +2 -2
  15. {google_genai-1.46.0 → google_genai-1.47.0}/LICENSE +0 -0
  16. {google_genai-1.46.0 → google_genai-1.47.0}/MANIFEST.in +0 -0
  17. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/__init__.py +0 -0
  18. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_adapters.py +0 -0
  19. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_api_module.py +0 -0
  20. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_automatic_function_calling_util.py +0 -0
  21. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_base_transformers.py +0 -0
  22. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_base_url.py +0 -0
  23. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_common.py +0 -0
  24. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_live_converters.py +61 -61
  25. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_local_tokenizer_loader.py +0 -0
  26. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_mcp_utils.py +0 -0
  27. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_operations_converters.py +0 -0
  28. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_replay_api_client.py +0 -0
  29. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_test_api_client.py +0 -0
  30. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/_tokens_converters.py +47 -47
  31. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/batches.py +57 -57
  32. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/caches.py +58 -58
  33. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/chats.py +0 -0
  34. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/errors.py +0 -0
  35. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/files.py +0 -0
  36. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/live_music.py +0 -0
  37. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/local_tokenizer.py +0 -0
  38. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/operations.py +0 -0
  39. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/pagers.py +0 -0
  40. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/py.typed +0 -0
  41. {google_genai-1.46.0 → google_genai-1.47.0}/google/genai/tokens.py +0 -0
  42. {google_genai-1.46.0 → google_genai-1.47.0}/google_genai.egg-info/SOURCES.txt +0 -0
  43. {google_genai-1.46.0 → google_genai-1.47.0}/google_genai.egg-info/dependency_links.txt +0 -0
  44. {google_genai-1.46.0 → google_genai-1.47.0}/google_genai.egg-info/top_level.txt +0 -0
  45. {google_genai-1.46.0 → google_genai-1.47.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-genai
3
- Version: 1.46.0
3
+ Version: 1.47.0
4
4
  Summary: GenAI Python SDK
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License-Expression: Apache-2.0
@@ -23,7 +23,7 @@ License-File: LICENSE
23
23
  Requires-Dist: anyio<5.0.0,>=4.8.0
24
24
  Requires-Dist: google-auth<3.0.0,>=2.14.1
25
25
  Requires-Dist: httpx<1.0.0,>=0.28.1
26
- Requires-Dist: pydantic<3.0.0,>=2.0.0
26
+ Requires-Dist: pydantic<3.0.0,>=2.9.0
27
27
  Requires-Dist: requests<3.0.0,>=2.28.1
28
28
  Requires-Dist: tenacity<9.2.0,>=8.2.3
29
29
  Requires-Dist: websockets<15.1.0,>=13.0.0
@@ -128,7 +128,6 @@ Explicitly close the sync client to ensure that resources, such as the
128
128
  underlying HTTP connections, are properly cleaned up and closed.
129
129
 
130
130
  ```python
131
-
132
131
  from google.genai import Client
133
132
 
134
133
  client = Client()
@@ -147,7 +146,6 @@ client.close()
147
146
  To explicitly close the async client:
148
147
 
149
148
  ```python
150
-
151
149
  from google.genai import Client
152
150
 
153
151
  aclient = Client(
@@ -174,15 +172,14 @@ By using the sync client context manager, it will close the underlying
174
172
  from google.genai import Client
175
173
 
176
174
  with Client() as client:
177
- response_1 = client.models.generate_content(
178
- model=MODEL_ID,
179
- contents='Hello',
180
- )
181
- response_2 = client.models.generate_content(
182
- model=MODEL_ID,
183
- contents='Ask a question',
184
- )
185
-
175
+ response_1 = client.models.generate_content(
176
+ model=MODEL_ID,
177
+ contents='Hello',
178
+ )
179
+ response_2 = client.models.generate_content(
180
+ model=MODEL_ID,
181
+ contents='Ask a question',
182
+ )
186
183
  ```
187
184
 
188
185
  By using the async client context manager, it will close the underlying
@@ -192,15 +189,14 @@ By using the async client context manager, it will close the underlying
192
189
  from google.genai import Client
193
190
 
194
191
  async with Client().aio as aclient:
195
- response_1 = await aclient.models.generate_content(
196
- model=MODEL_ID,
197
- contents='Hello',
198
- )
199
- response_2 = await aclient.models.generate_content(
200
- model=MODEL_ID,
201
- contents='Ask a question',
202
- )
203
-
192
+ response_1 = await aclient.models.generate_content(
193
+ model=MODEL_ID,
194
+ contents='Hello',
195
+ )
196
+ response_2 = await aclient.models.generate_content(
197
+ model=MODEL_ID,
198
+ contents='Ask a question',
199
+ )
204
200
  ```
205
201
 
206
202
  ### API Selection
@@ -245,7 +241,6 @@ Additional args of `aiohttp.ClientSession.request()` ([see _RequestOptions args]
245
241
  through the following way:
246
242
 
247
243
  ```python
248
-
249
244
  http_options = types.HttpOptions(
250
245
  async_client_args={'cookies': ..., 'ssl': ...},
251
246
  )
@@ -259,7 +254,6 @@ Both httpx and aiohttp libraries use `urllib.request.getproxies` from
259
254
  environment variables. Before client initialization, you may set proxy (and
260
255
  optional SSL_CERT_FILE) by setting the environment variables:
261
256
 
262
-
263
257
  ```bash
264
258
  export HTTPS_PROXY='http://username:password@proxy_uri:port'
265
259
  export SSL_CERT_FILE='client.pem'
@@ -270,7 +264,6 @@ args to `httpx.Client()`. You may install `httpx[socks]` to use it.
270
264
  Then, you can pass it through the following way:
271
265
 
272
266
  ```python
273
-
274
267
  http_options = types.HttpOptions(
275
268
  client_args={'proxy': 'socks5://user:pass@host:port'},
276
269
  async_client_args={'proxy': 'socks5://user:pass@host:port'},
@@ -286,16 +279,14 @@ In some cases you might need a custom base url (for example, API gateway proxy
286
279
  You may pass the custom base url like this:
287
280
 
288
281
  ```python
289
-
290
282
  base_url = 'https://test-api-gateway-proxy.com'
291
283
  client = Client(
292
- vertexai=True,
293
- http_options={
294
- 'base_url': base_url,
295
- 'headers': {'Authorization': 'Bearer test_token'},
296
- },
284
+ vertexai=True, # Currently only vertexai=True is supported
285
+ http_options={
286
+ 'base_url': base_url,
287
+ 'headers': {'Authorization': 'Bearer test_token'},
288
+ },
297
289
  )
298
-
299
290
  ```
300
291
 
301
292
  ## Types
@@ -329,17 +320,17 @@ response = client.models.generate_content(
329
320
  model='gemini-2.5-flash-image',
330
321
  contents='A cartoon infographic for flying sneakers',
331
322
  config=types.GenerateContentConfig(
332
- response_modalities=["IMAGE"],
333
- image_config=types.ImageConfig(
334
- aspect_ratio="9:16",
335
- ),
323
+ response_modalities=["IMAGE"],
324
+ image_config=types.ImageConfig(
325
+ aspect_ratio="9:16",
326
+ ),
336
327
  ),
337
328
  )
338
329
 
339
330
  for part in response.parts:
340
- if part.inline_data:
341
- generated_image = part.as_image()
342
- generated_image.show()
331
+ if part.inline_data:
332
+ generated_image = part.as_image()
333
+ generated_image.show()
343
334
  ```
344
335
 
345
336
  #### with uploaded file (Gemini Developer API only)
@@ -374,8 +365,8 @@ This is the canonical way to provide contents, SDK will not do any conversion.
374
365
  from google.genai import types
375
366
 
376
367
  contents = types.Content(
377
- role='user',
378
- parts=[types.Part.from_text(text='Why is the sky blue?')]
368
+ role='user',
369
+ parts=[types.Part.from_text(text='Why is the sky blue?')]
379
370
  )
380
371
  ```
381
372
 
@@ -383,10 +374,10 @@ SDK converts this to
383
374
 
384
375
  ```python
385
376
  [
386
- types.Content(
387
- role='user',
388
- parts=[types.Part.from_text(text='Why is the sky blue?')]
389
- )
377
+ types.Content(
378
+ role='user',
379
+ parts=[types.Part.from_text(text='Why is the sky blue?')]
380
+ )
390
381
  ]
391
382
  ```
392
383
 
@@ -400,11 +391,11 @@ The SDK will assume this is a text part, and it converts this into the following
400
391
 
401
392
  ```python
402
393
  [
403
- types.UserContent(
404
- parts=[
405
- types.Part.from_text(text='Why is the sky blue?')
406
- ]
407
- )
394
+ types.UserContent(
395
+ parts=[
396
+ types.Part.from_text(text='Why is the sky blue?')
397
+ ]
398
+ )
408
399
  ]
409
400
  ```
410
401
 
@@ -422,12 +413,12 @@ like the following:
422
413
 
423
414
  ```python
424
415
  [
425
- types.UserContent(
426
- parts=[
427
- types.Part.from_text(text='Why is the sky blue?'),
428
- types.Part.from_text(text='Why is the cloud white?'),
429
- ]
430
- )
416
+ types.UserContent(
417
+ parts=[
418
+ types.Part.from_text(text='Why is the sky blue?'),
419
+ types.Part.from_text(text='Why is the cloud white?'),
420
+ ]
421
+ )
431
422
  ]
432
423
  ```
433
424
 
@@ -440,8 +431,8 @@ Where a `types.UserContent` is a subclass of `types.Content`, the
440
431
  from google.genai import types
441
432
 
442
433
  contents = types.Part.from_function_call(
443
- name='get_weather_by_location',
444
- args={'location': 'Boston'}
434
+ name='get_weather_by_location',
435
+ args={'location': 'Boston'}
445
436
  )
446
437
  ```
447
438
 
@@ -449,14 +440,14 @@ The SDK converts a function call part to a content with a `model` role:
449
440
 
450
441
  ```python
451
442
  [
452
- types.ModelContent(
453
- parts=[
454
- types.Part.from_function_call(
455
- name='get_weather_by_location',
456
- args={'location': 'Boston'}
457
- )
458
- ]
459
- )
443
+ types.ModelContent(
444
+ parts=[
445
+ types.Part.from_function_call(
446
+ name='get_weather_by_location',
447
+ args={'location': 'Boston'}
448
+ )
449
+ ]
450
+ )
460
451
  ]
461
452
  ```
462
453
 
@@ -469,14 +460,14 @@ Where a `types.ModelContent` is a subclass of `types.Content`, the
469
460
  from google.genai import types
470
461
 
471
462
  contents = [
472
- types.Part.from_function_call(
473
- name='get_weather_by_location',
474
- args={'location': 'Boston'}
475
- ),
476
- types.Part.from_function_call(
477
- name='get_weather_by_location',
478
- args={'location': 'New York'}
479
- ),
463
+ types.Part.from_function_call(
464
+ name='get_weather_by_location',
465
+ args={'location': 'Boston'}
466
+ ),
467
+ types.Part.from_function_call(
468
+ name='get_weather_by_location',
469
+ args={'location': 'New York'}
470
+ ),
480
471
  ]
481
472
  ```
482
473
 
@@ -484,18 +475,18 @@ The SDK converts a list of function call parts to the a content with a `model` r
484
475
 
485
476
  ```python
486
477
  [
487
- types.ModelContent(
488
- parts=[
489
- types.Part.from_function_call(
490
- name='get_weather_by_location',
491
- args={'location': 'Boston'}
492
- ),
493
- types.Part.from_function_call(
494
- name='get_weather_by_location',
495
- args={'location': 'New York'}
496
- )
497
- ]
498
- )
478
+ types.ModelContent(
479
+ parts=[
480
+ types.Part.from_function_call(
481
+ name='get_weather_by_location',
482
+ args={'location': 'Boston'}
483
+ ),
484
+ types.Part.from_function_call(
485
+ name='get_weather_by_location',
486
+ args={'location': 'New York'}
487
+ )
488
+ ]
489
+ )
499
490
  ]
500
491
  ```
501
492
 
@@ -508,8 +499,8 @@ Where a `types.ModelContent` is a subclass of `types.Content`, the
508
499
  from google.genai import types
509
500
 
510
501
  contents = types.Part.from_uri(
511
- file_uri: 'gs://generativeai-downloads/images/scones.jpg',
512
- mime_type: 'image/jpeg',
502
+ file_uri: 'gs://generativeai-downloads/images/scones.jpg',
503
+ mime_type: 'image/jpeg',
513
504
  )
514
505
  ```
515
506
 
@@ -517,12 +508,12 @@ The SDK converts all non function call parts into a content with a `user` role.
517
508
 
518
509
  ```python
519
510
  [
520
- types.UserContent(parts=[
521
- types.Part.from_uri(
522
- file_uri: 'gs://generativeai-downloads/images/scones.jpg',
523
- mime_type: 'image/jpeg',
524
- )
525
- ])
511
+ types.UserContent(parts=[
512
+ types.Part.from_uri(
513
+ file_uri: 'gs://generativeai-downloads/images/scones.jpg',
514
+ mime_type: 'image/jpeg',
515
+ )
516
+ ])
526
517
  ]
527
518
  ```
528
519
 
@@ -532,11 +523,11 @@ The SDK converts all non function call parts into a content with a `user` role.
532
523
  from google.genai import types
533
524
 
534
525
  contents = [
535
- types.Part.from_text('What is this image about?'),
536
- types.Part.from_uri(
537
- file_uri: 'gs://generativeai-downloads/images/scones.jpg',
538
- mime_type: 'image/jpeg',
539
- )
526
+ types.Part.from_text('What is this image about?'),
527
+ types.Part.from_uri(
528
+ file_uri: 'gs://generativeai-downloads/images/scones.jpg',
529
+ mime_type: 'image/jpeg',
530
+ )
540
531
  ]
541
532
  ```
542
533
 
@@ -544,15 +535,15 @@ The SDK will convert the list of parts into a content with a `user` role
544
535
 
545
536
  ```python
546
537
  [
547
- types.UserContent(
548
- parts=[
549
- types.Part.from_text('What is this image about?'),
550
- types.Part.from_uri(
551
- file_uri: 'gs://generativeai-downloads/images/scones.jpg',
552
- mime_type: 'image/jpeg',
553
- )
554
- ]
555
- )
538
+ types.UserContent(
539
+ parts=[
540
+ types.Part.from_text('What is this image about?'),
541
+ types.Part.from_uri(
542
+ file_uri: 'gs://generativeai-downloads/images/scones.jpg',
543
+ mime_type: 'image/jpeg',
544
+ )
545
+ ]
546
+ )
556
547
  ]
557
548
  ```
558
549
 
@@ -686,7 +677,7 @@ def get_current_weather(location: str) -> str:
686
677
  """Returns the current weather.
687
678
 
688
679
  Args:
689
- location: The city and state, e.g. San Francisco, CA
680
+ location: The city and state, e.g. San Francisco, CA
690
681
  """
691
682
  return 'sunny'
692
683
 
@@ -708,14 +699,14 @@ as follows:
708
699
  from google.genai import types
709
700
 
710
701
  response = client.models.generate_content(
711
- model='gemini-2.5-flash',
712
- contents='What is the weather like in Boston?',
713
- config=types.GenerateContentConfig(
714
- tools=[get_current_weather],
715
- automatic_function_calling=types.AutomaticFunctionCallingConfig(
716
- disable=True
702
+ model='gemini-2.5-flash',
703
+ contents='What is the weather like in Boston?',
704
+ config=types.GenerateContentConfig(
705
+ tools=[get_current_weather],
706
+ automatic_function_calling=types.AutomaticFunctionCallingConfig(
707
+ disable=True
708
+ ),
717
709
  ),
718
- ),
719
710
  )
720
711
  ```
721
712
 
@@ -829,7 +820,7 @@ def get_current_weather(location: str) -> str:
829
820
  """Returns the current weather.
830
821
 
831
822
  Args:
832
- location: The city and state, e.g. San Francisco, CA
823
+ location: The city and state, e.g. San Francisco, CA
833
824
  """
834
825
  return "sunny"
835
826
 
@@ -859,7 +850,7 @@ def get_current_weather(location: str) -> str:
859
850
  """Returns the current weather.
860
851
 
861
852
  Args:
862
- location: The city and state, e.g. San Francisco, CA
853
+ location: The city and state, e.g. San Francisco, CA
863
854
  """
864
855
  return "sunny"
865
856
 
@@ -1039,20 +1030,20 @@ values as the response.
1039
1030
  from enum import Enum
1040
1031
 
1041
1032
  class InstrumentEnum(Enum):
1042
- PERCUSSION = 'Percussion'
1043
- STRING = 'String'
1044
- WOODWIND = 'Woodwind'
1045
- BRASS = 'Brass'
1046
- KEYBOARD = 'Keyboard'
1033
+ PERCUSSION = 'Percussion'
1034
+ STRING = 'String'
1035
+ WOODWIND = 'Woodwind'
1036
+ BRASS = 'Brass'
1037
+ KEYBOARD = 'Keyboard'
1047
1038
 
1048
1039
  response = client.models.generate_content(
1049
- model='gemini-2.5-flash',
1050
- contents='What instrument plays multiple notes at once?',
1051
- config={
1052
- 'response_mime_type': 'text/x.enum',
1053
- 'response_schema': InstrumentEnum,
1054
- },
1055
- )
1040
+ model='gemini-2.5-flash',
1041
+ contents='What instrument plays multiple notes at once?',
1042
+ config={
1043
+ 'response_mime_type': 'text/x.enum',
1044
+ 'response_schema': InstrumentEnum,
1045
+ },
1046
+ )
1056
1047
  print(response.text)
1057
1048
  ```
1058
1049
 
@@ -1065,20 +1056,20 @@ identical but in quotes.
1065
1056
  from enum import Enum
1066
1057
 
1067
1058
  class InstrumentEnum(Enum):
1068
- PERCUSSION = 'Percussion'
1069
- STRING = 'String'
1070
- WOODWIND = 'Woodwind'
1071
- BRASS = 'Brass'
1072
- KEYBOARD = 'Keyboard'
1059
+ PERCUSSION = 'Percussion'
1060
+ STRING = 'String'
1061
+ WOODWIND = 'Woodwind'
1062
+ BRASS = 'Brass'
1063
+ KEYBOARD = 'Keyboard'
1073
1064
 
1074
1065
  response = client.models.generate_content(
1075
- model='gemini-2.5-flash',
1076
- contents='What instrument plays multiple notes at once?',
1077
- config={
1078
- 'response_mime_type': 'application/json',
1079
- 'response_schema': InstrumentEnum,
1080
- },
1081
- )
1066
+ model='gemini-2.5-flash',
1067
+ contents='What instrument plays multiple notes at once?',
1068
+ config={
1069
+ 'response_mime_type': 'application/json',
1070
+ 'response_schema': InstrumentEnum,
1071
+ },
1072
+ )
1082
1073
  print(response.text)
1083
1074
  ```
1084
1075
 
@@ -1156,7 +1147,6 @@ print(response.text)
1156
1147
 
1157
1148
  ### Generate Content (Asynchronous Streaming)
1158
1149
 
1159
-
1160
1150
  ```python
1161
1151
  async for chunk in await client.aio.models.generate_content_stream(
1162
1152
  model='gemini-2.5-flash', contents='Tell me a story in 300 words.'
@@ -1214,7 +1204,7 @@ result = tokenizer.compute_tokens("What is your name?")
1214
1204
 
1215
1205
  ```python
1216
1206
  response = client.models.embed_content(
1217
- model='text-embedding-004',
1207
+ model='gemini-embedding-001',
1218
1208
  contents='why is the sky blue?',
1219
1209
  )
1220
1210
  print(response)
@@ -1225,7 +1215,7 @@ from google.genai import types
1225
1215
 
1226
1216
  # multiple contents with config
1227
1217
  response = client.models.embed_content(
1228
- model='text-embedding-004',
1218
+ model='gemini-embedding-001',
1229
1219
  contents=['why is the sky blue?', 'What is your age?'],
1230
1220
  config=types.EmbedContentConfig(output_dimensionality=10),
1231
1221
  )
@@ -1455,7 +1445,7 @@ async for chunk in await chat.send_message_stream('tell me a story'):
1455
1445
  Files are only supported in Gemini Developer API. See the 'Create a client'
1456
1446
  section above to initialize a client.
1457
1447
 
1458
- ```cmd
1448
+ ```sh
1459
1449
  !gsutil cp gs://cloud-samples-data/generative-ai/pdf/2312.11805v3.pdf .
1460
1450
  !gsutil cp gs://cloud-samples-data/generative-ai/pdf/2403.05530.pdf .
1461
1451
  ```
@@ -1556,14 +1546,14 @@ section above to initialize a client.
1556
1546
 
1557
1547
  ### Tune
1558
1548
 
1559
- - Vertex AI supports tuning from GCS source or from a Vertex Multimodal Dataset
1549
+ - Vertex AI supports tuning from GCS source or from a [Vertex AI Multimodal Dataset](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/datasets)
1560
1550
 
1561
1551
  ```python
1562
1552
  from google.genai import types
1563
1553
 
1564
1554
  model = 'gemini-2.5-flash'
1565
1555
  training_dataset = types.TuningDataset(
1566
- # or gcs_uri=my_vertex_multimodal_dataset
1556
+ # or gcs_uri=my_vertex_multimodal_dataset
1567
1557
  gcs_uri='gs://cloud-samples-data/ai-platform/generative_ai/gemini-1_5/text/sft_train_data.jsonl',
1568
1558
  )
1569
1559
  ```
@@ -1719,7 +1709,7 @@ job = client.batches.create(
1719
1709
  src='bq://my-project.my-dataset.my-table', # or "gs://path/to/input/data"
1720
1710
  )
1721
1711
 
1722
- job
1712
+ print(job)
1723
1713
  ```
1724
1714
 
1725
1715
  Gemini Developer API:
@@ -1729,13 +1719,13 @@ Gemini Developer API:
1729
1719
  batch_job = client.batches.create(
1730
1720
  model="gemini-2.5-flash",
1731
1721
  src=[{
1732
- "contents": [{
1733
- "parts": [{
1734
- "text": "Hello!",
1722
+ "contents": [{
1723
+ "parts": [{
1724
+ "text": "Hello!",
1725
+ }],
1726
+ "role": "user",
1735
1727
  }],
1736
- "role": "user",
1737
- }],
1738
- "config": {"response_modalities": ["text"]},
1728
+ "config": {"response_modalities": ["text"]},
1739
1729
  }],
1740
1730
  )
1741
1731
 
@@ -1843,13 +1833,13 @@ To handle errors raised by the model service, the SDK provides this [APIError](h
1843
1833
  from google.genai import errors
1844
1834
 
1845
1835
  try:
1846
- client.models.generate_content(
1847
- model="invalid-model-name",
1848
- contents="What is your name?",
1849
- )
1836
+ client.models.generate_content(
1837
+ model="invalid-model-name",
1838
+ contents="What is your name?",
1839
+ )
1850
1840
  except errors.APIError as e:
1851
- print(e.code) # 404
1852
- print(e.message)
1841
+ print(e.code) # 404
1842
+ print(e.message)
1853
1843
  ```
1854
1844
 
1855
1845
  ## Extra Request Body