google-genai 1.32.0__py3-none-any.whl → 1.33.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
@@ -19,7 +19,6 @@ from abc import ABC, abstractmethod
19
19
  import datetime
20
20
  from enum import Enum, EnumMeta
21
21
  import inspect
22
- import io
23
22
  import json
24
23
  import logging
25
24
  import sys
@@ -576,7 +575,7 @@ class SubjectReferenceType(_common.CaseInSensitiveEnum):
576
575
 
577
576
 
578
577
  class EditMode(_common.CaseInSensitiveEnum):
579
- """Enum representing the Imagen 3 Edit mode."""
578
+ """Enum representing the editing mode."""
580
579
 
581
580
  EDIT_MODE_DEFAULT = 'EDIT_MODE_DEFAULT'
582
581
  EDIT_MODE_INPAINT_REMOVAL = 'EDIT_MODE_INPAINT_REMOVAL'
@@ -824,20 +823,18 @@ class Blob(_common.BaseModel):
824
823
  description="""Required. The IANA standard MIME type of the source data.""",
825
824
  )
826
825
 
827
- def as_image(self) -> Optional['PIL_Image']:
828
- """Returns the Blob as a PIL Image, or None if the Blob is not an image."""
826
+ def as_image(self) -> Optional['Image']:
827
+ """Returns the Blob as a Image, or None if the Blob is not an image."""
829
828
  if (
830
829
  not self.data
831
830
  or not self.mime_type
832
831
  or not self.mime_type.startswith('image/')
833
832
  ):
834
833
  return None
835
- if not _is_pillow_image_imported:
836
- raise ImportError(
837
- 'The PIL module is not available. Please install the Pillow'
838
- ' package. `pip install pillow`'
839
- )
840
- return PIL.Image.open(io.BytesIO(self.data))
834
+ return Image(
835
+ image_bytes=self.data,
836
+ mime_type=self.mime_type,
837
+ )
841
838
 
842
839
 
843
840
  class BlobDict(TypedDict, total=False):
@@ -1098,7 +1095,7 @@ class Part(_common.BaseModel):
1098
1095
  default=None, description="""Optional. Text part (can be code)."""
1099
1096
  )
1100
1097
 
1101
- def as_image(self) -> Optional['PIL_Image']:
1098
+ def as_image(self) -> Optional['Image']:
1102
1099
  """Returns the part as a PIL Image, or None if the part is not an image."""
1103
1100
  if not self.inline_data:
1104
1101
  return None
@@ -3901,6 +3898,10 @@ class GenerateContentConfig(_common.BaseModel):
3901
3898
  http_options: Optional[HttpOptions] = Field(
3902
3899
  default=None, description="""Used to override HTTP request options."""
3903
3900
  )
3901
+ should_return_http_response: Optional[bool] = Field(
3902
+ default=None,
3903
+ description=""" If true, the raw HTTP response will be returned in the 'sdk_http_response' field.""",
3904
+ )
3904
3905
  system_instruction: Optional[ContentUnion] = Field(
3905
3906
  default=None,
3906
3907
  description="""Instructions for the model to steer it toward better performance.
@@ -4115,6 +4116,9 @@ class GenerateContentConfigDict(TypedDict, total=False):
4115
4116
  http_options: Optional[HttpOptionsDict]
4116
4117
  """Used to override HTTP request options."""
4117
4118
 
4119
+ should_return_http_response: Optional[bool]
4120
+ """ If true, the raw HTTP response will be returned in the 'sdk_http_response' field."""
4121
+
4118
4122
  system_instruction: Optional[ContentUnionDict]
4119
4123
  """Instructions for the model to steer it toward better performance.
4120
4124
  For example, "Answer as concisely as possible" or "Don't use technical
@@ -5972,91 +5976,69 @@ class GenerateImagesConfig(_common.BaseModel):
5972
5976
  )
5973
5977
  output_gcs_uri: Optional[str] = Field(
5974
5978
  default=None,
5975
- description="""Cloud Storage URI used to store the generated images.
5976
- """,
5979
+ description="""Cloud Storage URI used to store the generated images.""",
5977
5980
  )
5978
5981
  negative_prompt: Optional[str] = Field(
5979
5982
  default=None,
5980
- description="""Description of what to discourage in the generated images.
5981
- """,
5983
+ description="""Description of what to discourage in the generated images.""",
5982
5984
  )
5983
5985
  number_of_images: Optional[int] = Field(
5984
- default=None,
5985
- description="""Number of images to generate.
5986
- """,
5986
+ default=None, description="""Number of images to generate."""
5987
5987
  )
5988
5988
  aspect_ratio: Optional[str] = Field(
5989
5989
  default=None,
5990
5990
  description="""Aspect ratio of the generated images. Supported values are
5991
- "1:1", "3:4", "4:3", "9:16", and "16:9".
5992
- """,
5991
+ "1:1", "3:4", "4:3", "9:16", and "16:9".""",
5993
5992
  )
5994
5993
  guidance_scale: Optional[float] = Field(
5995
5994
  default=None,
5996
5995
  description="""Controls how much the model adheres to the text prompt. Large
5997
5996
  values increase output and prompt alignment, but may compromise image
5998
- quality.
5999
- """,
5997
+ quality.""",
6000
5998
  )
