google-genai 1.2.0__py3-none-any.whl → 1.4.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/types.py CHANGED
@@ -21,8 +21,9 @@ import inspect
21
21
  import json
22
22
  import logging
23
23
  import sys
24
+ import types as builtin_types
24
25
  import typing
25
- from typing import Any, Callable, GenericAlias, Literal, Optional, Union
26
+ from typing import Any, Callable, Literal, Optional, Union, _UnionGenericAlias
26
27
  import pydantic
27
28
  from pydantic import Field
28
29
  from typing_extensions import TypedDict
@@ -30,11 +31,11 @@ from . import _common
30
31
 
31
32
  if sys.version_info >= (3, 10):
32
33
  # Supports both Union[t1, t2] and t1 | t2
33
- VersionedUnionType = Union[typing.types.UnionType, typing._UnionGenericAlias]
34
- _UNION_TYPES = (typing.Union, typing.types.UnionType)
34
+ VersionedUnionType = Union[builtin_types.UnionType, _UnionGenericAlias]
35
+ _UNION_TYPES = (typing.Union, builtin_types.UnionType)
35
36
  else:
36
37
  # Supports only Union[t1, t2]
37
- VersionedUnionType = typing._UnionGenericAlias
38
+ VersionedUnionType = _UnionGenericAlias
38
39
  _UNION_TYPES = (typing.Union,)
39
40
 
40
41
  _is_pillow_image_imported = False
@@ -53,6 +54,8 @@ else:
53
54
  except ImportError:
54
55
  PIL_Image = None
55
56
 
57
+ logger = logging.getLogger('google_genai.types')
58
+
56
59
 
57
60
  class Outcome(_common.CaseInSensitiveEnum):
58
61
  """Required. Outcome of the code execution."""
@@ -71,7 +74,7 @@ class Language(_common.CaseInSensitiveEnum):
71
74
 
72
75
 
73
76
  class Type(_common.CaseInSensitiveEnum):
74
- """A basic data type."""
77
+ """Optional. The type of the data."""
75
78
 
76
79
  TYPE_UNSPECIFIED = 'TYPE_UNSPECIFIED'
77
80
  STRING = 'STRING'
@@ -691,6 +694,63 @@ class Content(_common.BaseModel):
691
694
  )
692
695
 
693
696
 
697
+ class UserContent(Content):
698
+ """UserContent facilitates the creation of a Content object with a user role.
699
+
700
+ Example usages:
701
+
702
+
703
+ - Create a user Content object with a string:
704
+ user_content = UserContent("Why is the sky blue?")
705
+ - Create a user Content object with a file data Part object:
706
+ user_content = UserContent(Part.from_uri(file_uril="gs://bucket/file.txt",
707
+ mime_type="text/plain"))
708
+ - Create a user Content object with byte data Part object:
709
+ user_content = UserContent(Part.from_bytes(data=b"Hello, World!",
710
+ mime_type="text/plain"))
711
+
712
+ You can create a user Content object using other classmethods in the Part
713
+ class as well.
714
+ You can also create a user Content using a list of Part objects or strings.
715
+ """
716
+
717
+ role: Literal['user'] = Field(default='user', init=False, frozen=True)
718
+ parts: list[Part] = Field()
719
+
720
+ def __init__(self, parts: Union['PartUnionDict', list['PartUnionDict']]):
721
+ from . import _transformers as t
722
+
723
+ super().__init__(parts=t.t_parts(None, parts=parts))
724
+
725
+
726
+ class ModelContent(Content):
727
+ """ModelContent facilitates the creation of a Content object with a model role.
728
+
729
+ Example usages:
730
+
731
+ - Create a model Content object with a string:
732
+ model_content = ModelContent("Why is the sky blue?")
733
+ - Create a model Content object with a file data Part object:
734
+ model_content = ModelContent(Part.from_uri(file_uril="gs://bucket/file.txt",
735
+ mime_type="text/plain"))
736
+ - Create a model Content object with byte data Part object:
737
+ model_content = ModelContent(Part.from_bytes(data=b"Hello, World!",
738
+ mime_type="text/plain"))
739
+
740
+ You can create a model Content object using other classmethods in the Part
741
+ class as well.
742
+ You can also create a model Content using a list of Part objects or strings.
743
+ """
744
+
745
+ role: Literal['model'] = Field(default='model', init=False, frozen=True)
746
+ parts: list[Part] = Field()
747
+
748
+ def __init__(self, parts: Union['PartUnionDict', list['PartUnionDict']]):
749
+ from . import _transformers as t
750
+
751
+ super().__init__(parts=t.t_parts(None, parts=parts))
752
+
753
+
694
754
  class ContentDict(TypedDict, total=False):
695
755
  """Contains the multi-part content of a message."""
696
756
 
@@ -751,18 +811,10 @@ class Schema(_common.BaseModel):
751
811
  Represents a select subset of an OpenAPI 3.0 schema object.
