google-genai 1.41.0__py3-none-any.whl → 1.42.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 +2 -1
- google/genai/_common.py +213 -77
- google/genai/_live_converters.py +720 -3119
- google/genai/_replay_api_client.py +8 -4
- google/genai/_tokens_converters.py +14 -443
- google/genai/_transformers.py +42 -12
- google/genai/batches.py +113 -1063
- google/genai/caches.py +67 -863
- google/genai/errors.py +9 -2
- google/genai/files.py +12 -171
- google/genai/live.py +10 -11
- google/genai/live_music.py +24 -27
- google/genai/models.py +322 -1835
- google/genai/operations.py +6 -32
- google/genai/tokens.py +2 -12
- google/genai/tunings.py +18 -197
- google/genai/types.py +86 -3
- google/genai/version.py +1 -1
- {google_genai-1.41.0.dist-info → google_genai-1.42.0.dist-info}/METADATA +40 -38
- google_genai-1.42.0.dist-info/RECORD +39 -0
- google_genai-1.41.0.dist-info/RECORD +0 -39
- {google_genai-1.41.0.dist-info → google_genai-1.42.0.dist-info}/WHEEL +0 -0
- {google_genai-1.41.0.dist-info → google_genai-1.42.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.41.0.dist-info → google_genai-1.42.0.dist-info}/top_level.txt +0 -0
google/genai/caches.py
CHANGED
@@ -33,62 +33,6 @@ from .pagers import AsyncPager, Pager
|
|
33
33
|
logger = logging.getLogger('google_genai.caches')
|
34
34
|
|
35
35
|
|
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(
|
42
|
-
from_object: Union[dict[str, Any], object],
|
43
|
-
parent_object: Optional[dict[str, Any]] = None,
|
44
|
-
) -> dict[str, Any]:
|
45
|
-
to_object: dict[str, Any] = {}
|
46
|
-
if getv(from_object, ['api_key_string']) is not None:
|
47
|
-
setv(to_object, ['apiKeyString'], getv(from_object, ['api_key_string']))
|
48
|
-
|
49
|
-
return to_object
|
50
|
-
|
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']))
|
88
|
-
|
89
|
-
return to_object
|
90
|
-
|
91
|
-
|
92
36
|
def _Blob_to_mldev(
|
93
37
|
from_object: Union[dict[str, Any], object],
|
94
38
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -106,117 +50,6 @@ def _Blob_to_mldev(
|
|
106
50
|
return to_object
|
107
51
|
|
108
52
|
|
109
|
-
def _Blob_to_vertex(
|
110
|
-
from_object: Union[dict[str, Any], object],
|
111
|
-
parent_object: Optional[dict[str, Any]] = None,
|
112
|
-
) -> dict[str, Any]:
|
113
|
-
to_object: dict[str, Any] = {}
|
114
|
-
if getv(from_object, ['display_name']) is not None:
|
115
|
-
setv(to_object, ['displayName'], getv(from_object, ['display_name']))
|
116
|
-
|
117
|
-
if getv(from_object, ['data']) is not None:
|
118
|
-
setv(to_object, ['data'], getv(from_object, ['data']))
|
119
|
-
|
120
|
-
if getv(from_object, ['mime_type']) is not None:
|
121
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
122
|
-
|
123
|
-
return to_object
|
124
|
-
|
125
|
-
|
126
|
-
def _CachedContent_from_mldev(
|
127
|
-
from_object: Union[dict[str, Any], object],
|
128
|
-
parent_object: Optional[dict[str, Any]] = None,
|
129
|
-
) -> dict[str, Any]:
|
130
|
-
to_object: dict[str, Any] = {}
|
131
|
-
if getv(from_object, ['name']) is not None:
|
132
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
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
|
-
|
152
|
-
return to_object
|
153
|
-
|
154
|
-
|
155
|
-
def _CachedContent_from_vertex(
|
156
|
-
from_object: Union[dict[str, Any], object],
|
157
|
-
parent_object: Optional[dict[str, Any]] = None,
|
158
|
-
) -> dict[str, Any]:
|
159
|
-
to_object: dict[str, Any] = {}
|
160
|
-
if getv(from_object, ['name']) is not None:
|
161
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
162
|
-
|
163
|
-
if getv(from_object, ['displayName']) is not None:
|
164
|
-
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
165
|
-
|
166
|
-
if getv(from_object, ['model']) is not None:
|
167
|
-
setv(to_object, ['model'], getv(from_object, ['model']))
|
168
|
-
|
169
|
-
if getv(from_object, ['createTime']) is not None:
|
170
|
-
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
171
|
-
|
172
|
-
if getv(from_object, ['updateTime']) is not None:
|
173
|
-
setv(to_object, ['update_time'], getv(from_object, ['updateTime']))
|
174
|
-
|
175
|
-
if getv(from_object, ['expireTime']) is not None:
|
176
|
-
setv(to_object, ['expire_time'], getv(from_object, ['expireTime']))
|
177
|
-
|
178
|
-
if getv(from_object, ['usageMetadata']) is not None:
|
179
|
-
setv(to_object, ['usage_metadata'], getv(from_object, ['usageMetadata']))
|
180
|
-
|
181
|
-
return to_object
|
182
|
-
|
183
|
-
|
184
|
-
def _ComputerUse_to_mldev(
|
185
|
-
from_object: Union[dict[str, Any], object],
|
186
|
-
parent_object: Optional[dict[str, Any]] = None,
|
187
|
-
) -> dict[str, Any]:
|
188
|
-
to_object: dict[str, Any] = {}
|
189
|
-
if getv(from_object, ['environment']) is not None:
|
190
|
-
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
191
|
-
|
192
|
-
if getv(from_object, ['excluded_predefined_functions']) is not None:
|
193
|
-
setv(
|
194
|
-
to_object,
|
195
|
-
['excludedPredefinedFunctions'],
|
196
|
-
getv(from_object, ['excluded_predefined_functions']),
|
197
|
-
)
|
198
|
-
|
199
|
-
return to_object
|
200
|
-
|
201
|
-
|
202
|
-
def _ComputerUse_to_vertex(
|
203
|
-
from_object: Union[dict[str, Any], object],
|
204
|
-
parent_object: Optional[dict[str, Any]] = None,
|
205
|
-
) -> dict[str, Any]:
|
206
|
-
to_object: dict[str, Any] = {}
|
207
|
-
if getv(from_object, ['environment']) is not None:
|
208
|
-
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
209
|
-
|
210
|
-
if getv(from_object, ['excluded_predefined_functions']) is not None:
|
211
|
-
setv(
|
212
|
-
to_object,
|
213
|
-
['excludedPredefinedFunctions'],
|
214
|
-
getv(from_object, ['excluded_predefined_functions']),
|
215
|
-
)
|
216
|
-
|
217
|
-
return to_object
|
218
|
-
|
219
|
-
|
220
53
|
def _Content_to_mldev(
|
221
54
|
from_object: Union[dict[str, Any], object],
|
222
55
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -238,27 +71,6 @@ def _Content_to_mldev(
|
|
238
71
|
return to_object
|
239
72
|
|
240
73
|
|
241
|
-
def _Content_to_vertex(
|
242
|
-
from_object: Union[dict[str, Any], object],
|
243
|
-
parent_object: Optional[dict[str, Any]] = None,
|
244
|
-
) -> dict[str, Any]:
|
245
|
-
to_object: dict[str, Any] = {}
|
246
|
-
if getv(from_object, ['parts']) is not None:
|
247
|
-
setv(
|
248
|
-
to_object,
|
249
|
-
['parts'],
|
250
|
-
[
|
251
|
-
_Part_to_vertex(item, to_object)
|
252
|
-
for item in getv(from_object, ['parts'])
|
253
|
-
],
|
254
|
-
)
|
255
|
-
|
256
|
-
if getv(from_object, ['role']) is not None:
|
257
|
-
setv(to_object, ['role'], getv(from_object, ['role']))
|
258
|
-
|
259
|
-
return to_object
|
260
|
-
|
261
|
-
|
262
74
|
def _CreateCachedContentConfig_to_mldev(
|
263
75
|
from_object: Union[dict[str, Any], object],
|
264
76
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -304,11 +116,7 @@ def _CreateCachedContentConfig_to_mldev(
|
|
304
116
|
)
|
305
117
|
|
306
118
|
if getv(from_object, ['tool_config']) is not None:
|
307
|
-
setv(
|
308
|
-
parent_object,
|
309
|
-
['toolConfig'],
|
310
|
-
_ToolConfig_to_mldev(getv(from_object, ['tool_config']), to_object),
|
311
|
-
)
|
119
|
+
setv(parent_object, ['toolConfig'], getv(from_object, ['tool_config']))
|
312
120
|
|
313
121
|
if getv(from_object, ['kms_key_name']) is not None:
|
314
122
|
raise ValueError('kms_key_name parameter is not supported in Gemini API.')
|
@@ -335,19 +143,14 @@ def _CreateCachedContentConfig_to_vertex(
|
|
335
143
|
setv(
|
336
144
|
parent_object,
|
337
145
|
['contents'],
|
338
|
-
[
|
339
|
-
_Content_to_vertex(item, to_object)
|
340
|
-
for item in t.t_contents(getv(from_object, ['contents']))
|
341
|
-
],
|
146
|
+
[item for item in t.t_contents(getv(from_object, ['contents']))],
|
342
147
|
)
|
343
148
|
|
344
149
|
if getv(from_object, ['system_instruction']) is not None:
|
345
150
|
setv(
|
346
151
|
parent_object,
|
347
152
|
['systemInstruction'],
|
348
|
-
|
349
|
-
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
350
|
-
),
|
153
|
+
t.t_content(getv(from_object, ['system_instruction'])),
|
351
154
|
)
|
352
155
|
|
353
156
|
if getv(from_object, ['tools']) is not None:
|
@@ -361,11 +164,7 @@ def _CreateCachedContentConfig_to_vertex(
|
|
361
164
|
)
|
362
165
|
|
363
166
|
if getv(from_object, ['tool_config']) is not None:
|
364
|
-
setv(
|
365
|
-
parent_object,
|
366
|
-
['toolConfig'],
|
367
|
-
_ToolConfig_to_vertex(getv(from_object, ['tool_config']), to_object),
|
368
|
-
)
|
167
|
+
setv(parent_object, ['toolConfig'], getv(from_object, ['tool_config']))
|
369
168
|
|
370
169
|
if getv(from_object, ['kms_key_name']) is not None:
|
371
170
|
setv(
|
@@ -477,53 +276,6 @@ def _DeleteCachedContentResponse_from_vertex(
|
|
477
276
|
return to_object
|
478
277
|
|
479
278
|
|
480
|
-
def _DynamicRetrievalConfig_to_mldev(
|
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, ['mode']) is not None:
|
486
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
487
|
-
|
488
|
-
if getv(from_object, ['dynamic_threshold']) is not None:
|
489
|
-
setv(
|
490
|
-
to_object,
|
491
|
-
['dynamicThreshold'],
|
492
|
-
getv(from_object, ['dynamic_threshold']),
|
493
|
-
)
|
494
|
-
|
495
|
-
return to_object
|
496
|
-
|
497
|
-
|
498
|
-
def _DynamicRetrievalConfig_to_vertex(
|
499
|
-
from_object: Union[dict[str, Any], object],
|
500
|
-
parent_object: Optional[dict[str, Any]] = None,
|
501
|
-
) -> dict[str, Any]:
|
502
|
-
to_object: dict[str, Any] = {}
|
503
|
-
if getv(from_object, ['mode']) is not None:
|
504
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
505
|
-
|
506
|
-
if getv(from_object, ['dynamic_threshold']) is not None:
|
507
|
-
setv(
|
508
|
-
to_object,
|
509
|
-
['dynamicThreshold'],
|
510
|
-
getv(from_object, ['dynamic_threshold']),
|
511
|
-
)
|
512
|
-
|
513
|
-
return to_object
|
514
|
-
|
515
|
-
|
516
|
-
def _EnterpriseWebSearch_to_vertex(
|
517
|
-
from_object: Union[dict[str, Any], object],
|
518
|
-
parent_object: Optional[dict[str, Any]] = None,
|
519
|
-
) -> dict[str, Any]:
|
520
|
-
to_object: dict[str, Any] = {}
|
521
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
522
|
-
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
523
|
-
|
524
|
-
return to_object
|
525
|
-
|
526
|
-
|
527
279
|
def _FileData_to_mldev(
|
528
280
|
from_object: Union[dict[str, Any], object],
|
529
281
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -541,130 +293,6 @@ def _FileData_to_mldev(
|
|
541
293
|
return to_object
|
542
294
|
|
543
295
|
|
544
|
-
def _FileData_to_vertex(
|
545
|
-
from_object: Union[dict[str, Any], object],
|
546
|
-
parent_object: Optional[dict[str, Any]] = None,
|
547
|
-
) -> dict[str, Any]:
|
548
|
-
to_object: dict[str, Any] = {}
|
549
|
-
if getv(from_object, ['display_name']) is not None:
|
550
|
-
setv(to_object, ['displayName'], getv(from_object, ['display_name']))
|
551
|
-
|
552
|
-
if getv(from_object, ['file_uri']) is not None:
|
553
|
-
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
554
|
-
|
555
|
-
if getv(from_object, ['mime_type']) is not None:
|
556
|
-
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
557
|
-
|
558
|
-
return to_object
|
559
|
-
|
560
|
-
|
561
|
-
def _FunctionCall_to_mldev(
|
562
|
-
from_object: Union[dict[str, Any], object],
|
563
|
-
parent_object: Optional[dict[str, Any]] = None,
|
564
|
-
) -> dict[str, Any]:
|
565
|
-
to_object: dict[str, Any] = {}
|
566
|
-
if getv(from_object, ['id']) is not None:
|
567
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
568
|
-
|
569
|
-
if getv(from_object, ['args']) is not None:
|
570
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
571
|
-
|
572
|
-
if getv(from_object, ['name']) is not None:
|
573
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
574
|
-
|
575
|
-
return to_object
|
576
|
-
|
577
|
-
|
578
|
-
def _FunctionCall_to_vertex(
|
579
|
-
from_object: Union[dict[str, Any], object],
|
580
|
-
parent_object: Optional[dict[str, Any]] = None,
|
581
|
-
) -> dict[str, Any]:
|
582
|
-
to_object: dict[str, Any] = {}
|
583
|
-
if getv(from_object, ['id']) is not None:
|
584
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
585
|
-
|
586
|
-
if getv(from_object, ['args']) is not None:
|
587
|
-
setv(to_object, ['args'], getv(from_object, ['args']))
|
588
|
-
|
589
|
-
if getv(from_object, ['name']) is not None:
|
590
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
591
|
-
|
592
|
-
return to_object
|
593
|
-
|
594
|
-
|
595
|
-
def _FunctionCallingConfig_to_mldev(
|
596
|
-
from_object: Union[dict[str, Any], object],
|
597
|
-
parent_object: Optional[dict[str, Any]] = None,
|
598
|
-
) -> dict[str, Any]:
|
599
|
-
to_object: dict[str, Any] = {}
|
600
|
-
if getv(from_object, ['mode']) is not None:
|
601
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
602
|
-
|
603
|
-
if getv(from_object, ['allowed_function_names']) is not None:
|
604
|
-
setv(
|
605
|
-
to_object,
|
606
|
-
['allowedFunctionNames'],
|
607
|
-
getv(from_object, ['allowed_function_names']),
|
608
|
-
)
|
609
|
-
|
610
|
-
return to_object
|
611
|
-
|
612
|
-
|
613
|
-
def _FunctionCallingConfig_to_vertex(
|
614
|
-
from_object: Union[dict[str, Any], object],
|
615
|
-
parent_object: Optional[dict[str, Any]] = None,
|
616
|
-
) -> dict[str, Any]:
|
617
|
-
to_object: dict[str, Any] = {}
|
618
|
-
if getv(from_object, ['mode']) is not None:
|
619
|
-
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
620
|
-
|
621
|
-
if getv(from_object, ['allowed_function_names']) is not None:
|
622
|
-
setv(
|
623
|
-
to_object,
|
624
|
-
['allowedFunctionNames'],
|
625
|
-
getv(from_object, ['allowed_function_names']),
|
626
|
-
)
|
627
|
-
|
628
|
-
return to_object
|
629
|
-
|
630
|
-
|
631
|
-
def _FunctionDeclaration_to_mldev(
|
632
|
-
from_object: Union[dict[str, Any], object],
|
633
|
-
parent_object: Optional[dict[str, Any]] = None,
|
634
|
-
) -> dict[str, Any]:
|
635
|
-
to_object: dict[str, Any] = {}
|
636
|
-
if getv(from_object, ['behavior']) is not None:
|
637
|
-
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
638
|
-
|
639
|
-
if getv(from_object, ['description']) is not None:
|
640
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
641
|
-
|
642
|
-
if getv(from_object, ['name']) is not None:
|
643
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
644
|
-
|
645
|
-
if getv(from_object, ['parameters']) is not None:
|
646
|
-
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
647
|
-
|
648
|
-
if getv(from_object, ['parameters_json_schema']) is not None:
|
649
|
-
setv(
|
650
|
-
to_object,
|
651
|
-
['parametersJsonSchema'],
|
652
|
-
getv(from_object, ['parameters_json_schema']),
|
653
|
-
)
|
654
|
-
|
655
|
-
if getv(from_object, ['response']) is not None:
|
656
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
657
|
-
|
658
|
-
if getv(from_object, ['response_json_schema']) is not None:
|
659
|
-
setv(
|
660
|
-
to_object,
|
661
|
-
['responseJsonSchema'],
|
662
|
-
getv(from_object, ['response_json_schema']),
|
663
|
-
)
|
664
|
-
|
665
|
-
return to_object
|
666
|
-
|
667
|
-
|
668
296
|
def _FunctionDeclaration_to_vertex(
|
669
297
|
from_object: Union[dict[str, Any], object],
|
670
298
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -687,194 +315,67 @@ def _FunctionDeclaration_to_vertex(
|
|
687
315
|
to_object,
|
688
316
|
['parametersJsonSchema'],
|
689
317
|
getv(from_object, ['parameters_json_schema']),
|
690
|
-
)
|
691
|
-
|
692
|
-
if getv(from_object, ['response']) is not None:
|
693
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
694
|
-
|
695
|
-
if getv(from_object, ['response_json_schema']) is not None:
|
696
|
-
setv(
|
697
|
-
to_object,
|
698
|
-
['responseJsonSchema'],
|
699
|
-
getv(from_object, ['response_json_schema']),
|
700
|
-
)
|
701
|
-
|
702
|
-
return to_object
|
703
|
-
|
704
|
-
|
705
|
-
def _GetCachedContentParameters_to_mldev(
|
706
|
-
api_client: BaseApiClient,
|
707
|
-
from_object: Union[dict[str, Any], object],
|
708
|
-
parent_object: Optional[dict[str, Any]] = None,
|
709
|
-
) -> dict[str, Any]:
|
710
|
-
to_object: dict[str, Any] = {}
|
711
|
-
if getv(from_object, ['name']) is not None:
|
712
|
-
setv(
|
713
|
-
to_object,
|
714
|
-
['_url', 'name'],
|
715
|
-
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
716
|
-
)
|
717
|
-
|
718
|
-
return to_object
|
719
|
-
|
720
|
-
|
721
|
-
def _GetCachedContentParameters_to_vertex(
|
722
|
-
api_client: BaseApiClient,
|
723
|
-
from_object: Union[dict[str, Any], object],
|
724
|
-
parent_object: Optional[dict[str, Any]] = None,
|
725
|
-
) -> dict[str, Any]:
|
726
|
-
to_object: dict[str, Any] = {}
|
727
|
-
if getv(from_object, ['name']) is not None:
|
728
|
-
setv(
|
729
|
-
to_object,
|
730
|
-
['_url', 'name'],
|
731
|
-
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
732
|
-
)
|
733
|
-
|
734
|
-
return to_object
|
735
|
-
|
736
|
-
|
737
|
-
def _GoogleMaps_to_vertex(
|
738
|
-
from_object: Union[dict[str, Any], object],
|
739
|
-
parent_object: Optional[dict[str, Any]] = None,
|
740
|
-
) -> dict[str, Any]:
|
741
|
-
to_object: dict[str, Any] = {}
|
742
|
-
if getv(from_object, ['auth_config']) is not None:
|
743
|
-
setv(
|
744
|
-
to_object,
|
745
|
-
['authConfig'],
|
746
|
-
_AuthConfig_to_vertex(getv(from_object, ['auth_config']), to_object),
|
747
|
-
)
|
748
|
-
|
749
|
-
return to_object
|
750
|
-
|
751
|
-
|
752
|
-
def _GoogleSearchRetrieval_to_mldev(
|
753
|
-
from_object: Union[dict[str, Any], object],
|
754
|
-
parent_object: Optional[dict[str, Any]] = None,
|
755
|
-
) -> dict[str, Any]:
|
756
|
-
to_object: dict[str, Any] = {}
|
757
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
758
|
-
setv(
|
759
|
-
to_object,
|
760
|
-
['dynamicRetrievalConfig'],
|
761
|
-
_DynamicRetrievalConfig_to_mldev(
|
762
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
763
|
-
),
|
764
|
-
)
|
765
|
-
|
766
|
-
return to_object
|
767
|
-
|
768
|
-
|
769
|
-
def _GoogleSearchRetrieval_to_vertex(
|
770
|
-
from_object: Union[dict[str, Any], object],
|
771
|
-
parent_object: Optional[dict[str, Any]] = None,
|
772
|
-
) -> dict[str, Any]:
|
773
|
-
to_object: dict[str, Any] = {}
|
774
|
-
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
775
|
-
setv(
|
776
|
-
to_object,
|
777
|
-
['dynamicRetrievalConfig'],
|
778
|
-
_DynamicRetrievalConfig_to_vertex(
|
779
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
780
|
-
),
|
781
|
-
)
|
782
|
-
|
783
|
-
return to_object
|
784
|
-
|
785
|
-
|
786
|
-
def _GoogleSearch_to_mldev(
|
787
|
-
from_object: Union[dict[str, Any], object],
|
788
|
-
parent_object: Optional[dict[str, Any]] = None,
|
789
|
-
) -> dict[str, Any]:
|
790
|
-
to_object: dict[str, Any] = {}
|
791
|
-
if getv(from_object, ['time_range_filter']) is not None:
|
792
|
-
setv(
|
793
|
-
to_object,
|
794
|
-
['timeRangeFilter'],
|
795
|
-
_Interval_to_mldev(getv(from_object, ['time_range_filter']), to_object),
|
796
|
-
)
|
797
|
-
|
798
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
799
|
-
raise ValueError(
|
800
|
-
'exclude_domains parameter is not supported in Gemini API.'
|
801
|
-
)
|
802
|
-
|
803
|
-
return to_object
|
804
|
-
|
805
|
-
|
806
|
-
def _GoogleSearch_to_vertex(
|
807
|
-
from_object: Union[dict[str, Any], object],
|
808
|
-
parent_object: Optional[dict[str, Any]] = None,
|
809
|
-
) -> dict[str, Any]:
|
810
|
-
to_object: dict[str, Any] = {}
|
811
|
-
if getv(from_object, ['time_range_filter']) is not None:
|
812
|
-
setv(
|
813
|
-
to_object,
|
814
|
-
['timeRangeFilter'],
|
815
|
-
_Interval_to_vertex(
|
816
|
-
getv(from_object, ['time_range_filter']), to_object
|
817
|
-
),
|
818
|
-
)
|
819
|
-
|
820
|
-
if getv(from_object, ['exclude_domains']) is not None:
|
821
|
-
setv(to_object, ['excludeDomains'], getv(from_object, ['exclude_domains']))
|
822
|
-
|
823
|
-
return to_object
|
824
|
-
|
825
|
-
|
826
|
-
def _Interval_to_mldev(
|
827
|
-
from_object: Union[dict[str, Any], object],
|
828
|
-
parent_object: Optional[dict[str, Any]] = None,
|
829
|
-
) -> dict[str, Any]:
|
830
|
-
to_object: dict[str, Any] = {}
|
831
|
-
if getv(from_object, ['start_time']) is not None:
|
832
|
-
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
318
|
+
)
|
319
|
+
|
320
|
+
if getv(from_object, ['response']) is not None:
|
321
|
+
setv(to_object, ['response'], getv(from_object, ['response']))
|
833
322
|
|
834
|
-
if getv(from_object, ['
|
835
|
-
setv(
|
323
|
+
if getv(from_object, ['response_json_schema']) is not None:
|
324
|
+
setv(
|
325
|
+
to_object,
|
326
|
+
['responseJsonSchema'],
|
327
|
+
getv(from_object, ['response_json_schema']),
|
328
|
+
)
|
836
329
|
|
837
330
|
return to_object
|
838
331
|
|
839
332
|
|
840
|
-
def
|
333
|
+
def _GetCachedContentParameters_to_mldev(
|
334
|
+
api_client: BaseApiClient,
|
841
335
|
from_object: Union[dict[str, Any], object],
|
842
336
|
parent_object: Optional[dict[str, Any]] = None,
|
843
337
|
) -> dict[str, Any]:
|
844
338
|
to_object: dict[str, Any] = {}
|
845
|
-
if getv(from_object, ['
|
846
|
-
setv(
|
847
|
-
|
848
|
-
|
849
|
-
|
339
|
+
if getv(from_object, ['name']) is not None:
|
340
|
+
setv(
|
341
|
+
to_object,
|
342
|
+
['_url', 'name'],
|
343
|
+
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
344
|
+
)
|
850
345
|
|
851
346
|
return to_object
|
852
347
|
|
853
348
|
|
854
|
-
def
|
349
|
+
def _GetCachedContentParameters_to_vertex(
|
350
|
+
api_client: BaseApiClient,
|
855
351
|
from_object: Union[dict[str, Any], object],
|
856
352
|
parent_object: Optional[dict[str, Any]] = None,
|
857
353
|
) -> dict[str, Any]:
|
858
354
|
to_object: dict[str, Any] = {}
|
859
|
-
if getv(from_object, ['
|
860
|
-
setv(
|
861
|
-
|
862
|
-
|
863
|
-
|
355
|
+
if getv(from_object, ['name']) is not None:
|
356
|
+
setv(
|
357
|
+
to_object,
|
358
|
+
['_url', 'name'],
|
359
|
+
t.t_cached_content_name(api_client, getv(from_object, ['name'])),
|
360
|
+
)
|
864
361
|
|
865
362
|
return to_object
|
866
363
|
|
867
364
|
|
868
|
-
def
|
365
|
+
def _GoogleSearch_to_mldev(
|
869
366
|
from_object: Union[dict[str, Any], object],
|
870
367
|
parent_object: Optional[dict[str, Any]] = None,
|
871
368
|
) -> dict[str, Any]:
|
872
369
|
to_object: dict[str, Any] = {}
|
873
|
-
if getv(from_object, ['
|
874
|
-
setv(
|
370
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
371
|
+
setv(
|
372
|
+
to_object, ['timeRangeFilter'], getv(from_object, ['time_range_filter'])
|
373
|
+
)
|
875
374
|
|
876
|
-
if getv(from_object, ['
|
877
|
-
|
375
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
376
|
+
raise ValueError(
|
377
|
+
'exclude_domains parameter is not supported in Gemini API.'
|
378
|
+
)
|
878
379
|
|
879
380
|
return to_object
|
880
381
|
|
@@ -962,10 +463,7 @@ def _ListCachedContentsResponse_from_mldev(
|
|
962
463
|
setv(
|
963
464
|
to_object,
|
964
465
|
['cached_contents'],
|
965
|
-
[
|
966
|
-
_CachedContent_from_mldev(item, to_object)
|
967
|
-
for item in getv(from_object, ['cachedContents'])
|
968
|
-
],
|
466
|
+
[item for item in getv(from_object, ['cachedContents'])],
|
969
467
|
)
|
970
468
|
|
971
469
|
return to_object
|
@@ -988,10 +486,7 @@ def _ListCachedContentsResponse_from_vertex(
|
|
988
486
|
setv(
|
989
487
|
to_object,
|
990
488
|
['cached_contents'],
|
991
|
-
[
|
992
|
-
_CachedContent_from_vertex(item, to_object)
|
993
|
-
for item in getv(from_object, ['cachedContents'])
|
994
|
-
],
|
489
|
+
[item for item in getv(from_object, ['cachedContents'])],
|
995
490
|
)
|
996
491
|
|
997
492
|
return to_object
|
@@ -1003,13 +498,7 @@ def _Part_to_mldev(
|
|
1003
498
|
) -> dict[str, Any]:
|
1004
499
|
to_object: dict[str, Any] = {}
|
1005
500
|
if getv(from_object, ['video_metadata']) is not None:
|
1006
|
-
setv(
|
1007
|
-
to_object,
|
1008
|
-
['videoMetadata'],
|
1009
|
-
_VideoMetadata_to_mldev(
|
1010
|
-
getv(from_object, ['video_metadata']), to_object
|
1011
|
-
),
|
1012
|
-
)
|
501
|
+
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
1013
502
|
|
1014
503
|
if getv(from_object, ['thought']) is not None:
|
1015
504
|
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
@@ -1036,81 +525,7 @@ def _Part_to_mldev(
|
|
1036
525
|
)
|
1037
526
|
|
1038
527
|
if getv(from_object, ['function_call']) is not None:
|
1039
|
-
setv(
|
1040
|
-
to_object,
|
1041
|
-
['functionCall'],
|
1042
|
-
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
1043
|
-
)
|
1044
|
-
|
1045
|
-
if getv(from_object, ['code_execution_result']) is not None:
|
1046
|
-
setv(
|
1047
|
-
to_object,
|
1048
|
-
['codeExecutionResult'],
|
1049
|
-
getv(from_object, ['code_execution_result']),
|
1050
|
-
)
|
1051
|
-
|
1052
|
-
if getv(from_object, ['executable_code']) is not None:
|
1053
|
-
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
1054
|
-
|
1055
|
-
if getv(from_object, ['function_response']) is not None:
|
1056
|
-
setv(
|
1057
|
-
to_object,
|
1058
|
-
['functionResponse'],
|
1059
|
-
getv(from_object, ['function_response']),
|
1060
|
-
)
|
1061
|
-
|
1062
|
-
if getv(from_object, ['text']) is not None:
|
1063
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
1064
|
-
|
1065
|
-
return to_object
|
1066
|
-
|
1067
|
-
|
1068
|
-
def _Part_to_vertex(
|
1069
|
-
from_object: Union[dict[str, Any], object],
|
1070
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1071
|
-
) -> dict[str, Any]:
|
1072
|
-
to_object: dict[str, Any] = {}
|
1073
|
-
if getv(from_object, ['video_metadata']) is not None:
|
1074
|
-
setv(
|
1075
|
-
to_object,
|
1076
|
-
['videoMetadata'],
|
1077
|
-
_VideoMetadata_to_vertex(
|
1078
|
-
getv(from_object, ['video_metadata']), to_object
|
1079
|
-
),
|
1080
|
-
)
|
1081
|
-
|
1082
|
-
if getv(from_object, ['thought']) is not None:
|
1083
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
1084
|
-
|
1085
|
-
if getv(from_object, ['inline_data']) is not None:
|
1086
|
-
setv(
|
1087
|
-
to_object,
|
1088
|
-
['inlineData'],
|
1089
|
-
_Blob_to_vertex(getv(from_object, ['inline_data']), to_object),
|
1090
|
-
)
|
1091
|
-
|
1092
|
-
if getv(from_object, ['file_data']) is not None:
|
1093
|
-
setv(
|
1094
|
-
to_object,
|
1095
|
-
['fileData'],
|
1096
|
-
_FileData_to_vertex(getv(from_object, ['file_data']), to_object),
|
1097
|
-
)
|
1098
|
-
|
1099
|
-
if getv(from_object, ['thought_signature']) is not None:
|
1100
|
-
setv(
|
1101
|
-
to_object,
|
1102
|
-
['thoughtSignature'],
|
1103
|
-
getv(from_object, ['thought_signature']),
|
1104
|
-
)
|
1105
|
-
|
1106
|
-
if getv(from_object, ['function_call']) is not None:
|
1107
|
-
setv(
|
1108
|
-
to_object,
|
1109
|
-
['functionCall'],
|
1110
|
-
_FunctionCall_to_vertex(
|
1111
|
-
getv(from_object, ['function_call']), to_object
|
1112
|
-
),
|
1113
|
-
)
|
528
|
+
setv(to_object, ['functionCall'], getv(from_object, ['function_call']))
|
1114
529
|
|
1115
530
|
if getv(from_object, ['code_execution_result']) is not None:
|
1116
531
|
setv(
|
@@ -1135,94 +550,6 @@ def _Part_to_vertex(
|
|
1135
550
|
return to_object
|
1136
551
|
|
1137
552
|
|
1138
|
-
def _RetrievalConfig_to_mldev(
|
1139
|
-
from_object: Union[dict[str, Any], object],
|
1140
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1141
|
-
) -> dict[str, Any]:
|
1142
|
-
to_object: dict[str, Any] = {}
|
1143
|
-
if getv(from_object, ['lat_lng']) is not None:
|
1144
|
-
setv(
|
1145
|
-
to_object,
|
1146
|
-
['latLng'],
|
1147
|
-
_LatLng_to_mldev(getv(from_object, ['lat_lng']), to_object),
|
1148
|
-
)
|
1149
|
-
|
1150
|
-
if getv(from_object, ['language_code']) is not None:
|
1151
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
1152
|
-
|
1153
|
-
return to_object
|
1154
|
-
|
1155
|
-
|
1156
|
-
def _RetrievalConfig_to_vertex(
|
1157
|
-
from_object: Union[dict[str, Any], object],
|
1158
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1159
|
-
) -> dict[str, Any]:
|
1160
|
-
to_object: dict[str, Any] = {}
|
1161
|
-
if getv(from_object, ['lat_lng']) is not None:
|
1162
|
-
setv(
|
1163
|
-
to_object,
|
1164
|
-
['latLng'],
|
1165
|
-
_LatLng_to_vertex(getv(from_object, ['lat_lng']), to_object),
|
1166
|
-
)
|
1167
|
-
|
1168
|
-
if getv(from_object, ['language_code']) is not None:
|
1169
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
1170
|
-
|
1171
|
-
return to_object
|
1172
|
-
|
1173
|
-
|
1174
|
-
def _ToolConfig_to_mldev(
|
1175
|
-
from_object: Union[dict[str, Any], object],
|
1176
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1177
|
-
) -> dict[str, Any]:
|
1178
|
-
to_object: dict[str, Any] = {}
|
1179
|
-
if getv(from_object, ['function_calling_config']) is not None:
|
1180
|
-
setv(
|
1181
|
-
to_object,
|
1182
|
-
['functionCallingConfig'],
|
1183
|
-
_FunctionCallingConfig_to_mldev(
|
1184
|
-
getv(from_object, ['function_calling_config']), to_object
|
1185
|
-
),
|
1186
|
-
)
|
1187
|
-
|
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
|
-
)
|
1196
|
-
|
1197
|
-
return to_object
|
1198
|
-
|
1199
|
-
|
1200
|
-
def _ToolConfig_to_vertex(
|
1201
|
-
from_object: Union[dict[str, Any], object],
|
1202
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1203
|
-
) -> dict[str, Any]:
|
1204
|
-
to_object: dict[str, Any] = {}
|
1205
|
-
if getv(from_object, ['function_calling_config']) is not None:
|
1206
|
-
setv(
|
1207
|
-
to_object,
|
1208
|
-
['functionCallingConfig'],
|
1209
|
-
_FunctionCallingConfig_to_vertex(
|
1210
|
-
getv(from_object, ['function_calling_config']), to_object
|
1211
|
-
),
|
1212
|
-
)
|
1213
|
-
|
1214
|
-
if getv(from_object, ['retrieval_config']) is not None:
|
1215
|
-
setv(
|
1216
|
-
to_object,
|
1217
|
-
['retrievalConfig'],
|
1218
|
-
_RetrievalConfig_to_vertex(
|
1219
|
-
getv(from_object, ['retrieval_config']), to_object
|
1220
|
-
),
|
1221
|
-
)
|
1222
|
-
|
1223
|
-
return to_object
|
1224
|
-
|
1225
|
-
|
1226
553
|
def _Tool_to_mldev(
|
1227
554
|
from_object: Union[dict[str, Any], object],
|
1228
555
|
parent_object: Optional[dict[str, Any]] = None,
|
@@ -1232,10 +559,7 @@ def _Tool_to_mldev(
|
|
1232
559
|
setv(
|
1233
560
|
to_object,
|
1234
561
|
['functionDeclarations'],
|
1235
|
-
[
|
1236
|
-
_FunctionDeclaration_to_mldev(item, to_object)
|
1237
|
-
for item in getv(from_object, ['function_declarations'])
|
1238
|
-
],
|
562
|
+
[item for item in getv(from_object, ['function_declarations'])],
|
1239
563
|
)
|
1240
564
|
|
1241
565
|
if getv(from_object, ['retrieval']) is not None:
|
@@ -1252,9 +576,7 @@ def _Tool_to_mldev(
|
|
1252
576
|
setv(
|
1253
577
|
to_object,
|
1254
578
|
['googleSearchRetrieval'],
|
1255
|
-
|
1256
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
1257
|
-
),
|
579
|
+
getv(from_object, ['google_search_retrieval']),
|
1258
580
|
)
|
1259
581
|
|
1260
582
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
@@ -1266,18 +588,10 @@ def _Tool_to_mldev(
|
|
1266
588
|
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
1267
589
|
|
1268
590
|
if getv(from_object, ['url_context']) is not None:
|
1269
|
-
setv(
|
1270
|
-
to_object,
|
1271
|
-
['urlContext'],
|
1272
|
-
_UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
|
1273
|
-
)
|
591
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
1274
592
|
|
1275
593
|
if getv(from_object, ['computer_use']) is not None:
|
1276
|
-
setv(
|
1277
|
-
to_object,
|
1278
|
-
['computerUse'],
|
1279
|
-
_ComputerUse_to_mldev(getv(from_object, ['computer_use']), to_object),
|
1280
|
-
)
|
594
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
1281
595
|
|
1282
596
|
if getv(from_object, ['code_execution']) is not None:
|
1283
597
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
@@ -1304,52 +618,30 @@ def _Tool_to_vertex(
|
|
1304
618
|
setv(to_object, ['retrieval'], getv(from_object, ['retrieval']))
|
1305
619
|
|
1306
620
|
if getv(from_object, ['google_search']) is not None:
|
1307
|
-
setv(
|
1308
|
-
to_object,
|
1309
|
-
['googleSearch'],
|
1310
|
-
_GoogleSearch_to_vertex(
|
1311
|
-
getv(from_object, ['google_search']), to_object
|
1312
|
-
),
|
1313
|
-
)
|
621
|
+
setv(to_object, ['googleSearch'], getv(from_object, ['google_search']))
|
1314
622
|
|
1315
623
|
if getv(from_object, ['google_search_retrieval']) is not None:
|
1316
624
|
setv(
|
1317
625
|
to_object,
|
1318
626
|
['googleSearchRetrieval'],
|
1319
|
-
|
1320
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
1321
|
-
),
|
627
|
+
getv(from_object, ['google_search_retrieval']),
|
1322
628
|
)
|
1323
629
|
|
1324
630
|
if getv(from_object, ['enterprise_web_search']) is not None:
|
1325
631
|
setv(
|
1326
632
|
to_object,
|
1327
633
|
['enterpriseWebSearch'],
|
1328
|
-
|
1329
|
-
getv(from_object, ['enterprise_web_search']), to_object
|
1330
|
-
),
|
634
|
+
getv(from_object, ['enterprise_web_search']),
|
1331
635
|
)
|
1332
636
|
|
1333
637
|
if getv(from_object, ['google_maps']) is not None:
|
1334
|
-
setv(
|
1335
|
-
to_object,
|
1336
|
-
['googleMaps'],
|
1337
|
-
_GoogleMaps_to_vertex(getv(from_object, ['google_maps']), to_object),
|
1338
|
-
)
|
638
|
+
setv(to_object, ['googleMaps'], getv(from_object, ['google_maps']))
|
1339
639
|
|
1340
640
|
if getv(from_object, ['url_context']) is not None:
|
1341
|
-
setv(
|
1342
|
-
to_object,
|
1343
|
-
['urlContext'],
|
1344
|
-
_UrlContext_to_vertex(getv(from_object, ['url_context']), to_object),
|
1345
|
-
)
|
641
|
+
setv(to_object, ['urlContext'], getv(from_object, ['url_context']))
|
1346
642
|
|
1347
643
|
if getv(from_object, ['computer_use']) is not None:
|
1348
|
-
setv(
|
1349
|
-
to_object,
|
1350
|
-
['computerUse'],
|
1351
|
-
_ComputerUse_to_vertex(getv(from_object, ['computer_use']), to_object),
|
1352
|
-
)
|
644
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
1353
645
|
|
1354
646
|
if getv(from_object, ['code_execution']) is not None:
|
1355
647
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
@@ -1429,58 +721,6 @@ def _UpdateCachedContentParameters_to_vertex(
|
|
1429
721
|
return to_object
|
1430
722
|
|
1431
723
|
|
1432
|
-
def _UrlContext_to_mldev(
|
1433
|
-
from_object: Union[dict[str, Any], object],
|
1434
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1435
|
-
) -> dict[str, Any]:
|
1436
|
-
to_object: dict[str, Any] = {}
|
1437
|
-
|
1438
|
-
return to_object
|
1439
|
-
|
1440
|
-
|
1441
|
-
def _UrlContext_to_vertex(
|
1442
|
-
from_object: Union[dict[str, Any], object],
|
1443
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1444
|
-
) -> dict[str, Any]:
|
1445
|
-
to_object: dict[str, Any] = {}
|
1446
|
-
|
1447
|
-
return to_object
|
1448
|
-
|
1449
|
-
|
1450
|
-
def _VideoMetadata_to_mldev(
|
1451
|
-
from_object: Union[dict[str, Any], object],
|
1452
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1453
|
-
) -> dict[str, Any]:
|
1454
|
-
to_object: dict[str, Any] = {}
|
1455
|
-
if getv(from_object, ['fps']) is not None:
|
1456
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
1457
|
-
|
1458
|
-
if getv(from_object, ['end_offset']) is not None:
|
1459
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
1460
|
-
|
1461
|
-
if getv(from_object, ['start_offset']) is not None:
|
1462
|
-
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
1463
|
-
|
1464
|
-
return to_object
|
1465
|
-
|
1466
|
-
|
1467
|
-
def _VideoMetadata_to_vertex(
|
1468
|
-
from_object: Union[dict[str, Any], object],
|
1469
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1470
|
-
) -> dict[str, Any]:
|
1471
|
-
to_object: dict[str, Any] = {}
|
1472
|
-
if getv(from_object, ['fps']) is not None:
|
1473
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
1474
|
-
|
1475
|
-
if getv(from_object, ['end_offset']) is not None:
|
1476
|
-
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
1477
|
-
|
1478
|
-
if getv(from_object, ['start_offset']) is not None:
|
1479
|
-
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
1480
|
-
|
1481
|
-
return to_object
|
1482
|
-
|
1483
|
-
|
1484
724
|
class Caches(_api_module.BaseModule):
|
1485
725
|
|
1486
726
|
def create(
|
@@ -1552,13 +792,7 @@ class Caches(_api_module.BaseModule):
|
|
1552
792
|
'post', path, request_dict, http_options
|
1553
793
|
)
|
1554
794
|
|
1555
|
-
response_dict =
|
1556
|
-
|
1557
|
-
if self._api_client.vertexai:
|
1558
|
-
response_dict = _CachedContent_from_vertex(response_dict)
|
1559
|
-
|
1560
|
-
else:
|
1561
|
-
response_dict = _CachedContent_from_mldev(response_dict)
|
795
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
1562
796
|
|
1563
797
|
return_value = types.CachedContent._from_response(
|
1564
798
|
response=response_dict, kwargs=parameter_model.model_dump()
|
@@ -1623,13 +857,7 @@ class Caches(_api_module.BaseModule):
|
|
1623
857
|
|
1624
858
|
response = self._api_client.request('get', path, request_dict, http_options)
|
1625
859
|
|
1626
|
-
response_dict =
|
1627
|
-
|
1628
|
-
if self._api_client.vertexai:
|
1629
|
-
response_dict = _CachedContent_from_vertex(response_dict)
|
1630
|
-
|
1631
|
-
else:
|
1632
|
-
response_dict = _CachedContent_from_mldev(response_dict)
|
860
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
1633
861
|
|
1634
862
|
return_value = types.CachedContent._from_response(
|
1635
863
|
response=response_dict, kwargs=parameter_model.model_dump()
|
@@ -1698,12 +926,12 @@ class Caches(_api_module.BaseModule):
|
|
1698
926
|
'delete', path, request_dict, http_options
|
1699
927
|
)
|
1700
928
|
|
1701
|
-
response_dict =
|
929
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
1702
930
|
|
1703
931
|
if self._api_client.vertexai:
|
1704
932
|
response_dict = _DeleteCachedContentResponse_from_vertex(response_dict)
|
1705
933
|
|
1706
|
-
|
934
|
+
if not self._api_client.vertexai:
|
1707
935
|
response_dict = _DeleteCachedContentResponse_from_mldev(response_dict)
|
1708
936
|
|
1709
937
|
return_value = types.DeleteCachedContentResponse._from_response(
|
@@ -1778,13 +1006,7 @@ class Caches(_api_module.BaseModule):
|
|
1778
1006
|
'patch', path, request_dict, http_options
|
1779
1007
|
)
|
1780
1008
|
|
1781
|
-
response_dict =
|
1782
|
-
|
1783
|
-
if self._api_client.vertexai:
|
1784
|
-
response_dict = _CachedContent_from_vertex(response_dict)
|
1785
|
-
|
1786
|
-
else:
|
1787
|
-
response_dict = _CachedContent_from_mldev(response_dict)
|
1009
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
1788
1010
|
|
1789
1011
|
return_value = types.CachedContent._from_response(
|
1790
1012
|
response=response_dict, kwargs=parameter_model.model_dump()
|
@@ -1843,12 +1065,12 @@ class Caches(_api_module.BaseModule):
|
|
1843
1065
|
|
1844
1066
|
response = self._api_client.request('get', path, request_dict, http_options)
|
1845
1067
|
|
1846
|
-
response_dict =
|
1068
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
1847
1069
|
|
1848
1070
|
if self._api_client.vertexai:
|
1849
1071
|
response_dict = _ListCachedContentsResponse_from_vertex(response_dict)
|
1850
1072
|
|
1851
|
-
|
1073
|
+
if not self._api_client.vertexai:
|
1852
1074
|
response_dict = _ListCachedContentsResponse_from_mldev(response_dict)
|
1853
1075
|
|
1854
1076
|
return_value = types.ListCachedContentsResponse._from_response(
|
@@ -1942,13 +1164,7 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1942
1164
|
'post', path, request_dict, http_options
|
1943
1165
|
)
|
1944
1166
|
|
1945
|
-
response_dict =
|
1946
|
-
|
1947
|
-
if self._api_client.vertexai:
|
1948
|
-
response_dict = _CachedContent_from_vertex(response_dict)
|
1949
|
-
|
1950
|
-
else:
|
1951
|
-
response_dict = _CachedContent_from_mldev(response_dict)
|
1167
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
1952
1168
|
|
1953
1169
|
return_value = types.CachedContent._from_response(
|
1954
1170
|
response=response_dict, kwargs=parameter_model.model_dump()
|
@@ -2016,13 +1232,7 @@ class AsyncCaches(_api_module.BaseModule):
|
|
2016
1232
|
'get', path, request_dict, http_options
|
2017
1233
|
)
|
2018
1234
|
|
2019
|
-
response_dict =
|
2020
|
-
|
2021
|
-
if self._api_client.vertexai:
|
2022
|
-
response_dict = _CachedContent_from_vertex(response_dict)
|
2023
|
-
|
2024
|
-
else:
|
2025
|
-
response_dict = _CachedContent_from_mldev(response_dict)
|
1235
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
2026
1236
|
|
2027
1237
|
return_value = types.CachedContent._from_response(
|
2028
1238
|
response=response_dict, kwargs=parameter_model.model_dump()
|
@@ -2092,12 +1302,12 @@ class AsyncCaches(_api_module.BaseModule):
|
|
2092
1302
|
'delete', path, request_dict, http_options
|
2093
1303
|
)
|
2094
1304
|
|
2095
|
-
response_dict =
|
1305
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
2096
1306
|
|
2097
1307
|
if self._api_client.vertexai:
|
2098
1308
|
response_dict = _DeleteCachedContentResponse_from_vertex(response_dict)
|
2099
1309
|
|
2100
|
-
|
1310
|
+
if not self._api_client.vertexai:
|
2101
1311
|
response_dict = _DeleteCachedContentResponse_from_mldev(response_dict)
|
2102
1312
|
|
2103
1313
|
return_value = types.DeleteCachedContentResponse._from_response(
|
@@ -2172,13 +1382,7 @@ class AsyncCaches(_api_module.BaseModule):
|
|
2172
1382
|
'patch', path, request_dict, http_options
|
2173
1383
|
)
|
2174
1384
|
|
2175
|
-
response_dict =
|
2176
|
-
|
2177
|
-
if self._api_client.vertexai:
|
2178
|
-
response_dict = _CachedContent_from_vertex(response_dict)
|
2179
|
-
|
2180
|
-
else:
|
2181
|
-
response_dict = _CachedContent_from_mldev(response_dict)
|
1385
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
2182
1386
|
|
2183
1387
|
return_value = types.CachedContent._from_response(
|
2184
1388
|
response=response_dict, kwargs=parameter_model.model_dump()
|
@@ -2239,12 +1443,12 @@ class AsyncCaches(_api_module.BaseModule):
|
|
2239
1443
|
'get', path, request_dict, http_options
|
2240
1444
|
)
|
2241
1445
|
|
2242
|
-
response_dict =
|
1446
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
2243
1447
|
|
2244
1448
|
if self._api_client.vertexai:
|
2245
1449
|
response_dict = _ListCachedContentsResponse_from_vertex(response_dict)
|
2246
1450
|
|
2247
|
-
|
1451
|
+
if not self._api_client.vertexai:
|
2248
1452
|
response_dict = _ListCachedContentsResponse_from_mldev(response_dict)
|
2249
1453
|
|
2250
1454
|
return_value = types.ListCachedContentsResponse._from_response(
|