6001
5999
  seed: Optional[int] = Field(
6002
6000
  default=None,
6003
6001
  description="""Random seed for image generation. This is not available when
6004
- ``add_watermark`` is set to true.
6005
- """,
6002
+ ``add_watermark`` is set to true.""",
6006
6003
  )
6007
6004
  safety_filter_level: Optional[SafetyFilterLevel] = Field(
6008
- default=None,
6009
- description="""Filter level for safety filtering.
6010
- """,
6005
+ default=None, description="""Filter level for safety filtering."""
6011
6006
  )
6012
6007
  person_generation: Optional[PersonGeneration] = Field(
6013
- default=None,
6014
- description="""Allows generation of people by the model.
6015
- """,
6008
+ default=None, description="""Allows generation of people by the model."""
6016
6009
  )
6017
6010
  include_safety_attributes: Optional[bool] = Field(
6018
6011
  default=None,
6019
6012
  description="""Whether to report the safety scores of each generated image and
6020
- the positive prompt in the response.
6021
- """,
6013
+ the positive prompt in the response.""",
6022
6014
  )
6023
6015
  include_rai_reason: Optional[bool] = Field(
6024
6016
  default=None,
6025
6017
  description="""Whether to include the Responsible AI filter reason if the image
6026
- is filtered out of the response.
6027
- """,
6018
+ is filtered out of the response.""",
6028
6019
  )
6029
6020
  language: Optional[ImagePromptLanguage] = Field(
6030
- default=None,
6031
- description="""Language of the text in the prompt.
6032
- """,
6021
+ default=None, description="""Language of the text in the prompt."""
6033
6022
  )
6034
6023
  output_mime_type: Optional[str] = Field(
6035
- default=None,
6036
- description="""MIME type of the generated image.
6037
- """,
6024
+ default=None, description="""MIME type of the generated image."""
6038
6025
  )
6039
6026
  output_compression_quality: Optional[int] = Field(
6040
6027
  default=None,
6041
6028
  description="""Compression quality of the generated image (for ``image/jpeg``
6042
- only).
6043
- """,
6029
+ only).""",
6044
6030
  )
6045
6031
  add_watermark: Optional[bool] = Field(
6046
6032
  default=None,
6047
- description="""Whether to add a watermark to the generated images.
6048
- """,
6033
+ description="""Whether to add a watermark to the generated images.""",
6049
6034
  )
6050
6035
  image_size: Optional[str] = Field(
6051
6036
  default=None,
6052
6037
  description="""The size of the largest dimension of the generated image.
6053
- Supported sizes are 1K and 2K (not supported for Imagen 3 models).
6054
- """,
6038
+ Supported sizes are 1K and 2K (not supported for Imagen 3 models).""",
6055
6039
  )
6056
6040
  enhance_prompt: Optional[bool] = Field(
6057
- default=None,
6058
- description="""Whether to use the prompt rewriting logic.
6059
- """,
6041
+ default=None, description="""Whether to use the prompt rewriting logic."""
6060
6042
  )
6061
6043
 
6062
6044
 
@@ -6067,76 +6049,60 @@ class GenerateImagesConfigDict(TypedDict, total=False):
6067
6049
  """Used to override HTTP request options."""
6068
6050
 
6069
6051
  output_gcs_uri: Optional[str]
6070
- """Cloud Storage URI used to store the generated images.
6071
- """
6052
+ """Cloud Storage URI used to store the generated images."""
6072
6053
 
6073
6054
  negative_prompt: Optional[str]
6074
- """Description of what to discourage in the generated images.
6075
- """
6055
+ """Description of what to discourage in the generated images."""
6076
6056
 
6077
6057
  number_of_images: Optional[int]
6078
- """Number of images to generate.
6079
- """
6058
+ """Number of images to generate."""
6080
6059
 
6081
6060
  aspect_ratio: Optional[str]
6082
6061
  """Aspect ratio of the generated images. Supported values are
6083
- "1:1", "3:4", "4:3", "9:16", and "16:9".
6084
- """
6062
+ "1:1", "3:4", "4:3", "9:16", and "16:9"."""
6085
6063
 
6086
6064
  guidance_scale: Optional[float]
6087
6065
  """Controls how much the model adheres to the text prompt. Large
6088
6066
  values increase output and prompt alignment, but may compromise image
6089
- quality.
6090
- """
6067
+ quality."""
6091
6068
 
6092
6069
  seed: Optional[int]
6093
6070
  """Random seed for image generation. This is not available when
6094
- ``add_watermark`` is set to true.
6095
- """
6071
+ ``add_watermark`` is set to true."""
6096
6072
 
6097
6073
  safety_filter_level: Optional[SafetyFilterLevel]
6098
- """Filter level for safety filtering.
6099
- """
6074
+ """Filter level for safety filtering."""
6100
6075
 
6101
6076
  person_generation: Optional[PersonGeneration]
6102
- """Allows generation of people by the model.
6103
- """
6077
+ """Allows generation of people by the model."""
6104
6078
 
6105
6079
  include_safety_attributes: Optional[bool]
6106
6080
  """Whether to report the safety scores of each generated image and
6107
- the positive prompt in the response.
6108
- """
6081
+ the positive prompt in the response."""
6109
6082
 
6110
6083
  include_rai_reason: Optional[bool]
6111
6084
  """Whether to include the Responsible AI filter reason if the image
6112
- is filtered out of the response.
6113
- """
6085
+ is filtered out of the response."""
6114
6086
 
6115
6087
  language: Optional[ImagePromptLanguage]
6116
- """Language of the text in the prompt.
6117
- """
6088
+ """Language of the text in the prompt."""
6118
6089
 
6119
6090
  output_mime_type: Optional[str]
6120
- """MIME type of the generated image.
6121
- """
6091
+ """MIME type of the generated image."""
6122
6092
 
6123
6093
  output_compression_quality: Optional[int]
6124
6094
  """Compression quality of the generated image (for ``image/jpeg``
6125
- only).
6126
- """
6095
+ only)."""
6127
6096
 
6128
6097
  add_watermark: Optional[bool]
6129
- """Whether to add a watermark to the generated images.
6130
- """
6098
+ """Whether to add a watermark to the generated images."""
6131
6099
 
6132
6100
  image_size: Optional[str]
6133
6101
  """The size of the largest dimension of the generated image.
