google-genai 1.27.0__py3-none-any.whl → 1.29.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
@@ -241,6 +241,10 @@ class UrlRetrievalStatus(_common.CaseInSensitiveEnum):
241
241
  """Url retrieval is successful."""
242
242
  URL_RETRIEVAL_STATUS_ERROR = 'URL_RETRIEVAL_STATUS_ERROR'
243
243
  """Url retrieval is failed due to error."""
244
+ URL_RETRIEVAL_STATUS_PAYWALL = 'URL_RETRIEVAL_STATUS_PAYWALL'
245
+ """Url retrieval is failed because the content is behind paywall."""
246
+ URL_RETRIEVAL_STATUS_UNSAFE = 'URL_RETRIEVAL_STATUS_UNSAFE'
247
+ """Url retrieval is failed because the content is unsafe."""
244
248
 
245
249
 
246
250
  class FinishReason(_common.CaseInSensitiveEnum):
@@ -672,6 +676,22 @@ class Scale(_common.CaseInSensitiveEnum):
672
676
  """B major or Ab minor."""
673
677
 
674
678
 
679
+ class MusicGenerationMode(_common.CaseInSensitiveEnum):
680
+ """The mode of music generation."""
681
+
682
+ MUSIC_GENERATION_MODE_UNSPECIFIED = 'MUSIC_GENERATION_MODE_UNSPECIFIED'
683
+ """Rely on the server default generation mode."""
684
+ QUALITY = 'QUALITY'
685
+ """Steer text prompts to regions of latent space with higher quality
686
+ music."""
687
+ DIVERSITY = 'DIVERSITY'
688
+ """Steer text prompts to regions of latent space with a larger
689
+ diversity of music."""
690
+ VOCALIZATION = 'VOCALIZATION'
691
+ """Steer text prompts to regions of latent space more likely to
692
+ generate music with vocals."""
693
+
694
+
675
695
  class LiveMusicPlaybackControl(_common.CaseInSensitiveEnum):
676
696
  """The playback control signal to apply to the music generation."""
677
697
 
@@ -2092,20 +2112,50 @@ class FunctionDeclaration(_common.BaseModel):
2092
2112
  from . import _automatic_function_calling_util
2093
2113
 
2094
2114
  parameters_properties = {}
2115
+ parameters_json_schema = {}
2095
2116
  annotation_under_future = typing.get_type_hints(callable)
2096
- for name, param in inspect.signature(callable).parameters.items():
2097
- if param.kind in (
2098
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
2099
- inspect.Parameter.KEYWORD_ONLY,
2100
- inspect.Parameter.POSITIONAL_ONLY,
2101
- ):
2102
- # This snippet catches the case when type hints are stored as strings
2103
- if isinstance(param.annotation, str):
2104
- param = param.replace(annotation=annotation_under_future[name])
2105
- schema = _automatic_function_calling_util._parse_schema_from_parameter(
2106
- api_option, param, callable.__name__
2107
- )
2108
- parameters_properties[name] = schema
2117
+ try:
2118
+ for name, param in inspect.signature(callable).parameters.items():
2119
+ if param.kind in (
2120
+ inspect.Parameter.POSITIONAL_OR_KEYWORD,
2121
+ inspect.Parameter.KEYWORD_ONLY,
2122
+ inspect.Parameter.POSITIONAL_ONLY,
2123
+ ):
2124
+ param = _automatic_function_calling_util._handle_params_as_deferred_annotations(
2125
+ param, annotation_under_future, name
2126
+ )
2127
+ schema = (
2128
+ _automatic_function_calling_util._parse_schema_from_parameter(
2129
+ api_option, param, callable.__name__
2130
+ )
2131
+ )
2132
+ parameters_properties[name] = schema
2133
+ except ValueError:
2134
+ parameters_properties = {}
2135
+ for name, param in inspect.signature(callable).parameters.items():
2136
+ if param.kind in (
2137
+ inspect.Parameter.POSITIONAL_OR_KEYWORD,
2138
+ inspect.Parameter.KEYWORD_ONLY,
2139
+ inspect.Parameter.POSITIONAL_ONLY,
2140
+ ):
2141
+ try:
2142
+ param = _automatic_function_calling_util._handle_params_as_deferred_annotations(
2143
+ param, annotation_under_future, name
2144
+ )
2145
+ param_schema_adapter = pydantic.TypeAdapter(
2146
+ param.annotation,
2147
+ config=pydantic.ConfigDict(arbitrary_types_allowed=True),
2148
+ )
2149
+ json_schema_dict = param_schema_adapter.json_schema()
2150
+ json_schema_dict = _automatic_function_calling_util._add_unevaluated_items_to_fixed_len_tuple_schema(
2151
+ json_schema_dict
2152
+ )
2153
+ parameters_json_schema[name] = json_schema_dict
2154
+ except Exception as e:
2155
+ _automatic_function_calling_util._raise_for_unsupported_param(
2156
+ param, callable.__name__, e
2157
+ )
2158
+
2109
2159
  declaration = FunctionDeclaration(
2110
2160
  name=callable.__name__,
2111
2161
  description=inspect.cleandoc(callable.__doc__)
@@ -2123,6 +2173,8 @@ class FunctionDeclaration(_common.BaseModel):
2123
2173
  declaration.parameters
2124
2174
  )