752
812
  """
753
813
 
754
- min_items: Optional[int] = Field(
755
- default=None,
756
- description="""Optional. Minimum number of the elements for Type.ARRAY.""",
757
- )
758
814
  example: Optional[Any] = Field(
759
815
  default=None,
760
816
  description="""Optional. Example of the object. Will only populated when the object is the root.""",
761
817
  )
762
- property_ordering: Optional[list[str]] = Field(
763
- default=None,
764
- description="""Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.""",
765
- )
766
818
  pattern: Optional[str] = Field(
767
819
  default=None,
768
820
  description="""Optional. Pattern of the Type.STRING to restrict a string to a regular expression.""",
@@ -774,7 +826,7 @@ class Schema(_common.BaseModel):
774
826
  default: Optional[Any] = Field(
775
827
  default=None, description="""Optional. Default value of the data."""
776
828
  )
777
- any_of: list['Schema'] = Field(
829
+ any_of: Optional[list['Schema']] = Field(
778
830
  default=None,
779
831
  description="""Optional. The value should be validated against any (one or more) of the subschemas in the list.""",
780
832
  )
@@ -793,25 +845,14 @@ class Schema(_common.BaseModel):
793
845
  default=None,
794
846
  description="""Optional. Minimum number of the properties for Type.OBJECT.""",
795
847
  )
796
- max_items: Optional[int] = Field(
797
- default=None,
798
- description="""Optional. Maximum number of the elements for Type.ARRAY.""",
799
- )
800
848
  maximum: Optional[float] = Field(
801
849
  default=None,
802
850
  description="""Optional. Maximum value of the Type.INTEGER and Type.NUMBER""",
803
851
  )
804
- nullable: Optional[bool] = Field(
805
- default=None,
806
- description="""Optional. Indicates if the value may be null.""",
807
- )
808
852
  max_properties: Optional[int] = Field(
809
853
  default=None,
810
854
  description="""Optional. Maximum number of the properties for Type.OBJECT.""",
811
855
  )
812
- type: Optional[Type] = Field(
813
- default=None, description="""Optional. The type of the data."""
814
- )
815
856
  description: Optional[str] = Field(
816
857
  default=None, description="""Optional. The description of the data."""
817
858
  )
@@ -823,18 +864,37 @@ class Schema(_common.BaseModel):
823
864
  default=None,
824
865
  description="""Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc""",
825
866
  )
826
- items: 'Schema' = Field(
867
+ items: Optional['Schema'] = Field(
827
868
  default=None,
828
869
  description="""Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY.""",
829
870
  )
830
- properties: dict[str, 'Schema'] = Field(
871
+ max_items: Optional[int] = Field(
872
+ default=None,
873
+ description="""Optional. Maximum number of the elements for Type.ARRAY.""",
874
+ )
875
+ min_items: Optional[int] = Field(
876
+ default=None,
877
+ description="""Optional. Minimum number of the elements for Type.ARRAY.""",
878
+ )
879
+ nullable: Optional[bool] = Field(
880
+ default=None,
881
+ description="""Optional. Indicates if the value may be null.""",
882
+ )
883
+ properties: Optional[dict[str, 'Schema']] = Field(
831
884
  default=None,
832
885
  description="""Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT.""",
833
886
  )
887
+ property_ordering: Optional[list[str]] = Field(
888
+ default=None,
889
+ description="""Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.""",
890
+ )
834
891
  required: Optional[list[str]] = Field(
835
892
  default=None,
836
893
  description="""Optional. Required properties of Type.OBJECT.""",
837
894
  )
895
+ type: Optional[Type] = Field(
896
+ default=None, description="""Optional. The type of the data."""
897
+ )
838
898
 
839
899
 
840
900
  class SchemaDict(TypedDict, total=False):
@@ -843,15 +903,9 @@ class SchemaDict(TypedDict, total=False):
843
903
  Represents a select subset of an OpenAPI 3.0 schema object.
844
904
  """
845
905
 
846
- min_items: Optional[int]
847
- """Optional. Minimum number of the elements for Type.ARRAY."""
848
-
849
906
  example: Optional[Any]
850
907
  """Optional. Example of the object. Will only populated when the object is the root."""
851
908
 
852
- property_ordering: Optional[list[str]]
853
- """Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties."""
854
-
855
909
  pattern: Optional[str]
856
910
  """Optional. Pattern of the Type.STRING to restrict a string to a regular expression."""
857
911
 
@@ -861,7 +915,7 @@ class SchemaDict(TypedDict, total=False):
861
915
  default: Optional[Any]
862
916
  """Optional. Default value of the data."""
863
917
 
864
- any_of: list['SchemaDict']
918
+ any_of: Optional[list['SchemaDict']]
865
919
  """Optional. The value should be validated against any (one or more) of the subschemas in the list."""
866
920
 
867
921
  max_length: Optional[int]
@@ -876,21 +930,12 @@ class SchemaDict(TypedDict, total=False):
876
930
  min_properties: Optional[int]
877
931
  """Optional. Minimum number of the properties for Type.OBJECT."""
878
932
 
879
- max_items: Optional[int]
880
- """Optional. Maximum number of the elements for Type.ARRAY."""
881
-
882
933
  maximum: Optional[float]
883
934
  """Optional. Maximum value of the Type.INTEGER and Type.NUMBER"""
884
935
 
885
- nullable: Optional[bool]
886
- """Optional. Indicates if the value may be null."""
887
-
888
936
  max_properties: Optional[int]
889
937
  """Optional. Maximum number of the properties for Type.OBJECT."""
890
938
 
891
- type: Optional[Type]
892
- """Optional. The type of the data."""
893
-
894
939
  description: Optional[str]
895
940
  """Optional. The description of the data."""
896
941
 
@@ -900,15 +945,30 @@ class SchemaDict(TypedDict, total=False):
900
945
  format: Optional[str]
901
946
  """Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc"""
902
947
 
903
- items: 'SchemaDict'
948
+ items: Optional['SchemaDict']
904
949
  """Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY."""
905
950
 
906
- properties: dict[str, 'SchemaDict']
951
+ max_items: Optional[int]
952
+ """Optional. Maximum number of the elements for Type.ARRAY."""
953
+
954
+ min_items: Optional[int]
955
+ """Optional. Minimum number of the elements for Type.ARRAY."""
956
+
957
+ nullable: Optional[bool]
958
+ """Optional. Indicates if the value may be null."""
959
+
960
+ properties: Optional[dict[str, 'SchemaDict']]
907
961
  """Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT."""
908
962
 
963
+ property_ordering: Optional[list[str]]
964
+ """Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties."""
965
+
909
966
  required: Optional[list[str]]
910
967
  """Optional. Required properties of Type.OBJECT."""
911
968
 
969
+ type: Optional[Type]
970
+ """Optional. The type of the data."""
971
+
912
972
 
913
973
  SchemaOrDict = Union[Schema, SchemaDict]
914
974
 
@@ -1688,7 +1748,9 @@ ContentUnion = Union[Content, list[PartUnion], PartUnion]
1688
1748
  ContentUnionDict = Union[ContentUnion, ContentDict]
1689
1749
 
1690
1750
 
1691
- SchemaUnion = Union[dict, type, Schema, GenericAlias, VersionedUnionType]
1751
+ SchemaUnion = Union[
1752
+ dict, type, Schema, builtin_types.GenericAlias, VersionedUnionType
1753
+ ]
1692
1754
 
1693
1755
 
1694
1756
  SchemaUnionDict = Union[SchemaUnion, SchemaDict]
