google-genai 1.31.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/_api_client.py +32 -9
- google/genai/_base_transformers.py +26 -0
- google/genai/_local_tokenizer_loader.py +223 -0
- google/genai/_operations_converters.py +307 -0
- google/genai/_replay_api_client.py +15 -0
- google/genai/_transformers.py +0 -10
- google/genai/caches.py +14 -2
- google/genai/files.py +12 -2
- google/genai/local_tokenizer.py +362 -0
- google/genai/models.py +171 -196
- google/genai/tunings.py +134 -0
- google/genai/types.py +402 -304
- google/genai/version.py +1 -1
- {google_genai-1.31.0.dist-info → google_genai-1.33.0.dist-info}/METADATA +6 -6
- {google_genai-1.31.0.dist-info → google_genai-1.33.0.dist-info}/RECORD +18 -14
- {google_genai-1.31.0.dist-info → google_genai-1.33.0.dist-info}/WHEEL +0 -0
- {google_genai-1.31.0.dist-info → google_genai-1.33.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.31.0.dist-info → google_genai-1.33.0.dist-info}/top_level.txt +0 -0
google/genai/types.py
CHANGED
@@ -29,6 +29,11 @@ import pydantic
|
|
29
29
|
from pydantic import ConfigDict, Field, PrivateAttr, model_validator
|
30
30
|
from typing_extensions import Self, TypedDict
|
31
31
|
from . import _common
|
32
|
+
from ._operations_converters import (
|
33
|
+
_GenerateVideosOperation_from_mldev,
|
34
|
+
_GenerateVideosOperation_from_vertex,
|
35
|
+
)
|
36
|
+
|
32
37
|
|
33
38
|
if sys.version_info >= (3, 10):
|
34
39
|
# Supports both Union[t1, t2] and t1 | t2
|
@@ -496,6 +501,8 @@ class FunctionCallingConfigMode(_common.CaseInSensitiveEnum):
|
|
496
501
|
"""Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations"."""
|
497
502
|
NONE = 'NONE'
|
498
503
|
"""Model will not predict any function calls. Model behavior is same as when not passing any function declarations."""
|
504
|
+
VALIDATED = 'VALIDATED'
|
505
|
+
"""Model decides to predict either a function call or a natural language response, but will validate function calls with constrained decoding. If "allowed_function_names" are set, the predicted function call will be limited to any one of "allowed_function_names", else the predicted function call will be any one of the provided "function_declarations"."""
|
499
506
|
|
500
507
|
|
501
508
|
class SafetyFilterLevel(_common.CaseInSensitiveEnum):
|
@@ -568,7 +575,7 @@ class SubjectReferenceType(_common.CaseInSensitiveEnum):
|
|
568
575
|
|
569
576
|
|
570
577
|
class EditMode(_common.CaseInSensitiveEnum):
|
571
|
-
"""Enum representing the
|
578
|
+
"""Enum representing the editing mode."""
|
572
579
|
|
573
580
|
EDIT_MODE_DEFAULT = 'EDIT_MODE_DEFAULT'
|
574
581
|
EDIT_MODE_INPAINT_REMOVAL = 'EDIT_MODE_INPAINT_REMOVAL'
|
@@ -590,6 +597,18 @@ class SegmentMode(_common.CaseInSensitiveEnum):
|
|
590
597
|
INTERACTIVE = 'INTERACTIVE'
|
591
598
|
|
592
599
|
|
600
|
+
class VideoGenerationReferenceType(_common.CaseInSensitiveEnum):
|
601
|
+
"""Enum for the reference type of a video generation reference image."""
|
602
|
+
|
603
|
+
ASSET = 'ASSET'
|
604
|
+
"""A reference image that provides assets to the generated video,
|
605
|
+
such as the scene, an object, a character, etc."""
|
606
|
+
STYLE = 'STYLE'
|
607
|
+
"""A reference image that provides aesthetics including colors,
|
608
|
+
lighting, texture, etc., to be used as the style of the generated video,
|
609
|
+
such as 'anime', 'photography', 'origami', etc."""
|
610
|
+
|
611
|
+
|
593
612
|
class VideoCompressionQuality(_common.CaseInSensitiveEnum):
|
594
613
|
"""Enum that controls the compression quality of the generated videos."""
|
595
614
|
|
@@ -804,6 +823,19 @@ class Blob(_common.BaseModel):
|
|
804
823
|
description="""Required. The IANA standard MIME type of the source data.""",
|
805
824
|
)
|
806
825
|
|
826
|
+
def as_image(self) -> Optional['Image']:
|
827
|
+
"""Returns the Blob as a Image, or None if the Blob is not an image."""
|
828
|
+
if (
|
829
|
+
not self.data
|
830
|
+
or not self.mime_type
|
831
|
+
or not self.mime_type.startswith('image/')
|
832
|
+
):
|
833
|
+
return None
|
834
|
+
return Image(
|
835
|
+
image_bytes=self.data,
|
836
|
+
mime_type=self.mime_type,
|
837
|
+
)
|
838
|
+
|
807
839
|
|
808
840
|
class BlobDict(TypedDict, total=False):
|
809
841
|
"""Content blob."""
|
@@ -1063,6 +1095,12 @@ class Part(_common.BaseModel):
|
|
1063
1095
|
default=None, description="""Optional. Text part (can be code)."""
|
1064
1096
|
)
|
1065
1097
|
|
1098
|
+
def as_image(self) -> Optional['Image']:
|
1099
|
+
"""Returns the part as a PIL Image, or None if the part is not an image."""
|
1100
|
+
if not self.inline_data:
|
1101
|
+
return None
|
1102
|
+
return self.inline_data.as_image()
|
1103
|
+
|
1066
1104
|
@classmethod
|
1067
1105
|
def from_uri(
|
1068
1106
|
cls, *, file_uri: str, mime_type: Optional[str] = None
|
@@ -3860,6 +3898,10 @@ class GenerateContentConfig(_common.BaseModel):
|
|
3860
3898
|
http_options: Optional[HttpOptions] = Field(
|
3861
3899
|
default=None, description="""Used to override HTTP request options."""
|
3862
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
|
+
)
|
3863
3905
|
system_instruction: Optional[ContentUnion] = Field(
|
3864
3906
|
default=None,
|
3865
3907
|
description="""Instructions for the model to steer it toward better performance.
|
@@ -4074,6 +4116,9 @@ class GenerateContentConfigDict(TypedDict, total=False):
|
|
4074
4116
|
http_options: Optional[HttpOptionsDict]
|
4075
4117
|
"""Used to override HTTP request options."""
|
4076
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
|
+
|
4077
4122
|
system_instruction: Optional[ContentUnionDict]
|
4078
4123
|
"""Instructions for the model to steer it toward better performance.
|
4079
4124
|
For example, "Answer as concisely as possible" or "Don't use technical
|
@@ -5446,6 +5491,23 @@ class GenerateContentResponse(_common.BaseModel):
|
|
5446
5491
|
# part.text == '' is different from part.text is None
|
5447
5492
|
return text if any_text_part_text else None
|
5448
5493
|
|
5494
|
+
@property
|
5495
|
+
def parts(self) -> Optional[list[Part]]:
|
5496
|
+
"""Returns the content-parts in the response."""
|
5497
|
+
if (
|
5498
|
+
not self.candidates
|
5499
|
+
or self.candidates[0].content is None
|
5500
|
+
or self.candidates[0].content.parts is None
|
5501
|
+
):
|
5502
|
+
return None
|
5503
|
+
if len(self.candidates) > 1:
|
5504
|
+
logger.warning(
|
5505
|
+
'Warning: there are multiple candidates in the response, returning'
|
5506
|
+
' parts from the first one.'
|
5507
|
+
)
|
5508
|
+
|
5509
|
+
return self.candidates[0].content.parts
|
5510
|
+
|
5449
5511
|
@property
|
5450
5512
|
def text(self) -> Optional[str]:
|
5451
5513
|
"""Returns the concatenation of all text parts in the response."""
|
@@ -5914,91 +5976,69 @@ class GenerateImagesConfig(_common.BaseModel):
|
|
5914
5976
|
)
|
5915
5977
|
output_gcs_uri: Optional[str] = Field(
|
5916
5978
|
default=None,
|
5917
|
-
description="""Cloud Storage URI used to store the generated images.
|
5918
|
-
""",
|
5979
|
+
description="""Cloud Storage URI used to store the generated images.""",
|
5919
5980
|
)
|
5920
5981
|
negative_prompt: Optional[str] = Field(
|
5921
5982
|
default=None,
|
5922
|
-
description="""Description of what to discourage in the generated images.
|
5923
|
-
""",
|
5983
|
+
description="""Description of what to discourage in the generated images.""",
|
5924
5984
|
)
|
5925
5985
|
number_of_images: Optional[int] = Field(
|
5926
|
-
default=None,
|
5927
|
-
description="""Number of images to generate.
|
5928
|
-
""",
|
5986
|
+
default=None, description="""Number of images to generate."""
|
5929
5987
|
)
|
5930
5988
|
aspect_ratio: Optional[str] = Field(
|
5931
5989
|
default=None,
|
5932
5990
|
description="""Aspect ratio of the generated images. Supported values are
|
5933
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
5934
|
-
""",
|
5991
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9".""",
|
5935
5992
|
)
|
5936
5993
|
guidance_scale: Optional[float] = Field(
|
5937
5994
|
default=None,
|
5938
5995
|
description="""Controls how much the model adheres to the text prompt. Large
|
5939
5996
|
values increase output and prompt alignment, but may compromise image
|
5940
|
-
quality.
|
5941
|
-
""",
|
5997
|
+
quality.""",
|
5942
5998
|
)
|
5943
5999
|
seed: Optional[int] = Field(
|
5944
6000
|
default=None,
|
5945
6001
|
description="""Random seed for image generation. This is not available when
|
5946
|
-
``add_watermark`` is set to true.
|
5947
|
-
""",
|
6002
|
+
``add_watermark`` is set to true.""",
|
5948
6003
|
)
|
5949
6004
|
safety_filter_level: Optional[SafetyFilterLevel] = Field(
|
5950
|
-
default=None,
|
5951
|
-
description="""Filter level for safety filtering.
|
5952
|
-
""",
|
6005
|
+
default=None, description="""Filter level for safety filtering."""
|
5953
6006
|
)
|
5954
6007
|
person_generation: Optional[PersonGeneration] = Field(
|
5955
|
-
default=None,
|
5956
|
-
description="""Allows generation of people by the model.
|
5957
|
-
""",
|
6008
|
+
default=None, description="""Allows generation of people by the model."""
|
5958
6009
|
)
|
5959
6010
|
include_safety_attributes: Optional[bool] = Field(
|
5960
6011
|
default=None,
|
5961
6012
|
description="""Whether to report the safety scores of each generated image and
|
5962
|
-
the positive prompt in the response.
|
5963
|
-
""",
|
6013
|
+
the positive prompt in the response.""",
|
5964
6014
|
)
|
5965
6015
|
include_rai_reason: Optional[bool] = Field(
|
5966
6016
|
default=None,
|
5967
6017
|
description="""Whether to include the Responsible AI filter reason if the image
|
5968
|
-
is filtered out of the response.
|
5969
|
-
""",
|
6018
|
+
is filtered out of the response.""",
|
5970
6019
|
)
|
5971
6020
|
language: Optional[ImagePromptLanguage] = Field(
|
5972
|
-
default=None,
|
5973
|
-
description="""Language of the text in the prompt.
|
5974
|
-
""",
|
6021
|
+
default=None, description="""Language of the text in the prompt."""
|
5975
6022
|
)
|
5976
6023
|
output_mime_type: Optional[str] = Field(
|
5977
|
-
default=None,
|
5978
|
-
description="""MIME type of the generated image.
|
5979
|
-
""",
|
6024
|
+
default=None, description="""MIME type of the generated image."""
|
5980
6025
|
)
|
5981
6026
|
output_compression_quality: Optional[int] = Field(
|
5982
6027
|
default=None,
|
5983
6028
|
description="""Compression quality of the generated image (for ``image/jpeg``
|
5984
|
-
only).
|
5985
|
-
""",
|
6029
|
+
only).""",
|
5986
6030
|
)
|
5987
6031
|
add_watermark: Optional[bool] = Field(
|
5988
6032
|
default=None,
|
5989
|
-
description="""Whether to add a watermark to the generated images.
|
5990
|
-
""",
|
6033
|
+
description="""Whether to add a watermark to the generated images.""",
|
5991
6034
|
)
|
5992
6035
|
image_size: Optional[str] = Field(
|
5993
6036
|
default=None,
|
5994
6037
|
description="""The size of the largest dimension of the generated image.
|
5995
|
-
Supported sizes are 1K and 2K (not supported for Imagen 3 models).
|
5996
|
-
""",
|
6038
|
+
Supported sizes are 1K and 2K (not supported for Imagen 3 models).""",
|
5997
6039
|
)
|
5998
6040
|
enhance_prompt: Optional[bool] = Field(
|
5999
|
-
default=None,
|
6000
|
-
description="""Whether to use the prompt rewriting logic.
|
6001
|
-
""",
|
6041
|
+
default=None, description="""Whether to use the prompt rewriting logic."""
|
6002
6042
|
)
|
6003
6043
|
|
6004
6044
|
|
@@ -6009,76 +6049,60 @@ class GenerateImagesConfigDict(TypedDict, total=False):
|
|
6009
6049
|
"""Used to override HTTP request options."""
|
6010
6050
|
|
6011
6051
|
output_gcs_uri: Optional[str]
|
6012
|
-
"""Cloud Storage URI used to store the generated images.
|
6013
|
-
"""
|
6052
|
+
"""Cloud Storage URI used to store the generated images."""
|
6014
6053
|
|
6015
6054
|
negative_prompt: Optional[str]
|
6016
|
-
"""Description of what to discourage in the generated images.
|
6017
|
-
"""
|
6055
|
+
"""Description of what to discourage in the generated images."""
|
6018
6056
|
|
6019
6057
|
number_of_images: Optional[int]
|
6020
|
-
"""Number of images to generate.
|
6021
|
-
"""
|
6058
|
+
"""Number of images to generate."""
|
6022
6059
|
|
6023
6060
|
aspect_ratio: Optional[str]
|
6024
6061
|
"""Aspect ratio of the generated images. Supported values are
|
6025
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
6026
|
-
"""
|
6062
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9"."""
|
6027
6063
|
|
6028
6064
|
guidance_scale: Optional[float]
|
6029
6065
|
"""Controls how much the model adheres to the text prompt. Large
|
6030
6066
|
values increase output and prompt alignment, but may compromise image
|
6031
|
-
quality.
|
6032
|
-
"""
|
6067
|
+
quality."""
|
6033
6068
|
|
6034
6069
|
seed: Optional[int]
|
6035
6070
|
"""Random seed for image generation. This is not available when
|
6036
|
-
``add_watermark`` is set to true.
|
6037
|
-
"""
|
6071
|
+
``add_watermark`` is set to true."""
|
6038
6072
|
|
6039
6073
|
safety_filter_level: Optional[SafetyFilterLevel]
|
6040
|
-
"""Filter level for safety filtering.
|
6041
|
-
"""
|
6074
|
+
"""Filter level for safety filtering."""
|
6042
6075
|
|
6043
6076
|
person_generation: Optional[PersonGeneration]
|
6044
|
-
"""Allows generation of people by the model.
|
6045
|
-
"""
|
6077
|
+
"""Allows generation of people by the model."""
|
6046
6078
|
|
6047
6079
|
include_safety_attributes: Optional[bool]
|
6048
6080
|
"""Whether to report the safety scores of each generated image and
|
6049
|
-
the positive prompt in the response.
|
6050
|
-
"""
|
6081
|
+
the positive prompt in the response."""
|
6051
6082
|
|
6052
6083
|
include_rai_reason: Optional[bool]
|
6053
6084
|
"""Whether to include the Responsible AI filter reason if the image
|
6054
|
-
is filtered out of the response.
|
6055
|
-
"""
|
6085
|
+
is filtered out of the response."""
|
6056
6086
|
|
6057
6087
|
language: Optional[ImagePromptLanguage]
|
6058
|
-
"""Language of the text in the prompt.
|
6059
|
-
"""
|
6088
|
+
"""Language of the text in the prompt."""
|
6060
6089
|
|
6061
6090
|
output_mime_type: Optional[str]
|
6062
|
-
"""MIME type of the generated image.
|
6063
|
-
"""
|
6091
|
+
"""MIME type of the generated image."""
|
6064
6092
|
|
6065
6093
|
output_compression_quality: Optional[int]
|
6066
6094
|
"""Compression quality of the generated image (for ``image/jpeg``
|
6067
|
-
only).
|
6068
|
-
"""
|
6095
|
+
only)."""
|
6069
6096
|
|
6070
6097
|
add_watermark: Optional[bool]
|
6071
|
-
"""Whether to add a watermark to the generated images.
|
6072
|
-
"""
|
6098
|
+
"""Whether to add a watermark to the generated images."""
|
6073
6099
|
|
6074
6100
|
image_size: Optional[str]
|
6075
6101
|
"""The size of the largest dimension of the generated image.
|
6076
|
-
Supported sizes are 1K and 2K (not supported for Imagen 3 models).
|
6077
|
-
"""
|
6102
|
+
Supported sizes are 1K and 2K (not supported for Imagen 3 models)."""
|
6078
6103
|
|
6079
6104
|
enhance_prompt: Optional[bool]
|
6080
|
-
"""Whether to use the prompt rewriting logic.
|
6081
|
-
"""
|
6105
|
+
"""Whether to use the prompt rewriting logic."""
|
6082
6106
|
|
6083
6107
|
|
6084
6108
|
GenerateImagesConfigOrDict = Union[
|
@@ -6133,14 +6157,12 @@ class Image(_common.BaseModel):
|
|
6133
6157
|
gcs_uri: Optional[str] = Field(
|
6134
6158
|
default=None,
|
6135
6159
|
description="""The Cloud Storage URI of the image. ``Image`` can contain a value
|
6136
|
-
for this field or the ``image_bytes`` field but not both.
|
6137
|
-
""",
|
6160
|
+
for this field or the ``image_bytes`` field but not both.""",
|
6138
6161
|
)
|
6139
6162
|
image_bytes: Optional[bytes] = Field(
|
6140
6163
|
default=None,
|
6141
6164
|
description="""The image bytes data. ``Image`` can contain a value for this field
|
6142
|
-
or the ``gcs_uri`` field but not both.
|
6143
|
-
""",
|
6165
|
+
or the ``gcs_uri`` field but not both.""",
|
6144
6166
|
)
|
6145
6167
|
mime_type: Optional[str] = Field(
|
6146
6168
|
default=None, description="""The MIME type of the image."""
|
@@ -6197,13 +6219,19 @@ class Image(_common.BaseModel):
|
|
6197
6219
|
|
6198
6220
|
This method only works in a notebook environment.
|
6199
6221
|
"""
|
6200
|
-
|
6201
|
-
|
6202
|
-
|
6203
|
-
|
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
|
6204
6228
|
|
6205
|
-
|
6206
|
-
|
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()
|
6207
6235
|
|
6208
6236
|
@property
|
6209
6237
|
def _pil_image(self) -> Optional['PIL_Image']:
|
@@ -6269,13 +6297,11 @@ class ImageDict(TypedDict, total=False):
|
|
6269
6297
|
|
6270
6298
|
gcs_uri: Optional[str]
|
6271
6299
|
"""The Cloud Storage URI of the image. ``Image`` can contain a value
|
6272
|
-
for this field or the ``image_bytes`` field but not both.
|
6273
|
-
"""
|
6300
|
+
for this field or the ``image_bytes`` field but not both."""
|
6274
6301
|
|
6275
6302
|
image_bytes: Optional[bytes]
|
6276
6303
|
"""The image bytes data. ``Image`` can contain a value for this field
|
6277
|
-
or the ``gcs_uri`` field but not both.
|
6278
|
-
"""
|
6304
|
+
or the ``gcs_uri`` field but not both."""
|
6279
6305
|
|
6280
6306
|
mime_type: Optional[str]
|
6281
6307
|
"""The MIME type of the image."""
|
@@ -6288,19 +6314,13 @@ class SafetyAttributes(_common.BaseModel):
|
|
6288
6314
|
"""Safety attributes of a GeneratedImage or the user-provided prompt."""
|
6289
6315
|
|
6290
6316
|
categories: Optional[list[str]] = Field(
|
6291
|
-
default=None,
|
6292
|
-
description="""List of RAI categories.
|
6293
|
-
""",
|
6317
|
+
default=None, description="""List of RAI categories."""
|
6294
6318
|
)
|
6295
6319
|
scores: Optional[list[float]] = Field(
|
6296
|
-
default=None,
|
6297
|
-
description="""List of scores of each categories.
|
6298
|
-
""",
|
6320
|
+
default=None, description="""List of scores of each categories."""
|
6299
6321
|
)
|
6300
6322
|
content_type: Optional[str] = Field(
|
6301
|
-
default=None,
|
6302
|
-
description="""Internal use only.
|
6303
|
-
""",
|
6323
|
+
default=None, description="""Internal use only."""
|
6304
6324
|
)
|
6305
6325
|
|
6306
6326
|
|
@@ -6308,16 +6328,13 @@ class SafetyAttributesDict(TypedDict, total=False):
|
|
6308
6328
|
"""Safety attributes of a GeneratedImage or the user-provided prompt."""
|
6309
6329
|
|
6310
6330
|
categories: Optional[list[str]]
|
6311
|
-
"""List of RAI categories.
|
6312
|
-
"""
|
6331
|
+
"""List of RAI categories."""
|
6313
6332
|
|
6314
6333
|
scores: Optional[list[float]]
|
6315
|
-
"""List of scores of each categories.
|
6316
|
-
"""
|
6334
|
+
"""List of scores of each categories."""
|
6317
6335
|
|
6318
6336
|
content_type: Optional[str]
|
6319
|
-
"""Internal use only.
|
6320
|
-
"""
|
6337
|
+
"""Internal use only."""
|
6321
6338
|
|
6322
6339
|
|
6323
6340
|
SafetyAttributesOrDict = Union[SafetyAttributes, SafetyAttributesDict]
|
@@ -6327,27 +6344,22 @@ class GeneratedImage(_common.BaseModel):
|
|
6327
6344
|
"""An output image."""
|
6328
6345
|
|
6329
6346
|
image: Optional[Image] = Field(
|
6330
|
-
default=None,
|
6331
|
-
description="""The output image data.
|
6332
|
-
""",
|
6347
|
+
default=None, description="""The output image data."""
|
6333
6348
|
)
|
6334
6349
|
rai_filtered_reason: Optional[str] = Field(
|
6335
6350
|
default=None,
|
6336
6351
|
description="""Responsible AI filter reason if the image is filtered out of the
|
6337
|
-
response.
|
6338
|
-
""",
|
6352
|
+
response.""",
|
6339
6353
|
)
|
6340
6354
|
safety_attributes: Optional[SafetyAttributes] = Field(
|
6341
6355
|
default=None,
|
6342
6356
|
description="""Safety attributes of the image. Lists of RAI categories and their
|
6343
|
-
scores of each content.
|
6344
|
-
""",
|
6357
|
+
scores of each content.""",
|
6345
6358
|
)
|
6346
6359
|
enhanced_prompt: Optional[str] = Field(
|
6347
6360
|
default=None,
|
6348
6361
|
description="""The rewritten prompt used for the image generation if the prompt
|
6349
|
-
enhancer is enabled.
|
6350
|
-
""",
|
6362
|
+
enhancer is enabled.""",
|
6351
6363
|
)
|
6352
6364
|
|
6353
6365
|
|
@@ -6355,23 +6367,19 @@ class GeneratedImageDict(TypedDict, total=False):
|
|
6355
6367
|
"""An output image."""
|
6356
6368
|
|
6357
6369
|
image: Optional[ImageDict]
|
6358
|
-
"""The output image data.
|
6359
|
-
"""
|
6370
|
+
"""The output image data."""
|
6360
6371
|
|
6361
6372
|
rai_filtered_reason: Optional[str]
|
6362
6373
|
"""Responsible AI filter reason if the image is filtered out of the
|
6363
|
-
response.
|
6364
|
-
"""
|
6374
|
+
response."""
|
6365
6375
|
|
6366
6376
|
safety_attributes: Optional[SafetyAttributesDict]
|
6367
6377
|
"""Safety attributes of the image. Lists of RAI categories and their
|
6368
|
-
scores of each content.
|
6369
|
-
"""
|
6378
|
+
scores of each content."""
|
6370
6379
|
|
6371
6380
|
enhanced_prompt: Optional[str]
|
6372
6381
|
"""The rewritten prompt used for the image generation if the prompt
|
6373
|
-
enhancer is enabled.
|
6374
|
-
"""
|
6382
|
+
enhancer is enabled."""
|
6375
6383
|
|
6376
6384
|
|
6377
6385
|
GeneratedImageOrDict = Union[GeneratedImage, GeneratedImageDict]
|
@@ -6384,15 +6392,12 @@ class GenerateImagesResponse(_common.BaseModel):
|
|
6384
6392
|
default=None, description="""Used to retain the full HTTP response."""
|
6385
6393
|
)
|
6386
6394
|
generated_images: Optional[list[GeneratedImage]] = Field(
|
6387
|
-
default=None,
|
6388
|
-
description="""List of generated images.
|
6389
|
-
""",
|
6395
|
+
default=None, description="""List of generated images."""
|
6390
6396
|
)
|
6391
6397
|
positive_prompt_safety_attributes: Optional[SafetyAttributes] = Field(
|
6392
6398
|
default=None,
|
6393
6399
|
description="""Safety attributes of the positive prompt. Only populated if
|
6394
|
-
``include_safety_attributes`` is set to True.
|
6395
|
-
""",
|
6400
|
+
``include_safety_attributes`` is set to True.""",
|
6396
6401
|
)
|
6397
6402
|
|
6398
6403
|
@property
|
@@ -6414,13 +6419,11 @@ class GenerateImagesResponseDict(TypedDict, total=False):
|
|
6414
6419
|
"""Used to retain the full HTTP response."""
|
6415
6420
|
|
6416
6421
|
generated_images: Optional[list[GeneratedImageDict]]
|
6417
|
-
"""List of generated images.
|
6418
|
-
"""
|
6422
|
+
"""List of generated images."""
|
6419
6423
|
|
6420
6424
|
positive_prompt_safety_attributes: Optional[SafetyAttributesDict]
|
6421
6425
|
"""Safety attributes of the positive prompt. Only populated if
|
6422
|
-
``include_safety_attributes`` is set to True.
|
6423
|
-
"""
|
6426
|
+
``include_safety_attributes`` is set to True."""
|
6424
6427
|
|
6425
6428
|
|
6426
6429
|
GenerateImagesResponseOrDict = Union[
|
@@ -6615,80 +6618,61 @@ class EditImageConfig(_common.BaseModel):
|
|
6615
6618
|
)
|
6616
6619
|
output_gcs_uri: Optional[str] = Field(
|
6617
6620
|
default=None,
|
6618
|
-
description="""Cloud Storage URI used to store the generated images.
|
6619
|
-
""",
|
6621
|
+
description="""Cloud Storage URI used to store the generated images.""",
|
6620
6622
|
)
|
6621
6623
|
negative_prompt: Optional[str] = Field(
|
6622
6624
|
default=None,
|
6623
|
-
description="""Description of what to discourage in the generated images.
|
6624
|
-
""",
|
6625
|
+
description="""Description of what to discourage in the generated images.""",
|
6625
6626
|
)
|
6626
6627
|
number_of_images: Optional[int] = Field(
|
6627
|
-
default=None,
|
6628
|
-
description="""Number of images to generate.
|
6629
|
-
""",
|
6628
|
+
default=None, description="""Number of images to generate."""
|
6630
6629
|
)
|
6631
6630
|
aspect_ratio: Optional[str] = Field(
|
6632
6631
|
default=None,
|
6633
6632
|
description="""Aspect ratio of the generated images. Supported values are
|
6634
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
6635
|
-
""",
|
6633
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9".""",
|
6636
6634
|
)
|
6637
6635
|
guidance_scale: Optional[float] = Field(
|
6638
6636
|
default=None,
|
6639
6637
|
description="""Controls how much the model adheres to the text prompt. Large
|
6640
6638
|
values increase output and prompt alignment, but may compromise image
|
6641
|
-
quality.
|
6642
|
-
""",
|
6639
|
+
quality.""",
|
6643
6640
|
)
|
6644
6641
|
seed: Optional[int] = Field(
|
6645
6642
|
default=None,
|
6646
6643
|
description="""Random seed for image generation. This is not available when
|
6647
|
-
``add_watermark`` is set to true.
|
6648
|
-
""",
|
6644
|
+
``add_watermark`` is set to true.""",
|
6649
6645
|
)
|
6650
6646
|
safety_filter_level: Optional[SafetyFilterLevel] = Field(
|
6651
|
-
default=None,
|
6652
|
-
description="""Filter level for safety filtering.
|
6653
|
-
""",
|
6647
|
+
default=None, description="""Filter level for safety filtering."""
|
6654
6648
|
)
|
6655
6649
|
person_generation: Optional[PersonGeneration] = Field(
|
6656
|
-
default=None,
|
6657
|
-
description="""Allows generation of people by the model.
|
6658
|
-
""",
|
6650
|
+
default=None, description="""Allows generation of people by the model."""
|
6659
6651
|
)
|
6660
6652
|
include_safety_attributes: Optional[bool] = Field(
|
6661
6653
|
default=None,
|
6662
6654
|
description="""Whether to report the safety scores of each generated image and
|
6663
|
-
the positive prompt in the response.
|
6664
|
-
""",
|
6655
|
+
the positive prompt in the response.""",
|
6665
6656
|
)
|
6666
6657
|
include_rai_reason: Optional[bool] = Field(
|
6667
6658
|
default=None,
|
6668
6659
|
description="""Whether to include the Responsible AI filter reason if the image
|
6669
|
-
is filtered out of the response.
|
6670
|
-
""",
|
6660
|
+
is filtered out of the response.""",
|
6671
6661
|
)
|
6672
6662
|
language: Optional[ImagePromptLanguage] = Field(
|
6673
|
-
default=None,
|
6674
|
-
description="""Language of the text in the prompt.
|
6675
|
-
""",
|
6663
|
+
default=None, description="""Language of the text in the prompt."""
|
6676
6664
|
)
|
6677
6665
|
output_mime_type: Optional[str] = Field(
|
6678
|
-
default=None,
|
6679
|
-
description="""MIME type of the generated image.
|
6680
|
-
""",
|
6666
|
+
default=None, description="""MIME type of the generated image."""
|
6681
6667
|
)
|
6682
6668
|
output_compression_quality: Optional[int] = Field(
|
6683
6669
|
default=None,
|
6684
6670
|
description="""Compression quality of the generated image (for ``image/jpeg``
|
6685
|
-
only).
|
6686
|
-
""",
|
6671
|
+
only).""",
|
6687
6672
|
)
|
6688
6673
|
add_watermark: Optional[bool] = Field(
|
6689
6674
|
default=None,
|
6690
|
-
description="""Whether to add a watermark to the generated images.
|
6691
|
-
""",
|
6675
|
+
description="""Whether to add a watermark to the generated images.""",
|
6692
6676
|
)
|
6693
6677
|
edit_mode: Optional[EditMode] = Field(
|
6694
6678
|
default=None,
|
@@ -6708,67 +6692,53 @@ class EditImageConfigDict(TypedDict, total=False):
|
|
6708
6692
|
"""Used to override HTTP request options."""
|
6709
6693
|
|
6710
6694
|
output_gcs_uri: Optional[str]
|
6711
|
-
"""Cloud Storage URI used to store the generated images.
|
6712
|
-
"""
|
6695
|
+
"""Cloud Storage URI used to store the generated images."""
|
6713
6696
|
|
6714
6697
|
negative_prompt: Optional[str]
|
6715
|
-
"""Description of what to discourage in the generated images.
|
6716
|
-
"""
|
6698
|
+
"""Description of what to discourage in the generated images."""
|
6717
6699
|
|
6718
6700
|
number_of_images: Optional[int]
|
6719
|
-
"""Number of images to generate.
|
6720
|
-
"""
|
6701
|
+
"""Number of images to generate."""
|
6721
6702
|
|
6722
6703
|
aspect_ratio: Optional[str]
|
6723
6704
|
"""Aspect ratio of the generated images. Supported values are
|
6724
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
6725
|
-
"""
|
6705
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9"."""
|
6726
6706
|
|
6727
6707
|
guidance_scale: Optional[float]
|
6728
6708
|
"""Controls how much the model adheres to the text prompt. Large
|
6729
6709
|
values increase output and prompt alignment, but may compromise image
|
6730
|
-
quality.
|
6731
|
-
"""
|
6710
|
+
quality."""
|
6732
6711
|
|
6733
6712
|
seed: Optional[int]
|
6734
6713
|
"""Random seed for image generation. This is not available when
|
6735
|
-
``add_watermark`` is set to true.
|
6736
|
-
"""
|
6714
|
+
``add_watermark`` is set to true."""
|
6737
6715
|
|
6738
6716
|
safety_filter_level: Optional[SafetyFilterLevel]
|
6739
|
-
"""Filter level for safety filtering.
|
6740
|
-
"""
|
6717
|
+
"""Filter level for safety filtering."""
|
6741
6718
|
|
6742
6719
|
person_generation: Optional[PersonGeneration]
|
6743
|
-
"""Allows generation of people by the model.
|
6744
|
-
"""
|
6720
|
+
"""Allows generation of people by the model."""
|
6745
6721
|
|
6746
6722
|
include_safety_attributes: Optional[bool]
|
6747
6723
|
"""Whether to report the safety scores of each generated image and
|
6748
|
-
the positive prompt in the response.
|
6749
|
-
"""
|
6724
|
+
the positive prompt in the response."""
|
6750
6725
|
|
6751
6726
|
include_rai_reason: Optional[bool]
|
6752
6727
|
"""Whether to include the Responsible AI filter reason if the image
|
6753
|
-
is filtered out of the response.
|
6754
|
-
"""
|
6728
|
+
is filtered out of the response."""
|
6755
6729
|
|
6756
6730
|
language: Optional[ImagePromptLanguage]
|
6757
|
-
"""Language of the text in the prompt.
|
6758
|
-
"""
|
6731
|
+
"""Language of the text in the prompt."""
|
6759
6732
|
|
6760
6733
|
output_mime_type: Optional[str]
|
6761
|
-
"""MIME type of the generated image.
|
6762
|
-
"""
|
6734
|
+
"""MIME type of the generated image."""
|
6763
6735
|
|
6764
6736
|
output_compression_quality: Optional[int]
|
6765
6737
|
"""Compression quality of the generated image (for ``image/jpeg``
|
6766
|
-
only).
|
6767
|
-
"""
|
6738
|
+
only)."""
|
6768
6739
|
|
6769
6740
|
add_watermark: Optional[bool]
|
6770
|
-
"""Whether to add a watermark to the generated images.
|
6771
|
-
"""
|
6741
|
+
"""Whether to add a watermark to the generated images."""
|
6772
6742
|
|
6773
6743
|
edit_mode: Optional[EditMode]
|
6774
6744
|
"""Describes the editing mode for the request."""
|
@@ -6854,6 +6824,10 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
|
|
6854
6824
|
http_options: Optional[HttpOptions] = Field(
|
6855
6825
|
default=None, description="""Used to override HTTP request options."""
|
6856
6826
|
)
|
6827
|
+
output_gcs_uri: Optional[str] = Field(
|
6828
|
+
default=None,
|
6829
|
+
description="""Cloud Storage URI used to store the generated images.""",
|
6830
|
+
)
|
6857
6831
|
include_rai_reason: Optional[bool] = Field(
|
6858
6832
|
default=None,
|
6859
6833
|
description="""Whether to include a reason for filtered-out images in the
|
@@ -6865,8 +6839,8 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
|
|
6865
6839
|
)
|
6866
6840
|
output_compression_quality: Optional[int] = Field(
|
6867
6841
|
default=None,
|
6868
|
-
description="""The level of compression if the
|
6869
|
-
``image/jpeg``.""",
|
6842
|
+
description="""The level of compression. Only applicable if the
|
6843
|
+
``output_mime_type`` is ``image/jpeg``.""",
|
6870
6844
|
)
|
6871
6845
|
enhance_input_image: Optional[bool] = Field(
|
6872
6846
|
default=None,
|
@@ -6895,6 +6869,9 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
|
|
6895
6869
|
http_options: Optional[HttpOptionsDict]
|
6896
6870
|
"""Used to override HTTP request options."""
|
6897
6871
|
|
6872
|
+
output_gcs_uri: Optional[str]
|
6873
|
+
"""Cloud Storage URI used to store the generated images."""
|
6874
|
+
|
6898
6875
|
include_rai_reason: Optional[bool]
|
6899
6876
|
"""Whether to include a reason for filtered-out images in the
|
6900
6877
|
response."""
|
@@ -6903,8 +6880,8 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
|
|
6903
6880
|
"""The image format that the output should be saved as."""
|
6904
6881
|
|
6905
6882
|
output_compression_quality: Optional[int]
|
6906
|
-
"""The level of compression if the
|
6907
|
-
``image/jpeg``."""
|
6883
|
+
"""The level of compression. Only applicable if the
|
6884
|
+
``output_mime_type`` is ``image/jpeg``."""
|
6908
6885
|
|
6909
6886
|
enhance_input_image: Optional[bool]
|
6910
6887
|
"""Whether to add an image enhancing step before upscaling.
|
@@ -7078,6 +7055,10 @@ class RecontextImageConfig(_common.BaseModel):
|
|
7078
7055
|
description="""Whether allow to generate person images, and restrict to specific
|
7079
7056
|
ages.""",
|
7080
7057
|
)
|
7058
|
+
add_watermark: Optional[bool] = Field(
|
7059
|
+
default=None,
|
7060
|
+
description="""Whether to add a SynthID watermark to the generated images.""",
|
7061
|
+
)
|
7081
7062
|
output_mime_type: Optional[str] = Field(
|
7082
7063
|
default=None, description="""MIME type of the generated image."""
|
7083
7064
|
)
|
@@ -7117,6 +7098,9 @@ class RecontextImageConfigDict(TypedDict, total=False):
|
|
7117
7098
|
"""Whether allow to generate person images, and restrict to specific
|
7118
7099
|
ages."""
|
7119
7100
|
|
7101
|
+
add_watermark: Optional[bool]
|
7102
|
+
"""Whether to add a SynthID watermark to the generated images."""
|
7103
|
+
|
7120
7104
|
output_mime_type: Optional[str]
|
7121
7105
|
"""MIME type of the generated image."""
|
7122
7106
|
|
@@ -7828,12 +7812,15 @@ _DeleteModelParametersOrDict = Union[
|
|
7828
7812
|
|
7829
7813
|
class DeleteModelResponse(_common.BaseModel):
|
7830
7814
|
|
7831
|
-
|
7815
|
+
sdk_http_response: Optional[HttpResponse] = Field(
|
7816
|
+
default=None, description="""Used to retain the full HTTP response."""
|
7817
|
+
)
|
7832
7818
|
|
7833
7819
|
|
7834
7820
|
class DeleteModelResponseDict(TypedDict, total=False):
|
7835
7821
|
|
7836
|
-
|
7822
|
+
sdk_http_response: Optional[HttpResponseDict]
|
7823
|
+
"""Used to retain the full HTTP response."""
|
7837
7824
|
|
7838
7825
|
|
7839
7826
|
DeleteModelResponseOrDict = Union[DeleteModelResponse, DeleteModelResponseDict]
|
@@ -8198,7 +8185,7 @@ class TokensInfo(_common.BaseModel):
|
|
8198
8185
|
|
8199
8186
|
role: Optional[str] = Field(
|
8200
8187
|
default=None,
|
8201
|
-
description="""Optional
|
8188
|
+
description="""Optional fields for the role from the corresponding Content.""",
|
8202
8189
|
)
|
8203
8190
|
token_ids: Optional[list[int]] = Field(
|
8204
8191
|
default=None, description="""A list of token ids from the input."""
|
@@ -8212,7 +8199,7 @@ class TokensInfoDict(TypedDict, total=False):
|
|
8212
8199
|
"""Tokens info with a list of tokens and the corresponding list of token ids."""
|
8213
8200
|
|
8214
8201
|
role: Optional[str]
|
8215
|
-
"""Optional
|
8202
|
+
"""Optional fields for the role from the corresponding Content."""
|
8216
8203
|
|
8217
8204
|
token_ids: Optional[list[int]]
|
8218
8205
|
"""A list of token ids from the input."""
|
@@ -8261,7 +8248,7 @@ class Video(_common.BaseModel):
|
|
8261
8248
|
default=None, description="""Video bytes."""
|
8262
8249
|
)
|
8263
8250
|
mime_type: Optional[str] = Field(
|
8264
|
-
default=None, description="""Video encoding, for example
|
8251
|
+
default=None, description="""Video encoding, for example ``video/mp4``."""
|
8265
8252
|
)
|
8266
8253
|
|
8267
8254
|
@classmethod
|
@@ -8348,25 +8335,63 @@ class VideoDict(TypedDict, total=False):
|
|
8348
8335
|
"""Video bytes."""
|
8349
8336
|
|
8350
8337
|
mime_type: Optional[str]
|
8351
|
-
"""Video encoding, for example
|
8338
|
+
"""Video encoding, for example ``video/mp4``."""
|
8352
8339
|
|
8353
8340
|
|
8354
8341
|
VideoOrDict = Union[Video, VideoDict]
|
8355
8342
|
|
8356
8343
|
|
8344
|
+
class GenerateVideosSource(_common.BaseModel):
|
8345
|
+
"""A set of source input(s) for video generation."""
|
8346
|
+
|
8347
|
+
prompt: Optional[str] = Field(
|
8348
|
+
default=None,
|
8349
|
+
description="""The text prompt for generating the videos.
|
8350
|
+
Optional if image or video is provided.""",
|
8351
|
+
)
|
8352
|
+
image: Optional[Image] = Field(
|
8353
|
+
default=None,
|
8354
|
+
description="""The input image for generating the videos.
|
8355
|
+
Optional if prompt is provided. Not allowed if video is provided.""",
|
8356
|
+
)
|
8357
|
+
video: Optional[Video] = Field(
|
8358
|
+
default=None,
|
8359
|
+
description="""The input video for video extension use cases.
|
8360
|
+
Optional if prompt is provided. Not allowed if image is provided.""",
|
8361
|
+
)
|
8362
|
+
|
8363
|
+
|
8364
|
+
class GenerateVideosSourceDict(TypedDict, total=False):
|
8365
|
+
"""A set of source input(s) for video generation."""
|
8366
|
+
|
8367
|
+
prompt: Optional[str]
|
8368
|
+
"""The text prompt for generating the videos.
|
8369
|
+
Optional if image or video is provided."""
|
8370
|
+
|
8371
|
+
image: Optional[ImageDict]
|
8372
|
+
"""The input image for generating the videos.
|
8373
|
+
Optional if prompt is provided. Not allowed if video is provided."""
|
8374
|
+
|
8375
|
+
video: Optional[VideoDict]
|
8376
|
+
"""The input video for video extension use cases.
|
8377
|
+
Optional if prompt is provided. Not allowed if image is provided."""
|
8378
|
+
|
8379
|
+
|
8380
|
+
GenerateVideosSourceOrDict = Union[
|
8381
|
+
GenerateVideosSource, GenerateVideosSourceDict
|
8382
|
+
]
|
8383
|
+
|
8384
|
+
|
8357
8385
|
class VideoGenerationReferenceImage(_common.BaseModel):
|
8358
8386
|
"""A reference image for video generation."""
|
8359
8387
|
|
8360
8388
|
image: Optional[Image] = Field(
|
8361
|
-
default=None,
|
8362
|
-
description="""The reference image.
|
8363
|
-
""",
|
8389
|
+
default=None, description="""The reference image."""
|
8364
8390
|
)
|
8365
|
-
reference_type: Optional[
|
8391
|
+
reference_type: Optional[VideoGenerationReferenceType] = Field(
|
8366
8392
|
default=None,
|
8367
8393
|
description="""The type of the reference image, which defines how the reference
|
8368
|
-
image will be used to generate the video.
|
8369
|
-
or 'style'.""",
|
8394
|
+
image will be used to generate the video.""",
|
8370
8395
|
)
|
8371
8396
|
|
8372
8397
|
|
@@ -8374,13 +8399,11 @@ class VideoGenerationReferenceImageDict(TypedDict, total=False):
|
|
8374
8399
|
"""A reference image for video generation."""
|
8375
8400
|
|
8376
8401
|
image: Optional[ImageDict]
|
8377
|
-
"""The reference image.
|
8378
|
-
"""
|
8402
|
+
"""The reference image."""
|
8379
8403
|
|
8380
|
-
reference_type: Optional[
|
8404
|
+
reference_type: Optional[VideoGenerationReferenceType]
|
8381
8405
|
"""The type of the reference image, which defines how the reference
|
8382
|
-
image will be used to generate the video.
|
8383
|
-
or 'style'."""
|
8406
|
+
image will be used to generate the video."""
|
8384
8407
|
|
8385
8408
|
|
8386
8409
|
VideoGenerationReferenceImageOrDict = Union[
|
@@ -8410,27 +8433,35 @@ class GenerateVideosConfig(_common.BaseModel):
|
|
8410
8433
|
)
|
8411
8434
|
seed: Optional[int] = Field(
|
8412
8435
|
default=None,
|
8413
|
-
description="""The RNG seed. If RNG seed is exactly same for each request with
|
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.""",
|
8414
8440
|
)
|
8415
8441
|
aspect_ratio: Optional[str] = Field(
|
8416
8442
|
default=None,
|
8417
|
-
description="""The aspect ratio for the generated video. 16:9 (landscape) and
|
8443
|
+
description="""The aspect ratio for the generated video. 16:9 (landscape) and
|
8444
|
+
9:16 (portrait) are supported.""",
|
8418
8445
|
)
|
8419
8446
|
resolution: Optional[str] = Field(
|
8420
8447
|
default=None,
|
8421
|
-
description="""The resolution for the generated video. 720p and 1080p are
|
8448
|
+
description="""The resolution for the generated video. 720p and 1080p are
|
8449
|
+
supported.""",
|
8422
8450
|
)
|
8423
8451
|
person_generation: Optional[str] = Field(
|
8424
8452
|
default=None,
|
8425
|
-
description="""Whether allow to generate person videos, and restrict to specific
|
8453
|
+
description="""Whether allow to generate person videos, and restrict to specific
|
8454
|
+
ages. Supported values are: dont_allow, allow_adult.""",
|
8426
8455
|
)
|
8427
8456
|
pubsub_topic: Optional[str] = Field(
|
8428
8457
|
default=None,
|
8429
|
-
description="""The pubsub topic where to publish the video generation
|
8458
|
+
description="""The pubsub topic where to publish the video generation
|
8459
|
+
progress.""",
|
8430
8460
|
)
|
8431
8461
|
negative_prompt: Optional[str] = Field(
|
8432
8462
|
default=None,
|
8433
|
-
description="""
|
8463
|
+
description="""Explicitly state what should not be included in the generated
|
8464
|
+
videos.""",
|
8434
8465
|
)
|
8435
8466
|
enhance_prompt: Optional[bool] = Field(
|
8436
8467
|
default=None, description="""Whether to use the prompt rewriting logic."""
|
@@ -8441,7 +8472,8 @@ class GenerateVideosConfig(_common.BaseModel):
|
|
8441
8472
|
)
|
8442
8473
|
last_frame: Optional[Image] = Field(
|
8443
8474
|
default=None,
|
8444
|
-
description="""Image to use as the last frame of generated videos.
|
8475
|
+
description="""Image to use as the last frame of generated videos.
|
8476
|
+
Only supported for image to video use cases.""",
|
8445
8477
|
)
|
8446
8478
|
reference_images: Optional[list[VideoGenerationReferenceImage]] = Field(
|
8447
8479
|
default=None,
|
@@ -8476,22 +8508,30 @@ class GenerateVideosConfigDict(TypedDict, total=False):
|
|
8476
8508
|
"""Duration of the clip for video generation in seconds."""
|
8477
8509
|
|
8478
8510
|
seed: Optional[int]
|
8479
|
-
"""The RNG seed. If RNG seed is exactly same for each request with
|
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."""
|
8480
8515
|
|
8481
8516
|
aspect_ratio: Optional[str]
|
8482
|
-
"""The aspect ratio for the generated video. 16:9 (landscape) and
|
8517
|
+
"""The aspect ratio for the generated video. 16:9 (landscape) and
|
8518
|
+
9:16 (portrait) are supported."""
|
8483
8519
|
|
8484
8520
|
resolution: Optional[str]
|
8485
|
-
"""The resolution for the generated video. 720p and 1080p are
|
8521
|
+
"""The resolution for the generated video. 720p and 1080p are
|
8522
|
+
supported."""
|
8486
8523
|
|
8487
8524
|
person_generation: Optional[str]
|
8488
|
-
"""Whether allow to generate person videos, and restrict to specific
|
8525
|
+
"""Whether allow to generate person videos, and restrict to specific
|
8526
|
+
ages. Supported values are: dont_allow, allow_adult."""
|
8489
8527
|
|
8490
8528
|
pubsub_topic: Optional[str]
|
8491
|
-
"""The pubsub topic where to publish the video generation
|
8529
|
+
"""The pubsub topic where to publish the video generation
|
8530
|
+
progress."""
|
8492
8531
|
|
8493
8532
|
negative_prompt: Optional[str]
|
8494
|
-
"""
|
8533
|
+
"""Explicitly state what should not be included in the generated
|
8534
|
+
videos."""
|
8495
8535
|
|
8496
8536
|
enhance_prompt: Optional[bool]
|
8497
8537
|
"""Whether to use the prompt rewriting logic."""
|
@@ -8500,7 +8540,8 @@ class GenerateVideosConfigDict(TypedDict, total=False):
|
|
8500
8540
|
"""Whether to generate audio along with the video."""
|
8501
8541
|
|
8502
8542
|
last_frame: Optional[ImageDict]
|
8503
|
-
"""Image to use as the last frame of generated videos.
|
8543
|
+
"""Image to use as the last frame of generated videos.
|
8544
|
+
Only supported for image to video use cases."""
|
8504
8545
|
|
8505
8546
|
reference_images: Optional[list[VideoGenerationReferenceImageDict]]
|
8506
8547
|
"""The images to use as the references to generate the videos.
|
@@ -8528,17 +8569,22 @@ class _GenerateVideosParameters(_common.BaseModel):
|
|
8528
8569
|
)
|
8529
8570
|
prompt: Optional[str] = Field(
|
8530
8571
|
default=None,
|
8531
|
-
description="""The text prompt for generating the videos.
|
8572
|
+
description="""The text prompt for generating the videos.
|
8573
|
+
Optional if image or video is provided.""",
|
8532
8574
|
)
|
8533
8575
|
image: Optional[Image] = Field(
|
8534
8576
|
default=None,
|
8535
8577
|
description="""The input image for generating the videos.
|
8536
|
-
Optional if prompt
|
8578
|
+
Optional if prompt is provided. Not allowed if video is provided.""",
|
8537
8579
|
)
|
8538
8580
|
video: Optional[Video] = Field(
|
8539
8581
|
default=None,
|
8540
8582
|
description="""The input video for video extension use cases.
|
8541
|
-
Optional if prompt
|
8583
|
+
Optional if prompt is provided. Not allowed if image is provided.""",
|
8584
|
+
)
|
8585
|
+
source: Optional[GenerateVideosSource] = Field(
|
8586
|
+
default=None,
|
8587
|
+
description="""A set of source input(s) for video generation.""",
|
8542
8588
|
)
|
8543
8589
|
config: Optional[GenerateVideosConfig] = Field(
|
8544
8590
|
default=None, description="""Configuration for generating videos."""
|
@@ -8553,15 +8599,19 @@ class _GenerateVideosParametersDict(TypedDict, total=False):
|
|
8553
8599
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_."""
|
8554
8600
|
|
8555
8601
|
prompt: Optional[str]
|
8556
|
-
"""The text prompt for generating the videos.
|
8602
|
+
"""The text prompt for generating the videos.
|
8603
|
+
Optional if image or video is provided."""
|
8557
8604
|
|
8558
8605
|
image: Optional[ImageDict]
|
8559
8606
|
"""The input image for generating the videos.
|
8560
|
-
Optional if prompt
|
8607
|
+
Optional if prompt is provided. Not allowed if video is provided."""
|
8561
8608
|
|
8562
8609
|
video: Optional[VideoDict]
|
8563
8610
|
"""The input video for video extension use cases.
|
8564
|
-
Optional if prompt
|
8611
|
+
Optional if prompt is provided. Not allowed if image is provided."""
|
8612
|
+
|
8613
|
+
source: Optional[GenerateVideosSourceDict]
|
8614
|
+
"""A set of source input(s) for video generation."""
|
8565
8615
|
|
8566
8616
|
config: Optional[GenerateVideosConfigDict]
|
8567
8617
|
"""Configuration for generating videos."""
|
@@ -8605,6 +8655,24 @@ class GenerateVideosResponse(_common.BaseModel):
|
|
8605
8655
|
)
|
8606
8656
|
|
8607
8657
|
|
8658
|
+
class GenerateVideosResponseDict(TypedDict, total=False):
|
8659
|
+
"""Response with generated videos."""
|
8660
|
+
|
8661
|
+
generated_videos: Optional[list[GeneratedVideoDict]]
|
8662
|
+
"""List of the generated videos"""
|
8663
|
+
|
8664
|
+
rai_media_filtered_count: Optional[int]
|
8665
|
+
"""Returns if any videos were filtered due to RAI policies."""
|
8666
|
+
|
8667
|
+
rai_media_filtered_reasons: Optional[list[str]]
|
8668
|
+
"""Returns rai failure reasons if any."""
|
8669
|
+
|
8670
|
+
|
8671
|
+
GenerateVideosResponseOrDict = Union[
|
8672
|
+
GenerateVideosResponse, GenerateVideosResponseDict
|
8673
|
+
]
|
8674
|
+
|
8675
|
+
|
8608
8676
|
class Operation(ABC):
|
8609
8677
|
"""A long-running operation."""
|
8610
8678
|
|
@@ -8640,7 +8708,6 @@ class GenerateVideosOperation(_common.BaseModel, Operation):
|
|
8640
8708
|
response: Optional[GenerateVideosResponse] = Field(
|
8641
8709
|
default=None, description="""The generated videos."""
|
8642
8710
|
)
|
8643
|
-
|
8644
8711
|
result: Optional[GenerateVideosResponse] = Field(
|
8645
8712
|
default=None, description="""The generated videos."""
|
8646
8713
|
)
|
@@ -8650,76 +8717,12 @@ class GenerateVideosOperation(_common.BaseModel, Operation):
|
|
8650
8717
|
cls, api_response: Any, is_vertex_ai: bool = False
|
8651
8718
|
) -> Self:
|
8652
8719
|
"""Instantiates a GenerateVideosOperation from an API response."""
|
8653
|
-
new_operation = cls()
|
8654
|
-
new_operation.name = api_response.get('name', None)
|
8655
|
-
new_operation.metadata = api_response.get('metadata', None)
|
8656
|
-
new_operation.done = api_response.get('done', None)
|
8657
|
-
new_operation.error = api_response.get('error', None)
|
8658
|
-
|
8659
8720
|
if is_vertex_ai:
|
8660
|
-
|
8661
|
-
new_operation.response = GenerateVideosResponse(
|
8662
|
-
generated_videos=[
|
8663
|
-
GeneratedVideo(
|
8664
|
-
video=Video(
|
8665
|
-
uri=video.get('gcsUri', None),
|
8666
|
-
video_bytes=video.get('bytesBase64Encoded', None),
|
8667
|
-
mime_type=video.get('mimeType', None),
|
8668
|
-
)
|
8669
|
-
)
|
8670
|
-
for video in api_response.get('response', {}).get('videos', [])
|
8671
|
-
],
|
8672
|
-
rai_media_filtered_count=api_response.get('response', {}).get(
|
8673
|
-
'raiMediaFilteredCount', None
|
8674
|
-
),
|
8675
|
-
rai_media_filtered_reasons=api_response.get('response', {}).get(
|
8676
|
-
'raiMediaFilteredReasons', None
|
8677
|
-
),
|
8678
|
-
)
|
8721
|
+
response_dict = _GenerateVideosOperation_from_vertex(api_response)
|
8679
8722
|
else:
|
8680
|
-
|
8681
|
-
new_operation.response = GenerateVideosResponse(
|
8682
|
-
generated_videos=[
|
8683
|
-
GeneratedVideo(
|
8684
|
-
video=Video(
|
8685
|
-
uri=video.get('video', {}).get('uri', None),
|
8686
|
-
video_bytes=video.get('video', {}).get(
|
8687
|
-
'encodedVideo', None
|
8688
|
-
),
|
8689
|
-
mime_type=video.get('encoding', None),
|
8690
|
-
)
|
8691
|
-
)
|
8692
|
-
for video in api_response.get('response', {})
|
8693
|
-
.get('generateVideoResponse', {})
|
8694
|
-
.get('generatedSamples', [])
|
8695
|
-
],
|
8696
|
-
rai_media_filtered_count=api_response.get('response', {})
|
8697
|
-
.get('generateVideoResponse', {})
|
8698
|
-
.get('raiMediaFilteredCount', None),
|
8699
|
-
rai_media_filtered_reasons=api_response.get('response', {})
|
8700
|
-
.get('generateVideoResponse', {})
|
8701
|
-
.get('raiMediaFilteredReasons', None),
|
8702
|
-
)
|
8703
|
-
new_operation.result = new_operation.response
|
8704
|
-
return new_operation
|
8705
|
-
|
8706
|
-
|
8707
|
-
class GenerateVideosResponseDict(TypedDict, total=False):
|
8708
|
-
"""Response with generated videos."""
|
8709
|
-
|
8710
|
-
generated_videos: Optional[list[GeneratedVideoDict]]
|
8711
|
-
"""List of the generated videos"""
|
8712
|
-
|
8713
|
-
rai_media_filtered_count: Optional[int]
|
8714
|
-
"""Returns if any videos were filtered due to RAI policies."""
|
8723
|
+
response_dict = _GenerateVideosOperation_from_mldev(api_response)
|
8715
8724
|
|
8716
|
-
|
8717
|
-
"""Returns rai failure reasons if any."""
|
8718
|
-
|
8719
|
-
|
8720
|
-
GenerateVideosResponseOrDict = Union[
|
8721
|
-
GenerateVideosResponse, GenerateVideosResponseDict
|
8722
|
-
]
|
8725
|
+
return cls._from_response(response=response_dict, kwargs={})
|
8723
8726
|
|
8724
8727
|
|
8725
8728
|
class GetTuningJobConfig(_common.BaseModel):
|
@@ -10193,6 +10196,52 @@ ListTuningJobsResponseOrDict = Union[
|
|
10193
10196
|
]
|
10194
10197
|
|
10195
10198
|
|
10199
|
+
class CancelTuningJobConfig(_common.BaseModel):
|
10200
|
+
"""Optional parameters for tunings.cancel method."""
|
10201
|
+
|
10202
|
+
http_options: Optional[HttpOptions] = Field(
|
10203
|
+
default=None, description="""Used to override HTTP request options."""
|
10204
|
+
)
|
10205
|
+
|
10206
|
+
|
10207
|
+
class CancelTuningJobConfigDict(TypedDict, total=False):
|
10208
|
+
"""Optional parameters for tunings.cancel method."""
|
10209
|
+
|
10210
|
+
http_options: Optional[HttpOptionsDict]
|
10211
|
+
"""Used to override HTTP request options."""
|
10212
|
+
|
10213
|
+
|
10214
|
+
CancelTuningJobConfigOrDict = Union[
|
10215
|
+
CancelTuningJobConfig, CancelTuningJobConfigDict
|
10216
|
+
]
|
10217
|
+
|
10218
|
+
|
10219
|
+
class _CancelTuningJobParameters(_common.BaseModel):
|
10220
|
+
"""Parameters for the cancel method."""
|
10221
|
+
|
10222
|
+
name: Optional[str] = Field(
|
10223
|
+
default=None, description="""The resource name of the tuning job."""
|
10224
|
+
)
|
10225
|
+
config: Optional[CancelTuningJobConfig] = Field(
|
10226
|
+
default=None, description="""Optional parameters for the request."""
|
10227
|
+
)
|
10228
|
+
|
10229
|
+
|
10230
|
+
class _CancelTuningJobParametersDict(TypedDict, total=False):
|
10231
|
+
"""Parameters for the cancel method."""
|
10232
|
+
|
10233
|
+
name: Optional[str]
|
10234
|
+
"""The resource name of the tuning job."""
|
10235
|
+
|
10236
|
+
config: Optional[CancelTuningJobConfigDict]
|
10237
|
+
"""Optional parameters for the request."""
|
10238
|
+
|
10239
|
+
|
10240
|
+
_CancelTuningJobParametersOrDict = Union[
|
10241
|
+
_CancelTuningJobParameters, _CancelTuningJobParametersDict
|
10242
|
+
]
|
10243
|
+
|
10244
|
+
|
10196
10245
|
class TuningExample(_common.BaseModel):
|
10197
10246
|
|
10198
10247
|
text_input: Optional[str] = Field(
|
@@ -10797,13 +10846,16 @@ _DeleteCachedContentParametersOrDict = Union[
|
|
10797
10846
|
class DeleteCachedContentResponse(_common.BaseModel):
|
10798
10847
|
"""Empty response for caches.delete method."""
|
10799
10848
|
|
10800
|
-
|
10849
|
+
sdk_http_response: Optional[HttpResponse] = Field(
|
10850
|
+
default=None, description="""Used to retain the full HTTP response."""
|
10851
|
+
)
|
10801
10852
|
|
10802
10853
|
|
10803
10854
|
class DeleteCachedContentResponseDict(TypedDict, total=False):
|
10804
10855
|
"""Empty response for caches.delete method."""
|
10805
10856
|
|
10806
|
-
|
10857
|
+
sdk_http_response: Optional[HttpResponseDict]
|
10858
|
+
"""Used to retain the full HTTP response."""
|
10807
10859
|
|
10808
10860
|
|
10809
10861
|
DeleteCachedContentResponseOrDict = Union[
|
@@ -11208,13 +11260,16 @@ _DeleteFileParametersOrDict = Union[
|
|
11208
11260
|
class DeleteFileResponse(_common.BaseModel):
|
11209
11261
|
"""Response for the delete file method."""
|
11210
11262
|
|
11211
|
-
|
11263
|
+
sdk_http_response: Optional[HttpResponse] = Field(
|
11264
|
+
default=None, description="""Used to retain the full HTTP response."""
|
11265
|
+
)
|
11212
11266
|
|
11213
11267
|
|
11214
11268
|
class DeleteFileResponseDict(TypedDict, total=False):
|
11215
11269
|
"""Response for the delete file method."""
|
11216
11270
|
|
11217
|
-
|
11271
|
+
sdk_http_response: Optional[HttpResponseDict]
|
11272
|
+
"""Used to retain the full HTTP response."""
|
11218
11273
|
|
11219
11274
|
|
11220
11275
|
DeleteFileResponseOrDict = Union[DeleteFileResponse, DeleteFileResponseDict]
|
@@ -12281,6 +12336,10 @@ class UpscaleImageConfig(_common.BaseModel):
|
|
12281
12336
|
http_options: Optional[HttpOptions] = Field(
|
12282
12337
|
default=None, description="""Used to override HTTP request options."""
|
12283
12338
|
)
|
12339
|
+
output_gcs_uri: Optional[str] = Field(
|
12340
|
+
default=None,
|
12341
|
+
description="""Cloud Storage URI used to store the generated images.""",
|
12342
|
+
)
|
12284
12343
|
include_rai_reason: Optional[bool] = Field(
|
12285
12344
|
default=None,
|
12286
12345
|
description="""Whether to include a reason for filtered-out images in the
|
@@ -12292,8 +12351,8 @@ class UpscaleImageConfig(_common.BaseModel):
|
|
12292
12351
|
)
|
12293
12352
|
output_compression_quality: Optional[int] = Field(
|
12294
12353
|
default=None,
|
12295
|
-
description="""The level of compression if the
|
12296
|
-
``image/jpeg``.""",
|
12354
|
+
description="""The level of compression. Only applicable if the
|
12355
|
+
``output_mime_type`` is ``image/jpeg``.""",
|
12297
12356
|
)
|
12298
12357
|
enhance_input_image: Optional[bool] = Field(
|
12299
12358
|
default=None,
|
@@ -12321,6 +12380,9 @@ class UpscaleImageConfigDict(TypedDict, total=False):
|
|
12321
12380
|
http_options: Optional[HttpOptionsDict]
|
12322
12381
|
"""Used to override HTTP request options."""
|
12323
12382
|
|
12383
|
+
output_gcs_uri: Optional[str]
|
12384
|
+
"""Cloud Storage URI used to store the generated images."""
|
12385
|
+
|
12324
12386
|
include_rai_reason: Optional[bool]
|
12325
12387
|
"""Whether to include a reason for filtered-out images in the
|
12326
12388
|
response."""
|
@@ -12329,8 +12391,8 @@ class UpscaleImageConfigDict(TypedDict, total=False):
|
|
12329
12391
|
"""The image format that the output should be saved as."""
|
12330
12392
|
|
12331
12393
|
output_compression_quality: Optional[int]
|
12332
|
-
"""The level of compression if the
|
12333
|
-
``image/jpeg``."""
|
12394
|
+
"""The level of compression. Only applicable if the
|
12395
|
+
``output_mime_type`` is ``image/jpeg``."""
|
12334
12396
|
|
12335
12397
|
enhance_input_image: Optional[bool]
|
12336
12398
|
"""Whether to add an image enhancing step before upscaling.
|
@@ -14737,6 +14799,42 @@ CreateAuthTokenParametersOrDict = Union[
|
|
14737
14799
|
]
|
14738
14800
|
|
14739
14801
|
|
14802
|
+
class CountTokensResult(_common.BaseModel):
|
14803
|
+
"""Local tokenizer count tokens result."""
|
14804
|
+
|
14805
|
+
total_tokens: Optional[int] = Field(
|
14806
|
+
default=None, description="""The total number of tokens."""
|
14807
|
+
)
|
14808
|
+
|
14809
|
+
|
14810
|
+
class CountTokensResultDict(TypedDict, total=False):
|
14811
|
+
"""Local tokenizer count tokens result."""
|
14812
|
+
|
14813
|
+
total_tokens: Optional[int]
|
14814
|
+
"""The total number of tokens."""
|
14815
|
+
|
14816
|
+
|
14817
|
+
CountTokensResultOrDict = Union[CountTokensResult, CountTokensResultDict]
|
14818
|
+
|
14819
|
+
|
14820
|
+
class ComputeTokensResult(_common.BaseModel):
|
14821
|
+
"""Local tokenizer compute tokens result."""
|
14822
|
+
|
14823
|
+
tokens_info: Optional[list[TokensInfo]] = Field(
|
14824
|
+
default=None, description="""Lists of tokens info from the input."""
|
14825
|
+
)
|
14826
|
+
|
14827
|
+
|
14828
|
+
class ComputeTokensResultDict(TypedDict, total=False):
|
14829
|
+
"""Local tokenizer compute tokens result."""
|
14830
|
+
|
14831
|
+
tokens_info: Optional[list[TokensInfoDict]]
|
14832
|
+
"""Lists of tokens info from the input."""
|
14833
|
+
|
14834
|
+
|
14835
|
+
ComputeTokensResultOrDict = Union[ComputeTokensResult, ComputeTokensResultDict]
|
14836
|
+
|
14837
|
+
|
14740
14838
|
class CreateTuningJobParameters(_common.BaseModel):
|
14741
14839
|
"""Supervised fine-tuning job creation parameters - optional fields."""
|
14742
14840
|
|