google-genai 1.2.0__py3-none-any.whl → 1.4.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 +160 -59
- google/genai/_api_module.py +6 -1
- google/genai/_automatic_function_calling_util.py +12 -12
- google/genai/_common.py +14 -2
- google/genai/_extra_utils.py +14 -8
- google/genai/_replay_api_client.py +35 -3
- google/genai/_test_api_client.py +8 -8
- google/genai/_transformers.py +169 -48
- google/genai/batches.py +176 -127
- google/genai/caches.py +315 -214
- google/genai/chats.py +179 -35
- google/genai/client.py +16 -6
- google/genai/errors.py +19 -5
- google/genai/files.py +161 -115
- google/genai/live.py +137 -105
- google/genai/models.py +1553 -734
- google/genai/operations.py +635 -0
- google/genai/pagers.py +5 -5
- google/genai/tunings.py +166 -103
- google/genai/types.py +590 -142
- google/genai/version.py +1 -1
- {google_genai-1.2.0.dist-info → google_genai-1.4.0.dist-info}/METADATA +94 -12
- google_genai-1.4.0.dist-info/RECORD +27 -0
- {google_genai-1.2.0.dist-info → google_genai-1.4.0.dist-info}/WHEEL +1 -1
- google/genai/_operations.py +0 -365
- google_genai-1.2.0.dist-info/RECORD +0 -27
- {google_genai-1.2.0.dist-info → google_genai-1.4.0.dist-info}/LICENSE +0 -0
- {google_genai-1.2.0.dist-info → google_genai-1.4.0.dist-info}/top_level.txt +0 -0
google/genai/caches.py
CHANGED
@@ -15,24 +15,27 @@
|
|
15
15
|
|
16
16
|
# Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
17
17
|
|
18
|
-
|
18
|
+
import logging
|
19
|
+
from typing import Any, Optional, Union
|
19
20
|
from urllib.parse import urlencode
|
20
21
|
from . import _api_module
|
21
22
|
from . import _common
|
22
23
|
from . import _transformers as t
|
23
24
|
from . import types
|
24
|
-
from ._api_client import
|
25
|
+
from ._api_client import BaseApiClient
|
25
26
|
from ._common import get_value_by_path as getv
|
26
27
|
from ._common import set_value_by_path as setv
|
27
28
|
from .pagers import AsyncPager, Pager
|
28
29
|
|
30
|
+
logger = logging.getLogger('google_genai.caches')
|
31
|
+
|
29
32
|
|
30
33
|
def _Part_to_mldev(
|
31
|
-
api_client:
|
34
|
+
api_client: BaseApiClient,
|
32
35
|
from_object: Union[dict, object],
|
33
|
-
parent_object: dict = None,
|
36
|
+
parent_object: Optional[dict] = None,
|
34
37
|
) -> dict:
|
35
|
-
to_object = {}
|
38
|
+
to_object: dict[str, Any] = {}
|
36
39
|
if getv(from_object, ['video_metadata']) is not None:
|
37
40
|
raise ValueError('video_metadata parameter is not supported in Gemini API.')
|
38
41
|
|
@@ -72,11 +75,11 @@ def _Part_to_mldev(
|
|
72
75
|
|
73
76
|
|
74
77
|
def _Part_to_vertex(
|
75
|
-
api_client:
|
78
|
+
api_client: BaseApiClient,
|
76
79
|
from_object: Union[dict, object],
|
77
|
-
parent_object: dict = None,
|
80
|
+
parent_object: Optional[dict] = None,
|
78
81
|
) -> dict:
|
79
|
-
to_object = {}
|
82
|
+
to_object: dict[str, Any] = {}
|
80
83
|
if getv(from_object, ['video_metadata']) is not None:
|
81
84
|
setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata']))
|
82
85
|
|
@@ -116,11 +119,11 @@ def _Part_to_vertex(
|
|
116
119
|
|
117
120
|
|
118
121
|
def _Content_to_mldev(
|
119
|
-
api_client:
|
122
|
+
api_client: BaseApiClient,
|
120
123
|
from_object: Union[dict, object],
|
121
|
-
parent_object: dict = None,
|
124
|
+
parent_object: Optional[dict] = None,
|
122
125
|
) -> dict:
|
123
|
-
to_object = {}
|
126
|
+
to_object: dict[str, Any] = {}
|
124
127
|
if getv(from_object, ['parts']) is not None:
|
125
128
|
setv(
|
126
129
|
to_object,
|
@@ -138,11 +141,11 @@ def _Content_to_mldev(
|
|
138
141
|
|
139
142
|
|
140
143
|
def _Content_to_vertex(
|
141
|
-
api_client:
|
144
|
+
api_client: BaseApiClient,
|
142
145
|
from_object: Union[dict, object],
|
143
|
-
parent_object: dict = None,
|
146
|
+
parent_object: Optional[dict] = None,
|
144
147
|
) -> dict:
|
145
|
-
to_object = {}
|
148
|
+
to_object: dict[str, Any] = {}
|
146
149
|
if getv(from_object, ['parts']) is not None:
|
147
150
|
setv(
|
148
151
|
to_object,
|
@@ -160,24 +163,14 @@ def _Content_to_vertex(
|
|
160
163
|
|
161
164
|
|
162
165
|
def _Schema_to_mldev(
|
163
|
-
api_client:
|
166
|
+
api_client: BaseApiClient,
|
164
167
|
from_object: Union[dict, object],
|
165
|
-
parent_object: dict = None,
|
168
|
+
parent_object: Optional[dict] = None,
|
166
169
|
) -> dict:
|
167
|
-
to_object = {}
|
168
|
-
if getv(from_object, ['min_items']) is not None:
|
169
|
-
raise ValueError('min_items parameter is not supported in Gemini API.')
|
170
|
-
|
170
|
+
to_object: dict[str, Any] = {}
|
171
171
|
if getv(from_object, ['example']) is not None:
|
172
172
|
raise ValueError('example parameter is not supported in Gemini API.')
|
173
173
|
|
174
|
-
if getv(from_object, ['property_ordering']) is not None:
|
175
|
-
setv(
|
176
|
-
to_object,
|
177
|
-
['propertyOrdering'],
|
178
|
-
getv(from_object, ['property_ordering']),
|
179
|
-
)
|
180
|
-
|
181
174
|
if getv(from_object, ['pattern']) is not None:
|
182
175
|
raise ValueError('pattern parameter is not supported in Gemini API.')
|
183
176
|
|
@@ -202,21 +195,12 @@ def _Schema_to_mldev(
|
|
202
195
|
if getv(from_object, ['min_properties']) is not None:
|
203
196
|
raise ValueError('min_properties parameter is not supported in Gemini API.')
|
204
197
|
|
205
|
-
if getv(from_object, ['max_items']) is not None:
|
206
|
-
raise ValueError('max_items parameter is not supported in Gemini API.')
|
207
|
-
|
208
198
|
if getv(from_object, ['maximum']) is not None:
|
209
199
|
raise ValueError('maximum parameter is not supported in Gemini API.')
|
210
200
|
|
211
|
-
if getv(from_object, ['nullable']) is not None:
|
212
|
-
raise ValueError('nullable parameter is not supported in Gemini API.')
|
213
|
-
|
214
201
|
if getv(from_object, ['max_properties']) is not None:
|
215
202
|
raise ValueError('max_properties parameter is not supported in Gemini API.')
|
216
203
|
|
217
|
-
if getv(from_object, ['type']) is not None:
|
218
|
-
setv(to_object, ['type'], getv(from_object, ['type']))
|
219
|
-
|
220
204
|
if getv(from_object, ['description']) is not None:
|
221
205
|
setv(to_object, ['description'], getv(from_object, ['description']))
|
222
206
|
|
@@ -229,34 +213,43 @@ def _Schema_to_mldev(
|
|
229
213
|
if getv(from_object, ['items']) is not None:
|
230
214
|
setv(to_object, ['items'], getv(from_object, ['items']))
|
231
215
|
|
216
|
+
if getv(from_object, ['max_items']) is not None:
|
217
|
+
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
218
|
+
|
219
|
+
if getv(from_object, ['min_items']) is not None:
|
220
|
+
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
221
|
+
|
222
|
+
if getv(from_object, ['nullable']) is not None:
|
223
|
+
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
224
|
+
|
232
225
|
if getv(from_object, ['properties']) is not None:
|
233
226
|
setv(to_object, ['properties'], getv(from_object, ['properties']))
|
234
227
|
|
228
|
+
if getv(from_object, ['property_ordering']) is not None:
|
229
|
+
setv(
|
230
|
+
to_object,
|
231
|
+
['propertyOrdering'],
|
232
|
+
getv(from_object, ['property_ordering']),
|
233
|
+
)
|
234
|
+
|
235
235
|
if getv(from_object, ['required']) is not None:
|
236
236
|
setv(to_object, ['required'], getv(from_object, ['required']))
|
237
237
|
|
238
|
+
if getv(from_object, ['type']) is not None:
|
239
|
+
setv(to_object, ['type'], getv(from_object, ['type']))
|
240
|
+
|
238
241
|
return to_object
|
239
242
|
|
240
243
|
|
241
244
|
def _Schema_to_vertex(
|
242
|
-
api_client:
|
245
|
+
api_client: BaseApiClient,
|
243
246
|
from_object: Union[dict, object],
|
244
|
-
parent_object: dict = None,
|
247
|
+
parent_object: Optional[dict] = None,
|
245
248
|
) -> dict:
|
246
|
-
to_object = {}
|
247
|
-
if getv(from_object, ['min_items']) is not None:
|
248
|
-
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
249
|
-
|
249
|
+
to_object: dict[str, Any] = {}
|
250
250
|
if getv(from_object, ['example']) is not None:
|
251
251
|
setv(to_object, ['example'], getv(from_object, ['example']))
|
252
252
|
|
253
|
-
if getv(from_object, ['property_ordering']) is not None:
|
254
|
-
setv(
|
255
|
-
to_object,
|
256
|
-
['propertyOrdering'],
|
257
|
-
getv(from_object, ['property_ordering']),
|
258
|
-
)
|
259
|
-
|
260
253
|
if getv(from_object, ['pattern']) is not None:
|
261
254
|
setv(to_object, ['pattern'], getv(from_object, ['pattern']))
|
262
255
|
|
@@ -281,21 +274,12 @@ def _Schema_to_vertex(
|
|
281
274
|
if getv(from_object, ['min_properties']) is not None:
|
282
275
|
setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
|
283
276
|
|
284
|
-
if getv(from_object, ['max_items']) is not None:
|
285
|
-
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
286
|
-
|
287
277
|
if getv(from_object, ['maximum']) is not None:
|
288
278
|
setv(to_object, ['maximum'], getv(from_object, ['maximum']))
|
289
279
|
|
290
|
-
if getv(from_object, ['nullable']) is not None:
|
291
|
-
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
292
|
-
|
293
280
|
if getv(from_object, ['max_properties']) is not None:
|
294
281
|
setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
|
295
282
|
|
296
|
-
if getv(from_object, ['type']) is not None:
|
297
|
-
setv(to_object, ['type'], getv(from_object, ['type']))
|
298
|
-
|
299
283
|
if getv(from_object, ['description']) is not None:
|
300
284
|
setv(to_object, ['description'], getv(from_object, ['description']))
|
301
285
|
|
@@ -308,21 +292,40 @@ def _Schema_to_vertex(
|
|
308
292
|
if getv(from_object, ['items']) is not None:
|
309
293
|
setv(to_object, ['items'], getv(from_object, ['items']))
|
310
294
|
|
295
|
+
if getv(from_object, ['max_items']) is not None:
|
296
|
+
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
297
|
+
|
298
|
+
if getv(from_object, ['min_items']) is not None:
|
299
|
+
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
300
|
+
|
301
|
+
if getv(from_object, ['nullable']) is not None:
|
302
|
+
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
303
|
+
|
311
304
|
if getv(from_object, ['properties']) is not None:
|
312
305
|
setv(to_object, ['properties'], getv(from_object, ['properties']))
|
313
306
|
|
307
|
+
if getv(from_object, ['property_ordering']) is not None:
|
308
|
+
setv(
|
309
|
+
to_object,
|
310
|
+
['propertyOrdering'],
|
311
|
+
getv(from_object, ['property_ordering']),
|
312
|
+
)
|
313
|
+
|
314
314
|
if getv(from_object, ['required']) is not None:
|
315
315
|
setv(to_object, ['required'], getv(from_object, ['required']))
|
316
316
|
|
317
|
+
if getv(from_object, ['type']) is not None:
|
318
|
+
setv(to_object, ['type'], getv(from_object, ['type']))
|
319
|
+
|
317
320
|
return to_object
|
318
321
|
|
319
322
|
|
320
323
|
def _FunctionDeclaration_to_mldev(
|
321
|
-
api_client:
|
324
|
+
api_client: BaseApiClient,
|
322
325
|
from_object: Union[dict, object],
|
323
|
-
parent_object: dict = None,
|
326
|
+
parent_object: Optional[dict] = None,
|
324
327
|
) -> dict:
|
325
|
-
to_object = {}
|
328
|
+
to_object: dict[str, Any] = {}
|
326
329
|
if getv(from_object, ['response']) is not None:
|
327
330
|
raise ValueError('response parameter is not supported in Gemini API.')
|
328
331
|
|
@@ -339,11 +342,11 @@ def _FunctionDeclaration_to_mldev(
|
|
339
342
|
|
340
343
|
|
341
344
|
def _FunctionDeclaration_to_vertex(
|
342
|
-
api_client:
|
345
|
+
api_client: BaseApiClient,
|
343
346
|
from_object: Union[dict, object],
|
344
|
-
parent_object: dict = None,
|
347
|
+
parent_object: Optional[dict] = None,
|
345
348
|
) -> dict:
|
346
|
-
to_object = {}
|
349
|
+
to_object: dict[str, Any] = {}
|
347
350
|
if getv(from_object, ['response']) is not None:
|
348
351
|
setv(
|
349
352
|
to_object,
|
@@ -366,31 +369,31 @@ def _FunctionDeclaration_to_vertex(
|
|
366
369
|
|
367
370
|
|
368
371
|
def _GoogleSearch_to_mldev(
|
369
|
-
api_client:
|
372
|
+
api_client: BaseApiClient,
|
370
373
|
from_object: Union[dict, object],
|
371
|
-
parent_object: dict = None,
|
374
|
+
parent_object: Optional[dict] = None,
|
372
375
|
) -> dict:
|
373
|
-
to_object = {}
|
376
|
+
to_object: dict[str, Any] = {}
|
374
377
|
|
375
378
|
return to_object
|
376
379
|
|
377
380
|
|
378
381
|
def _GoogleSearch_to_vertex(
|
379
|
-
api_client:
|
382
|
+
api_client: BaseApiClient,
|
380
383
|
from_object: Union[dict, object],
|
381
|
-
parent_object: dict = None,
|
384
|
+
parent_object: Optional[dict] = None,
|
382
385
|
) -> dict:
|
383
|
-
to_object = {}
|
386
|
+
to_object: dict[str, Any] = {}
|
384
387
|
|
385
388
|
return to_object
|
386
389
|
|
387
390
|
|
388
391
|
def _DynamicRetrievalConfig_to_mldev(
|
389
|
-
api_client:
|
392
|
+
api_client: BaseApiClient,
|
390
393
|
from_object: Union[dict, object],
|
391
|
-
parent_object: dict = None,
|
394
|
+
parent_object: Optional[dict] = None,
|
392
395
|
) -> dict:
|
393
|
-
to_object = {}
|
396
|
+
to_object: dict[str, Any] = {}
|
394
397
|
if getv(from_object, ['mode']) is not None:
|
395
398
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
396
399
|
|
@@ -405,11 +408,11 @@ def _DynamicRetrievalConfig_to_mldev(
|
|
405
408
|
|
406
409
|
|
407
410
|
def _DynamicRetrievalConfig_to_vertex(
|
408
|
-
api_client:
|
411
|
+
api_client: BaseApiClient,
|
409
412
|
from_object: Union[dict, object],
|
410
|
-
parent_object: dict = None,
|
413
|
+
parent_object: Optional[dict] = None,
|
411
414
|
) -> dict:
|
412
|
-
to_object = {}
|
415
|
+
to_object: dict[str, Any] = {}
|
413
416
|
if getv(from_object, ['mode']) is not None:
|
414
417
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
415
418
|
|
@@ -424,11 +427,11 @@ def _DynamicRetrievalConfig_to_vertex(
|
|
424
427
|
|
425
428
|
|
426
429
|
def _GoogleSearchRetrieval_to_mldev(
|
427
|
-
api_client:
|
430
|
+
api_client: BaseApiClient,
|
428
431
|
from_object: Union[dict, object],
|
429
|
-
parent_object: dict = None,
|
432
|
+
parent_object: Optional[dict] = None,
|
430
433
|
) -> dict:
|
431
|
-
to_object = {}
|
434
|
+
to_object: dict[str, Any] = {}
|
432
435
|
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
433
436
|
setv(
|
434
437
|
to_object,
|
@@ -444,11 +447,11 @@ def _GoogleSearchRetrieval_to_mldev(
|
|
444
447
|
|
445
448
|
|
446
449
|
def _GoogleSearchRetrieval_to_vertex(
|
447
|
-
api_client:
|
450
|
+
api_client: BaseApiClient,
|
448
451
|
from_object: Union[dict, object],
|
449
|
-
parent_object: dict = None,
|
452
|
+
parent_object: Optional[dict] = None,
|
450
453
|
) -> dict:
|
451
|
-
to_object = {}
|
454
|
+
to_object: dict[str, Any] = {}
|
452
455
|
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
453
456
|
setv(
|
454
457
|
to_object,
|
@@ -464,11 +467,11 @@ def _GoogleSearchRetrieval_to_vertex(
|
|
464
467
|
|
465
468
|
|
466
469
|
def _Tool_to_mldev(
|
467
|
-
api_client:
|
470
|
+
api_client: BaseApiClient,
|
468
471
|
from_object: Union[dict, object],
|
469
|
-
parent_object: dict = None,
|
472
|
+
parent_object: Optional[dict] = None,
|
470
473
|
) -> dict:
|
471
|
-
to_object = {}
|
474
|
+
to_object: dict[str, Any] = {}
|
472
475
|
if getv(from_object, ['function_declarations']) is not None:
|
473
476
|
setv(
|
474
477
|
to_object,
|
@@ -509,11 +512,11 @@ def _Tool_to_mldev(
|
|
509
512
|
|
510
513
|
|
511
514
|
def _Tool_to_vertex(
|
512
|
-
api_client:
|
515
|
+
api_client: BaseApiClient,
|
513
516
|
from_object: Union[dict, object],
|
514
|
-
parent_object: dict = None,
|
517
|
+
parent_object: Optional[dict] = None,
|
515
518
|
) -> dict:
|
516
|
-
to_object = {}
|
519
|
+
to_object: dict[str, Any] = {}
|
517
520
|
if getv(from_object, ['function_declarations']) is not None:
|
518
521
|
setv(
|
519
522
|
to_object,
|
@@ -554,11 +557,11 @@ def _Tool_to_vertex(
|
|
554
557
|
|
555
558
|
|
556
559
|
def _FunctionCallingConfig_to_mldev(
|
557
|
-
api_client:
|
560
|
+
api_client: BaseApiClient,
|
558
561
|
from_object: Union[dict, object],
|
559
|
-
parent_object: dict = None,
|
562
|
+
parent_object: Optional[dict] = None,
|
560
563
|
) -> dict:
|
561
|
-
to_object = {}
|
564
|
+
to_object: dict[str, Any] = {}
|
562
565
|
if getv(from_object, ['mode']) is not None:
|
563
566
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
564
567
|
|
@@ -573,11 +576,11 @@ def _FunctionCallingConfig_to_mldev(
|
|
573
576
|
|
574
577
|
|
575
578
|
def _FunctionCallingConfig_to_vertex(
|
576
|
-
api_client:
|
579
|
+
api_client: BaseApiClient,
|
577
580
|
from_object: Union[dict, object],
|
578
|
-
parent_object: dict = None,
|
581
|
+
parent_object: Optional[dict] = None,
|
579
582
|
) -> dict:
|
580
|
-
to_object = {}
|
583
|
+
to_object: dict[str, Any] = {}
|
581
584
|
if getv(from_object, ['mode']) is not None:
|
582
585
|
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
583
586
|
|
@@ -592,11 +595,11 @@ def _FunctionCallingConfig_to_vertex(
|
|
592
595
|
|
593
596
|
|
594
597
|
def _ToolConfig_to_mldev(
|
595
|
-
api_client:
|
598
|
+
api_client: BaseApiClient,
|
596
599
|
from_object: Union[dict, object],
|
597
|
-
parent_object: dict = None,
|
600
|
+
parent_object: Optional[dict] = None,
|
598
601
|
) -> dict:
|
599
|
-
to_object = {}
|
602
|
+
to_object: dict[str, Any] = {}
|
600
603
|
if getv(from_object, ['function_calling_config']) is not None:
|
601
604
|
setv(
|
602
605
|
to_object,
|
@@ -612,11 +615,11 @@ def _ToolConfig_to_mldev(
|
|
612
615
|
|
613
616
|
|
614
617
|
def _ToolConfig_to_vertex(
|
615
|
-
api_client:
|
618
|
+
api_client: BaseApiClient,
|
616
619
|
from_object: Union[dict, object],
|
617
|
-
parent_object: dict = None,
|
620
|
+
parent_object: Optional[dict] = None,
|
618
621
|
) -> dict:
|
619
|
-
to_object = {}
|
622
|
+
to_object: dict[str, Any] = {}
|
620
623
|
if getv(from_object, ['function_calling_config']) is not None:
|
621
624
|
setv(
|
622
625
|
to_object,
|
@@ -632,11 +635,11 @@ def _ToolConfig_to_vertex(
|
|
632
635
|
|
633
636
|
|
634
637
|
def _CreateCachedContentConfig_to_mldev(
|
635
|
-
api_client:
|
638
|
+
api_client: BaseApiClient,
|
636
639
|
from_object: Union[dict, object],
|
637
|
-
parent_object: dict = None,
|
640
|
+
parent_object: Optional[dict] = None,
|
638
641
|
) -> dict:
|
639
|
-
to_object = {}
|
642
|
+
to_object: dict[str, Any] = {}
|
640
643
|
|
641
644
|
if getv(from_object, ['ttl']) is not None:
|
642
645
|
setv(parent_object, ['ttl'], getv(from_object, ['ttl']))
|
@@ -693,11 +696,11 @@ def _CreateCachedContentConfig_to_mldev(
|
|
693
696
|
|
694
697
|
|
695
698
|
def _CreateCachedContentConfig_to_vertex(
|
696
|
-
api_client:
|
699
|
+
api_client: BaseApiClient,
|
697
700
|
from_object: Union[dict, object],
|
698
|
-
parent_object: dict = None,
|
701
|
+
parent_object: Optional[dict] = None,
|
699
702
|
) -> dict:
|
700
|
-
to_object = {}
|
703
|
+
to_object: dict[str, Any] = {}
|
701
704
|
|
702
705
|
if getv(from_object, ['ttl']) is not None:
|
703
706
|
setv(parent_object, ['ttl'], getv(from_object, ['ttl']))
|
@@ -754,11 +757,11 @@ def _CreateCachedContentConfig_to_vertex(
|
|
754
757
|
|
755
758
|
|
756
759
|
def _CreateCachedContentParameters_to_mldev(
|
757
|
-
api_client:
|
760
|
+
api_client: BaseApiClient,
|
758
761
|
from_object: Union[dict, object],
|
759
|
-
parent_object: dict = None,
|
762
|
+
parent_object: Optional[dict] = None,
|
760
763
|
) -> dict:
|
761
|
-
to_object = {}
|
764
|
+
to_object: dict[str, Any] = {}
|
762
765
|
if getv(from_object, ['model']) is not None:
|
763
766
|
setv(
|
764
767
|
to_object,
|
@@ -779,11 +782,11 @@ def _CreateCachedContentParameters_to_mldev(
|
|
779
782
|
|
780
783
|
|
781
784
|
def _CreateCachedContentParameters_to_vertex(
|
782
|
-
api_client:
|
785
|
+
api_client: BaseApiClient,
|
783
786
|
from_object: Union[dict, object],
|
784
|
-
parent_object: dict = None,
|
787
|
+
parent_object: Optional[dict] = None,
|
785
788
|
) -> dict:
|
786
|
-
to_object = {}
|
789
|
+
to_object: dict[str, Any] = {}
|
787
790
|
if getv(from_object, ['model']) is not None:
|
788
791
|
setv(
|
789
792
|
to_object,
|
@@ -804,11 +807,11 @@ def _CreateCachedContentParameters_to_vertex(
|
|
804
807
|
|
805
808
|
|
806
809
|
def _GetCachedContentParameters_to_mldev(
|
807
|
-
api_client:
|
810
|
+
api_client: BaseApiClient,
|
808
811
|
from_object: Union[dict, object],
|
809
|
-
parent_object: dict = None,
|
812
|
+
parent_object: Optional[dict] = None,
|
810
813
|
) -> dict:
|
811
|
-
to_object = {}
|
814
|
+
to_object: dict[str, Any] = {}
|
812
815
|
if getv(from_object, ['name']) is not None:
|
813
816
|
setv(
|
814
817
|
to_object,
|
@@ -823,11 +826,11 @@ def _GetCachedContentParameters_to_mldev(
|
|
823
826
|
|
824
827
|
|
825
828
|
def _GetCachedContentParameters_to_vertex(
|
826
|
-
api_client:
|
829
|
+
api_client: BaseApiClient,
|
827
830
|
from_object: Union[dict, object],
|
828
|
-
parent_object: dict = None,
|
831
|
+
parent_object: Optional[dict] = None,
|
829
832
|
) -> dict:
|
830
|
-
to_object = {}
|
833
|
+
to_object: dict[str, Any] = {}
|
831
834
|
if getv(from_object, ['name']) is not None:
|
832
835
|
setv(
|
833
836
|
to_object,
|
@@ -842,11 +845,11 @@ def _GetCachedContentParameters_to_vertex(
|
|
842
845
|
|
843
846
|
|
844
847
|
def _DeleteCachedContentParameters_to_mldev(
|
845
|
-
api_client:
|
848
|
+
api_client: BaseApiClient,
|
846
849
|
from_object: Union[dict, object],
|
847
|
-
parent_object: dict = None,
|
850
|
+
parent_object: Optional[dict] = None,
|
848
851
|
) -> dict:
|
849
|
-
to_object = {}
|
852
|
+
to_object: dict[str, Any] = {}
|
850
853
|
if getv(from_object, ['name']) is not None:
|
851
854
|
setv(
|
852
855
|
to_object,
|
@@ -861,11 +864,11 @@ def _DeleteCachedContentParameters_to_mldev(
|
|
861
864
|
|
862
865
|
|
863
866
|
def _DeleteCachedContentParameters_to_vertex(
|
864
|
-
api_client:
|
867
|
+
api_client: BaseApiClient,
|
865
868
|
from_object: Union[dict, object],
|
866
|
-
parent_object: dict = None,
|
869
|
+
parent_object: Optional[dict] = None,
|
867
870
|
) -> dict:
|
868
|
-
to_object = {}
|
871
|
+
to_object: dict[str, Any] = {}
|
869
872
|
if getv(from_object, ['name']) is not None:
|
870
873
|
setv(
|
871
874
|
to_object,
|
@@ -880,11 +883,11 @@ def _DeleteCachedContentParameters_to_vertex(
|
|
880
883
|
|
881
884
|
|
882
885
|
def _UpdateCachedContentConfig_to_mldev(
|
883
|
-
api_client:
|
886
|
+
api_client: BaseApiClient,
|
884
887
|
from_object: Union[dict, object],
|
885
|
-
parent_object: dict = None,
|
888
|
+
parent_object: Optional[dict] = None,
|
886
889
|
) -> dict:
|
887
|
-
to_object = {}
|
890
|
+
to_object: dict[str, Any] = {}
|
888
891
|
|
889
892
|
if getv(from_object, ['ttl']) is not None:
|
890
893
|
setv(parent_object, ['ttl'], getv(from_object, ['ttl']))
|
@@ -896,11 +899,11 @@ def _UpdateCachedContentConfig_to_mldev(
|
|
896
899
|
|
897
900
|
|
898
901
|
def _UpdateCachedContentConfig_to_vertex(
|
899
|
-
api_client:
|
902
|
+
api_client: BaseApiClient,
|
900
903
|
from_object: Union[dict, object],
|
901
|
-
parent_object: dict = None,
|
904
|
+
parent_object: Optional[dict] = None,
|
902
905
|
) -> dict:
|
903
|
-
to_object = {}
|
906
|
+
to_object: dict[str, Any] = {}
|
904
907
|
|
905
908
|
if getv(from_object, ['ttl']) is not None:
|
906
909
|
setv(parent_object, ['ttl'], getv(from_object, ['ttl']))
|
@@ -912,11 +915,11 @@ def _UpdateCachedContentConfig_to_vertex(
|
|
912
915
|
|
913
916
|
|
914
917
|
def _UpdateCachedContentParameters_to_mldev(
|
915
|
-
api_client:
|
918
|
+
api_client: BaseApiClient,
|
916
919
|
from_object: Union[dict, object],
|
917
|
-
parent_object: dict = None,
|
920
|
+
parent_object: Optional[dict] = None,
|
918
921
|
) -> dict:
|
919
|
-
to_object = {}
|
922
|
+
to_object: dict[str, Any] = {}
|
920
923
|
if getv(from_object, ['name']) is not None:
|
921
924
|
setv(
|
922
925
|
to_object,
|
@@ -937,11 +940,11 @@ def _UpdateCachedContentParameters_to_mldev(
|
|
937
940
|
|
938
941
|
|
939
942
|
def _UpdateCachedContentParameters_to_vertex(
|
940
|
-
api_client:
|
943
|
+
api_client: BaseApiClient,
|
941
944
|
from_object: Union[dict, object],
|
942
|
-
parent_object: dict = None,
|
945
|
+
parent_object: Optional[dict] = None,
|
943
946
|
) -> dict:
|
944
|
-
to_object = {}
|
947
|
+
to_object: dict[str, Any] = {}
|
945
948
|
if getv(from_object, ['name']) is not None:
|
946
949
|
setv(
|
947
950
|
to_object,
|
@@ -962,11 +965,11 @@ def _UpdateCachedContentParameters_to_vertex(
|
|
962
965
|
|
963
966
|
|
964
967
|
def _ListCachedContentsConfig_to_mldev(
|
965
|
-
api_client:
|
968
|
+
api_client: BaseApiClient,
|
966
969
|
from_object: Union[dict, object],
|
967
|
-
parent_object: dict = None,
|
970
|
+
parent_object: Optional[dict] = None,
|
968
971
|
) -> dict:
|
969
|
-
to_object = {}
|
972
|
+
to_object: dict[str, Any] = {}
|
970
973
|
|
971
974
|
if getv(from_object, ['page_size']) is not None:
|
972
975
|
setv(
|
@@ -984,11 +987,11 @@ def _ListCachedContentsConfig_to_mldev(
|
|
984
987
|
|
985
988
|
|
986
989
|
def _ListCachedContentsConfig_to_vertex(
|
987
|
-
api_client:
|
990
|
+
api_client: BaseApiClient,
|
988
991
|
from_object: Union[dict, object],
|
989
|
-
parent_object: dict = None,
|
992
|
+
parent_object: Optional[dict] = None,
|
990
993
|
) -> dict:
|
991
|
-
to_object = {}
|
994
|
+
to_object: dict[str, Any] = {}
|
992
995
|
|
993
996
|
if getv(from_object, ['page_size']) is not None:
|
994
997
|
setv(
|
@@ -1006,11 +1009,11 @@ def _ListCachedContentsConfig_to_vertex(
|
|
1006
1009
|
|
1007
1010
|
|
1008
1011
|
def _ListCachedContentsParameters_to_mldev(
|
1009
|
-
api_client:
|
1012
|
+
api_client: BaseApiClient,
|
1010
1013
|
from_object: Union[dict, object],
|
1011
|
-
parent_object: dict = None,
|
1014
|
+
parent_object: Optional[dict] = None,
|
1012
1015
|
) -> dict:
|
1013
|
-
to_object = {}
|
1016
|
+
to_object: dict[str, Any] = {}
|
1014
1017
|
if getv(from_object, ['config']) is not None:
|
1015
1018
|
setv(
|
1016
1019
|
to_object,
|
@@ -1024,11 +1027,11 @@ def _ListCachedContentsParameters_to_mldev(
|
|
1024
1027
|
|
1025
1028
|
|
1026
1029
|
def _ListCachedContentsParameters_to_vertex(
|
1027
|
-
api_client:
|
1030
|
+
api_client: BaseApiClient,
|
1028
1031
|
from_object: Union[dict, object],
|
1029
|
-
parent_object: dict = None,
|
1032
|
+
parent_object: Optional[dict] = None,
|
1030
1033
|
) -> dict:
|
1031
|
-
to_object = {}
|
1034
|
+
to_object: dict[str, Any] = {}
|
1032
1035
|
if getv(from_object, ['config']) is not None:
|
1033
1036
|
setv(
|
1034
1037
|
to_object,
|
@@ -1042,11 +1045,11 @@ def _ListCachedContentsParameters_to_vertex(
|
|
1042
1045
|
|
1043
1046
|
|
1044
1047
|
def _CachedContent_from_mldev(
|
1045
|
-
api_client:
|
1048
|
+
api_client: BaseApiClient,
|
1046
1049
|
from_object: Union[dict, object],
|
1047
|
-
parent_object: dict = None,
|
1050
|
+
parent_object: Optional[dict] = None,
|
1048
1051
|
) -> dict:
|
1049
|
-
to_object = {}
|
1052
|
+
to_object: dict[str, Any] = {}
|
1050
1053
|
if getv(from_object, ['name']) is not None:
|
1051
1054
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
1052
1055
|
|
@@ -1072,11 +1075,11 @@ def _CachedContent_from_mldev(
|
|
1072
1075
|
|
1073
1076
|
|
1074
1077
|
def _CachedContent_from_vertex(
|
1075
|
-
api_client:
|
1078
|
+
api_client: BaseApiClient,
|
1076
1079
|
from_object: Union[dict, object],
|
1077
|
-
parent_object: dict = None,
|
1080
|
+
parent_object: Optional[dict] = None,
|
1078
1081
|
) -> dict:
|
1079
|
-
to_object = {}
|
1082
|
+
to_object: dict[str, Any] = {}
|
1080
1083
|
if getv(from_object, ['name']) is not None:
|
1081
1084
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
1082
1085
|
|
@@ -1102,31 +1105,31 @@ def _CachedContent_from_vertex(
|
|
1102
1105
|
|
1103
1106
|
|
1104
1107
|
def _DeleteCachedContentResponse_from_mldev(
|
1105
|
-
api_client:
|
1108
|
+
api_client: BaseApiClient,
|
1106
1109
|
from_object: Union[dict, object],
|
1107
|
-
parent_object: dict = None,
|
1110
|
+
parent_object: Optional[dict] = None,
|
1108
1111
|
) -> dict:
|
1109
|
-
to_object = {}
|
1112
|
+
to_object: dict[str, Any] = {}
|
1110
1113
|
|
1111
1114
|
return to_object
|
1112
1115
|
|
1113
1116
|
|
1114
1117
|
def _DeleteCachedContentResponse_from_vertex(
|
1115
|
-
api_client:
|
1118
|
+
api_client: BaseApiClient,
|
1116
1119
|
from_object: Union[dict, object],
|
1117
|
-
parent_object: dict = None,
|
1120
|
+
parent_object: Optional[dict] = None,
|
1118
1121
|
) -> dict:
|
1119
|
-
to_object = {}
|
1122
|
+
to_object: dict[str, Any] = {}
|
1120
1123
|
|
1121
1124
|
return to_object
|
1122
1125
|
|
1123
1126
|
|
1124
1127
|
def _ListCachedContentsResponse_from_mldev(
|
1125
|
-
api_client:
|
1128
|
+
api_client: BaseApiClient,
|
1126
1129
|
from_object: Union[dict, object],
|
1127
|
-
parent_object: dict = None,
|
1130
|
+
parent_object: Optional[dict] = None,
|
1128
1131
|
) -> dict:
|
1129
|
-
to_object = {}
|
1132
|
+
to_object: dict[str, Any] = {}
|
1130
1133
|
if getv(from_object, ['nextPageToken']) is not None:
|
1131
1134
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
1132
1135
|
|
@@ -1144,11 +1147,11 @@ def _ListCachedContentsResponse_from_mldev(
|
|
1144
1147
|
|
1145
1148
|
|
1146
1149
|
def _ListCachedContentsResponse_from_vertex(
|
1147
|
-
api_client:
|
1150
|
+
api_client: BaseApiClient,
|
1148
1151
|
from_object: Union[dict, object],
|
1149
|
-
parent_object: dict = None,
|
1152
|
+
parent_object: Optional[dict] = None,
|
1150
1153
|
) -> dict:
|
1151
|
-
to_object = {}
|
1154
|
+
to_object: dict[str, Any] = {}
|
1152
1155
|
if getv(from_object, ['nextPageToken']) is not None:
|
1153
1156
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
1154
1157
|
|
@@ -1183,7 +1186,7 @@ class Caches(_api_module.BaseModule):
|
|
1183
1186
|
.. code-block:: python
|
1184
1187
|
|
1185
1188
|
contents = ... // Initialize the content to cache.
|
1186
|
-
response =
|
1189
|
+
response = client.caches.create(
|
1187
1190
|
model= ... // The publisher model id
|
1188
1191
|
contents=contents,
|
1189
1192
|
config={
|
@@ -1199,23 +1202,33 @@ class Caches(_api_module.BaseModule):
|
|
1199
1202
|
config=config,
|
1200
1203
|
)
|
1201
1204
|
|
1205
|
+
request_url_dict: Optional[dict[str, str]]
|
1206
|
+
|
1202
1207
|
if self._api_client.vertexai:
|
1203
1208
|
request_dict = _CreateCachedContentParameters_to_vertex(
|
1204
1209
|
self._api_client, parameter_model
|
1205
1210
|
)
|
1206
|
-
|
1211
|
+
request_url_dict = request_dict.get('_url')
|
1212
|
+
if request_url_dict:
|
1213
|
+
path = 'cachedContents'.format_map(request_url_dict)
|
1214
|
+
else:
|
1215
|
+
path = 'cachedContents'
|
1207
1216
|
else:
|
1208
1217
|
request_dict = _CreateCachedContentParameters_to_mldev(
|
1209
1218
|
self._api_client, parameter_model
|
1210
1219
|
)
|
1211
|
-
|
1220
|
+
request_url_dict = request_dict.get('_url')
|
1221
|
+
if request_url_dict:
|
1222
|
+
path = 'cachedContents'.format_map(request_url_dict)
|
1223
|
+
else:
|
1224
|
+
path = 'cachedContents'
|
1212
1225
|
query_params = request_dict.get('_query')
|
1213
1226
|
if query_params:
|
1214
1227
|
path = f'{path}?{urlencode(query_params)}'
|
1215
1228
|
# TODO: remove the hack that pops config.
|
1216
1229
|
request_dict.pop('config', None)
|
1217
1230
|
|
1218
|
-
http_options = None
|
1231
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1219
1232
|
if isinstance(config, dict):
|
1220
1233
|
http_options = config.get('http_options', None)
|
1221
1234
|
elif hasattr(config, 'http_options'):
|
@@ -1236,7 +1249,7 @@ class Caches(_api_module.BaseModule):
|
|
1236
1249
|
response_dict = _CachedContent_from_mldev(self._api_client, response_dict)
|
1237
1250
|
|
1238
1251
|
return_value = types.CachedContent._from_response(
|
1239
|
-
response=response_dict, kwargs=parameter_model
|
1252
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1240
1253
|
)
|
1241
1254
|
self._api_client._verify_response(return_value)
|
1242
1255
|
return return_value
|
@@ -1251,8 +1264,7 @@ class Caches(_api_module.BaseModule):
|
|
1251
1264
|
|
1252
1265
|
.. code-block:: python
|
1253
1266
|
|
1254
|
-
|
1255
|
-
name.
|
1267
|
+
client.caches.get(name= ... ) // The server-generated resource name.
|
1256
1268
|
"""
|
1257
1269
|
|
1258
1270
|
parameter_model = types._GetCachedContentParameters(
|
@@ -1260,23 +1272,33 @@ class Caches(_api_module.BaseModule):
|
|
1260
1272
|
config=config,
|
1261
1273
|
)
|
1262
1274
|
|
1275
|
+
request_url_dict: Optional[dict[str, str]]
|
1276
|
+
|
1263
1277
|
if self._api_client.vertexai:
|
1264
1278
|
request_dict = _GetCachedContentParameters_to_vertex(
|
1265
1279
|
self._api_client, parameter_model
|
1266
1280
|
)
|
1267
|
-
|
1281
|
+
request_url_dict = request_dict.get('_url')
|
1282
|
+
if request_url_dict:
|
1283
|
+
path = '{name}'.format_map(request_url_dict)
|
1284
|
+
else:
|
1285
|
+
path = '{name}'
|
1268
1286
|
else:
|
1269
1287
|
request_dict = _GetCachedContentParameters_to_mldev(
|
1270
1288
|
self._api_client, parameter_model
|
1271
1289
|
)
|
1272
|
-
|
1290
|
+
request_url_dict = request_dict.get('_url')
|
1291
|
+
if request_url_dict:
|
1292
|
+
path = '{name}'.format_map(request_url_dict)
|
1293
|
+
else:
|
1294
|
+
path = '{name}'
|
1273
1295
|
query_params = request_dict.get('_query')
|
1274
1296
|
if query_params:
|
1275
1297
|
path = f'{path}?{urlencode(query_params)}'
|
1276
1298
|
# TODO: remove the hack that pops config.
|
1277
1299
|
request_dict.pop('config', None)
|
1278
1300
|
|
1279
|
-
http_options = None
|
1301
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1280
1302
|
if isinstance(config, dict):
|
1281
1303
|
http_options = config.get('http_options', None)
|
1282
1304
|
elif hasattr(config, 'http_options'):
|
@@ -1297,7 +1319,7 @@ class Caches(_api_module.BaseModule):
|
|
1297
1319
|
response_dict = _CachedContent_from_mldev(self._api_client, response_dict)
|
1298
1320
|
|
1299
1321
|
return_value = types.CachedContent._from_response(
|
1300
|
-
response=response_dict, kwargs=parameter_model
|
1322
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1301
1323
|
)
|
1302
1324
|
self._api_client._verify_response(return_value)
|
1303
1325
|
return return_value
|
@@ -1314,8 +1336,7 @@ class Caches(_api_module.BaseModule):
|
|
1314
1336
|
|
1315
1337
|
.. code-block:: python
|
1316
1338
|
|
1317
|
-
|
1318
|
-
resource name.
|
1339
|
+
client.caches.delete(name= ... ) // The server-generated resource name.
|
1319
1340
|
"""
|
1320
1341
|
|
1321
1342
|
parameter_model = types._DeleteCachedContentParameters(
|
@@ -1323,23 +1344,33 @@ class Caches(_api_module.BaseModule):
|
|
1323
1344
|
config=config,
|
1324
1345
|
)
|
1325
1346
|
|
1347
|
+
request_url_dict: Optional[dict[str, str]]
|
1348
|
+
|
1326
1349
|
if self._api_client.vertexai:
|
1327
1350
|
request_dict = _DeleteCachedContentParameters_to_vertex(
|
1328
1351
|
self._api_client, parameter_model
|
1329
1352
|
)
|
1330
|
-
|
1353
|
+
request_url_dict = request_dict.get('_url')
|
1354
|
+
if request_url_dict:
|
1355
|
+
path = '{name}'.format_map(request_url_dict)
|
1356
|
+
else:
|
1357
|
+
path = '{name}'
|
1331
1358
|
else:
|
1332
1359
|
request_dict = _DeleteCachedContentParameters_to_mldev(
|
1333
1360
|
self._api_client, parameter_model
|
1334
1361
|
)
|
1335
|
-
|
1362
|
+
request_url_dict = request_dict.get('_url')
|
1363
|
+
if request_url_dict:
|
1364
|
+
path = '{name}'.format_map(request_url_dict)
|
1365
|
+
else:
|
1366
|
+
path = '{name}'
|
1336
1367
|
query_params = request_dict.get('_query')
|
1337
1368
|
if query_params:
|
1338
1369
|
path = f'{path}?{urlencode(query_params)}'
|
1339
1370
|
# TODO: remove the hack that pops config.
|
1340
1371
|
request_dict.pop('config', None)
|
1341
1372
|
|
1342
|
-
http_options = None
|
1373
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1343
1374
|
if isinstance(config, dict):
|
1344
1375
|
http_options = config.get('http_options', None)
|
1345
1376
|
elif hasattr(config, 'http_options'):
|
@@ -1362,7 +1393,7 @@ class Caches(_api_module.BaseModule):
|
|
1362
1393
|
)
|
1363
1394
|
|
1364
1395
|
return_value = types.DeleteCachedContentResponse._from_response(
|
1365
|
-
response=response_dict, kwargs=parameter_model
|
1396
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1366
1397
|
)
|
1367
1398
|
self._api_client._verify_response(return_value)
|
1368
1399
|
return return_value
|
@@ -1377,7 +1408,7 @@ class Caches(_api_module.BaseModule):
|
|
1377
1408
|
|
1378
1409
|
.. code-block:: python
|
1379
1410
|
|
1380
|
-
response =
|
1411
|
+
response = client.caches.update(
|
1381
1412
|
name= ... // The server-generated resource name.
|
1382
1413
|
config={
|
1383
1414
|
'ttl': '7600s',
|
@@ -1390,23 +1421,33 @@ class Caches(_api_module.BaseModule):
|
|
1390
1421
|
config=config,
|
1391
1422
|
)
|
1392
1423
|
|
1424
|
+
request_url_dict: Optional[dict[str, str]]
|
1425
|
+
|
1393
1426
|
if self._api_client.vertexai:
|
1394
1427
|
request_dict = _UpdateCachedContentParameters_to_vertex(
|
1395
1428
|
self._api_client, parameter_model
|
1396
1429
|
)
|
1397
|
-
|
1430
|
+
request_url_dict = request_dict.get('_url')
|
1431
|
+
if request_url_dict:
|
1432
|
+
path = '{name}'.format_map(request_url_dict)
|
1433
|
+
else:
|
1434
|
+
path = '{name}'
|
1398
1435
|
else:
|
1399
1436
|
request_dict = _UpdateCachedContentParameters_to_mldev(
|
1400
1437
|
self._api_client, parameter_model
|
1401
1438
|
)
|
1402
|
-
|
1439
|
+
request_url_dict = request_dict.get('_url')
|
1440
|
+
if request_url_dict:
|
1441
|
+
path = '{name}'.format_map(request_url_dict)
|
1442
|
+
else:
|
1443
|
+
path = '{name}'
|
1403
1444
|
query_params = request_dict.get('_query')
|
1404
1445
|
if query_params:
|
1405
1446
|
path = f'{path}?{urlencode(query_params)}'
|
1406
1447
|
# TODO: remove the hack that pops config.
|
1407
1448
|
request_dict.pop('config', None)
|
1408
1449
|
|
1409
|
-
http_options = None
|
1450
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1410
1451
|
if isinstance(config, dict):
|
1411
1452
|
http_options = config.get('http_options', None)
|
1412
1453
|
elif hasattr(config, 'http_options'):
|
@@ -1427,7 +1468,7 @@ class Caches(_api_module.BaseModule):
|
|
1427
1468
|
response_dict = _CachedContent_from_mldev(self._api_client, response_dict)
|
1428
1469
|
|
1429
1470
|
return_value = types.CachedContent._from_response(
|
1430
|
-
response=response_dict, kwargs=parameter_model
|
1471
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1431
1472
|
)
|
1432
1473
|
self._api_client._verify_response(return_value)
|
1433
1474
|
return return_value
|
@@ -1439,8 +1480,8 @@ class Caches(_api_module.BaseModule):
|
|
1439
1480
|
|
1440
1481
|
.. code-block:: python
|
1441
1482
|
|
1442
|
-
cached_contents =
|
1443
|
-
|
1483
|
+
cached_contents = client.caches.list(config={'page_size': 2})
|
1484
|
+
for cached_content in cached_contents:
|
1444
1485
|
print(cached_content)
|
1445
1486
|
"""
|
1446
1487
|
|
@@ -1448,23 +1489,33 @@ class Caches(_api_module.BaseModule):
|
|
1448
1489
|
config=config,
|
1449
1490
|
)
|
1450
1491
|
|
1492
|
+
request_url_dict: Optional[dict[str, str]]
|
1493
|
+
|
1451
1494
|
if self._api_client.vertexai:
|
1452
1495
|
request_dict = _ListCachedContentsParameters_to_vertex(
|
1453
1496
|
self._api_client, parameter_model
|
1454
1497
|
)
|
1455
|
-
|
1498
|
+
request_url_dict = request_dict.get('_url')
|
1499
|
+
if request_url_dict:
|
1500
|
+
path = 'cachedContents'.format_map(request_url_dict)
|
1501
|
+
else:
|
1502
|
+
path = 'cachedContents'
|
1456
1503
|
else:
|
1457
1504
|
request_dict = _ListCachedContentsParameters_to_mldev(
|
1458
1505
|
self._api_client, parameter_model
|
1459
1506
|
)
|
1460
|
-
|
1507
|
+
request_url_dict = request_dict.get('_url')
|
1508
|
+
if request_url_dict:
|
1509
|
+
path = 'cachedContents'.format_map(request_url_dict)
|
1510
|
+
else:
|
1511
|
+
path = 'cachedContents'
|
1461
1512
|
query_params = request_dict.get('_query')
|
1462
1513
|
if query_params:
|
1463
1514
|
path = f'{path}?{urlencode(query_params)}'
|
1464
1515
|
# TODO: remove the hack that pops config.
|
1465
1516
|
request_dict.pop('config', None)
|
1466
1517
|
|
1467
|
-
http_options = None
|
1518
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1468
1519
|
if isinstance(config, dict):
|
1469
1520
|
http_options = config.get('http_options', None)
|
1470
1521
|
elif hasattr(config, 'http_options'):
|
@@ -1487,7 +1538,7 @@ class Caches(_api_module.BaseModule):
|
|
1487
1538
|
)
|
1488
1539
|
|
1489
1540
|
return_value = types.ListCachedContentsResponse._from_response(
|
1490
|
-
response=response_dict, kwargs=parameter_model
|
1541
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1491
1542
|
)
|
1492
1543
|
self._api_client._verify_response(return_value)
|
1493
1544
|
return return_value
|
@@ -1537,23 +1588,33 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1537
1588
|
config=config,
|
1538
1589
|
)
|
1539
1590
|
|
1591
|
+
request_url_dict: Optional[dict[str, str]]
|
1592
|
+
|
1540
1593
|
if self._api_client.vertexai:
|
1541
1594
|
request_dict = _CreateCachedContentParameters_to_vertex(
|
1542
1595
|
self._api_client, parameter_model
|
1543
1596
|
)
|
1544
|
-
|
1597
|
+
request_url_dict = request_dict.get('_url')
|
1598
|
+
if request_url_dict:
|
1599
|
+
path = 'cachedContents'.format_map(request_url_dict)
|
1600
|
+
else:
|
1601
|
+
path = 'cachedContents'
|
1545
1602
|
else:
|
1546
1603
|
request_dict = _CreateCachedContentParameters_to_mldev(
|
1547
1604
|
self._api_client, parameter_model
|
1548
1605
|
)
|
1549
|
-
|
1606
|
+
request_url_dict = request_dict.get('_url')
|
1607
|
+
if request_url_dict:
|
1608
|
+
path = 'cachedContents'.format_map(request_url_dict)
|
1609
|
+
else:
|
1610
|
+
path = 'cachedContents'
|
1550
1611
|
query_params = request_dict.get('_query')
|
1551
1612
|
if query_params:
|
1552
1613
|
path = f'{path}?{urlencode(query_params)}'
|
1553
1614
|
# TODO: remove the hack that pops config.
|
1554
1615
|
request_dict.pop('config', None)
|
1555
1616
|
|
1556
|
-
http_options = None
|
1617
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1557
1618
|
if isinstance(config, dict):
|
1558
1619
|
http_options = config.get('http_options', None)
|
1559
1620
|
elif hasattr(config, 'http_options'):
|
@@ -1574,7 +1635,7 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1574
1635
|
response_dict = _CachedContent_from_mldev(self._api_client, response_dict)
|
1575
1636
|
|
1576
1637
|
return_value = types.CachedContent._from_response(
|
1577
|
-
response=response_dict, kwargs=parameter_model
|
1638
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1578
1639
|
)
|
1579
1640
|
self._api_client._verify_response(return_value)
|
1580
1641
|
return return_value
|
@@ -1598,23 +1659,33 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1598
1659
|
config=config,
|
1599
1660
|
)
|
1600
1661
|
|
1662
|
+
request_url_dict: Optional[dict[str, str]]
|
1663
|
+
|
1601
1664
|
if self._api_client.vertexai:
|
1602
1665
|
request_dict = _GetCachedContentParameters_to_vertex(
|
1603
1666
|
self._api_client, parameter_model
|
1604
1667
|
)
|
1605
|
-
|
1668
|
+
request_url_dict = request_dict.get('_url')
|
1669
|
+
if request_url_dict:
|
1670
|
+
path = '{name}'.format_map(request_url_dict)
|
1671
|
+
else:
|
1672
|
+
path = '{name}'
|
1606
1673
|
else:
|
1607
1674
|
request_dict = _GetCachedContentParameters_to_mldev(
|
1608
1675
|
self._api_client, parameter_model
|
1609
1676
|
)
|
1610
|
-
|
1677
|
+
request_url_dict = request_dict.get('_url')
|
1678
|
+
if request_url_dict:
|
1679
|
+
path = '{name}'.format_map(request_url_dict)
|
1680
|
+
else:
|
1681
|
+
path = '{name}'
|
1611
1682
|
query_params = request_dict.get('_query')
|
1612
1683
|
if query_params:
|
1613
1684
|
path = f'{path}?{urlencode(query_params)}'
|
1614
1685
|
# TODO: remove the hack that pops config.
|
1615
1686
|
request_dict.pop('config', None)
|
1616
1687
|
|
1617
|
-
http_options = None
|
1688
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1618
1689
|
if isinstance(config, dict):
|
1619
1690
|
http_options = config.get('http_options', None)
|
1620
1691
|
elif hasattr(config, 'http_options'):
|
@@ -1635,7 +1706,7 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1635
1706
|
response_dict = _CachedContent_from_mldev(self._api_client, response_dict)
|
1636
1707
|
|
1637
1708
|
return_value = types.CachedContent._from_response(
|
1638
|
-
response=response_dict, kwargs=parameter_model
|
1709
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1639
1710
|
)
|
1640
1711
|
self._api_client._verify_response(return_value)
|
1641
1712
|
return return_value
|
@@ -1661,23 +1732,33 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1661
1732
|
config=config,
|
1662
1733
|
)
|
1663
1734
|
|
1735
|
+
request_url_dict: Optional[dict[str, str]]
|
1736
|
+
|
1664
1737
|
if self._api_client.vertexai:
|
1665
1738
|
request_dict = _DeleteCachedContentParameters_to_vertex(
|
1666
1739
|
self._api_client, parameter_model
|
1667
1740
|
)
|
1668
|
-
|
1741
|
+
request_url_dict = request_dict.get('_url')
|
1742
|
+
if request_url_dict:
|
1743
|
+
path = '{name}'.format_map(request_url_dict)
|
1744
|
+
else:
|
1745
|
+
path = '{name}'
|
1669
1746
|
else:
|
1670
1747
|
request_dict = _DeleteCachedContentParameters_to_mldev(
|
1671
1748
|
self._api_client, parameter_model
|
1672
1749
|
)
|
1673
|
-
|
1750
|
+
request_url_dict = request_dict.get('_url')
|
1751
|
+
if request_url_dict:
|
1752
|
+
path = '{name}'.format_map(request_url_dict)
|
1753
|
+
else:
|
1754
|
+
path = '{name}'
|
1674
1755
|
query_params = request_dict.get('_query')
|
1675
1756
|
if query_params:
|
1676
1757
|
path = f'{path}?{urlencode(query_params)}'
|
1677
1758
|
# TODO: remove the hack that pops config.
|
1678
1759
|
request_dict.pop('config', None)
|
1679
1760
|
|
1680
|
-
http_options = None
|
1761
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1681
1762
|
if isinstance(config, dict):
|
1682
1763
|
http_options = config.get('http_options', None)
|
1683
1764
|
elif hasattr(config, 'http_options'):
|
@@ -1700,7 +1781,7 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1700
1781
|
)
|
1701
1782
|
|
1702
1783
|
return_value = types.DeleteCachedContentResponse._from_response(
|
1703
|
-
response=response_dict, kwargs=parameter_model
|
1784
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1704
1785
|
)
|
1705
1786
|
self._api_client._verify_response(return_value)
|
1706
1787
|
return return_value
|
@@ -1728,23 +1809,33 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1728
1809
|
config=config,
|
1729
1810
|
)
|
1730
1811
|
|
1812
|
+
request_url_dict: Optional[dict[str, str]]
|
1813
|
+
|
1731
1814
|
if self._api_client.vertexai:
|
1732
1815
|
request_dict = _UpdateCachedContentParameters_to_vertex(
|
1733
1816
|
self._api_client, parameter_model
|
1734
1817
|
)
|
1735
|
-
|
1818
|
+
request_url_dict = request_dict.get('_url')
|
1819
|
+
if request_url_dict:
|
1820
|
+
path = '{name}'.format_map(request_url_dict)
|
1821
|
+
else:
|
1822
|
+
path = '{name}'
|
1736
1823
|
else:
|
1737
1824
|
request_dict = _UpdateCachedContentParameters_to_mldev(
|
1738
1825
|
self._api_client, parameter_model
|
1739
1826
|
)
|
1740
|
-
|
1827
|
+
request_url_dict = request_dict.get('_url')
|
1828
|
+
if request_url_dict:
|
1829
|
+
path = '{name}'.format_map(request_url_dict)
|
1830
|
+
else:
|
1831
|
+
path = '{name}'
|
1741
1832
|
query_params = request_dict.get('_query')
|
1742
1833
|
if query_params:
|
1743
1834
|
path = f'{path}?{urlencode(query_params)}'
|
1744
1835
|
# TODO: remove the hack that pops config.
|
1745
1836
|
request_dict.pop('config', None)
|
1746
1837
|
|
1747
|
-
http_options = None
|
1838
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1748
1839
|
if isinstance(config, dict):
|
1749
1840
|
http_options = config.get('http_options', None)
|
1750
1841
|
elif hasattr(config, 'http_options'):
|
@@ -1765,7 +1856,7 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1765
1856
|
response_dict = _CachedContent_from_mldev(self._api_client, response_dict)
|
1766
1857
|
|
1767
1858
|
return_value = types.CachedContent._from_response(
|
1768
|
-
response=response_dict, kwargs=parameter_model
|
1859
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1769
1860
|
)
|
1770
1861
|
self._api_client._verify_response(return_value)
|
1771
1862
|
return return_value
|
@@ -1786,23 +1877,33 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1786
1877
|
config=config,
|
1787
1878
|
)
|
1788
1879
|
|
1880
|
+
request_url_dict: Optional[dict[str, str]]
|
1881
|
+
|
1789
1882
|
if self._api_client.vertexai:
|
1790
1883
|
request_dict = _ListCachedContentsParameters_to_vertex(
|
1791
1884
|
self._api_client, parameter_model
|
1792
1885
|
)
|
1793
|
-
|
1886
|
+
request_url_dict = request_dict.get('_url')
|
1887
|
+
if request_url_dict:
|
1888
|
+
path = 'cachedContents'.format_map(request_url_dict)
|
1889
|
+
else:
|
1890
|
+
path = 'cachedContents'
|
1794
1891
|
else:
|
1795
1892
|
request_dict = _ListCachedContentsParameters_to_mldev(
|
1796
1893
|
self._api_client, parameter_model
|
1797
1894
|
)
|
1798
|
-
|
1895
|
+
request_url_dict = request_dict.get('_url')
|
1896
|
+
if request_url_dict:
|
1897
|
+
path = 'cachedContents'.format_map(request_url_dict)
|
1898
|
+
else:
|
1899
|
+
path = 'cachedContents'
|
1799
1900
|
query_params = request_dict.get('_query')
|
1800
1901
|
if query_params:
|
1801
1902
|
path = f'{path}?{urlencode(query_params)}'
|
1802
1903
|
# TODO: remove the hack that pops config.
|
1803
1904
|
request_dict.pop('config', None)
|
1804
1905
|
|
1805
|
-
http_options = None
|
1906
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1806
1907
|
if isinstance(config, dict):
|
1807
1908
|
http_options = config.get('http_options', None)
|
1808
1909
|
elif hasattr(config, 'http_options'):
|
@@ -1825,7 +1926,7 @@ class AsyncCaches(_api_module.BaseModule):
|
|
1825
1926
|
)
|
1826
1927
|
|
1827
1928
|
return_value = types.ListCachedContentsResponse._from_response(
|
1828
|
-
response=response_dict, kwargs=parameter_model
|
1929
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1829
1930
|
)
|
1830
1931
|
self._api_client._verify_response(return_value)
|
1831
1932
|
return return_value
|