@@ -2823,6 +2885,16 @@ class GenerateContentResponse(_common.BaseModel):
2823
2885
  description="""Response variations returned by the model.
2824
2886
  """,
2825
2887
  )
2888
+ create_time: Optional[datetime.datetime] = Field(
2889
+ default=None,
2890
+ description="""Timestamp when the request is made to the server.
2891
+ """,
2892
+ )
2893
+ response_id: Optional[str] = Field(
2894
+ default=None,
2895
+ description="""Identifier for each response.
2896
+ """,
2897
+ )
2826
2898
  model_version: Optional[str] = Field(
2827
2899
  default=None,
2828
2900
  description="""Output only. The model version used to generate the response.""",
@@ -2835,7 +2907,7 @@ class GenerateContentResponse(_common.BaseModel):
2835
2907
  default=None, description="""Usage metadata about the response(s)."""
2836
2908
  )
2837
2909
  automatic_function_calling_history: Optional[list[Content]] = None
2838
- parsed: Union[pydantic.BaseModel, dict, Enum] = Field(
2910
+ parsed: Optional[Union[pydantic.BaseModel, dict, Enum]] = Field(
2839
2911
  default=None,
2840
2912
  description="""Parsed response if response_schema is provided. Not available for streaming.""",
2841
2913
  )
@@ -2850,27 +2922,31 @@ class GenerateContentResponse(_common.BaseModel):
2850
2922
  ):
2851
2923
  return None
2852
2924
  if len(self.candidates) > 1:
2853
- logging.warning(
2925
+ logger.warning(
2854
2926
  f'there are {len(self.candidates)} candidates, returning text from'
2855
2927
  ' the first candidate.Access response.candidates directly to get'
2856
2928
  ' text from other candidates.'
2857
2929
  )
2858
2930
  text = ''
2859
2931
  any_text_part_text = False
2932
+ non_text_parts = []
2860
2933
  for part in self.candidates[0].content.parts:
2861
2934
  for field_name, field_value in part.model_dump(
2862
2935
  exclude={'text', 'thought'}
2863
2936
  ).items():
2864
2937
  if field_value is not None:
2865
- raise ValueError(
2866
- 'GenerateContentResponse.text only supports text parts, but got'
2867
- f' {field_name} part{part}'
2868
- )
2938
+ non_text_parts.append(field_name)
2869
2939
  if isinstance(part.text, str):
2870
2940
  if isinstance(part.thought, bool) and part.thought:
2871
2941
  continue
2872
2942
  any_text_part_text = True
2873
2943
  text += part.text
2944
+ if non_text_parts:
2945
+ logger.warning(
2946
+ 'Warning: there are non-text parts in the response:'
2947
+ f' {non_text_parts},returning concatenated text from text parts,check'
2948
+ ' out the non text parts for full response from model.'
2949
+ )
2874
2950
  # part.text == '' is different from part.text is None
2875
2951
  return text if any_text_part_text else None
2876
2952
 
@@ -2884,7 +2960,7 @@ class GenerateContentResponse(_common.BaseModel):
2884
2960
  ):
2885
2961
  return None
2886
2962
  if len(self.candidates) > 1:
2887
- logging.warning(
2963
+ logger.warning(
2888
2964
  'Warning: there are multiple candidates in the response, returning'
2889
2965
  ' function calls from the first one.'
2890
2966
  )
@@ -2896,11 +2972,49 @@ class GenerateContentResponse(_common.BaseModel):
2896
2972
 
2897
2973
  return function_calls if function_calls else None
2898
2974
 
2975
+ @property
2976
+ def executable_code(self) -> Optional[str]:
2977
+ """Returns the executable code in the response."""
2978
+ if (
2979
+ not self.candidates
2980
+ or not self.candidates[0].content
2981
+ or not self.candidates[0].content.parts
2982
+ ):
2983
+ return None
2984
+ if len(self.candidates) > 1:
2985
+ logging.warning(
2986
+ 'Warning: there are multiple candidates in the response, returning'
2987
+ ' executable code from the first one.'
2988
+ )
2989
+ for part in self.candidates[0].content.parts:
2990
+ if part.executable_code is not None:
2991
+ return part.executable_code.code
2992
+ return None
2993
+
2994
+ @property
2995
+ def code_execution_result(self) -> Optional[str]:
2996
+ """Returns the code execution result in the response."""
2997
+ if (
2998
+ not self.candidates
2999
+ or not self.candidates[0].content
3000
+ or not self.candidates[0].content.parts
3001
+ ):
3002
+ return None
3003
+ if len(self.candidates) > 1:
3004
+ logging.warning(
3005
+ 'Warning: there are multiple candidates in the response, returning'
3006
+ ' code execution result from the first one.'
3007
+ )
3008
+ for part in self.candidates[0].content.parts:
3009
+ if part.code_execution_result is not None:
3010
+ return part.code_execution_result.output
3011
+ return None
3012
+
2899
3013
  @classmethod
2900
3014
  def _from_response(
2901
3015
  cls, *, response: dict[str, object], kwargs: dict[str, object]
2902
- ):
2903
- result = super()._from_response(response, kwargs)
3016
+ ) -> _common.BaseModel:
3017
+ result = super()._from_response(response=response, kwargs=kwargs)
2904
3018
 
2905
3019
  # Handles response schema.
