google-genai 1.32.0__py3-none-any.whl → 1.34.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/_common.py +5 -1
- google/genai/_extra_utils.py +5 -8
- google/genai/_live_converters.py +100 -44
- google/genai/_replay_api_client.py +15 -0
- google/genai/_tokens_converters.py +24 -3
- google/genai/_transformers.py +55 -15
- google/genai/batches.py +680 -142
- google/genai/caches.py +50 -6
- google/genai/files.py +2 -0
- google/genai/local_tokenizer.py +29 -1
- google/genai/models.py +127 -191
- google/genai/types.py +431 -278
- google/genai/version.py +1 -1
- {google_genai-1.32.0.dist-info → google_genai-1.34.0.dist-info}/METADATA +18 -1
- {google_genai-1.32.0.dist-info → google_genai-1.34.0.dist-info}/RECORD +19 -19
- {google_genai-1.32.0.dist-info → google_genai-1.34.0.dist-info}/WHEEL +0 -0
- {google_genai-1.32.0.dist-info → google_genai-1.34.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.32.0.dist-info → google_genai-1.34.0.dist-info}/top_level.txt +0 -0
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
|
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['
|
828
|
-
"""Returns the Blob as a
|
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
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
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):
|
@@ -888,6 +885,41 @@ class FileDataDict(TypedDict, total=False):
|
|
888
885
|
FileDataOrDict = Union[FileData, FileDataDict]
|
889
886
|
|
890
887
|
|
888
|
+
class FunctionCall(_common.BaseModel):
|
889
|
+
"""A function call."""
|
890
|
+
|
891
|
+
id: Optional[str] = Field(
|
892
|
+
default=None,
|
893
|
+
description="""The unique id of the function call. If populated, the client to execute the
|
894
|
+
`function_call` and return the response with the matching `id`.""",
|
895
|
+
)
|
896
|
+
args: Optional[dict[str, Any]] = Field(
|
897
|
+
default=None,
|
898
|
+
description="""Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.""",
|
899
|
+
)
|
900
|
+
name: Optional[str] = Field(
|
901
|
+
default=None,
|
902
|
+
description="""Required. The name of the function to call. Matches [FunctionDeclaration.name].""",
|
903
|
+
)
|
904
|
+
|
905
|
+
|
906
|
+
class FunctionCallDict(TypedDict, total=False):
|
907
|
+
"""A function call."""
|
908
|
+
|
909
|
+
id: Optional[str]
|
910
|
+
"""The unique id of the function call. If populated, the client to execute the
|
911
|
+
`function_call` and return the response with the matching `id`."""
|
912
|
+
|
913
|
+
args: Optional[dict[str, Any]]
|
914
|
+
"""Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details."""
|
915
|
+
|
916
|
+
name: Optional[str]
|
917
|
+
"""Required. The name of the function to call. Matches [FunctionDeclaration.name]."""
|
918
|
+
|
919
|
+
|
920
|
+
FunctionCallOrDict = Union[FunctionCall, FunctionCallDict]
|
921
|
+
|
922
|
+
|
891
923
|
class CodeExecutionResult(_common.BaseModel):
|
892
924
|
"""Result of executing the [ExecutableCode].
|
893
925
|
|
@@ -956,41 +988,6 @@ class ExecutableCodeDict(TypedDict, total=False):
|
|
956
988
|
ExecutableCodeOrDict = Union[ExecutableCode, ExecutableCodeDict]
|
957
989
|
|
958
990
|
|
959
|
-
class FunctionCall(_common.BaseModel):
|
960
|
-
"""A function call."""
|
961
|
-
|
962
|
-
id: Optional[str] = Field(
|
963
|
-
default=None,
|
964
|
-
description="""The unique id of the function call. If populated, the client to execute the
|
965
|
-
`function_call` and return the response with the matching `id`.""",
|
966
|
-
)
|
967
|
-
args: Optional[dict[str, Any]] = Field(
|
968
|
-
default=None,
|
969
|
-
description="""Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.""",
|
970
|
-
)
|
971
|
-
name: Optional[str] = Field(
|
972
|
-
default=None,
|
973
|
-
description="""Required. The name of the function to call. Matches [FunctionDeclaration.name].""",
|
974
|
-
)
|
975
|
-
|
976
|
-
|
977
|
-
class FunctionCallDict(TypedDict, total=False):
|
978
|
-
"""A function call."""
|
979
|
-
|
980
|
-
id: Optional[str]
|
981
|
-
"""The unique id of the function call. If populated, the client to execute the
|
982
|
-
`function_call` and return the response with the matching `id`."""
|
983
|
-
|
984
|
-
args: Optional[dict[str, Any]]
|
985
|
-
"""Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details."""
|
986
|
-
|
987
|
-
name: Optional[str]
|
988
|
-
"""Required. The name of the function to call. Matches [FunctionDeclaration.name]."""
|
989
|
-
|
990
|
-
|
991
|
-
FunctionCallOrDict = Union[FunctionCall, FunctionCallDict]
|
992
|
-
|
993
|
-
|
994
991
|
class FunctionResponse(_common.BaseModel):
|
995
992
|
"""A function response."""
|
996
993
|
|
@@ -1078,6 +1075,12 @@ class Part(_common.BaseModel):
|
|
1078
1075
|
default=None,
|
1079
1076
|
description="""An opaque signature for the thought so it can be reused in subsequent requests.""",
|
1080
1077
|
)
|
1078
|
+
function_call: Optional[FunctionCall] = Field(
|
1079
|
+
default=None,
|
1080
|
+
description="""A predicted [FunctionCall] returned from the model that contains a string
|
1081
|
+
representing the [FunctionDeclaration.name] and a structured JSON object
|
1082
|
+
containing the parameters and their values.""",
|
1083
|
+
)
|
1081
1084
|
code_execution_result: Optional[CodeExecutionResult] = Field(
|
1082
1085
|
default=None,
|
1083
1086
|
description="""Optional. Result of executing the [ExecutableCode].""",
|
@@ -1086,10 +1089,6 @@ class Part(_common.BaseModel):
|
|
1086
1089
|
default=None,
|
1087
1090
|
description="""Optional. Code generated by the model that is meant to be executed.""",
|
1088
1091
|
)
|
1089
|
-
function_call: Optional[FunctionCall] = Field(
|
1090
|
-
default=None,
|
1091
|
-
description="""Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values.""",
|
1092
|
-
)
|
1093
1092
|
function_response: Optional[FunctionResponse] = Field(
|
1094
1093
|
default=None,
|
1095
1094
|
description="""Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model.""",
|
@@ -1098,7 +1097,7 @@ class Part(_common.BaseModel):
|
|
1098
1097
|
default=None, description="""Optional. Text part (can be code)."""
|
1099
1098
|
)
|
1100
1099
|
|
1101
|
-
def as_image(self) -> Optional['
|
1100
|
+
def as_image(self) -> Optional['Image']:
|
1102
1101
|
"""Returns the part as a PIL Image, or None if the part is not an image."""
|
1103
1102
|
if not self.inline_data:
|
1104
1103
|
return None
|
@@ -1184,15 +1183,17 @@ class PartDict(TypedDict, total=False):
|
|
1184
1183
|
thought_signature: Optional[bytes]
|
1185
1184
|
"""An opaque signature for the thought so it can be reused in subsequent requests."""
|
1186
1185
|
|
1186
|
+
function_call: Optional[FunctionCallDict]
|
1187
|
+
"""A predicted [FunctionCall] returned from the model that contains a string
|
1188
|
+
representing the [FunctionDeclaration.name] and a structured JSON object
|
1189
|
+
containing the parameters and their values."""
|
1190
|
+
|
1187
1191
|
code_execution_result: Optional[CodeExecutionResultDict]
|
1188
1192
|
"""Optional. Result of executing the [ExecutableCode]."""
|
1189
1193
|
|
1190
1194
|
executable_code: Optional[ExecutableCodeDict]
|
1191
1195
|
"""Optional. Code generated by the model that is meant to be executed."""
|
1192
1196
|
|
1193
|
-
function_call: Optional[FunctionCallDict]
|
1194
|
-
"""Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."""
|
1195
|
-
|
1196
1197
|
function_response: Optional[FunctionResponseDict]
|
1197
1198
|
"""Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."""
|
1198
1199
|
|
@@ -3901,6 +3902,10 @@ class GenerateContentConfig(_common.BaseModel):
|
|
3901
3902
|
http_options: Optional[HttpOptions] = Field(
|
3902
3903
|
default=None, description="""Used to override HTTP request options."""
|
3903
3904
|
)
|
3905
|
+
should_return_http_response: Optional[bool] = Field(
|
3906
|
+
default=None,
|
3907
|
+
description=""" If true, the raw HTTP response will be returned in the 'sdk_http_response' field.""",
|
3908
|
+
)
|
3904
3909
|
system_instruction: Optional[ContentUnion] = Field(
|
3905
3910
|
default=None,
|
3906
3911
|
description="""Instructions for the model to steer it toward better performance.
|
@@ -4115,6 +4120,9 @@ class GenerateContentConfigDict(TypedDict, total=False):
|
|
4115
4120
|
http_options: Optional[HttpOptionsDict]
|
4116
4121
|
"""Used to override HTTP request options."""
|
4117
4122
|
|
4123
|
+
should_return_http_response: Optional[bool]
|
4124
|
+
""" If true, the raw HTTP response will be returned in the 'sdk_http_response' field."""
|
4125
|
+
|
4118
4126
|
system_instruction: Optional[ContentUnionDict]
|
4119
4127
|
"""Instructions for the model to steer it toward better performance.
|
4120
4128
|
For example, "Answer as concisely as possible" or "Don't use technical
|
@@ -5972,91 +5980,69 @@ class GenerateImagesConfig(_common.BaseModel):
|
|
5972
5980
|
)
|
5973
5981
|
output_gcs_uri: Optional[str] = Field(
|
5974
5982
|
default=None,
|
5975
|
-
description="""Cloud Storage URI used to store the generated images.
|
5976
|
-
""",
|
5983
|
+
description="""Cloud Storage URI used to store the generated images.""",
|
5977
5984
|
)
|
5978
5985
|
negative_prompt: Optional[str] = Field(
|
5979
5986
|
default=None,
|
5980
|
-
description="""Description of what to discourage in the generated images.
|
5981
|
-
""",
|
5987
|
+
description="""Description of what to discourage in the generated images.""",
|
5982
5988
|
)
|
5983
5989
|
number_of_images: Optional[int] = Field(
|
5984
|
-
default=None,
|
5985
|
-
description="""Number of images to generate.
|
5986
|
-
""",
|
5990
|
+
default=None, description="""Number of images to generate."""
|
5987
5991
|
)
|
5988
5992
|
aspect_ratio: Optional[str] = Field(
|
5989
5993
|
default=None,
|
5990
5994
|
description="""Aspect ratio of the generated images. Supported values are
|
5991
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
5992
|
-
""",
|
5995
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9".""",
|
5993
5996
|
)
|
5994
5997
|
guidance_scale: Optional[float] = Field(
|
5995
5998
|
default=None,
|
5996
5999
|
description="""Controls how much the model adheres to the text prompt. Large
|
5997
6000
|
values increase output and prompt alignment, but may compromise image
|
5998
|
-
quality.
|
5999
|
-
""",
|
6001
|
+
quality.""",
|
6000
6002
|
)
|
6001
6003
|
seed: Optional[int] = Field(
|
6002
6004
|
default=None,
|
6003
6005
|
description="""Random seed for image generation. This is not available when
|
6004
|
-
``add_watermark`` is set to true.
|
6005
|
-
""",
|
6006
|
+
``add_watermark`` is set to true.""",
|
6006
6007
|
)
|
6007
6008
|
safety_filter_level: Optional[SafetyFilterLevel] = Field(
|
6008
|
-
default=None,
|
6009
|
-
description="""Filter level for safety filtering.
|
6010
|
-
""",
|
6009
|
+
default=None, description="""Filter level for safety filtering."""
|
6011
6010
|
)
|
6012
6011
|
person_generation: Optional[PersonGeneration] = Field(
|
6013
|
-
default=None,
|
6014
|
-
description="""Allows generation of people by the model.
|
6015
|
-
""",
|
6012
|
+
default=None, description="""Allows generation of people by the model."""
|
6016
6013
|
)
|
6017
6014
|
include_safety_attributes: Optional[bool] = Field(
|
6018
6015
|
default=None,
|
6019
6016
|
description="""Whether to report the safety scores of each generated image and
|
6020
|
-
the positive prompt in the response.
|
6021
|
-
""",
|
6017
|
+
the positive prompt in the response.""",
|
6022
6018
|
)
|
6023
6019
|
include_rai_reason: Optional[bool] = Field(
|
6024
6020
|
default=None,
|
6025
6021
|
description="""Whether to include the Responsible AI filter reason if the image
|
6026
|
-
is filtered out of the response.
|
6027
|
-
""",
|
6022
|
+
is filtered out of the response.""",
|
6028
6023
|
)
|
6029
6024
|
language: Optional[ImagePromptLanguage] = Field(
|
6030
|
-
default=None,
|
6031
|
-
description="""Language of the text in the prompt.
|
6032
|
-
""",
|
6025
|
+
default=None, description="""Language of the text in the prompt."""
|
6033
6026
|
)
|
6034
6027
|
output_mime_type: Optional[str] = Field(
|
6035
|
-
default=None,
|
6036
|
-
description="""MIME type of the generated image.
|
6037
|
-
""",
|
6028
|
+
default=None, description="""MIME type of the generated image."""
|
6038
6029
|
)
|
6039
6030
|
output_compression_quality: Optional[int] = Field(
|
6040
6031
|
default=None,
|
6041
6032
|
description="""Compression quality of the generated image (for ``image/jpeg``
|
6042
|
-
only).
|
6043
|
-
""",
|
6033
|
+
only).""",
|
6044
6034
|
)
|
6045
6035
|
add_watermark: Optional[bool] = Field(
|
6046
6036
|
default=None,
|
6047
|
-
description="""Whether to add a watermark to the generated images.
|
6048
|
-
""",
|
6037
|
+
description="""Whether to add a watermark to the generated images.""",
|
6049
6038
|
)
|
6050
6039
|
image_size: Optional[str] = Field(
|
6051
6040
|
default=None,
|
6052
6041
|
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
|
-
""",
|
6042
|
+
Supported sizes are 1K and 2K (not supported for Imagen 3 models).""",
|
6055
6043
|
)
|
6056
6044
|
enhance_prompt: Optional[bool] = Field(
|
6057
|
-
default=None,
|
6058
|
-
description="""Whether to use the prompt rewriting logic.
|
6059
|
-
""",
|
6045
|
+
default=None, description="""Whether to use the prompt rewriting logic."""
|
6060
6046
|
)
|
6061
6047
|
|
6062
6048
|
|
@@ -6067,76 +6053,60 @@ class GenerateImagesConfigDict(TypedDict, total=False):
|
|
6067
6053
|
"""Used to override HTTP request options."""
|
6068
6054
|
|
6069
6055
|
output_gcs_uri: Optional[str]
|
6070
|
-
"""Cloud Storage URI used to store the generated images.
|
6071
|
-
"""
|
6056
|
+
"""Cloud Storage URI used to store the generated images."""
|
6072
6057
|
|
6073
6058
|
negative_prompt: Optional[str]
|
6074
|
-
"""Description of what to discourage in the generated images.
|
6075
|
-
"""
|
6059
|
+
"""Description of what to discourage in the generated images."""
|
6076
6060
|
|
6077
6061
|
number_of_images: Optional[int]
|
6078
|
-
"""Number of images to generate.
|
6079
|
-
"""
|
6062
|
+
"""Number of images to generate."""
|
6080
6063
|
|
6081
6064
|
aspect_ratio: Optional[str]
|
6082
6065
|
"""Aspect ratio of the generated images. Supported values are
|
6083
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
6084
|
-
"""
|
6066
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9"."""
|
6085
6067
|
|
6086
6068
|
guidance_scale: Optional[float]
|
6087
6069
|
"""Controls how much the model adheres to the text prompt. Large
|
6088
6070
|
values increase output and prompt alignment, but may compromise image
|
6089
|
-
quality.
|
6090
|
-
"""
|
6071
|
+
quality."""
|
6091
6072
|
|
6092
6073
|
seed: Optional[int]
|
6093
6074
|
"""Random seed for image generation. This is not available when
|
6094
|
-
``add_watermark`` is set to true.
|
6095
|
-
"""
|
6075
|
+
``add_watermark`` is set to true."""
|
6096
6076
|
|
6097
6077
|
safety_filter_level: Optional[SafetyFilterLevel]
|
6098
|
-
"""Filter level for safety filtering.
|
6099
|
-
"""
|
6078
|
+
"""Filter level for safety filtering."""
|
6100
6079
|
|
6101
6080
|
person_generation: Optional[PersonGeneration]
|
6102
|
-
"""Allows generation of people by the model.
|
6103
|
-
"""
|
6081
|
+
"""Allows generation of people by the model."""
|
6104
6082
|
|
6105
6083
|
include_safety_attributes: Optional[bool]
|
6106
6084
|
"""Whether to report the safety scores of each generated image and
|
6107
|
-
the positive prompt in the response.
|
6108
|
-
"""
|
6085
|
+
the positive prompt in the response."""
|
6109
6086
|
|
6110
6087
|
include_rai_reason: Optional[bool]
|
6111
6088
|
"""Whether to include the Responsible AI filter reason if the image
|
6112
|
-
is filtered out of the response.
|
6113
|
-
"""
|
6089
|
+
is filtered out of the response."""
|
6114
6090
|
|
6115
6091
|
language: Optional[ImagePromptLanguage]
|
6116
|
-
"""Language of the text in the prompt.
|
6117
|
-
"""
|
6092
|
+
"""Language of the text in the prompt."""
|
6118
6093
|
|
6119
6094
|
output_mime_type: Optional[str]
|
6120
|
-
"""MIME type of the generated image.
|
6121
|
-
"""
|
6095
|
+
"""MIME type of the generated image."""
|
6122
6096
|
|
6123
6097
|
output_compression_quality: Optional[int]
|
6124
6098
|
"""Compression quality of the generated image (for ``image/jpeg``
|
6125
|
-
only).
|
6126
|
-
"""
|
6099
|
+
only)."""
|
6127
6100
|
|
6128
6101
|
add_watermark: Optional[bool]
|
6129
|
-
"""Whether to add a watermark to the generated images.
|
6130
|
-
"""
|
6102
|
+
"""Whether to add a watermark to the generated images."""
|
6131
6103
|
|
6132
6104
|
image_size: Optional[str]
|
6133
6105
|
"""The size of the largest dimension of the generated image.
|
6134
|
-
Supported sizes are 1K and 2K (not supported for Imagen 3 models).
|
6135
|
-
"""
|
6106
|
+
Supported sizes are 1K and 2K (not supported for Imagen 3 models)."""
|
6136
6107
|
|
6137
6108
|
enhance_prompt: Optional[bool]
|
6138
|
-
"""Whether to use the prompt rewriting logic.
|
6139
|
-
"""
|
6109
|
+
"""Whether to use the prompt rewriting logic."""
|
6140
6110
|
|
6141
6111
|
|
6142
6112
|
GenerateImagesConfigOrDict = Union[
|
@@ -6191,14 +6161,12 @@ class Image(_common.BaseModel):
|
|
6191
6161
|
gcs_uri: Optional[str] = Field(
|
6192
6162
|
default=None,
|
6193
6163
|
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
|
-
""",
|
6164
|
+
for this field or the ``image_bytes`` field but not both.""",
|
6196
6165
|
)
|
6197
6166
|
image_bytes: Optional[bytes] = Field(
|
6198
6167
|
default=None,
|
6199
6168
|
description="""The image bytes data. ``Image`` can contain a value for this field
|
6200
|
-
or the ``gcs_uri`` field but not both.
|
6201
|
-
""",
|
6169
|
+
or the ``gcs_uri`` field but not both.""",
|
6202
6170
|
)
|
6203
6171
|
mime_type: Optional[str] = Field(
|
6204
6172
|
default=None, description="""The MIME type of the image."""
|
@@ -6255,13 +6223,19 @@ class Image(_common.BaseModel):
|
|
6255
6223
|
|
6256
6224
|
This method only works in a notebook environment.
|
6257
6225
|
"""
|
6258
|
-
|
6259
|
-
|
6260
|
-
|
6261
|
-
|
6226
|
+
in_notebook = 'ipykernel' in sys.modules
|
6227
|
+
if in_notebook:
|
6228
|
+
try:
|
6229
|
+
from IPython import display as IPython_display
|
6230
|
+
except ImportError:
|
6231
|
+
IPython_display = None
|
6262
6232
|
|
6263
|
-
|
6264
|
-
|
6233
|
+
if IPython_display:
|
6234
|
+
IPython_display.display(self._pil_image)
|
6235
|
+
else:
|
6236
|
+
img = self._pil_image
|
6237
|
+
if img is not None:
|
6238
|
+
img.show()
|
6265
6239
|
|
6266
6240
|
@property
|
6267
6241
|
def _pil_image(self) -> Optional['PIL_Image']:
|
@@ -6327,13 +6301,11 @@ class ImageDict(TypedDict, total=False):
|
|
6327
6301
|
|
6328
6302
|
gcs_uri: Optional[str]
|
6329
6303
|
"""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
|
-
"""
|
6304
|
+
for this field or the ``image_bytes`` field but not both."""
|
6332
6305
|
|
6333
6306
|
image_bytes: Optional[bytes]
|
6334
6307
|
"""The image bytes data. ``Image`` can contain a value for this field
|
6335
|
-
or the ``gcs_uri`` field but not both.
|
6336
|
-
"""
|
6308
|
+
or the ``gcs_uri`` field but not both."""
|
6337
6309
|
|
6338
6310
|
mime_type: Optional[str]
|
6339
6311
|
"""The MIME type of the image."""
|
@@ -6346,19 +6318,13 @@ class SafetyAttributes(_common.BaseModel):
|
|
6346
6318
|
"""Safety attributes of a GeneratedImage or the user-provided prompt."""
|
6347
6319
|
|
6348
6320
|
categories: Optional[list[str]] = Field(
|
6349
|
-
default=None,
|
6350
|
-
description="""List of RAI categories.
|
6351
|
-
""",
|
6321
|
+
default=None, description="""List of RAI categories."""
|
6352
6322
|
)
|
6353
6323
|
scores: Optional[list[float]] = Field(
|
6354
|
-
default=None,
|
6355
|
-
description="""List of scores of each categories.
|
6356
|
-
""",
|
6324
|
+
default=None, description="""List of scores of each categories."""
|
6357
6325
|
)
|
6358
6326
|
content_type: Optional[str] = Field(
|
6359
|
-
default=None,
|
6360
|
-
description="""Internal use only.
|
6361
|
-
""",
|
6327
|
+
default=None, description="""Internal use only."""
|
6362
6328
|
)
|
6363
6329
|
|
6364
6330
|
|
@@ -6366,16 +6332,13 @@ class SafetyAttributesDict(TypedDict, total=False):
|
|
6366
6332
|
"""Safety attributes of a GeneratedImage or the user-provided prompt."""
|
6367
6333
|
|
6368
6334
|
categories: Optional[list[str]]
|
6369
|
-
"""List of RAI categories.
|
6370
|
-
"""
|
6335
|
+
"""List of RAI categories."""
|
6371
6336
|
|
6372
6337
|
scores: Optional[list[float]]
|
6373
|
-
"""List of scores of each categories.
|
6374
|
-
"""
|
6338
|
+
"""List of scores of each categories."""
|
6375
6339
|
|
6376
6340
|
content_type: Optional[str]
|
6377
|
-
"""Internal use only.
|
6378
|
-
"""
|
6341
|
+
"""Internal use only."""
|
6379
6342
|
|
6380
6343
|
|
6381
6344
|
SafetyAttributesOrDict = Union[SafetyAttributes, SafetyAttributesDict]
|
@@ -6385,27 +6348,22 @@ class GeneratedImage(_common.BaseModel):
|
|
6385
6348
|
"""An output image."""
|
6386
6349
|
|
6387
6350
|
image: Optional[Image] = Field(
|
6388
|
-
default=None,
|
6389
|
-
description="""The output image data.
|
6390
|
-
""",
|
6351
|
+
default=None, description="""The output image data."""
|
6391
6352
|
)
|
6392
6353
|
rai_filtered_reason: Optional[str] = Field(
|
6393
6354
|
default=None,
|
6394
6355
|
description="""Responsible AI filter reason if the image is filtered out of the
|
6395
|
-
response.
|
6396
|
-
""",
|
6356
|
+
response.""",
|
6397
6357
|
)
|
6398
6358
|
safety_attributes: Optional[SafetyAttributes] = Field(
|
6399
6359
|
default=None,
|
6400
6360
|
description="""Safety attributes of the image. Lists of RAI categories and their
|
6401
|
-
scores of each content.
|
6402
|
-
""",
|
6361
|
+
scores of each content.""",
|
6403
6362
|
)
|
6404
6363
|
enhanced_prompt: Optional[str] = Field(
|
6405
6364
|
default=None,
|
6406
6365
|
description="""The rewritten prompt used for the image generation if the prompt
|
6407
|
-
enhancer is enabled.
|
6408
|
-
""",
|
6366
|
+
enhancer is enabled.""",
|
6409
6367
|
)
|
6410
6368
|
|
6411
6369
|
|
@@ -6413,23 +6371,19 @@ class GeneratedImageDict(TypedDict, total=False):
|
|
6413
6371
|
"""An output image."""
|
6414
6372
|
|
6415
6373
|
image: Optional[ImageDict]
|
6416
|
-
"""The output image data.
|
6417
|
-
"""
|
6374
|
+
"""The output image data."""
|
6418
6375
|
|
6419
6376
|
rai_filtered_reason: Optional[str]
|
6420
6377
|
"""Responsible AI filter reason if the image is filtered out of the
|
6421
|
-
response.
|
6422
|
-
"""
|
6378
|
+
response."""
|
6423
6379
|
|
6424
6380
|
safety_attributes: Optional[SafetyAttributesDict]
|
6425
6381
|
"""Safety attributes of the image. Lists of RAI categories and their
|
6426
|
-
scores of each content.
|
6427
|
-
"""
|
6382
|
+
scores of each content."""
|
6428
6383
|
|
6429
6384
|
enhanced_prompt: Optional[str]
|
6430
6385
|
"""The rewritten prompt used for the image generation if the prompt
|
6431
|
-
enhancer is enabled.
|
6432
|
-
"""
|
6386
|
+
enhancer is enabled."""
|
6433
6387
|
|
6434
6388
|
|
6435
6389
|
GeneratedImageOrDict = Union[GeneratedImage, GeneratedImageDict]
|
@@ -6442,15 +6396,12 @@ class GenerateImagesResponse(_common.BaseModel):
|
|
6442
6396
|
default=None, description="""Used to retain the full HTTP response."""
|
6443
6397
|
)
|
6444
6398
|
generated_images: Optional[list[GeneratedImage]] = Field(
|
6445
|
-
default=None,
|
6446
|
-
description="""List of generated images.
|
6447
|
-
""",
|
6399
|
+
default=None, description="""List of generated images."""
|
6448
6400
|
)
|
6449
6401
|
positive_prompt_safety_attributes: Optional[SafetyAttributes] = Field(
|
6450
6402
|
default=None,
|
6451
6403
|
description="""Safety attributes of the positive prompt. Only populated if
|
6452
|
-
``include_safety_attributes`` is set to True.
|
6453
|
-
""",
|
6404
|
+
``include_safety_attributes`` is set to True.""",
|
6454
6405
|
)
|
6455
6406
|
|
6456
6407
|
@property
|
@@ -6472,13 +6423,11 @@ class GenerateImagesResponseDict(TypedDict, total=False):
|
|
6472
6423
|
"""Used to retain the full HTTP response."""
|
6473
6424
|
|
6474
6425
|
generated_images: Optional[list[GeneratedImageDict]]
|
6475
|
-
"""List of generated images.
|
6476
|
-
"""
|
6426
|
+
"""List of generated images."""
|
6477
6427
|
|
6478
6428
|
positive_prompt_safety_attributes: Optional[SafetyAttributesDict]
|
6479
6429
|
"""Safety attributes of the positive prompt. Only populated if
|
6480
|
-
``include_safety_attributes`` is set to True.
|
6481
|
-
"""
|
6430
|
+
``include_safety_attributes`` is set to True."""
|
6482
6431
|
|
6483
6432
|
|
6484
6433
|
GenerateImagesResponseOrDict = Union[
|
@@ -6673,80 +6622,61 @@ class EditImageConfig(_common.BaseModel):
|
|
6673
6622
|
)
|
6674
6623
|
output_gcs_uri: Optional[str] = Field(
|
6675
6624
|
default=None,
|
6676
|
-
description="""Cloud Storage URI used to store the generated images.
|
6677
|
-
""",
|
6625
|
+
description="""Cloud Storage URI used to store the generated images.""",
|
6678
6626
|
)
|
6679
6627
|
negative_prompt: Optional[str] = Field(
|
6680
6628
|
default=None,
|
6681
|
-
description="""Description of what to discourage in the generated images.
|
6682
|
-
""",
|
6629
|
+
description="""Description of what to discourage in the generated images.""",
|
6683
6630
|
)
|
6684
6631
|
number_of_images: Optional[int] = Field(
|
6685
|
-
default=None,
|
6686
|
-
description="""Number of images to generate.
|
6687
|
-
""",
|
6632
|
+
default=None, description="""Number of images to generate."""
|
6688
6633
|
)
|
6689
6634
|
aspect_ratio: Optional[str] = Field(
|
6690
6635
|
default=None,
|
6691
6636
|
description="""Aspect ratio of the generated images. Supported values are
|
6692
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
6693
|
-
""",
|
6637
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9".""",
|
6694
6638
|
)
|
6695
6639
|
guidance_scale: Optional[float] = Field(
|
6696
6640
|
default=None,
|
6697
6641
|
description="""Controls how much the model adheres to the text prompt. Large
|
6698
6642
|
values increase output and prompt alignment, but may compromise image
|
6699
|
-
quality.
|
6700
|
-
""",
|
6643
|
+
quality.""",
|
6701
6644
|
)
|
6702
6645
|
seed: Optional[int] = Field(
|
6703
6646
|
default=None,
|
6704
6647
|
description="""Random seed for image generation. This is not available when
|
6705
|
-
``add_watermark`` is set to true.
|
6706
|
-
""",
|
6648
|
+
``add_watermark`` is set to true.""",
|
6707
6649
|
)
|
6708
6650
|
safety_filter_level: Optional[SafetyFilterLevel] = Field(
|
6709
|
-
default=None,
|
6710
|
-
description="""Filter level for safety filtering.
|
6711
|
-
""",
|
6651
|
+
default=None, description="""Filter level for safety filtering."""
|
6712
6652
|
)
|
6713
6653
|
person_generation: Optional[PersonGeneration] = Field(
|
6714
|
-
default=None,
|
6715
|
-
description="""Allows generation of people by the model.
|
6716
|
-
""",
|
6654
|
+
default=None, description="""Allows generation of people by the model."""
|
6717
6655
|
)
|
6718
6656
|
include_safety_attributes: Optional[bool] = Field(
|
6719
6657
|
default=None,
|
6720
6658
|
description="""Whether to report the safety scores of each generated image and
|
6721
|
-
the positive prompt in the response.
|
6722
|
-
""",
|
6659
|
+
the positive prompt in the response.""",
|
6723
6660
|
)
|
6724
6661
|
include_rai_reason: Optional[bool] = Field(
|
6725
6662
|
default=None,
|
6726
6663
|
description="""Whether to include the Responsible AI filter reason if the image
|
6727
|
-
is filtered out of the response.
|
6728
|
-
""",
|
6664
|
+
is filtered out of the response.""",
|
6729
6665
|
)
|
6730
6666
|
language: Optional[ImagePromptLanguage] = Field(
|
6731
|
-
default=None,
|
6732
|
-
description="""Language of the text in the prompt.
|
6733
|
-
""",
|
6667
|
+
default=None, description="""Language of the text in the prompt."""
|
6734
6668
|
)
|
6735
6669
|
output_mime_type: Optional[str] = Field(
|
6736
|
-
default=None,
|
6737
|
-
description="""MIME type of the generated image.
|
6738
|
-
""",
|
6670
|
+
default=None, description="""MIME type of the generated image."""
|
6739
6671
|
)
|
6740
6672
|
output_compression_quality: Optional[int] = Field(
|
6741
6673
|
default=None,
|
6742
6674
|
description="""Compression quality of the generated image (for ``image/jpeg``
|
6743
|
-
only).
|
6744
|
-
""",
|
6675
|
+
only).""",
|
6745
6676
|
)
|
6746
6677
|
add_watermark: Optional[bool] = Field(
|
6747
6678
|
default=None,
|
6748
|
-
description="""Whether to add a watermark to the generated images.
|
6749
|
-
""",
|
6679
|
+
description="""Whether to add a watermark to the generated images.""",
|
6750
6680
|
)
|
6751
6681
|
edit_mode: Optional[EditMode] = Field(
|
6752
6682
|
default=None,
|
@@ -6766,67 +6696,53 @@ class EditImageConfigDict(TypedDict, total=False):
|
|
6766
6696
|
"""Used to override HTTP request options."""
|
6767
6697
|
|
6768
6698
|
output_gcs_uri: Optional[str]
|
6769
|
-
"""Cloud Storage URI used to store the generated images.
|
6770
|
-
"""
|
6699
|
+
"""Cloud Storage URI used to store the generated images."""
|
6771
6700
|
|
6772
6701
|
negative_prompt: Optional[str]
|
6773
|
-
"""Description of what to discourage in the generated images.
|
6774
|
-
"""
|
6702
|
+
"""Description of what to discourage in the generated images."""
|
6775
6703
|
|
6776
6704
|
number_of_images: Optional[int]
|
6777
|
-
"""Number of images to generate.
|
6778
|
-
"""
|
6705
|
+
"""Number of images to generate."""
|
6779
6706
|
|
6780
6707
|
aspect_ratio: Optional[str]
|
6781
6708
|
"""Aspect ratio of the generated images. Supported values are
|
6782
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
6783
|
-
"""
|
6709
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9"."""
|
6784
6710
|
|
6785
6711
|
guidance_scale: Optional[float]
|
6786
6712
|
"""Controls how much the model adheres to the text prompt. Large
|
6787
6713
|
values increase output and prompt alignment, but may compromise image
|
6788
|
-
quality.
|
6789
|
-
"""
|
6714
|
+
quality."""
|
6790
6715
|
|
6791
6716
|
seed: Optional[int]
|
6792
6717
|
"""Random seed for image generation. This is not available when
|
6793
|
-
``add_watermark`` is set to true.
|
6794
|
-
"""
|
6718
|
+
``add_watermark`` is set to true."""
|
6795
6719
|
|
6796
6720
|
safety_filter_level: Optional[SafetyFilterLevel]
|
6797
|
-
"""Filter level for safety filtering.
|
6798
|
-
"""
|
6721
|
+
"""Filter level for safety filtering."""
|
6799
6722
|
|
6800
6723
|
person_generation: Optional[PersonGeneration]
|
6801
|
-
"""Allows generation of people by the model.
|
6802
|
-
"""
|
6724
|
+
"""Allows generation of people by the model."""
|
6803
6725
|
|
6804
6726
|
include_safety_attributes: Optional[bool]
|
6805
6727
|
"""Whether to report the safety scores of each generated image and
|
6806
|
-
the positive prompt in the response.
|
6807
|
-
"""
|
6728
|
+
the positive prompt in the response."""
|
6808
6729
|
|
6809
6730
|
include_rai_reason: Optional[bool]
|
6810
6731
|
"""Whether to include the Responsible AI filter reason if the image
|
6811
|
-
is filtered out of the response.
|
6812
|
-
"""
|
6732
|
+
is filtered out of the response."""
|
6813
6733
|
|
6814
6734
|
language: Optional[ImagePromptLanguage]
|
6815
|
-
"""Language of the text in the prompt.
|
6816
|
-
"""
|
6735
|
+
"""Language of the text in the prompt."""
|
6817
6736
|
|
6818
6737
|
output_mime_type: Optional[str]
|
6819
|
-
"""MIME type of the generated image.
|
6820
|
-
"""
|
6738
|
+
"""MIME type of the generated image."""
|
6821
6739
|
|
6822
6740
|
output_compression_quality: Optional[int]
|
6823
6741
|
"""Compression quality of the generated image (for ``image/jpeg``
|
6824
|
-
only).
|
6825
|
-
"""
|
6742
|
+
only)."""
|
6826
6743
|
|
6827
6744
|
add_watermark: Optional[bool]
|
6828
|
-
"""Whether to add a watermark to the generated images.
|
6829
|
-
"""
|
6745
|
+
"""Whether to add a watermark to the generated images."""
|
6830
6746
|
|
6831
6747
|
edit_mode: Optional[EditMode]
|
6832
6748
|
"""Describes the editing mode for the request."""
|
@@ -6927,8 +6843,8 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
|
|
6927
6843
|
)
|
6928
6844
|
output_compression_quality: Optional[int] = Field(
|
6929
6845
|
default=None,
|
6930
|
-
description="""The level of compression if the
|
6931
|
-
``image/jpeg``.""",
|
6846
|
+
description="""The level of compression. Only applicable if the
|
6847
|
+
``output_mime_type`` is ``image/jpeg``.""",
|
6932
6848
|
)
|
6933
6849
|
enhance_input_image: Optional[bool] = Field(
|
6934
6850
|
default=None,
|
@@ -6968,8 +6884,8 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
|
|
6968
6884
|
"""The image format that the output should be saved as."""
|
6969
6885
|
|
6970
6886
|
output_compression_quality: Optional[int]
|
6971
|
-
"""The level of compression if the
|
6972
|
-
``image/jpeg``."""
|
6887
|
+
"""The level of compression. Only applicable if the
|
6888
|
+
``output_mime_type`` is ``image/jpeg``."""
|
6973
6889
|
|
6974
6890
|
enhance_input_image: Optional[bool]
|
6975
6891
|
"""Whether to add an image enhancing step before upscaling.
|
@@ -8336,7 +8252,7 @@ class Video(_common.BaseModel):
|
|
8336
8252
|
default=None, description="""Video bytes."""
|
8337
8253
|
)
|
8338
8254
|
mime_type: Optional[str] = Field(
|
8339
|
-
default=None, description="""Video encoding, for example
|
8255
|
+
default=None, description="""Video encoding, for example ``video/mp4``."""
|
8340
8256
|
)
|
8341
8257
|
|
8342
8258
|
@classmethod
|
@@ -8423,7 +8339,7 @@ class VideoDict(TypedDict, total=False):
|
|
8423
8339
|
"""Video bytes."""
|
8424
8340
|
|
8425
8341
|
mime_type: Optional[str]
|
8426
|
-
"""Video encoding, for example
|
8342
|
+
"""Video encoding, for example ``video/mp4``."""
|
8427
8343
|
|
8428
8344
|
|
8429
8345
|
VideoOrDict = Union[Video, VideoDict]
|
@@ -8440,12 +8356,12 @@ class GenerateVideosSource(_common.BaseModel):
|
|
8440
8356
|
image: Optional[Image] = Field(
|
8441
8357
|
default=None,
|
8442
8358
|
description="""The input image for generating the videos.
|
8443
|
-
Optional if prompt
|
8359
|
+
Optional if prompt is provided. Not allowed if video is provided.""",
|
8444
8360
|
)
|
8445
8361
|
video: Optional[Video] = Field(
|
8446
8362
|
default=None,
|
8447
8363
|
description="""The input video for video extension use cases.
|
8448
|
-
Optional if prompt
|
8364
|
+
Optional if prompt is provided. Not allowed if image is provided.""",
|
8449
8365
|
)
|
8450
8366
|
|
8451
8367
|
|
@@ -8458,11 +8374,11 @@ class GenerateVideosSourceDict(TypedDict, total=False):
|
|
8458
8374
|
|
8459
8375
|
image: Optional[ImageDict]
|
8460
8376
|
"""The input image for generating the videos.
|
8461
|
-
Optional if prompt
|
8377
|
+
Optional if prompt is provided. Not allowed if video is provided."""
|
8462
8378
|
|
8463
8379
|
video: Optional[VideoDict]
|
8464
8380
|
"""The input video for video extension use cases.
|
8465
|
-
Optional if prompt
|
8381
|
+
Optional if prompt is provided. Not allowed if image is provided."""
|
8466
8382
|
|
8467
8383
|
|
8468
8384
|
GenerateVideosSourceOrDict = Union[
|
@@ -8474,9 +8390,7 @@ class VideoGenerationReferenceImage(_common.BaseModel):
|
|
8474
8390
|
"""A reference image for video generation."""
|
8475
8391
|
|
8476
8392
|
image: Optional[Image] = Field(
|
8477
|
-
default=None,
|
8478
|
-
description="""The reference image.
|
8479
|
-
""",
|
8393
|
+
default=None, description="""The reference image."""
|
8480
8394
|
)
|
8481
8395
|
reference_type: Optional[VideoGenerationReferenceType] = Field(
|
8482
8396
|
default=None,
|
@@ -8489,8 +8403,7 @@ class VideoGenerationReferenceImageDict(TypedDict, total=False):
|
|
8489
8403
|
"""A reference image for video generation."""
|
8490
8404
|
|
8491
8405
|
image: Optional[ImageDict]
|
8492
|
-
"""The reference image.
|
8493
|
-
"""
|
8406
|
+
"""The reference image."""
|
8494
8407
|
|
8495
8408
|
reference_type: Optional[VideoGenerationReferenceType]
|
8496
8409
|
"""The type of the reference image, which defines how the reference
|
@@ -8524,27 +8437,35 @@ class GenerateVideosConfig(_common.BaseModel):
|
|
8524
8437
|
)
|
8525
8438
|
seed: Optional[int] = Field(
|
8526
8439
|
default=None,
|
8527
|
-
description="""The RNG seed. If RNG seed is exactly same for each request with
|
8440
|
+
description="""The RNG seed. If RNG seed is exactly same for each request with
|
8441
|
+
unchanged inputs, the prediction results will be consistent. Otherwise,
|
8442
|
+
a random RNG seed will be used each time to produce a different
|
8443
|
+
result.""",
|
8528
8444
|
)
|
8529
8445
|
aspect_ratio: Optional[str] = Field(
|
8530
8446
|
default=None,
|
8531
|
-
description="""The aspect ratio for the generated video. 16:9 (landscape) and
|
8447
|
+
description="""The aspect ratio for the generated video. 16:9 (landscape) and
|
8448
|
+
9:16 (portrait) are supported.""",
|
8532
8449
|
)
|
8533
8450
|
resolution: Optional[str] = Field(
|
8534
8451
|
default=None,
|
8535
|
-
description="""The resolution for the generated video. 720p and 1080p are
|
8452
|
+
description="""The resolution for the generated video. 720p and 1080p are
|
8453
|
+
supported.""",
|
8536
8454
|
)
|
8537
8455
|
person_generation: Optional[str] = Field(
|
8538
8456
|
default=None,
|
8539
|
-
description="""Whether allow to generate person videos, and restrict to specific
|
8457
|
+
description="""Whether allow to generate person videos, and restrict to specific
|
8458
|
+
ages. Supported values are: dont_allow, allow_adult.""",
|
8540
8459
|
)
|
8541
8460
|
pubsub_topic: Optional[str] = Field(
|
8542
8461
|
default=None,
|
8543
|
-
description="""The pubsub topic where to publish the video generation
|
8462
|
+
description="""The pubsub topic where to publish the video generation
|
8463
|
+
progress.""",
|
8544
8464
|
)
|
8545
8465
|
negative_prompt: Optional[str] = Field(
|
8546
8466
|
default=None,
|
8547
|
-
description="""
|
8467
|
+
description="""Explicitly state what should not be included in the generated
|
8468
|
+
videos.""",
|
8548
8469
|
)
|
8549
8470
|
enhance_prompt: Optional[bool] = Field(
|
8550
8471
|
default=None, description="""Whether to use the prompt rewriting logic."""
|
@@ -8555,7 +8476,8 @@ class GenerateVideosConfig(_common.BaseModel):
|
|
8555
8476
|
)
|
8556
8477
|
last_frame: Optional[Image] = Field(
|
8557
8478
|
default=None,
|
8558
|
-
description="""Image to use as the last frame of generated videos.
|
8479
|
+
description="""Image to use as the last frame of generated videos.
|
8480
|
+
Only supported for image to video use cases.""",
|
8559
8481
|
)
|
8560
8482
|
reference_images: Optional[list[VideoGenerationReferenceImage]] = Field(
|
8561
8483
|
default=None,
|
@@ -8590,22 +8512,30 @@ class GenerateVideosConfigDict(TypedDict, total=False):
|
|
8590
8512
|
"""Duration of the clip for video generation in seconds."""
|
8591
8513
|
|
8592
8514
|
seed: Optional[int]
|
8593
|
-
"""The RNG seed. If RNG seed is exactly same for each request with
|
8515
|
+
"""The RNG seed. If RNG seed is exactly same for each request with
|
8516
|
+
unchanged inputs, the prediction results will be consistent. Otherwise,
|
8517
|
+
a random RNG seed will be used each time to produce a different
|
8518
|
+
result."""
|
8594
8519
|
|
8595
8520
|
aspect_ratio: Optional[str]
|
8596
|
-
"""The aspect ratio for the generated video. 16:9 (landscape) and
|
8521
|
+
"""The aspect ratio for the generated video. 16:9 (landscape) and
|
8522
|
+
9:16 (portrait) are supported."""
|
8597
8523
|
|
8598
8524
|
resolution: Optional[str]
|
8599
|
-
"""The resolution for the generated video. 720p and 1080p are
|
8525
|
+
"""The resolution for the generated video. 720p and 1080p are
|
8526
|
+
supported."""
|
8600
8527
|
|
8601
8528
|
person_generation: Optional[str]
|
8602
|
-
"""Whether allow to generate person videos, and restrict to specific
|
8529
|
+
"""Whether allow to generate person videos, and restrict to specific
|
8530
|
+
ages. Supported values are: dont_allow, allow_adult."""
|
8603
8531
|
|
8604
8532
|
pubsub_topic: Optional[str]
|
8605
|
-
"""The pubsub topic where to publish the video generation
|
8533
|
+
"""The pubsub topic where to publish the video generation
|
8534
|
+
progress."""
|
8606
8535
|
|
8607
8536
|
negative_prompt: Optional[str]
|
8608
|
-
"""
|
8537
|
+
"""Explicitly state what should not be included in the generated
|
8538
|
+
videos."""
|
8609
8539
|
|
8610
8540
|
enhance_prompt: Optional[bool]
|
8611
8541
|
"""Whether to use the prompt rewriting logic."""
|
@@ -8614,7 +8544,8 @@ class GenerateVideosConfigDict(TypedDict, total=False):
|
|
8614
8544
|
"""Whether to generate audio along with the video."""
|
8615
8545
|
|
8616
8546
|
last_frame: Optional[ImageDict]
|
8617
|
-
"""Image to use as the last frame of generated videos.
|
8547
|
+
"""Image to use as the last frame of generated videos.
|
8548
|
+
Only supported for image to video use cases."""
|
8618
8549
|
|
8619
8550
|
reference_images: Optional[list[VideoGenerationReferenceImageDict]]
|
8620
8551
|
"""The images to use as the references to generate the videos.
|
@@ -8642,17 +8573,18 @@ class _GenerateVideosParameters(_common.BaseModel):
|
|
8642
8573
|
)
|
8643
8574
|
prompt: Optional[str] = Field(
|
8644
8575
|
default=None,
|
8645
|
-
description="""The text prompt for generating the videos.
|
8576
|
+
description="""The text prompt for generating the videos.
|
8577
|
+
Optional if image or video is provided.""",
|
8646
8578
|
)
|
8647
8579
|
image: Optional[Image] = Field(
|
8648
8580
|
default=None,
|
8649
8581
|
description="""The input image for generating the videos.
|
8650
|
-
Optional if prompt
|
8582
|
+
Optional if prompt is provided. Not allowed if video is provided.""",
|
8651
8583
|
)
|
8652
8584
|
video: Optional[Video] = Field(
|
8653
8585
|
default=None,
|
8654
8586
|
description="""The input video for video extension use cases.
|
8655
|
-
Optional if prompt
|
8587
|
+
Optional if prompt is provided. Not allowed if image is provided.""",
|
8656
8588
|
)
|
8657
8589
|
source: Optional[GenerateVideosSource] = Field(
|
8658
8590
|
default=None,
|
@@ -8671,15 +8603,16 @@ class _GenerateVideosParametersDict(TypedDict, total=False):
|
|
8671
8603
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_."""
|
8672
8604
|
|
8673
8605
|
prompt: Optional[str]
|
8674
|
-
"""The text prompt for generating the videos.
|
8606
|
+
"""The text prompt for generating the videos.
|
8607
|
+
Optional if image or video is provided."""
|
8675
8608
|
|
8676
8609
|
image: Optional[ImageDict]
|
8677
8610
|
"""The input image for generating the videos.
|
8678
|
-
Optional if prompt
|
8611
|
+
Optional if prompt is provided. Not allowed if video is provided."""
|
8679
8612
|
|
8680
8613
|
video: Optional[VideoDict]
|
8681
8614
|
"""The input video for video extension use cases.
|
8682
|
-
Optional if prompt
|
8615
|
+
Optional if prompt is provided. Not allowed if image is provided."""
|
8683
8616
|
|
8684
8617
|
source: Optional[GenerateVideosSourceDict]
|
8685
8618
|
"""A set of source input(s) for video generation."""
|
@@ -11506,6 +11439,70 @@ class InlinedResponseDict(TypedDict, total=False):
|
|
11506
11439
|
InlinedResponseOrDict = Union[InlinedResponse, InlinedResponseDict]
|
11507
11440
|
|
11508
11441
|
|
11442
|
+
class SingleEmbedContentResponse(_common.BaseModel):
|
11443
|
+
"""Config for `response` parameter."""
|
11444
|
+
|
11445
|
+
embedding: Optional[ContentEmbedding] = Field(
|
11446
|
+
default=None,
|
11447
|
+
description="""The response to the request.
|
11448
|
+
""",
|
11449
|
+
)
|
11450
|
+
token_count: Optional[int] = Field(
|
11451
|
+
default=None,
|
11452
|
+
description="""The error encountered while processing the request.
|
11453
|
+
""",
|
11454
|
+
)
|
11455
|
+
|
11456
|
+
|
11457
|
+
class SingleEmbedContentResponseDict(TypedDict, total=False):
|
11458
|
+
"""Config for `response` parameter."""
|
11459
|
+
|
11460
|
+
embedding: Optional[ContentEmbeddingDict]
|
11461
|
+
"""The response to the request.
|
11462
|
+
"""
|
11463
|
+
|
11464
|
+
token_count: Optional[int]
|
11465
|
+
"""The error encountered while processing the request.
|
11466
|
+
"""
|
11467
|
+
|
11468
|
+
|
11469
|
+
SingleEmbedContentResponseOrDict = Union[
|
11470
|
+
SingleEmbedContentResponse, SingleEmbedContentResponseDict
|
11471
|
+
]
|
11472
|
+
|
11473
|
+
|
11474
|
+
class InlinedEmbedContentResponse(_common.BaseModel):
|
11475
|
+
"""Config for `inlined_embedding_responses` parameter."""
|
11476
|
+
|
11477
|
+
response: Optional[SingleEmbedContentResponse] = Field(
|
11478
|
+
default=None,
|
11479
|
+
description="""The response to the request.
|
11480
|
+
""",
|
11481
|
+
)
|
11482
|
+
error: Optional[JobError] = Field(
|
11483
|
+
default=None,
|
11484
|
+
description="""The error encountered while processing the request.
|
11485
|
+
""",
|
11486
|
+
)
|
11487
|
+
|
11488
|
+
|
11489
|
+
class InlinedEmbedContentResponseDict(TypedDict, total=False):
|
11490
|
+
"""Config for `inlined_embedding_responses` parameter."""
|
11491
|
+
|
11492
|
+
response: Optional[SingleEmbedContentResponseDict]
|
11493
|
+
"""The response to the request.
|
11494
|
+
"""
|
11495
|
+
|
11496
|
+
error: Optional[JobErrorDict]
|
11497
|
+
"""The error encountered while processing the request.
|
11498
|
+
"""
|
11499
|
+
|
11500
|
+
|
11501
|
+
InlinedEmbedContentResponseOrDict = Union[
|
11502
|
+
InlinedEmbedContentResponse, InlinedEmbedContentResponseDict
|
11503
|
+
]
|
11504
|
+
|
11505
|
+
|
11509
11506
|
class BatchJobDestination(_common.BaseModel):
|
11510
11507
|
"""Config for `des` parameter."""
|
11511
11508
|
|
@@ -11541,6 +11538,15 @@ class BatchJobDestination(_common.BaseModel):
|
|
11541
11538
|
the input requests.
|
11542
11539
|
""",
|
11543
11540
|
)
|
11541
|
+
inlined_embed_content_responses: Optional[
|
11542
|
+
list[InlinedEmbedContentResponse]
|
11543
|
+
] = Field(
|
11544
|
+
default=None,
|
11545
|
+
description="""The responses to the requests in the batch. Returned when the batch was
|
11546
|
+
built using inlined requests. The responses will be in the same order as
|
11547
|
+
the input requests.
|
11548
|
+
""",
|
11549
|
+
)
|
11544
11550
|
|
11545
11551
|
|
11546
11552
|
class BatchJobDestinationDict(TypedDict, total=False):
|
@@ -11573,6 +11579,14 @@ class BatchJobDestinationDict(TypedDict, total=False):
|
|
11573
11579
|
the input requests.
|
11574
11580
|
"""
|
11575
11581
|
|
11582
|
+
inlined_embed_content_responses: Optional[
|
11583
|
+
list[InlinedEmbedContentResponseDict]
|
11584
|
+
]
|
11585
|
+
"""The responses to the requests in the batch. Returned when the batch was
|
11586
|
+
built using inlined requests. The responses will be in the same order as
|
11587
|
+
the input requests.
|
11588
|
+
"""
|
11589
|
+
|
11576
11590
|
|
11577
11591
|
BatchJobDestinationOrDict = Union[BatchJobDestination, BatchJobDestinationDict]
|
11578
11592
|
|
@@ -11733,6 +11747,13 @@ class BatchJob(_common.BaseModel):
|
|
11733
11747
|
""",
|
11734
11748
|
)
|
11735
11749
|
|
11750
|
+
@property
|
11751
|
+
def done(self) -> bool:
|
11752
|
+
"""Returns True if the batch job has ended."""
|
11753
|
+
if self.state is None:
|
11754
|
+
return False
|
11755
|
+
return self.state.name in JOB_STATES_ENDED
|
11756
|
+
|
11736
11757
|
|
11737
11758
|
class BatchJobDict(TypedDict, total=False):
|
11738
11759
|
"""Config for batches.create return value."""
|
@@ -11783,6 +11804,138 @@ class BatchJobDict(TypedDict, total=False):
|
|
11783
11804
|
BatchJobOrDict = Union[BatchJob, BatchJobDict]
|
11784
11805
|
|
11785
11806
|
|
11807
|
+
class EmbedContentBatch(_common.BaseModel):
|
11808
|
+
"""Parameters for the embed_content method."""
|
11809
|
+
|
11810
|
+
contents: Optional[ContentListUnion] = Field(
|
11811
|
+
default=None,
|
11812
|
+
description="""The content to embed. Only the `parts.text` fields will be counted.
|
11813
|
+
""",
|
11814
|
+
)
|
11815
|
+
config: Optional[EmbedContentConfig] = Field(
|
11816
|
+
default=None,
|
11817
|
+
description="""Configuration that contains optional parameters.
|
11818
|
+
""",
|
11819
|
+
)
|
11820
|
+
|
11821
|
+
|
11822
|
+
class EmbedContentBatchDict(TypedDict, total=False):
|
11823
|
+
"""Parameters for the embed_content method."""
|
11824
|
+
|
11825
|
+
contents: Optional[ContentListUnionDict]
|
11826
|
+
"""The content to embed. Only the `parts.text` fields will be counted.
|
11827
|
+
"""
|
11828
|
+
|
11829
|
+
config: Optional[EmbedContentConfigDict]
|
11830
|
+
"""Configuration that contains optional parameters.
|
11831
|
+
"""
|
11832
|
+
|
11833
|
+
|
11834
|
+
EmbedContentBatchOrDict = Union[EmbedContentBatch, EmbedContentBatchDict]
|
11835
|
+
|
11836
|
+
|
11837
|
+
class EmbeddingsBatchJobSource(_common.BaseModel):
|
11838
|
+
|
11839
|
+
file_name: Optional[str] = Field(
|
11840
|
+
default=None,
|
11841
|
+
description="""The Gemini Developer API's file resource name of the input data
|
11842
|
+
(e.g. "files/12345").
|
11843
|
+
""",
|
11844
|
+
)
|
11845
|
+
inlined_requests: Optional[EmbedContentBatch] = Field(
|
11846
|
+
default=None,
|
11847
|
+
description="""The Gemini Developer API's inlined input data to run batch job.
|
11848
|
+
""",
|
11849
|
+
)
|
11850
|
+
|
11851
|
+
|
11852
|
+
class EmbeddingsBatchJobSourceDict(TypedDict, total=False):
|
11853
|
+
|
11854
|
+
file_name: Optional[str]
|
11855
|
+
"""The Gemini Developer API's file resource name of the input data
|
11856
|
+
(e.g. "files/12345").
|
11857
|
+
"""
|
11858
|
+
|
11859
|
+
inlined_requests: Optional[EmbedContentBatchDict]
|
11860
|
+
"""The Gemini Developer API's inlined input data to run batch job.
|
11861
|
+
"""
|
11862
|
+
|
11863
|
+
|
11864
|
+
EmbeddingsBatchJobSourceOrDict = Union[
|
11865
|
+
EmbeddingsBatchJobSource, EmbeddingsBatchJobSourceDict
|
11866
|
+
]
|
11867
|
+
|
11868
|
+
|
11869
|
+
class CreateEmbeddingsBatchJobConfig(_common.BaseModel):
|
11870
|
+
"""Config for optional parameters."""
|
11871
|
+
|
11872
|
+
http_options: Optional[HttpOptions] = Field(
|
11873
|
+
default=None, description="""Used to override HTTP request options."""
|
11874
|
+
)
|
11875
|
+
display_name: Optional[str] = Field(
|
11876
|
+
default=None,
|
11877
|
+
description="""The user-defined name of this BatchJob.
|
11878
|
+
""",
|
11879
|
+
)
|
11880
|
+
|
11881
|
+
|
11882
|
+
class CreateEmbeddingsBatchJobConfigDict(TypedDict, total=False):
|
11883
|
+
"""Config for optional parameters."""
|
11884
|
+
|
11885
|
+
http_options: Optional[HttpOptionsDict]
|
11886
|
+
"""Used to override HTTP request options."""
|
11887
|
+
|
11888
|
+
display_name: Optional[str]
|
11889
|
+
"""The user-defined name of this BatchJob.
|
11890
|
+
"""
|
11891
|
+
|
11892
|
+
|
11893
|
+
CreateEmbeddingsBatchJobConfigOrDict = Union[
|
11894
|
+
CreateEmbeddingsBatchJobConfig, CreateEmbeddingsBatchJobConfigDict
|
11895
|
+
]
|
11896
|
+
|
11897
|
+
|
11898
|
+
class _CreateEmbeddingsBatchJobParameters(_common.BaseModel):
|
11899
|
+
"""Config for batches.create parameters."""
|
11900
|
+
|
11901
|
+
model: Optional[str] = Field(
|
11902
|
+
default=None,
|
11903
|
+
description="""The name of the model to produces the predictions via the BatchJob.
|
11904
|
+
""",
|
11905
|
+
)
|
11906
|
+
src: Optional[EmbeddingsBatchJobSource] = Field(
|
11907
|
+
default=None,
|
11908
|
+
description="""input data to run batch job".
|
11909
|
+
""",
|
11910
|
+
)
|
11911
|
+
config: Optional[CreateEmbeddingsBatchJobConfig] = Field(
|
11912
|
+
default=None,
|
11913
|
+
description="""Optional parameters for creating a BatchJob.
|
11914
|
+
""",
|
11915
|
+
)
|
11916
|
+
|
11917
|
+
|
11918
|
+
class _CreateEmbeddingsBatchJobParametersDict(TypedDict, total=False):
|
11919
|
+
"""Config for batches.create parameters."""
|
11920
|
+
|
11921
|
+
model: Optional[str]
|
11922
|
+
"""The name of the model to produces the predictions via the BatchJob.
|
11923
|
+
"""
|
11924
|
+
|
11925
|
+
src: Optional[EmbeddingsBatchJobSourceDict]
|
11926
|
+
"""input data to run batch job".
|
11927
|
+
"""
|
11928
|
+
|
11929
|
+
config: Optional[CreateEmbeddingsBatchJobConfigDict]
|
11930
|
+
"""Optional parameters for creating a BatchJob.
|
11931
|
+
"""
|
11932
|
+
|
11933
|
+
|
11934
|
+
_CreateEmbeddingsBatchJobParametersOrDict = Union[
|
11935
|
+
_CreateEmbeddingsBatchJobParameters, _CreateEmbeddingsBatchJobParametersDict
|
11936
|
+
]
|
11937
|
+
|
11938
|
+
|
11786
11939
|
class GetBatchJobConfig(_common.BaseModel):
|
11787
11940
|
"""Optional parameters."""
|
11788
11941
|
|
@@ -12422,8 +12575,8 @@ class UpscaleImageConfig(_common.BaseModel):
|
|
12422
12575
|
)
|
12423
12576
|
output_compression_quality: Optional[int] = Field(
|
12424
12577
|
default=None,
|
12425
|
-
description="""The level of compression if the
|
12426
|
-
``image/jpeg``.""",
|
12578
|
+
description="""The level of compression. Only applicable if the
|
12579
|
+
``output_mime_type`` is ``image/jpeg``.""",
|
12427
12580
|
)
|
12428
12581
|
enhance_input_image: Optional[bool] = Field(
|
12429
12582
|
default=None,
|
@@ -12462,8 +12615,8 @@ class UpscaleImageConfigDict(TypedDict, total=False):
|
|
12462
12615
|
"""The image format that the output should be saved as."""
|
12463
12616
|
|
12464
12617
|
output_compression_quality: Optional[int]
|
12465
|
-
"""The level of compression if the
|
12466
|
-
``image/jpeg``."""
|
12618
|
+
"""The level of compression. Only applicable if the
|
12619
|
+
``output_mime_type`` is ``image/jpeg``."""
|
12467
12620
|
|
12468
12621
|
enhance_input_image: Optional[bool]
|
12469
12622
|
"""Whether to add an image enhancing step before upscaling.
|