google-genai 1.10.0__py3-none-any.whl → 1.11.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 +75 -7
- google/genai/_extra_utils.py +69 -9
- google/genai/_transformers.py +129 -0
- google/genai/live.py +72 -1015
- google/genai/live_converters.py +1298 -0
- google/genai/models.py +74 -6
- google/genai/types.py +509 -21
- google/genai/version.py +1 -1
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/METADATA +1 -1
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/RECORD +13 -12
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/WHEEL +0 -0
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/top_level.txt +0 -0
google/genai/models.py
CHANGED
@@ -176,6 +176,20 @@ def _Schema_to_mldev(
|
|
176
176
|
return to_object
|
177
177
|
|
178
178
|
|
179
|
+
def _ModelSelectionConfig_to_mldev(
|
180
|
+
api_client: BaseApiClient,
|
181
|
+
from_object: Union[dict, object],
|
182
|
+
parent_object: Optional[dict] = None,
|
183
|
+
) -> dict:
|
184
|
+
to_object: dict[str, Any] = {}
|
185
|
+
if getv(from_object, ['feature_selection_preference']) is not None:
|
186
|
+
raise ValueError(
|
187
|
+
'feature_selection_preference parameter is not supported in Gemini API.'
|
188
|
+
)
|
189
|
+
|
190
|
+
return to_object
|
191
|
+
|
192
|
+
|
179
193
|
def _SafetySetting_to_mldev(
|
180
194
|
api_client: BaseApiClient,
|
181
195
|
from_object: Union[dict, object],
|
@@ -393,6 +407,9 @@ def _SpeechConfig_to_mldev(
|
|
393
407
|
),
|
394
408
|
)
|
395
409
|
|
410
|
+
if getv(from_object, ['language_code']) is not None:
|
411
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
412
|
+
|
396
413
|
return to_object
|
397
414
|
|
398
415
|
|
@@ -497,6 +514,11 @@ def _GenerateContentConfig_to_mldev(
|
|
497
514
|
if getv(from_object, ['routing_config']) is not None:
|
498
515
|
raise ValueError('routing_config parameter is not supported in Gemini API.')
|
499
516
|
|
517
|
+
if getv(from_object, ['model_selection_config']) is not None:
|
518
|
+
raise ValueError(
|
519
|
+
'model_selection_config parameter is not supported in Gemini API.'
|
520
|
+
)
|
521
|
+
|
500
522
|
if getv(from_object, ['safety_settings']) is not None:
|
501
523
|
setv(
|
502
524
|
parent_object,
|
@@ -1270,6 +1292,22 @@ def _Schema_to_vertex(
|
|
1270
1292
|
return to_object
|
1271
1293
|
|
1272
1294
|
|
1295
|
+
def _ModelSelectionConfig_to_vertex(
|
1296
|
+
api_client: BaseApiClient,
|
1297
|
+
from_object: Union[dict, object],
|
1298
|
+
parent_object: Optional[dict] = None,
|
1299
|
+
) -> dict:
|
1300
|
+
to_object: dict[str, Any] = {}
|
1301
|
+
if getv(from_object, ['feature_selection_preference']) is not None:
|
1302
|
+
setv(
|
1303
|
+
to_object,
|
1304
|
+
['featureSelectionPreference'],
|
1305
|
+
getv(from_object, ['feature_selection_preference']),
|
1306
|
+
)
|
1307
|
+
|
1308
|
+
return to_object
|
1309
|
+
|
1310
|
+
|
1273
1311
|
def _SafetySetting_to_vertex(
|
1274
1312
|
api_client: BaseApiClient,
|
1275
1313
|
from_object: Union[dict, object],
|
@@ -1493,6 +1531,9 @@ def _SpeechConfig_to_vertex(
|
|
1493
1531
|
),
|
1494
1532
|
)
|
1495
1533
|
|
1534
|
+
if getv(from_object, ['language_code']) is not None:
|
1535
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
1536
|
+
|
1496
1537
|
return to_object
|
1497
1538
|
|
1498
1539
|
|
@@ -1597,6 +1638,15 @@ def _GenerateContentConfig_to_vertex(
|
|
1597
1638
|
if getv(from_object, ['routing_config']) is not None:
|
1598
1639
|
setv(to_object, ['routingConfig'], getv(from_object, ['routing_config']))
|
1599
1640
|
|
1641
|
+
if getv(from_object, ['model_selection_config']) is not None:
|
1642
|
+
setv(
|
1643
|
+
to_object,
|
1644
|
+
['modelConfig'],
|
1645
|
+
_ModelSelectionConfig_to_vertex(
|
1646
|
+
api_client, getv(from_object, ['model_selection_config']), to_object
|
1647
|
+
),
|
1648
|
+
)
|
1649
|
+
|
1600
1650
|
if getv(from_object, ['safety_settings']) is not None:
|
1601
1651
|
setv(
|
1602
1652
|
parent_object,
|
@@ -2659,6 +2709,16 @@ def _GenerateVideosParameters_to_vertex(
|
|
2659
2709
|
return to_object
|
2660
2710
|
|
2661
2711
|
|
2712
|
+
def _FeatureSelectionPreference_to_mldev_enum_validate(enum_value: Any):
|
2713
|
+
if enum_value in set([
|
2714
|
+
'FEATURE_SELECTION_PREFERENCE_UNSPECIFIED',
|
2715
|
+
'PRIORITIZE_QUALITY',
|
2716
|
+
'BALANCED',
|
2717
|
+
'PRIORITIZE_COST',
|
2718
|
+
]):
|
2719
|
+
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
2720
|
+
|
2721
|
+
|
2662
2722
|
def _SafetyFilterLevel_to_mldev_enum_validate(enum_value: Any):
|
2663
2723
|
if enum_value in set(['BLOCK_NONE']):
|
2664
2724
|
raise ValueError(f'{enum_value} enum value is not supported in Gemini API.')
|
@@ -6433,7 +6493,9 @@ class AsyncModels(_api_module.BaseModule):
|
|
6433
6493
|
if remaining_remote_calls_afc == 0:
|
6434
6494
|
logger.info('Reached max remote calls for automatic function calling.')
|
6435
6495
|
|
6436
|
-
function_map = _extra_utils.get_function_map(
|
6496
|
+
function_map = _extra_utils.get_function_map(
|
6497
|
+
config, is_caller_method_async=True
|
6498
|
+
)
|
6437
6499
|
if not function_map:
|
6438
6500
|
break
|
6439
6501
|
if not response:
|
@@ -6444,8 +6506,10 @@ class AsyncModels(_api_module.BaseModule):
|
|
6444
6506
|
or not response.candidates[0].content.parts
|
6445
6507
|
):
|
6446
6508
|
break
|
6447
|
-
func_response_parts =
|
6448
|
-
|
6509
|
+
func_response_parts = (
|
6510
|
+
await _extra_utils.get_function_response_parts_async(
|
6511
|
+
response, function_map
|
6512
|
+
)
|
6449
6513
|
)
|
6450
6514
|
if not func_response_parts:
|
6451
6515
|
break
|
@@ -6565,7 +6629,9 @@ class AsyncModels(_api_module.BaseModule):
|
|
6565
6629
|
'Reached max remote calls for automatic function calling.'
|
6566
6630
|
)
|
6567
6631
|
|
6568
|
-
function_map = _extra_utils.get_function_map(
|
6632
|
+
function_map = _extra_utils.get_function_map(
|
6633
|
+
config, is_caller_method_async=True
|
6634
|
+
)
|
6569
6635
|
|
6570
6636
|
if i == 1:
|
6571
6637
|
# First request gets a function call.
|
@@ -6581,8 +6647,10 @@ class AsyncModels(_api_module.BaseModule):
|
|
6581
6647
|
or not chunk.candidates[0].content.parts
|
6582
6648
|
):
|
6583
6649
|
break
|
6584
|
-
func_response_parts =
|
6585
|
-
|
6650
|
+
func_response_parts = (
|
6651
|
+
await _extra_utils.get_function_response_parts_async(
|
6652
|
+
chunk, function_map
|
6653
|
+
)
|
6586
6654
|
)
|
6587
6655
|
if not func_response_parts:
|
6588
6656
|
yield chunk
|