2906
3020
  response_schema = _common.get_value_by_path(
@@ -2909,7 +3023,7 @@ class GenerateContentResponse(_common.BaseModel):
2909
3023
  if (
2910
3024
  inspect.isclass(response_schema)
2911
3025
  and not (
2912
- isinstance(response_schema, GenericAlias)
3026
+ isinstance(response_schema, builtin_types.GenericAlias)
2913
3027
  ) # Needed for Python 3.9 and 3.10
2914
3028
  and issubclass(response_schema, pydantic.BaseModel)
2915
3029
  ):
@@ -2933,7 +3047,7 @@ class GenerateContentResponse(_common.BaseModel):
2933
3047
  result.parsed = str(response_schema(enum_value).name)
2934
3048
  except ValueError:
2935
3049
  pass
2936
- elif isinstance(response_schema, GenericAlias) or isinstance(
3050
+ elif isinstance(response_schema, builtin_types.GenericAlias) or isinstance(
2937
3051
  response_schema, type
2938
3052
  ):
2939
3053
 
@@ -2967,7 +3081,7 @@ class GenerateContentResponse(_common.BaseModel):
2967
3081
  if issubclass(union_type, pydantic.BaseModel):
2968
3082
  try:
2969
3083
 
2970
- class Placeholder(pydantic.BaseModel):
3084
+ class Placeholder(pydantic.BaseModel): # type: ignore[no-redef]
2971
3085
  placeholder: response_schema
2972
3086
 
2973
3087
  parsed = {'placeholder': json.loads(result.text)}
@@ -2994,6 +3108,14 @@ class GenerateContentResponseDict(TypedDict, total=False):
2994
3108
  """Response variations returned by the model.
2995
3109
  """
2996
3110
 
3111
+ create_time: Optional[datetime.datetime]
3112
+ """Timestamp when the request is made to the server.
3113
+ """
3114
+
3115
+ response_id: Optional[str]
3116
+ """Identifier for each response.
3117
+ """
3118
+
2997
3119
  model_version: Optional[str]
2998
3120
  """Output only. The model version used to generate the response."""
2999
3121
 
@@ -3271,6 +3393,11 @@ class GenerateImagesConfig(_common.BaseModel):
3271
3393
  description="""Number of images to generate.
3272
3394
  """,
3273
3395
  )
3396
+ aspect_ratio: Optional[str] = Field(
3397
+ default=None,
3398
+ description="""Aspect ratio of the generated images.
3399
+ """,
3400
+ )
3274
3401
  guidance_scale: Optional[float] = Field(
3275
3402
  default=None,
3276
3403
  description="""Controls how much the model adheres to the text prompt. Large
@@ -3326,11 +3453,6 @@ class GenerateImagesConfig(_common.BaseModel):
3326
3453
  description="""Whether to add a watermark to the generated images.
3327
3454
  """,
3328
3455
  )
3329
- aspect_ratio: Optional[str] = Field(
3330
- default=None,
3331
- description="""Aspect ratio of the generated images.
3332
- """,
3333
- )
3334
3456
  enhance_prompt: Optional[bool] = Field(
3335
3457
  default=None,
3336
3458
  description="""Whether to use the prompt rewriting logic.
@@ -3356,6 +3478,10 @@ class GenerateImagesConfigDict(TypedDict, total=False):
3356
3478
  """Number of images to generate.
3357
3479
  """
3358
3480
 
3481
+ aspect_ratio: Optional[str]
3482
+ """Aspect ratio of the generated images.
3483
+ """
3484
+
3359
3485
  guidance_scale: Optional[float]
3360
3486
  """Controls how much the model adheres to the text prompt. Large
3361
3487
  values increase output and prompt alignment, but may compromise image
@@ -3401,10 +3527,6 @@ class GenerateImagesConfigDict(TypedDict, total=False):
3401
3527
  """Whether to add a watermark to the generated images.
3402
3528
  """
3403
3529
 
3404
- aspect_ratio: Optional[str]
3405
- """Aspect ratio of the generated images.
3406
- """
3407
-
3408
3530
  enhance_prompt: Optional[bool]
3409
3531
  """Whether to use the prompt rewriting logic.
3410
3532
  """
@@ -3527,7 +3649,8 @@ class Image(_common.BaseModel):
3527
3649
  IPython_display.display(self._pil_image)
3528
3650
 
3529
3651
  @property
3530
- def _pil_image(self) -> 'PIL_Image.Image':
3652
+ def _pil_image(self) -> 'PIL_Image':
3653
+ PIL_Image: Optional[builtin_types.ModuleType]
3531
3654
  try:
3532
3655
  from PIL import Image as PIL_Image
3533
3656
  except ImportError:
@@ -3796,7 +3919,8 @@ class _ReferenceImageAPI(_common.BaseModel):
3796
3919
  default=None, description="""The id of the reference image."""
3797
3920
  )
3798
3921
  reference_type: Optional[str] = Field(
3799
- default=None, description="""The type of the reference image."""
3922
+ default=None,
3923
+ description="""The type of the reference image. Only set by the SDK.""",
3800
3924
  )
3801
3925
  mask_image_config: Optional[MaskReferenceConfig] = Field(
3802
3926
  default=None,
@@ -3826,7 +3950,7 @@ class _ReferenceImageAPIDict(TypedDict, total=False):
3826
3950
  """The id of the reference image."""
3827
3951
 
3828
3952
  reference_type: Optional[str]
3829
- """The type of the reference image."""
3953
+ """The type of the reference image. Only set by the SDK."""
3830
3954
 
3831
3955
  mask_image_config: Optional[MaskReferenceConfigDict]
3832
3956
  """Configuration for the mask reference image."""
@@ -3865,6 +3989,11 @@ class EditImageConfig(_common.BaseModel):
3865
3989
  description="""Number of images to generate.
3866
3990
  """,
3867
3991
  )
3992
+ aspect_ratio: Optional[str] = Field(
3993
+ default=None,
3994
+ description="""Aspect ratio of the generated images.
3995
+ """,
3996
+ )
3868
3997
  guidance_scale: Optional[float] = Field(
3869
3998
  default=None,
3870
3999
  description="""Controls how much the model adheres to the text prompt. Large
@@ -3939,6 +4068,10 @@ class EditImageConfigDict(TypedDict, total=False):
3939
4068
  """Number of images to generate.
3940
4069
  """
3941
4070
 
4071
+ aspect_ratio: Optional[str]
4072
+ """Aspect ratio of the generated images.
4073
+ """
4074
+
3942
4075
  guidance_scale: Optional[float]
3943
4076
  """Controls how much the model adheres to the text prompt. Large
3944
4077
  values increase output and prompt alignment, but may compromise image
@@ -4835,6 +4968,331 @@ ComputeTokensResponseOrDict = Union[
4835
4968
  ]
4836
4969
 
4837
4970
 
4971
+ class GenerateVideosConfig(_common.BaseModel):
4972
+ """Configuration for generating videos."""
4973
+
4974
+ http_options: Optional[HttpOptions] = Field(
4975
+ default=None, description="""Used to override HTTP request options."""
4976
+ )
4977
+ number_of_videos: Optional[int] = Field(
4978
+ default=None, description="""Number of output videos."""
4979
+ )
4980
+ output_gcs_uri: Optional[str] = Field(
4981
+ default=None,
4982
+ description="""The gcs bucket where to save the generated videos.""",
4983
+ )
4984
+ fps: Optional[int] = Field(
4985
+ default=None, description="""Frames per second for video generation."""
4986
+ )
4987
+ duration_seconds: Optional[int] = Field(
4988
+ default=None,
4989
+ description="""Duration of the clip for video generation in seconds.""",
4990
+ )
4991
+ seed: Optional[int] = Field(
4992
+ default=None,
4993
+ description="""The RNG seed. If RNG seed is exactly same for each request with unchanged inputs, the prediction results will be consistent. Otherwise, a random RNG seed will be used each time to produce a different result.""",
4994
+ )
4995
+ aspect_ratio: Optional[str] = Field(
4996
+ default=None,
4997
+ description="""The aspect ratio for the generated video. 16:9 (landscape) and 9:16 (portrait) are supported.""",
4998
+ )
4999
+ resolution: Optional[str] = Field(
5000
+ default=None,
5001
+ description="""The resolution for the generated video. 1280x720, 1920x1080 are supported.""",
5002
+ )
5003
+ person_generation: Optional[str] = Field(
5004
+ default=None,
5005
+ description="""Whether allow to generate person videos, and restrict to specific ages. Supported values are: dont_allow, allow_adult.""",
5006
+ )
5007
+ pubsub_topic: Optional[str] = Field(
5008
+ default=None,
5009
+ description="""The pubsub topic where to publish the video generation progress.""",
5010
+ )
5011
+ negative_prompt: Optional[str] = Field(
5012
+ default=None,
5013
+ description="""Optional field in addition to the text content. Negative prompts can be explicitly stated here to help generate the video.""",
5014
+ )
5015
+ enhance_prompt: Optional[bool] = Field(
5016
+ default=None, description="""Whether to use the prompt rewriting logic."""
5017
+ )
5018
+
5019
+
5020
+ class GenerateVideosConfigDict(TypedDict, total=False):
5021
+ """Configuration for generating videos."""
5022
+
5023
+ http_options: Optional[HttpOptionsDict]
5024
+ """Used to override HTTP request options."""
5025
+
5026
+ number_of_videos: Optional[int]
5027
+ """Number of output videos."""
5028
+
5029
+ output_gcs_uri: Optional[str]
5030
+ """The gcs bucket where to save the generated videos."""
5031
+
5032
+ fps: Optional[int]
5033
+ """Frames per second for video generation."""
5034
+
5035
+ duration_seconds: Optional[int]
5036
+ """Duration of the clip for video generation in seconds."""
5037
+
5038
+ seed: Optional[int]
5039
+ """The RNG seed. If RNG seed is exactly same for each request with unchanged inputs, the prediction results will be consistent. Otherwise, a random RNG seed will be used each time to produce a different result."""
5040
+
5041
+ aspect_ratio: Optional[str]
5042
+ """The aspect ratio for the generated video. 16:9 (landscape) and 9:16 (portrait) are supported."""
5043
+
5044
+ resolution: Optional[str]
5045
+ """The resolution for the generated video. 1280x720, 1920x1080 are supported."""
5046
+
5047
+ person_generation: Optional[str]
5048
+ """Whether allow to generate person videos, and restrict to specific ages. Supported values are: dont_allow, allow_adult."""
5049
+
5050
+ pubsub_topic: Optional[str]
5051
+ """The pubsub topic where to publish the video generation progress."""
5052
+
5053
+ negative_prompt: Optional[str]
5054
+ """Optional field in addition to the text content. Negative prompts can be explicitly stated here to help generate the video."""
5055
+
5056
+ enhance_prompt: Optional[bool]
5057
+ """Whether to use the prompt rewriting logic."""
5058
+
5059
+
5060
+ GenerateVideosConfigOrDict = Union[
5061
+ GenerateVideosConfig, GenerateVideosConfigDict
5062
+ ]
5063
+
5064
+
5065
+ class _GenerateVideosParameters(_common.BaseModel):
5066
+ """Class that represents the parameters for generating an image."""
5067
+
5068
+ model: Optional[str] = Field(
5069
+ default=None,
5070
+ description="""ID of the model to use. For a list of models, see `Google models
5071
+ <https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_.""",
5072
+ )
5073
+ prompt: Optional[str] = Field(
5074
+ default=None,
5075
+ description="""The text prompt for generating the videos. Optional for image to video use cases.""",
5076
+ )
5077
+ config: Optional[GenerateVideosConfig] = Field(
5078
+ default=None, description="""Configuration for generating videos."""
5079
+ )
5080
+
5081
+
5082
+ class _GenerateVideosParametersDict(TypedDict, total=False):
5083
+ """Class that represents the parameters for generating an image."""
5084
+
5085
+ model: Optional[str]
5086
+ """ID of the model to use. For a list of models, see `Google models
5087
+ <https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_."""
5088
+
5089
+ prompt: Optional[str]
5090
+ """The text prompt for generating the videos. Optional for image to video use cases."""
5091
+
5092
+ config: Optional[GenerateVideosConfigDict]
5093
+ """Configuration for generating videos."""
5094
+
5095
+
5096
+ _GenerateVideosParametersOrDict = Union[
5097
+ _GenerateVideosParameters, _GenerateVideosParametersDict
5098
+ ]
5099
+
5100
+
5101
+ class Video(_common.BaseModel):
5102
+ """A generated video."""
5103
+
5104
+ uri: Optional[str] = Field(
5105
+ default=None, description="""Path to another storage."""
5106
+ )
5107
+ video_bytes: Optional[bytes] = Field(
5108
+ default=None, description="""Video bytes."""
5109
+ )
5110
+ mime_type: Optional[str] = Field(
5111
+ default=None, description="""Video encoding, for example "video/mp4"."""
5112
+ )
5113
+
5114
+ def save(
5115
+ self,
5116
+ path: str,
5117
+ ) -> None:
5118
+ """Saves the video to a file.
5119
+
5120
+ Args:
5121
+ path: Local path where to save the video.
5122
+ """
5123
+ import pathlib # pylint: disable=g-import-not-at-top
5124
+
5125
+ if not self.video_bytes:
5126
+ raise NotImplementedError('Saving remote videos is not supported.')
5127
+
5128
+ pathlib.Path(path).write_bytes(self.video_bytes)
5129
+
5130
+ def show(self):
5131
+ """Shows the video.
5132
+
5133
+ This method only works in a notebook environment.
5134
+ """
5135
+ if self.uri:
5136
+ return ValueError('Showing remote videos is not supported.')
5137
+ if not self.video_bytes:
5138
+ return ValueError('Video has no bytes.')
5139
+ if not self.mime_type:
5140
+ return ValueError('Mime type must be provided to display video.')
5141
+
5142
+ try:
5143
+ from IPython import display as IPython_display
5144
+ except ImportError:
5145
+ IPython_display = None
5146
+
5147
+ if IPython_display:
5148
+ return IPython_display.Video(
5149
+ data=self.video_bytes, mimetype=self.mime_type, embed=True
5150
+ )
5151
+
5152
+ def __repr__(self):
5153
+ video_bytes = '<video_bytes>' if self.video_bytes else 'None'
5154
+ return (
5155
+ f'Video(uri={self.uri}, video_bytes={video_bytes},'
5156
+ f' mime_type={self.mime_type})'
5157
+ )
5158
+
5159
+
5160
+ class VideoDict(TypedDict, total=False):
5161
+ """A generated video."""
5162
+
5163
+ uri: Optional[str]
5164
+ """Path to another storage."""
5165
+
5166
+ video_bytes: Optional[bytes]
5167
+ """Video bytes."""
5168
+
5169
+ mime_type: Optional[str]
5170
+ """Video encoding, for example "video/mp4"."""
5171
+
5172
+
5173
+ VideoOrDict = Union[Video, VideoDict]
5174
+
5175
+
5176
+ class GeneratedVideo(_common.BaseModel):
5177
+ """A generated video."""
5178
+
5179
+ video: Optional[Video] = Field(
5180
+ default=None, description="""The output video"""
5181
+ )
5182
+
5183
+
5184
+ class GeneratedVideoDict(TypedDict, total=False):
5185
+ """A generated video."""
5186
+
5187
+ video: Optional[VideoDict]
5188
+ """The output video"""
5189
+
5190
+
5191
+ GeneratedVideoOrDict = Union[GeneratedVideo, GeneratedVideoDict]
5192
+
5193
+
5194
+ class GenerateVideosResponse(_common.BaseModel):
5195
+ """Response with generated videos."""
5196
+
5197
+ generated_videos: Optional[list[GeneratedVideo]] = Field(
5198
+ default=None, description="""List of the generated videos"""
5199
+ )
5200
+ rai_media_filtered_count: Optional[int] = Field(
5201
+ default=None,
5202
+ description="""Returns if any videos were filtered due to RAI policies.""",
5203
+ )
5204
+ rai_media_filtered_reasons: Optional[list[str]] = Field(
5205
+ default=None, description="""Returns rai failure reasons if any."""
5206
+ )
5207
+
5208
+
5209
+ class GenerateVideosResponseDict(TypedDict, total=False):
5210
+ """Response with generated videos."""
5211
+
5212
+ generated_videos: Optional[list[GeneratedVideoDict]]
5213
+ """List of the generated videos"""
5214
+
5215
+ rai_media_filtered_count: Optional[int]
5216
+ """Returns if any videos were filtered due to RAI policies."""
5217
+
5218
+ rai_media_filtered_reasons: Optional[list[str]]
5219
+ """Returns rai failure reasons if any."""
5220
+
5221
+
5222
+ GenerateVideosResponseOrDict = Union[
5223
+ GenerateVideosResponse, GenerateVideosResponseDict
5224
+ ]
5225
+
5226
+
5227
+ class GenerateVideosOperation(_common.BaseModel):
5228
+ """A video generation operation.
5229
+
5230
+ Use the following code to refresh the operation:
5231
+
5232
+ ```
5233
+ operation = client.operations.get(operation)
5234
+ ```
5235
+ """
5236
+
5237
+ name: Optional[str] = Field(
5238
+ default=None,
5239
+ description="""The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.""",
5240
+ )
5241
+ metadata: Optional[dict[str, Any]] = Field(
5242
+ default=None,
5243
+ description="""Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.""",
5244
+ )
5245
+ done: Optional[bool] = Field(
5246
+ default=None,
5247
+ description="""If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.""",
5248
+ )
5249
+ error: Optional[dict[str, Any]] = Field(
5250
+ default=None,
5251
+ description="""The error result of the operation in case of failure or cancellation.""",
5252
+ )
5253
+ response: Optional[dict[str, Any]] = Field(
5254
+ default=None,
5255
+ description="""The normal response of the operation in case of success.""",
5256
+ )
5257
+ result: Optional[GenerateVideosResponse] = Field(
5258
+ default=None, description="""The generated videos."""
5259
+ )
5260
+
5261
+
5262
+ class GenerateVideosOperationDict(TypedDict, total=False):
5263
+ """A video generation operation.
5264
+
5265
+ Use the following code to refresh the operation:
5266
+
5267
+ ```
5268
+ operation = client.operations.get(operation)
5269
+ ```
5270
+ """
5271
+
5272
+ name: Optional[str]
5273
+ """The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`."""
5274
+
5275
+ metadata: Optional[dict[str, Any]]
5276
+ """Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any."""
5277
+
5278
+ done: Optional[bool]
5279
+ """If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available."""
5280
+
5281
+ error: Optional[dict[str, Any]]
5282
+ """The error result of the operation in case of failure or cancellation."""
5283
+
5284
+ response: Optional[dict[str, Any]]
5285
+ """The normal response of the operation in case of success."""
5286
+
5287
+ result: Optional[GenerateVideosResponseDict]
5288
+ """The generated videos."""
5289
+
5290
+
5291
+ GenerateVideosOperationOrDict = Union[
5292
+ GenerateVideosOperation, GenerateVideosOperationDict
5293
+ ]
5294
+
5295
+
4838
5296
  class GetTuningJobConfig(_common.BaseModel):
4839
5297
  """Optional parameters for tunings.get method."""
4840
5298
 
@@ -7764,19 +8222,17 @@ class RawReferenceImage(_common.BaseModel):
7764
8222
  default=None, description="""The id of the reference image."""
7765
8223
  )
7766
8224
  reference_type: Optional[str] = Field(
7767
- default=None, description="""The type of the reference image."""
8225
+ default=None,
8226
+ description="""The type of the reference image. Only set by the SDK.""",
7768
8227
  )
7769
8228
 
7770
- def __init__(
7771
- self,
7772
- reference_image: Optional[Image] = None,
7773
- reference_id: Optional[int] = None,
7774
- ):
7775
- super().__init__(
7776
- reference_image=reference_image,
7777
- reference_id=reference_id,
7778
- reference_type='REFERENCE_TYPE_RAW',
7779
- )
8229
+ @pydantic.model_validator(mode='before')
8230
+ @classmethod
8231
+ def _validate_mask_image_config(self, values):
8232
+ if 'reference_type' in values:
8233
+ raise ValueError('Cannot set internal reference_type field directly.')
8234
+ values['reference_type'] = 'REFERENCE_TYPE_RAW'
8235
+ return values
7780
8236
 
7781
8237
 
7782
8238
  class RawReferenceImageDict(TypedDict, total=False):
@@ -7794,7 +8250,7 @@ class RawReferenceImageDict(TypedDict, total=False):
7794
8250
  """The id of the reference image."""
7795
8251
 
7796
8252
  reference_type: Optional[str]
7797
- """The type of the reference image."""
8253
+ """The type of the reference image. Only set by the SDK."""
7798
8254
 
7799
8255
 
7800
8256
  RawReferenceImageOrDict = Union[RawReferenceImage, RawReferenceImageDict]
@@ -7820,7 +8276,8 @@ class MaskReferenceImage(_common.BaseModel):
7820
8276
  default=None, description="""The id of the reference image."""
7821
8277
  )
7822
8278
  reference_type: Optional[str] = Field(
7823
- default=None, description="""The type of the reference image."""
8279
+ default=None,
8280
+ description="""The type of the reference image. Only set by the SDK.""",
7824
8281
  )
7825
8282
  config: Optional[MaskReferenceConfig] = Field(
7826
8283
  default=None,
@@ -7831,18 +8288,15 @@ class MaskReferenceImage(_common.BaseModel):
7831
8288
  default=None, description=""""""
7832
8289
  )
7833
8290
 
7834
- def __init__(
7835
- self,
7836
- reference_image: Optional[Image] = None,
7837
- reference_id: Optional[int] = None,
7838
- config: Optional['MaskReferenceConfig'] = None,
7839
- ):
7840
- super().__init__(
7841
- reference_image=reference_image,
7842
- reference_id=reference_id,
7843
- reference_type='REFERENCE_TYPE_MASK',
7844
- )
7845
- self.mask_image_config = config
8291
+ @pydantic.model_validator(mode='before')
8292
+ @classmethod
8293
+ def _validate_mask_image_config(self, values):
8294
+ config = values.get('config', None)
8295
+ values['mask_image_config'] = config
8296
+ if 'reference_type' in values:
8297
+ raise ValueError('Cannot set internal reference_type field directly.')
8298
+ values['reference_type'] = 'REFERENCE_TYPE_MASK'
8299
+ return values
7846
8300
 
7847
8301
 
7848
8302
  class MaskReferenceImageDict(TypedDict, total=False):
@@ -7864,7 +8318,7 @@ class MaskReferenceImageDict(TypedDict, total=False):
7864
8318
  """The id of the reference image."""
7865
8319
 
7866
8320
  reference_type: Optional[str]
7867
- """The type of the reference image."""
8321
+ """The type of the reference image. Only set by the SDK."""
7868
8322
 
7869
8323
  config: Optional[MaskReferenceConfigDict]
7870
8324
  """Configuration for the mask reference image."""
@@ -7893,7 +8347,8 @@ class ControlReferenceImage(_common.BaseModel):
7893
8347
  default=None, description="""The id of the reference image."""
7894
8348
  )
7895
8349
  reference_type: Optional[str] = Field(
7896
- default=None, description="""The type of the reference image."""
8350
+ default=None,
8351
+ description="""The type of the reference image. Only set by the SDK.""",
7897
8352
  )
7898
8353
  config: Optional[ControlReferenceConfig] = Field(
7899
8354
  default=None,
@@ -7904,18 +8359,15 @@ class ControlReferenceImage(_common.BaseModel):
7904
8359
  default=None, description=""""""
7905
8360
  )
7906
8361
 
7907
- def __init__(
7908
- self,
7909
- reference_image: Optional[Image] = None,
7910
- reference_id: Optional[int] = None,
7911
- config: Optional['ControlReferenceConfig'] = None,
7912
- ):
7913
- super().__init__(
7914
- reference_image=reference_image,
7915
- reference_id=reference_id,
7916
- reference_type='REFERENCE_TYPE_CONTROL',
7917
- )
7918
- self.control_image_config = config
8362
+ @pydantic.model_validator(mode='before')
8363
+ @classmethod
8364
+ def _validate_mask_image_config(self, values):
8365
+ config = values.get('config', None)
8366
+ values['control_image_config'] = config
8367
+ if 'reference_type' in values:
8368
+ raise ValueError('Cannot set internal reference_type field directly.')
8369
+ values['reference_type'] = 'REFERENCE_TYPE_CONTROL'
8370
+ return values
7919
8371
 
7920
8372
 
7921
8373
  class ControlReferenceImageDict(TypedDict, total=False):
@@ -7937,7 +8389,7 @@ class ControlReferenceImageDict(TypedDict, total=False):
7937
8389
  """The id of the reference image."""
7938
8390
 
7939
8391
  reference_type: Optional[str]
7940
- """The type of the reference image."""
8392
+ """The type of the reference image. Only set by the SDK."""
7941
8393
 
7942
8394
  config: Optional[ControlReferenceConfigDict]
7943
8395
  """Configuration for the control reference image."""
@@ -7966,7 +8418,8 @@ class StyleReferenceImage(_common.BaseModel):
7966
8418
  default=None, description="""The id of the reference image."""
7967
8419
  )
7968
8420
  reference_type: Optional[str] = Field(
7969
- default=None, description="""The type of the reference image."""
8421
+ default=None,
8422
+ description="""The type of the reference image. Only set by the SDK.""",
7970
8423
  )
7971
8424
  config: Optional[StyleReferenceConfig] = Field(
7972
8425
  default=None,
@@ -7977,18 +8430,15 @@ class StyleReferenceImage(_common.BaseModel):
7977
8430
  default=None, description=""""""
7978
8431
  )
7979
8432
 
7980
- def __init__(
7981
- self,
7982
- reference_image: Optional[Image] = None,
7983
- reference_id: Optional[int] = None,
7984
- config: Optional['StyleReferenceConfig'] = None,
7985
- ):
7986
- super().__init__(
7987
- reference_image=reference_image,
7988
- reference_id=reference_id,
7989
- reference_type='REFERENCE_TYPE_STYLE',
7990
- )
7991
- self.style_image_config = config
8433
+ @pydantic.model_validator(mode='before')
8434
+ @classmethod
8435
+ def _validate_mask_image_config(self, values):
8436
+ config = values.get('config', None)
8437
+ values['style_image_config'] = config
8438
+ if 'reference_type' in values:
8439
+ raise ValueError('Cannot set internal reference_type field directly.')
8440
+ values['reference_type'] = 'REFERENCE_TYPE_STYLE'
8441
+ return values
7992
8442
 
7993
8443
 
7994
8444
  class StyleReferenceImageDict(TypedDict, total=False):
@@ -8008,7 +8458,7 @@ class StyleReferenceImageDict(TypedDict, total=False):
8008
8458
  """The id of the reference image."""
8009
8459
 
8010
8460
  reference_type: Optional[str]
8011
- """The type of the reference image."""
8461
+ """The type of the reference image. Only set by the SDK."""
8012
8462
 
8013
8463
  config: Optional[StyleReferenceConfigDict]
8014
8464
  """Configuration for the style reference image."""
@@ -8035,7 +8485,8 @@ class SubjectReferenceImage(_common.BaseModel):
8035
8485
  default=None, description="""The id of the reference image."""
8036
8486
  )
8037
8487
  reference_type: Optional[str] = Field(
8038
- default=None, description="""The type of the reference image."""
8488
+ default=None,
8489
+ description="""The type of the reference image. Only set by the SDK.""",
8039
8490
  )
8040
8491
  config: Optional[SubjectReferenceConfig] = Field(
8041
8492
  default=None,
@@ -8046,18 +8497,15 @@ class SubjectReferenceImage(_common.BaseModel):
8046
8497
  default=None, description=""""""
8047
8498
  )
8048
8499
 
8049
- def __init__(
8050
- self,
8051
- reference_image: Optional[Image] = None,
8052
- reference_id: Optional[int] = None,
8053
- config: Optional['SubjectReferenceConfig'] = None,
8054
- ):
8055
- super().__init__(
8056
- reference_image=reference_image,
8057
- reference_id=reference_id,
8058
- reference_type='REFERENCE_TYPE_SUBJECT',
8059
- )
8060
- self.subject_image_config = config
8500
+ @pydantic.model_validator(mode='before')
8501
+ @classmethod
8502
+ def _validate_mask_image_config(self, values):
8503
+ config = values.get('config', None)
8504
+ values['subject_image_config'] = config
8505
+ if 'reference_type' in values:
8506
+ raise ValueError('Cannot set internal reference_type field directly.')
8507
+ values['reference_type'] = 'REFERENCE_TYPE_SUBJECT'
8508
+ return values
8061
8509
 
8062
8510
 
8063
8511
  class SubjectReferenceImageDict(TypedDict, total=False):
@@ -8077,7 +8525,7 @@ class SubjectReferenceImageDict(TypedDict, total=False):
8077
8525
  """The id of the reference image."""
8078
8526
 
8079
8527
  reference_type: Optional[str]
8080
- """The type of the reference image."""
8528
+ """The type of the reference image. Only set by the SDK."""
8081
8529
 
8082
8530
  config: Optional[SubjectReferenceConfigDict]
8083
8531
  """Configuration for the subject reference image."""
@@ -8298,7 +8746,7 @@ The following fields are supported:
8298
8746
  Note: only text should be used in parts and content in each part will be
8299
8747
  in a separate paragraph.""",
8300
8748
  )
8301
- tools: Optional[list[Tool]] = Field(
8749
+ tools: Optional[ToolListUnion] = Field(
8302
8750
  default=None,
8303
8751
  description=""" A list of `Tools` the model may use to generate the next response.
8304
8752
 
@@ -8335,7 +8783,7 @@ The following fields are supported:
8335
8783
  Note: only text should be used in parts and content in each part will be
8336
8784
  in a separate paragraph."""
8337
8785
 
8338
- tools: Optional[list[ToolDict]]
8786
+ tools: Optional[ToolListUnionDict]
8339
8787
  """ A list of `Tools` the model may use to generate the next response.
8340
8788
 
8341
8789
  A `Tool` is a piece of code that enables the system to interact with
@@ -8547,7 +8995,7 @@ class LiveConnectConfig(_common.BaseModel):
8547
8995
  Note: only text should be used in parts and content in each part will be
8548
8996
  in a separate paragraph.""",
8549
8997
  )
8550
- tools: Optional[list[Tool]] = Field(
8998
+ tools: Optional[ToolListUnion] = Field(
8551
8999
  default=None,
8552
9000
  description="""A list of `Tools` the model may use to generate the next response.
8553
9001
 
@@ -8577,7 +9025,7 @@ class LiveConnectConfigDict(TypedDict, total=False):
8577
9025
  Note: only text should be used in parts and content in each part will be
8578
9026
  in a separate paragraph."""
8579
9027
 
8580
- tools: Optional[list[ToolDict]]
9028
+ tools: Optional[ToolListUnionDict]
8581
9029
  """A list of `Tools` the model may use to generate the next response.
8582
9030
 
8583
9031
  A `Tool` is a piece of code that enables the system to interact with