6134
- Supported sizes are 1K and 2K (not supported for Imagen 3 models).
6135
- """
6102
+ Supported sizes are 1K and 2K (not supported for Imagen 3 models)."""
6136
6103
 
6137
6104
  enhance_prompt: Optional[bool]
6138
- """Whether to use the prompt rewriting logic.
6139
- """
6105
+ """Whether to use the prompt rewriting logic."""
6140
6106
 
6141
6107
 
6142
6108
  GenerateImagesConfigOrDict = Union[
@@ -6191,14 +6157,12 @@ class Image(_common.BaseModel):
6191
6157
  gcs_uri: Optional[str] = Field(
6192
6158
  default=None,
6193
6159
  description="""The Cloud Storage URI of the image. ``Image`` can contain a value
6194
- for this field or the ``image_bytes`` field but not both.
6195
- """,
6160
+ for this field or the ``image_bytes`` field but not both.""",
6196
6161
  )
6197
6162
  image_bytes: Optional[bytes] = Field(
6198
6163
  default=None,
6199
6164
  description="""The image bytes data. ``Image`` can contain a value for this field
6200
- or the ``gcs_uri`` field but not both.
6201
- """,
6165
+ or the ``gcs_uri`` field but not both.""",
6202
6166
  )
6203
6167
  mime_type: Optional[str] = Field(
6204
6168
  default=None, description="""The MIME type of the image."""
@@ -6255,13 +6219,19 @@ class Image(_common.BaseModel):
6255
6219
 
6256
6220
  This method only works in a notebook environment.
6257
6221
  """
6258
- try:
6259
- from IPython import display as IPython_display
6260
- except ImportError:
6261
- IPython_display = None
6222
+ in_notebook = 'ipykernel' in sys.modules
6223
+ if in_notebook:
6224
+ try:
6225
+ from IPython import display as IPython_display
6226
+ except ImportError:
6227
+ IPython_display = None
6262
6228
 
6263
- if IPython_display:
6264
- IPython_display.display(self._pil_image)
6229
+ if IPython_display:
6230
+ IPython_display.display(self._pil_image)
6231
+ else:
6232
+ img = self._pil_image
6233
+ if img is not None:
6234
+ img.show()
6265
6235
 
6266
6236
  @property
6267
6237
  def _pil_image(self) -> Optional['PIL_Image']:
@@ -6327,13 +6297,11 @@ class ImageDict(TypedDict, total=False):
6327
6297
 
6328
6298
  gcs_uri: Optional[str]
6329
6299
  """The Cloud Storage URI of the image. ``Image`` can contain a value
6330
- for this field or the ``image_bytes`` field but not both.
6331
- """
6300
+ for this field or the ``image_bytes`` field but not both."""
6332
6301
 
6333
6302
  image_bytes: Optional[bytes]
6334
6303
  """The image bytes data. ``Image`` can contain a value for this field
6335
- or the ``gcs_uri`` field but not both.
6336
- """
6304
+ or the ``gcs_uri`` field but not both."""
6337
6305
 
6338
6306
  mime_type: Optional[str]
6339
6307
  """The MIME type of the image."""
@@ -6346,19 +6314,13 @@ class SafetyAttributes(_common.BaseModel):
6346
6314
  """Safety attributes of a GeneratedImage or the user-provided prompt."""
6347
6315
 
6348
6316
  categories: Optional[list[str]] = Field(
6349
- default=None,
6350
- description="""List of RAI categories.
6351
- """,
6317
+ default=None, description="""List of RAI categories."""
6352
6318
  )
6353
6319
  scores: Optional[list[float]] = Field(
6354
- default=None,
6355
- description="""List of scores of each categories.
6356
- """,
6320
+ default=None, description="""List of scores of each categories."""
6357
6321
  )
6358
6322
  content_type: Optional[str] = Field(
6359
- default=None,
6360
- description="""Internal use only.
6361
- """,
6323
+ default=None, description="""Internal use only."""
6362
6324
  )
6363
6325
 
6364
6326
 
@@ -6366,16 +6328,13 @@ class SafetyAttributesDict(TypedDict, total=False):
6366
6328
  """Safety attributes of a GeneratedImage or the user-provided prompt."""
6367
6329
 
6368
6330
  categories: Optional[list[str]]
6369
- """List of RAI categories.
6370
- """
6331
+ """List of RAI categories."""
6371
6332
 
6372
6333
  scores: Optional[list[float]]
6373
- """List of scores of each categories.
6374
- """
6334
+ """List of scores of each categories."""
6375
6335
 
6376
6336
  content_type: Optional[str]
6377
- """Internal use only.
6378
- """
6337
+ """Internal use only."""
6379
6338
 
6380
6339
 
6381
6340
  SafetyAttributesOrDict = Union[SafetyAttributes, SafetyAttributesDict]
@@ -6385,27 +6344,22 @@ class GeneratedImage(_common.BaseModel):
6385
6344
  """An output image."""
6386
6345
 
6387
6346
  image: Optional[Image] = Field(
6388
- default=None,
6389
- description="""The output image data.
6390
- """,
6347
+ default=None, description="""The output image data."""
6391
6348
  )
6392
6349
  rai_filtered_reason: Optional[str] = Field(
6393
6350
  default=None,
6394
6351
  description="""Responsible AI filter reason if the image is filtered out of the
6395
- response.
6396
- """,
6352
+ response.""",
6397
6353
  )
6398
6354
  safety_attributes: Optional[SafetyAttributes] = Field(
6399
6355
  default=None,
6400
6356
  description="""Safety attributes of the image. Lists of RAI categories and their
6401
- scores of each content.
6402
- """,
6357
+ scores of each content.""",
6403
6358
  )
6404
6359
  enhanced_prompt: Optional[str] = Field(
6405
6360
  default=None,
6406
6361
  description="""The rewritten prompt used for the image generation if the prompt
6407
- enhancer is enabled.
6408
- """,
6362
+ enhancer is enabled.""",
6409
6363
  )
6410
6364
 
6411
6365
 
@@ -6413,23 +6367,19 @@ class GeneratedImageDict(TypedDict, total=False):
6413
6367
  """An output image."""
6414
6368
 
6415
6369
  image: Optional[ImageDict]
6416
- """The output image data.
6417
- """
6370
+ """The output image data."""
6418
6371
 
6419
6372
  rai_filtered_reason: Optional[str]
6420
6373
  """Responsible AI filter reason if the image is filtered out of the
6421
- response.
6422
- """
6374
+ response."""
6423
6375
 
6424
6376
  safety_attributes: Optional[SafetyAttributesDict]
6425
6377
  """Safety attributes of the image. Lists of RAI categories and their
6426
- scores of each content.
6427
- """
6378
+ scores of each content."""
6428
6379
 
6429
6380
  enhanced_prompt: Optional[str]
6430
6381
  """The rewritten prompt used for the image generation if the prompt
6431
- enhancer is enabled.
6432
- """
6382
+ enhancer is enabled."""
6433
6383
 
6434
6384
 
6435
6385
  GeneratedImageOrDict = Union[GeneratedImage, GeneratedImageDict]
@@ -6442,15 +6392,12 @@ class GenerateImagesResponse(_common.BaseModel):
6442
6392
  default=None, description="""Used to retain the full HTTP response."""
6443
6393
  )
6444
6394
  generated_images: Optional[list[GeneratedImage]] = Field(
6445
- default=None,
6446
- description="""List of generated images.
6447
- """,
6395
+ default=None, description="""List of generated images."""
6448
6396
  )
6449
6397
  positive_prompt_safety_attributes: Optional[SafetyAttributes] = Field(
6450
6398
  default=None,
6451
6399
  description="""Safety attributes of the positive prompt. Only populated if
6452
- ``include_safety_attributes`` is set to True.
6453
- """,
6400
+ ``include_safety_attributes`` is set to True.""",
6454
6401
  )