2125
2175
  )
2176
+ elif parameters_json_schema:
2177
+ declaration.parameters_json_schema = parameters_json_schema
2126
2178
  # TODO: b/421991354 - Remove this check once the bug is fixed.
2127
2179
  if api_option == 'GEMINI_API':
2128
2180
  return declaration
@@ -2142,13 +2194,39 @@ class FunctionDeclaration(_common.BaseModel):
2142
2194
  return_value = return_value.replace(
2143
2195
  annotation=annotation_under_future['return']
2144
2196
  )
2145
- declaration.response = (
2146
- _automatic_function_calling_util._parse_schema_from_parameter(
2147
- api_option,
2148
- return_value,
2149
- callable.__name__,
2197
+ response_schema: Optional[Schema] = None
2198
+ response_json_schema: Optional[Union[dict[str, Any], Schema]] = {}
2199
+ try:
2200
+ response_schema = (
2201
+ _automatic_function_calling_util._parse_schema_from_parameter(
2202
+ api_option,
2203
+ return_value,
2204
+ callable.__name__,
2205
+ )
2206
+ )
2207
+ if response_schema.any_of is not None:
2208
+ # To handle any_of, we need to use responseJsonSchema
2209
+ response_json_schema = response_schema
2210
+ response_schema = None
2211
+ except ValueError:
2212
+ try:
2213
+ return_value_schema_adapter = pydantic.TypeAdapter(
2214
+ return_value.annotation,
2215
+ config=pydantic.ConfigDict(arbitrary_types_allowed=True),
2150
2216
  )
2151
- )
2217
+ response_json_schema = return_value_schema_adapter.json_schema()
2218
+ response_json_schema = _automatic_function_calling_util._add_unevaluated_items_to_fixed_len_tuple_schema(
2219
+ response_json_schema
2220
+ )
2221
+ except Exception as e:
2222
+ _automatic_function_calling_util._raise_for_unsupported_param(
2223
+ return_value, callable.__name__, e
2224
+ )
2225
+
2226
+ if response_schema:
2227
+ declaration.response = response_schema
2228
+ elif response_json_schema:
2229
+ declaration.response_json_schema = response_json_schema
2152
2230
  return declaration
2153
2231
 
2154
2232
  @classmethod
@@ -3676,19 +3754,25 @@ class FileDict(TypedDict, total=False):
3676
3754
 
3677
3755
  FileOrDict = Union[File, FileDict]
3678
3756
 
3757
+
3679
3758
  if _is_pillow_image_imported:
3680
- PartUnion = Union[File, Part, PIL_Image, str]
3759
+ PartUnion = Union[str, PIL_Image, File, Part]
3681
3760
  else:
3682
- PartUnion = Union[File, Part, str] # type: ignore[misc]
3761
+ PartUnion = Union[str, File, Part] # type: ignore[misc]
3683
3762
 
3684
3763
 
3685
- PartUnionDict = Union[PartUnion, PartDict]
3764
+ if _is_pillow_image_imported:
3765
+ PartUnionDict = Union[str, PIL_Image, File, FileDict, Part, PartDict]
3766
+ else:
3767
+ PartUnionDict = Union[str, File, FileDict, Part, PartDict] # type: ignore[misc]
3686
3768
 
3687
3769
 
3688
- ContentUnion = Union[Content, list[PartUnion], PartUnion]
3770
+ ContentUnion = Union[Content, PartUnion, list[PartUnion]]
3689
3771
 
3690
3772
 
3691
- ContentUnionDict = Union[ContentUnion, ContentDict]
3773
+ ContentUnionDict = Union[
3774
+ Content, ContentDict, PartUnionDict, list[PartUnionDict]
3775
+ ]
3692
3776
 
3693
3777
 
3694
3778
  class GenerationConfigRoutingConfigAutoRoutingMode(_common.BaseModel):
@@ -3764,10 +3848,10 @@ GenerationConfigRoutingConfigOrDict = Union[
3764
3848
  ]
3765
3849
 
3766
3850
 
3767
- SpeechConfigUnion = Union[SpeechConfig, str]
3851
+ SpeechConfigUnion = Union[str, SpeechConfig]
3768
3852
 
3769
3853
 
3770
- SpeechConfigUnionDict = Union[SpeechConfigUnion, SpeechConfigDict]
3854
+ SpeechConfigUnionDict = Union[str, SpeechConfig, SpeechConfigDict]
3771
3855
 
3772
3856
 
3773
3857
  class GenerateContentConfig(_common.BaseModel):
@@ -4160,10 +4244,10 @@ GenerateContentConfigOrDict = Union[
4160
4244
  ]
4161
4245
 
4162
4246
 
4163
- ContentListUnion = Union[list[ContentUnion], ContentUnion]
4247
+ ContentListUnion = Union[ContentUnion, list[ContentUnion]]
4164
4248
 
4165
4249
 
4166
- ContentListUnionDict = Union[list[ContentUnionDict], ContentUnionDict]
4250
+ ContentListUnionDict = Union[ContentUnionDict, list[ContentUnionDict]]
4167
4251
 
4168
4252
 
4169
4253
  class _GenerateContentParameters(_common.BaseModel):
@@ -5118,11 +5202,6 @@ class GenerateContentResponse(_common.BaseModel):
5118
5202
  description="""Timestamp when the request is made to the server.
5119
5203
  """,
5120
5204
  )
