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.
@@ -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 not client.vertexai and (
631
- schema.get('additionalProperties') or schema.get('additional_properties')
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, origin: Union[types.SchemaUnionDict, Any]
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(dest: str) -> types.BatchJobDestination:
1008
- if dest.startswith('gs://'):
1009
- return types.BatchJobDestination(
1010
- format='jsonl',
1011
- gcs_uri=dest,
1012
- )
1013
- elif dest.startswith('bq://'):
1014
- return types.BatchJobDestination(
1015
- format='bigquery',
1016
- bigquery_uri=dest,
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