6455
6402
 
6456
6403
  @property
@@ -6472,13 +6419,11 @@ class GenerateImagesResponseDict(TypedDict, total=False):
6472
6419
  """Used to retain the full HTTP response."""
6473
6420
 
6474
6421
  generated_images: Optional[list[GeneratedImageDict]]
6475
- """List of generated images.
6476
- """
6422
+ """List of generated images."""
6477
6423
 
6478
6424
  positive_prompt_safety_attributes: Optional[SafetyAttributesDict]
6479
6425
  """Safety attributes of the positive prompt. Only populated if
6480
- ``include_safety_attributes`` is set to True.
6481
- """
6426
+ ``include_safety_attributes`` is set to True."""
6482
6427
 
6483
6428
 
6484
6429
  GenerateImagesResponseOrDict = Union[
@@ -6673,80 +6618,61 @@ class EditImageConfig(_common.BaseModel):
6673
6618
  )
6674
6619
  output_gcs_uri: Optional[str] = Field(
6675
6620
  default=None,
6676
- description="""Cloud Storage URI used to store the generated images.
6677
- """,
6621
+ description="""Cloud Storage URI used to store the generated images.""",
6678
6622
  )
6679
6623
  negative_prompt: Optional[str] = Field(
6680
6624
  default=None,
6681
- description="""Description of what to discourage in the generated images.
6682
- """,
6625
+ description="""Description of what to discourage in the generated images.""",
6683
6626
  )
6684
6627
  number_of_images: Optional[int] = Field(
6685
- default=None,
6686
- description="""Number of images to generate.
6687
- """,
6628
+ default=None, description="""Number of images to generate."""
6688
6629
  )
6689
6630
  aspect_ratio: Optional[str] = Field(
6690
6631
  default=None,
6691
6632
  description="""Aspect ratio of the generated images. Supported values are
