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/_transformers.py
CHANGED
@@ -625,17 +625,22 @@ def _raise_for_unsupported_schema_type(origin: Any) -> None:
|
|
625
625
|
|
626
626
|
|
627
627
|
def _raise_for_unsupported_mldev_properties(
|
628
|
-
schema: Any, client: _api_client.BaseApiClient
|
628
|
+
schema: Any, client: Optional[_api_client.BaseApiClient]
|
629
629
|
) -> None:
|
630
|
-
if
|
631
|
-
|
630
|
+
if (
|
631
|
+
client
|
632
|
+
and not client.vertexai
|
633
|
+
and (
|
634
|
+
schema.get('additionalProperties')
|
635
|
+
or schema.get('additional_properties')
|
636
|
+
)
|
632
637
|
):
|
633
638
|
raise ValueError('additionalProperties is not supported in the Gemini API.')
|
634
639
|
|
635
640
|
|
636
641
|
def process_schema(
|
637
642
|
schema: dict[str, Any],
|
638
|
-
client: _api_client.BaseApiClient,
|
643
|
+
client: Optional[_api_client.BaseApiClient],
|
639
644
|
defs: Optional[dict[str, Any]] = None,
|
640
645
|
*,
|
641
646
|
order_properties: bool = True,
|
@@ -785,7 +790,7 @@ def process_schema(
|
|
785
790
|
|
786
791
|
|
787
792
|
def _process_enum(
|
788
|
-
enum: EnumMeta, client: _api_client.BaseApiClient
|
793
|
+
enum: EnumMeta, client: Optional[_api_client.BaseApiClient]
|
789
794
|
) -> types.Schema:
|
790
795
|
is_integer_enum = False
|
791
796
|
|
@@ -823,7 +828,8 @@ def _is_type_dict_str_any(
|
|
823
828
|
|
824
829
|
|
825
830
|
def t_schema(
|
826
|
-
client: _api_client.BaseApiClient,
|
831
|
+
client: Optional[_api_client.BaseApiClient],
|
832
|
+
origin: Union[types.SchemaUnionDict, Any],
|
827
833
|
) -> Optional[types.Schema]:
|
828
834
|
if not origin:
|
829
835
|
return None
|
@@ -1004,17 +1010,27 @@ def t_batch_job_source(
|
|
1004
1010
|
raise ValueError(f'Unsupported source: {src}')
|
1005
1011
|
|
1006
1012
|
|
1007
|
-
def t_batch_job_destination(
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
elif dest
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1013
|
+
def t_batch_job_destination(
|
1014
|
+
dest: Union[str, types.BatchJobDestinationOrDict],
|
1015
|
+
) -> types.BatchJobDestination:
|
1016
|
+
if isinstance(dest, dict):
|
1017
|
+
dest = types.BatchJobDestination(**dest)
|
1018
|
+
return dest
|
1019
|
+
elif isinstance(dest, str):
|
1020
|
+
if dest.startswith('gs://'):
|
1021
|
+
return types.BatchJobDestination(
|
1022
|
+
format='jsonl',
|
1023
|
+
gcs_uri=dest,
|
1024
|
+
)
|
1025
|
+
elif dest.startswith('bq://'):
|
1026
|
+
return types.BatchJobDestination(
|
1027
|
+
format='bigquery',
|
1028
|
+
bigquery_uri=dest,
|
1029
|
+
)
|
1030
|
+
else:
|
1031
|
+
raise ValueError(f'Unsupported destination: {dest}')
|
1032
|
+
elif isinstance(dest, types.BatchJobDestination):
|
1033
|
+
return dest
|
1018
1034
|
else:
|
1019
1035
|
raise ValueError(f'Unsupported destination: {dest}')
|
1020
1036
|
|