google-genai 1.24.0__py3-none-any.whl → 1.26.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/genai/_api_client.py +11 -1
- google/genai/_common.py +6 -4
- google/genai/_extra_utils.py +1 -1
- google/genai/_live_converters.py +1624 -1922
- google/genai/_replay_api_client.py +15 -8
- google/genai/_tokens_converters.py +11 -874
- google/genai/_transformers.py +33 -17
- google/genai/batches.py +388 -3477
- google/genai/caches.py +0 -65
- google/genai/errors.py +2 -2
- google/genai/files.py +4 -0
- google/genai/live.py +22 -15
- google/genai/models.py +10 -170
- google/genai/operations.py +36 -266
- google/genai/tokens.py +8 -4
- google/genai/tunings.py +7 -46
- google/genai/types.py +126 -46
- google/genai/version.py +1 -1
- {google_genai-1.24.0.dist-info → google_genai-1.26.0.dist-info}/METADATA +70 -12
- google_genai-1.26.0.dist-info/RECORD +35 -0
- google_genai-1.24.0.dist-info/RECORD +0 -35
- {google_genai-1.24.0.dist-info → google_genai-1.26.0.dist-info}/WHEEL +0 -0
- {google_genai-1.24.0.dist-info → google_genai-1.26.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.24.0.dist-info → google_genai-1.26.0.dist-info}/top_level.txt +0 -0
google/genai/caches.py
CHANGED
@@ -269,71 +269,6 @@ def _GoogleSearchRetrieval_to_mldev(
|
|
269
269
|
return to_object
|
270
270
|
|
271
271
|
|
272
|
-
def _EnterpriseWebSearch_to_mldev(
|
273
|
-
from_object: Union[dict[str, Any], object],
|
274
|
-
parent_object: Optional[dict[str, Any]] = None,
|
275
|
-
) -> dict[str, Any]:
|
276
|
-
to_object: dict[str, Any] = {}
|
277
|
-
|
278
|
-
return to_object
|
279
|
-
|
280
|
-
|
281
|
-
def _ApiKeyConfig_to_mldev(
|
282
|
-
from_object: Union[dict[str, Any], object],
|
283
|
-
parent_object: Optional[dict[str, Any]] = None,
|
284
|
-
) -> dict[str, Any]:
|
285
|
-
to_object: dict[str, Any] = {}
|
286
|
-
if getv(from_object, ['api_key_string']) is not None:
|
287
|
-
raise ValueError('api_key_string parameter is not supported in Gemini API.')
|
288
|
-
|
289
|
-
return to_object
|
290
|
-
|
291
|
-
|
292
|
-
def _AuthConfig_to_mldev(
|
293
|
-
from_object: Union[dict[str, Any], object],
|
294
|
-
parent_object: Optional[dict[str, Any]] = None,
|
295
|
-
) -> dict[str, Any]:
|
296
|
-
to_object: dict[str, Any] = {}
|
297
|
-
if getv(from_object, ['api_key_config']) is not None:
|
298
|
-
raise ValueError('api_key_config parameter is not supported in Gemini API.')
|
299
|
-
|
300
|
-
if getv(from_object, ['auth_type']) is not None:
|
301
|
-
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
302
|
-
|
303
|
-
if getv(from_object, ['google_service_account_config']) is not None:
|
304
|
-
setv(
|
305
|
-
to_object,
|
306
|
-
['googleServiceAccountConfig'],
|
307
|
-
getv(from_object, ['google_service_account_config']),
|
308
|
-
)
|
309
|
-
|
310
|
-
if getv(from_object, ['http_basic_auth_config']) is not None:
|
311
|
-
setv(
|
312
|
-
to_object,
|
313
|
-
['httpBasicAuthConfig'],
|
314
|
-
getv(from_object, ['http_basic_auth_config']),
|
315
|
-
)
|
316
|
-
|
317
|
-
if getv(from_object, ['oauth_config']) is not None:
|
318
|
-
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
319
|
-
|
320
|
-
if getv(from_object, ['oidc_config']) is not None:
|
321
|
-
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
322
|
-
|
323
|
-
return to_object
|
324
|
-
|
325
|
-
|
326
|
-
def _GoogleMaps_to_mldev(
|
327
|
-
from_object: Union[dict[str, Any], object],
|
328
|
-
parent_object: Optional[dict[str, Any]] = None,
|
329
|
-
) -> dict[str, Any]:
|
330
|
-
to_object: dict[str, Any] = {}
|
331
|
-
if getv(from_object, ['auth_config']) is not None:
|
332
|
-
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
333
|
-
|
334
|
-
return to_object
|
335
|
-
|
336
|
-
|
337
272
|
def _UrlContext_to_mldev(
|
338
273
|
from_object: Union[dict[str, Any], object],
|
339
274
|
parent_object: Optional[dict[str, Any]] = None,
|
google/genai/errors.py
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
from typing import Any, Optional, TYPE_CHECKING, Union
|
19
19
|
import httpx
|
20
20
|
import json
|
21
|
+
from . import _common
|
21
22
|
|
22
23
|
|
23
24
|
if TYPE_CHECKING:
|
@@ -185,5 +186,4 @@ class FunctionInvocationError(ValueError):
|
|
185
186
|
pass
|
186
187
|
|
187
188
|
|
188
|
-
|
189
|
-
"""Warning for experimental features."""
|
189
|
+
ExperimentalWarning = _common.ExperimentalWarning
|
google/genai/files.py
CHANGED
@@ -288,6 +288,10 @@ def _CreateFileResponse_from_mldev(
|
|
288
288
|
parent_object: Optional[dict[str, Any]] = None,
|
289
289
|
) -> dict[str, Any]:
|
290
290
|
to_object: dict[str, Any] = {}
|
291
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
292
|
+
setv(
|
293
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
294
|
+
)
|
291
295
|
|
292
296
|
return to_object
|
293
297
|
|
google/genai/live.py
CHANGED
@@ -196,7 +196,7 @@ class AsyncSession:
|
|
196
196
|
if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
|
197
197
|
MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
|
198
198
|
else:
|
199
|
-
MODEL_NAME = 'gemini-2.
|
199
|
+
MODEL_NAME = 'gemini-live-2.5-flash-preview';
|
200
200
|
|
201
201
|
client = genai.Client()
|
202
202
|
async with client.aio.live.connect(
|
@@ -267,7 +267,7 @@ class AsyncSession:
|
|
267
267
|
if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
|
268
268
|
MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
|
269
269
|
else:
|
270
|
-
MODEL_NAME = 'gemini-2.
|
270
|
+
MODEL_NAME = 'gemini-live-2.5-flash-preview';
|
271
271
|
|
272
272
|
|
273
273
|
client = genai.Client()
|
@@ -361,7 +361,7 @@ class AsyncSession:
|
|
361
361
|
if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
|
362
362
|
MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
|
363
363
|
else:
|
364
|
-
MODEL_NAME = 'gemini-2.
|
364
|
+
MODEL_NAME = 'gemini-live-2.5-flash-preview';
|
365
365
|
|
366
366
|
client = genai.Client()
|
367
367
|
|
@@ -372,7 +372,7 @@ class AsyncSession:
|
|
372
372
|
}
|
373
373
|
|
374
374
|
async with client.aio.live.connect(
|
375
|
-
model='models/gemini-2.
|
375
|
+
model='models/gemini-live-2.5-flash-preview',
|
376
376
|
config=config
|
377
377
|
) as session:
|
378
378
|
prompt = "Turn on the lights please"
|
@@ -929,7 +929,8 @@ class AsyncLive(_api_module.BaseModule):
|
|
929
929
|
version = self._api_client._http_options.api_version
|
930
930
|
api_key = self._api_client.api_key
|
931
931
|
method = 'BidiGenerateContent'
|
932
|
-
|
932
|
+
original_headers = self._api_client._http_options.headers
|
933
|
+
headers = original_headers.copy() if original_headers is not None else {}
|
933
934
|
if api_key.startswith('auth_tokens/'):
|
934
935
|
warnings.warn(
|
935
936
|
message=(
|
@@ -939,10 +940,18 @@ class AsyncLive(_api_module.BaseModule):
|
|
939
940
|
category=errors.ExperimentalWarning,
|
940
941
|
)
|
941
942
|
method = 'BidiGenerateContentConstrained'
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
943
|
+
headers['Authorization'] = f'Token {api_key}'
|
944
|
+
if version != 'v1alpha':
|
945
|
+
warnings.warn(
|
946
|
+
message=(
|
947
|
+
"The SDK's ephemeral token support is in v1alpha only."
|
948
|
+
'Please use client = genai.Client(api_key=token.name, '
|
949
|
+
'http_options=types.HttpOptions(api_version="v1alpha"))'
|
950
|
+
' before session connection.'
|
951
|
+
),
|
952
|
+
category=errors.ExperimentalWarning,
|
953
|
+
)
|
954
|
+
uri = f'{base_url}/ws/google.ai.generativelanguage.{version}.GenerativeService.{method}'
|
946
955
|
|
947
956
|
request_dict = _common.convert_to_dict(
|
948
957
|
live_converters._LiveConnectParameters_to_mldev(
|
@@ -963,7 +972,7 @@ class AsyncLive(_api_module.BaseModule):
|
|
963
972
|
api_key = self._api_client.api_key
|
964
973
|
version = self._api_client._http_options.api_version
|
965
974
|
uri = f'{base_url}/ws/google.cloud.aiplatform.{version}.LlmBidiService/BidiGenerateContent'
|
966
|
-
headers = self._api_client._http_options.headers
|
975
|
+
headers = self._api_client._http_options.headers or {}
|
967
976
|
|
968
977
|
request_dict = _common.convert_to_dict(
|
969
978
|
live_converters._LiveConnectParameters_to_vertex(
|
@@ -993,11 +1002,9 @@ class AsyncLive(_api_module.BaseModule):
|
|
993
1002
|
auth_req = google.auth.transport.requests.Request() # type: ignore
|
994
1003
|
creds.refresh(auth_req)
|
995
1004
|
bearer_token = creds.token
|
996
|
-
|
997
|
-
if
|
998
|
-
|
999
|
-
'Authorization': 'Bearer {}'.format(bearer_token),
|
1000
|
-
})
|
1005
|
+
original_headers = self._api_client._http_options.headers
|
1006
|
+
headers = original_headers.copy() if original_headers is not None else {}
|
1007
|
+
headers['Authorization'] = f'Bearer {bearer_token}'
|
1001
1008
|
version = self._api_client._http_options.api_version
|
1002
1009
|
uri = f'{base_url}/ws/google.cloud.aiplatform.{version}.LlmBidiService/BidiGenerateContent'
|
1003
1010
|
location = self._api_client.location
|
google/genai/models.py
CHANGED
@@ -260,19 +260,6 @@ def _Schema_to_mldev(
|
|
260
260
|
return to_object
|
261
261
|
|
262
262
|
|
263
|
-
def _ModelSelectionConfig_to_mldev(
|
264
|
-
from_object: Union[dict[str, Any], object],
|
265
|
-
parent_object: Optional[dict[str, Any]] = None,
|
266
|
-
) -> dict[str, Any]:
|
267
|
-
to_object: dict[str, Any] = {}
|
268
|
-
if getv(from_object, ['feature_selection_preference']) is not None:
|
269
|
-
raise ValueError(
|
270
|
-
'feature_selection_preference parameter is not supported in Gemini API.'
|
271
|
-
)
|
272
|
-
|
273
|
-
return to_object
|
274
|
-
|
275
|
-
|
276
263
|
def _SafetySetting_to_mldev(
|
277
264
|
from_object: Union[dict[str, Any], object],
|
278
265
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -391,71 +378,6 @@ def _GoogleSearchRetrieval_to_mldev(
|
|
391
378
|
return to_object
|
392
379
|
|
393
380
|
|
394
|
-
def _EnterpriseWebSearch_to_mldev(
|
395
|
-
from_object: Union[dict[str, Any], object],
|
396
|
-
parent_object: Optional[dict[str, Any]] = None,
|
397
|
-
) -> dict[str, Any]:
|
398
|
-
to_object: dict[str, Any] = {}
|
399
|
-
|
400
|
-
return to_object
|
401
|
-
|
402
|
-
|
403
|
-
def _ApiKeyConfig_to_mldev(
|
404
|
-
from_object: Union[dict[str, Any], object],
|
405
|
-
parent_object: Optional[dict[str, Any]] = None,
|
406
|
-
) -> dict[str, Any]:
|
407
|
-
to_object: dict[str, Any] = {}
|
408
|
-
if getv(from_object, ['api_key_string']) is not None:
|
409
|
-
raise ValueError('api_key_string parameter is not supported in Gemini API.')
|
410
|
-
|
411
|
-
return to_object
|
412
|
-
|
413
|
-
|
414
|
-
def _AuthConfig_to_mldev(
|
415
|
-
from_object: Union[dict[str, Any], object],
|
416
|
-
parent_object: Optional[dict[str, Any]] = None,
|
417
|
-
) -> dict[str, Any]:
|
418
|
-
to_object: dict[str, Any] = {}
|
419
|
-
if getv(from_object, ['api_key_config']) is not None:
|
420
|
-
raise ValueError('api_key_config parameter is not supported in Gemini API.')
|
421
|
-
|
422
|
-
if getv(from_object, ['auth_type']) is not None:
|
423
|
-
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
424
|
-
|
425
|
-
if getv(from_object, ['google_service_account_config']) is not None:
|
426
|
-
setv(
|
427
|
-
to_object,
|
428
|
-
['googleServiceAccountConfig'],
|
429
|
-
getv(from_object, ['google_service_account_config']),
|
430
|
-
)
|
431
|
-
|
432
|
-
if getv(from_object, ['http_basic_auth_config']) is not None:
|
433
|
-
setv(
|
434
|
-
to_object,
|
435
|
-
['httpBasicAuthConfig'],
|
436
|
-
getv(from_object, ['http_basic_auth_config']),
|
437
|
-
)
|
438
|
-
|
439
|
-
if getv(from_object, ['oauth_config']) is not None:
|
440
|
-
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
441
|
-
|
442
|
-
if getv(from_object, ['oidc_config']) is not None:
|
443
|
-
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
444
|
-
|
445
|
-
return to_object
|
446
|
-
|
447
|
-
|
448
|
-
def _GoogleMaps_to_mldev(
|
449
|
-
from_object: Union[dict[str, Any], object],
|
450
|
-
parent_object: Optional[dict[str, Any]] = None,
|
451
|
-
) -> dict[str, Any]:
|
452
|
-
to_object: dict[str, Any] = {}
|
453
|
-
if getv(from_object, ['auth_config']) is not None:
|
454
|
-
raise ValueError('auth_config parameter is not supported in Gemini API.')
|
455
|
-
|
456
|
-
return to_object
|
457
|
-
|
458
|
-
|
459
381
|
def _UrlContext_to_mldev(
|
460
382
|
from_object: Union[dict[str, Any], object],
|
461
383
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -1317,27 +1239,6 @@ def _Image_to_mldev(
|
|
1317
1239
|
return to_object
|
1318
1240
|
|
1319
1241
|
|
1320
|
-
def _Video_to_mldev(
|
1321
|
-
from_object: Union[dict[str, Any], object],
|
1322
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1323
|
-
) -> dict[str, Any]:
|
1324
|
-
to_object: dict[str, Any] = {}
|
1325
|
-
if getv(from_object, ['uri']) is not None:
|
1326
|
-
setv(to_object, ['video', 'uri'], getv(from_object, ['uri']))
|
1327
|
-
|
1328
|
-
if getv(from_object, ['video_bytes']) is not None:
|
1329
|
-
setv(
|
1330
|
-
to_object,
|
1331
|
-
['video', 'encodedVideo'],
|
1332
|
-
t.t_bytes(getv(from_object, ['video_bytes'])),
|
1333
|
-
)
|
1334
|
-
|
1335
|
-
if getv(from_object, ['mime_type']) is not None:
|
1336
|
-
setv(to_object, ['encoding'], getv(from_object, ['mime_type']))
|
1337
|
-
|
1338
|
-
return to_object
|
1339
|
-
|
1340
|
-
|
1341
1242
|
def _GenerateVideosConfig_to_mldev(
|
1342
1243
|
from_object: Union[dict[str, Any], object],
|
1343
1244
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -2071,33 +1972,6 @@ def _VoiceConfig_to_vertex(
|
|
2071
1972
|
return to_object
|
2072
1973
|
|
2073
1974
|
|
2074
|
-
def _SpeakerVoiceConfig_to_vertex(
|
2075
|
-
from_object: Union[dict[str, Any], object],
|
2076
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2077
|
-
) -> dict[str, Any]:
|
2078
|
-
to_object: dict[str, Any] = {}
|
2079
|
-
if getv(from_object, ['speaker']) is not None:
|
2080
|
-
raise ValueError('speaker parameter is not supported in Vertex AI.')
|
2081
|
-
|
2082
|
-
if getv(from_object, ['voice_config']) is not None:
|
2083
|
-
raise ValueError('voice_config parameter is not supported in Vertex AI.')
|
2084
|
-
|
2085
|
-
return to_object
|
2086
|
-
|
2087
|
-
|
2088
|
-
def _MultiSpeakerVoiceConfig_to_vertex(
|
2089
|
-
from_object: Union[dict[str, Any], object],
|
2090
|
-
parent_object: Optional[dict[str, Any]] = None,
|
2091
|
-
) -> dict[str, Any]:
|
2092
|
-
to_object: dict[str, Any] = {}
|
2093
|
-
if getv(from_object, ['speaker_voice_configs']) is not None:
|
2094
|
-
raise ValueError(
|
2095
|
-
'speaker_voice_configs parameter is not supported in Vertex AI.'
|
2096
|
-
)
|
2097
|
-
|
2098
|
-
return to_object
|
2099
|
-
|
2100
|
-
|
2101
1975
|
def _SpeechConfig_to_vertex(
|
2102
1976
|
from_object: Union[dict[str, Any], object],
|
2103
1977
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -2793,6 +2667,13 @@ def _EditImageConfig_to_vertex(
|
|
2793
2667
|
getv(from_object, ['output_compression_quality']),
|
2794
2668
|
)
|
2795
2669
|
|
2670
|
+
if getv(from_object, ['add_watermark']) is not None:
|
2671
|
+
setv(
|
2672
|
+
parent_object,
|
2673
|
+
['parameters', 'addWatermark'],
|
2674
|
+
getv(from_object, ['add_watermark']),
|
2675
|
+
)
|
2676
|
+
|
2796
2677
|
if getv(from_object, ['edit_mode']) is not None:
|
2797
2678
|
setv(
|
2798
2679
|
parent_object,
|
@@ -3331,18 +3212,6 @@ def _GenerateVideosParameters_to_vertex(
|
|
3331
3212
|
return to_object
|
3332
3213
|
|
3333
3214
|
|
3334
|
-
def _FeatureSelectionPreference_to_mldev_enum_validate(enum_value: Any) -> None:
|
3335
|
-
if enum_value in set(
|
3336
|
-
[
|
3337
|
-
'FEATURE_SELECTION_PREFERENCE_UNSPECIFIED',
|
3338
|
-
'PRIORITIZE_QUALITY',
|
3339
|
-
'BALANCED',
|
3340
|
-
'PRIORITIZE_COST',
|
3341
|
-
]
|
3342
|
-
):
|
3343
|
-
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
3344
|
-
|
3345
|
-
|
3346
3215
|
def _SafetyFilterLevel_to_mldev_enum_validate(enum_value: Any) -> None:
|
3347
3216
|
if enum_value in set(['BLOCK_NONE']):
|
3348
3217
|
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
@@ -3600,7 +3469,6 @@ def _GenerateContentResponse_from_mldev(
|
|
3600
3469
|
parent_object: Optional[dict[str, Any]] = None,
|
3601
3470
|
) -> dict[str, Any]:
|
3602
3471
|
to_object: dict[str, Any] = {}
|
3603
|
-
|
3604
3472
|
if getv(from_object, ['sdkHttpResponse']) is not None:
|
3605
3473
|
setv(
|
3606
3474
|
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
@@ -3628,15 +3496,6 @@ def _GenerateContentResponse_from_mldev(
|
|
3628
3496
|
return to_object
|
3629
3497
|
|
3630
3498
|
|
3631
|
-
def _ContentEmbeddingStatistics_from_mldev(
|
3632
|
-
from_object: Union[dict[str, Any], object],
|
3633
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3634
|
-
) -> dict[str, Any]:
|
3635
|
-
to_object: dict[str, Any] = {}
|
3636
|
-
|
3637
|
-
return to_object
|
3638
|
-
|
3639
|
-
|
3640
3499
|
def _ContentEmbedding_from_mldev(
|
3641
3500
|
from_object: Union[dict[str, Any], object],
|
3642
3501
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -3782,15 +3641,6 @@ def _GenerateImagesResponse_from_mldev(
|
|
3782
3641
|
return to_object
|
3783
3642
|
|
3784
3643
|
|
3785
|
-
def _Endpoint_from_mldev(
|
3786
|
-
from_object: Union[dict[str, Any], object],
|
3787
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3788
|
-
) -> dict[str, Any]:
|
3789
|
-
to_object: dict[str, Any] = {}
|
3790
|
-
|
3791
|
-
return to_object
|
3792
|
-
|
3793
|
-
|
3794
3644
|
def _TunedModelInfo_from_mldev(
|
3795
3645
|
from_object: Union[dict[str, Any], object],
|
3796
3646
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -3808,15 +3658,6 @@ def _TunedModelInfo_from_mldev(
|
|
3808
3658
|
return to_object
|
3809
3659
|
|
3810
3660
|
|
3811
|
-
def _Checkpoint_from_mldev(
|
3812
|
-
from_object: Union[dict[str, Any], object],
|
3813
|
-
parent_object: Optional[dict[str, Any]] = None,
|
3814
|
-
) -> dict[str, Any]:
|
3815
|
-
to_object: dict[str, Any] = {}
|
3816
|
-
|
3817
|
-
return to_object
|
3818
|
-
|
3819
|
-
|
3820
3661
|
def _Model_from_mldev(
|
3821
3662
|
from_object: Union[dict[str, Any], object],
|
3822
3663
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -4263,7 +4104,6 @@ def _GenerateContentResponse_from_vertex(
|
|
4263
4104
|
parent_object: Optional[dict[str, Any]] = None,
|
4264
4105
|
) -> dict[str, Any]:
|
4265
4106
|
to_object: dict[str, Any] = {}
|
4266
|
-
|
4267
4107
|
if getv(from_object, ['sdkHttpResponse']) is not None:
|
4268
4108
|
setv(
|
4269
4109
|
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
@@ -5861,9 +5701,9 @@ class Models(_api_module.BaseModule):
|
|
5861
5701
|
response = client.models.generate_content(
|
5862
5702
|
model='gemini-2.0-flash',
|
5863
5703
|
contents=[
|
5864
|
-
types.Part.from_text('What is shown in this image?'),
|
5865
|
-
types.Part.from_uri('gs://generativeai-downloads/images/scones.jpg',
|
5866
|
-
'image/jpeg')
|
5704
|
+
types.Part.from_text(text='What is shown in this image?'),
|
5705
|
+
types.Part.from_uri(file_uri='gs://generativeai-downloads/images/scones.jpg',
|
5706
|
+
mime_type='image/jpeg')
|
5867
5707
|
]
|
5868
5708
|
)
|
5869
5709
|
print(response.text)
|