6692
- "1:1", "3:4", "4:3", "9:16", and "16:9".
6693
- """,
6633
+ "1:1", "3:4", "4:3", "9:16", and "16:9".""",
6694
6634
  )
6695
6635
  guidance_scale: Optional[float] = Field(
6696
6636
  default=None,
6697
6637
  description="""Controls how much the model adheres to the text prompt. Large
6698
6638
  values increase output and prompt alignment, but may compromise image
6699
- quality.
6700
- """,
6639
+ quality.""",
6701
6640
  )
6702
6641
  seed: Optional[int] = Field(
6703
6642
  default=None,
6704
6643
  description="""Random seed for image generation. This is not available when
6705
- ``add_watermark`` is set to true.
6706
- """,
6644
+ ``add_watermark`` is set to true.""",
6707
6645
  )
6708
6646
  safety_filter_level: Optional[SafetyFilterLevel] = Field(
6709
- default=None,
6710
- description="""Filter level for safety filtering.
6711
- """,
6647
+ default=None, description="""Filter level for safety filtering."""
6712
6648
  )
6713
6649
  person_generation: Optional[PersonGeneration] = Field(
6714
- default=None,
6715
- description="""Allows generation of people by the model.
6716
- """,
6650
+ default=None, description="""Allows generation of people by the model."""
6717
6651
  )
6718
6652
  include_safety_attributes: Optional[bool] = Field(
6719
6653
  default=None,
6720
6654
  description="""Whether to report the safety scores of each generated image and
6721
- the positive prompt in the response.
6722
- """,
6655
+ the positive prompt in the response.""",
6723
6656
  )
6724
6657
  include_rai_reason: Optional[bool] = Field(
6725
6658
  default=None,
6726
6659
  description="""Whether to include the Responsible AI filter reason if the image
6727
- is filtered out of the response.
6728
- """,
6660
+ is filtered out of the response.""",
6729
6661
  )
6730
6662
  language: Optional[ImagePromptLanguage] = Field(
6731
- default=None,
6732
- description="""Language of the text in the prompt.
6733
- """,
6663
+ default=None, description="""Language of the text in the prompt."""
6734
6664
  )
6735
6665
  output_mime_type: Optional[str] = Field(
6736
- default=None,
6737
- description="""MIME type of the generated image.
6738
- """,
6666
+ default=None, description="""MIME type of the generated image."""
6739
6667
  )
6740
6668
  output_compression_quality: Optional[int] = Field(
6741
6669
  default=None,
6742
6670
  description="""Compression quality of the generated image (for ``image/jpeg``
6743
- only).
6744
- """,
6671
+ only).""",
6745
6672
  )
6746
6673
  add_watermark: Optional[bool] = Field(
6747
6674
  default=None,
6748
- description="""Whether to add a watermark to the generated images.
6749
- """,
6675
+ description="""Whether to add a watermark to the generated images.""",
6750
6676
  )
6751
6677
  edit_mode: Optional[EditMode] = Field(
6752
6678
  default=None,
@@ -6766,67 +6692,53 @@ class EditImageConfigDict(TypedDict, total=False):
6766
6692
  """Used to override HTTP request options."""
6767
6693
 
6768
6694
  output_gcs_uri: Optional[str]
6769
- """Cloud Storage URI used to store the generated images.
6770
- """
6695
+ """Cloud Storage URI used to store the generated images."""
6771
6696
 
6772
6697
  negative_prompt: Optional[str]
6773
- """Description of what to discourage in the generated images.
6774
- """
6698
+ """Description of what to discourage in the generated images."""
6775
6699
 
6776
6700
  number_of_images: Optional[int]
6777
- """Number of images to generate.
6778
- """
6701
+ """Number of images to generate."""
6779
6702
 
6780
6703
  aspect_ratio: Optional[str]
6781
6704
  """Aspect ratio of the generated images. Supported values are
6782
- "1:1", "3:4", "4:3", "9:16", and "16:9".
6783
- """
6705
+ "1:1", "3:4", "4:3", "9:16", and "16:9"."""
6784
6706
 