5121
- response_id: Optional[str] = Field(
5122
- default=None,
5123
- description="""Identifier for each response.
5124
- """,
5125
- )
5126
5205
  model_version: Optional[str] = Field(
5127
5206
  default=None,
5128
5207
  description="""Output only. The model version used to generate the response.""",
@@ -5131,6 +5210,10 @@ class GenerateContentResponse(_common.BaseModel):
5131
5210
  default=None,
5132
5211
  description="""Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.""",
5133
5212
  )
5213
+ response_id: Optional[str] = Field(
5214
+ default=None,
5215
+ description="""Output only. response_id is used to identify each response. It is the encoding of the event_id.""",
5216
+ )
5134
5217
  usage_metadata: Optional[GenerateContentResponseUsageMetadata] = Field(
5135
5218
  default=None, description="""Usage metadata about the response(s)."""
5136
5219
  )
@@ -5377,16 +5460,15 @@ class GenerateContentResponseDict(TypedDict, total=False):
5377
5460
  """Timestamp when the request is made to the server.
5378
5461
  """
5379
5462
 
5380
- response_id: Optional[str]
5381
- """Identifier for each response.
5382
- """
5383
-
5384
5463
  model_version: Optional[str]
5385
5464
  """Output only. The model version used to generate the response."""
5386
5465
 
5387
5466
  prompt_feedback: Optional[GenerateContentResponsePromptFeedbackDict]
5388
5467
  """Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations."""
5389
5468
 
5469
+ response_id: Optional[str]
5470
+ """Output only. response_id is used to identify each response. It is the encoding of the event_id."""
5471
+
5390
5472
  usage_metadata: Optional[GenerateContentResponseUsageMetadataDict]
5391
5473
  """Usage metadata about the response(s)."""
5392
5474
 
