google-genai 0.5.0__py3-none-any.whl → 0.7.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 +234 -131
- google/genai/_api_module.py +24 -0
- google/genai/_automatic_function_calling_util.py +43 -22
- google/genai/_common.py +37 -12
- google/genai/_extra_utils.py +25 -19
- google/genai/_replay_api_client.py +47 -35
- google/genai/_test_api_client.py +1 -1
- google/genai/_transformers.py +301 -51
- google/genai/batches.py +204 -165
- google/genai/caches.py +127 -144
- google/genai/chats.py +22 -18
- google/genai/client.py +32 -37
- google/genai/errors.py +1 -1
- google/genai/files.py +333 -165
- google/genai/live.py +16 -6
- google/genai/models.py +601 -283
- google/genai/tunings.py +91 -428
- google/genai/types.py +1190 -955
- google/genai/version.py +1 -1
- google_genai-0.7.0.dist-info/METADATA +1021 -0
- google_genai-0.7.0.dist-info/RECORD +26 -0
- google_genai-0.5.0.dist-info/METADATA +0 -888
- google_genai-0.5.0.dist-info/RECORD +0 -25
- {google_genai-0.5.0.dist-info → google_genai-0.7.0.dist-info}/LICENSE +0 -0
- {google_genai-0.5.0.dist-info → google_genai-0.7.0.dist-info}/WHEEL +0 -0
- {google_genai-0.5.0.dist-info → google_genai-0.7.0.dist-info}/top_level.txt +0 -0
google/genai/types.py
CHANGED
@@ -16,206 +16,315 @@
|
|
16
16
|
# Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
17
17
|
|
18
18
|
import datetime
|
19
|
+
from enum import Enum, EnumMeta
|
19
20
|
import inspect
|
20
21
|
import json
|
21
22
|
import logging
|
22
|
-
|
23
|
-
import
|
23
|
+
import typing
|
24
|
+
from typing import Any, Callable, GenericAlias, Literal, Optional, Type, TypedDict, Union
|
24
25
|
import pydantic
|
25
26
|
from pydantic import Field
|
26
27
|
from . import _common
|
27
28
|
|
29
|
+
_is_pillow_image_imported = False
|
30
|
+
if typing.TYPE_CHECKING:
|
31
|
+
import PIL.Image
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
PIL_Image = PIL.Image.Image
|
34
|
+
_is_pillow_image_imported = True
|
35
|
+
else:
|
36
|
+
PIL_Image: Type = Any
|
37
|
+
try:
|
38
|
+
import PIL.Image
|
35
39
|
|
40
|
+
PIL_Image = PIL.Image.Image
|
41
|
+
_is_pillow_image_imported = True
|
42
|
+
except ImportError:
|
43
|
+
PIL_Image = None
|
36
44
|
|
37
|
-
Language = Literal["LANGUAGE_UNSPECIFIED", "PYTHON"]
|
38
45
|
|
46
|
+
class Outcome(_common.CaseInSensitiveEnum):
|
47
|
+
"""Required. Outcome of the code execution."""
|
39
48
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
"INTEGER",
|
45
|
-
"BOOLEAN",
|
46
|
-
"ARRAY",
|
47
|
-
"OBJECT",
|
48
|
-
]
|
49
|
+
OUTCOME_UNSPECIFIED = 'OUTCOME_UNSPECIFIED'
|
50
|
+
OUTCOME_OK = 'OUTCOME_OK'
|
51
|
+
OUTCOME_FAILED = 'OUTCOME_FAILED'
|
52
|
+
OUTCOME_DEADLINE_EXCEEDED = 'OUTCOME_DEADLINE_EXCEEDED'
|
49
53
|
|
50
54
|
|
51
|
-
|
52
|
-
|
53
|
-
"HARM_CATEGORY_HATE_SPEECH",
|
54
|
-
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
55
|
-
"HARM_CATEGORY_HARASSMENT",
|
56
|
-
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
57
|
-
"HARM_CATEGORY_CIVIC_INTEGRITY",
|
58
|
-
]
|
55
|
+
class Language(_common.CaseInSensitiveEnum):
|
56
|
+
"""Required. Programming language of the `code`."""
|
59
57
|
|
58
|
+
LANGUAGE_UNSPECIFIED = 'LANGUAGE_UNSPECIFIED'
|
59
|
+
PYTHON = 'PYTHON'
|
60
60
|
|
61
|
-
HarmBlockMethod = Literal[
|
62
|
-
"HARM_BLOCK_METHOD_UNSPECIFIED", "SEVERITY", "PROBABILITY"
|
63
|
-
]
|
64
61
|
|
62
|
+
class Type(_common.CaseInSensitiveEnum):
|
63
|
+
"""A basic data type."""
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
]
|
65
|
+
TYPE_UNSPECIFIED = 'TYPE_UNSPECIFIED'
|
66
|
+
STRING = 'STRING'
|
67
|
+
NUMBER = 'NUMBER'
|
68
|
+
INTEGER = 'INTEGER'
|
69
|
+
BOOLEAN = 'BOOLEAN'
|
70
|
+
ARRAY = 'ARRAY'
|
71
|
+
OBJECT = 'OBJECT'
|
74
72
|
|
75
73
|
|
76
|
-
|
74
|
+
class HarmCategory(_common.CaseInSensitiveEnum):
|
75
|
+
"""Required. Harm category."""
|
77
76
|
|
77
|
+
HARM_CATEGORY_UNSPECIFIED = 'HARM_CATEGORY_UNSPECIFIED'
|
78
|
+
HARM_CATEGORY_HATE_SPEECH = 'HARM_CATEGORY_HATE_SPEECH'
|
79
|
+
HARM_CATEGORY_DANGEROUS_CONTENT = 'HARM_CATEGORY_DANGEROUS_CONTENT'
|
80
|
+
HARM_CATEGORY_HARASSMENT = 'HARM_CATEGORY_HARASSMENT'
|
81
|
+
HARM_CATEGORY_SEXUALLY_EXPLICIT = 'HARM_CATEGORY_SEXUALLY_EXPLICIT'
|
82
|
+
HARM_CATEGORY_CIVIC_INTEGRITY = 'HARM_CATEGORY_CIVIC_INTEGRITY'
|
78
83
|
|
79
|
-
FinishReason = Literal[
|
80
|
-
"FINISH_REASON_UNSPECIFIED",
|
81
|
-
"STOP",
|
82
|
-
"MAX_TOKENS",
|
83
|
-
"SAFETY",
|
84
|
-
"RECITATION",
|
85
|
-
"OTHER",
|
86
|
-
"BLOCKLIST",
|
87
|
-
"PROHIBITED_CONTENT",
|
88
|
-
"SPII",
|
89
|
-
"MALFORMED_FUNCTION_CALL",
|
90
|
-
]
|
91
84
|
|
85
|
+
class HarmBlockMethod(_common.CaseInSensitiveEnum):
|
86
|
+
"""Optional.
|
92
87
|
|
93
|
-
|
94
|
-
|
95
|
-
|
88
|
+
Specify if the threshold is used for probability or severity score. If not
|
89
|
+
specified, the threshold is used for probability score.
|
90
|
+
"""
|
96
91
|
|
92
|
+
HARM_BLOCK_METHOD_UNSPECIFIED = 'HARM_BLOCK_METHOD_UNSPECIFIED'
|
93
|
+
SEVERITY = 'SEVERITY'
|
94
|
+
PROBABILITY = 'PROBABILITY'
|
97
95
|
|
98
|
-
HarmSeverity = Literal[
|
99
|
-
"HARM_SEVERITY_UNSPECIFIED",
|
100
|
-
"HARM_SEVERITY_NEGLIGIBLE",
|
101
|
-
"HARM_SEVERITY_LOW",
|
102
|
-
"HARM_SEVERITY_MEDIUM",
|
103
|
-
"HARM_SEVERITY_HIGH",
|
104
|
-
]
|
105
96
|
|
97
|
+
class HarmBlockThreshold(_common.CaseInSensitiveEnum):
|
98
|
+
"""Required. The harm block threshold."""
|
106
99
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
]
|
100
|
+
HARM_BLOCK_THRESHOLD_UNSPECIFIED = 'HARM_BLOCK_THRESHOLD_UNSPECIFIED'
|
101
|
+
BLOCK_LOW_AND_ABOVE = 'BLOCK_LOW_AND_ABOVE'
|
102
|
+
BLOCK_MEDIUM_AND_ABOVE = 'BLOCK_MEDIUM_AND_ABOVE'
|
103
|
+
BLOCK_ONLY_HIGH = 'BLOCK_ONLY_HIGH'
|
104
|
+
BLOCK_NONE = 'BLOCK_NONE'
|
105
|
+
OFF = 'OFF'
|
114
106
|
|
115
107
|
|
116
|
-
|
117
|
-
|
118
|
-
"DEDICATED_RESOURCES",
|
119
|
-
"AUTOMATIC_RESOURCES",
|
120
|
-
"SHARED_RESOURCES",
|
121
|
-
]
|
108
|
+
class Mode(_common.CaseInSensitiveEnum):
|
109
|
+
"""The mode of the predictor to be used in dynamic retrieval."""
|
122
110
|
|
111
|
+
MODE_UNSPECIFIED = 'MODE_UNSPECIFIED'
|
112
|
+
MODE_DYNAMIC = 'MODE_DYNAMIC'
|
123
113
|
|
124
|
-
JobState = Literal[
|
125
|
-
"JOB_STATE_UNSPECIFIED",
|
126
|
-
"JOB_STATE_QUEUED",
|
127
|
-
"JOB_STATE_PENDING",
|
128
|
-
"JOB_STATE_RUNNING",
|
129
|
-
"JOB_STATE_SUCCEEDED",
|
130
|
-
"JOB_STATE_FAILED",
|
131
|
-
"JOB_STATE_CANCELLING",
|
132
|
-
"JOB_STATE_CANCELLED",
|
133
|
-
"JOB_STATE_PAUSED",
|
134
|
-
"JOB_STATE_EXPIRED",
|
135
|
-
"JOB_STATE_UPDATING",
|
136
|
-
"JOB_STATE_PARTIALLY_SUCCEEDED",
|
137
|
-
]
|
138
114
|
|
115
|
+
class State(_common.CaseInSensitiveEnum):
|
116
|
+
"""Output only. RagFile state."""
|
139
117
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
"ADAPTER_SIZE_FOUR",
|
144
|
-
"ADAPTER_SIZE_EIGHT",
|
145
|
-
"ADAPTER_SIZE_SIXTEEN",
|
146
|
-
"ADAPTER_SIZE_THIRTY_TWO",
|
147
|
-
]
|
118
|
+
STATE_UNSPECIFIED = 'STATE_UNSPECIFIED'
|
119
|
+
ACTIVE = 'ACTIVE'
|
120
|
+
ERROR = 'ERROR'
|
148
121
|
|
149
122
|
|
150
|
-
|
123
|
+
class FinishReason(_common.CaseInSensitiveEnum):
|
124
|
+
"""Output only.
|
125
|
+
|
126
|
+
The reason why the model stopped generating tokens. If empty, the model has
|
127
|
+
not stopped generating the tokens.
|
128
|
+
"""
|
151
129
|
|
130
|
+
FINISH_REASON_UNSPECIFIED = 'FINISH_REASON_UNSPECIFIED'
|
131
|
+
STOP = 'STOP'
|
132
|
+
MAX_TOKENS = 'MAX_TOKENS'
|
133
|
+
SAFETY = 'SAFETY'
|
134
|
+
RECITATION = 'RECITATION'
|
135
|
+
OTHER = 'OTHER'
|
136
|
+
BLOCKLIST = 'BLOCKLIST'
|
137
|
+
PROHIBITED_CONTENT = 'PROHIBITED_CONTENT'
|
138
|
+
SPII = 'SPII'
|
139
|
+
MALFORMED_FUNCTION_CALL = 'MALFORMED_FUNCTION_CALL'
|
152
140
|
|
153
|
-
DynamicRetrievalConfigMode = Literal["MODE_UNSPECIFIED", "MODE_DYNAMIC"]
|
154
141
|
|
142
|
+
class HarmProbability(_common.CaseInSensitiveEnum):
|
143
|
+
"""Output only. Harm probability levels in the content."""
|
155
144
|
|
156
|
-
|
145
|
+
HARM_PROBABILITY_UNSPECIFIED = 'HARM_PROBABILITY_UNSPECIFIED'
|
146
|
+
NEGLIGIBLE = 'NEGLIGIBLE'
|
147
|
+
LOW = 'LOW'
|
148
|
+
MEDIUM = 'MEDIUM'
|
149
|
+
HIGH = 'HIGH'
|
157
150
|
|
158
151
|
|
159
|
-
|
160
|
-
|
161
|
-
"MEDIA_RESOLUTION_LOW",
|
162
|
-
"MEDIA_RESOLUTION_MEDIUM",
|
163
|
-
"MEDIA_RESOLUTION_HIGH",
|
164
|
-
]
|
152
|
+
class HarmSeverity(_common.CaseInSensitiveEnum):
|
153
|
+
"""Output only. Harm severity levels in the content."""
|
165
154
|
|
155
|
+
HARM_SEVERITY_UNSPECIFIED = 'HARM_SEVERITY_UNSPECIFIED'
|
156
|
+
HARM_SEVERITY_NEGLIGIBLE = 'HARM_SEVERITY_NEGLIGIBLE'
|
157
|
+
HARM_SEVERITY_LOW = 'HARM_SEVERITY_LOW'
|
158
|
+
HARM_SEVERITY_MEDIUM = 'HARM_SEVERITY_MEDIUM'
|
159
|
+
HARM_SEVERITY_HIGH = 'HARM_SEVERITY_HIGH'
|
166
160
|
|
167
|
-
SafetyFilterLevel = Literal[
|
168
|
-
"BLOCK_LOW_AND_ABOVE",
|
169
|
-
"BLOCK_MEDIUM_AND_ABOVE",
|
170
|
-
"BLOCK_ONLY_HIGH",
|
171
|
-
"BLOCK_NONE",
|
172
|
-
]
|
173
161
|
|
162
|
+
class BlockedReason(_common.CaseInSensitiveEnum):
|
163
|
+
"""Output only. Blocked reason."""
|
174
164
|
|
175
|
-
|
165
|
+
BLOCKED_REASON_UNSPECIFIED = 'BLOCKED_REASON_UNSPECIFIED'
|
166
|
+
SAFETY = 'SAFETY'
|
167
|
+
OTHER = 'OTHER'
|
168
|
+
BLOCKLIST = 'BLOCKLIST'
|
169
|
+
PROHIBITED_CONTENT = 'PROHIBITED_CONTENT'
|
176
170
|
|
177
171
|
|
178
|
-
|
172
|
+
class DeploymentResourcesType(_common.CaseInSensitiveEnum):
|
173
|
+
""""""
|
179
174
|
|
175
|
+
DEPLOYMENT_RESOURCES_TYPE_UNSPECIFIED = (
|
176
|
+
'DEPLOYMENT_RESOURCES_TYPE_UNSPECIFIED'
|
177
|
+
)
|
178
|
+
DEDICATED_RESOURCES = 'DEDICATED_RESOURCES'
|
179
|
+
AUTOMATIC_RESOURCES = 'AUTOMATIC_RESOURCES'
|
180
|
+
SHARED_RESOURCES = 'SHARED_RESOURCES'
|
180
181
|
|
181
|
-
MaskReferenceMode = Literal[
|
182
|
-
"MASK_MODE_DEFAULT",
|
183
|
-
"MASK_MODE_USER_PROVIDED",
|
184
|
-
"MASK_MODE_BACKGROUND",
|
185
|
-
"MASK_MODE_FOREGROUND",
|
186
|
-
"MASK_MODE_SEMANTIC",
|
187
|
-
]
|
188
182
|
|
183
|
+
class JobState(_common.CaseInSensitiveEnum):
|
184
|
+
"""Job state."""
|
189
185
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
186
|
+
JOB_STATE_UNSPECIFIED = 'JOB_STATE_UNSPECIFIED'
|
187
|
+
JOB_STATE_QUEUED = 'JOB_STATE_QUEUED'
|
188
|
+
JOB_STATE_PENDING = 'JOB_STATE_PENDING'
|
189
|
+
JOB_STATE_RUNNING = 'JOB_STATE_RUNNING'
|
190
|
+
JOB_STATE_SUCCEEDED = 'JOB_STATE_SUCCEEDED'
|
191
|
+
JOB_STATE_FAILED = 'JOB_STATE_FAILED'
|
192
|
+
JOB_STATE_CANCELLING = 'JOB_STATE_CANCELLING'
|
193
|
+
JOB_STATE_CANCELLED = 'JOB_STATE_CANCELLED'
|
194
|
+
JOB_STATE_PAUSED = 'JOB_STATE_PAUSED'
|
195
|
+
JOB_STATE_EXPIRED = 'JOB_STATE_EXPIRED'
|
196
|
+
JOB_STATE_UPDATING = 'JOB_STATE_UPDATING'
|
197
|
+
JOB_STATE_PARTIALLY_SUCCEEDED = 'JOB_STATE_PARTIALLY_SUCCEEDED'
|
196
198
|
|
197
199
|
|
198
|
-
|
199
|
-
|
200
|
-
"SUBJECT_TYPE_PERSON",
|
201
|
-
"SUBJECT_TYPE_ANIMAL",
|
202
|
-
"SUBJECT_TYPE_PRODUCT",
|
203
|
-
]
|
200
|
+
class AdapterSize(_common.CaseInSensitiveEnum):
|
201
|
+
"""Optional. Adapter size for tuning."""
|
204
202
|
|
203
|
+
ADAPTER_SIZE_UNSPECIFIED = 'ADAPTER_SIZE_UNSPECIFIED'
|
204
|
+
ADAPTER_SIZE_ONE = 'ADAPTER_SIZE_ONE'
|
205
|
+
ADAPTER_SIZE_FOUR = 'ADAPTER_SIZE_FOUR'
|
206
|
+
ADAPTER_SIZE_EIGHT = 'ADAPTER_SIZE_EIGHT'
|
207
|
+
ADAPTER_SIZE_SIXTEEN = 'ADAPTER_SIZE_SIXTEEN'
|
208
|
+
ADAPTER_SIZE_THIRTY_TWO = 'ADAPTER_SIZE_THIRTY_TWO'
|
205
209
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
210
|
+
|
211
|
+
class DynamicRetrievalConfigMode(_common.CaseInSensitiveEnum):
|
212
|
+
"""Config for the dynamic retrieval config mode."""
|
213
|
+
|
214
|
+
MODE_UNSPECIFIED = 'MODE_UNSPECIFIED'
|
215
|
+
MODE_DYNAMIC = 'MODE_DYNAMIC'
|
216
|
+
|
217
|
+
|
218
|
+
class FunctionCallingConfigMode(_common.CaseInSensitiveEnum):
|
219
|
+
"""Config for the function calling config mode."""
|
220
|
+
|
221
|
+
MODE_UNSPECIFIED = 'MODE_UNSPECIFIED'
|
222
|
+
AUTO = 'AUTO'
|
223
|
+
ANY = 'ANY'
|
224
|
+
NONE = 'NONE'
|
225
|
+
|
226
|
+
|
227
|
+
class MediaResolution(_common.CaseInSensitiveEnum):
|
228
|
+
"""The media resolution to use."""
|
229
|
+
|
230
|
+
MEDIA_RESOLUTION_UNSPECIFIED = 'MEDIA_RESOLUTION_UNSPECIFIED'
|
231
|
+
MEDIA_RESOLUTION_LOW = 'MEDIA_RESOLUTION_LOW'
|
232
|
+
MEDIA_RESOLUTION_MEDIUM = 'MEDIA_RESOLUTION_MEDIUM'
|
233
|
+
MEDIA_RESOLUTION_HIGH = 'MEDIA_RESOLUTION_HIGH'
|
234
|
+
|
235
|
+
|
236
|
+
class SafetyFilterLevel(_common.CaseInSensitiveEnum):
|
237
|
+
"""Enum that controls the safety filter level for objectionable content."""
|
238
|
+
|
239
|
+
BLOCK_LOW_AND_ABOVE = 'BLOCK_LOW_AND_ABOVE'
|
240
|
+
BLOCK_MEDIUM_AND_ABOVE = 'BLOCK_MEDIUM_AND_ABOVE'
|
241
|
+
BLOCK_ONLY_HIGH = 'BLOCK_ONLY_HIGH'
|
242
|
+
BLOCK_NONE = 'BLOCK_NONE'
|
243
|
+
|
244
|
+
|
245
|
+
class PersonGeneration(_common.CaseInSensitiveEnum):
|
246
|
+
"""Enum that controls the generation of people."""
|
247
|
+
|
248
|
+
DONT_ALLOW = 'DONT_ALLOW'
|
249
|
+
ALLOW_ADULT = 'ALLOW_ADULT'
|
250
|
+
ALLOW_ALL = 'ALLOW_ALL'
|
251
|
+
|
252
|
+
|
253
|
+
class ImagePromptLanguage(_common.CaseInSensitiveEnum):
|
254
|
+
"""Enum that specifies the language of the text in the prompt."""
|
255
|
+
|
256
|
+
auto = 'auto'
|
257
|
+
en = 'en'
|
258
|
+
ja = 'ja'
|
259
|
+
ko = 'ko'
|
260
|
+
hi = 'hi'
|
261
|
+
|
262
|
+
|
263
|
+
class MaskReferenceMode(_common.CaseInSensitiveEnum):
|
264
|
+
"""Enum representing the mask mode of a mask reference image."""
|
265
|
+
|
266
|
+
MASK_MODE_DEFAULT = 'MASK_MODE_DEFAULT'
|
267
|
+
MASK_MODE_USER_PROVIDED = 'MASK_MODE_USER_PROVIDED'
|
268
|
+
MASK_MODE_BACKGROUND = 'MASK_MODE_BACKGROUND'
|
269
|
+
MASK_MODE_FOREGROUND = 'MASK_MODE_FOREGROUND'
|
270
|
+
MASK_MODE_SEMANTIC = 'MASK_MODE_SEMANTIC'
|
271
|
+
|
272
|
+
|
273
|
+
class ControlReferenceType(_common.CaseInSensitiveEnum):
|
274
|
+
"""Enum representing the control type of a control reference image."""
|
275
|
+
|
276
|
+
CONTROL_TYPE_DEFAULT = 'CONTROL_TYPE_DEFAULT'
|
277
|
+
CONTROL_TYPE_CANNY = 'CONTROL_TYPE_CANNY'
|
278
|
+
CONTROL_TYPE_SCRIBBLE = 'CONTROL_TYPE_SCRIBBLE'
|
279
|
+
CONTROL_TYPE_FACE_MESH = 'CONTROL_TYPE_FACE_MESH'
|
280
|
+
|
281
|
+
|
282
|
+
class SubjectReferenceType(_common.CaseInSensitiveEnum):
|
283
|
+
"""Enum representing the subject type of a subject reference image."""
|
284
|
+
|
285
|
+
SUBJECT_TYPE_DEFAULT = 'SUBJECT_TYPE_DEFAULT'
|
286
|
+
SUBJECT_TYPE_PERSON = 'SUBJECT_TYPE_PERSON'
|
287
|
+
SUBJECT_TYPE_ANIMAL = 'SUBJECT_TYPE_ANIMAL'
|
288
|
+
SUBJECT_TYPE_PRODUCT = 'SUBJECT_TYPE_PRODUCT'
|
289
|
+
|
290
|
+
|
291
|
+
class EditMode(_common.CaseInSensitiveEnum):
|
292
|
+
"""Enum representing the Imagen 3 Edit mode."""
|
293
|
+
|
294
|
+
EDIT_MODE_DEFAULT = 'EDIT_MODE_DEFAULT'
|
295
|
+
EDIT_MODE_INPAINT_REMOVAL = 'EDIT_MODE_INPAINT_REMOVAL'
|
296
|
+
EDIT_MODE_INPAINT_INSERTION = 'EDIT_MODE_INPAINT_INSERTION'
|
297
|
+
EDIT_MODE_OUTPAINT = 'EDIT_MODE_OUTPAINT'
|
298
|
+
EDIT_MODE_CONTROLLED_EDITING = 'EDIT_MODE_CONTROLLED_EDITING'
|
299
|
+
EDIT_MODE_STYLE = 'EDIT_MODE_STYLE'
|
300
|
+
EDIT_MODE_BGSWAP = 'EDIT_MODE_BGSWAP'
|
301
|
+
EDIT_MODE_PRODUCT_IMAGE = 'EDIT_MODE_PRODUCT_IMAGE'
|
302
|
+
|
303
|
+
|
304
|
+
class FileState(_common.CaseInSensitiveEnum):
|
305
|
+
"""State for the lifecycle of a File."""
|
306
|
+
|
307
|
+
STATE_UNSPECIFIED = 'STATE_UNSPECIFIED'
|
308
|
+
PROCESSING = 'PROCESSING'
|
309
|
+
ACTIVE = 'ACTIVE'
|
310
|
+
FAILED = 'FAILED'
|
216
311
|
|
217
312
|
|
218
|
-
|
313
|
+
class FileSource(_common.CaseInSensitiveEnum):
|
314
|
+
"""Source of the File."""
|
315
|
+
|
316
|
+
SOURCE_UNSPECIFIED = 'SOURCE_UNSPECIFIED'
|
317
|
+
UPLOADED = 'UPLOADED'
|
318
|
+
GENERATED = 'GENERATED'
|
319
|
+
|
320
|
+
|
321
|
+
class Modality(_common.CaseInSensitiveEnum):
|
322
|
+
"""Server content modalities."""
|
323
|
+
|
324
|
+
MODALITY_UNSPECIFIED = 'MODALITY_UNSPECIFIED'
|
325
|
+
TEXT = 'TEXT'
|
326
|
+
IMAGE = 'IMAGE'
|
327
|
+
AUDIO = 'AUDIO'
|
219
328
|
|
220
329
|
|
221
330
|
class VideoMetadata(_common.BaseModel):
|
@@ -402,10 +511,7 @@ FunctionResponseOrDict = Union[FunctionResponse, FunctionResponseDict]
|
|
402
511
|
|
403
512
|
|
404
513
|
class Blob(_common.BaseModel):
|
405
|
-
"""Content blob.
|
406
|
-
|
407
|
-
It's preferred to send as text directly rather than raw bytes.
|
408
|
-
"""
|
514
|
+
"""Content blob."""
|
409
515
|
|
410
516
|
data: Optional[bytes] = Field(
|
411
517
|
default=None, description="""Required. Raw bytes."""
|
@@ -417,10 +523,7 @@ class Blob(_common.BaseModel):
|
|
417
523
|
|
418
524
|
|
419
525
|
class BlobDict(TypedDict, total=False):
|
420
|
-
"""Content blob.
|
421
|
-
|
422
|
-
It's preferred to send as text directly rather than raw bytes.
|
423
|
-
"""
|
526
|
+
"""Content blob."""
|
424
527
|
|
425
528
|
data: Optional[bytes]
|
426
529
|
"""Required. Raw bytes."""
|
@@ -474,16 +577,16 @@ class Part(_common.BaseModel):
|
|
474
577
|
)
|
475
578
|
|
476
579
|
@classmethod
|
477
|
-
def from_uri(cls, file_uri: str, mime_type: str) ->
|
580
|
+
def from_uri(cls, *, file_uri: str, mime_type: str) -> 'Part':
|
478
581
|
file_data = FileData(file_uri=file_uri, mime_type=mime_type)
|
479
582
|
return cls(file_data=file_data)
|
480
583
|
|
481
584
|
@classmethod
|
482
|
-
def from_text(cls, text: str) ->
|
585
|
+
def from_text(cls, *, text: str) -> 'Part':
|
483
586
|
return cls(text=text)
|
484
587
|
|
485
588
|
@classmethod
|
486
|
-
def from_bytes(cls, data: bytes, mime_type: str) ->
|
589
|
+
def from_bytes(cls, *, data: bytes, mime_type: str) -> 'Part':
|
487
590
|
inline_data = Blob(
|
488
591
|
data=data,
|
489
592
|
mime_type=mime_type,
|
@@ -491,31 +594,33 @@ class Part(_common.BaseModel):
|
|
491
594
|
return cls(inline_data=inline_data)
|
492
595
|
|
493
596
|
@classmethod
|
494
|
-
def from_function_call(cls, name: str, args: dict[str, Any]) ->
|
597
|
+
def from_function_call(cls, *, name: str, args: dict[str, Any]) -> 'Part':
|
495
598
|
function_call = FunctionCall(name=name, args=args)
|
496
599
|
return cls(function_call=function_call)
|
497
600
|
|
498
601
|
@classmethod
|
499
602
|
def from_function_response(
|
500
|
-
cls, name: str, response: dict[str, Any]
|
501
|
-
) ->
|
603
|
+
cls, *, name: str, response: dict[str, Any]
|
604
|
+
) -> 'Part':
|
502
605
|
function_response = FunctionResponse(name=name, response=response)
|
503
606
|
return cls(function_response=function_response)
|
504
607
|
|
505
608
|
@classmethod
|
506
|
-
def from_video_metadata(cls,
|
609
|
+
def from_video_metadata(cls, *, start_offset: str, end_offset: str) -> 'Part':
|
507
610
|
video_metadata = VideoMetadata(
|
508
611
|
end_offset=end_offset, start_offset=start_offset
|
509
612
|
)
|
510
613
|
return cls(video_metadata=video_metadata)
|
511
614
|
|
512
615
|
@classmethod
|
513
|
-
def from_executable_code(cls, code: str, language: Language) ->
|
616
|
+
def from_executable_code(cls, *, code: str, language: Language) -> 'Part':
|
514
617
|
executable_code = ExecutableCode(code=code, language=language)
|
515
618
|
return cls(executable_code=executable_code)
|
516
619
|
|
517
620
|
@classmethod
|
518
|
-
def from_code_execution_result(
|
621
|
+
def from_code_execution_result(
|
622
|
+
cls, *, outcome: Outcome, output: str
|
623
|
+
) -> 'Part':
|
519
624
|
code_execution_result = CodeExecutionResult(outcome=outcome, output=output)
|
520
625
|
return cls(code_execution_result=code_execution_result)
|
521
626
|
|
@@ -557,8 +662,6 @@ class PartDict(TypedDict, total=False):
|
|
557
662
|
|
558
663
|
|
559
664
|
PartOrDict = Union[Part, PartDict]
|
560
|
-
PartUnion = Union[Part, PIL.Image.Image, str]
|
561
|
-
PartUnionDict = Union[PartUnion, PartDict]
|
562
665
|
|
563
666
|
|
564
667
|
class Content(_common.BaseModel):
|
@@ -591,11 +694,51 @@ class ContentDict(TypedDict, total=False):
|
|
591
694
|
|
592
695
|
|
593
696
|
ContentOrDict = Union[Content, ContentDict]
|
594
|
-
ContentUnion = Union[Content, list[PartUnion], PartUnion]
|
595
|
-
ContentUnionDict = Union[ContentUnion, ContentDict]
|
596
697
|
|
597
|
-
|
598
|
-
|
698
|
+
|
699
|
+
class HttpOptions(_common.BaseModel):
|
700
|
+
"""HTTP options to be used in each of the requests."""
|
701
|
+
|
702
|
+
base_url: Optional[str] = Field(
|
703
|
+
default=None,
|
704
|
+
description="""The base URL for the AI platform service endpoint.""",
|
705
|
+
)
|
706
|
+
api_version: Optional[str] = Field(
|
707
|
+
default=None, description="""Specifies the version of the API to use."""
|
708
|
+
)
|
709
|
+
headers: Optional[dict[str, str]] = Field(
|
710
|
+
default=None,
|
711
|
+
description="""Additional HTTP headers to be sent with the request.""",
|
712
|
+
)
|
713
|
+
timeout: Optional[int] = Field(
|
714
|
+
default=None, description="""Timeout for the request in milliseconds."""
|
715
|
+
)
|
716
|
+
deprecated_response_payload: Optional[dict[str, any]] = Field(
|
717
|
+
default=None,
|
718
|
+
description="""This field is deprecated. If set, the response payload will be returned int the supplied dict.""",
|
719
|
+
)
|
720
|
+
|
721
|
+
|
722
|
+
class HttpOptionsDict(TypedDict, total=False):
|
723
|
+
"""HTTP options to be used in each of the requests."""
|
724
|
+
|
725
|
+
base_url: Optional[str]
|
726
|
+
"""The base URL for the AI platform service endpoint."""
|
727
|
+
|
728
|
+
api_version: Optional[str]
|
729
|
+
"""Specifies the version of the API to use."""
|
730
|
+
|
731
|
+
headers: Optional[dict[str, str]]
|
732
|
+
"""Additional HTTP headers to be sent with the request."""
|
733
|
+
|
734
|
+
timeout: Optional[int]
|
735
|
+
"""Timeout for the request in milliseconds."""
|
736
|
+
|
737
|
+
deprecated_response_payload: Optional[dict[str, any]]
|
738
|
+
"""This field is deprecated. If set, the response payload will be returned int the supplied dict."""
|
739
|
+
|
740
|
+
|
741
|
+
HttpOptionsOrDict = Union[HttpOptions, HttpOptionsDict]
|
599
742
|
|
600
743
|
|
601
744
|
class Schema(_common.BaseModel):
|
@@ -627,7 +770,7 @@ class Schema(_common.BaseModel):
|
|
627
770
|
default: Optional[Any] = Field(
|
628
771
|
default=None, description="""Optional. Default value of the data."""
|
629
772
|
)
|
630
|
-
any_of: list[
|
773
|
+
any_of: list['Schema'] = Field(
|
631
774
|
default=None,
|
632
775
|
description="""Optional. The value should be validated against any (one or more) of the subschemas in the list.""",
|
633
776
|
)
|
@@ -676,11 +819,11 @@ class Schema(_common.BaseModel):
|
|
676
819
|
default=None,
|
677
820
|
description="""Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc""",
|
678
821
|
)
|
679
|
-
items:
|
822
|
+
items: 'Schema' = Field(
|
680
823
|
default=None,
|
681
824
|
description="""Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY.""",
|
682
825
|
)
|
683
|
-
properties: dict[str,
|
826
|
+
properties: dict[str, 'Schema'] = Field(
|
684
827
|
default=None,
|
685
828
|
description="""Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT.""",
|
686
829
|
)
|
@@ -714,7 +857,7 @@ class SchemaDict(TypedDict, total=False):
|
|
714
857
|
default: Optional[Any]
|
715
858
|
"""Optional. Default value of the data."""
|
716
859
|
|
717
|
-
any_of: list[
|
860
|
+
any_of: list['SchemaDict']
|
718
861
|
"""Optional. The value should be validated against any (one or more) of the subschemas in the list."""
|
719
862
|
|
720
863
|
max_length: Optional[int]
|
@@ -753,10 +896,10 @@ class SchemaDict(TypedDict, total=False):
|
|
753
896
|
format: Optional[str]
|
754
897
|
"""Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc"""
|
755
898
|
|
756
|
-
items:
|
899
|
+
items: 'SchemaDict'
|
757
900
|
"""Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY."""
|
758
901
|
|
759
|
-
properties: dict[str,
|
902
|
+
properties: dict[str, 'SchemaDict']
|
760
903
|
"""Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT."""
|
761
904
|
|
762
905
|
required: Optional[list[str]]
|
@@ -764,8 +907,6 @@ class SchemaDict(TypedDict, total=False):
|
|
764
907
|
|
765
908
|
|
766
909
|
SchemaOrDict = Union[Schema, SchemaDict]
|
767
|
-
SchemaUnion = Union[dict, type, Schema]
|
768
|
-
SchemaUnionDict = Union[SchemaUnion, SchemaDict]
|
769
910
|
|
770
911
|
|
771
912
|
class SafetySetting(_common.BaseModel):
|
@@ -827,88 +968,61 @@ class FunctionDeclaration(_common.BaseModel):
|
|
827
968
|
)
|
828
969
|
|
829
970
|
@classmethod
|
830
|
-
def
|
831
|
-
"""Returns the function variant based on the provided client object."""
|
832
|
-
if client.vertexai:
|
833
|
-
return "VERTEX_AI"
|
834
|
-
else:
|
835
|
-
return "GOOGLE_AI"
|
836
|
-
|
837
|
-
@classmethod
|
838
|
-
def from_function_with_options(
|
971
|
+
def from_callable(
|
839
972
|
cls,
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
Supported endpoints are: 'GOOGLE_AI', 'VERTEX_AI', or 'DEFAULT'.
|
846
|
-
"""
|
973
|
+
*,
|
974
|
+
client,
|
975
|
+
callable: Callable,
|
976
|
+
) -> 'FunctionDeclaration':
|
977
|
+
"""Converts a Callable to a FunctionDeclaration based on the client."""
|
847
978
|
from . import _automatic_function_calling_util
|
848
979
|
|
849
|
-
supported_variants = ["GOOGLE_AI", "VERTEX_AI", "DEFAULT"]
|
850
|
-
if variant not in supported_variants:
|
851
|
-
raise ValueError(
|
852
|
-
f"Unsupported variant: {variant}. Supported variants are:"
|
853
|
-
f" {', '.join(supported_variants)}"
|
854
|
-
)
|
855
|
-
|
856
|
-
# TODO: b/382524014 - Add support for DEFAULT API endpoint.
|
857
|
-
|
858
980
|
parameters_properties = {}
|
859
|
-
for name, param in inspect.signature(
|
981
|
+
for name, param in inspect.signature(callable).parameters.items():
|
860
982
|
if param.kind in (
|
861
983
|
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
862
984
|
inspect.Parameter.KEYWORD_ONLY,
|
863
985
|
inspect.Parameter.POSITIONAL_ONLY,
|
864
986
|
):
|
865
987
|
schema = _automatic_function_calling_util._parse_schema_from_parameter(
|
866
|
-
|
988
|
+
client, param, callable.__name__
|
867
989
|
)
|
868
990
|
parameters_properties[name] = schema
|
869
991
|
declaration = FunctionDeclaration(
|
870
|
-
name=
|
871
|
-
description=
|
992
|
+
name=callable.__name__,
|
993
|
+
description=callable.__doc__,
|
872
994
|
)
|
873
995
|
if parameters_properties:
|
874
996
|
declaration.parameters = Schema(
|
875
|
-
type=
|
997
|
+
type='OBJECT',
|
876
998
|
properties=parameters_properties,
|
877
999
|
)
|
878
|
-
if
|
1000
|
+
if client.vertexai:
|
879
1001
|
declaration.parameters.required = (
|
880
1002
|
_automatic_function_calling_util._get_required_fields(
|
881
1003
|
declaration.parameters
|
882
1004
|
)
|
883
1005
|
)
|
884
|
-
if not
|
1006
|
+
if not client.vertexai:
|
885
1007
|
return declaration
|
886
1008
|
|
887
|
-
return_annotation = inspect.signature(
|
1009
|
+
return_annotation = inspect.signature(callable).return_annotation
|
888
1010
|
if return_annotation is inspect._empty:
|
889
1011
|
return declaration
|
890
1012
|
|
891
1013
|
declaration.response = (
|
892
1014
|
_automatic_function_calling_util._parse_schema_from_parameter(
|
893
|
-
|
1015
|
+
client,
|
894
1016
|
inspect.Parameter(
|
895
|
-
|
1017
|
+
'return_value',
|
896
1018
|
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
897
1019
|
annotation=return_annotation,
|
898
1020
|
),
|
899
|
-
|
1021
|
+
callable.__name__,
|
900
1022
|
)
|
901
1023
|
)
|
902
1024
|
return declaration
|
903
1025
|
|
904
|
-
@classmethod
|
905
|
-
def from_function(cls, client, func: Callable) -> "FunctionDeclaration":
|
906
|
-
"""Converts a function to a FunctionDeclaration."""
|
907
|
-
return cls.from_function_with_options(
|
908
|
-
variant=cls._get_variant(client),
|
909
|
-
func=func,
|
910
|
-
)
|
911
|
-
|
912
1026
|
|
913
1027
|
class FunctionDeclarationDict(TypedDict, total=False):
|
914
1028
|
"""Defines a function that the model can generate JSON inputs for.
|
@@ -1310,8 +1424,6 @@ class SpeechConfigDict(TypedDict, total=False):
|
|
1310
1424
|
|
1311
1425
|
|
1312
1426
|
SpeechConfigOrDict = Union[SpeechConfig, SpeechConfigDict]
|
1313
|
-
SpeechConfigUnion = Union[SpeechConfig, str]
|
1314
|
-
SpeechConfigUnionDict = Union[SpeechConfigUnion, SpeechConfigDict]
|
1315
1427
|
|
1316
1428
|
|
1317
1429
|
class AutomaticFunctionCallingConfig(_common.BaseModel):
|
@@ -1373,154 +1485,340 @@ AutomaticFunctionCallingConfigOrDict = Union[
|
|
1373
1485
|
]
|
1374
1486
|
|
1375
1487
|
|
1376
|
-
class
|
1377
|
-
"""
|
1378
|
-
|
1379
|
-
model_routing_preference: Optional[
|
1380
|
-
Literal["UNKNOWN", "PRIORITIZE_QUALITY", "BALANCED", "PRIORITIZE_COST"]
|
1381
|
-
] = Field(default=None, description="""The model routing preference.""")
|
1382
|
-
|
1383
|
-
|
1384
|
-
class GenerationConfigRoutingConfigAutoRoutingModeDict(TypedDict, total=False):
|
1385
|
-
"""When automated routing is specified, the routing will be determined by the pretrained routing model and customer provided model routing preference."""
|
1386
|
-
|
1387
|
-
model_routing_preference: Optional[
|
1388
|
-
Literal["UNKNOWN", "PRIORITIZE_QUALITY", "BALANCED", "PRIORITIZE_COST"]
|
1389
|
-
]
|
1390
|
-
"""The model routing preference."""
|
1391
|
-
|
1392
|
-
|
1393
|
-
GenerationConfigRoutingConfigAutoRoutingModeOrDict = Union[
|
1394
|
-
GenerationConfigRoutingConfigAutoRoutingMode,
|
1395
|
-
GenerationConfigRoutingConfigAutoRoutingModeDict,
|
1396
|
-
]
|
1397
|
-
|
1398
|
-
|
1399
|
-
class GenerationConfigRoutingConfigManualRoutingMode(_common.BaseModel):
|
1400
|
-
"""When manual routing is set, the specified model will be used directly."""
|
1488
|
+
class ThinkingConfig(_common.BaseModel):
|
1489
|
+
"""The thinking features configuration."""
|
1401
1490
|
|
1402
|
-
|
1491
|
+
include_thoughts: Optional[bool] = Field(
|
1403
1492
|
default=None,
|
1404
|
-
description="""
|
1493
|
+
description="""Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
|
1494
|
+
""",
|
1405
1495
|
)
|
1406
1496
|
|
1407
1497
|
|
1408
|
-
class
|
1409
|
-
|
1410
|
-
):
|
1411
|
-
"""When manual routing is set, the specified model will be used directly."""
|
1498
|
+
class ThinkingConfigDict(TypedDict, total=False):
|
1499
|
+
"""The thinking features configuration."""
|
1412
1500
|
|
1413
|
-
|
1414
|
-
"""
|
1501
|
+
include_thoughts: Optional[bool]
|
1502
|
+
"""Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
|
1503
|
+
"""
|
1415
1504
|
|
1416
1505
|
|
1417
|
-
|
1418
|
-
GenerationConfigRoutingConfigManualRoutingMode,
|
1419
|
-
GenerationConfigRoutingConfigManualRoutingModeDict,
|
1420
|
-
]
|
1506
|
+
ThinkingConfigOrDict = Union[ThinkingConfig, ThinkingConfigDict]
|
1421
1507
|
|
1422
1508
|
|
1423
|
-
class
|
1424
|
-
"""
|
1509
|
+
class FileStatus(_common.BaseModel):
|
1510
|
+
"""Status of a File that uses a common error model."""
|
1425
1511
|
|
1426
|
-
|
1427
|
-
default=None,
|
1512
|
+
details: Optional[list[dict[str, Any]]] = Field(
|
1513
|
+
default=None,
|
1514
|
+
description="""A list of messages that carry the error details. There is a common set of message types for APIs to use.""",
|
1428
1515
|
)
|
1429
|
-
|
1430
|
-
default=None,
|
1516
|
+
message: Optional[str] = Field(
|
1517
|
+
default=None,
|
1518
|
+
description="""A list of messages that carry the error details. There is a common set of message types for APIs to use.""",
|
1519
|
+
)
|
1520
|
+
code: Optional[int] = Field(
|
1521
|
+
default=None, description="""The status code. 0 for OK, 1 for CANCELLED"""
|
1431
1522
|
)
|
1432
1523
|
|
1433
1524
|
|
1434
|
-
class
|
1435
|
-
"""
|
1525
|
+
class FileStatusDict(TypedDict, total=False):
|
1526
|
+
"""Status of a File that uses a common error model."""
|
1436
1527
|
|
1437
|
-
|
1438
|
-
"""
|
1528
|
+
details: Optional[list[dict[str, Any]]]
|
1529
|
+
"""A list of messages that carry the error details. There is a common set of message types for APIs to use."""
|
1439
1530
|
|
1440
|
-
|
1441
|
-
"""
|
1531
|
+
message: Optional[str]
|
1532
|
+
"""A list of messages that carry the error details. There is a common set of message types for APIs to use."""
|
1442
1533
|
|
1534
|
+
code: Optional[int]
|
1535
|
+
"""The status code. 0 for OK, 1 for CANCELLED"""
|
1443
1536
|
|
1444
|
-
GenerationConfigRoutingConfigOrDict = Union[
|
1445
|
-
GenerationConfigRoutingConfig, GenerationConfigRoutingConfigDict
|
1446
|
-
]
|
1447
1537
|
|
1538
|
+
FileStatusOrDict = Union[FileStatus, FileStatusDict]
|
1448
1539
|
|
1449
|
-
class GenerateContentConfig(_common.BaseModel):
|
1450
|
-
"""Class for configuring optional model parameters.
|
1451
1540
|
|
1452
|
-
|
1453
|
-
|
1454
|
-
"""
|
1541
|
+
class File(_common.BaseModel):
|
1542
|
+
"""A file uploaded to the API."""
|
1455
1543
|
|
1456
|
-
|
1544
|
+
name: Optional[str] = Field(
|
1457
1545
|
default=None,
|
1458
|
-
description="""
|
1459
|
-
For example, "Answer as concisely as possible" or "Don't use technical
|
1460
|
-
terms in your response".
|
1461
|
-
""",
|
1546
|
+
description="""The `File` resource name. The ID (name excluding the "files/" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456`""",
|
1462
1547
|
)
|
1463
|
-
|
1548
|
+
display_name: Optional[str] = Field(
|
1464
1549
|
default=None,
|
1465
|
-
description="""
|
1466
|
-
Lower temperatures are good for prompts that require a less open-ended or
|
1467
|
-
creative response, while higher temperatures can lead to more diverse or
|
1468
|
-
creative results.
|
1469
|
-
""",
|
1550
|
+
description="""Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'""",
|
1470
1551
|
)
|
1471
|
-
|
1472
|
-
default=None,
|
1473
|
-
description="""Tokens are selected from the most to least probable until the sum
|
1474
|
-
of their probabilities equals this value. Use a lower value for less
|
1475
|
-
random responses and a higher value for more random responses.
|
1476
|
-
""",
|
1552
|
+
mime_type: Optional[str] = Field(
|
1553
|
+
default=None, description="""Output only. MIME type of the file."""
|
1477
1554
|
)
|
1478
|
-
|
1479
|
-
default=None,
|
1480
|
-
description="""For each token selection step, the ``top_k`` tokens with the
|
1481
|
-
highest probabilities are sampled. Then tokens are further filtered based
|
1482
|
-
on ``top_p`` with the final token selected using temperature sampling. Use
|
1483
|
-
a lower number for less random responses and a higher number for more
|
1484
|
-
random responses.
|
1485
|
-
""",
|
1555
|
+
size_bytes: Optional[int] = Field(
|
1556
|
+
default=None, description="""Output only. Size of the file in bytes."""
|
1486
1557
|
)
|
1487
|
-
|
1558
|
+
create_time: Optional[datetime.datetime] = Field(
|
1488
1559
|
default=None,
|
1489
|
-
description="""
|
1490
|
-
""",
|
1560
|
+
description="""Output only. The timestamp of when the `File` was created.""",
|
1491
1561
|
)
|
1492
|
-
|
1562
|
+
expiration_time: Optional[datetime.datetime] = Field(
|
1493
1563
|
default=None,
|
1494
|
-
description="""
|
1495
|
-
""",
|
1564
|
+
description="""Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'""",
|
1496
1565
|
)
|
1497
|
-
|
1566
|
+
update_time: Optional[datetime.datetime] = Field(
|
1498
1567
|
default=None,
|
1499
|
-
description="""
|
1500
|
-
of the strings is encountered in the response.
|
1501
|
-
""",
|
1568
|
+
description="""Output only. The timestamp of when the `File` was last updated.""",
|
1502
1569
|
)
|
1503
|
-
|
1570
|
+
sha256_hash: Optional[str] = Field(
|
1504
1571
|
default=None,
|
1505
|
-
description="""
|
1506
|
-
chosen by the model at each step.
|
1507
|
-
""",
|
1572
|
+
description="""Output only. SHA-256 hash of the uploaded bytes.""",
|
1508
1573
|
)
|
1509
|
-
|
1510
|
-
default=None,
|
1511
|
-
description="""Number of top candidate tokens to return the log probabilities for
|
1512
|
-
at each generation step.
|
1513
|
-
""",
|
1574
|
+
uri: Optional[str] = Field(
|
1575
|
+
default=None, description="""Output only. The URI of the `File`."""
|
1514
1576
|
)
|
1515
|
-
|
1577
|
+
download_uri: Optional[str] = Field(
|
1516
1578
|
default=None,
|
1517
|
-
description="""
|
1518
|
-
generated text, increasing the probability of generating more diverse
|
1519
|
-
content.
|
1520
|
-
""",
|
1579
|
+
description="""Output only. The URI of the `File`, only set for downloadable (generated) files.""",
|
1521
1580
|
)
|
1522
|
-
|
1523
|
-
default=None,
|
1581
|
+
state: Optional[FileState] = Field(
|
1582
|
+
default=None, description="""Output only. Processing state of the File."""
|
1583
|
+
)
|
1584
|
+
source: Optional[FileSource] = Field(
|
1585
|
+
default=None, description="""Output only. The source of the `File`."""
|
1586
|
+
)
|
1587
|
+
video_metadata: Optional[dict[str, Any]] = Field(
|
1588
|
+
default=None, description="""Output only. Metadata for a video."""
|
1589
|
+
)
|
1590
|
+
error: Optional[FileStatus] = Field(
|
1591
|
+
default=None,
|
1592
|
+
description="""Output only. Error status if File processing failed.""",
|
1593
|
+
)
|
1594
|
+
|
1595
|
+
|
1596
|
+
class FileDict(TypedDict, total=False):
|
1597
|
+
"""A file uploaded to the API."""
|
1598
|
+
|
1599
|
+
name: Optional[str]
|
1600
|
+
"""The `File` resource name. The ID (name excluding the "files/" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456`"""
|
1601
|
+
|
1602
|
+
display_name: Optional[str]
|
1603
|
+
"""Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'"""
|
1604
|
+
|
1605
|
+
mime_type: Optional[str]
|
1606
|
+
"""Output only. MIME type of the file."""
|
1607
|
+
|
1608
|
+
size_bytes: Optional[int]
|
1609
|
+
"""Output only. Size of the file in bytes."""
|
1610
|
+
|
1611
|
+
create_time: Optional[datetime.datetime]
|
1612
|
+
"""Output only. The timestamp of when the `File` was created."""
|
1613
|
+
|
1614
|
+
expiration_time: Optional[datetime.datetime]
|
1615
|
+
"""Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'"""
|
1616
|
+
|
1617
|
+
update_time: Optional[datetime.datetime]
|
1618
|
+
"""Output only. The timestamp of when the `File` was last updated."""
|
1619
|
+
|
1620
|
+
sha256_hash: Optional[str]
|
1621
|
+
"""Output only. SHA-256 hash of the uploaded bytes."""
|
1622
|
+
|
1623
|
+
uri: Optional[str]
|
1624
|
+
"""Output only. The URI of the `File`."""
|
1625
|
+
|
1626
|
+
download_uri: Optional[str]
|
1627
|
+
"""Output only. The URI of the `File`, only set for downloadable (generated) files."""
|
1628
|
+
|
1629
|
+
state: Optional[FileState]
|
1630
|
+
"""Output only. Processing state of the File."""
|
1631
|
+
|
1632
|
+
source: Optional[FileSource]
|
1633
|
+
"""Output only. The source of the `File`."""
|
1634
|
+
|
1635
|
+
video_metadata: Optional[dict[str, Any]]
|
1636
|
+
"""Output only. Metadata for a video."""
|
1637
|
+
|
1638
|
+
error: Optional[FileStatusDict]
|
1639
|
+
"""Output only. Error status if File processing failed."""
|
1640
|
+
|
1641
|
+
|
1642
|
+
FileOrDict = Union[File, FileDict]
|
1643
|
+
|
1644
|
+
if _is_pillow_image_imported:
|
1645
|
+
PartUnion = Union[File, Part, PIL_Image, str]
|
1646
|
+
else:
|
1647
|
+
PartUnion = Union[File, Part, str]
|
1648
|
+
|
1649
|
+
|
1650
|
+
PartUnionDict = Union[PartUnion, PartDict]
|
1651
|
+
|
1652
|
+
|
1653
|
+
ContentUnion = Union[Content, list[PartUnion], PartUnion]
|
1654
|
+
|
1655
|
+
|
1656
|
+
ContentUnionDict = Union[ContentUnion, ContentDict]
|
1657
|
+
|
1658
|
+
|
1659
|
+
SchemaUnion = Union[dict, type, Schema, GenericAlias]
|
1660
|
+
|
1661
|
+
|
1662
|
+
SchemaUnionDict = Union[SchemaUnion, SchemaDict]
|
1663
|
+
|
1664
|
+
|
1665
|
+
class GenerationConfigRoutingConfigAutoRoutingMode(_common.BaseModel):
|
1666
|
+
"""When automated routing is specified, the routing will be determined by the pretrained routing model and customer provided model routing preference."""
|
1667
|
+
|
1668
|
+
model_routing_preference: Optional[
|
1669
|
+
Literal['UNKNOWN', 'PRIORITIZE_QUALITY', 'BALANCED', 'PRIORITIZE_COST']
|
1670
|
+
] = Field(default=None, description="""The model routing preference.""")
|
1671
|
+
|
1672
|
+
|
1673
|
+
class GenerationConfigRoutingConfigAutoRoutingModeDict(TypedDict, total=False):
|
1674
|
+
"""When automated routing is specified, the routing will be determined by the pretrained routing model and customer provided model routing preference."""
|
1675
|
+
|
1676
|
+
model_routing_preference: Optional[
|
1677
|
+
Literal['UNKNOWN', 'PRIORITIZE_QUALITY', 'BALANCED', 'PRIORITIZE_COST']
|
1678
|
+
]
|
1679
|
+
"""The model routing preference."""
|
1680
|
+
|
1681
|
+
|
1682
|
+
GenerationConfigRoutingConfigAutoRoutingModeOrDict = Union[
|
1683
|
+
GenerationConfigRoutingConfigAutoRoutingMode,
|
1684
|
+
GenerationConfigRoutingConfigAutoRoutingModeDict,
|
1685
|
+
]
|
1686
|
+
|
1687
|
+
|
1688
|
+
class GenerationConfigRoutingConfigManualRoutingMode(_common.BaseModel):
|
1689
|
+
"""When manual routing is set, the specified model will be used directly."""
|
1690
|
+
|
1691
|
+
model_name: Optional[str] = Field(
|
1692
|
+
default=None,
|
1693
|
+
description="""The model name to use. Only the public LLM models are accepted. e.g. 'gemini-1.5-pro-001'.""",
|
1694
|
+
)
|
1695
|
+
|
1696
|
+
|
1697
|
+
class GenerationConfigRoutingConfigManualRoutingModeDict(
|
1698
|
+
TypedDict, total=False
|
1699
|
+
):
|
1700
|
+
"""When manual routing is set, the specified model will be used directly."""
|
1701
|
+
|
1702
|
+
model_name: Optional[str]
|
1703
|
+
"""The model name to use. Only the public LLM models are accepted. e.g. 'gemini-1.5-pro-001'."""
|
1704
|
+
|
1705
|
+
|
1706
|
+
GenerationConfigRoutingConfigManualRoutingModeOrDict = Union[
|
1707
|
+
GenerationConfigRoutingConfigManualRoutingMode,
|
1708
|
+
GenerationConfigRoutingConfigManualRoutingModeDict,
|
1709
|
+
]
|
1710
|
+
|
1711
|
+
|
1712
|
+
class GenerationConfigRoutingConfig(_common.BaseModel):
|
1713
|
+
"""The configuration for routing the request to a specific model."""
|
1714
|
+
|
1715
|
+
auto_mode: Optional[GenerationConfigRoutingConfigAutoRoutingMode] = Field(
|
1716
|
+
default=None, description="""Automated routing."""
|
1717
|
+
)
|
1718
|
+
manual_mode: Optional[GenerationConfigRoutingConfigManualRoutingMode] = Field(
|
1719
|
+
default=None, description="""Manual routing."""
|
1720
|
+
)
|
1721
|
+
|
1722
|
+
|
1723
|
+
class GenerationConfigRoutingConfigDict(TypedDict, total=False):
|
1724
|
+
"""The configuration for routing the request to a specific model."""
|
1725
|
+
|
1726
|
+
auto_mode: Optional[GenerationConfigRoutingConfigAutoRoutingModeDict]
|
1727
|
+
"""Automated routing."""
|
1728
|
+
|
1729
|
+
manual_mode: Optional[GenerationConfigRoutingConfigManualRoutingModeDict]
|
1730
|
+
"""Manual routing."""
|
1731
|
+
|
1732
|
+
|
1733
|
+
GenerationConfigRoutingConfigOrDict = Union[
|
1734
|
+
GenerationConfigRoutingConfig, GenerationConfigRoutingConfigDict
|
1735
|
+
]
|
1736
|
+
|
1737
|
+
|
1738
|
+
SpeechConfigUnion = Union[SpeechConfig, str]
|
1739
|
+
|
1740
|
+
|
1741
|
+
SpeechConfigUnionDict = Union[SpeechConfigUnion, SpeechConfigDict]
|
1742
|
+
|
1743
|
+
|
1744
|
+
class GenerateContentConfig(_common.BaseModel):
|
1745
|
+
"""Optional model configuration parameters.
|
1746
|
+
|
1747
|
+
For more information, see `Content generation parameters
|
1748
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/content-generation-parameters>`_.
|
1749
|
+
"""
|
1750
|
+
|
1751
|
+
http_options: Optional[HttpOptions] = Field(
|
1752
|
+
default=None, description="""Used to override HTTP request options."""
|
1753
|
+
)
|
1754
|
+
system_instruction: Optional[ContentUnion] = Field(
|
1755
|
+
default=None,
|
1756
|
+
description="""Instructions for the model to steer it toward better performance.
|
1757
|
+
For example, "Answer as concisely as possible" or "Don't use technical
|
1758
|
+
terms in your response".
|
1759
|
+
""",
|
1760
|
+
)
|
1761
|
+
temperature: Optional[float] = Field(
|
1762
|
+
default=None,
|
1763
|
+
description="""Value that controls the degree of randomness in token selection.
|
1764
|
+
Lower temperatures are good for prompts that require a less open-ended or
|
1765
|
+
creative response, while higher temperatures can lead to more diverse or
|
1766
|
+
creative results.
|
1767
|
+
""",
|
1768
|
+
)
|
1769
|
+
top_p: Optional[float] = Field(
|
1770
|
+
default=None,
|
1771
|
+
description="""Tokens are selected from the most to least probable until the sum
|
1772
|
+
of their probabilities equals this value. Use a lower value for less
|
1773
|
+
random responses and a higher value for more random responses.
|
1774
|
+
""",
|
1775
|
+
)
|
1776
|
+
top_k: Optional[float] = Field(
|
1777
|
+
default=None,
|
1778
|
+
description="""For each token selection step, the ``top_k`` tokens with the
|
1779
|
+
highest probabilities are sampled. Then tokens are further filtered based
|
1780
|
+
on ``top_p`` with the final token selected using temperature sampling. Use
|
1781
|
+
a lower number for less random responses and a higher number for more
|
1782
|
+
random responses.
|
1783
|
+
""",
|
1784
|
+
)
|
1785
|
+
candidate_count: Optional[int] = Field(
|
1786
|
+
default=None,
|
1787
|
+
description="""Number of response variations to return.
|
1788
|
+
""",
|
1789
|
+
)
|
1790
|
+
max_output_tokens: Optional[int] = Field(
|
1791
|
+
default=None,
|
1792
|
+
description="""Maximum number of tokens that can be generated in the response.
|
1793
|
+
""",
|
1794
|
+
)
|
1795
|
+
stop_sequences: Optional[list[str]] = Field(
|
1796
|
+
default=None,
|
1797
|
+
description="""List of strings that tells the model to stop generating text if one
|
1798
|
+
of the strings is encountered in the response.
|
1799
|
+
""",
|
1800
|
+
)
|
1801
|
+
response_logprobs: Optional[bool] = Field(
|
1802
|
+
default=None,
|
1803
|
+
description="""Whether to return the log probabilities of the tokens that were
|
1804
|
+
chosen by the model at each step.
|
1805
|
+
""",
|
1806
|
+
)
|
1807
|
+
logprobs: Optional[int] = Field(
|
1808
|
+
default=None,
|
1809
|
+
description="""Number of top candidate tokens to return the log probabilities for
|
1810
|
+
at each generation step.
|
1811
|
+
""",
|
1812
|
+
)
|
1813
|
+
presence_penalty: Optional[float] = Field(
|
1814
|
+
default=None,
|
1815
|
+
description="""Positive values penalize tokens that already appear in the
|
1816
|
+
generated text, increasing the probability of generating more diverse
|
1817
|
+
content.
|
1818
|
+
""",
|
1819
|
+
)
|
1820
|
+
frequency_penalty: Optional[float] = Field(
|
1821
|
+
default=None,
|
1524
1822
|
description="""Positive values penalize tokens that repeatedly appear in the
|
1525
1823
|
generated text, increasing the probability of generating more diverse
|
1526
1824
|
content.
|
@@ -1587,20 +1885,34 @@ class GenerateContentConfig(_common.BaseModel):
|
|
1587
1885
|
description="""The speech generation configuration.
|
1588
1886
|
""",
|
1589
1887
|
)
|
1888
|
+
audio_timestamp: Optional[bool] = Field(
|
1889
|
+
default=None,
|
1890
|
+
description="""If enabled, audio timestamp will be included in the request to the
|
1891
|
+
model.
|
1892
|
+
""",
|
1893
|
+
)
|
1590
1894
|
automatic_function_calling: Optional[AutomaticFunctionCallingConfig] = Field(
|
1591
1895
|
default=None,
|
1592
1896
|
description="""The configuration for automatic function calling.
|
1593
1897
|
""",
|
1594
1898
|
)
|
1899
|
+
thinking_config: Optional[ThinkingConfig] = Field(
|
1900
|
+
default=None,
|
1901
|
+
description="""The thinking features configuration.
|
1902
|
+
""",
|
1903
|
+
)
|
1595
1904
|
|
1596
1905
|
|
1597
1906
|
class GenerateContentConfigDict(TypedDict, total=False):
|
1598
|
-
"""
|
1907
|
+
"""Optional model configuration parameters.
|
1599
1908
|
|
1600
1909
|
For more information, see `Content generation parameters
|
1601
1910
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/content-generation-parameters>`_.
|
1602
1911
|
"""
|
1603
1912
|
|
1913
|
+
http_options: Optional[HttpOptionsDict]
|
1914
|
+
"""Used to override HTTP request options."""
|
1915
|
+
|
1604
1916
|
system_instruction: Optional[ContentUnionDict]
|
1605
1917
|
"""Instructions for the model to steer it toward better performance.
|
1606
1918
|
For example, "Answer as concisely as possible" or "Don't use technical
|
@@ -1713,18 +2025,33 @@ class GenerateContentConfigDict(TypedDict, total=False):
|
|
1713
2025
|
"""The speech generation configuration.
|
1714
2026
|
"""
|
1715
2027
|
|
2028
|
+
audio_timestamp: Optional[bool]
|
2029
|
+
"""If enabled, audio timestamp will be included in the request to the
|
2030
|
+
model.
|
2031
|
+
"""
|
2032
|
+
|
1716
2033
|
automatic_function_calling: Optional[AutomaticFunctionCallingConfigDict]
|
1717
2034
|
"""The configuration for automatic function calling.
|
1718
2035
|
"""
|
1719
2036
|
|
2037
|
+
thinking_config: Optional[ThinkingConfigDict]
|
2038
|
+
"""The thinking features configuration.
|
2039
|
+
"""
|
2040
|
+
|
1720
2041
|
|
1721
2042
|
GenerateContentConfigOrDict = Union[
|
1722
2043
|
GenerateContentConfig, GenerateContentConfigDict
|
1723
2044
|
]
|
1724
2045
|
|
1725
2046
|
|
2047
|
+
ContentListUnion = Union[list[ContentUnion], ContentUnion]
|
2048
|
+
|
2049
|
+
|
2050
|
+
ContentListUnionDict = Union[list[ContentUnionDict], ContentUnionDict]
|
2051
|
+
|
2052
|
+
|
1726
2053
|
class _GenerateContentParameters(_common.BaseModel):
|
1727
|
-
"""
|
2054
|
+
"""Config for models.generate_content parameters."""
|
1728
2055
|
|
1729
2056
|
model: Optional[str] = Field(
|
1730
2057
|
default=None,
|
@@ -1744,7 +2071,7 @@ class _GenerateContentParameters(_common.BaseModel):
|
|
1744
2071
|
|
1745
2072
|
|
1746
2073
|
class _GenerateContentParametersDict(TypedDict, total=False):
|
1747
|
-
"""
|
2074
|
+
"""Config for models.generate_content parameters."""
|
1748
2075
|
|
1749
2076
|
model: Optional[str]
|
1750
2077
|
"""ID of the model to use. For a list of models, see `Google models
|
@@ -1866,7 +2193,7 @@ CitationOrDict = Union[Citation, CitationDict]
|
|
1866
2193
|
|
1867
2194
|
|
1868
2195
|
class CitationMetadata(_common.BaseModel):
|
1869
|
-
"""
|
2196
|
+
"""Citation information when the model quotes another source."""
|
1870
2197
|
|
1871
2198
|
citations: Optional[list[Citation]] = Field(
|
1872
2199
|
default=None,
|
@@ -1878,7 +2205,7 @@ class CitationMetadata(_common.BaseModel):
|
|
1878
2205
|
|
1879
2206
|
|
1880
2207
|
class CitationMetadataDict(TypedDict, total=False):
|
1881
|
-
"""
|
2208
|
+
"""Citation information when the model quotes another source."""
|
1882
2209
|
|
1883
2210
|
citations: Optional[list[CitationDict]]
|
1884
2211
|
"""Contains citation information when the model directly quotes, at
|
@@ -2271,7 +2598,7 @@ SafetyRatingOrDict = Union[SafetyRating, SafetyRatingDict]
|
|
2271
2598
|
|
2272
2599
|
|
2273
2600
|
class Candidate(_common.BaseModel):
|
2274
|
-
"""
|
2601
|
+
"""A response candidate generated from the model."""
|
2275
2602
|
|
2276
2603
|
content: Optional[Content] = Field(
|
2277
2604
|
default=None,
|
@@ -2319,7 +2646,7 @@ class Candidate(_common.BaseModel):
|
|
2319
2646
|
|
2320
2647
|
|
2321
2648
|
class CandidateDict(TypedDict, total=False):
|
2322
|
-
"""
|
2649
|
+
"""A response candidate generated from the model."""
|
2323
2650
|
|
2324
2651
|
content: Optional[ContentDict]
|
2325
2652
|
"""Contains the multi-part content of the response.
|
@@ -2455,7 +2782,7 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2455
2782
|
default=None, description="""Usage metadata about the response(s)."""
|
2456
2783
|
)
|
2457
2784
|
automatic_function_calling_history: Optional[list[Content]] = None
|
2458
|
-
parsed: Union[pydantic.BaseModel, dict] = Field(
|
2785
|
+
parsed: Union[pydantic.BaseModel, dict, Enum] = Field(
|
2459
2786
|
default=None,
|
2460
2787
|
description="""Parsed response if response_schema is provided. Not available for streaming.""",
|
2461
2788
|
)
|
@@ -2471,20 +2798,20 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2471
2798
|
return None
|
2472
2799
|
if len(self.candidates) > 1:
|
2473
2800
|
logging.warning(
|
2474
|
-
f
|
2475
|
-
|
2476
|
-
|
2801
|
+
f'there are {len(self.candidates)} candidates, returning text from'
|
2802
|
+
' the first candidate.Access response.candidates directly to get'
|
2803
|
+
' text from other candidates.'
|
2477
2804
|
)
|
2478
|
-
text =
|
2805
|
+
text = ''
|
2479
2806
|
any_text_part_text = False
|
2480
2807
|
for part in self.candidates[0].content.parts:
|
2481
2808
|
for field_name, field_value in part.dict(
|
2482
|
-
exclude={
|
2809
|
+
exclude={'text', 'thought'}
|
2483
2810
|
).items():
|
2484
2811
|
if field_value is not None:
|
2485
2812
|
raise ValueError(
|
2486
|
-
|
2487
|
-
f
|
2813
|
+
'GenerateContentResponse.text only supports text parts, but got'
|
2814
|
+
f' {field_name} part{part}'
|
2488
2815
|
)
|
2489
2816
|
if isinstance(part.text, str):
|
2490
2817
|
if isinstance(part.thought, bool) and part.thought:
|
@@ -2505,8 +2832,8 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2505
2832
|
return None
|
2506
2833
|
if len(self.candidates) > 1:
|
2507
2834
|
logging.warning(
|
2508
|
-
|
2509
|
-
|
2835
|
+
'Warning: there are multiple candidates in the response, returning'
|
2836
|
+
' function calls from the first one.'
|
2510
2837
|
)
|
2511
2838
|
function_calls = [
|
2512
2839
|
part.function_call
|
@@ -2518,16 +2845,20 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2518
2845
|
|
2519
2846
|
@classmethod
|
2520
2847
|
def _from_response(
|
2521
|
-
cls, response: dict[str, object], kwargs: dict[str, object]
|
2848
|
+
cls, *, response: dict[str, object], kwargs: dict[str, object]
|
2522
2849
|
):
|
2523
2850
|
result = super()._from_response(response, kwargs)
|
2524
2851
|
|
2525
2852
|
# Handles response schema.
|
2526
2853
|
response_schema = _common.get_value_by_path(
|
2527
|
-
kwargs, [
|
2854
|
+
kwargs, ['config', 'response_schema']
|
2528
2855
|
)
|
2529
|
-
if
|
2530
|
-
response_schema
|
2856
|
+
if (
|
2857
|
+
inspect.isclass(response_schema)
|
2858
|
+
and not (
|
2859
|
+
isinstance(response_schema, GenericAlias)
|
2860
|
+
) # Needed for Python 3.9 and 3.10
|
2861
|
+
and issubclass(response_schema, pydantic.BaseModel)
|
2531
2862
|
):
|
2532
2863
|
# Pydantic schema.
|
2533
2864
|
try:
|
@@ -2535,14 +2866,40 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2535
2866
|
# may not be a valid json per stream response
|
2536
2867
|
except pydantic.ValidationError:
|
2537
2868
|
pass
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
try:
|
2544
|
-
result.parsed =
|
2545
|
-
|
2869
|
+
except json.decoder.JSONDecodeError:
|
2870
|
+
pass
|
2871
|
+
elif isinstance(response_schema, EnumMeta):
|
2872
|
+
# Enum with "application/json" returns response in double quotes.
|
2873
|
+
enum_value = result.text.replace('"', '')
|
2874
|
+
try:
|
2875
|
+
result.parsed = response_schema(enum_value)
|
2876
|
+
except ValueError:
|
2877
|
+
pass
|
2878
|
+
elif isinstance(response_schema, GenericAlias) or isinstance(
|
2879
|
+
response_schema, type
|
2880
|
+
):
|
2881
|
+
|
2882
|
+
class Placeholder(pydantic.BaseModel):
|
2883
|
+
placeholder: response_schema
|
2884
|
+
|
2885
|
+
try:
|
2886
|
+
parsed = {'placeholder': json.loads(result.text)}
|
2887
|
+
placeholder = Placeholder.model_validate(parsed)
|
2888
|
+
result.parsed = placeholder.placeholder
|
2889
|
+
except json.decoder.JSONDecodeError:
|
2890
|
+
pass
|
2891
|
+
except pydantic.ValidationError:
|
2892
|
+
pass
|
2893
|
+
|
2894
|
+
elif isinstance(response_schema, dict) or isinstance(
|
2895
|
+
response_schema, Schema
|
2896
|
+
):
|
2897
|
+
# With just the Schema, we don't know what pydantic model the user would
|
2898
|
+
# want the result converted to. So just return json.
|
2899
|
+
# JSON schema.
|
2900
|
+
try:
|
2901
|
+
result.parsed = json.loads(result.text)
|
2902
|
+
# may not be a valid json per stream response
|
2546
2903
|
except json.decoder.JSONDecodeError:
|
2547
2904
|
pass
|
2548
2905
|
|
@@ -2572,9 +2929,9 @@ GenerateContentResponseOrDict = Union[
|
|
2572
2929
|
|
2573
2930
|
|
2574
2931
|
class EmbedContentConfig(_common.BaseModel):
|
2575
|
-
"""
|
2932
|
+
"""Optional parameters for the embed_content method."""
|
2576
2933
|
|
2577
|
-
http_options: Optional[
|
2934
|
+
http_options: Optional[HttpOptions] = Field(
|
2578
2935
|
default=None, description="""Used to override HTTP request options."""
|
2579
2936
|
)
|
2580
2937
|
task_type: Optional[str] = Field(
|
@@ -2611,9 +2968,9 @@ class EmbedContentConfig(_common.BaseModel):
|
|
2611
2968
|
|
2612
2969
|
|
2613
2970
|
class EmbedContentConfigDict(TypedDict, total=False):
|
2614
|
-
"""
|
2971
|
+
"""Optional parameters for the embed_content method."""
|
2615
2972
|
|
2616
|
-
http_options: Optional[
|
2973
|
+
http_options: Optional[HttpOptionsDict]
|
2617
2974
|
"""Used to override HTTP request options."""
|
2618
2975
|
|
2619
2976
|
task_type: Optional[str]
|
@@ -2812,10 +3169,10 @@ EmbedContentResponseOrDict = Union[
|
|
2812
3169
|
]
|
2813
3170
|
|
2814
3171
|
|
2815
|
-
class
|
2816
|
-
"""
|
3172
|
+
class GenerateImagesConfig(_common.BaseModel):
|
3173
|
+
"""The config for generating an images."""
|
2817
3174
|
|
2818
|
-
http_options: Optional[
|
3175
|
+
http_options: Optional[HttpOptions] = Field(
|
2819
3176
|
default=None, description="""Used to override HTTP request options."""
|
2820
3177
|
)
|
2821
3178
|
output_gcs_uri: Optional[str] = Field(
|
@@ -2885,20 +3242,25 @@ class GenerateImageConfig(_common.BaseModel):
|
|
2885
3242
|
)
|
2886
3243
|
add_watermark: Optional[bool] = Field(
|
2887
3244
|
default=None,
|
2888
|
-
description="""Whether to add a watermark to the generated
|
3245
|
+
description="""Whether to add a watermark to the generated images.
|
2889
3246
|
""",
|
2890
3247
|
)
|
2891
3248
|
aspect_ratio: Optional[str] = Field(
|
2892
3249
|
default=None,
|
2893
|
-
description="""Aspect ratio of the generated
|
3250
|
+
description="""Aspect ratio of the generated images.
|
3251
|
+
""",
|
3252
|
+
)
|
3253
|
+
enhance_prompt: Optional[bool] = Field(
|
3254
|
+
default=None,
|
3255
|
+
description="""Whether to use the prompt rewriting logic.
|
2894
3256
|
""",
|
2895
3257
|
)
|
2896
3258
|
|
2897
3259
|
|
2898
|
-
class
|
2899
|
-
"""
|
3260
|
+
class GenerateImagesConfigDict(TypedDict, total=False):
|
3261
|
+
"""The config for generating an images."""
|
2900
3262
|
|
2901
|
-
http_options: Optional[
|
3263
|
+
http_options: Optional[HttpOptionsDict]
|
2902
3264
|
"""Used to override HTTP request options."""
|
2903
3265
|
|
2904
3266
|
output_gcs_uri: Optional[str]
|
@@ -2955,19 +3317,25 @@ class GenerateImageConfigDict(TypedDict, total=False):
|
|
2955
3317
|
"""
|
2956
3318
|
|
2957
3319
|
add_watermark: Optional[bool]
|
2958
|
-
"""Whether to add a watermark to the generated
|
3320
|
+
"""Whether to add a watermark to the generated images.
|
2959
3321
|
"""
|
2960
3322
|
|
2961
3323
|
aspect_ratio: Optional[str]
|
2962
|
-
"""Aspect ratio of the generated
|
3324
|
+
"""Aspect ratio of the generated images.
|
3325
|
+
"""
|
3326
|
+
|
3327
|
+
enhance_prompt: Optional[bool]
|
3328
|
+
"""Whether to use the prompt rewriting logic.
|
2963
3329
|
"""
|
2964
3330
|
|
2965
3331
|
|
2966
|
-
|
3332
|
+
GenerateImagesConfigOrDict = Union[
|
3333
|
+
GenerateImagesConfig, GenerateImagesConfigDict
|
3334
|
+
]
|
2967
3335
|
|
2968
3336
|
|
2969
|
-
class
|
2970
|
-
"""
|
3337
|
+
class _GenerateImagesParameters(_common.BaseModel):
|
3338
|
+
"""The parameters for generating images."""
|
2971
3339
|
|
2972
3340
|
model: Optional[str] = Field(
|
2973
3341
|
default=None,
|
@@ -2976,39 +3344,39 @@ class _GenerateImageParameters(_common.BaseModel):
|
|
2976
3344
|
)
|
2977
3345
|
prompt: Optional[str] = Field(
|
2978
3346
|
default=None,
|
2979
|
-
description="""Text prompt that typically describes the
|
3347
|
+
description="""Text prompt that typically describes the images to output.
|
2980
3348
|
""",
|
2981
3349
|
)
|
2982
|
-
config: Optional[
|
3350
|
+
config: Optional[GenerateImagesConfig] = Field(
|
2983
3351
|
default=None,
|
2984
|
-
description="""Configuration for generating
|
3352
|
+
description="""Configuration for generating images.
|
2985
3353
|
""",
|
2986
3354
|
)
|
2987
3355
|
|
2988
3356
|
|
2989
|
-
class
|
2990
|
-
"""
|
3357
|
+
class _GenerateImagesParametersDict(TypedDict, total=False):
|
3358
|
+
"""The parameters for generating images."""
|
2991
3359
|
|
2992
3360
|
model: Optional[str]
|
2993
3361
|
"""ID of the model to use. For a list of models, see `Google models
|
2994
3362
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_."""
|
2995
3363
|
|
2996
3364
|
prompt: Optional[str]
|
2997
|
-
"""Text prompt that typically describes the
|
3365
|
+
"""Text prompt that typically describes the images to output.
|
2998
3366
|
"""
|
2999
3367
|
|
3000
|
-
config: Optional[
|
3001
|
-
"""Configuration for generating
|
3368
|
+
config: Optional[GenerateImagesConfigDict]
|
3369
|
+
"""Configuration for generating images.
|
3002
3370
|
"""
|
3003
3371
|
|
3004
3372
|
|
3005
|
-
|
3006
|
-
|
3373
|
+
_GenerateImagesParametersOrDict = Union[
|
3374
|
+
_GenerateImagesParameters, _GenerateImagesParametersDict
|
3007
3375
|
]
|
3008
3376
|
|
3009
3377
|
|
3010
3378
|
class Image(_common.BaseModel):
|
3011
|
-
"""
|
3379
|
+
"""An image."""
|
3012
3380
|
|
3013
3381
|
gcs_uri: Optional[str] = Field(
|
3014
3382
|
default=None,
|
@@ -3022,13 +3390,16 @@ class Image(_common.BaseModel):
|
|
3022
3390
|
or the ``gcs_uri`` field but not both.
|
3023
3391
|
""",
|
3024
3392
|
)
|
3393
|
+
mime_type: Optional[str] = Field(
|
3394
|
+
default=None, description="""The MIME type of the image."""
|
3395
|
+
)
|
3025
3396
|
|
3026
3397
|
_loaded_image = None
|
3027
3398
|
|
3028
3399
|
"""Image."""
|
3029
3400
|
|
3030
|
-
@
|
3031
|
-
def from_file(location: str) ->
|
3401
|
+
@classmethod
|
3402
|
+
def from_file(cls, *, location: str) -> 'Image':
|
3032
3403
|
"""Lazy-loads an image from a local file or Google Cloud Storage.
|
3033
3404
|
|
3034
3405
|
Args:
|
@@ -3043,22 +3414,22 @@ class Image(_common.BaseModel):
|
|
3043
3414
|
|
3044
3415
|
parsed_url = urllib.parse.urlparse(location)
|
3045
3416
|
if (
|
3046
|
-
parsed_url.scheme ==
|
3047
|
-
and parsed_url.netloc ==
|
3417
|
+
parsed_url.scheme == 'https'
|
3418
|
+
and parsed_url.netloc == 'storage.googleapis.com'
|
3048
3419
|
):
|
3049
3420
|
parsed_url = parsed_url._replace(
|
3050
|
-
scheme=
|
3051
|
-
netloc=
|
3052
|
-
path=f
|
3421
|
+
scheme='gs',
|
3422
|
+
netloc='',
|
3423
|
+
path=f'/{urllib.parse.unquote(parsed_url.path)}',
|
3053
3424
|
)
|
3054
3425
|
location = urllib.parse.urlunparse(parsed_url)
|
3055
3426
|
|
3056
|
-
if parsed_url.scheme ==
|
3057
|
-
return
|
3427
|
+
if parsed_url.scheme == 'gs':
|
3428
|
+
return cls(gcs_uri=location)
|
3058
3429
|
|
3059
3430
|
# Load image from local path
|
3060
3431
|
image_bytes = pathlib.Path(location).read_bytes()
|
3061
|
-
image =
|
3432
|
+
image = cls(image_bytes=image_bytes)
|
3062
3433
|
return image
|
3063
3434
|
|
3064
3435
|
def show(self):
|
@@ -3071,15 +3442,11 @@ class Image(_common.BaseModel):
|
|
3071
3442
|
except ImportError:
|
3072
3443
|
IPython_display = None
|
3073
3444
|
|
3074
|
-
|
3075
|
-
from PIL import Image as PIL_Image
|
3076
|
-
except ImportError:
|
3077
|
-
PIL_Image = None
|
3078
|
-
if PIL_Image and IPython_display:
|
3445
|
+
if IPython_display:
|
3079
3446
|
IPython_display.display(self._pil_image)
|
3080
3447
|
|
3081
3448
|
@property
|
3082
|
-
def _pil_image(self) ->
|
3449
|
+
def _pil_image(self) -> 'PIL_Image.Image':
|
3083
3450
|
try:
|
3084
3451
|
from PIL import Image as PIL_Image
|
3085
3452
|
except ImportError:
|
@@ -3089,8 +3456,8 @@ class Image(_common.BaseModel):
|
|
3089
3456
|
if self._loaded_image is None:
|
3090
3457
|
if not PIL_Image:
|
3091
3458
|
raise RuntimeError(
|
3092
|
-
|
3093
|
-
|
3459
|
+
'The PIL module is not available. Please install the Pillow'
|
3460
|
+
' package. `pip install pillow`'
|
3094
3461
|
)
|
3095
3462
|
self._loaded_image = PIL_Image.open(io.BytesIO(self.image_bytes))
|
3096
3463
|
return self._loaded_image
|
@@ -3106,36 +3473,34 @@ class Image(_common.BaseModel):
|
|
3106
3473
|
pathlib.Path(location).write_bytes(self.image_bytes)
|
3107
3474
|
|
3108
3475
|
|
3109
|
-
Modality = Literal["MODALITY_UNSPECIFIED", "TEXT", "IMAGE", "AUDIO"]
|
3110
|
-
|
3111
3476
|
JOB_STATES_SUCCEEDED_VERTEX = [
|
3112
|
-
|
3477
|
+
'JOB_STATE_SUCCEEDED',
|
3113
3478
|
]
|
3114
3479
|
|
3115
3480
|
JOB_STATES_SUCCEEDED_MLDEV = [
|
3116
|
-
|
3481
|
+
'ACTIVE',
|
3117
3482
|
]
|
3118
3483
|
|
3119
3484
|
JOB_STATES_SUCCEEDED = JOB_STATES_SUCCEEDED_VERTEX + JOB_STATES_SUCCEEDED_MLDEV
|
3120
3485
|
|
3121
3486
|
|
3122
3487
|
JOB_STATES_ENDED_VERTEX = [
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3488
|
+
'JOB_STATE_SUCCEEDED',
|
3489
|
+
'JOB_STATE_FAILED',
|
3490
|
+
'JOB_STATE_CANCELLED',
|
3491
|
+
'JOB_STATE_EXPIRED',
|
3127
3492
|
]
|
3128
3493
|
|
3129
3494
|
JOB_STATES_ENDED_MLDEV = [
|
3130
|
-
|
3131
|
-
|
3495
|
+
'ACTIVE',
|
3496
|
+
'FAILED',
|
3132
3497
|
]
|
3133
3498
|
|
3134
3499
|
JOB_STATES_ENDED = JOB_STATES_ENDED_VERTEX + JOB_STATES_ENDED_MLDEV
|
3135
3500
|
|
3136
3501
|
|
3137
3502
|
class ImageDict(TypedDict, total=False):
|
3138
|
-
"""
|
3503
|
+
"""An image."""
|
3139
3504
|
|
3140
3505
|
gcs_uri: Optional[str]
|
3141
3506
|
"""The Cloud Storage URI of the image. ``Image`` can contain a value
|
@@ -3147,12 +3512,15 @@ class ImageDict(TypedDict, total=False):
|
|
3147
3512
|
or the ``gcs_uri`` field but not both.
|
3148
3513
|
"""
|
3149
3514
|
|
3515
|
+
mime_type: Optional[str]
|
3516
|
+
"""The MIME type of the image."""
|
3517
|
+
|
3150
3518
|
|
3151
3519
|
ImageOrDict = Union[Image, ImageDict]
|
3152
3520
|
|
3153
3521
|
|
3154
3522
|
class GeneratedImage(_common.BaseModel):
|
3155
|
-
"""
|
3523
|
+
"""An output image."""
|
3156
3524
|
|
3157
3525
|
image: Optional[Image] = Field(
|
3158
3526
|
default=None,
|
@@ -3168,7 +3536,7 @@ class GeneratedImage(_common.BaseModel):
|
|
3168
3536
|
|
3169
3537
|
|
3170
3538
|
class GeneratedImageDict(TypedDict, total=False):
|
3171
|
-
"""
|
3539
|
+
"""An output image."""
|
3172
3540
|
|
3173
3541
|
image: Optional[ImageDict]
|
3174
3542
|
"""The output image data.
|
@@ -3183,8 +3551,8 @@ class GeneratedImageDict(TypedDict, total=False):
|
|
3183
3551
|
GeneratedImageOrDict = Union[GeneratedImage, GeneratedImageDict]
|
3184
3552
|
|
3185
3553
|
|
3186
|
-
class
|
3187
|
-
"""
|
3554
|
+
class GenerateImagesResponse(_common.BaseModel):
|
3555
|
+
"""The output images response."""
|
3188
3556
|
|
3189
3557
|
generated_images: Optional[list[GeneratedImage]] = Field(
|
3190
3558
|
default=None,
|
@@ -3193,16 +3561,16 @@ class GenerateImageResponse(_common.BaseModel):
|
|
3193
3561
|
)
|
3194
3562
|
|
3195
3563
|
|
3196
|
-
class
|
3197
|
-
"""
|
3564
|
+
class GenerateImagesResponseDict(TypedDict, total=False):
|
3565
|
+
"""The output images response."""
|
3198
3566
|
|
3199
3567
|
generated_images: Optional[list[GeneratedImageDict]]
|
3200
3568
|
"""List of generated images.
|
3201
3569
|
"""
|
3202
3570
|
|
3203
3571
|
|
3204
|
-
|
3205
|
-
|
3572
|
+
GenerateImagesResponseOrDict = Union[
|
3573
|
+
GenerateImagesResponse, GenerateImagesResponseDict
|
3206
3574
|
]
|
3207
3575
|
|
3208
3576
|
|
@@ -3387,7 +3755,7 @@ _ReferenceImageAPIOrDict = Union[_ReferenceImageAPI, _ReferenceImageAPIDict]
|
|
3387
3755
|
class EditImageConfig(_common.BaseModel):
|
3388
3756
|
"""Configuration for editing an image."""
|
3389
3757
|
|
3390
|
-
http_options: Optional[
|
3758
|
+
http_options: Optional[HttpOptions] = Field(
|
3391
3759
|
default=None, description="""Used to override HTTP request options."""
|
3392
3760
|
)
|
3393
3761
|
output_gcs_uri: Optional[str] = Field(
|
@@ -3464,7 +3832,7 @@ class EditImageConfig(_common.BaseModel):
|
|
3464
3832
|
class EditImageConfigDict(TypedDict, total=False):
|
3465
3833
|
"""Configuration for editing an image."""
|
3466
3834
|
|
3467
|
-
http_options: Optional[
|
3835
|
+
http_options: Optional[HttpOptionsDict]
|
3468
3836
|
"""Used to override HTTP request options."""
|
3469
3837
|
|
3470
3838
|
output_gcs_uri: Optional[str]
|
@@ -3591,7 +3959,7 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
|
|
3591
3959
|
to be modifiable or exposed to users in the SDK method.
|
3592
3960
|
"""
|
3593
3961
|
|
3594
|
-
http_options: Optional[
|
3962
|
+
http_options: Optional[HttpOptions] = Field(
|
3595
3963
|
default=None, description="""Used to override HTTP request options."""
|
3596
3964
|
)
|
3597
3965
|
include_rai_reason: Optional[bool] = Field(
|
@@ -3619,7 +3987,7 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
|
|
3619
3987
|
to be modifiable or exposed to users in the SDK method.
|
3620
3988
|
"""
|
3621
3989
|
|
3622
|
-
http_options: Optional[
|
3990
|
+
http_options: Optional[HttpOptionsDict]
|
3623
3991
|
"""Used to override HTTP request options."""
|
3624
3992
|
|
3625
3993
|
include_rai_reason: Optional[bool]
|
@@ -3702,9 +4070,30 @@ UpscaleImageResponseOrDict = Union[
|
|
3702
4070
|
]
|
3703
4071
|
|
3704
4072
|
|
4073
|
+
class GetModelConfig(_common.BaseModel):
|
4074
|
+
"""Optional parameters for models.get method."""
|
4075
|
+
|
4076
|
+
http_options: Optional[HttpOptions] = Field(
|
4077
|
+
default=None, description="""Used to override HTTP request options."""
|
4078
|
+
)
|
4079
|
+
|
4080
|
+
|
4081
|
+
class GetModelConfigDict(TypedDict, total=False):
|
4082
|
+
"""Optional parameters for models.get method."""
|
4083
|
+
|
4084
|
+
http_options: Optional[HttpOptionsDict]
|
4085
|
+
"""Used to override HTTP request options."""
|
4086
|
+
|
4087
|
+
|
4088
|
+
GetModelConfigOrDict = Union[GetModelConfig, GetModelConfigDict]
|
4089
|
+
|
4090
|
+
|
3705
4091
|
class _GetModelParameters(_common.BaseModel):
|
3706
4092
|
|
3707
4093
|
model: Optional[str] = Field(default=None, description="""""")
|
4094
|
+
config: Optional[GetModelConfig] = Field(
|
4095
|
+
default=None, description="""Optional parameters for the request."""
|
4096
|
+
)
|
3708
4097
|
|
3709
4098
|
|
3710
4099
|
class _GetModelParametersDict(TypedDict, total=False):
|
@@ -3712,6 +4101,9 @@ class _GetModelParametersDict(TypedDict, total=False):
|
|
3712
4101
|
model: Optional[str]
|
3713
4102
|
""""""
|
3714
4103
|
|
4104
|
+
config: Optional[GetModelConfigDict]
|
4105
|
+
"""Optional parameters for the request."""
|
4106
|
+
|
3715
4107
|
|
3716
4108
|
_GetModelParametersOrDict = Union[_GetModelParameters, _GetModelParametersDict]
|
3717
4109
|
|
@@ -3863,7 +4255,7 @@ ModelOrDict = Union[Model, ModelDict]
|
|
3863
4255
|
|
3864
4256
|
class ListModelsConfig(_common.BaseModel):
|
3865
4257
|
|
3866
|
-
http_options: Optional[
|
4258
|
+
http_options: Optional[HttpOptions] = Field(
|
3867
4259
|
default=None, description="""Used to override HTTP request options."""
|
3868
4260
|
)
|
3869
4261
|
page_size: Optional[int] = Field(default=None, description="""""")
|
@@ -3877,7 +4269,7 @@ class ListModelsConfig(_common.BaseModel):
|
|
3877
4269
|
|
3878
4270
|
class ListModelsConfigDict(TypedDict, total=False):
|
3879
4271
|
|
3880
|
-
http_options: Optional[
|
4272
|
+
http_options: Optional[HttpOptionsDict]
|
3881
4273
|
"""Used to override HTTP request options."""
|
3882
4274
|
|
3883
4275
|
page_size: Optional[int]
|
@@ -3932,12 +4324,18 @@ ListModelsResponseOrDict = Union[ListModelsResponse, ListModelsResponseDict]
|
|
3932
4324
|
|
3933
4325
|
class UpdateModelConfig(_common.BaseModel):
|
3934
4326
|
|
4327
|
+
http_options: Optional[HttpOptions] = Field(
|
4328
|
+
default=None, description="""Used to override HTTP request options."""
|
4329
|
+
)
|
3935
4330
|
display_name: Optional[str] = Field(default=None, description="""""")
|
3936
4331
|
description: Optional[str] = Field(default=None, description="""""")
|
3937
4332
|
|
3938
4333
|
|
3939
4334
|
class UpdateModelConfigDict(TypedDict, total=False):
|
3940
4335
|
|
4336
|
+
http_options: Optional[HttpOptionsDict]
|
4337
|
+
"""Used to override HTTP request options."""
|
4338
|
+
|
3941
4339
|
display_name: Optional[str]
|
3942
4340
|
""""""
|
3943
4341
|
|
@@ -3968,9 +4366,28 @@ _UpdateModelParametersOrDict = Union[
|
|
3968
4366
|
]
|
3969
4367
|
|
3970
4368
|
|
4369
|
+
class DeleteModelConfig(_common.BaseModel):
|
4370
|
+
|
4371
|
+
http_options: Optional[HttpOptions] = Field(
|
4372
|
+
default=None, description="""Used to override HTTP request options."""
|
4373
|
+
)
|
4374
|
+
|
4375
|
+
|
4376
|
+
class DeleteModelConfigDict(TypedDict, total=False):
|
4377
|
+
|
4378
|
+
http_options: Optional[HttpOptionsDict]
|
4379
|
+
"""Used to override HTTP request options."""
|
4380
|
+
|
4381
|
+
|
4382
|
+
DeleteModelConfigOrDict = Union[DeleteModelConfig, DeleteModelConfigDict]
|
4383
|
+
|
4384
|
+
|
3971
4385
|
class _DeleteModelParameters(_common.BaseModel):
|
3972
4386
|
|
3973
4387
|
model: Optional[str] = Field(default=None, description="""""")
|
4388
|
+
config: Optional[DeleteModelConfig] = Field(
|
4389
|
+
default=None, description="""Optional parameters for the request."""
|
4390
|
+
)
|
3974
4391
|
|
3975
4392
|
|
3976
4393
|
class _DeleteModelParametersDict(TypedDict, total=False):
|
@@ -3978,6 +4395,9 @@ class _DeleteModelParametersDict(TypedDict, total=False):
|
|
3978
4395
|
model: Optional[str]
|
3979
4396
|
""""""
|
3980
4397
|
|
4398
|
+
config: Optional[DeleteModelConfigDict]
|
4399
|
+
"""Optional parameters for the request."""
|
4400
|
+
|
3981
4401
|
|
3982
4402
|
_DeleteModelParametersOrDict = Union[
|
3983
4403
|
_DeleteModelParameters, _DeleteModelParametersDict
|
@@ -4109,7 +4529,7 @@ GenerationConfigOrDict = Union[GenerationConfig, GenerationConfigDict]
|
|
4109
4529
|
class CountTokensConfig(_common.BaseModel):
|
4110
4530
|
"""Config for the count_tokens method."""
|
4111
4531
|
|
4112
|
-
http_options: Optional[
|
4532
|
+
http_options: Optional[HttpOptions] = Field(
|
4113
4533
|
default=None, description="""Used to override HTTP request options."""
|
4114
4534
|
)
|
4115
4535
|
system_instruction: Optional[ContentUnion] = Field(
|
@@ -4134,7 +4554,7 @@ class CountTokensConfig(_common.BaseModel):
|
|
4134
4554
|
class CountTokensConfigDict(TypedDict, total=False):
|
4135
4555
|
"""Config for the count_tokens method."""
|
4136
4556
|
|
4137
|
-
http_options: Optional[
|
4557
|
+
http_options: Optional[HttpOptionsDict]
|
4138
4558
|
"""Used to override HTTP request options."""
|
4139
4559
|
|
4140
4560
|
system_instruction: Optional[ContentUnionDict]
|
@@ -4218,7 +4638,7 @@ CountTokensResponseOrDict = Union[CountTokensResponse, CountTokensResponseDict]
|
|
4218
4638
|
class ComputeTokensConfig(_common.BaseModel):
|
4219
4639
|
"""Optional parameters for computing tokens."""
|
4220
4640
|
|
4221
|
-
http_options: Optional[
|
4641
|
+
http_options: Optional[HttpOptions] = Field(
|
4222
4642
|
default=None, description="""Used to override HTTP request options."""
|
4223
4643
|
)
|
4224
4644
|
|
@@ -4226,7 +4646,7 @@ class ComputeTokensConfig(_common.BaseModel):
|
|
4226
4646
|
class ComputeTokensConfigDict(TypedDict, total=False):
|
4227
4647
|
"""Optional parameters for computing tokens."""
|
4228
4648
|
|
4229
|
-
http_options: Optional[
|
4649
|
+
http_options: Optional[HttpOptionsDict]
|
4230
4650
|
"""Used to override HTTP request options."""
|
4231
4651
|
|
4232
4652
|
|
@@ -4326,7 +4746,7 @@ ComputeTokensResponseOrDict = Union[
|
|
4326
4746
|
class GetTuningJobConfig(_common.BaseModel):
|
4327
4747
|
"""Optional parameters for tunings.get method."""
|
4328
4748
|
|
4329
|
-
http_options: Optional[
|
4749
|
+
http_options: Optional[HttpOptions] = Field(
|
4330
4750
|
default=None, description="""Used to override HTTP request options."""
|
4331
4751
|
)
|
4332
4752
|
|
@@ -4334,7 +4754,7 @@ class GetTuningJobConfig(_common.BaseModel):
|
|
4334
4754
|
class GetTuningJobConfigDict(TypedDict, total=False):
|
4335
4755
|
"""Optional parameters for tunings.get method."""
|
4336
4756
|
|
4337
|
-
http_options: Optional[
|
4757
|
+
http_options: Optional[HttpOptionsDict]
|
4338
4758
|
"""Used to override HTTP request options."""
|
4339
4759
|
|
4340
4760
|
|
@@ -4953,6 +5373,41 @@ class EncryptionSpecDict(TypedDict, total=False):
|
|
4953
5373
|
EncryptionSpecOrDict = Union[EncryptionSpec, EncryptionSpecDict]
|
4954
5374
|
|
4955
5375
|
|
5376
|
+
class PartnerModelTuningSpec(_common.BaseModel):
|
5377
|
+
"""Tuning spec for Partner models."""
|
5378
|
+
|
5379
|
+
hyper_parameters: Optional[dict[str, Any]] = Field(
|
5380
|
+
default=None,
|
5381
|
+
description="""Hyperparameters for tuning. The accepted hyper_parameters and their valid range of values will differ depending on the base model.""",
|
5382
|
+
)
|
5383
|
+
training_dataset_uri: Optional[str] = Field(
|
5384
|
+
default=None,
|
5385
|
+
description="""Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""",
|
5386
|
+
)
|
5387
|
+
validation_dataset_uri: Optional[str] = Field(
|
5388
|
+
default=None,
|
5389
|
+
description="""Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file.""",
|
5390
|
+
)
|
5391
|
+
|
5392
|
+
|
5393
|
+
class PartnerModelTuningSpecDict(TypedDict, total=False):
|
5394
|
+
"""Tuning spec for Partner models."""
|
5395
|
+
|
5396
|
+
hyper_parameters: Optional[dict[str, Any]]
|
5397
|
+
"""Hyperparameters for tuning. The accepted hyper_parameters and their valid range of values will differ depending on the base model."""
|
5398
|
+
|
5399
|
+
training_dataset_uri: Optional[str]
|
5400
|
+
"""Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file."""
|
5401
|
+
|
5402
|
+
validation_dataset_uri: Optional[str]
|
5403
|
+
"""Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file."""
|
5404
|
+
|
5405
|
+
|
5406
|
+
PartnerModelTuningSpecOrDict = Union[
|
5407
|
+
PartnerModelTuningSpec, PartnerModelTuningSpecDict
|
5408
|
+
]
|
5409
|
+
|
5410
|
+
|
4956
5411
|
class DistillationHyperParameters(_common.BaseModel):
|
4957
5412
|
"""Hyperparameters for Distillation."""
|
4958
5413
|
|
@@ -5048,41 +5503,6 @@ class DistillationSpecDict(TypedDict, total=False):
|
|
5048
5503
|
DistillationSpecOrDict = Union[DistillationSpec, DistillationSpecDict]
|
5049
5504
|
|
5050
5505
|
|
5051
|
-
class PartnerModelTuningSpec(_common.BaseModel):
|
5052
|
-
"""Tuning spec for Partner models."""
|
5053
|
-
|
5054
|
-
hyper_parameters: Optional[dict[str, Any]] = Field(
|
5055
|
-
default=None,
|
5056
|
-
description="""Hyperparameters for tuning. The accepted hyper_parameters and their valid range of values will differ depending on the base model.""",
|
5057
|
-
)
|
5058
|
-
training_dataset_uri: Optional[str] = Field(
|
5059
|
-
default=None,
|
5060
|
-
description="""Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""",
|
5061
|
-
)
|
5062
|
-
validation_dataset_uri: Optional[str] = Field(
|
5063
|
-
default=None,
|
5064
|
-
description="""Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file.""",
|
5065
|
-
)
|
5066
|
-
|
5067
|
-
|
5068
|
-
class PartnerModelTuningSpecDict(TypedDict, total=False):
|
5069
|
-
"""Tuning spec for Partner models."""
|
5070
|
-
|
5071
|
-
hyper_parameters: Optional[dict[str, Any]]
|
5072
|
-
"""Hyperparameters for tuning. The accepted hyper_parameters and their valid range of values will differ depending on the base model."""
|
5073
|
-
|
5074
|
-
training_dataset_uri: Optional[str]
|
5075
|
-
"""Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file."""
|
5076
|
-
|
5077
|
-
validation_dataset_uri: Optional[str]
|
5078
|
-
"""Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file."""
|
5079
|
-
|
5080
|
-
|
5081
|
-
PartnerModelTuningSpecOrDict = Union[
|
5082
|
-
PartnerModelTuningSpec, PartnerModelTuningSpecDict
|
5083
|
-
]
|
5084
|
-
|
5085
|
-
|
5086
5506
|
class TuningJob(_common.BaseModel):
|
5087
5507
|
"""A tuning job."""
|
5088
5508
|
|
@@ -5124,7 +5544,7 @@ class TuningJob(_common.BaseModel):
|
|
5124
5544
|
)
|
5125
5545
|
tuned_model: Optional[TunedModel] = Field(
|
5126
5546
|
default=None,
|
5127
|
-
description="""Output only. The tuned model resources
|
5547
|
+
description="""Output only. The tuned model resources associated with this TuningJob.""",
|
5128
5548
|
)
|
5129
5549
|
supervised_tuning_spec: Optional[SupervisedTuningSpec] = Field(
|
5130
5550
|
default=None, description="""Tuning Spec for Supervised Fine Tuning."""
|
@@ -5137,16 +5557,12 @@ class TuningJob(_common.BaseModel):
|
|
5137
5557
|
default=None,
|
5138
5558
|
description="""Customer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with the provided encryption key.""",
|
5139
5559
|
)
|
5140
|
-
distillation_spec: Optional[DistillationSpec] = Field(
|
5141
|
-
default=None, description="""Tuning Spec for Distillation."""
|
5142
|
-
)
|
5143
5560
|
partner_model_tuning_spec: Optional[PartnerModelTuningSpec] = Field(
|
5144
5561
|
default=None,
|
5145
5562
|
description="""Tuning Spec for open sourced and third party Partner models.""",
|
5146
5563
|
)
|
5147
|
-
|
5148
|
-
default=None,
|
5149
|
-
description="""Output only. The resource name of the PipelineJob associated with the TuningJob. Format: `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`.""",
|
5564
|
+
distillation_spec: Optional[DistillationSpec] = Field(
|
5565
|
+
default=None, description="""Tuning Spec for Distillation."""
|
5150
5566
|
)
|
5151
5567
|
experiment: Optional[str] = Field(
|
5152
5568
|
default=None,
|
@@ -5156,6 +5572,10 @@ class TuningJob(_common.BaseModel):
|
|
5156
5572
|
default=None,
|
5157
5573
|
description="""Optional. The labels with user-defined metadata to organize TuningJob and generated resources such as Model and Endpoint. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.""",
|
5158
5574
|
)
|
5575
|
+
pipeline_job: Optional[str] = Field(
|
5576
|
+
default=None,
|
5577
|
+
description="""Output only. The resource name of the PipelineJob associated with the TuningJob. Format: `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`.""",
|
5578
|
+
)
|
5159
5579
|
tuned_model_display_name: Optional[str] = Field(
|
5160
5580
|
default=None,
|
5161
5581
|
description="""Optional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters.""",
|
@@ -5203,7 +5623,7 @@ class TuningJobDict(TypedDict, total=False):
|
|
5203
5623
|
"""The base model that is being tuned, e.g., "gemini-1.0-pro-002". ."""
|
5204
5624
|
|
5205
5625
|
tuned_model: Optional[TunedModelDict]
|
5206
|
-
"""Output only. The tuned model resources
|
5626
|
+
"""Output only. The tuned model resources associated with this TuningJob."""
|
5207
5627
|
|
5208
5628
|
supervised_tuning_spec: Optional[SupervisedTuningSpecDict]
|
5209
5629
|
"""Tuning Spec for Supervised Fine Tuning."""
|
@@ -5214,14 +5634,11 @@ class TuningJobDict(TypedDict, total=False):
|
|
5214
5634
|
encryption_spec: Optional[EncryptionSpecDict]
|
5215
5635
|
"""Customer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with the provided encryption key."""
|
5216
5636
|
|
5217
|
-
distillation_spec: Optional[DistillationSpecDict]
|
5218
|
-
"""Tuning Spec for Distillation."""
|
5219
|
-
|
5220
5637
|
partner_model_tuning_spec: Optional[PartnerModelTuningSpecDict]
|
5221
5638
|
"""Tuning Spec for open sourced and third party Partner models."""
|
5222
5639
|
|
5223
|
-
|
5224
|
-
"""
|
5640
|
+
distillation_spec: Optional[DistillationSpecDict]
|
5641
|
+
"""Tuning Spec for Distillation."""
|
5225
5642
|
|
5226
5643
|
experiment: Optional[str]
|
5227
5644
|
"""Output only. The Experiment associated with this TuningJob."""
|
@@ -5229,6 +5646,9 @@ class TuningJobDict(TypedDict, total=False):
|
|
5229
5646
|
labels: Optional[dict[str, str]]
|
5230
5647
|
"""Optional. The labels with user-defined metadata to organize TuningJob and generated resources such as Model and Endpoint. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels."""
|
5231
5648
|
|
5649
|
+
pipeline_job: Optional[str]
|
5650
|
+
"""Output only. The resource name of the PipelineJob associated with the TuningJob. Format: `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`."""
|
5651
|
+
|
5232
5652
|
tuned_model_display_name: Optional[str]
|
5233
5653
|
"""Optional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters."""
|
5234
5654
|
|
@@ -5239,6 +5659,9 @@ TuningJobOrDict = Union[TuningJob, TuningJobDict]
|
|
5239
5659
|
class ListTuningJobsConfig(_common.BaseModel):
|
5240
5660
|
"""Configuration for the list tuning jobs method."""
|
5241
5661
|
|
5662
|
+
http_options: Optional[HttpOptions] = Field(
|
5663
|
+
default=None, description="""Used to override HTTP request options."""
|
5664
|
+
)
|
5242
5665
|
page_size: Optional[int] = Field(default=None, description="""""")
|
5243
5666
|
page_token: Optional[str] = Field(default=None, description="""""")
|
5244
5667
|
filter: Optional[str] = Field(default=None, description="""""")
|
@@ -5247,6 +5670,9 @@ class ListTuningJobsConfig(_common.BaseModel):
|
|
5247
5670
|
class ListTuningJobsConfigDict(TypedDict, total=False):
|
5248
5671
|
"""Configuration for the list tuning jobs method."""
|
5249
5672
|
|
5673
|
+
http_options: Optional[HttpOptionsDict]
|
5674
|
+
"""Used to override HTTP request options."""
|
5675
|
+
|
5250
5676
|
page_size: Optional[int]
|
5251
5677
|
""""""
|
5252
5678
|
|
@@ -5321,208 +5747,43 @@ class TuningExample(_common.BaseModel):
|
|
5321
5747
|
|
5322
5748
|
class TuningExampleDict(TypedDict, total=False):
|
5323
5749
|
|
5324
|
-
text_input: Optional[str]
|
5325
|
-
"""Text model input."""
|
5326
|
-
|
5327
|
-
output: Optional[str]
|
5328
|
-
"""The expected model output."""
|
5329
|
-
|
5330
|
-
|
5331
|
-
TuningExampleOrDict = Union[TuningExample, TuningExampleDict]
|
5332
|
-
|
5333
|
-
|
5334
|
-
class TuningDataset(_common.BaseModel):
|
5335
|
-
"""Supervised fune-tuning training dataset."""
|
5336
|
-
|
5337
|
-
gcs_uri: Optional[str] = Field(
|
5338
|
-
default=None,
|
5339
|
-
description="""GCS URI of the file containing training dataset in JSONL format.""",
|
5340
|
-
)
|
5341
|
-
examples: Optional[list[TuningExample]] = Field(
|
5342
|
-
default=None,
|
5343
|
-
description="""Inline examples with simple input/output text.""",
|
5344
|
-
)
|
5345
|
-
|
5346
|
-
|
5347
|
-
class TuningDatasetDict(TypedDict, total=False):
|
5348
|
-
"""Supervised fune-tuning training dataset."""
|
5349
|
-
|
5350
|
-
gcs_uri: Optional[str]
|
5351
|
-
"""GCS URI of the file containing training dataset in JSONL format."""
|
5352
|
-
|
5353
|
-
examples: Optional[list[TuningExampleDict]]
|
5354
|
-
"""Inline examples with simple input/output text."""
|
5355
|
-
|
5356
|
-
|
5357
|
-
TuningDatasetOrDict = Union[TuningDataset, TuningDatasetDict]
|
5358
|
-
|
5359
|
-
|
5360
|
-
class TuningValidationDataset(_common.BaseModel):
|
5361
|
-
|
5362
|
-
gcs_uri: Optional[str] = Field(
|
5363
|
-
default=None,
|
5364
|
-
description="""GCS URI of the file containing validation dataset in JSONL format.""",
|
5365
|
-
)
|
5366
|
-
|
5367
|
-
|
5368
|
-
class TuningValidationDatasetDict(TypedDict, total=False):
|
5369
|
-
|
5370
|
-
gcs_uri: Optional[str]
|
5371
|
-
"""GCS URI of the file containing validation dataset in JSONL format."""
|
5372
|
-
|
5373
|
-
|
5374
|
-
TuningValidationDatasetOrDict = Union[
|
5375
|
-
TuningValidationDataset, TuningValidationDatasetDict
|
5376
|
-
]
|
5377
|
-
|
5378
|
-
|
5379
|
-
class CreateTuningJobConfig(_common.BaseModel):
|
5380
|
-
"""Supervised fine-tuning job creation request - optional fields."""
|
5381
|
-
|
5382
|
-
http_options: Optional[dict[str, Any]] = Field(
|
5383
|
-
default=None, description="""Used to override HTTP request options."""
|
5384
|
-
)
|
5385
|
-
validation_dataset: Optional[TuningValidationDataset] = Field(
|
5386
|
-
default=None,
|
5387
|
-
description="""Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""",
|
5388
|
-
)
|
5389
|
-
tuned_model_display_name: Optional[str] = Field(
|
5390
|
-
default=None,
|
5391
|
-
description="""The display name of the tuned Model. The name can be up to 128 characters long and can consist of any UTF-8 characters.""",
|
5392
|
-
)
|
5393
|
-
description: Optional[str] = Field(
|
5394
|
-
default=None, description="""The description of the TuningJob"""
|
5395
|
-
)
|
5396
|
-
epoch_count: Optional[int] = Field(
|
5397
|
-
default=None,
|
5398
|
-
description="""Number of complete passes the model makes over the entire training dataset during training.""",
|
5399
|
-
)
|
5400
|
-
learning_rate_multiplier: Optional[float] = Field(
|
5401
|
-
default=None,
|
5402
|
-
description="""Multiplier for adjusting the default learning rate.""",
|
5403
|
-
)
|
5404
|
-
adapter_size: Optional[AdapterSize] = Field(
|
5405
|
-
default=None, description="""Adapter size for tuning."""
|
5406
|
-
)
|
5407
|
-
batch_size: Optional[int] = Field(
|
5408
|
-
default=None,
|
5409
|
-
description="""The batch size hyperparameter for tuning. If not set, a default of 4 or 16 will be used based on the number of training examples.""",
|
5410
|
-
)
|
5411
|
-
learning_rate: Optional[float] = Field(
|
5412
|
-
default=None,
|
5413
|
-
description="""The learning rate hyperparameter for tuning. If not set, a default of 0.001 or 0.0002 will be calculated based on the number of training examples.""",
|
5414
|
-
)
|
5415
|
-
|
5416
|
-
|
5417
|
-
class CreateTuningJobConfigDict(TypedDict, total=False):
|
5418
|
-
"""Supervised fine-tuning job creation request - optional fields."""
|
5419
|
-
|
5420
|
-
http_options: Optional[dict[str, Any]]
|
5421
|
-
"""Used to override HTTP request options."""
|
5422
|
-
|
5423
|
-
validation_dataset: Optional[TuningValidationDatasetDict]
|
5424
|
-
"""Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file."""
|
5425
|
-
|
5426
|
-
tuned_model_display_name: Optional[str]
|
5427
|
-
"""The display name of the tuned Model. The name can be up to 128 characters long and can consist of any UTF-8 characters."""
|
5428
|
-
|
5429
|
-
description: Optional[str]
|
5430
|
-
"""The description of the TuningJob"""
|
5431
|
-
|
5432
|
-
epoch_count: Optional[int]
|
5433
|
-
"""Number of complete passes the model makes over the entire training dataset during training."""
|
5434
|
-
|
5435
|
-
learning_rate_multiplier: Optional[float]
|
5436
|
-
"""Multiplier for adjusting the default learning rate."""
|
5437
|
-
|
5438
|
-
adapter_size: Optional[AdapterSize]
|
5439
|
-
"""Adapter size for tuning."""
|
5440
|
-
|
5441
|
-
batch_size: Optional[int]
|
5442
|
-
"""The batch size hyperparameter for tuning. If not set, a default of 4 or 16 will be used based on the number of training examples."""
|
5443
|
-
|
5444
|
-
learning_rate: Optional[float]
|
5445
|
-
"""The learning rate hyperparameter for tuning. If not set, a default of 0.001 or 0.0002 will be calculated based on the number of training examples."""
|
5446
|
-
|
5447
|
-
|
5448
|
-
CreateTuningJobConfigOrDict = Union[
|
5449
|
-
CreateTuningJobConfig, CreateTuningJobConfigDict
|
5450
|
-
]
|
5451
|
-
|
5452
|
-
|
5453
|
-
class _CreateTuningJobParameters(_common.BaseModel):
|
5454
|
-
"""Supervised fine-tuning job creation parameters - optional fields."""
|
5455
|
-
|
5456
|
-
base_model: Optional[str] = Field(
|
5457
|
-
default=None,
|
5458
|
-
description="""The base model that is being tuned, e.g., "gemini-1.0-pro-002".""",
|
5459
|
-
)
|
5460
|
-
training_dataset: Optional[TuningDataset] = Field(
|
5461
|
-
default=None,
|
5462
|
-
description="""Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""",
|
5463
|
-
)
|
5464
|
-
config: Optional[CreateTuningJobConfig] = Field(
|
5465
|
-
default=None, description="""Configuration for the tuning job."""
|
5466
|
-
)
|
5467
|
-
|
5468
|
-
|
5469
|
-
class _CreateTuningJobParametersDict(TypedDict, total=False):
|
5470
|
-
"""Supervised fine-tuning job creation parameters - optional fields."""
|
5471
|
-
|
5472
|
-
base_model: Optional[str]
|
5473
|
-
"""The base model that is being tuned, e.g., "gemini-1.0-pro-002"."""
|
5474
|
-
|
5475
|
-
training_dataset: Optional[TuningDatasetDict]
|
5476
|
-
"""Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file."""
|
5477
|
-
|
5478
|
-
config: Optional[CreateTuningJobConfigDict]
|
5479
|
-
"""Configuration for the tuning job."""
|
5480
|
-
|
5481
|
-
|
5482
|
-
_CreateTuningJobParametersOrDict = Union[
|
5483
|
-
_CreateTuningJobParameters, _CreateTuningJobParametersDict
|
5484
|
-
]
|
5485
|
-
|
5486
|
-
|
5487
|
-
class TuningJobOrOperation(_common.BaseModel):
|
5488
|
-
"""A tuning job or an long-running-operation that resolves to a tuning job."""
|
5489
|
-
|
5490
|
-
tuning_job: Optional[TuningJob] = Field(default=None, description="""""")
|
5491
|
-
|
5492
|
-
|
5493
|
-
class TuningJobOrOperationDict(TypedDict, total=False):
|
5494
|
-
"""A tuning job or an long-running-operation that resolves to a tuning job."""
|
5495
|
-
|
5496
|
-
tuning_job: Optional[TuningJobDict]
|
5497
|
-
""""""
|
5750
|
+
text_input: Optional[str]
|
5751
|
+
"""Text model input."""
|
5498
5752
|
|
5753
|
+
output: Optional[str]
|
5754
|
+
"""The expected model output."""
|
5499
5755
|
|
5500
|
-
|
5501
|
-
|
5502
|
-
]
|
5756
|
+
|
5757
|
+
TuningExampleOrDict = Union[TuningExample, TuningExampleDict]
|
5503
5758
|
|
5504
5759
|
|
5505
|
-
class
|
5506
|
-
"""
|
5760
|
+
class TuningDataset(_common.BaseModel):
|
5761
|
+
"""Supervised fine-tuning training dataset."""
|
5507
5762
|
|
5508
5763
|
gcs_uri: Optional[str] = Field(
|
5509
5764
|
default=None,
|
5510
5765
|
description="""GCS URI of the file containing training dataset in JSONL format.""",
|
5511
5766
|
)
|
5767
|
+
examples: Optional[list[TuningExample]] = Field(
|
5768
|
+
default=None,
|
5769
|
+
description="""Inline examples with simple input/output text.""",
|
5770
|
+
)
|
5512
5771
|
|
5513
5772
|
|
5514
|
-
class
|
5515
|
-
"""
|
5773
|
+
class TuningDatasetDict(TypedDict, total=False):
|
5774
|
+
"""Supervised fine-tuning training dataset."""
|
5516
5775
|
|
5517
5776
|
gcs_uri: Optional[str]
|
5518
5777
|
"""GCS URI of the file containing training dataset in JSONL format."""
|
5519
5778
|
|
5779
|
+
examples: Optional[list[TuningExampleDict]]
|
5780
|
+
"""Inline examples with simple input/output text."""
|
5781
|
+
|
5520
5782
|
|
5521
|
-
|
5783
|
+
TuningDatasetOrDict = Union[TuningDataset, TuningDatasetDict]
|
5522
5784
|
|
5523
5785
|
|
5524
|
-
class
|
5525
|
-
"""Validation dataset."""
|
5786
|
+
class TuningValidationDataset(_common.BaseModel):
|
5526
5787
|
|
5527
5788
|
gcs_uri: Optional[str] = Field(
|
5528
5789
|
default=None,
|
@@ -5530,32 +5791,34 @@ class DistillationValidationDataset(_common.BaseModel):
|
|
5530
5791
|
)
|
5531
5792
|
|
5532
5793
|
|
5533
|
-
class
|
5534
|
-
"""Validation dataset."""
|
5794
|
+
class TuningValidationDatasetDict(TypedDict, total=False):
|
5535
5795
|
|
5536
5796
|
gcs_uri: Optional[str]
|
5537
5797
|
"""GCS URI of the file containing validation dataset in JSONL format."""
|
5538
5798
|
|
5539
5799
|
|
5540
|
-
|
5541
|
-
|
5800
|
+
TuningValidationDatasetOrDict = Union[
|
5801
|
+
TuningValidationDataset, TuningValidationDatasetDict
|
5542
5802
|
]
|
5543
5803
|
|
5544
5804
|
|
5545
|
-
class
|
5546
|
-
"""
|
5805
|
+
class CreateTuningJobConfig(_common.BaseModel):
|
5806
|
+
"""Supervised fine-tuning job creation request - optional fields."""
|
5547
5807
|
|
5548
|
-
http_options: Optional[
|
5808
|
+
http_options: Optional[HttpOptions] = Field(
|
5549
5809
|
default=None, description="""Used to override HTTP request options."""
|
5550
5810
|
)
|
5551
|
-
validation_dataset: Optional[
|
5811
|
+
validation_dataset: Optional[TuningValidationDataset] = Field(
|
5552
5812
|
default=None,
|
5553
|
-
description="""Cloud Storage path to file containing
|
5813
|
+
description="""Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""",
|
5554
5814
|
)
|
5555
5815
|
tuned_model_display_name: Optional[str] = Field(
|
5556
5816
|
default=None,
|
5557
5817
|
description="""The display name of the tuned Model. The name can be up to 128 characters long and can consist of any UTF-8 characters.""",
|
5558
5818
|
)
|
5819
|
+
description: Optional[str] = Field(
|
5820
|
+
default=None, description="""The description of the TuningJob"""
|
5821
|
+
)
|
5559
5822
|
epoch_count: Optional[int] = Field(
|
5560
5823
|
default=None,
|
5561
5824
|
description="""Number of complete passes the model makes over the entire training dataset during training.""",
|
@@ -5567,24 +5830,31 @@ class CreateDistillationJobConfig(_common.BaseModel):
|
|
5567
5830
|
adapter_size: Optional[AdapterSize] = Field(
|
5568
5831
|
default=None, description="""Adapter size for tuning."""
|
5569
5832
|
)
|
5570
|
-
|
5833
|
+
batch_size: Optional[int] = Field(
|
5834
|
+
default=None,
|
5835
|
+
description="""The batch size hyperparameter for tuning. If not set, a default of 4 or 16 will be used based on the number of training examples.""",
|
5836
|
+
)
|
5837
|
+
learning_rate: Optional[float] = Field(
|
5571
5838
|
default=None,
|
5572
|
-
description="""The
|
5839
|
+
description="""The learning rate hyperparameter for tuning. If not set, a default of 0.001 or 0.0002 will be calculated based on the number of training examples.""",
|
5573
5840
|
)
|
5574
5841
|
|
5575
5842
|
|
5576
|
-
class
|
5577
|
-
"""
|
5843
|
+
class CreateTuningJobConfigDict(TypedDict, total=False):
|
5844
|
+
"""Supervised fine-tuning job creation request - optional fields."""
|
5578
5845
|
|
5579
|
-
http_options: Optional[
|
5846
|
+
http_options: Optional[HttpOptionsDict]
|
5580
5847
|
"""Used to override HTTP request options."""
|
5581
5848
|
|
5582
|
-
validation_dataset: Optional[
|
5583
|
-
"""Cloud Storage path to file containing
|
5849
|
+
validation_dataset: Optional[TuningValidationDatasetDict]
|
5850
|
+
"""Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file."""
|
5584
5851
|
|
5585
5852
|
tuned_model_display_name: Optional[str]
|
5586
5853
|
"""The display name of the tuned Model. The name can be up to 128 characters long and can consist of any UTF-8 characters."""
|
5587
5854
|
|
5855
|
+
description: Optional[str]
|
5856
|
+
"""The description of the TuningJob"""
|
5857
|
+
|
5588
5858
|
epoch_count: Optional[int]
|
5589
5859
|
"""Number of complete passes the model makes over the entire training dataset during training."""
|
5590
5860
|
|
@@ -5594,60 +5864,74 @@ class CreateDistillationJobConfigDict(TypedDict, total=False):
|
|
5594
5864
|
adapter_size: Optional[AdapterSize]
|
5595
5865
|
"""Adapter size for tuning."""
|
5596
5866
|
|
5597
|
-
|
5598
|
-
"""The
|
5867
|
+
batch_size: Optional[int]
|
5868
|
+
"""The batch size hyperparameter for tuning. If not set, a default of 4 or 16 will be used based on the number of training examples."""
|
5869
|
+
|
5870
|
+
learning_rate: Optional[float]
|
5871
|
+
"""The learning rate hyperparameter for tuning. If not set, a default of 0.001 or 0.0002 will be calculated based on the number of training examples."""
|
5599
5872
|
|
5600
5873
|
|
5601
|
-
|
5602
|
-
|
5874
|
+
CreateTuningJobConfigOrDict = Union[
|
5875
|
+
CreateTuningJobConfig, CreateTuningJobConfigDict
|
5603
5876
|
]
|
5604
5877
|
|
5605
5878
|
|
5606
|
-
class
|
5607
|
-
"""
|
5879
|
+
class _CreateTuningJobParameters(_common.BaseModel):
|
5880
|
+
"""Supervised fine-tuning job creation parameters - optional fields."""
|
5608
5881
|
|
5609
|
-
|
5610
|
-
default=None,
|
5611
|
-
description="""The student model that is being tuned, e.g. ``google/gemma-2b-1.1-it``.""",
|
5612
|
-
)
|
5613
|
-
teacher_model: Optional[str] = Field(
|
5882
|
+
base_model: Optional[str] = Field(
|
5614
5883
|
default=None,
|
5615
|
-
description="""The
|
5884
|
+
description="""The base model that is being tuned, e.g., "gemini-1.0-pro-002".""",
|
5616
5885
|
)
|
5617
|
-
training_dataset: Optional[
|
5886
|
+
training_dataset: Optional[TuningDataset] = Field(
|
5618
5887
|
default=None,
|
5619
5888
|
description="""Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""",
|
5620
5889
|
)
|
5621
|
-
config: Optional[
|
5622
|
-
default=None, description="""Configuration for the
|
5890
|
+
config: Optional[CreateTuningJobConfig] = Field(
|
5891
|
+
default=None, description="""Configuration for the tuning job."""
|
5623
5892
|
)
|
5624
5893
|
|
5625
5894
|
|
5626
|
-
class
|
5627
|
-
"""
|
5628
|
-
|
5629
|
-
student_model: Optional[str]
|
5630
|
-
"""The student model that is being tuned, e.g. ``google/gemma-2b-1.1-it``."""
|
5895
|
+
class _CreateTuningJobParametersDict(TypedDict, total=False):
|
5896
|
+
"""Supervised fine-tuning job creation parameters - optional fields."""
|
5631
5897
|
|
5632
|
-
|
5633
|
-
"""The
|
5898
|
+
base_model: Optional[str]
|
5899
|
+
"""The base model that is being tuned, e.g., "gemini-1.0-pro-002"."""
|
5634
5900
|
|
5635
|
-
training_dataset: Optional[
|
5901
|
+
training_dataset: Optional[TuningDatasetDict]
|
5636
5902
|
"""Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file."""
|
5637
5903
|
|
5638
|
-
config: Optional[
|
5639
|
-
"""Configuration for the
|
5904
|
+
config: Optional[CreateTuningJobConfigDict]
|
5905
|
+
"""Configuration for the tuning job."""
|
5906
|
+
|
5907
|
+
|
5908
|
+
_CreateTuningJobParametersOrDict = Union[
|
5909
|
+
_CreateTuningJobParameters, _CreateTuningJobParametersDict
|
5910
|
+
]
|
5911
|
+
|
5912
|
+
|
5913
|
+
class TuningJobOrOperation(_common.BaseModel):
|
5914
|
+
"""A tuning job or an long-running-operation that resolves to a tuning job."""
|
5915
|
+
|
5916
|
+
tuning_job: Optional[TuningJob] = Field(default=None, description="""""")
|
5917
|
+
|
5918
|
+
|
5919
|
+
class TuningJobOrOperationDict(TypedDict, total=False):
|
5920
|
+
"""A tuning job or an long-running-operation that resolves to a tuning job."""
|
5640
5921
|
|
5922
|
+
tuning_job: Optional[TuningJobDict]
|
5923
|
+
""""""
|
5641
5924
|
|
5642
|
-
|
5643
|
-
|
5925
|
+
|
5926
|
+
TuningJobOrOperationOrDict = Union[
|
5927
|
+
TuningJobOrOperation, TuningJobOrOperationDict
|
5644
5928
|
]
|
5645
5929
|
|
5646
5930
|
|
5647
5931
|
class CreateCachedContentConfig(_common.BaseModel):
|
5648
|
-
"""
|
5932
|
+
"""Optional configuration for cached content creation."""
|
5649
5933
|
|
5650
|
-
http_options: Optional[
|
5934
|
+
http_options: Optional[HttpOptions] = Field(
|
5651
5935
|
default=None, description="""Used to override HTTP request options."""
|
5652
5936
|
)
|
5653
5937
|
ttl: Optional[str] = Field(
|
@@ -5686,9 +5970,9 @@ class CreateCachedContentConfig(_common.BaseModel):
|
|
5686
5970
|
|
5687
5971
|
|
5688
5972
|
class CreateCachedContentConfigDict(TypedDict, total=False):
|
5689
|
-
"""
|
5973
|
+
"""Optional configuration for cached content creation."""
|
5690
5974
|
|
5691
|
-
http_options: Optional[
|
5975
|
+
http_options: Optional[HttpOptionsDict]
|
5692
5976
|
"""Used to override HTTP request options."""
|
5693
5977
|
|
5694
5978
|
ttl: Optional[str]
|
@@ -5814,7 +6098,7 @@ class CachedContent(_common.BaseModel):
|
|
5814
6098
|
description="""The name of the publisher model to use for cached content.""",
|
5815
6099
|
)
|
5816
6100
|
create_time: Optional[datetime.datetime] = Field(
|
5817
|
-
default=None, description="""
|
6101
|
+
default=None, description="""Creation time of the cache entry."""
|
5818
6102
|
)
|
5819
6103
|
update_time: Optional[datetime.datetime] = Field(
|
5820
6104
|
default=None,
|
@@ -5842,7 +6126,7 @@ class CachedContentDict(TypedDict, total=False):
|
|
5842
6126
|
"""The name of the publisher model to use for cached content."""
|
5843
6127
|
|
5844
6128
|
create_time: Optional[datetime.datetime]
|
5845
|
-
"""
|
6129
|
+
"""Creation time of the cache entry."""
|
5846
6130
|
|
5847
6131
|
update_time: Optional[datetime.datetime]
|
5848
6132
|
"""When the cache entry was last updated in UTC time."""
|
@@ -5860,7 +6144,7 @@ CachedContentOrDict = Union[CachedContent, CachedContentDict]
|
|
5860
6144
|
class GetCachedContentConfig(_common.BaseModel):
|
5861
6145
|
"""Optional parameters for caches.get method."""
|
5862
6146
|
|
5863
|
-
http_options: Optional[
|
6147
|
+
http_options: Optional[HttpOptions] = Field(
|
5864
6148
|
default=None, description="""Used to override HTTP request options."""
|
5865
6149
|
)
|
5866
6150
|
|
@@ -5868,7 +6152,7 @@ class GetCachedContentConfig(_common.BaseModel):
|
|
5868
6152
|
class GetCachedContentConfigDict(TypedDict, total=False):
|
5869
6153
|
"""Optional parameters for caches.get method."""
|
5870
6154
|
|
5871
|
-
http_options: Optional[
|
6155
|
+
http_options: Optional[HttpOptionsDict]
|
5872
6156
|
"""Used to override HTTP request options."""
|
5873
6157
|
|
5874
6158
|
|
@@ -5912,7 +6196,7 @@ _GetCachedContentParametersOrDict = Union[
|
|
5912
6196
|
class DeleteCachedContentConfig(_common.BaseModel):
|
5913
6197
|
"""Optional parameters for caches.delete method."""
|
5914
6198
|
|
5915
|
-
http_options: Optional[
|
6199
|
+
http_options: Optional[HttpOptions] = Field(
|
5916
6200
|
default=None, description="""Used to override HTTP request options."""
|
5917
6201
|
)
|
5918
6202
|
|
@@ -5920,7 +6204,7 @@ class DeleteCachedContentConfig(_common.BaseModel):
|
|
5920
6204
|
class DeleteCachedContentConfigDict(TypedDict, total=False):
|
5921
6205
|
"""Optional parameters for caches.delete method."""
|
5922
6206
|
|
5923
|
-
http_options: Optional[
|
6207
|
+
http_options: Optional[HttpOptionsDict]
|
5924
6208
|
"""Used to override HTTP request options."""
|
5925
6209
|
|
5926
6210
|
|
@@ -5981,7 +6265,7 @@ DeleteCachedContentResponseOrDict = Union[
|
|
5981
6265
|
class UpdateCachedContentConfig(_common.BaseModel):
|
5982
6266
|
"""Optional parameters for caches.update method."""
|
5983
6267
|
|
5984
|
-
http_options: Optional[
|
6268
|
+
http_options: Optional[HttpOptions] = Field(
|
5985
6269
|
default=None, description="""Used to override HTTP request options."""
|
5986
6270
|
)
|
5987
6271
|
ttl: Optional[str] = Field(
|
@@ -5997,7 +6281,7 @@ class UpdateCachedContentConfig(_common.BaseModel):
|
|
5997
6281
|
class UpdateCachedContentConfigDict(TypedDict, total=False):
|
5998
6282
|
"""Optional parameters for caches.update method."""
|
5999
6283
|
|
6000
|
-
http_options: Optional[
|
6284
|
+
http_options: Optional[HttpOptionsDict]
|
6001
6285
|
"""Used to override HTTP request options."""
|
6002
6286
|
|
6003
6287
|
ttl: Optional[str]
|
@@ -6045,6 +6329,9 @@ _UpdateCachedContentParametersOrDict = Union[
|
|
6045
6329
|
class ListCachedContentsConfig(_common.BaseModel):
|
6046
6330
|
"""Config for caches.list method."""
|
6047
6331
|
|
6332
|
+
http_options: Optional[HttpOptions] = Field(
|
6333
|
+
default=None, description="""Used to override HTTP request options."""
|
6334
|
+
)
|
6048
6335
|
page_size: Optional[int] = Field(default=None, description="""""")
|
6049
6336
|
page_token: Optional[str] = Field(default=None, description="""""")
|
6050
6337
|
|
@@ -6052,6 +6339,9 @@ class ListCachedContentsConfig(_common.BaseModel):
|
|
6052
6339
|
class ListCachedContentsConfigDict(TypedDict, total=False):
|
6053
6340
|
"""Config for caches.list method."""
|
6054
6341
|
|
6342
|
+
http_options: Optional[HttpOptionsDict]
|
6343
|
+
"""Used to override HTTP request options."""
|
6344
|
+
|
6055
6345
|
page_size: Optional[int]
|
6056
6346
|
""""""
|
6057
6347
|
|
@@ -6115,7 +6405,7 @@ ListCachedContentsResponseOrDict = Union[
|
|
6115
6405
|
class ListFilesConfig(_common.BaseModel):
|
6116
6406
|
"""Used to override the default configuration."""
|
6117
6407
|
|
6118
|
-
http_options: Optional[
|
6408
|
+
http_options: Optional[HttpOptions] = Field(
|
6119
6409
|
default=None, description="""Used to override HTTP request options."""
|
6120
6410
|
)
|
6121
6411
|
page_size: Optional[int] = Field(default=None, description="""""")
|
@@ -6125,7 +6415,7 @@ class ListFilesConfig(_common.BaseModel):
|
|
6125
6415
|
class ListFilesConfigDict(TypedDict, total=False):
|
6126
6416
|
"""Used to override the default configuration."""
|
6127
6417
|
|
6128
|
-
http_options: Optional[
|
6418
|
+
http_options: Optional[HttpOptionsDict]
|
6129
6419
|
"""Used to override HTTP request options."""
|
6130
6420
|
|
6131
6421
|
page_size: Optional[int]
|
@@ -6159,129 +6449,6 @@ _ListFilesParametersOrDict = Union[
|
|
6159
6449
|
]
|
6160
6450
|
|
6161
6451
|
|
6162
|
-
class FileStatus(_common.BaseModel):
|
6163
|
-
"""Status of a File that uses a common error model."""
|
6164
|
-
|
6165
|
-
details: Optional[list[dict[str, Any]]] = Field(
|
6166
|
-
default=None,
|
6167
|
-
description="""A list of messages that carry the error details. There is a common set of message types for APIs to use.""",
|
6168
|
-
)
|
6169
|
-
message: Optional[str] = Field(
|
6170
|
-
default=None,
|
6171
|
-
description="""A list of messages that carry the error details. There is a common set of message types for APIs to use.""",
|
6172
|
-
)
|
6173
|
-
code: Optional[int] = Field(
|
6174
|
-
default=None, description="""The status code. 0 for OK, 1 for CANCELLED"""
|
6175
|
-
)
|
6176
|
-
|
6177
|
-
|
6178
|
-
class FileStatusDict(TypedDict, total=False):
|
6179
|
-
"""Status of a File that uses a common error model."""
|
6180
|
-
|
6181
|
-
details: Optional[list[dict[str, Any]]]
|
6182
|
-
"""A list of messages that carry the error details. There is a common set of message types for APIs to use."""
|
6183
|
-
|
6184
|
-
message: Optional[str]
|
6185
|
-
"""A list of messages that carry the error details. There is a common set of message types for APIs to use."""
|
6186
|
-
|
6187
|
-
code: Optional[int]
|
6188
|
-
"""The status code. 0 for OK, 1 for CANCELLED"""
|
6189
|
-
|
6190
|
-
|
6191
|
-
FileStatusOrDict = Union[FileStatus, FileStatusDict]
|
6192
|
-
|
6193
|
-
|
6194
|
-
class File(_common.BaseModel):
|
6195
|
-
"""A file uploaded to the API."""
|
6196
|
-
|
6197
|
-
name: Optional[str] = Field(
|
6198
|
-
default=None,
|
6199
|
-
description="""The `File` resource name. The ID (name excluding the "files/" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456`""",
|
6200
|
-
)
|
6201
|
-
display_name: Optional[str] = Field(
|
6202
|
-
default=None,
|
6203
|
-
description="""Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'""",
|
6204
|
-
)
|
6205
|
-
mime_type: Optional[str] = Field(
|
6206
|
-
default=None, description="""Output only. MIME type of the file."""
|
6207
|
-
)
|
6208
|
-
size_bytes: Optional[int] = Field(
|
6209
|
-
default=None, description="""Output only. Size of the file in bytes."""
|
6210
|
-
)
|
6211
|
-
create_time: Optional[datetime.datetime] = Field(
|
6212
|
-
default=None,
|
6213
|
-
description="""Output only. The timestamp of when the `File` was created.""",
|
6214
|
-
)
|
6215
|
-
expiration_time: Optional[datetime.datetime] = Field(
|
6216
|
-
default=None,
|
6217
|
-
description="""Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'""",
|
6218
|
-
)
|
6219
|
-
update_time: Optional[datetime.datetime] = Field(
|
6220
|
-
default=None,
|
6221
|
-
description="""Output only. The timestamp of when the `File` was last updated.""",
|
6222
|
-
)
|
6223
|
-
sha256_hash: Optional[bytes] = Field(
|
6224
|
-
default=None,
|
6225
|
-
description="""Output only. SHA-256 hash of the uploaded bytes.""",
|
6226
|
-
)
|
6227
|
-
uri: Optional[str] = Field(
|
6228
|
-
default=None, description="""Output only. The URI of the `File`."""
|
6229
|
-
)
|
6230
|
-
state: Optional[FileState] = Field(
|
6231
|
-
default=None, description="""Output only. Processing state of the File."""
|
6232
|
-
)
|
6233
|
-
video_metadata: Optional[dict[str, Any]] = Field(
|
6234
|
-
default=None, description="""Output only. Metadata for a video."""
|
6235
|
-
)
|
6236
|
-
error: Optional[FileStatus] = Field(
|
6237
|
-
default=None,
|
6238
|
-
description="""Output only. Error status if File processing failed.""",
|
6239
|
-
)
|
6240
|
-
|
6241
|
-
|
6242
|
-
class FileDict(TypedDict, total=False):
|
6243
|
-
"""A file uploaded to the API."""
|
6244
|
-
|
6245
|
-
name: Optional[str]
|
6246
|
-
"""The `File` resource name. The ID (name excluding the "files/" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: `files/123-456`"""
|
6247
|
-
|
6248
|
-
display_name: Optional[str]
|
6249
|
-
"""Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'"""
|
6250
|
-
|
6251
|
-
mime_type: Optional[str]
|
6252
|
-
"""Output only. MIME type of the file."""
|
6253
|
-
|
6254
|
-
size_bytes: Optional[int]
|
6255
|
-
"""Output only. Size of the file in bytes."""
|
6256
|
-
|
6257
|
-
create_time: Optional[datetime.datetime]
|
6258
|
-
"""Output only. The timestamp of when the `File` was created."""
|
6259
|
-
|
6260
|
-
expiration_time: Optional[datetime.datetime]
|
6261
|
-
"""Optional. The human-readable display name for the `File`. The display name must be no more than 512 characters in length, including spaces. Example: 'Welcome Image'"""
|
6262
|
-
|
6263
|
-
update_time: Optional[datetime.datetime]
|
6264
|
-
"""Output only. The timestamp of when the `File` was last updated."""
|
6265
|
-
|
6266
|
-
sha256_hash: Optional[bytes]
|
6267
|
-
"""Output only. SHA-256 hash of the uploaded bytes."""
|
6268
|
-
|
6269
|
-
uri: Optional[str]
|
6270
|
-
"""Output only. The URI of the `File`."""
|
6271
|
-
|
6272
|
-
state: Optional[FileState]
|
6273
|
-
"""Output only. Processing state of the File."""
|
6274
|
-
|
6275
|
-
video_metadata: Optional[dict[str, Any]]
|
6276
|
-
"""Output only. Metadata for a video."""
|
6277
|
-
|
6278
|
-
error: Optional[FileStatusDict]
|
6279
|
-
"""Output only. Error status if File processing failed."""
|
6280
|
-
|
6281
|
-
|
6282
|
-
FileOrDict = Union[File, FileDict]
|
6283
|
-
|
6284
|
-
|
6285
6452
|
class ListFilesResponse(_common.BaseModel):
|
6286
6453
|
"""Response for the list files method."""
|
6287
6454
|
|
@@ -6309,7 +6476,7 @@ ListFilesResponseOrDict = Union[ListFilesResponse, ListFilesResponseDict]
|
|
6309
6476
|
class CreateFileConfig(_common.BaseModel):
|
6310
6477
|
"""Used to override the default configuration."""
|
6311
6478
|
|
6312
|
-
http_options: Optional[
|
6479
|
+
http_options: Optional[HttpOptions] = Field(
|
6313
6480
|
default=None, description="""Used to override HTTP request options."""
|
6314
6481
|
)
|
6315
6482
|
|
@@ -6317,7 +6484,7 @@ class CreateFileConfig(_common.BaseModel):
|
|
6317
6484
|
class CreateFileConfigDict(TypedDict, total=False):
|
6318
6485
|
"""Used to override the default configuration."""
|
6319
6486
|
|
6320
|
-
http_options: Optional[
|
6487
|
+
http_options: Optional[HttpOptionsDict]
|
6321
6488
|
"""Used to override HTTP request options."""
|
6322
6489
|
|
6323
6490
|
|
@@ -6380,7 +6547,7 @@ CreateFileResponseOrDict = Union[CreateFileResponse, CreateFileResponseDict]
|
|
6380
6547
|
class GetFileConfig(_common.BaseModel):
|
6381
6548
|
"""Used to override the default configuration."""
|
6382
6549
|
|
6383
|
-
http_options: Optional[
|
6550
|
+
http_options: Optional[HttpOptions] = Field(
|
6384
6551
|
default=None, description="""Used to override HTTP request options."""
|
6385
6552
|
)
|
6386
6553
|
|
@@ -6388,7 +6555,7 @@ class GetFileConfig(_common.BaseModel):
|
|
6388
6555
|
class GetFileConfigDict(TypedDict, total=False):
|
6389
6556
|
"""Used to override the default configuration."""
|
6390
6557
|
|
6391
|
-
http_options: Optional[
|
6558
|
+
http_options: Optional[HttpOptionsDict]
|
6392
6559
|
"""Used to override HTTP request options."""
|
6393
6560
|
|
6394
6561
|
|
@@ -6424,7 +6591,7 @@ _GetFileParametersOrDict = Union[_GetFileParameters, _GetFileParametersDict]
|
|
6424
6591
|
class DeleteFileConfig(_common.BaseModel):
|
6425
6592
|
"""Used to override the default configuration."""
|
6426
6593
|
|
6427
|
-
http_options: Optional[
|
6594
|
+
http_options: Optional[HttpOptions] = Field(
|
6428
6595
|
default=None, description="""Used to override HTTP request options."""
|
6429
6596
|
)
|
6430
6597
|
|
@@ -6432,7 +6599,7 @@ class DeleteFileConfig(_common.BaseModel):
|
|
6432
6599
|
class DeleteFileConfigDict(TypedDict, total=False):
|
6433
6600
|
"""Used to override the default configuration."""
|
6434
6601
|
|
6435
|
-
http_options: Optional[
|
6602
|
+
http_options: Optional[HttpOptionsDict]
|
6436
6603
|
"""Used to override HTTP request options."""
|
6437
6604
|
|
6438
6605
|
|
@@ -6483,7 +6650,7 @@ DeleteFileResponseOrDict = Union[DeleteFileResponse, DeleteFileResponseDict]
|
|
6483
6650
|
|
6484
6651
|
|
6485
6652
|
class BatchJobSource(_common.BaseModel):
|
6486
|
-
"""Config
|
6653
|
+
"""Config for `src` parameter."""
|
6487
6654
|
|
6488
6655
|
format: Optional[str] = Field(
|
6489
6656
|
default=None,
|
@@ -6504,7 +6671,7 @@ class BatchJobSource(_common.BaseModel):
|
|
6504
6671
|
|
6505
6672
|
|
6506
6673
|
class BatchJobSourceDict(TypedDict, total=False):
|
6507
|
-
"""Config
|
6674
|
+
"""Config for `src` parameter."""
|
6508
6675
|
|
6509
6676
|
format: Optional[str]
|
6510
6677
|
"""Storage format of the input files. Must be one of:
|
@@ -6524,7 +6691,7 @@ BatchJobSourceOrDict = Union[BatchJobSource, BatchJobSourceDict]
|
|
6524
6691
|
|
6525
6692
|
|
6526
6693
|
class BatchJobDestination(_common.BaseModel):
|
6527
|
-
"""Config
|
6694
|
+
"""Config for `des` parameter."""
|
6528
6695
|
|
6529
6696
|
format: Optional[str] = Field(
|
6530
6697
|
default=None,
|
@@ -6545,7 +6712,7 @@ class BatchJobDestination(_common.BaseModel):
|
|
6545
6712
|
|
6546
6713
|
|
6547
6714
|
class BatchJobDestinationDict(TypedDict, total=False):
|
6548
|
-
"""Config
|
6715
|
+
"""Config for `des` parameter."""
|
6549
6716
|
|
6550
6717
|
format: Optional[str]
|
6551
6718
|
"""Storage format of the output files. Must be one of:
|
@@ -6565,9 +6732,9 @@ BatchJobDestinationOrDict = Union[BatchJobDestination, BatchJobDestinationDict]
|
|
6565
6732
|
|
6566
6733
|
|
6567
6734
|
class CreateBatchJobConfig(_common.BaseModel):
|
6568
|
-
"""Config
|
6735
|
+
"""Config for optional parameters."""
|
6569
6736
|
|
6570
|
-
http_options: Optional[
|
6737
|
+
http_options: Optional[HttpOptions] = Field(
|
6571
6738
|
default=None, description="""Used to override HTTP request options."""
|
6572
6739
|
)
|
6573
6740
|
display_name: Optional[str] = Field(
|
@@ -6584,9 +6751,9 @@ class CreateBatchJobConfig(_common.BaseModel):
|
|
6584
6751
|
|
6585
6752
|
|
6586
6753
|
class CreateBatchJobConfigDict(TypedDict, total=False):
|
6587
|
-
"""Config
|
6754
|
+
"""Config for optional parameters."""
|
6588
6755
|
|
6589
|
-
http_options: Optional[
|
6756
|
+
http_options: Optional[HttpOptionsDict]
|
6590
6757
|
"""Used to override HTTP request options."""
|
6591
6758
|
|
6592
6759
|
display_name: Optional[str]
|
@@ -6605,7 +6772,7 @@ CreateBatchJobConfigOrDict = Union[
|
|
6605
6772
|
|
6606
6773
|
|
6607
6774
|
class _CreateBatchJobParameters(_common.BaseModel):
|
6608
|
-
"""Config
|
6775
|
+
"""Config for batches.create parameters."""
|
6609
6776
|
|
6610
6777
|
model: Optional[str] = Field(
|
6611
6778
|
default=None,
|
@@ -6626,7 +6793,7 @@ class _CreateBatchJobParameters(_common.BaseModel):
|
|
6626
6793
|
|
6627
6794
|
|
6628
6795
|
class _CreateBatchJobParametersDict(TypedDict, total=False):
|
6629
|
-
"""Config
|
6796
|
+
"""Config for batches.create parameters."""
|
6630
6797
|
|
6631
6798
|
model: Optional[str]
|
6632
6799
|
"""The name of the model to produces the predictions via the BatchJob.
|
@@ -6648,7 +6815,7 @@ _CreateBatchJobParametersOrDict = Union[
|
|
6648
6815
|
|
6649
6816
|
|
6650
6817
|
class JobError(_common.BaseModel):
|
6651
|
-
"""
|
6818
|
+
"""Job error."""
|
6652
6819
|
|
6653
6820
|
details: Optional[list[str]] = Field(
|
6654
6821
|
default=None,
|
@@ -6662,7 +6829,7 @@ class JobError(_common.BaseModel):
|
|
6662
6829
|
|
6663
6830
|
|
6664
6831
|
class JobErrorDict(TypedDict, total=False):
|
6665
|
-
"""
|
6832
|
+
"""Job error."""
|
6666
6833
|
|
6667
6834
|
details: Optional[list[str]]
|
6668
6835
|
"""A list of messages that carry the error details. There is a common set of message types for APIs to use."""
|
@@ -6678,7 +6845,7 @@ JobErrorOrDict = Union[JobError, JobErrorDict]
|
|
6678
6845
|
|
6679
6846
|
|
6680
6847
|
class BatchJob(_common.BaseModel):
|
6681
|
-
"""Config
|
6848
|
+
"""Config for batches.create return value."""
|
6682
6849
|
|
6683
6850
|
name: Optional[str] = Field(
|
6684
6851
|
default=None, description="""Output only. Resource name of the Job."""
|
@@ -6728,7 +6895,7 @@ class BatchJob(_common.BaseModel):
|
|
6728
6895
|
|
6729
6896
|
|
6730
6897
|
class BatchJobDict(TypedDict, total=False):
|
6731
|
-
"""Config
|
6898
|
+
"""Config for batches.create return value."""
|
6732
6899
|
|
6733
6900
|
name: Optional[str]
|
6734
6901
|
"""Output only. Resource name of the Job."""
|
@@ -6773,7 +6940,7 @@ BatchJobOrDict = Union[BatchJob, BatchJobDict]
|
|
6773
6940
|
class GetBatchJobConfig(_common.BaseModel):
|
6774
6941
|
"""Optional parameters."""
|
6775
6942
|
|
6776
|
-
http_options: Optional[
|
6943
|
+
http_options: Optional[HttpOptions] = Field(
|
6777
6944
|
default=None, description="""Used to override HTTP request options."""
|
6778
6945
|
)
|
6779
6946
|
|
@@ -6781,7 +6948,7 @@ class GetBatchJobConfig(_common.BaseModel):
|
|
6781
6948
|
class GetBatchJobConfigDict(TypedDict, total=False):
|
6782
6949
|
"""Optional parameters."""
|
6783
6950
|
|
6784
|
-
http_options: Optional[
|
6951
|
+
http_options: Optional[HttpOptionsDict]
|
6785
6952
|
"""Used to override HTTP request options."""
|
6786
6953
|
|
6787
6954
|
|
@@ -6789,7 +6956,7 @@ GetBatchJobConfigOrDict = Union[GetBatchJobConfig, GetBatchJobConfigDict]
|
|
6789
6956
|
|
6790
6957
|
|
6791
6958
|
class _GetBatchJobParameters(_common.BaseModel):
|
6792
|
-
"""Config
|
6959
|
+
"""Config for batches.get parameters."""
|
6793
6960
|
|
6794
6961
|
name: Optional[str] = Field(
|
6795
6962
|
default=None,
|
@@ -6804,7 +6971,7 @@ class _GetBatchJobParameters(_common.BaseModel):
|
|
6804
6971
|
|
6805
6972
|
|
6806
6973
|
class _GetBatchJobParametersDict(TypedDict, total=False):
|
6807
|
-
"""Config
|
6974
|
+
"""Config for batches.get parameters."""
|
6808
6975
|
|
6809
6976
|
name: Optional[str]
|
6810
6977
|
"""A fully-qualified BatchJob resource name or ID.
|
@@ -6824,7 +6991,7 @@ _GetBatchJobParametersOrDict = Union[
|
|
6824
6991
|
class CancelBatchJobConfig(_common.BaseModel):
|
6825
6992
|
"""Optional parameters."""
|
6826
6993
|
|
6827
|
-
http_options: Optional[
|
6994
|
+
http_options: Optional[HttpOptions] = Field(
|
6828
6995
|
default=None, description="""Used to override HTTP request options."""
|
6829
6996
|
)
|
6830
6997
|
|
@@ -6832,7 +6999,7 @@ class CancelBatchJobConfig(_common.BaseModel):
|
|
6832
6999
|
class CancelBatchJobConfigDict(TypedDict, total=False):
|
6833
7000
|
"""Optional parameters."""
|
6834
7001
|
|
6835
|
-
http_options: Optional[
|
7002
|
+
http_options: Optional[HttpOptionsDict]
|
6836
7003
|
"""Used to override HTTP request options."""
|
6837
7004
|
|
6838
7005
|
|
@@ -6842,7 +7009,7 @@ CancelBatchJobConfigOrDict = Union[
|
|
6842
7009
|
|
6843
7010
|
|
6844
7011
|
class _CancelBatchJobParameters(_common.BaseModel):
|
6845
|
-
"""Config
|
7012
|
+
"""Config for batches.cancel parameters."""
|
6846
7013
|
|
6847
7014
|
name: Optional[str] = Field(
|
6848
7015
|
default=None,
|
@@ -6857,7 +7024,7 @@ class _CancelBatchJobParameters(_common.BaseModel):
|
|
6857
7024
|
|
6858
7025
|
|
6859
7026
|
class _CancelBatchJobParametersDict(TypedDict, total=False):
|
6860
|
-
"""Config
|
7027
|
+
"""Config for batches.cancel parameters."""
|
6861
7028
|
|
6862
7029
|
name: Optional[str]
|
6863
7030
|
"""A fully-qualified BatchJob resource name or ID.
|
@@ -6874,10 +7041,10 @@ _CancelBatchJobParametersOrDict = Union[
|
|
6874
7041
|
]
|
6875
7042
|
|
6876
7043
|
|
6877
|
-
class
|
6878
|
-
"""Config
|
7044
|
+
class ListBatchJobsConfig(_common.BaseModel):
|
7045
|
+
"""Config for optional parameters."""
|
6879
7046
|
|
6880
|
-
http_options: Optional[
|
7047
|
+
http_options: Optional[HttpOptions] = Field(
|
6881
7048
|
default=None, description="""Used to override HTTP request options."""
|
6882
7049
|
)
|
6883
7050
|
page_size: Optional[int] = Field(default=None, description="""""")
|
@@ -6885,10 +7052,10 @@ class ListBatchJobConfig(_common.BaseModel):
|
|
6885
7052
|
filter: Optional[str] = Field(default=None, description="""""")
|
6886
7053
|
|
6887
7054
|
|
6888
|
-
class
|
6889
|
-
"""Config
|
7055
|
+
class ListBatchJobsConfigDict(TypedDict, total=False):
|
7056
|
+
"""Config for optional parameters."""
|
6890
7057
|
|
6891
|
-
http_options: Optional[
|
7058
|
+
http_options: Optional[HttpOptionsDict]
|
6892
7059
|
"""Used to override HTTP request options."""
|
6893
7060
|
|
6894
7061
|
page_size: Optional[int]
|
@@ -6901,36 +7068,38 @@ class ListBatchJobConfigDict(TypedDict, total=False):
|
|
6901
7068
|
""""""
|
6902
7069
|
|
6903
7070
|
|
6904
|
-
|
7071
|
+
ListBatchJobsConfigOrDict = Union[ListBatchJobsConfig, ListBatchJobsConfigDict]
|
6905
7072
|
|
6906
7073
|
|
6907
|
-
class
|
6908
|
-
"""Config
|
7074
|
+
class _ListBatchJobsParameters(_common.BaseModel):
|
7075
|
+
"""Config for batches.list parameters."""
|
6909
7076
|
|
6910
|
-
config: Optional[
|
7077
|
+
config: Optional[ListBatchJobsConfig] = Field(
|
7078
|
+
default=None, description=""""""
|
7079
|
+
)
|
6911
7080
|
|
6912
7081
|
|
6913
|
-
class
|
6914
|
-
"""Config
|
7082
|
+
class _ListBatchJobsParametersDict(TypedDict, total=False):
|
7083
|
+
"""Config for batches.list parameters."""
|
6915
7084
|
|
6916
|
-
config: Optional[
|
7085
|
+
config: Optional[ListBatchJobsConfigDict]
|
6917
7086
|
""""""
|
6918
7087
|
|
6919
7088
|
|
6920
|
-
|
6921
|
-
|
7089
|
+
_ListBatchJobsParametersOrDict = Union[
|
7090
|
+
_ListBatchJobsParameters, _ListBatchJobsParametersDict
|
6922
7091
|
]
|
6923
7092
|
|
6924
7093
|
|
6925
|
-
class
|
6926
|
-
"""Config
|
7094
|
+
class ListBatchJobsResponse(_common.BaseModel):
|
7095
|
+
"""Config for batches.list return value."""
|
6927
7096
|
|
6928
7097
|
next_page_token: Optional[str] = Field(default=None, description="""""")
|
6929
7098
|
batch_jobs: Optional[list[BatchJob]] = Field(default=None, description="""""")
|
6930
7099
|
|
6931
7100
|
|
6932
|
-
class
|
6933
|
-
"""Config
|
7101
|
+
class ListBatchJobsResponseDict(TypedDict, total=False):
|
7102
|
+
"""Config for batches.list return value."""
|
6934
7103
|
|
6935
7104
|
next_page_token: Optional[str]
|
6936
7105
|
""""""
|
@@ -6939,13 +7108,33 @@ class ListBatchJobResponseDict(TypedDict, total=False):
|
|
6939
7108
|
""""""
|
6940
7109
|
|
6941
7110
|
|
6942
|
-
|
6943
|
-
|
7111
|
+
ListBatchJobsResponseOrDict = Union[
|
7112
|
+
ListBatchJobsResponse, ListBatchJobsResponseDict
|
7113
|
+
]
|
7114
|
+
|
7115
|
+
|
7116
|
+
class DeleteBatchJobConfig(_common.BaseModel):
|
7117
|
+
"""Optional parameters for models.get method."""
|
7118
|
+
|
7119
|
+
http_options: Optional[HttpOptions] = Field(
|
7120
|
+
default=None, description="""Used to override HTTP request options."""
|
7121
|
+
)
|
7122
|
+
|
7123
|
+
|
7124
|
+
class DeleteBatchJobConfigDict(TypedDict, total=False):
|
7125
|
+
"""Optional parameters for models.get method."""
|
7126
|
+
|
7127
|
+
http_options: Optional[HttpOptionsDict]
|
7128
|
+
"""Used to override HTTP request options."""
|
7129
|
+
|
7130
|
+
|
7131
|
+
DeleteBatchJobConfigOrDict = Union[
|
7132
|
+
DeleteBatchJobConfig, DeleteBatchJobConfigDict
|
6944
7133
|
]
|
6945
7134
|
|
6946
7135
|
|
6947
7136
|
class _DeleteBatchJobParameters(_common.BaseModel):
|
6948
|
-
"""Config
|
7137
|
+
"""Config for batches.delete parameters."""
|
6949
7138
|
|
6950
7139
|
name: Optional[str] = Field(
|
6951
7140
|
default=None,
|
@@ -6954,10 +7143,13 @@ class _DeleteBatchJobParameters(_common.BaseModel):
|
|
6954
7143
|
or "456" when project and location are initialized in the client.
|
6955
7144
|
""",
|
6956
7145
|
)
|
7146
|
+
config: Optional[DeleteBatchJobConfig] = Field(
|
7147
|
+
default=None, description="""Optional parameters for the request."""
|
7148
|
+
)
|
6957
7149
|
|
6958
7150
|
|
6959
7151
|
class _DeleteBatchJobParametersDict(TypedDict, total=False):
|
6960
|
-
"""Config
|
7152
|
+
"""Config for batches.delete parameters."""
|
6961
7153
|
|
6962
7154
|
name: Optional[str]
|
6963
7155
|
"""A fully-qualified BatchJob resource name or ID.
|
@@ -6965,6 +7157,9 @@ class _DeleteBatchJobParametersDict(TypedDict, total=False):
|
|
6965
7157
|
or "456" when project and location are initialized in the client.
|
6966
7158
|
"""
|
6967
7159
|
|
7160
|
+
config: Optional[DeleteBatchJobConfigDict]
|
7161
|
+
"""Optional parameters for the request."""
|
7162
|
+
|
6968
7163
|
|
6969
7164
|
_DeleteBatchJobParametersOrDict = Union[
|
6970
7165
|
_DeleteBatchJobParameters, _DeleteBatchJobParametersDict
|
@@ -6972,7 +7167,7 @@ _DeleteBatchJobParametersOrDict = Union[
|
|
6972
7167
|
|
6973
7168
|
|
6974
7169
|
class DeleteResourceJob(_common.BaseModel):
|
6975
|
-
"""
|
7170
|
+
"""The return value of delete operation."""
|
6976
7171
|
|
6977
7172
|
name: Optional[str] = Field(default=None, description="""""")
|
6978
7173
|
done: Optional[bool] = Field(default=None, description="""""")
|
@@ -6980,7 +7175,7 @@ class DeleteResourceJob(_common.BaseModel):
|
|
6980
7175
|
|
6981
7176
|
|
6982
7177
|
class DeleteResourceJobDict(TypedDict, total=False):
|
6983
|
-
"""
|
7178
|
+
"""The return value of delete operation."""
|
6984
7179
|
|
6985
7180
|
name: Optional[str]
|
6986
7181
|
""""""
|
@@ -7189,7 +7384,7 @@ ReplayFileOrDict = Union[ReplayFile, ReplayFileDict]
|
|
7189
7384
|
class UploadFileConfig(_common.BaseModel):
|
7190
7385
|
"""Used to override the default configuration."""
|
7191
7386
|
|
7192
|
-
http_options: Optional[
|
7387
|
+
http_options: Optional[HttpOptions] = Field(
|
7193
7388
|
default=None, description="""Used to override HTTP request options."""
|
7194
7389
|
)
|
7195
7390
|
name: Optional[str] = Field(
|
@@ -7208,7 +7403,7 @@ class UploadFileConfig(_common.BaseModel):
|
|
7208
7403
|
class UploadFileConfigDict(TypedDict, total=False):
|
7209
7404
|
"""Used to override the default configuration."""
|
7210
7405
|
|
7211
|
-
http_options: Optional[
|
7406
|
+
http_options: Optional[HttpOptionsDict]
|
7212
7407
|
"""Used to override HTTP request options."""
|
7213
7408
|
|
7214
7409
|
name: Optional[str]
|
@@ -7224,6 +7419,24 @@ class UploadFileConfigDict(TypedDict, total=False):
|
|
7224
7419
|
UploadFileConfigOrDict = Union[UploadFileConfig, UploadFileConfigDict]
|
7225
7420
|
|
7226
7421
|
|
7422
|
+
class DownloadFileConfig(_common.BaseModel):
|
7423
|
+
"""Used to override the default configuration."""
|
7424
|
+
|
7425
|
+
http_options: Optional[HttpOptions] = Field(
|
7426
|
+
default=None, description="""Used to override HTTP request options."""
|
7427
|
+
)
|
7428
|
+
|
7429
|
+
|
7430
|
+
class DownloadFileConfigDict(TypedDict, total=False):
|
7431
|
+
"""Used to override the default configuration."""
|
7432
|
+
|
7433
|
+
http_options: Optional[HttpOptionsDict]
|
7434
|
+
"""Used to override HTTP request options."""
|
7435
|
+
|
7436
|
+
|
7437
|
+
DownloadFileConfigOrDict = Union[DownloadFileConfig, DownloadFileConfigDict]
|
7438
|
+
|
7439
|
+
|
7227
7440
|
class UpscaleImageConfig(_common.BaseModel):
|
7228
7441
|
"""Configuration for upscaling an image.
|
7229
7442
|
|
@@ -7232,7 +7445,7 @@ class UpscaleImageConfig(_common.BaseModel):
|
|
7232
7445
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_.
|
7233
7446
|
"""
|
7234
7447
|
|
7235
|
-
http_options: Optional[
|
7448
|
+
http_options: Optional[HttpOptions] = Field(
|
7236
7449
|
default=None, description="""Used to override HTTP request options."""
|
7237
7450
|
)
|
7238
7451
|
include_rai_reason: Optional[bool] = Field(
|
@@ -7259,7 +7472,7 @@ class UpscaleImageConfigDict(TypedDict, total=False):
|
|
7259
7472
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_.
|
7260
7473
|
"""
|
7261
7474
|
|
7262
|
-
http_options: Optional[
|
7475
|
+
http_options: Optional[HttpOptionsDict]
|
7263
7476
|
"""Used to override HTTP request options."""
|
7264
7477
|
|
7265
7478
|
include_rai_reason: Optional[bool]
|
@@ -7317,7 +7530,7 @@ UpscaleImageParametersOrDict = Union[
|
|
7317
7530
|
|
7318
7531
|
|
7319
7532
|
class RawReferenceImage(_common.BaseModel):
|
7320
|
-
"""
|
7533
|
+
"""A raw reference image.
|
7321
7534
|
|
7322
7535
|
A raw reference image represents the base image to edit, provided by the user.
|
7323
7536
|
It can optionally be provided in addition to a mask reference image or
|
@@ -7343,12 +7556,12 @@ class RawReferenceImage(_common.BaseModel):
|
|
7343
7556
|
super().__init__(
|
7344
7557
|
reference_image=reference_image,
|
7345
7558
|
reference_id=reference_id,
|
7346
|
-
reference_type=
|
7559
|
+
reference_type='REFERENCE_TYPE_RAW',
|
7347
7560
|
)
|
7348
7561
|
|
7349
7562
|
|
7350
7563
|
class RawReferenceImageDict(TypedDict, total=False):
|
7351
|
-
"""
|
7564
|
+
"""A raw reference image.
|
7352
7565
|
|
7353
7566
|
A raw reference image represents the base image to edit, provided by the user.
|
7354
7567
|
It can optionally be provided in addition to a mask reference image or
|
@@ -7369,7 +7582,7 @@ RawReferenceImageOrDict = Union[RawReferenceImage, RawReferenceImageDict]
|
|
7369
7582
|
|
7370
7583
|
|
7371
7584
|
class MaskReferenceImage(_common.BaseModel):
|
7372
|
-
"""
|
7585
|
+
"""A mask reference image.
|
7373
7586
|
|
7374
7587
|
This encapsulates either a mask image provided by the user and configs for
|
7375
7588
|
the user provided mask, or only config parameters for the model to generate
|
@@ -7395,7 +7608,7 @@ class MaskReferenceImage(_common.BaseModel):
|
|
7395
7608
|
description="""Configuration for the mask reference image.""",
|
7396
7609
|
)
|
7397
7610
|
"""Re-map config to mask_reference_config to send to API."""
|
7398
|
-
mask_image_config: Optional[
|
7611
|
+
mask_image_config: Optional['MaskReferenceConfig'] = Field(
|
7399
7612
|
default=None, description=""""""
|
7400
7613
|
)
|
7401
7614
|
|
@@ -7403,18 +7616,18 @@ class MaskReferenceImage(_common.BaseModel):
|
|
7403
7616
|
self,
|
7404
7617
|
reference_image: Optional[Image] = None,
|
7405
7618
|
reference_id: Optional[int] = None,
|
7406
|
-
config: Optional[
|
7619
|
+
config: Optional['MaskReferenceConfig'] = None,
|
7407
7620
|
):
|
7408
7621
|
super().__init__(
|
7409
7622
|
reference_image=reference_image,
|
7410
7623
|
reference_id=reference_id,
|
7411
|
-
reference_type=
|
7624
|
+
reference_type='REFERENCE_TYPE_MASK',
|
7412
7625
|
)
|
7413
7626
|
self.mask_image_config = config
|
7414
7627
|
|
7415
7628
|
|
7416
7629
|
class MaskReferenceImageDict(TypedDict, total=False):
|
7417
|
-
"""
|
7630
|
+
"""A mask reference image.
|
7418
7631
|
|
7419
7632
|
This encapsulates either a mask image provided by the user and configs for
|
7420
7633
|
the user provided mask, or only config parameters for the model to generate
|
@@ -7442,7 +7655,7 @@ MaskReferenceImageOrDict = Union[MaskReferenceImage, MaskReferenceImageDict]
|
|
7442
7655
|
|
7443
7656
|
|
7444
7657
|
class ControlReferenceImage(_common.BaseModel):
|
7445
|
-
"""
|
7658
|
+
"""A control reference image.
|
7446
7659
|
|
7447
7660
|
The image of the control reference image is either a control image provided
|
7448
7661
|
by the user, or a regular image which the backend will use to generate a
|
@@ -7468,7 +7681,7 @@ class ControlReferenceImage(_common.BaseModel):
|
|
7468
7681
|
description="""Configuration for the control reference image.""",
|
7469
7682
|
)
|
7470
7683
|
"""Re-map config to control_reference_config to send to API."""
|
7471
|
-
control_image_config: Optional[
|
7684
|
+
control_image_config: Optional['ControlReferenceConfig'] = Field(
|
7472
7685
|
default=None, description=""""""
|
7473
7686
|
)
|
7474
7687
|
|
@@ -7476,18 +7689,18 @@ class ControlReferenceImage(_common.BaseModel):
|
|
7476
7689
|
self,
|
7477
7690
|
reference_image: Optional[Image] = None,
|
7478
7691
|
reference_id: Optional[int] = None,
|
7479
|
-
config: Optional[
|
7692
|
+
config: Optional['ControlReferenceConfig'] = None,
|
7480
7693
|
):
|
7481
7694
|
super().__init__(
|
7482
7695
|
reference_image=reference_image,
|
7483
7696
|
reference_id=reference_id,
|
7484
|
-
reference_type=
|
7697
|
+
reference_type='REFERENCE_TYPE_CONTROL',
|
7485
7698
|
)
|
7486
7699
|
self.control_image_config = config
|
7487
7700
|
|
7488
7701
|
|
7489
7702
|
class ControlReferenceImageDict(TypedDict, total=False):
|
7490
|
-
"""
|
7703
|
+
"""A control reference image.
|
7491
7704
|
|
7492
7705
|
The image of the control reference image is either a control image provided
|
7493
7706
|
by the user, or a regular image which the backend will use to generate a
|
@@ -7517,7 +7730,7 @@ ControlReferenceImageOrDict = Union[
|
|
7517
7730
|
|
7518
7731
|
|
7519
7732
|
class StyleReferenceImage(_common.BaseModel):
|
7520
|
-
"""
|
7733
|
+
"""A style reference image.
|
7521
7734
|
|
7522
7735
|
This encapsulates a style reference image provided by the user, and
|
7523
7736
|
additionally optional config parameters for the style reference image.
|
@@ -7541,7 +7754,7 @@ class StyleReferenceImage(_common.BaseModel):
|
|
7541
7754
|
description="""Configuration for the style reference image.""",
|
7542
7755
|
)
|
7543
7756
|
"""Re-map config to style_reference_config to send to API."""
|
7544
|
-
style_image_config: Optional[
|
7757
|
+
style_image_config: Optional['StyleReferenceConfig'] = Field(
|
7545
7758
|
default=None, description=""""""
|
7546
7759
|
)
|
7547
7760
|
|
@@ -7549,18 +7762,18 @@ class StyleReferenceImage(_common.BaseModel):
|
|
7549
7762
|
self,
|
7550
7763
|
reference_image: Optional[Image] = None,
|
7551
7764
|
reference_id: Optional[int] = None,
|
7552
|
-
config: Optional[
|
7765
|
+
config: Optional['StyleReferenceConfig'] = None,
|
7553
7766
|
):
|
7554
7767
|
super().__init__(
|
7555
7768
|
reference_image=reference_image,
|
7556
7769
|
reference_id=reference_id,
|
7557
|
-
reference_type=
|
7770
|
+
reference_type='REFERENCE_TYPE_STYLE',
|
7558
7771
|
)
|
7559
7772
|
self.style_image_config = config
|
7560
7773
|
|
7561
7774
|
|
7562
7775
|
class StyleReferenceImageDict(TypedDict, total=False):
|
7563
|
-
"""
|
7776
|
+
"""A style reference image.
|
7564
7777
|
|
7565
7778
|
This encapsulates a style reference image provided by the user, and
|
7566
7779
|
additionally optional config parameters for the style reference image.
|
@@ -7586,7 +7799,7 @@ StyleReferenceImageOrDict = Union[StyleReferenceImage, StyleReferenceImageDict]
|
|
7586
7799
|
|
7587
7800
|
|
7588
7801
|
class SubjectReferenceImage(_common.BaseModel):
|
7589
|
-
"""
|
7802
|
+
"""A subject reference image.
|
7590
7803
|
|
7591
7804
|
This encapsulates a subject reference image provided by the user, and
|
7592
7805
|
additionally optional config parameters for the subject reference image.
|
@@ -7610,7 +7823,7 @@ class SubjectReferenceImage(_common.BaseModel):
|
|
7610
7823
|
description="""Configuration for the subject reference image.""",
|
7611
7824
|
)
|
7612
7825
|
"""Re-map config to subject_reference_config to send to API."""
|
7613
|
-
subject_image_config: Optional[
|
7826
|
+
subject_image_config: Optional['SubjectReferenceConfig'] = Field(
|
7614
7827
|
default=None, description=""""""
|
7615
7828
|
)
|
7616
7829
|
|
@@ -7618,18 +7831,18 @@ class SubjectReferenceImage(_common.BaseModel):
|
|
7618
7831
|
self,
|
7619
7832
|
reference_image: Optional[Image] = None,
|
7620
7833
|
reference_id: Optional[int] = None,
|
7621
|
-
config: Optional[
|
7834
|
+
config: Optional['SubjectReferenceConfig'] = None,
|
7622
7835
|
):
|
7623
7836
|
super().__init__(
|
7624
7837
|
reference_image=reference_image,
|
7625
7838
|
reference_id=reference_id,
|
7626
|
-
reference_type=
|
7839
|
+
reference_type='REFERENCE_TYPE_SUBJECT',
|
7627
7840
|
)
|
7628
7841
|
self.subject_image_config = config
|
7629
7842
|
|
7630
7843
|
|
7631
7844
|
class SubjectReferenceImageDict(TypedDict, total=False):
|
7632
|
-
"""
|
7845
|
+
"""A subject reference image.
|
7633
7846
|
|
7634
7847
|
This encapsulates a subject reference image provided by the user, and
|
7635
7848
|
additionally optional config parameters for the subject reference image.
|
@@ -7690,7 +7903,7 @@ class LiveServerContent(_common.BaseModel):
|
|
7690
7903
|
)
|
7691
7904
|
interrupted: Optional[bool] = Field(
|
7692
7905
|
default=None,
|
7693
|
-
description="""If true, indicates that a client message has interrupted current model generation. If the client is playing out the content in realtime, this is a good signal to stop and empty the current queue.
|
7906
|
+
description="""If true, indicates that a client message has interrupted current model generation. If the client is playing out the content in realtime, this is a good signal to stop and empty the current queue.""",
|
7694
7907
|
)
|
7695
7908
|
|
7696
7909
|
|
@@ -7708,7 +7921,7 @@ class LiveServerContentDict(TypedDict, total=False):
|
|
7708
7921
|
"""If true, indicates that the model is done generating. Generation will only start in response to additional client messages. Can be set alongside `content`, indicating that the `content` is the last in the turn."""
|
7709
7922
|
|
7710
7923
|
interrupted: Optional[bool]
|
7711
|
-
"""If true, indicates that a client message has interrupted current model generation. If the client is playing out the content in realtime, this is a good signal to stop and empty the current queue.
|
7924
|
+
"""If true, indicates that a client message has interrupted current model generation. If the client is playing out the content in realtime, this is a good signal to stop and empty the current queue."""
|
7712
7925
|
|
7713
7926
|
|
7714
7927
|
LiveServerContentOrDict = Union[LiveServerContent, LiveServerContentDict]
|
@@ -7792,7 +8005,7 @@ class LiveServerMessage(_common.BaseModel):
|
|
7792
8005
|
or not self.server_content.model_turn.parts
|
7793
8006
|
):
|
7794
8007
|
return None
|
7795
|
-
text =
|
8008
|
+
text = ''
|
7796
8009
|
for part in self.server_content.model_turn.parts:
|
7797
8010
|
if isinstance(part.text, str):
|
7798
8011
|
if isinstance(part.thought, bool) and part.thought:
|
@@ -7810,7 +8023,7 @@ class LiveServerMessage(_common.BaseModel):
|
|
7810
8023
|
or not self.server_content.model_turn.parts
|
7811
8024
|
):
|
7812
8025
|
return None
|
7813
|
-
concatenated_data = b
|
8026
|
+
concatenated_data = b''
|
7814
8027
|
for part in self.server_content.model_turn.parts:
|
7815
8028
|
if part.inline_data and isinstance(part.inline_data.data, bytes):
|
7816
8029
|
concatenated_data += part.inline_data.data
|
@@ -7848,7 +8061,17 @@ class LiveClientSetup(_common.BaseModel):
|
|
7848
8061
|
)
|
7849
8062
|
generation_config: Optional[GenerationConfig] = Field(
|
7850
8063
|
default=None,
|
7851
|
-
description="""The generation configuration for the session.
|
8064
|
+
description="""The generation configuration for the session.
|
8065
|
+
|
8066
|
+
The following fields are supported:
|
8067
|
+
- `response_logprobs`
|
8068
|
+
- `response_mime_type`
|
8069
|
+
- `logprobs`
|
8070
|
+
- `response_schema`
|
8071
|
+
- `stop_sequence`
|
8072
|
+
- `routing_config`
|
8073
|
+
- `audio_timestamp`
|
8074
|
+
""",
|
7852
8075
|
)
|
7853
8076
|
system_instruction: Optional[Content] = Field(
|
7854
8077
|
default=None,
|
@@ -7876,7 +8099,17 @@ class LiveClientSetupDict(TypedDict, total=False):
|
|
7876
8099
|
"""
|
7877
8100
|
|
7878
8101
|
generation_config: Optional[GenerationConfigDict]
|
7879
|
-
"""The generation configuration for the session.
|
8102
|
+
"""The generation configuration for the session.
|
8103
|
+
|
8104
|
+
The following fields are supported:
|
8105
|
+
- `response_logprobs`
|
8106
|
+
- `response_mime_type`
|
8107
|
+
- `logprobs`
|
8108
|
+
- `response_schema`
|
8109
|
+
- `stop_sequence`
|
8110
|
+
- `routing_config`
|
8111
|
+
- `audio_timestamp`
|
8112
|
+
"""
|
7880
8113
|
|
7881
8114
|
system_instruction: Optional[ContentDict]
|
7882
8115
|
"""The user provided system instructions for the model.
|
@@ -7908,7 +8141,7 @@ class LiveClientContent(_common.BaseModel):
|
|
7908
8141
|
description="""The content appended to the current conversation with the model.
|
7909
8142
|
|
7910
8143
|
For single-turn queries, this is a single instance. For multi-turn
|
7911
|
-
queries, this is a repeated field that contains conversation history
|
8144
|
+
queries, this is a repeated field that contains conversation history and
|
7912
8145
|
latest request.
|
7913
8146
|
""",
|
7914
8147
|
)
|
@@ -7933,7 +8166,7 @@ class LiveClientContentDict(TypedDict, total=False):
|
|
7933
8166
|
"""The content appended to the current conversation with the model.
|
7934
8167
|
|
7935
8168
|
For single-turn queries, this is a single instance. For multi-turn
|
7936
|
-
queries, this is a repeated field that contains conversation history
|
8169
|
+
queries, this is a repeated field that contains conversation history and
|
7937
8170
|
latest request.
|
7938
8171
|
"""
|
7939
8172
|
|
@@ -7950,16 +8183,17 @@ class LiveClientRealtimeInput(_common.BaseModel):
|
|
7950
8183
|
"""User input that is sent in real time.
|
7951
8184
|
|
7952
8185
|
This is different from `ClientContentUpdate` in a few ways:
|
7953
|
-
|
7954
|
-
|
7955
|
-
|
7956
|
-
|
7957
|
-
|
7958
|
-
|
7959
|
-
|
7960
|
-
|
7961
|
-
|
7962
|
-
|
8186
|
+
|
8187
|
+
- Can be sent continuously without interruption to model generation.
|
8188
|
+
- If there is a need to mix data interleaved across the
|
8189
|
+
`ClientContentUpdate` and the `RealtimeUpdate`, server attempts to
|
8190
|
+
optimize for best response, but there are no guarantees.
|
8191
|
+
- End of turn is not explicitly specified, but is rather derived from user
|
8192
|
+
activity (for example, end of speech).
|
8193
|
+
- Even before the end of turn, the data is processed incrementally
|
8194
|
+
to optimize for a fast start of the response from the model.
|
8195
|
+
- Is always assumed to be the user's input (cannot be used to populate
|
8196
|
+
conversation history).
|
7963
8197
|
"""
|
7964
8198
|
|
7965
8199
|
media_chunks: Optional[list[Blob]] = Field(
|
@@ -7971,16 +8205,17 @@ class LiveClientRealtimeInputDict(TypedDict, total=False):
|
|
7971
8205
|
"""User input that is sent in real time.
|
7972
8206
|
|
7973
8207
|
This is different from `ClientContentUpdate` in a few ways:
|
7974
|
-
|
7975
|
-
|
7976
|
-
|
7977
|
-
|
7978
|
-
|
7979
|
-
|
7980
|
-
|
7981
|
-
|
7982
|
-
|
7983
|
-
|
8208
|
+
|
8209
|
+
- Can be sent continuously without interruption to model generation.
|
8210
|
+
- If there is a need to mix data interleaved across the
|
8211
|
+
`ClientContentUpdate` and the `RealtimeUpdate`, server attempts to
|
8212
|
+
optimize for best response, but there are no guarantees.
|
8213
|
+
- End of turn is not explicitly specified, but is rather derived from user
|
8214
|
+
activity (for example, end of speech).
|
8215
|
+
- Even before the end of turn, the data is processed incrementally
|
8216
|
+
to optimize for a fast start of the response from the model.
|
8217
|
+
- Is always assumed to be the user's input (cannot be used to populate
|
8218
|
+
conversation history).
|
7984
8219
|
"""
|
7985
8220
|
|
7986
8221
|
media_chunks: Optional[list[BlobDict]]
|
@@ -8070,7 +8305,7 @@ LiveClientMessageOrDict = Union[LiveClientMessage, LiveClientMessageDict]
|
|
8070
8305
|
|
8071
8306
|
|
8072
8307
|
class LiveConnectConfig(_common.BaseModel):
|
8073
|
-
"""
|
8308
|
+
"""Session config for the API connection."""
|
8074
8309
|
|
8075
8310
|
generation_config: Optional[GenerationConfig] = Field(
|
8076
8311
|
default=None,
|
@@ -8104,7 +8339,7 @@ class LiveConnectConfig(_common.BaseModel):
|
|
8104
8339
|
|
8105
8340
|
|
8106
8341
|
class LiveConnectConfigDict(TypedDict, total=False):
|
8107
|
-
"""
|
8342
|
+
"""Session config for the API connection."""
|
8108
8343
|
|
8109
8344
|
generation_config: Optional[GenerationConfigDict]
|
8110
8345
|
"""The generation configuration for the session."""
|