6785
6707
  guidance_scale: Optional[float]
6786
6708
  """Controls how much the model adheres to the text prompt. Large
6787
6709
  values increase output and prompt alignment, but may compromise image
6788
- quality.
6789
- """
6710
+ quality."""
6790
6711
 
6791
6712
  seed: Optional[int]
6792
6713
  """Random seed for image generation. This is not available when
6793
- ``add_watermark`` is set to true.
6794
- """
6714
+ ``add_watermark`` is set to true."""
6795
6715
 
6796
6716
  safety_filter_level: Optional[SafetyFilterLevel]
6797
- """Filter level for safety filtering.
6798
- """
6717
+ """Filter level for safety filtering."""
6799
6718
 
6800
6719
  person_generation: Optional[PersonGeneration]
6801
- """Allows generation of people by the model.
6802
- """
6720
+ """Allows generation of people by the model."""
6803
6721
 
6804
6722
  include_safety_attributes: Optional[bool]
6805
6723
  """Whether to report the safety scores of each generated image and
6806
- the positive prompt in the response.
6807
- """
6724
+ the positive prompt in the response."""
6808
6725
 
6809
6726
  include_rai_reason: Optional[bool]
6810
6727
  """Whether to include the Responsible AI filter reason if the image
6811
- is filtered out of the response.
6812
- """
6728
+ is filtered out of the response."""
6813
6729
 
6814
6730
  language: Optional[ImagePromptLanguage]
6815
- """Language of the text in the prompt.
6816
- """
6731
+ """Language of the text in the prompt."""
6817
6732
 
6818
6733
  output_mime_type: Optional[str]
6819
- """MIME type of the generated image.
6820
- """
6734
+ """MIME type of the generated image."""
6821
6735
 
6822
6736
  output_compression_quality: Optional[int]
6823
6737
  """Compression quality of the generated image (for ``image/jpeg``
6824
- only).
6825
- """
6738
+ only)."""
6826
6739
 
6827
6740
  add_watermark: Optional[bool]
6828
- """Whether to add a watermark to the generated images.
6829
- """
6741
+ """Whether to add a watermark to the generated images."""
6830
6742
 
6831
6743
  edit_mode: Optional[EditMode]
6832
6744
  """Describes the editing mode for the request."""
@@ -6927,8 +6839,8 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
6927
6839
  )
6928
6840
  output_compression_quality: Optional[int] = Field(
6929
6841
  default=None,
6930
- description="""The level of compression if the ``output_mime_type`` is
6931
- ``image/jpeg``.""",
6842
+ description="""The level of compression. Only applicable if the
6843
+ ``output_mime_type`` is ``image/jpeg``.""",
6932
6844
  )
6933
6845
  enhance_input_image: Optional[bool] = Field(
6934
6846
  default=None,
@@ -6968,8 +6880,8 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
6968
6880
  """The image format that the output should be saved as."""
6969
6881
 
6970
6882
  output_compression_quality: Optional[int]
6971
- """The level of compression if the ``output_mime_type`` is
6972
- ``image/jpeg``."""
6883
+ """The level of compression. Only applicable if the
6884
+ ``output_mime_type`` is ``image/jpeg``."""
6973
6885
 
6974
6886
  enhance_input_image: Optional[bool]
6975
6887
  """Whether to add an image enhancing step before upscaling.
@@ -8336,7 +8248,7 @@ class Video(_common.BaseModel):
8336
8248
  default=None, description="""Video bytes."""
8337
8249
  )
8338
8250
  mime_type: Optional[str] = Field(
8339
- default=None, description="""Video encoding, for example "video/mp4"."""
8251
+ default=None, description="""Video encoding, for example ``video/mp4``."""
8340
8252
  )
8341
8253
 
8342
8254
  @classmethod
@@ -8423,7 +8335,7 @@ class VideoDict(TypedDict, total=False):
8423
8335
  """Video bytes."""
8424
8336
 
8425
8337
  mime_type: Optional[str]
8426
- """Video encoding, for example "video/mp4"."""
8338
+ """Video encoding, for example ``video/mp4``."""
8427
8339
 
8428
8340
 
8429
8341
  VideoOrDict = Union[Video, VideoDict]
@@ -8440,12 +8352,12 @@ class GenerateVideosSource(_common.BaseModel):
8440
8352
  image: Optional[Image] = Field(
8441
8353
  default=None,
8442
8354
  description="""The input image for generating the videos.
8443
- Optional if prompt or video is provided.""",
8355
+ Optional if prompt is provided. Not allowed if video is provided.""",
8444
8356
  )
8445
8357
  video: Optional[Video] = Field(
8446
8358
  default=None,
8447
8359
  description="""The input video for video extension use cases.
8448
- Optional if prompt or image is provided.""",
8360
+ Optional if prompt is provided. Not allowed if image is provided.""",
8449
8361
  )
8450
8362
 
8451
8363
 
@@ -8458,11 +8370,11 @@ class GenerateVideosSourceDict(TypedDict, total=False):
8458
8370
 
8459
8371
  image: Optional[ImageDict]
