google-genai 1.37.0__py3-none-any.whl → 1.39.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 +12 -0
- google/genai/_common.py +25 -10
- google/genai/_live_converters.py +2081 -1907
- google/genai/_operations_converters.py +108 -117
- google/genai/_replay_api_client.py +8 -4
- google/genai/_tokens_converters.py +465 -458
- google/genai/_transformers.py +44 -26
- google/genai/batches.py +1101 -1138
- google/genai/caches.py +747 -771
- google/genai/client.py +87 -0
- google/genai/files.py +110 -123
- google/genai/local_tokenizer.py +7 -2
- google/genai/models.py +2716 -2814
- google/genai/operations.py +10 -22
- google/genai/tunings.py +358 -391
- google/genai/types.py +222 -4
- google/genai/version.py +1 -1
- {google_genai-1.37.0.dist-info → google_genai-1.39.0.dist-info}/METADATA +82 -1
- google_genai-1.39.0.dist-info/RECORD +39 -0
- google_genai-1.37.0.dist-info/RECORD +0 -39
- {google_genai-1.37.0.dist-info → google_genai-1.39.0.dist-info}/WHEEL +0 -0
- {google_genai-1.37.0.dist-info → google_genai-1.39.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.37.0.dist-info → google_genai-1.39.0.dist-info}/top_level.txt +0 -0
google/genai/caches.py
CHANGED
@@ -33,19 +33,58 @@ from .pagers import AsyncPager, Pager
|
|
33
33
|
logger = logging.getLogger('google_genai.caches')
|
34
34
|
|
35
35
|
|
36
|
-
def
|
36
|
+
def _Behavior_to_vertex_enum_validate(enum_value: Any) -> None:
|
37
|
+
if enum_value in set(['UNSPECIFIED', 'BLOCKING', 'NON_BLOCKING']):
|
38
|
+
raise ValueError(f'{enum_value} enum value is not supported in Vertex AI.')
|
39
|
+
|
40
|
+
|
41
|
+
def _ApiKeyConfig_to_vertex(
|
37
42
|
from_object: Union[dict[str, Any], object],
|
38
43
|
parent_object: Optional[dict[str, Any]] = None,
|
39
44
|
) -> dict[str, Any]:
|
40
45
|
to_object: dict[str, Any] = {}
|
41
|
-
if getv(from_object, ['
|
42
|
-
setv(to_object, ['
|
46
|
+
if getv(from_object, ['api_key_string']) is not None:
|
47
|
+
setv(to_object, ['apiKeyString'], getv(from_object, ['api_key_string']))
|
43
48
|
|
44
|
-
|
45
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
49
|
+
return to_object
|
46
50
|
|
47
|
-
|
48
|
-
|
51
|
+
|
52
|
+
def _AuthConfig_to_vertex(
|
53
|
+
from_object: Union[dict[str, Any], object],
|
54
|
+
parent_object: Optional[dict[str, Any]] = None,
|
55
|
+
) -> dict[str, Any]:
|
56
|
+
to_object: dict[str, Any] = {}
|
57
|
+
if getv(from_object, ['api_key_config']) is not None:
|
58
|
+
setv(
|
59
|
+
to_object,
|
60
|
+
['apiKeyConfig'],
|
61
|
+
_ApiKeyConfig_to_vertex(
|
62
|
+
getv(from_object, ['api_key_config']), to_object
|
63
|
+
),
|
64
|
+
)
|
65
|
+
|
66
|
+
if getv(from_object, ['auth_type']) is not None:
|
67
|
+
setv(to_object, ['authType'], getv(from_object, ['auth_type']))
|
68
|
+
|
69
|
+
if getv(from_object, ['google_service_account_config']) is not None:
|
70
|
+
setv(
|
71
|
+
to_object,
|
72
|
+
['googleServiceAccountConfig'],
|
73
|
+
getv(from_object, ['google_service_account_config']),
|
74
|
+
)
|
75
|
+
|
76
|
+
if getv(from_object, ['http_basic_auth_config']) is not None:
|
77
|
+
setv(
|
78
|
+
to_object,
|
79
|
+
['httpBasicAuthConfig'],
|
80
|
+
getv(from_object, ['http_basic_auth_config']),
|
81
|
+
)
|
82
|
+
|
83
|
+
if getv(from_object, ['oauth_config']) is not None:
|
84
|
+
setv(to_object, ['oauthConfig'], getv(from_object, ['oauth_config']))
|
85
|
+
|
86
|
+
if getv(from_object, ['oidc_config']) is not None:
|
87
|
+
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
49
88
|
|
50
89
|
return to_object
|
51
90
|
|
@@ -67,16 +106,16 @@ def _Blob_to_mldev(
|
|
67
106
|
return to_object
|
68
107
|
|
69
108
|
|
70
|
-
def
|
109
|
+
def _Blob_to_vertex(
|
71
110
|
from_object: Union[dict[str, Any], object],
|
72
111
|
parent_object: Optional[dict[str, Any]] = None,
|
73
112
|
) -> dict[str, Any]:
|
74
113
|
to_object: dict[str, Any] = {}
|
75
114
|
if getv(from_object, ['display_name']) is not None:
|
76
|
-
|
115
|
+
setv(to_object, ['displayName'], getv(from_object, ['display_name']))
|
77
116
|
|
78
|
-
if getv(from_object, ['
|
79
|
-
setv(to_object, ['
|
117
|
+
if getv(from_object, ['data']) is not None:
|
118
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
80
119
|
|
81
120
|
if getv(from_object, ['mime_type']) is not None:
|
82
121
|
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
@@ -84,87 +123,60 @@ def _FileData_to_mldev(
|
|
84
123
|
return to_object
|
85
124
|
|
86
125
|
|
87
|
-
def
|
126
|
+
def _CachedContent_from_mldev(
|
88
127
|
from_object: Union[dict[str, Any], object],
|
89
128
|
parent_object: Optional[dict[str, Any]] = None,
|
90
129
|
) -> dict[str, Any]:
|
91
130
|
to_object: dict[str, Any] = {}
|
92
|
-
if getv(from_object, ['id']) is not None:
|
93
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
94
|
-
|
95
|
-
if getv(from_object, ['args']) is not None:
|
96
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
97
|
-
|
98
131
|
if getv(from_object, ['name']) is not None:
|
99
132
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
100
133
|
|
134
|
+
if getv(from_object, ['displayName']) is not None:
|
135
|
+
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
136
|
+
|
137
|
+
if getv(from_object, ['model']) is not None:
|
138
|
+
setv(to_object, ['model'], getv(from_object, ['model']))
|
139
|
+
|
140
|
+
if getv(from_object, ['createTime']) is not None:
|
141
|
+
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
142
|
+
|
143
|
+
if getv(from_object, ['updateTime']) is not None:
|
144
|
+
setv(to_object, ['update_time'], getv(from_object, ['updateTime']))
|
145
|
+
|
146
|
+
if getv(from_object, ['expireTime']) is not None:
|
147
|
+
setv(to_object, ['expire_time'], getv(from_object, ['expireTime']))
|
148
|
+
|
149
|
+
if getv(from_object, ['usageMetadata']) is not None:
|
150
|
+
setv(to_object, ['usage_metadata'], getv(from_object, ['usageMetadata']))
|
151
|
+
|
101
152
|
return to_object
|
102
153
|
|
103
154
|
|
104
|
-
def
|
155
|
+
def _CachedContent_from_vertex(
|
105
156
|
from_object: Union[dict[str, Any], object],
|
106
157
|
parent_object: Optional[dict[str, Any]] = None,
|
107
158
|
) -> dict[str, Any]:
|
108
159
|
to_object: dict[str, Any] = {}
|
109
|
-
if getv(from_object, ['
|
110
|
-
setv(
|
111
|
-
to_object,
|
112
|
-
['videoMetadata'],
|
113
|
-
_VideoMetadata_to_mldev(
|
114
|
-
getv(from_object, ['video_metadata']), to_object
|
115
|
-
),
|
116
|
-
)
|
117
|
-
|
118
|
-
if getv(from_object, ['thought']) is not None:
|
119
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
120
|
-
|
121
|
-
if getv(from_object, ['inline_data']) is not None:
|
122
|
-
setv(
|
123
|
-
to_object,
|
124
|
-
['inlineData'],
|
125
|
-
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
126
|
-
)
|
127
|
-
|
128
|
-
if getv(from_object, ['file_data']) is not None:
|
129
|
-
setv(
|
130
|
-
to_object,
|
131
|
-
['fileData'],
|
132
|
-
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
133
|
-
)
|
160
|
+
if getv(from_object, ['name']) is not None:
|
161
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
134
162
|
|
135
|
-
if getv(from_object, ['
|
136
|
-
setv(
|
137
|
-
to_object,
|
138
|
-
['thoughtSignature'],
|
139
|
-
getv(from_object, ['thought_signature']),
|
140
|
-
)
|
163
|
+
if getv(from_object, ['displayName']) is not None:
|
164
|
+
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
141
165
|
|
142
|
-
if getv(from_object, ['
|
143
|
-
setv(
|
144
|
-
to_object,
|
145
|
-
['functionCall'],
|
146
|
-
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
147
|
-
)
|
166
|
+
if getv(from_object, ['model']) is not None:
|
167
|
+
setv(to_object, ['model'], getv(from_object, ['model']))
|
148
168
|
|
149
|
-
if getv(from_object, ['
|
150
|
-
setv(
|
151
|
-
to_object,
|
152
|
-
['codeExecutionResult'],
|
153
|
-
getv(from_object, ['code_execution_result']),
|
154
|
-
)
|
169
|
+
if getv(from_object, ['createTime']) is not None:
|
170
|
+
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
155
171
|
|
156
|
-
if getv(from_object, ['
|
157
|
-
setv(to_object, ['
|
172
|
+
if getv(from_object, ['updateTime']) is not None:
|
173
|
+
setv(to_object, ['update_time'], getv(from_object, ['updateTime']))
|
158
174
|
|
159
|
-
if getv(from_object, ['
|
160
|
-
setv(
|
161
|
-
to_object,
|
162
|
-
['functionResponse'],
|
163
|
-
getv(from_object, ['function_response']),
|
164
|
-
)
|
175
|
+
if getv(from_object, ['expireTime']) is not None:
|
176
|
+
setv(to_object, ['expire_time'], getv(from_object, ['expireTime']))
|
165
177
|
|
166
|
-
if getv(from_object, ['
|
167
|
-
setv(to_object, ['
|
178
|
+
if getv(from_object, ['usageMetadata']) is not None:
|
179
|
+
setv(to_object, ['usage_metadata'], getv(from_object, ['usageMetadata']))
|
168
180
|
|
169
181
|
return to_object
|
170
182
|
|
@@ -190,273 +202,85 @@ def _Content_to_mldev(
|
|
190
202
|
return to_object
|
191
203
|
|
192
204
|
|
193
|
-
def
|
205
|
+
def _Content_to_vertex(
|
194
206
|
from_object: Union[dict[str, Any], object],
|
195
207
|
parent_object: Optional[dict[str, Any]] = None,
|
196
208
|
) -> dict[str, Any]:
|
197
209
|
to_object: dict[str, Any] = {}
|
198
|
-
if getv(from_object, ['
|
199
|
-
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
200
|
-
|
201
|
-
if getv(from_object, ['description']) is not None:
|
202
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
203
|
-
|
204
|
-
if getv(from_object, ['name']) is not None:
|
205
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
206
|
-
|
207
|
-
if getv(from_object, ['parameters']) is not None:
|
208
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
209
|
-
|
210
|
-
if getv(from_object, ['parameters_json_schema']) is not None:
|
210
|
+
if getv(from_object, ['parts']) is not None:
|
211
211
|
setv(
|
212
212
|
to_object,
|
213
|
-
['
|
214
|
-
|
213
|
+
['parts'],
|
214
|
+
[
|
215
|
+
_Part_to_vertex(item, to_object)
|
216
|
+
for item in getv(from_object, ['parts'])
|
217
|
+
],
|
215
218
|
)
|
216
219
|
|
217
|
-
if getv(from_object, ['
|
218
|
-
setv(to_object, ['
|
219
|
-
|
220
|
-
if getv(from_object, ['response_json_schema']) is not None:
|
221
|
-
setv(
|
222
|
-
to_object,
|
223
|
-
['responseJsonSchema'],
|
224
|
-
getv(from_object, ['response_json_schema']),
|
225
|
-
)
|
220
|
+
if getv(from_object, ['role']) is not None:
|
221
|
+
setv(to_object, ['role'], getv(from_object, ['role']))
|
226
222
|
|
227
223
|
return to_object
|
228
224
|
|
229
225
|
|
230
|
-
def
|
226
|
+
def _CreateCachedContentConfig_to_mldev(
|
231
227
|
from_object: Union[dict[str, Any], object],
|
232
228
|
parent_object: Optional[dict[str, Any]] = None,
|
233
229
|
) -> dict[str, Any]:
|
234
230
|
to_object: dict[str, Any] = {}
|
235
|
-
if getv(from_object, ['start_time']) is not None:
|
236
|
-
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
237
231
|
|
238
|
-
if getv(from_object, ['
|
239
|
-
setv(
|
232
|
+
if getv(from_object, ['ttl']) is not None:
|
233
|
+
setv(parent_object, ['ttl'], getv(from_object, ['ttl']))
|
240
234
|
|
241
|
-
|
235
|
+
if getv(from_object, ['expire_time']) is not None:
|
236
|
+
setv(parent_object, ['expireTime'], getv(from_object, ['expire_time']))
|
242
237
|
|
238
|
+
if getv(from_object, ['display_name']) is not None:
|
239
|
+
setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
|
243
240
|
|
244
|
-
|
245
|
-
from_object: Union[dict[str, Any], object],
|
246
|
-
parent_object: Optional[dict[str, Any]] = None,
|
247
|
-
) -> dict[str, Any]:
|
248
|
-
to_object: dict[str, Any] = {}
|
249
|
-
if getv(from_object, ['time_range_filter']) is not None:
|
241
|
+
if getv(from_object, ['contents']) is not None:
|
250
242
|
setv(
|
251
|
-
|
252
|
-
['
|
253
|
-
|
243
|
+
parent_object,
|
244
|
+
['contents'],
|
245
|
+
[
|
246
|
+
_Content_to_mldev(item, to_object)
|
247
|
+
for item in t.t_contents(getv(from_object, ['contents']))
|
248
|
+
],
|
254
249
|
)
|
255
250
|
|
256
|
-
if getv(from_object, ['
|
257
|
-
|
258
|
-
|
251
|
+
if getv(from_object, ['system_instruction']) is not None:
|
252
|
+
setv(
|
253
|
+
parent_object,
|
254
|
+
['systemInstruction'],
|
255
|
+
_Content_to_mldev(
|
256
|
+
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
257
|
+
),
|
258
|
+
)
|
259
|
+
|
260
|
+
if getv(from_object, ['tools']) is not None:
|
261
|
+
setv(
|
262
|
+
parent_object,
|
263
|
+
['tools'],
|
264
|
+
[
|
265
|
+
_Tool_to_mldev(item, to_object)
|
266
|
+
for item in getv(from_object, ['tools'])
|
267
|
+
],
|
268
|
+
)
|
269
|
+
|
270
|
+
if getv(from_object, ['tool_config']) is not None:
|
271
|
+
setv(
|
272
|
+
parent_object,
|
273
|
+
['toolConfig'],
|
274
|
+
_ToolConfig_to_mldev(getv(from_object, ['tool_config']), to_object),
|
259
275
|
)
|
260
276
|
|
277
|
+
if getv(from_object, ['kms_key_name']) is not None:
|
278
|
+
raise ValueError('kms_key_name parameter is not supported in Gemini API.')
|
279
|
+
|
261
280
|
return to_object
|
262
281
|
|
263
282
|
|
264
|
-
def
|
265
|
-
from_object: Union[dict[str, Any], object],
|
266
|
-
parent_object: Optional[dict[str, Any]] = None,
|
267
|
-
) -> dict[str, Any]:
|
268
|
-
to_object: dict[str, Any] = {}
|
269
|
-
if getv(from_object, ['mode']) is not None:
|
270
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
271
|
-
|
272
|
-
if getv(from_object, ['dynamic_threshold']) is not None:
|
273
|
-
setv(
|
274
|
-
to_object,
|
275
|
-
['dynamicThreshold'],
|
276
|
-
getv(from_object, ['dynamic_threshold']),
|
277
|
-
)
|
278
|
-
|
279
|
-
return to_object
|
280
|
-
|
281
|
-
|
282
|
-
def _GoogleSearchRetrieval_to_mldev(
|
283
|
-
from_object: Union[dict[str, Any], object],
|
284
|
-
parent_object: Optional[dict[str, Any]] = None,
|
285
|
-
) -> dict[str, Any]:
|
286
|
-
to_object: dict[str, Any] = {}
|
287
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
288
|
-
setv(
|
289
|
-
to_object,
|
290
|
-
['dynamicRetrievalConfig'],
|
291
|
-
_DynamicRetrievalConfig_to_mldev(
|
292
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
293
|
-
),
|
294
|
-
)
|
295
|
-
|
296
|
-
return to_object
|
297
|
-
|
298
|
-
|
299
|
-
def _UrlContext_to_mldev(
|
300
|
-
from_object: Union[dict[str, Any], object],
|
301
|
-
parent_object: Optional[dict[str, Any]] = None,
|
302
|
-
) -> dict[str, Any]:
|
303
|
-
to_object: dict[str, Any] = {}
|
304
|
-
|
305
|
-
return to_object
|
306
|
-
|
307
|
-
|
308
|
-
def _ToolComputerUse_to_mldev(
|
309
|
-
from_object: Union[dict[str, Any], object],
|
310
|
-
parent_object: Optional[dict[str, Any]] = None,
|
311
|
-
) -> dict[str, Any]:
|
312
|
-
to_object: dict[str, Any] = {}
|
313
|
-
if getv(from_object, ['environment']) is not None:
|
314
|
-
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
315
|
-
|
316
|
-
return to_object
|
317
|
-
|
318
|
-
|
319
|
-
def _Tool_to_mldev(
|
320
|
-
from_object: Union[dict[str, Any], object],
|
321
|
-
parent_object: Optional[dict[str, Any]] = None,
|
322
|
-
) -> dict[str, Any]:
|
323
|
-
to_object: dict[str, Any] = {}
|
324
|
-
if getv(from_object, ['function_declarations']) is not None:
|
325
|
-
setv(
|
326
|
-
to_object,
|
327
|
-
['functionDeclarations'],
|
328
|
-
[
|
329
|
-
_FunctionDeclaration_to_mldev(item, to_object)
|
330
|
-
for item in getv(from_object, ['function_declarations'])
|
331
|
-
],
|
332
|
-
)
|
333
|
-
|
334
|
-
if getv(from_object, ['retrieval']) is not None:
|
335
|
-
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
336
|
-
|
337
|
-
if getv(from_object, ['google_search']) is not None:
|
338
|
-
setv(
|
339
|
-
to_object,
|
340
|
-
['googleSearch'],
|
341
|
-
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
342
|
-
)
|
343
|
-
|
344
|
-
if getv(from_object, ['google_search_retrieval']) is not None:
|
345
|
-
setv(
|
346
|
-
to_object,
|
347
|
-
['googleSearchRetrieval'],
|
348
|
-
_GoogleSearchRetrieval_to_mldev(
|
349
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
350
|
-
),
|
351
|
-
)
|
352
|
-
|
353
|
-
if getv(from_object, ['enterprise_web_search']) is not None:
|
354
|
-
raise ValueError(
|
355
|
-
'enterprise_web_search parameter is not supported in Gemini API.'
|
356
|
-
)
|
357
|
-
|
358
|
-
if getv(from_object, ['google_maps']) is not None:
|
359
|
-
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
360
|
-
|
361
|
-
if getv(from_object, ['url_context']) is not None:
|
362
|
-
setv(
|
363
|
-
to_object,
|
364
|
-
['urlContext'],
|
365
|
-
_UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
|
366
|
-
)
|
367
|
-
|
368
|
-
if getv(from_object, ['computer_use']) is not None:
|
369
|
-
setv(
|
370
|
-
to_object,
|
371
|
-
['computerUse'],
|
372
|
-
_ToolComputerUse_to_mldev(
|
373
|
-
getv(from_object, ['computer_use']), to_object
|
374
|
-
),
|
375
|
-
)
|
376
|
-
|
377
|
-
if getv(from_object, ['code_execution']) is not None:
|
378
|
-
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
379
|
-
|
380
|
-
return to_object
|
381
|
-
|
382
|
-
|
383
|
-
def _FunctionCallingConfig_to_mldev(
|
384
|
-
from_object: Union[dict[str, Any], object],
|
385
|
-
parent_object: Optional[dict[str, Any]] = None,
|
386
|
-
) -> dict[str, Any]:
|
387
|
-
to_object: dict[str, Any] = {}
|
388
|
-
if getv(from_object, ['mode']) is not None:
|
389
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
390
|
-
|
391
|
-
if getv(from_object, ['allowed_function_names']) is not None:
|
392
|
-
setv(
|
393
|
-
to_object,
|
394
|
-
['allowedFunctionNames'],
|
395
|
-
getv(from_object, ['allowed_function_names']),
|
396
|
-
)
|
397
|
-
|
398
|
-
return to_object
|
399
|
-
|
400
|
-
|
401
|
-
def _LatLng_to_mldev(
|
402
|
-
from_object: Union[dict[str, Any], object],
|
403
|
-
parent_object: Optional[dict[str, Any]] = None,
|
404
|
-
) -> dict[str, Any]:
|
405
|
-
to_object: dict[str, Any] = {}
|
406
|
-
if getv(from_object, ['latitude']) is not None:
|
407
|
-
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
|
408
|
-
|
409
|
-
if getv(from_object, ['longitude']) is not None:
|
410
|
-
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
|
411
|
-
|
412
|
-
return to_object
|
413
|
-
|
414
|
-
|
415
|
-
def _RetrievalConfig_to_mldev(
|
416
|
-
from_object: Union[dict[str, Any], object],
|
417
|
-
parent_object: Optional[dict[str, Any]] = None,
|
418
|
-
) -> dict[str, Any]:
|
419
|
-
to_object: dict[str, Any] = {}
|
420
|
-
if getv(from_object, ['lat_lng']) is not None:
|
421
|
-
setv(
|
422
|
-
to_object,
|
423
|
-
['latLng'],
|
424
|
-
_LatLng_to_mldev(getv(from_object, ['lat_lng']), to_object),
|
425
|
-
)
|
426
|
-
|
427
|
-
if getv(from_object, ['language_code']) is not None:
|
428
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
429
|
-
|
430
|
-
return to_object
|
431
|
-
|
432
|
-
|
433
|
-
def _ToolConfig_to_mldev(
|
434
|
-
from_object: Union[dict[str, Any], object],
|
435
|
-
parent_object: Optional[dict[str, Any]] = None,
|
436
|
-
) -> dict[str, Any]:
|
437
|
-
to_object: dict[str, Any] = {}
|
438
|
-
if getv(from_object, ['function_calling_config']) is not None:
|
439
|
-
setv(
|
440
|
-
to_object,
|
441
|
-
['functionCallingConfig'],
|
442
|
-
_FunctionCallingConfig_to_mldev(
|
443
|
-
getv(from_object, ['function_calling_config']), to_object
|
444
|
-
),
|
445
|
-
)
|
446
|
-
|
447
|
-
if getv(from_object, ['retrieval_config']) is not None:
|
448
|
-
setv(
|
449
|
-
to_object,
|
450
|
-
['retrievalConfig'],
|
451
|
-
_RetrievalConfig_to_mldev(
|
452
|
-
getv(from_object, ['retrieval_config']), to_object
|
453
|
-
),
|
454
|
-
)
|
455
|
-
|
456
|
-
return to_object
|
457
|
-
|
458
|
-
|
459
|
-
def _CreateCachedContentConfig_to_mldev(
|
283
|
+
def _CreateCachedContentConfig_to_vertex(
|
460
284
|
from_object: Union[dict[str, Any], object],
|
461
285
|
parent_object: Optional[dict[str, Any]] = None,
|
462
286
|
) -> dict[str, Any]:
|
@@ -476,7 +300,7 @@ def _CreateCachedContentConfig_to_mldev(
|
|
476
300
|
parent_object,
|
477
301
|
['contents'],
|
478
302
|
[
|
479
|
-
|
303
|
+
_Content_to_vertex(item, to_object)
|
480
304
|
for item in t.t_contents(getv(from_object, ['contents']))
|
481
305
|
],
|
482
306
|
)
|
@@ -485,7 +309,7 @@ def _CreateCachedContentConfig_to_mldev(
|
|
485
309
|
setv(
|
486
310
|
parent_object,
|
487
311
|
['systemInstruction'],
|
488
|
-
|
312
|
+
_Content_to_vertex(
|
489
313
|
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
490
314
|
),
|
491
315
|
)
|
@@ -495,7 +319,7 @@ def _CreateCachedContentConfig_to_mldev(
|
|
495
319
|
parent_object,
|
496
320
|
['tools'],
|
497
321
|
[
|
498
|
-
|
322
|
+
_Tool_to_vertex(item, to_object)
|
499
323
|
for item in getv(from_object, ['tools'])
|
500
324
|
],
|
501
325
|
)
|
@@ -504,11 +328,15 @@ def _CreateCachedContentConfig_to_mldev(
|
|
504
328
|
setv(
|
505
329
|
parent_object,
|
506
330
|
['toolConfig'],
|
507
|
-
|
331
|
+
_ToolConfig_to_vertex(getv(from_object, ['tool_config']), to_object),
|
508
332
|
)
|
509
333
|
|
510
334
|
if getv(from_object, ['kms_key_name']) is not None:
|
511
|
-
|
335
|
+
setv(
|
336
|
+
parent_object,
|
337
|
+
['encryption_spec', 'kmsKeyName'],
|
338
|
+
getv(from_object, ['kms_key_name']),
|
339
|
+
)
|
512
340
|
|
513
341
|
return to_object
|
514
342
|
|
@@ -527,32 +355,30 @@ def _CreateCachedContentParameters_to_mldev(
|
|
527
355
|
)
|
528
356
|
|
529
357
|
if getv(from_object, ['config']) is not None:
|
530
|
-
|
531
|
-
to_object
|
532
|
-
['config'],
|
533
|
-
_CreateCachedContentConfig_to_mldev(
|
534
|
-
getv(from_object, ['config']), to_object
|
535
|
-
),
|
358
|
+
_CreateCachedContentConfig_to_mldev(
|
359
|
+
getv(from_object, ['config']), to_object
|
536
360
|
)
|
537
361
|
|
538
362
|
return to_object
|
539
363
|
|
540
364
|
|
541
|
-
def
|
365
|
+
def _CreateCachedContentParameters_to_vertex(
|
542
366
|
api_client: BaseApiClient,
|
543
367
|
from_object: Union[dict[str, Any], object],
|
544
368
|
parent_object: Optional[dict[str, Any]] = None,
|
545
369
|
) -> dict[str, Any]:
|
546
370
|
to_object: dict[str, Any] = {}
|
547
|
-
if getv(from_object, ['
|
371
|
+
if getv(from_object, ['model']) is not None:
|
548
372
|
setv(
|
549
373
|
to_object,
|
550
|
-
['
|
551
|
-
t.
|
374
|
+
['model'],
|
375
|
+
t.t_caches_model(api_client, getv(from_object, ['model'])),
|
552
376
|
)
|
553
377
|
|
554
378
|
if getv(from_object, ['config']) is not None:
|
555
|
-
|
379
|
+
_CreateCachedContentConfig_to_vertex(
|
380
|
+
getv(from_object, ['config']), to_object
|
381
|
+
)
|
556
382
|
|
557
383
|
return to_object
|
558
384
|
|
@@ -570,28 +396,10 @@ def _DeleteCachedContentParameters_to_mldev(
|
|
570
396
|
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
571
397
|
)
|
572
398
|
|
573
|
-
if getv(from_object, ['config']) is not None:
|
574
|
-
setv(to_object, ['config'], getv(from_object, ['config']))
|
575
|
-
|
576
|
-
return to_object
|
577
|
-
|
578
|
-
|
579
|
-
def _UpdateCachedContentConfig_to_mldev(
|
580
|
-
from_object: Union[dict[str, Any], object],
|
581
|
-
parent_object: Optional[dict[str, Any]] = None,
|
582
|
-
) -> dict[str, Any]:
|
583
|
-
to_object: dict[str, Any] = {}
|
584
|
-
|
585
|
-
if getv(from_object, ['ttl']) is not None:
|
586
|
-
setv(parent_object, ['ttl'], getv(from_object, ['ttl']))
|
587
|
-
|
588
|
-
if getv(from_object, ['expire_time']) is not None:
|
589
|
-
setv(parent_object, ['expireTime'], getv(from_object, ['expire_time']))
|
590
|
-
|
591
399
|
return to_object
|
592
400
|
|
593
401
|
|
594
|
-
def
|
402
|
+
def _DeleteCachedContentParameters_to_vertex(
|
595
403
|
api_client: BaseApiClient,
|
596
404
|
from_object: Union[dict[str, Any], object],
|
597
405
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -604,83 +412,92 @@ def _UpdateCachedContentParameters_to_mldev(
|
|
604
412
|
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
605
413
|
)
|
606
414
|
|
607
|
-
if getv(from_object, ['config']) is not None:
|
608
|
-
setv(
|
609
|
-
to_object,
|
610
|
-
['config'],
|
611
|
-
_UpdateCachedContentConfig_to_mldev(
|
612
|
-
getv(from_object, ['config']), to_object
|
613
|
-
),
|
614
|
-
)
|
615
|
-
|
616
415
|
return to_object
|
617
416
|
|
618
417
|
|
619
|
-
def
|
418
|
+
def _DeleteCachedContentResponse_from_mldev(
|
620
419
|
from_object: Union[dict[str, Any], object],
|
621
420
|
parent_object: Optional[dict[str, Any]] = None,
|
622
421
|
) -> dict[str, Any]:
|
623
422
|
to_object: dict[str, Any] = {}
|
624
|
-
|
625
|
-
if getv(from_object, ['page_size']) is not None:
|
626
|
-
setv(
|
627
|
-
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
628
|
-
)
|
629
|
-
|
630
|
-
if getv(from_object, ['page_token']) is not None:
|
423
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
631
424
|
setv(
|
632
|
-
|
633
|
-
['_query', 'pageToken'],
|
634
|
-
getv(from_object, ['page_token']),
|
425
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
635
426
|
)
|
636
427
|
|
637
428
|
return to_object
|
638
429
|
|
639
430
|
|
640
|
-
def
|
431
|
+
def _DeleteCachedContentResponse_from_vertex(
|
641
432
|
from_object: Union[dict[str, Any], object],
|
642
433
|
parent_object: Optional[dict[str, Any]] = None,
|
643
434
|
) -> dict[str, Any]:
|
644
435
|
to_object: dict[str, Any] = {}
|
645
|
-
if getv(from_object, ['
|
436
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
437
|
+
setv(
|
438
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
439
|
+
)
|
440
|
+
|
441
|
+
return to_object
|
442
|
+
|
443
|
+
|
444
|
+
def _DynamicRetrievalConfig_to_mldev(
|
445
|
+
from_object: Union[dict[str, Any], object],
|
446
|
+
parent_object: Optional[dict[str, Any]] = None,
|
447
|
+
) -> dict[str, Any]:
|
448
|
+
to_object: dict[str, Any] = {}
|
449
|
+
if getv(from_object, ['mode']) is not None:
|
450
|
+
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
451
|
+
|
452
|
+
if getv(from_object, ['dynamic_threshold']) is not None:
|
646
453
|
setv(
|
647
454
|
to_object,
|
648
|
-
['
|
649
|
-
|
650
|
-
getv(from_object, ['config']), to_object
|
651
|
-
),
|
455
|
+
['dynamicThreshold'],
|
456
|
+
getv(from_object, ['dynamic_threshold']),
|
652
457
|
)
|
653
458
|
|
654
459
|
return to_object
|
655
460
|
|
656
461
|
|
657
|
-
def
|
462
|
+
def _DynamicRetrievalConfig_to_vertex(
|
658
463
|
from_object: Union[dict[str, Any], object],
|
659
464
|
parent_object: Optional[dict[str, Any]] = None,
|
660
465
|
) -> dict[str, Any]:
|
661
466
|
to_object: dict[str, Any] = {}
|
662
|
-
if getv(from_object, ['
|
663
|
-
setv(to_object, ['
|
467
|
+
if getv(from_object, ['mode']) is not None:
|
468
|
+
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
664
469
|
|
665
|
-
if getv(from_object, ['
|
666
|
-
setv(
|
470
|
+
if getv(from_object, ['dynamic_threshold']) is not None:
|
471
|
+
setv(
|
472
|
+
to_object,
|
473
|
+
['dynamicThreshold'],
|
474
|
+
getv(from_object, ['dynamic_threshold']),
|
475
|
+
)
|
667
476
|
|
668
|
-
|
669
|
-
|
477
|
+
return to_object
|
478
|
+
|
479
|
+
|
480
|
+
def _EnterpriseWebSearch_to_vertex(
|
481
|
+
from_object: Union[dict[str, Any], object],
|
482
|
+
parent_object: Optional[dict[str, Any]] = None,
|
483
|
+
) -> dict[str, Any]:
|
484
|
+
to_object: dict[str, Any] = {}
|
485
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
486
|
+
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
670
487
|
|
671
488
|
return to_object
|
672
489
|
|
673
490
|
|
674
|
-
def
|
491
|
+
def _FileData_to_mldev(
|
675
492
|
from_object: Union[dict[str, Any], object],
|
676
493
|
parent_object: Optional[dict[str, Any]] = None,
|
677
494
|
) -> dict[str, Any]:
|
678
495
|
to_object: dict[str, Any] = {}
|
679
496
|
if getv(from_object, ['display_name']) is not None:
|
680
|
-
|
497
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
681
498
|
|
682
|
-
if getv(from_object, ['
|
683
|
-
setv(to_object, ['
|
499
|
+
if getv(from_object, ['file_uri']) is not None:
|
500
|
+
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
684
501
|
|
685
502
|
if getv(from_object, ['mime_type']) is not None:
|
686
503
|
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
@@ -705,7 +522,7 @@ def _FileData_to_vertex(
|
|
705
522
|
return to_object
|
706
523
|
|
707
524
|
|
708
|
-
def
|
525
|
+
def _FunctionCall_to_mldev(
|
709
526
|
from_object: Union[dict[str, Any], object],
|
710
527
|
parent_object: Optional[dict[str, Any]] = None,
|
711
528
|
) -> dict[str, Any]:
|
@@ -722,93 +539,92 @@ def _FunctionCall_to_vertex(
|
|
722
539
|
return to_object
|
723
540
|
|
724
541
|
|
725
|
-
def
|
542
|
+
def _FunctionCall_to_vertex(
|
726
543
|
from_object: Union[dict[str, Any], object],
|
727
544
|
parent_object: Optional[dict[str, Any]] = None,
|
728
545
|
) -> dict[str, Any]:
|
729
546
|
to_object: dict[str, Any] = {}
|
730
|
-
if getv(from_object, ['
|
731
|
-
setv(
|
732
|
-
to_object,
|
733
|
-
['videoMetadata'],
|
734
|
-
_VideoMetadata_to_vertex(
|
735
|
-
getv(from_object, ['video_metadata']), to_object
|
736
|
-
),
|
737
|
-
)
|
547
|
+
if getv(from_object, ['id']) is not None:
|
548
|
+
setv(to_object, ['id'], getv(from_object, ['id']))
|
738
549
|
|
739
|
-
if getv(from_object, ['
|
740
|
-
setv(to_object, ['
|
550
|
+
if getv(from_object, ['args']) is not None:
|
551
|
+
setv(to_object, ['args'], getv(from_object, ['args']))
|
741
552
|
|
742
|
-
if getv(from_object, ['
|
743
|
-
setv(
|
744
|
-
to_object,
|
745
|
-
['inlineData'],
|
746
|
-
_Blob_to_vertex(getv(from_object, ['inline_data']), to_object),
|
747
|
-
)
|
553
|
+
if getv(from_object, ['name']) is not None:
|
554
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
748
555
|
|
749
|
-
|
750
|
-
setv(
|
751
|
-
to_object,
|
752
|
-
['fileData'],
|
753
|
-
_FileData_to_vertex(getv(from_object, ['file_data']), to_object),
|
754
|
-
)
|
556
|
+
return to_object
|
755
557
|
|
756
|
-
if getv(from_object, ['thought_signature']) is not None:
|
757
|
-
setv(
|
758
|
-
to_object,
|
759
|
-
['thoughtSignature'],
|
760
|
-
getv(from_object, ['thought_signature']),
|
761
|
-
)
|
762
558
|
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
)
|
559
|
+
def _FunctionCallingConfig_to_mldev(
|
560
|
+
from_object: Union[dict[str, Any], object],
|
561
|
+
parent_object: Optional[dict[str, Any]] = None,
|
562
|
+
) -> dict[str, Any]:
|
563
|
+
to_object: dict[str, Any] = {}
|
564
|
+
if getv(from_object, ['mode']) is not None:
|
565
|
+
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
771
566
|
|
772
|
-
if getv(from_object, ['
|
567
|
+
if getv(from_object, ['allowed_function_names']) is not None:
|
773
568
|
setv(
|
774
569
|
to_object,
|
775
|
-
['
|
776
|
-
getv(from_object, ['
|
570
|
+
['allowedFunctionNames'],
|
571
|
+
getv(from_object, ['allowed_function_names']),
|
777
572
|
)
|
778
573
|
|
779
|
-
|
780
|
-
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
574
|
+
return to_object
|
781
575
|
|
782
|
-
|
576
|
+
|
577
|
+
def _FunctionCallingConfig_to_vertex(
|
578
|
+
from_object: Union[dict[str, Any], object],
|
579
|
+
parent_object: Optional[dict[str, Any]] = None,
|
580
|
+
) -> dict[str, Any]:
|
581
|
+
to_object: dict[str, Any] = {}
|
582
|
+
if getv(from_object, ['mode']) is not None:
|
583
|
+
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
584
|
+
|
585
|
+
if getv(from_object, ['allowed_function_names']) is not None:
|
783
586
|
setv(
|
784
587
|
to_object,
|
785
|
-
['
|
786
|
-
getv(from_object, ['
|
588
|
+
['allowedFunctionNames'],
|
589
|
+
getv(from_object, ['allowed_function_names']),
|
787
590
|
)
|
788
591
|
|
789
|
-
if getv(from_object, ['text']) is not None:
|
790
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
791
|
-
|
792
592
|
return to_object
|
793
593
|
|
794
594
|
|
795
|
-
def
|
595
|
+
def _FunctionDeclaration_to_mldev(
|
796
596
|
from_object: Union[dict[str, Any], object],
|
797
597
|
parent_object: Optional[dict[str, Any]] = None,
|
798
598
|
) -> dict[str, Any]:
|
799
599
|
to_object: dict[str, Any] = {}
|
800
|
-
if getv(from_object, ['
|
600
|
+
if getv(from_object, ['behavior']) is not None:
|
601
|
+
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
602
|
+
|
603
|
+
if getv(from_object, ['description']) is not None:
|
604
|
+
setv(to_object, ['description'], getv(from_object, ['description']))
|
605
|
+
|
606
|
+
if getv(from_object, ['name']) is not None:
|
607
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
608
|
+
|
609
|
+
if getv(from_object, ['parameters']) is not None:
|
610
|
+
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
611
|
+
|
612
|
+
if getv(from_object, ['parameters_json_schema']) is not None:
|
801
613
|
setv(
|
802
614
|
to_object,
|
803
|
-
['
|
804
|
-
[
|
805
|
-
_Part_to_vertex(item, to_object)
|
806
|
-
for item in getv(from_object, ['parts'])
|
807
|
-
],
|
615
|
+
['parametersJsonSchema'],
|
616
|
+
getv(from_object, ['parameters_json_schema']),
|
808
617
|
)
|
809
618
|
|
810
|
-
if getv(from_object, ['
|
811
|
-
setv(to_object, ['
|
619
|
+
if getv(from_object, ['response']) is not None:
|
620
|
+
setv(to_object, ['response'], getv(from_object, ['response']))
|
621
|
+
|
622
|
+
if getv(from_object, ['response_json_schema']) is not None:
|
623
|
+
setv(
|
624
|
+
to_object,
|
625
|
+
['responseJsonSchema'],
|
626
|
+
getv(from_object, ['response_json_schema']),
|
627
|
+
)
|
812
628
|
|
813
629
|
return to_object
|
814
630
|
|
@@ -850,53 +666,65 @@ def _FunctionDeclaration_to_vertex(
|
|
850
666
|
return to_object
|
851
667
|
|
852
668
|
|
853
|
-
def
|
669
|
+
def _GetCachedContentParameters_to_mldev(
|
670
|
+
api_client: BaseApiClient,
|
854
671
|
from_object: Union[dict[str, Any], object],
|
855
672
|
parent_object: Optional[dict[str, Any]] = None,
|
856
673
|
) -> dict[str, Any]:
|
857
674
|
to_object: dict[str, Any] = {}
|
858
|
-
if getv(from_object, ['
|
859
|
-
setv(
|
860
|
-
|
861
|
-
|
862
|
-
|
675
|
+
if getv(from_object, ['name']) is not None:
|
676
|
+
setv(
|
677
|
+
to_object,
|
678
|
+
['_url', 'name'],
|
679
|
+
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
680
|
+
)
|
863
681
|
|
864
682
|
return to_object
|
865
683
|
|
866
684
|
|
867
|
-
def
|
685
|
+
def _GetCachedContentParameters_to_vertex(
|
686
|
+
api_client: BaseApiClient,
|
868
687
|
from_object: Union[dict[str, Any], object],
|
869
688
|
parent_object: Optional[dict[str, Any]] = None,
|
870
689
|
) -> dict[str, Any]:
|
871
690
|
to_object: dict[str, Any] = {}
|
872
|
-
if getv(from_object, ['
|
691
|
+
if getv(from_object, ['name']) is not None:
|
873
692
|
setv(
|
874
693
|
to_object,
|
875
|
-
['
|
876
|
-
|
877
|
-
getv(from_object, ['time_range_filter']), to_object
|
878
|
-
),
|
694
|
+
['_url', 'name'],
|
695
|
+
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
879
696
|
)
|
880
697
|
|
881
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
882
|
-
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
883
|
-
|
884
698
|
return to_object
|
885
699
|
|
886
700
|
|
887
|
-
def
|
701
|
+
def _GoogleMaps_to_vertex(
|
888
702
|
from_object: Union[dict[str, Any], object],
|
889
703
|
parent_object: Optional[dict[str, Any]] = None,
|
890
704
|
) -> dict[str, Any]:
|
891
705
|
to_object: dict[str, Any] = {}
|
892
|
-
if getv(from_object, ['
|
893
|
-
setv(
|
706
|
+
if getv(from_object, ['auth_config']) is not None:
|
707
|
+
setv(
|
708
|
+
to_object,
|
709
|
+
['authConfig'],
|
710
|
+
_AuthConfig_to_vertex(getv(from_object, ['auth_config']), to_object),
|
711
|
+
)
|
894
712
|
|
895
|
-
|
713
|
+
return to_object
|
714
|
+
|
715
|
+
|
716
|
+
def _GoogleSearchRetrieval_to_mldev(
|
717
|
+
from_object: Union[dict[str, Any], object],
|
718
|
+
parent_object: Optional[dict[str, Any]] = None,
|
719
|
+
) -> dict[str, Any]:
|
720
|
+
to_object: dict[str, Any] = {}
|
721
|
+
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
896
722
|
setv(
|
897
723
|
to_object,
|
898
|
-
['
|
899
|
-
|
724
|
+
['dynamicRetrievalConfig'],
|
725
|
+
_DynamicRetrievalConfig_to_mldev(
|
726
|
+
getv(from_object, ['dynamic_retrieval_config']), to_object
|
727
|
+
),
|
900
728
|
)
|
901
729
|
|
902
730
|
return to_object
|
@@ -919,223 +747,452 @@ def _GoogleSearchRetrieval_to_vertex(
|
|
919
747
|
return to_object
|
920
748
|
|
921
749
|
|
922
|
-
def
|
750
|
+
def _GoogleSearch_to_mldev(
|
923
751
|
from_object: Union[dict[str, Any], object],
|
924
752
|
parent_object: Optional[dict[str, Any]] = None,
|
925
753
|
) -> dict[str, Any]:
|
926
754
|
to_object: dict[str, Any] = {}
|
755
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
756
|
+
setv(
|
757
|
+
to_object,
|
758
|
+
['timeRangeFilter'],
|
759
|
+
_Interval_to_mldev(getv(from_object, ['time_range_filter']), to_object),
|
760
|
+
)
|
761
|
+
|
762
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
763
|
+
raise ValueError(
|
764
|
+
'exclude_domains parameter is not supported in Gemini API.'
|
765
|
+
)
|
766
|
+
|
767
|
+
return to_object
|
768
|
+
|
769
|
+
|
770
|
+
def _GoogleSearch_to_vertex(
|
771
|
+
from_object: Union[dict[str, Any], object],
|
772
|
+
parent_object: Optional[dict[str, Any]] = None,
|
773
|
+
) -> dict[str, Any]:
|
774
|
+
to_object: dict[str, Any] = {}
|
775
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
776
|
+
setv(
|
777
|
+
to_object,
|
778
|
+
['timeRangeFilter'],
|
779
|
+
_Interval_to_vertex(
|
780
|
+
getv(from_object, ['time_range_filter']), to_object
|
781
|
+
),
|
782
|
+
)
|
783
|
+
|
927
784
|
if getv(from_object, ['exclude_domains']) is not None:
|
928
785
|
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
929
786
|
|
930
787
|
return to_object
|
931
788
|
|
932
789
|
|
933
|
-
def
|
790
|
+
def _Interval_to_mldev(
|
934
791
|
from_object: Union[dict[str, Any], object],
|
935
792
|
parent_object: Optional[dict[str, Any]] = None,
|
936
793
|
) -> dict[str, Any]:
|
937
794
|
to_object: dict[str, Any] = {}
|
938
|
-
if getv(from_object, ['
|
939
|
-
setv(to_object, ['
|
795
|
+
if getv(from_object, ['start_time']) is not None:
|
796
|
+
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
797
|
+
|
798
|
+
if getv(from_object, ['end_time']) is not None:
|
799
|
+
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
940
800
|
|
941
801
|
return to_object
|
942
802
|
|
943
803
|
|
944
|
-
def
|
804
|
+
def _Interval_to_vertex(
|
945
805
|
from_object: Union[dict[str, Any], object],
|
946
806
|
parent_object: Optional[dict[str, Any]] = None,
|
947
807
|
) -> dict[str, Any]:
|
948
808
|
to_object: dict[str, Any] = {}
|
949
|
-
if getv(from_object, ['
|
809
|
+
if getv(from_object, ['start_time']) is not None:
|
810
|
+
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
811
|
+
|
812
|
+
if getv(from_object, ['end_time']) is not None:
|
813
|
+
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
814
|
+
|
815
|
+
return to_object
|
816
|
+
|
817
|
+
|
818
|
+
def _LatLng_to_mldev(
|
819
|
+
from_object: Union[dict[str, Any], object],
|
820
|
+
parent_object: Optional[dict[str, Any]] = None,
|
821
|
+
) -> dict[str, Any]:
|
822
|
+
to_object: dict[str, Any] = {}
|
823
|
+
if getv(from_object, ['latitude']) is not None:
|
824
|
+
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
|
825
|
+
|
826
|
+
if getv(from_object, ['longitude']) is not None:
|
827
|
+
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
|
828
|
+
|
829
|
+
return to_object
|
830
|
+
|
831
|
+
|
832
|
+
def _LatLng_to_vertex(
|
833
|
+
from_object: Union[dict[str, Any], object],
|
834
|
+
parent_object: Optional[dict[str, Any]] = None,
|
835
|
+
) -> dict[str, Any]:
|
836
|
+
to_object: dict[str, Any] = {}
|
837
|
+
if getv(from_object, ['latitude']) is not None:
|
838
|
+
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
|
839
|
+
|
840
|
+
if getv(from_object, ['longitude']) is not None:
|
841
|
+
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
|
842
|
+
|
843
|
+
return to_object
|
844
|
+
|
845
|
+
|
846
|
+
def _ListCachedContentsConfig_to_mldev(
|
847
|
+
from_object: Union[dict[str, Any], object],
|
848
|
+
parent_object: Optional[dict[str, Any]] = None,
|
849
|
+
) -> dict[str, Any]:
|
850
|
+
to_object: dict[str, Any] = {}
|
851
|
+
|
852
|
+
if getv(from_object, ['page_size']) is not None:
|
853
|
+
setv(
|
854
|
+
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
855
|
+
)
|
856
|
+
|
857
|
+
if getv(from_object, ['page_token']) is not None:
|
858
|
+
setv(
|
859
|
+
parent_object,
|
860
|
+
['_query', 'pageToken'],
|
861
|
+
getv(from_object, ['page_token']),
|
862
|
+
)
|
863
|
+
|
864
|
+
return to_object
|
865
|
+
|
866
|
+
|
867
|
+
def _ListCachedContentsConfig_to_vertex(
|
868
|
+
from_object: Union[dict[str, Any], object],
|
869
|
+
parent_object: Optional[dict[str, Any]] = None,
|
870
|
+
) -> dict[str, Any]:
|
871
|
+
to_object: dict[str, Any] = {}
|
872
|
+
|
873
|
+
if getv(from_object, ['page_size']) is not None:
|
874
|
+
setv(
|
875
|
+
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
876
|
+
)
|
877
|
+
|
878
|
+
if getv(from_object, ['page_token']) is not None:
|
879
|
+
setv(
|
880
|
+
parent_object,
|
881
|
+
['_query', 'pageToken'],
|
882
|
+
getv(from_object, ['page_token']),
|
883
|
+
)
|
884
|
+
|
885
|
+
return to_object
|
886
|
+
|
887
|
+
|
888
|
+
def _ListCachedContentsParameters_to_mldev(
|
889
|
+
from_object: Union[dict[str, Any], object],
|
890
|
+
parent_object: Optional[dict[str, Any]] = None,
|
891
|
+
) -> dict[str, Any]:
|
892
|
+
to_object: dict[str, Any] = {}
|
893
|
+
if getv(from_object, ['config']) is not None:
|
894
|
+
_ListCachedContentsConfig_to_mldev(getv(from_object, ['config']), to_object)
|
895
|
+
|
896
|
+
return to_object
|
897
|
+
|
898
|
+
|
899
|
+
def _ListCachedContentsParameters_to_vertex(
|
900
|
+
from_object: Union[dict[str, Any], object],
|
901
|
+
parent_object: Optional[dict[str, Any]] = None,
|
902
|
+
) -> dict[str, Any]:
|
903
|
+
to_object: dict[str, Any] = {}
|
904
|
+
if getv(from_object, ['config']) is not None:
|
905
|
+
_ListCachedContentsConfig_to_vertex(
|
906
|
+
getv(from_object, ['config']), to_object
|
907
|
+
)
|
908
|
+
|
909
|
+
return to_object
|
910
|
+
|
911
|
+
|
912
|
+
def _ListCachedContentsResponse_from_mldev(
|
913
|
+
from_object: Union[dict[str, Any], object],
|
914
|
+
parent_object: Optional[dict[str, Any]] = None,
|
915
|
+
) -> dict[str, Any]:
|
916
|
+
to_object: dict[str, Any] = {}
|
917
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
918
|
+
setv(
|
919
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
920
|
+
)
|
921
|
+
|
922
|
+
if getv(from_object, ['nextPageToken']) is not None:
|
923
|
+
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
924
|
+
|
925
|
+
if getv(from_object, ['cachedContents']) is not None:
|
950
926
|
setv(
|
951
927
|
to_object,
|
952
|
-
['
|
953
|
-
|
954
|
-
|
928
|
+
['cached_contents'],
|
929
|
+
[
|
930
|
+
_CachedContent_from_mldev(item, to_object)
|
931
|
+
for item in getv(from_object, ['cachedContents'])
|
932
|
+
],
|
933
|
+
)
|
934
|
+
|
935
|
+
return to_object
|
936
|
+
|
937
|
+
|
938
|
+
def _ListCachedContentsResponse_from_vertex(
|
939
|
+
from_object: Union[dict[str, Any], object],
|
940
|
+
parent_object: Optional[dict[str, Any]] = None,
|
941
|
+
) -> dict[str, Any]:
|
942
|
+
to_object: dict[str, Any] = {}
|
943
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
944
|
+
setv(
|
945
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
946
|
+
)
|
947
|
+
|
948
|
+
if getv(from_object, ['nextPageToken']) is not None:
|
949
|
+
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
950
|
+
|
951
|
+
if getv(from_object, ['cachedContents']) is not None:
|
952
|
+
setv(
|
953
|
+
to_object,
|
954
|
+
['cached_contents'],
|
955
|
+
[
|
956
|
+
_CachedContent_from_vertex(item, to_object)
|
957
|
+
for item in getv(from_object, ['cachedContents'])
|
958
|
+
],
|
959
|
+
)
|
960
|
+
|
961
|
+
return to_object
|
962
|
+
|
963
|
+
|
964
|
+
def _Part_to_mldev(
|
965
|
+
from_object: Union[dict[str, Any], object],
|
966
|
+
parent_object: Optional[dict[str, Any]] = None,
|
967
|
+
) -> dict[str, Any]:
|
968
|
+
to_object: dict[str, Any] = {}
|
969
|
+
if getv(from_object, ['video_metadata']) is not None:
|
970
|
+
setv(
|
971
|
+
to_object,
|
972
|
+
['videoMetadata'],
|
973
|
+
_VideoMetadata_to_mldev(
|
974
|
+
getv(from_object, ['video_metadata']), to_object
|
955
975
|
),
|
956
976
|
)
|
957
977
|
|
958
|
-
if getv(from_object, ['
|
959
|
-
setv(to_object, ['
|
960
|
-
|
961
|
-
if getv(from_object, ['
|
978
|
+
if getv(from_object, ['thought']) is not None:
|
979
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
980
|
+
|
981
|
+
if getv(from_object, ['inline_data']) is not None:
|
982
|
+
setv(
|
983
|
+
to_object,
|
984
|
+
['inlineData'],
|
985
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
986
|
+
)
|
987
|
+
|
988
|
+
if getv(from_object, ['file_data']) is not None:
|
989
|
+
setv(
|
990
|
+
to_object,
|
991
|
+
['fileData'],
|
992
|
+
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
993
|
+
)
|
994
|
+
|
995
|
+
if getv(from_object, ['thought_signature']) is not None:
|
996
|
+
setv(
|
997
|
+
to_object,
|
998
|
+
['thoughtSignature'],
|
999
|
+
getv(from_object, ['thought_signature']),
|
1000
|
+
)
|
1001
|
+
|
1002
|
+
if getv(from_object, ['function_call']) is not None:
|
962
1003
|
setv(
|
963
1004
|
to_object,
|
964
|
-
['
|
965
|
-
getv(from_object, ['
|
1005
|
+
['functionCall'],
|
1006
|
+
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
966
1007
|
)
|
967
1008
|
|
968
|
-
if getv(from_object, ['
|
1009
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
969
1010
|
setv(
|
970
1011
|
to_object,
|
971
|
-
['
|
972
|
-
getv(from_object, ['
|
1012
|
+
['codeExecutionResult'],
|
1013
|
+
getv(from_object, ['code_execution_result']),
|
973
1014
|
)
|
974
1015
|
|
975
|
-
if getv(from_object, ['
|
976
|
-
setv(to_object, ['
|
977
|
-
|
978
|
-
if getv(from_object, ['oidc_config']) is not None:
|
979
|
-
setv(to_object, ['oidcConfig'], getv(from_object, ['oidc_config']))
|
980
|
-
|
981
|
-
return to_object
|
982
|
-
|
1016
|
+
if getv(from_object, ['executable_code']) is not None:
|
1017
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
983
1018
|
|
984
|
-
|
985
|
-
from_object: Union[dict[str, Any], object],
|
986
|
-
parent_object: Optional[dict[str, Any]] = None,
|
987
|
-
) -> dict[str, Any]:
|
988
|
-
to_object: dict[str, Any] = {}
|
989
|
-
if getv(from_object, ['auth_config']) is not None:
|
1019
|
+
if getv(from_object, ['function_response']) is not None:
|
990
1020
|
setv(
|
991
1021
|
to_object,
|
992
|
-
['
|
993
|
-
|
1022
|
+
['functionResponse'],
|
1023
|
+
getv(from_object, ['function_response']),
|
994
1024
|
)
|
995
1025
|
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
def _UrlContext_to_vertex(
|
1000
|
-
from_object: Union[dict[str, Any], object],
|
1001
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1002
|
-
) -> dict[str, Any]:
|
1003
|
-
to_object: dict[str, Any] = {}
|
1026
|
+
if getv(from_object, ['text']) is not None:
|
1027
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
1004
1028
|
|
1005
1029
|
return to_object
|
1006
1030
|
|
1007
1031
|
|
1008
|
-
def
|
1032
|
+
def _Part_to_vertex(
|
1009
1033
|
from_object: Union[dict[str, Any], object],
|
1010
1034
|
parent_object: Optional[dict[str, Any]] = None,
|
1011
1035
|
) -> dict[str, Any]:
|
1012
1036
|
to_object: dict[str, Any] = {}
|
1013
|
-
if getv(from_object, ['
|
1014
|
-
setv(
|
1015
|
-
|
1016
|
-
|
1037
|
+
if getv(from_object, ['video_metadata']) is not None:
|
1038
|
+
setv(
|
1039
|
+
to_object,
|
1040
|
+
['videoMetadata'],
|
1041
|
+
_VideoMetadata_to_vertex(
|
1042
|
+
getv(from_object, ['video_metadata']), to_object
|
1043
|
+
),
|
1044
|
+
)
|
1017
1045
|
|
1046
|
+
if getv(from_object, ['thought']) is not None:
|
1047
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
1018
1048
|
|
1019
|
-
|
1020
|
-
from_object: Union[dict[str, Any], object],
|
1021
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1022
|
-
) -> dict[str, Any]:
|
1023
|
-
to_object: dict[str, Any] = {}
|
1024
|
-
if getv(from_object, ['function_declarations']) is not None:
|
1049
|
+
if getv(from_object, ['inline_data']) is not None:
|
1025
1050
|
setv(
|
1026
1051
|
to_object,
|
1027
|
-
['
|
1028
|
-
[
|
1029
|
-
_FunctionDeclaration_to_vertex(item, to_object)
|
1030
|
-
for item in getv(from_object, ['function_declarations'])
|
1031
|
-
],
|
1052
|
+
['inlineData'],
|
1053
|
+
_Blob_to_vertex(getv(from_object, ['inline_data']), to_object),
|
1032
1054
|
)
|
1033
1055
|
|
1034
|
-
if getv(from_object, ['
|
1035
|
-
setv(
|
1056
|
+
if getv(from_object, ['file_data']) is not None:
|
1057
|
+
setv(
|
1058
|
+
to_object,
|
1059
|
+
['fileData'],
|
1060
|
+
_FileData_to_vertex(getv(from_object, ['file_data']), to_object),
|
1061
|
+
)
|
1036
1062
|
|
1037
|
-
if getv(from_object, ['
|
1063
|
+
if getv(from_object, ['thought_signature']) is not None:
|
1038
1064
|
setv(
|
1039
1065
|
to_object,
|
1040
|
-
['
|
1041
|
-
|
1042
|
-
getv(from_object, ['google_search']), to_object
|
1043
|
-
),
|
1066
|
+
['thoughtSignature'],
|
1067
|
+
getv(from_object, ['thought_signature']),
|
1044
1068
|
)
|
1045
1069
|
|
1046
|
-
if getv(from_object, ['
|
1070
|
+
if getv(from_object, ['function_call']) is not None:
|
1047
1071
|
setv(
|
1048
1072
|
to_object,
|
1049
|
-
['
|
1050
|
-
|
1051
|
-
getv(from_object, ['
|
1073
|
+
['functionCall'],
|
1074
|
+
_FunctionCall_to_vertex(
|
1075
|
+
getv(from_object, ['function_call']), to_object
|
1052
1076
|
),
|
1053
1077
|
)
|
1054
1078
|
|
1055
|
-
if getv(from_object, ['
|
1079
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
1056
1080
|
setv(
|
1057
1081
|
to_object,
|
1058
|
-
['
|
1059
|
-
|
1060
|
-
getv(from_object, ['enterprise_web_search']), to_object
|
1061
|
-
),
|
1082
|
+
['codeExecutionResult'],
|
1083
|
+
getv(from_object, ['code_execution_result']),
|
1062
1084
|
)
|
1063
1085
|
|
1064
|
-
if getv(from_object, ['
|
1086
|
+
if getv(from_object, ['executable_code']) is not None:
|
1087
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
1088
|
+
|
1089
|
+
if getv(from_object, ['function_response']) is not None:
|
1065
1090
|
setv(
|
1066
1091
|
to_object,
|
1067
|
-
['
|
1068
|
-
|
1092
|
+
['functionResponse'],
|
1093
|
+
getv(from_object, ['function_response']),
|
1069
1094
|
)
|
1070
1095
|
|
1071
|
-
if getv(from_object, ['
|
1096
|
+
if getv(from_object, ['text']) is not None:
|
1097
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
1098
|
+
|
1099
|
+
return to_object
|
1100
|
+
|
1101
|
+
|
1102
|
+
def _RetrievalConfig_to_mldev(
|
1103
|
+
from_object: Union[dict[str, Any], object],
|
1104
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1105
|
+
) -> dict[str, Any]:
|
1106
|
+
to_object: dict[str, Any] = {}
|
1107
|
+
if getv(from_object, ['lat_lng']) is not None:
|
1072
1108
|
setv(
|
1073
1109
|
to_object,
|
1074
|
-
['
|
1075
|
-
|
1110
|
+
['latLng'],
|
1111
|
+
_LatLng_to_mldev(getv(from_object, ['lat_lng']), to_object),
|
1076
1112
|
)
|
1077
1113
|
|
1078
|
-
if getv(from_object, ['
|
1114
|
+
if getv(from_object, ['language_code']) is not None:
|
1115
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
1116
|
+
|
1117
|
+
return to_object
|
1118
|
+
|
1119
|
+
|
1120
|
+
def _RetrievalConfig_to_vertex(
|
1121
|
+
from_object: Union[dict[str, Any], object],
|
1122
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1123
|
+
) -> dict[str, Any]:
|
1124
|
+
to_object: dict[str, Any] = {}
|
1125
|
+
if getv(from_object, ['lat_lng']) is not None:
|
1079
1126
|
setv(
|
1080
1127
|
to_object,
|
1081
|
-
['
|
1082
|
-
|
1083
|
-
getv(from_object, ['computer_use']), to_object
|
1084
|
-
),
|
1128
|
+
['latLng'],
|
1129
|
+
_LatLng_to_vertex(getv(from_object, ['lat_lng']), to_object),
|
1085
1130
|
)
|
1086
1131
|
|
1087
|
-
if getv(from_object, ['
|
1088
|
-
setv(to_object, ['
|
1132
|
+
if getv(from_object, ['language_code']) is not None:
|
1133
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
1089
1134
|
|
1090
1135
|
return to_object
|
1091
1136
|
|
1092
1137
|
|
1093
|
-
def
|
1138
|
+
def _ToolComputerUse_to_mldev(
|
1094
1139
|
from_object: Union[dict[str, Any], object],
|
1095
1140
|
parent_object: Optional[dict[str, Any]] = None,
|
1096
1141
|
) -> dict[str, Any]:
|
1097
1142
|
to_object: dict[str, Any] = {}
|
1098
|
-
if getv(from_object, ['
|
1099
|
-
setv(to_object, ['
|
1143
|
+
if getv(from_object, ['environment']) is not None:
|
1144
|
+
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
1100
1145
|
|
1101
|
-
if getv(from_object, ['
|
1146
|
+
if getv(from_object, ['excluded_predefined_functions']) is not None:
|
1102
1147
|
setv(
|
1103
1148
|
to_object,
|
1104
|
-
['
|
1105
|
-
getv(from_object, ['
|
1149
|
+
['excludedPredefinedFunctions'],
|
1150
|
+
getv(from_object, ['excluded_predefined_functions']),
|
1106
1151
|
)
|
1107
1152
|
|
1108
1153
|
return to_object
|
1109
1154
|
|
1110
1155
|
|
1111
|
-
def
|
1156
|
+
def _ToolComputerUse_to_vertex(
|
1112
1157
|
from_object: Union[dict[str, Any], object],
|
1113
1158
|
parent_object: Optional[dict[str, Any]] = None,
|
1114
1159
|
) -> dict[str, Any]:
|
1115
1160
|
to_object: dict[str, Any] = {}
|
1116
|
-
if getv(from_object, ['
|
1117
|
-
setv(to_object, ['
|
1161
|
+
if getv(from_object, ['environment']) is not None:
|
1162
|
+
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
1118
1163
|
|
1119
|
-
if getv(from_object, ['
|
1120
|
-
setv(
|
1164
|
+
if getv(from_object, ['excluded_predefined_functions']) is not None:
|
1165
|
+
setv(
|
1166
|
+
to_object,
|
1167
|
+
['excludedPredefinedFunctions'],
|
1168
|
+
getv(from_object, ['excluded_predefined_functions']),
|
1169
|
+
)
|
1121
1170
|
|
1122
1171
|
return to_object
|
1123
1172
|
|
1124
1173
|
|
1125
|
-
def
|
1174
|
+
def _ToolConfig_to_mldev(
|
1126
1175
|
from_object: Union[dict[str, Any], object],
|
1127
1176
|
parent_object: Optional[dict[str, Any]] = None,
|
1128
1177
|
) -> dict[str, Any]:
|
1129
1178
|
to_object: dict[str, Any] = {}
|
1130
|
-
if getv(from_object, ['
|
1179
|
+
if getv(from_object, ['function_calling_config']) is not None:
|
1131
1180
|
setv(
|
1132
1181
|
to_object,
|
1133
|
-
['
|
1134
|
-
|
1182
|
+
['functionCallingConfig'],
|
1183
|
+
_FunctionCallingConfig_to_mldev(
|
1184
|
+
getv(from_object, ['function_calling_config']), to_object
|
1185
|
+
),
|
1135
1186
|
)
|
1136
1187
|
|
1137
|
-
if getv(from_object, ['
|
1138
|
-
setv(
|
1188
|
+
if getv(from_object, ['retrieval_config']) is not None:
|
1189
|
+
setv(
|
1190
|
+
to_object,
|
1191
|
+
['retrievalConfig'],
|
1192
|
+
_RetrievalConfig_to_mldev(
|
1193
|
+
getv(from_object, ['retrieval_config']), to_object
|
1194
|
+
),
|
1195
|
+
)
|
1139
1196
|
|
1140
1197
|
return to_object
|
1141
1198
|
|
@@ -1166,126 +1223,155 @@ def _ToolConfig_to_vertex(
|
|
1166
1223
|
return to_object
|
1167
1224
|
|
1168
1225
|
|
1169
|
-
def
|
1226
|
+
def _Tool_to_mldev(
|
1170
1227
|
from_object: Union[dict[str, Any], object],
|
1171
1228
|
parent_object: Optional[dict[str, Any]] = None,
|
1172
1229
|
) -> dict[str, Any]:
|
1173
1230
|
to_object: dict[str, Any] = {}
|
1174
|
-
|
1175
|
-
if getv(from_object, ['ttl']) is not None:
|
1176
|
-
setv(parent_object, ['ttl'], getv(from_object, ['ttl']))
|
1177
|
-
|
1178
|
-
if getv(from_object, ['expire_time']) is not None:
|
1179
|
-
setv(parent_object, ['expireTime'], getv(from_object, ['expire_time']))
|
1180
|
-
|
1181
|
-
if getv(from_object, ['display_name']) is not None:
|
1182
|
-
setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
|
1183
|
-
|
1184
|
-
if getv(from_object, ['contents']) is not None:
|
1231
|
+
if getv(from_object, ['function_declarations']) is not None:
|
1185
1232
|
setv(
|
1186
|
-
|
1187
|
-
['
|
1233
|
+
to_object,
|
1234
|
+
['functionDeclarations'],
|
1188
1235
|
[
|
1189
|
-
|
1190
|
-
for item in
|
1236
|
+
_FunctionDeclaration_to_mldev(item, to_object)
|
1237
|
+
for item in getv(from_object, ['function_declarations'])
|
1191
1238
|
],
|
1192
1239
|
)
|
1193
1240
|
|
1194
|
-
if getv(from_object, ['
|
1241
|
+
if getv(from_object, ['retrieval']) is not None:
|
1242
|
+
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
1243
|
+
|
1244
|
+
if getv(from_object, ['google_search']) is not None:
|
1195
1245
|
setv(
|
1196
|
-
|
1197
|
-
['
|
1198
|
-
|
1199
|
-
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
1200
|
-
),
|
1246
|
+
to_object,
|
1247
|
+
['googleSearch'],
|
1248
|
+
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
1201
1249
|
)
|
1202
1250
|
|
1203
|
-
if getv(from_object, ['
|
1251
|
+
if getv(from_object, ['google_search_retrieval']) is not None:
|
1204
1252
|
setv(
|
1205
|
-
|
1206
|
-
['
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
],
|
1253
|
+
to_object,
|
1254
|
+
['googleSearchRetrieval'],
|
1255
|
+
_GoogleSearchRetrieval_to_mldev(
|
1256
|
+
getv(from_object, ['google_search_retrieval']), to_object
|
1257
|
+
),
|
1211
1258
|
)
|
1212
1259
|
|
1213
|
-
if getv(from_object, ['
|
1260
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
1261
|
+
raise ValueError(
|
1262
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
1263
|
+
)
|
1264
|
+
|
1265
|
+
if getv(from_object, ['google_maps']) is not None:
|
1266
|
+
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
1267
|
+
|
1268
|
+
if getv(from_object, ['url_context']) is not None:
|
1214
1269
|
setv(
|
1215
|
-
|
1216
|
-
['
|
1217
|
-
|
1270
|
+
to_object,
|
1271
|
+
['urlContext'],
|
1272
|
+
_UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
|
1218
1273
|
)
|
1219
1274
|
|
1220
|
-
if getv(from_object, ['
|
1275
|
+
if getv(from_object, ['computer_use']) is not None:
|
1221
1276
|
setv(
|
1222
|
-
|
1223
|
-
['
|
1224
|
-
|
1277
|
+
to_object,
|
1278
|
+
['computerUse'],
|
1279
|
+
_ToolComputerUse_to_mldev(
|
1280
|
+
getv(from_object, ['computer_use']), to_object
|
1281
|
+
),
|
1225
1282
|
)
|
1226
1283
|
|
1284
|
+
if getv(from_object, ['code_execution']) is not None:
|
1285
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
1286
|
+
|
1227
1287
|
return to_object
|
1228
1288
|
|
1229
1289
|
|
1230
|
-
def
|
1231
|
-
api_client: BaseApiClient,
|
1290
|
+
def _Tool_to_vertex(
|
1232
1291
|
from_object: Union[dict[str, Any], object],
|
1233
1292
|
parent_object: Optional[dict[str, Any]] = None,
|
1234
1293
|
) -> dict[str, Any]:
|
1235
1294
|
to_object: dict[str, Any] = {}
|
1236
|
-
if getv(from_object, ['
|
1295
|
+
if getv(from_object, ['function_declarations']) is not None:
|
1237
1296
|
setv(
|
1238
1297
|
to_object,
|
1239
|
-
['
|
1240
|
-
|
1298
|
+
['functionDeclarations'],
|
1299
|
+
[
|
1300
|
+
_FunctionDeclaration_to_vertex(item, to_object)
|
1301
|
+
for item in getv(from_object, ['function_declarations'])
|
1302
|
+
],
|
1241
1303
|
)
|
1242
1304
|
|
1243
|
-
if getv(from_object, ['
|
1305
|
+
if getv(from_object, ['retrieval']) is not None:
|
1306
|
+
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
1307
|
+
|
1308
|
+
if getv(from_object, ['google_search']) is not None:
|
1244
1309
|
setv(
|
1245
1310
|
to_object,
|
1246
|
-
['
|
1247
|
-
|
1248
|
-
getv(from_object, ['
|
1311
|
+
['googleSearch'],
|
1312
|
+
_GoogleSearch_to_vertex(
|
1313
|
+
getv(from_object, ['google_search']), to_object
|
1249
1314
|
),
|
1250
1315
|
)
|
1251
1316
|
|
1252
|
-
|
1317
|
+
if getv(from_object, ['google_search_retrieval']) is not None:
|
1318
|
+
setv(
|
1319
|
+
to_object,
|
1320
|
+
['googleSearchRetrieval'],
|
1321
|
+
_GoogleSearchRetrieval_to_vertex(
|
1322
|
+
getv(from_object, ['google_search_retrieval']), to_object
|
1323
|
+
),
|
1324
|
+
)
|
1253
1325
|
|
1326
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
1327
|
+
setv(
|
1328
|
+
to_object,
|
1329
|
+
['enterpriseWebSearch'],
|
1330
|
+
_EnterpriseWebSearch_to_vertex(
|
1331
|
+
getv(from_object, ['enterprise_web_search']), to_object
|
1332
|
+
),
|
1333
|
+
)
|
1254
1334
|
|
1255
|
-
|
1256
|
-
api_client: BaseApiClient,
|
1257
|
-
from_object: Union[dict[str, Any], object],
|
1258
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1259
|
-
) -> dict[str, Any]:
|
1260
|
-
to_object: dict[str, Any] = {}
|
1261
|
-
if getv(from_object, ['name']) is not None:
|
1335
|
+
if getv(from_object, ['google_maps']) is not None:
|
1262
1336
|
setv(
|
1263
1337
|
to_object,
|
1264
|
-
['
|
1265
|
-
|
1338
|
+
['googleMaps'],
|
1339
|
+
_GoogleMaps_to_vertex(getv(from_object, ['google_maps']), to_object),
|
1266
1340
|
)
|
1267
1341
|
|
1268
|
-
if getv(from_object, ['
|
1269
|
-
setv(
|
1342
|
+
if getv(from_object, ['url_context']) is not None:
|
1343
|
+
setv(
|
1344
|
+
to_object,
|
1345
|
+
['urlContext'],
|
1346
|
+
_UrlContext_to_vertex(getv(from_object, ['url_context']), to_object),
|
1347
|
+
)
|
1348
|
+
|
1349
|
+
if getv(from_object, ['computer_use']) is not None:
|
1350
|
+
setv(
|
1351
|
+
to_object,
|
1352
|
+
['computerUse'],
|
1353
|
+
_ToolComputerUse_to_vertex(
|
1354
|
+
getv(from_object, ['computer_use']), to_object
|
1355
|
+
),
|
1356
|
+
)
|
1357
|
+
|
1358
|
+
if getv(from_object, ['code_execution']) is not None:
|
1359
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
1270
1360
|
|
1271
1361
|
return to_object
|
1272
1362
|
|
1273
1363
|
|
1274
|
-
def
|
1275
|
-
api_client: BaseApiClient,
|
1364
|
+
def _UpdateCachedContentConfig_to_mldev(
|
1276
1365
|
from_object: Union[dict[str, Any], object],
|
1277
1366
|
parent_object: Optional[dict[str, Any]] = None,
|
1278
1367
|
) -> dict[str, Any]:
|
1279
1368
|
to_object: dict[str, Any] = {}
|
1280
|
-
if getv(from_object, ['name']) is not None:
|
1281
|
-
setv(
|
1282
|
-
to_object,
|
1283
|
-
['_url', 'name'],
|
1284
|
-
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
1285
|
-
)
|
1286
1369
|
|
1287
|
-
if getv(from_object, ['
|
1288
|
-
setv(
|
1370
|
+
if getv(from_object, ['ttl']) is not None:
|
1371
|
+
setv(parent_object, ['ttl'], getv(from_object, ['ttl']))
|
1372
|
+
|
1373
|
+
if getv(from_object, ['expire_time']) is not None:
|
1374
|
+
setv(parent_object, ['expireTime'], getv(from_object, ['expire_time']))
|
1289
1375
|
|
1290
1376
|
return to_object
|
1291
1377
|
|
@@ -1305,7 +1391,7 @@ def _UpdateCachedContentConfig_to_vertex(
|
|
1305
1391
|
return to_object
|
1306
1392
|
|
1307
1393
|
|
1308
|
-
def
|
1394
|
+
def _UpdateCachedContentParameters_to_mldev(
|
1309
1395
|
api_client: BaseApiClient,
|
1310
1396
|
from_object: Union[dict[str, Any], object],
|
1311
1397
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -1319,192 +1405,82 @@ def _UpdateCachedContentParameters_to_vertex(
|
|
1319
1405
|
)
|
1320
1406
|
|
1321
1407
|
if getv(from_object, ['config']) is not None:
|
1322
|
-
|
1323
|
-
to_object
|
1324
|
-
['config'],
|
1325
|
-
_UpdateCachedContentConfig_to_vertex(
|
1326
|
-
getv(from_object, ['config']), to_object
|
1327
|
-
),
|
1408
|
+
_UpdateCachedContentConfig_to_mldev(
|
1409
|
+
getv(from_object, ['config']), to_object
|
1328
1410
|
)
|
1329
1411
|
|
1330
1412
|
return to_object
|
1331
1413
|
|
1332
1414
|
|
1333
|
-
def
|
1415
|
+
def _UpdateCachedContentParameters_to_vertex(
|
1416
|
+
api_client: BaseApiClient,
|
1334
1417
|
from_object: Union[dict[str, Any], object],
|
1335
1418
|
parent_object: Optional[dict[str, Any]] = None,
|
1336
1419
|
) -> dict[str, Any]:
|
1337
1420
|
to_object: dict[str, Any] = {}
|
1338
|
-
|
1339
|
-
if getv(from_object, ['page_size']) is not None:
|
1340
|
-
setv(
|
1341
|
-
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
1342
|
-
)
|
1343
|
-
|
1344
|
-
if getv(from_object, ['page_token']) is not None:
|
1421
|
+
if getv(from_object, ['name']) is not None:
|
1345
1422
|
setv(
|
1346
|
-
|
1347
|
-
['
|
1348
|
-
getv(from_object, ['
|
1423
|
+
to_object,
|
1424
|
+
['_url', 'name'],
|
1425
|
+
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
1349
1426
|
)
|
1350
1427
|
|
1351
|
-
return to_object
|
1352
|
-
|
1353
|
-
|
1354
|
-
def _ListCachedContentsParameters_to_vertex(
|
1355
|
-
from_object: Union[dict[str, Any], object],
|
1356
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1357
|
-
) -> dict[str, Any]:
|
1358
|
-
to_object: dict[str, Any] = {}
|
1359
1428
|
if getv(from_object, ['config']) is not None:
|
1360
|
-
|
1361
|
-
to_object
|
1362
|
-
['config'],
|
1363
|
-
_ListCachedContentsConfig_to_vertex(
|
1364
|
-
getv(from_object, ['config']), to_object
|
1365
|
-
),
|
1429
|
+
_UpdateCachedContentConfig_to_vertex(
|
1430
|
+
getv(from_object, ['config']), to_object
|
1366
1431
|
)
|
1367
1432
|
|
1368
1433
|
return to_object
|
1369
1434
|
|
1370
1435
|
|
1371
|
-
def
|
1372
|
-
if enum_value in set(['UNSPECIFIED', 'BLOCKING', 'NON_BLOCKING']):
|
1373
|
-
raise ValueError(f'{enum_value} enum value is not supported in Vertex AI.')
|
1374
|
-
|
1375
|
-
|
1376
|
-
def _CachedContent_from_mldev(
|
1377
|
-
from_object: Union[dict[str, Any], object],
|
1378
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1379
|
-
) -> dict[str, Any]:
|
1380
|
-
to_object: dict[str, Any] = {}
|
1381
|
-
if getv(from_object, ['name']) is not None:
|
1382
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1383
|
-
|
1384
|
-
if getv(from_object, ['displayName']) is not None:
|
1385
|
-
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
1386
|
-
|
1387
|
-
if getv(from_object, ['model']) is not None:
|
1388
|
-
setv(to_object, ['model'], getv(from_object, ['model']))
|
1389
|
-
|
1390
|
-
if getv(from_object, ['createTime']) is not None:
|
1391
|
-
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
1392
|
-
|
1393
|
-
if getv(from_object, ['updateTime']) is not None:
|
1394
|
-
setv(to_object, ['update_time'], getv(from_object, ['updateTime']))
|
1395
|
-
|
1396
|
-
if getv(from_object, ['expireTime']) is not None:
|
1397
|
-
setv(to_object, ['expire_time'], getv(from_object, ['expireTime']))
|
1398
|
-
|
1399
|
-
if getv(from_object, ['usageMetadata']) is not None:
|
1400
|
-
setv(to_object, ['usage_metadata'], getv(from_object, ['usageMetadata']))
|
1401
|
-
|
1402
|
-
return to_object
|
1403
|
-
|
1404
|
-
|
1405
|
-
def _DeleteCachedContentResponse_from_mldev(
|
1436
|
+
def _UrlContext_to_mldev(
|
1406
1437
|
from_object: Union[dict[str, Any], object],
|
1407
1438
|
parent_object: Optional[dict[str, Any]] = None,
|
1408
1439
|
) -> dict[str, Any]:
|
1409
1440
|
to_object: dict[str, Any] = {}
|
1410
|
-
if getv(from_object, ['sdkHttpResponse']) is not None:
|
1411
|
-
setv(
|
1412
|
-
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
1413
|
-
)
|
1414
1441
|
|
1415
1442
|
return to_object
|
1416
1443
|
|
1417
1444
|
|
1418
|
-
def
|
1445
|
+
def _UrlContext_to_vertex(
|
1419
1446
|
from_object: Union[dict[str, Any], object],
|
1420
1447
|
parent_object: Optional[dict[str, Any]] = None,
|
1421
1448
|
) -> dict[str, Any]:
|
1422
1449
|
to_object: dict[str, Any] = {}
|
1423
|
-
if getv(from_object, ['sdkHttpResponse']) is not None:
|
1424
|
-
setv(
|
1425
|
-
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
1426
|
-
)
|
1427
|
-
|
1428
|
-
if getv(from_object, ['nextPageToken']) is not None:
|
1429
|
-
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
1430
|
-
|
1431
|
-
if getv(from_object, ['cachedContents']) is not None:
|
1432
|
-
setv(
|
1433
|
-
to_object,
|
1434
|
-
['cached_contents'],
|
1435
|
-
[
|
1436
|
-
_CachedContent_from_mldev(item, to_object)
|
1437
|
-
for item in getv(from_object, ['cachedContents'])
|
1438
|
-
],
|
1439
|
-
)
|
1440
1450
|
|
1441
1451
|
return to_object
|
1442
1452
|
|
1443
1453
|
|
1444
|
-
def
|
1454
|
+
def _VideoMetadata_to_mldev(
|
1445
1455
|
from_object: Union[dict[str, Any], object],
|
1446
1456
|
parent_object: Optional[dict[str, Any]] = None,
|
1447
1457
|
) -> dict[str, Any]:
|
1448
1458
|
to_object: dict[str, Any] = {}
|
1449
|
-
if getv(from_object, ['
|
1450
|
-
setv(to_object, ['
|
1451
|
-
|
1452
|
-
if getv(from_object, ['displayName']) is not None:
|
1453
|
-
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
1454
|
-
|
1455
|
-
if getv(from_object, ['model']) is not None:
|
1456
|
-
setv(to_object, ['model'], getv(from_object, ['model']))
|
1457
|
-
|
1458
|
-
if getv(from_object, ['createTime']) is not None:
|
1459
|
-
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
1460
|
-
|
1461
|
-
if getv(from_object, ['updateTime']) is not None:
|
1462
|
-
setv(to_object, ['update_time'], getv(from_object, ['updateTime']))
|
1463
|
-
|
1464
|
-
if getv(from_object, ['expireTime']) is not None:
|
1465
|
-
setv(to_object, ['expire_time'], getv(from_object, ['expireTime']))
|
1466
|
-
|
1467
|
-
if getv(from_object, ['usageMetadata']) is not None:
|
1468
|
-
setv(to_object, ['usage_metadata'], getv(from_object, ['usageMetadata']))
|
1469
|
-
|
1470
|
-
return to_object
|
1459
|
+
if getv(from_object, ['fps']) is not None:
|
1460
|
+
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
1471
1461
|
|
1462
|
+
if getv(from_object, ['end_offset']) is not None:
|
1463
|
+
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
1472
1464
|
|
1473
|
-
|
1474
|
-
|
1475
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1476
|
-
) -> dict[str, Any]:
|
1477
|
-
to_object: dict[str, Any] = {}
|
1478
|
-
if getv(from_object, ['sdkHttpResponse']) is not None:
|
1479
|
-
setv(
|
1480
|
-
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
1481
|
-
)
|
1465
|
+
if getv(from_object, ['start_offset']) is not None:
|
1466
|
+
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
1482
1467
|
|
1483
1468
|
return to_object
|
1484
1469
|
|
1485
1470
|
|
1486
|
-
def
|
1471
|
+
def _VideoMetadata_to_vertex(
|
1487
1472
|
from_object: Union[dict[str, Any], object],
|
1488
1473
|
parent_object: Optional[dict[str, Any]] = None,
|
1489
1474
|
) -> dict[str, Any]:
|
1490
1475
|
to_object: dict[str, Any] = {}
|
1491
|
-
if getv(from_object, ['
|
1492
|
-
setv(
|
1493
|
-
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
1494
|
-
)
|
1476
|
+
if getv(from_object, ['fps']) is not None:
|
1477
|
+
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
1495
1478
|
|
1496
|
-
if getv(from_object, ['
|
1497
|
-
setv(to_object, ['
|
1479
|
+
if getv(from_object, ['end_offset']) is not None:
|
1480
|
+
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
1498
1481
|
|
1499
|
-
if getv(from_object, ['
|
1500
|
-
setv(
|
1501
|
-
to_object,
|
1502
|
-
['cached_contents'],
|
1503
|
-
[
|
1504
|
-
_CachedContent_from_vertex(item, to_object)
|
1505
|
-
for item in getv(from_object, ['cachedContents'])
|
1506
|
-
],
|
1507
|
-
)
|
1482
|
+
if getv(from_object, ['start_offset']) is not None:
|
1483
|
+
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
1508
1484
|
|
1509
1485
|
return to_object
|
1510
1486
|
|