@@ -5606,6 +5688,9 @@ EmbedContentMetadataOrDict = Union[
5606
5688
  class EmbedContentResponse(_common.BaseModel):
5607
5689
  """Response for the embed_content method."""
5608
5690
 
5691
+ sdk_http_response: Optional[HttpResponse] = Field(
5692
+ default=None, description="""Used to retain the full HTTP response."""
5693
+ )
5609
5694
  embeddings: Optional[list[ContentEmbedding]] = Field(
5610
5695
  default=None,
5611
5696
  description="""The embeddings for each request, in the same order as provided in
@@ -5622,6 +5707,9 @@ class EmbedContentResponse(_common.BaseModel):
5622
5707
  class EmbedContentResponseDict(TypedDict, total=False):
5623
5708
  """Response for the embed_content method."""
5624
5709
 
5710
+ sdk_http_response: Optional[HttpResponseDict]
5711
+ """Used to retain the full HTTP response."""
5712
+
5625
5713
  embeddings: Optional[list[ContentEmbeddingDict]]
5626
5714
  """The embeddings for each request, in the same order as provided in
5627
5715
  the batch request.
@@ -6111,6 +6199,9 @@ GeneratedImageOrDict = Union[GeneratedImage, GeneratedImageDict]
6111
6199
  class GenerateImagesResponse(_common.BaseModel):
6112
6200
  """The output images response."""
6113
6201
 
6202
+ sdk_http_response: Optional[HttpResponse] = Field(
6203
+ default=None, description="""Used to retain the full HTTP response."""
6204
+ )
6114
6205
  generated_images: Optional[list[GeneratedImage]] = Field(
6115
6206
  default=None,
6116
6207
  description="""List of generated images.
@@ -6123,10 +6214,24 @@ class GenerateImagesResponse(_common.BaseModel):
6123
6214
  """,
6124
6215
  )
6125
6216
 
6217
+ @property
6218
+ def images(self) -> list[Optional[Image]]:
6219
+ """Returns the list of all generated images.
6220
+
6221
+ A convenience method for accessing the images. Some attributes of the
6222
+ generated image are only available through the ``GeneratedImage`` object.
6223
+ """
6224
+ if not self.generated_images:
6225
+ return []
6226
+ return [generated_image.image for generated_image in self.generated_images]
6227
+
6126
6228
 
6127
6229
  class GenerateImagesResponseDict(TypedDict, total=False):
6128
6230
  """The output images response."""
6129
6231
 
6232
+ sdk_http_response: Optional[HttpResponseDict]
6233
+ """Used to retain the full HTTP response."""
6234
+
6130
6235
  generated_images: Optional[list[GeneratedImageDict]]
6131
6236
  """List of generated images.
6132
6237
  """
@@ -6537,6 +6642,9 @@ _EditImageParametersOrDict = Union[
6537
6642
  class EditImageResponse(_common.BaseModel):
6538
6643
  """Response for the request to edit an image."""
6539
6644
 
6645
+ sdk_http_response: Optional[HttpResponse] = Field(
6646
+ default=None, description="""Used to retain the full HTTP response."""
6647
+ )
6540
6648
  generated_images: Optional[list[GeneratedImage]] = Field(
6541
6649
  default=None, description="""Generated images."""
6542
6650
  )
@@ -6545,6 +6653,9 @@ class EditImageResponse(_common.BaseModel):
6545
6653
  class EditImageResponseDict(TypedDict, total=False):
6546
6654
  """Response for the request to edit an image."""
6547
6655
 
6656
+ sdk_http_response: Optional[HttpResponseDict]
6657
+ """Used to retain the full HTTP response."""
6658
+
6548
6659
  generated_images: Optional[list[GeneratedImageDict]]
6549
6660
  """Generated images."""
6550
6661
 
@@ -6678,6 +6789,9 @@ _UpscaleImageAPIParametersOrDict = Union[
6678
6789
 
6679
6790
  class UpscaleImageResponse(_common.BaseModel):
6680
6791
 
6792
+ sdk_http_response: Optional[HttpResponse] = Field(
6793
+ default=None, description="""Used to retain the full HTTP response."""
6794
+ )
6681
6795
  generated_images: Optional[list[GeneratedImage]] = Field(
6682
6796
  default=None, description="""Generated images."""
6683
6797
  )
@@ -6685,6 +6799,9 @@ class UpscaleImageResponse(_common.BaseModel):
6685
6799
 
6686
6800
  class UpscaleImageResponseDict(TypedDict, total=False):
6687
6801
 
6802
+ sdk_http_response: Optional[HttpResponseDict]
6803
+ """Used to retain the full HTTP response."""
6804
+
6688
6805
  generated_images: Optional[list[GeneratedImageDict]]
6689
6806
  """Generated images."""
6690
6807
 
@@ -6694,6 +6811,204 @@ UpscaleImageResponseOrDict = Union[
6694
6811
  ]
6695
6812
 
6696
6813
 
6814
+ class ProductImage(_common.BaseModel):
6815
+ """An image of the product."""
6816
+
6817
+ product_image: Optional[Image] = Field(
6818
+ default=None,
6819
+ description="""An image of the product to be recontextualized.""",
6820
+ )
6821
+
6822
+
6823
+ class ProductImageDict(TypedDict, total=False):
6824
+ """An image of the product."""
6825
+
6826
+ product_image: Optional[ImageDict]
6827
+ """An image of the product to be recontextualized."""
6828
+
6829
+
6830
+ ProductImageOrDict = Union[ProductImage, ProductImageDict]
6831
+
6832
+
6833
+ class RecontextImageSource(_common.BaseModel):
6834
+ """A set of source input(s) for image recontextualization."""
6835
+
6836
+ prompt: Optional[str] = Field(
6837
+ default=None,
6838
+ description="""A text prompt for guiding the model during image
6839
+ recontextualization. Not supported for Virtual Try-On.""",
6840
+ )
6841
+ person_image: Optional[Image] = Field(
6842
+ default=None,
6843
+ description="""Image of the person or subject who will be wearing the
6844
+ product(s).""",
6845
+ )
6846
+ product_images: Optional[list[ProductImage]] = Field(
6847
+ default=None, description="""A list of product images."""
6848
+ )
6849
+
6850
+
6851
+ class RecontextImageSourceDict(TypedDict, total=False):
6852
+ """A set of source input(s) for image recontextualization."""
6853
+
6854
+ prompt: Optional[str]
6855
+ """A text prompt for guiding the model during image
6856
+ recontextualization. Not supported for Virtual Try-On."""
6857
+
6858
+ person_image: Optional[ImageDict]
6859
+ """Image of the person or subject who will be wearing the
6860
+ product(s)."""
6861
+
6862
+ product_images: Optional[list[ProductImageDict]]
6863
+ """A list of product images."""
6864
+
6865
+
6866
+ RecontextImageSourceOrDict = Union[
6867
+ RecontextImageSource, RecontextImageSourceDict
6868
+ ]
6869
+
6870
+
6871
+ class RecontextImageConfig(_common.BaseModel):
6872
+ """Configuration for recontextualizing an image."""
6873
+
6874
+ http_options: Optional[HttpOptions] = Field(
6875
+ default=None, description="""Used to override HTTP request options."""
6876
+ )
6877
+ number_of_images: Optional[int] = Field(
6878
+ default=None, description="""Number of images to generate."""
6879
+ )
6880
+ base_steps: Optional[int] = Field(
6881
+ default=None,
6882
+ description="""The number of sampling steps. A higher value has better image
6883
+ quality, while a lower value has better latency.""",
6884
+ )
6885
+ output_gcs_uri: Optional[str] = Field(
6886
+ default=None,
6887
+ description="""Cloud Storage URI used to store the generated images.""",
6888
+ )
6889
+ seed: Optional[int] = Field(
6890
+ default=None, description="""Random seed for image generation."""
6891
+ )
6892
+ safety_filter_level: Optional[SafetyFilterLevel] = Field(
6893
+ default=None, description="""Filter level for safety filtering."""
6894
+ )
6895
+ person_generation: Optional[PersonGeneration] = Field(
6896
+ default=None,
6897
+ description="""Whether allow to generate person images, and restrict to specific
6898
+ ages.""",
6899
+ )
6900
+ output_mime_type: Optional[str] = Field(
6901
+ default=None, description="""MIME type of the generated image."""
6902
+ )
6903
+ output_compression_quality: Optional[int] = Field(
6904
+ default=None,
6905
+ description="""Compression quality of the generated image (for ``image/jpeg``
6906
+ only).""",
6907
+ )
6908
+ enhance_prompt: Optional[bool] = Field(
6909
+ default=None, description="""Whether to use the prompt rewriting logic."""
6910
+ )
6911
+
6912
+
6913
+ class RecontextImageConfigDict(TypedDict, total=False):
6914
+ """Configuration for recontextualizing an image."""
6915
+
6916
+ http_options: Optional[HttpOptionsDict]
6917
+ """Used to override HTTP request options."""
6918
+
6919
+ number_of_images: Optional[int]
6920
+ """Number of images to generate."""
6921
+
6922
+ base_steps: Optional[int]
6923
+ """The number of sampling steps. A higher value has better image
6924
+ quality, while a lower value has better latency."""
6925
+
6926
+ output_gcs_uri: Optional[str]
6927
+ """Cloud Storage URI used to store the generated images."""
6928
+
6929
+ seed: Optional[int]
6930
+ """Random seed for image generation."""
6931
+
6932
+ safety_filter_level: Optional[SafetyFilterLevel]
6933
+ """Filter level for safety filtering."""
6934
+
6935
+ person_generation: Optional[PersonGeneration]
6936
+ """Whether allow to generate person images, and restrict to specific
6937
+ ages."""
6938
+
6939
+ output_mime_type: Optional[str]
6940
+ """MIME type of the generated image."""
6941
+
6942
+ output_compression_quality: Optional[int]
6943
+ """Compression quality of the generated image (for ``image/jpeg``
6944
+ only)."""
6945
+
6946
+ enhance_prompt: Optional[bool]
6947
+ """Whether to use the prompt rewriting logic."""
6948
+
6949
+
6950
+ RecontextImageConfigOrDict = Union[
6951
+ RecontextImageConfig, RecontextImageConfigDict
6952
+ ]
6953
+
6954
+
6955
+ class _RecontextImageParameters(_common.BaseModel):
6956
+ """The parameters for recontextualizing an image."""
6957
+
6958
+ model: Optional[str] = Field(
6959
+ default=None,
6960
+ description="""ID of the model to use. For a list of models, see `Google models
6961
+ <https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_.""",
6962
+ )
6963
+ source: Optional[RecontextImageSource] = Field(
6964
+ default=None,
6965
+ description="""A set of source input(s) for image recontextualization.""",
6966
+ )
6967
+ config: Optional[RecontextImageConfig] = Field(
6968
+ default=None,
6969
+ description="""Configuration for image recontextualization.""",
6970
+ )
6971
+
6972
+
6973
+ class _RecontextImageParametersDict(TypedDict, total=False):
6974
+ """The parameters for recontextualizing an image."""
6975
+
6976
+ model: Optional[str]
6977
+ """ID of the model to use. For a list of models, see `Google models
6978
+ <https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_."""
6979
+
6980
+ source: Optional[RecontextImageSourceDict]
6981
+ """A set of source input(s) for image recontextualization."""
6982
+
6983
+ config: Optional[RecontextImageConfigDict]
6984
+ """Configuration for image recontextualization."""
6985
+
6986
+
6987
+ _RecontextImageParametersOrDict = Union[
6988
+ _RecontextImageParameters, _RecontextImageParametersDict
6989
+ ]
6990
+
6991
+
6992
+ class RecontextImageResponse(_common.BaseModel):
6993
+ """The output images response."""
6994
+
6995
+ generated_images: Optional[list[GeneratedImage]] = Field(
6996
+ default=None, description="""List of generated images."""
6997
+ )
6998
+
6999
+
7000
+ class RecontextImageResponseDict(TypedDict, total=False):
7001
+ """The output images response."""
7002
+
7003
+ generated_images: Optional[list[GeneratedImageDict]]
7004
+ """List of generated images."""
7005
+
7006
+
7007
+ RecontextImageResponseOrDict = Union[
7008
+ RecontextImageResponse, RecontextImageResponseDict
7009
+ ]
7010
+
7011
+
6697
7012
  class GetModelConfig(_common.BaseModel):
6698
7013
  """Optional parameters for models.get method."""
6699
7014
 
@@ -7383,6 +7698,9 @@ _CountTokensParametersOrDict = Union[
7383
7698
  class CountTokensResponse(_common.BaseModel):
7384
7699
  """Response for counting tokens."""
7385
7700
 
7701
+ sdk_http_response: Optional[HttpResponse] = Field(
7702
+ default=None, description="""Used to retain the full HTTP response."""
7703
+ )
7386
7704
  total_tokens: Optional[int] = Field(
7387
7705
  default=None, description="""Total number of tokens."""
7388
7706
  )
@@ -7395,6 +7713,9 @@ class CountTokensResponse(_common.BaseModel):
7395
7713
  class CountTokensResponseDict(TypedDict, total=False):
7396
7714
  """Response for counting tokens."""
7397
7715
 
7716
+ sdk_http_response: Optional[HttpResponseDict]
7717
+ """Used to retain the full HTTP response."""
7718
+
7398
7719
  total_tokens: Optional[int]
7399
7720
  """Total number of tokens."""
7400
7721
 
@@ -7495,6 +7816,9 @@ TokensInfoOrDict = Union[TokensInfo, TokensInfoDict]
7495
7816
  class ComputeTokensResponse(_common.BaseModel):
7496
7817
  """Response for computing tokens."""
7497
7818
 
7819
+ sdk_http_response: Optional[HttpResponse] = Field(
7820
+ default=None, description="""Used to retain the full HTTP response."""
7821
+ )
7498
7822
  tokens_info: Optional[list[TokensInfo]] = Field(
7499
7823
  default=None,
7500
7824
  description="""Lists of tokens info from the input. A ComputeTokensRequest could have multiple instances with a prompt in each instance. We also need to return lists of tokens info for the request with multiple instances.""",
@@ -7504,6 +7828,9 @@ class ComputeTokensResponse(_common.BaseModel):
7504
7828
  class ComputeTokensResponseDict(TypedDict, total=False):
7505
7829
  """Response for computing tokens."""
7506
7830
 
7831
+ sdk_http_response: Optional[HttpResponseDict]
7832
+ """Used to retain the full HTTP response."""
7833
+
7507
7834
  tokens_info: Optional[list[TokensInfoDict]]
7508
7835
  """Lists of tokens info from the input. A ComputeTokensRequest could have multiple instances with a prompt in each instance. We also need to return lists of tokens info for the request with multiple instances."""
7509
7836
 
@@ -8775,6 +9102,9 @@ DistillationSpecOrDict = Union[DistillationSpec, DistillationSpecDict]
8775
9102
  class TuningJob(_common.BaseModel):
8776
9103
  """A tuning job."""
8777
9104
 
9105
+ sdk_http_response: Optional[HttpResponse] = Field(
9106
+ default=None, description="""Used to retain the full HTTP response."""
9107
+ )
8778
9108
  name: Optional[str] = Field(
8779
9109
  default=None,
8780
9110
  description="""Output only. Identifier. Resource name of a TuningJob. Format: `projects/{project}/locations/{location}/tuningJobs/{tuning_job}`""",
@@ -8874,6 +9204,9 @@ class TuningJob(_common.BaseModel):
8874
9204
  class TuningJobDict(TypedDict, total=False):
8875
9205
  """A tuning job."""
8876
9206
 
9207
+ sdk_http_response: Optional[HttpResponseDict]
9208
+ """Used to retain the full HTTP response."""
9209
+
8877
9210
  name: Optional[str]
8878
9211
  """Output only. Identifier. Resource name of a TuningJob. Format: `projects/{project}/locations/{location}/tuningJobs/{tuning_job}`"""
8879
9212
 
@@ -9228,6 +9561,9 @@ _CreateTuningJobParametersOrDict = Union[
9228
9561
  class TuningOperation(_common.BaseModel):
9229
9562
  """A long-running operation."""
9230
9563
 
9564
+ sdk_http_response: Optional[HttpResponse] = Field(
9565
+ default=None, description="""Used to retain the full HTTP response."""
9566
+ )
9231
9567
  name: Optional[str] = Field(
9232
9568
  default=None,
9233
9569
  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}`.""",
@@ -9249,6 +9585,9 @@ class TuningOperation(_common.BaseModel):
9249
9585
  class TuningOperationDict(TypedDict, total=False):
9250
9586
  """A long-running operation."""
9251
9587
 
9588
+ sdk_http_response: Optional[HttpResponseDict]
9589
+ """Used to retain the full HTTP response."""
9590
+
9252
9591
  name: Optional[str]
9253
9592
  """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}`."""
9254
9593
 
@@ -10706,6 +11045,9 @@ _DeleteBatchJobParametersOrDict = Union[
10706
11045
  class DeleteResourceJob(_common.BaseModel):
10707
11046
  """The return value of delete operation."""
10708
11047
 
11048
+ sdk_http_response: Optional[HttpResponse] = Field(
11049
+ default=None, description="""Used to retain the full HTTP response."""
11050
+ )
10709
11051
  name: Optional[str] = Field(default=None, description="""""")
10710
11052
  done: Optional[bool] = Field(default=None, description="""""")
10711
11053
  error: Optional[JobError] = Field(default=None, description="""""")
@@ -10714,6 +11056,9 @@ class DeleteResourceJob(_common.BaseModel):
10714
11056
  class DeleteResourceJobDict(TypedDict, total=False):
10715
11057
  """The return value of delete operation."""
10716
11058
 
11059
+ sdk_http_response: Optional[HttpResponseDict]
11060
+ """Used to retain the full HTTP response."""
11061
+
10717
11062
  name: Optional[str]
10718
11063
  """"""
10719
11064
 
@@ -12535,13 +12880,17 @@ LiveClientRealtimeInputOrDict = Union[
12535
12880
  LiveClientRealtimeInput, LiveClientRealtimeInputDict
12536
12881
  ]
12537
12882
 
12883
+
12538
12884
  if _is_pillow_image_imported:
12539
- BlobImageUnion = Union[Blob, PIL_Image]
12885
+ BlobImageUnion = Union[PIL_Image, Blob]
12540
12886
  else:
12541
12887
  BlobImageUnion = Blob # type: ignore[misc]
12542
12888
 
12543
12889
 
12544
- BlobImageUnionDict = Union[BlobImageUnion, BlobDict]
12890
+ if _is_pillow_image_imported:
12891
+ BlobImageUnionDict = Union[PIL_Image, Blob, BlobDict]
12892
+ else:
12893
+ BlobImageUnionDict = Union[Blob, BlobDict] # type: ignore[misc]
12545
12894
 
12546
12895
 
12547
12896
  class LiveSendRealtimeInputParameters(_common.BaseModel):
@@ -13061,6 +13410,10 @@ class LiveMusicGenerationConfig(_common.BaseModel):
13061
13410
  default=None,
13062
13411
  description="""Whether the audio output should contain only bass and drums.""",
13063
13412
  )
13413
+ music_generation_mode: Optional[MusicGenerationMode] = Field(
13414
+ default=None,
13415
+ description="""The mode of music generation. Default mode is QUALITY.""",
13416
+ )
13064
13417
 
13065
13418
 
13066
13419
  class LiveMusicGenerationConfigDict(TypedDict, total=False):
@@ -13104,6 +13457,9 @@ class LiveMusicGenerationConfigDict(TypedDict, total=False):
13104
13457
  only_bass_and_drums: Optional[bool]
13105
13458
  """Whether the audio output should contain only bass and drums."""
13106
13459
 
13460
+ music_generation_mode: Optional[MusicGenerationMode]
13461
+ """The mode of music generation. Default mode is QUALITY."""
13462
+
13107
13463
 
13108
13464
  LiveMusicGenerationConfigOrDict = Union[
13109
13465
  LiveMusicGenerationConfig, LiveMusicGenerationConfigDict
google/genai/version.py CHANGED
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
  #
15
15
 
16
- __version__ = '1.27.0' # x-release-please-version
16
+ __version__ = '1.29.0' # x-release-please-version