8460
8372
  """The input image for generating the videos.
8461
- Optional if prompt or video is provided."""
8373
+ Optional if prompt is provided. Not allowed if video is provided."""
8462
8374
 
8463
8375
  video: Optional[VideoDict]
8464
8376
  """The input video for video extension use cases.
8465
- Optional if prompt or image is provided."""
8377
+ Optional if prompt is provided. Not allowed if image is provided."""
8466
8378
 
8467
8379
 
8468
8380
  GenerateVideosSourceOrDict = Union[
@@ -8474,9 +8386,7 @@ class VideoGenerationReferenceImage(_common.BaseModel):
8474
8386
  """A reference image for video generation."""
8475
8387
 
8476
8388
  image: Optional[Image] = Field(
8477
- default=None,
8478
- description="""The reference image.
8479
- """,
8389
+ default=None, description="""The reference image."""
8480
8390
  )
8481
8391
  reference_type: Optional[VideoGenerationReferenceType] = Field(
8482
8392
  default=None,
@@ -8489,8 +8399,7 @@ class VideoGenerationReferenceImageDict(TypedDict, total=False):
8489
8399
  """A reference image for video generation."""
8490
8400
 
8491
8401
  image: Optional[ImageDict]
8492
- """The reference image.
8493
- """
8402
+ """The reference image."""
8494
8403
 
8495
8404
  reference_type: Optional[VideoGenerationReferenceType]
8496
8405
  """The type of the reference image, which defines how the reference
@@ -8524,27 +8433,35 @@ class GenerateVideosConfig(_common.BaseModel):
8524
8433
  )
8525
8434
  seed: Optional[int] = Field(
8526
8435
  default=None,
8527
- 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.""",
8436
+ description="""The RNG seed. If RNG seed is exactly same for each request with
8437
+ unchanged inputs, the prediction results will be consistent. Otherwise,
8438
+ a random RNG seed will be used each time to produce a different
8439
+ result.""",
8528
8440
  )
8529
8441
  aspect_ratio: Optional[str] = Field(
8530
8442
  default=None,
8531
- description="""The aspect ratio for the generated video. 16:9 (landscape) and 9:16 (portrait) are supported.""",
8443
+ description="""The aspect ratio for the generated video. 16:9 (landscape) and
8444
+ 9:16 (portrait) are supported.""",
8532
8445
  )
8533
8446
  resolution: Optional[str] = Field(
8534
8447
  default=None,
8535
- description="""The resolution for the generated video. 720p and 1080p are supported.""",
8448
+ description="""The resolution for the generated video. 720p and 1080p are
8449
+ supported.""",
8536
8450
  )
8537
8451
  person_generation: Optional[str] = Field(
8538
8452
  default=None,
8539
- description="""Whether allow to generate person videos, and restrict to specific ages. Supported values are: dont_allow, allow_adult.""",
8453
+ description="""Whether allow to generate person videos, and restrict to specific
8454
+ ages. Supported values are: dont_allow, allow_adult.""",
8540
8455
  )
8541
8456
  pubsub_topic: Optional[str] = Field(
8542
8457
  default=None,
8543
- description="""The pubsub topic where to publish the video generation progress.""",
8458
+ description="""The pubsub topic where to publish the video generation
8459
+ progress.""",
8544
8460
  )
8545
8461
  negative_prompt: Optional[str] = Field(
8546
8462
  default=None,
8547
- description="""Optional field in addition to the text content. Negative prompts can be explicitly stated here to help generate the video.""",
8463
+ description="""Explicitly state what should not be included in the generated
8464
+ videos.""",
8548
8465
  )
8549
8466
  enhance_prompt: Optional[bool] = Field(
8550
8467
  default=None, description="""Whether to use the prompt rewriting logic."""
@@ -8555,7 +8472,8 @@ class GenerateVideosConfig(_common.BaseModel):
8555
8472
  )
8556
8473
  last_frame: Optional[Image] = Field(
8557
8474
  default=None,
8558
- description="""Image to use as the last frame of generated videos. Only supported for image to video use cases.""",
8475
+ description="""Image to use as the last frame of generated videos.
8476
+ Only supported for image to video use cases.""",
8559
8477
  )
8560
8478
  reference_images: Optional[list[VideoGenerationReferenceImage]] = Field(
8561
8479
  default=None,
@@ -8590,22 +8508,30 @@ class GenerateVideosConfigDict(TypedDict, total=False):
8590
8508
  """Duration of the clip for video generation in seconds."""
8591
8509
 
8592
8510
  seed: Optional[int]
8593
- """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."""
8511
+ """The RNG seed. If RNG seed is exactly same for each request with
8512
+ unchanged inputs, the prediction results will be consistent. Otherwise,
8513
+ a random RNG seed will be used each time to produce a different
8514
+ result."""
8594
8515
 
8595
8516
  aspect_ratio: Optional[str]
8596
- """The aspect ratio for the generated video. 16:9 (landscape) and 9:16 (portrait) are supported."""
8517
+ """The aspect ratio for the generated video. 16:9 (landscape) and
8518
+ 9:16 (portrait) are supported."""
8597
8519
 
8598
8520
  resolution: Optional[str]
8599
- """The resolution for the generated video. 720p and 1080p are supported."""
8521
+ """The resolution for the generated video. 720p and 1080p are
8522
+ supported."""
8600
8523
 
8601
8524
  person_generation: Optional[str]
8602
- """Whether allow to generate person videos, and restrict to specific ages. Supported values are: dont_allow, allow_adult."""
8525
+ """Whether allow to generate person videos, and restrict to specific
8526
+ ages. Supported values are: dont_allow, allow_adult."""
8603
8527
 
8604
8528
  pubsub_topic: Optional[str]
8605
- """The pubsub topic where to publish the video generation progress."""
8529
+ """The pubsub topic where to publish the video generation
8530
+ progress."""
8606
8531
 
8607
8532
  negative_prompt: Optional[str]
8608
- """Optional field in addition to the text content. Negative prompts can be explicitly stated here to help generate the video."""
8533
+ """Explicitly state what should not be included in the generated
8534
+ videos."""
8609
8535
 
8610
8536
  enhance_prompt: Optional[bool]
8611
8537
  """Whether to use the prompt rewriting logic."""
@@ -8614,7 +8540,8 @@ class GenerateVideosConfigDict(TypedDict, total=False):
8614
8540
  """Whether to generate audio along with the video."""
8615
8541
 
8616
8542
  last_frame: Optional[ImageDict]
8617
- """Image to use as the last frame of generated videos. Only supported for image to video use cases."""
8543
+ """Image to use as the last frame of generated videos.
8544
+ Only supported for image to video use cases."""
8618
8545
 
8619
8546
  reference_images: Optional[list[VideoGenerationReferenceImageDict]]
8620
8547
  """The images to use as the references to generate the videos.
@@ -8642,17 +8569,18 @@ class _GenerateVideosParameters(_common.BaseModel):
8642
8569
  )
8643
8570
  prompt: Optional[str] = Field(
8644
8571
  default=None,
8645
- description="""The text prompt for generating the videos. Optional for image to video use cases.""",
8572
+ description="""The text prompt for generating the videos.
8573
+ Optional if image or video is provided.""",
8646
8574
  )
8647
8575
  image: Optional[Image] = Field(
8648
8576
  default=None,
8649
8577
  description="""The input image for generating the videos.
8650
- Optional if prompt or video is provided.""",
8578
+ Optional if prompt is provided. Not allowed if video is provided.""",
8651
8579
  )
8652
8580
  video: Optional[Video] = Field(
8653
8581
  default=None,
8654
8582
  description="""The input video for video extension use cases.
8655
- Optional if prompt or image is provided.""",
8583
+ Optional if prompt is provided. Not allowed if image is provided.""",
8656
8584
  )
8657
8585
  source: Optional[GenerateVideosSource] = Field(
8658
8586
  default=None,
@@ -8671,15 +8599,16 @@ class _GenerateVideosParametersDict(TypedDict, total=False):
8671
8599
  <https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_."""
8672
8600
 
8673
8601
  prompt: Optional[str]
8674
- """The text prompt for generating the videos. Optional for image to video use cases."""
8602
+ """The text prompt for generating the videos.
8603
+ Optional if image or video is provided."""
8675
8604
 
8676
8605
  image: Optional[ImageDict]
8677
8606
  """The input image for generating the videos.
8678
- Optional if prompt or video is provided."""
8607
+ Optional if prompt is provided. Not allowed if video is provided."""
8679
8608
 
8680
8609
  video: Optional[VideoDict]
8681
8610
  """The input video for video extension use cases.
8682
- Optional if prompt or image is provided."""
8611
+ Optional if prompt is provided. Not allowed if image is provided."""
8683
8612
 
8684
8613
  source: Optional[GenerateVideosSourceDict]
8685
8614
  """A set of source input(s) for video generation."""
@@ -12422,8 +12351,8 @@ class UpscaleImageConfig(_common.BaseModel):
12422
12351
  )
12423
12352
  output_compression_quality: Optional[int] = Field(
12424
12353
  default=None,
12425
- description="""The level of compression if the ``output_mime_type`` is
12426
- ``image/jpeg``.""",
12354
+ description="""The level of compression. Only applicable if the
12355
+ ``output_mime_type`` is ``image/jpeg``.""",
12427
12356
  )
12428
12357
  enhance_input_image: Optional[bool] = Field(
12429
12358
  default=None,
@@ -12462,8 +12391,8 @@ class UpscaleImageConfigDict(TypedDict, total=False):
12462
12391
  """The image format that the output should be saved as."""
12463
12392
 
12464
12393
  output_compression_quality: Optional[int]
12465
- """The level of compression if the ``output_mime_type`` is
12466
- ``image/jpeg``."""
12394
+ """The level of compression. Only applicable if the
12395
+ ``output_mime_type`` is ``image/jpeg``."""
12467
12396
 
12468
12397
  enhance_input_image: Optional[bool]
12469
12398
  """Whether to add an image enhancing step before upscaling.