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/batches.py
CHANGED
@@ -15,25 +15,28 @@
|
|
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 _extra_utils
|
23
24
|
from . import _transformers as t
|
24
25
|
from . import types
|
25
|
-
from ._api_client import
|
26
|
+
from ._api_client import BaseApiClient
|
26
27
|
from ._common import get_value_by_path as getv
|
27
28
|
from ._common import set_value_by_path as setv
|
28
29
|
from .pagers import AsyncPager, Pager
|
29
30
|
|
31
|
+
logger = logging.getLogger('google_genai.batches')
|
32
|
+
|
30
33
|
|
31
34
|
def _BatchJobSource_to_mldev(
|
32
|
-
api_client:
|
35
|
+
api_client: BaseApiClient,
|
33
36
|
from_object: Union[dict, object],
|
34
|
-
parent_object: dict = None,
|
37
|
+
parent_object: Optional[dict] = None,
|
35
38
|
) -> dict:
|
36
|
-
to_object = {}
|
39
|
+
to_object: dict[str, Any] = {}
|
37
40
|
if getv(from_object, ['format']) is not None:
|
38
41
|
raise ValueError('format parameter is not supported in Gemini API.')
|
39
42
|
|
@@ -47,11 +50,11 @@ def _BatchJobSource_to_mldev(
|
|
47
50
|
|
48
51
|
|
49
52
|
def _BatchJobSource_to_vertex(
|
50
|
-
api_client:
|
53
|
+
api_client: BaseApiClient,
|
51
54
|
from_object: Union[dict, object],
|
52
|
-
parent_object: dict = None,
|
55
|
+
parent_object: Optional[dict] = None,
|
53
56
|
) -> dict:
|
54
|
-
to_object = {}
|
57
|
+
to_object: dict[str, Any] = {}
|
55
58
|
if getv(from_object, ['format']) is not None:
|
56
59
|
setv(to_object, ['instancesFormat'], getv(from_object, ['format']))
|
57
60
|
|
@@ -69,11 +72,11 @@ def _BatchJobSource_to_vertex(
|
|
69
72
|
|
70
73
|
|
71
74
|
def _BatchJobDestination_to_mldev(
|
72
|
-
api_client:
|
75
|
+
api_client: BaseApiClient,
|
73
76
|
from_object: Union[dict, object],
|
74
|
-
parent_object: dict = None,
|
77
|
+
parent_object: Optional[dict] = None,
|
75
78
|
) -> dict:
|
76
|
-
to_object = {}
|
79
|
+
to_object: dict[str, Any] = {}
|
77
80
|
if getv(from_object, ['format']) is not None:
|
78
81
|
raise ValueError('format parameter is not supported in Gemini API.')
|
79
82
|
|
@@ -87,11 +90,11 @@ def _BatchJobDestination_to_mldev(
|
|
87
90
|
|
88
91
|
|
89
92
|
def _BatchJobDestination_to_vertex(
|
90
|
-
api_client:
|
93
|
+
api_client: BaseApiClient,
|
91
94
|
from_object: Union[dict, object],
|
92
|
-
parent_object: dict = None,
|
95
|
+
parent_object: Optional[dict] = None,
|
93
96
|
) -> dict:
|
94
|
-
to_object = {}
|
97
|
+
to_object: dict[str, Any] = {}
|
95
98
|
if getv(from_object, ['format']) is not None:
|
96
99
|
setv(to_object, ['predictionsFormat'], getv(from_object, ['format']))
|
97
100
|
|
@@ -113,11 +116,11 @@ def _BatchJobDestination_to_vertex(
|
|
113
116
|
|
114
117
|
|
115
118
|
def _CreateBatchJobConfig_to_mldev(
|
116
|
-
api_client:
|
119
|
+
api_client: BaseApiClient,
|
117
120
|
from_object: Union[dict, object],
|
118
|
-
parent_object: dict = None,
|
121
|
+
parent_object: Optional[dict] = None,
|
119
122
|
) -> dict:
|
120
|
-
to_object = {}
|
123
|
+
to_object: dict[str, Any] = {}
|
121
124
|
|
122
125
|
if getv(from_object, ['display_name']) is not None:
|
123
126
|
setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
|
@@ -129,11 +132,11 @@ def _CreateBatchJobConfig_to_mldev(
|
|
129
132
|
|
130
133
|
|
131
134
|
def _CreateBatchJobConfig_to_vertex(
|
132
|
-
api_client:
|
135
|
+
api_client: BaseApiClient,
|
133
136
|
from_object: Union[dict, object],
|
134
|
-
parent_object: dict = None,
|
137
|
+
parent_object: Optional[dict] = None,
|
135
138
|
) -> dict:
|
136
|
-
to_object = {}
|
139
|
+
to_object: dict[str, Any] = {}
|
137
140
|
|
138
141
|
if getv(from_object, ['display_name']) is not None:
|
139
142
|
setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
|
@@ -153,11 +156,11 @@ def _CreateBatchJobConfig_to_vertex(
|
|
153
156
|
|
154
157
|
|
155
158
|
def _CreateBatchJobParameters_to_mldev(
|
156
|
-
api_client:
|
159
|
+
api_client: BaseApiClient,
|
157
160
|
from_object: Union[dict, object],
|
158
|
-
parent_object: dict = None,
|
161
|
+
parent_object: Optional[dict] = None,
|
159
162
|
) -> dict:
|
160
|
-
to_object = {}
|
163
|
+
to_object: dict[str, Any] = {}
|
161
164
|
if getv(from_object, ['model']) is not None:
|
162
165
|
raise ValueError('model parameter is not supported in Gemini API.')
|
163
166
|
|
@@ -177,11 +180,11 @@ def _CreateBatchJobParameters_to_mldev(
|
|
177
180
|
|
178
181
|
|
179
182
|
def _CreateBatchJobParameters_to_vertex(
|
180
|
-
api_client:
|
183
|
+
api_client: BaseApiClient,
|
181
184
|
from_object: Union[dict, object],
|
182
|
-
parent_object: dict = None,
|
185
|
+
parent_object: Optional[dict] = None,
|
183
186
|
) -> dict:
|
184
|
-
to_object = {}
|
187
|
+
to_object: dict[str, Any] = {}
|
185
188
|
if getv(from_object, ['model']) is not None:
|
186
189
|
setv(
|
187
190
|
to_object,
|
@@ -213,11 +216,11 @@ def _CreateBatchJobParameters_to_vertex(
|
|
213
216
|
|
214
217
|
|
215
218
|
def _GetBatchJobParameters_to_mldev(
|
216
|
-
api_client:
|
219
|
+
api_client: BaseApiClient,
|
217
220
|
from_object: Union[dict, object],
|
218
|
-
parent_object: dict = None,
|
221
|
+
parent_object: Optional[dict] = None,
|
219
222
|
) -> dict:
|
220
|
-
to_object = {}
|
223
|
+
to_object: dict[str, Any] = {}
|
221
224
|
if getv(from_object, ['name']) is not None:
|
222
225
|
raise ValueError('name parameter is not supported in Gemini API.')
|
223
226
|
|
@@ -228,11 +231,11 @@ def _GetBatchJobParameters_to_mldev(
|
|
228
231
|
|
229
232
|
|
230
233
|
def _GetBatchJobParameters_to_vertex(
|
231
|
-
api_client:
|
234
|
+
api_client: BaseApiClient,
|
232
235
|
from_object: Union[dict, object],
|
233
|
-
parent_object: dict = None,
|
236
|
+
parent_object: Optional[dict] = None,
|
234
237
|
) -> dict:
|
235
|
-
to_object = {}
|
238
|
+
to_object: dict[str, Any] = {}
|
236
239
|
if getv(from_object, ['name']) is not None:
|
237
240
|
setv(
|
238
241
|
to_object,
|
@@ -247,11 +250,11 @@ def _GetBatchJobParameters_to_vertex(
|
|
247
250
|
|
248
251
|
|
249
252
|
def _CancelBatchJobParameters_to_mldev(
|
250
|
-
api_client:
|
253
|
+
api_client: BaseApiClient,
|
251
254
|
from_object: Union[dict, object],
|
252
|
-
parent_object: dict = None,
|
255
|
+
parent_object: Optional[dict] = None,
|
253
256
|
) -> dict:
|
254
|
-
to_object = {}
|
257
|
+
to_object: dict[str, Any] = {}
|
255
258
|
if getv(from_object, ['name']) is not None:
|
256
259
|
raise ValueError('name parameter is not supported in Gemini API.')
|
257
260
|
|
@@ -262,11 +265,11 @@ def _CancelBatchJobParameters_to_mldev(
|
|
262
265
|
|
263
266
|
|
264
267
|
def _CancelBatchJobParameters_to_vertex(
|
265
|
-
api_client:
|
268
|
+
api_client: BaseApiClient,
|
266
269
|
from_object: Union[dict, object],
|
267
|
-
parent_object: dict = None,
|
270
|
+
parent_object: Optional[dict] = None,
|
268
271
|
) -> dict:
|
269
|
-
to_object = {}
|
272
|
+
to_object: dict[str, Any] = {}
|
270
273
|
if getv(from_object, ['name']) is not None:
|
271
274
|
setv(
|
272
275
|
to_object,
|
@@ -281,11 +284,11 @@ def _CancelBatchJobParameters_to_vertex(
|
|
281
284
|
|
282
285
|
|
283
286
|
def _ListBatchJobsConfig_to_mldev(
|
284
|
-
api_client:
|
287
|
+
api_client: BaseApiClient,
|
285
288
|
from_object: Union[dict, object],
|
286
|
-
parent_object: dict = None,
|
289
|
+
parent_object: Optional[dict] = None,
|
287
290
|
) -> dict:
|
288
|
-
to_object = {}
|
291
|
+
to_object: dict[str, Any] = {}
|
289
292
|
|
290
293
|
if getv(from_object, ['page_size']) is not None:
|
291
294
|
setv(
|
@@ -306,11 +309,11 @@ def _ListBatchJobsConfig_to_mldev(
|
|
306
309
|
|
307
310
|
|
308
311
|
def _ListBatchJobsConfig_to_vertex(
|
309
|
-
api_client:
|
312
|
+
api_client: BaseApiClient,
|
310
313
|
from_object: Union[dict, object],
|
311
|
-
parent_object: dict = None,
|
314
|
+
parent_object: Optional[dict] = None,
|
312
315
|
) -> dict:
|
313
|
-
to_object = {}
|
316
|
+
to_object: dict[str, Any] = {}
|
314
317
|
|
315
318
|
if getv(from_object, ['page_size']) is not None:
|
316
319
|
setv(
|
@@ -331,11 +334,11 @@ def _ListBatchJobsConfig_to_vertex(
|
|
331
334
|
|
332
335
|
|
333
336
|
def _ListBatchJobsParameters_to_mldev(
|
334
|
-
api_client:
|
337
|
+
api_client: BaseApiClient,
|
335
338
|
from_object: Union[dict, object],
|
336
|
-
parent_object: dict = None,
|
339
|
+
parent_object: Optional[dict] = None,
|
337
340
|
) -> dict:
|
338
|
-
to_object = {}
|
341
|
+
to_object: dict[str, Any] = {}
|
339
342
|
if getv(from_object, ['config']) is not None:
|
340
343
|
raise ValueError('config parameter is not supported in Gemini API.')
|
341
344
|
|
@@ -343,11 +346,11 @@ def _ListBatchJobsParameters_to_mldev(
|
|
343
346
|
|
344
347
|
|
345
348
|
def _ListBatchJobsParameters_to_vertex(
|
346
|
-
api_client:
|
349
|
+
api_client: BaseApiClient,
|
347
350
|
from_object: Union[dict, object],
|
348
|
-
parent_object: dict = None,
|
351
|
+
parent_object: Optional[dict] = None,
|
349
352
|
) -> dict:
|
350
|
-
to_object = {}
|
353
|
+
to_object: dict[str, Any] = {}
|
351
354
|
if getv(from_object, ['config']) is not None:
|
352
355
|
setv(
|
353
356
|
to_object,
|
@@ -361,11 +364,11 @@ def _ListBatchJobsParameters_to_vertex(
|
|
361
364
|
|
362
365
|
|
363
366
|
def _DeleteBatchJobParameters_to_mldev(
|
364
|
-
api_client:
|
367
|
+
api_client: BaseApiClient,
|
365
368
|
from_object: Union[dict, object],
|
366
|
-
parent_object: dict = None,
|
369
|
+
parent_object: Optional[dict] = None,
|
367
370
|
) -> dict:
|
368
|
-
to_object = {}
|
371
|
+
to_object: dict[str, Any] = {}
|
369
372
|
if getv(from_object, ['name']) is not None:
|
370
373
|
raise ValueError('name parameter is not supported in Gemini API.')
|
371
374
|
|
@@ -376,11 +379,11 @@ def _DeleteBatchJobParameters_to_mldev(
|
|
376
379
|
|
377
380
|
|
378
381
|
def _DeleteBatchJobParameters_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
|
if getv(from_object, ['name']) is not None:
|
385
388
|
setv(
|
386
389
|
to_object,
|
@@ -395,21 +398,21 @@ def _DeleteBatchJobParameters_to_vertex(
|
|
395
398
|
|
396
399
|
|
397
400
|
def _JobError_from_mldev(
|
398
|
-
api_client:
|
401
|
+
api_client: BaseApiClient,
|
399
402
|
from_object: Union[dict, object],
|
400
|
-
parent_object: dict = None,
|
403
|
+
parent_object: Optional[dict] = None,
|
401
404
|
) -> dict:
|
402
|
-
to_object = {}
|
405
|
+
to_object: dict[str, Any] = {}
|
403
406
|
|
404
407
|
return to_object
|
405
408
|
|
406
409
|
|
407
410
|
def _JobError_from_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, ['details']) is not None:
|
414
417
|
setv(to_object, ['details'], getv(from_object, ['details']))
|
415
418
|
|
@@ -423,21 +426,21 @@ def _JobError_from_vertex(
|
|
423
426
|
|
424
427
|
|
425
428
|
def _BatchJobSource_from_mldev(
|
426
|
-
api_client:
|
429
|
+
api_client: BaseApiClient,
|
427
430
|
from_object: Union[dict, object],
|
428
|
-
parent_object: dict = None,
|
431
|
+
parent_object: Optional[dict] = None,
|
429
432
|
) -> dict:
|
430
|
-
to_object = {}
|
433
|
+
to_object: dict[str, Any] = {}
|
431
434
|
|
432
435
|
return to_object
|
433
436
|
|
434
437
|
|
435
438
|
def _BatchJobSource_from_vertex(
|
436
|
-
api_client:
|
439
|
+
api_client: BaseApiClient,
|
437
440
|
from_object: Union[dict, object],
|
438
|
-
parent_object: dict = None,
|
441
|
+
parent_object: Optional[dict] = None,
|
439
442
|
) -> dict:
|
440
|
-
to_object = {}
|
443
|
+
to_object: dict[str, Any] = {}
|
441
444
|
if getv(from_object, ['instancesFormat']) is not None:
|
442
445
|
setv(to_object, ['format'], getv(from_object, ['instancesFormat']))
|
443
446
|
|
@@ -455,21 +458,21 @@ def _BatchJobSource_from_vertex(
|
|
455
458
|
|
456
459
|
|
457
460
|
def _BatchJobDestination_from_mldev(
|
458
|
-
api_client:
|
461
|
+
api_client: BaseApiClient,
|
459
462
|
from_object: Union[dict, object],
|
460
|
-
parent_object: dict = None,
|
463
|
+
parent_object: Optional[dict] = None,
|
461
464
|
) -> dict:
|
462
|
-
to_object = {}
|
465
|
+
to_object: dict[str, Any] = {}
|
463
466
|
|
464
467
|
return to_object
|
465
468
|
|
466
469
|
|
467
470
|
def _BatchJobDestination_from_vertex(
|
468
|
-
api_client:
|
471
|
+
api_client: BaseApiClient,
|
469
472
|
from_object: Union[dict, object],
|
470
|
-
parent_object: dict = None,
|
473
|
+
parent_object: Optional[dict] = None,
|
471
474
|
) -> dict:
|
472
|
-
to_object = {}
|
475
|
+
to_object: dict[str, Any] = {}
|
473
476
|
if getv(from_object, ['predictionsFormat']) is not None:
|
474
477
|
setv(to_object, ['format'], getv(from_object, ['predictionsFormat']))
|
475
478
|
|
@@ -491,21 +494,21 @@ def _BatchJobDestination_from_vertex(
|
|
491
494
|
|
492
495
|
|
493
496
|
def _BatchJob_from_mldev(
|
494
|
-
api_client:
|
497
|
+
api_client: BaseApiClient,
|
495
498
|
from_object: Union[dict, object],
|
496
|
-
parent_object: dict = None,
|
499
|
+
parent_object: Optional[dict] = None,
|
497
500
|
) -> dict:
|
498
|
-
to_object = {}
|
501
|
+
to_object: dict[str, Any] = {}
|
499
502
|
|
500
503
|
return to_object
|
501
504
|
|
502
505
|
|
503
506
|
def _BatchJob_from_vertex(
|
504
|
-
api_client:
|
507
|
+
api_client: BaseApiClient,
|
505
508
|
from_object: Union[dict, object],
|
506
|
-
parent_object: dict = None,
|
509
|
+
parent_object: Optional[dict] = None,
|
507
510
|
) -> dict:
|
508
|
-
to_object = {}
|
511
|
+
to_object: dict[str, Any] = {}
|
509
512
|
if getv(from_object, ['name']) is not None:
|
510
513
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
511
514
|
|
@@ -561,11 +564,11 @@ def _BatchJob_from_vertex(
|
|
561
564
|
|
562
565
|
|
563
566
|
def _ListBatchJobsResponse_from_mldev(
|
564
|
-
api_client:
|
567
|
+
api_client: BaseApiClient,
|
565
568
|
from_object: Union[dict, object],
|
566
|
-
parent_object: dict = None,
|
569
|
+
parent_object: Optional[dict] = None,
|
567
570
|
) -> dict:
|
568
|
-
to_object = {}
|
571
|
+
to_object: dict[str, Any] = {}
|
569
572
|
if getv(from_object, ['nextPageToken']) is not None:
|
570
573
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
571
574
|
|
@@ -573,11 +576,11 @@ def _ListBatchJobsResponse_from_mldev(
|
|
573
576
|
|
574
577
|
|
575
578
|
def _ListBatchJobsResponse_from_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, ['nextPageToken']) is not None:
|
582
585
|
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
583
586
|
|
@@ -595,21 +598,21 @@ def _ListBatchJobsResponse_from_vertex(
|
|
595
598
|
|
596
599
|
|
597
600
|
def _DeleteResourceJob_from_mldev(
|
598
|
-
api_client:
|
601
|
+
api_client: BaseApiClient,
|
599
602
|
from_object: Union[dict, object],
|
600
|
-
parent_object: dict = None,
|
603
|
+
parent_object: Optional[dict] = None,
|
601
604
|
) -> dict:
|
602
|
-
to_object = {}
|
605
|
+
to_object: dict[str, Any] = {}
|
603
606
|
|
604
607
|
return to_object
|
605
608
|
|
606
609
|
|
607
610
|
def _DeleteResourceJob_from_vertex(
|
608
|
-
api_client:
|
611
|
+
api_client: BaseApiClient,
|
609
612
|
from_object: Union[dict, object],
|
610
|
-
parent_object: dict = None,
|
613
|
+
parent_object: Optional[dict] = None,
|
611
614
|
) -> dict:
|
612
|
-
to_object = {}
|
615
|
+
to_object: dict[str, Any] = {}
|
613
616
|
if getv(from_object, ['name']) is not None:
|
614
617
|
setv(to_object, ['name'], getv(from_object, ['name']))
|
615
618
|
|
@@ -643,13 +646,18 @@ class Batches(_api_module.BaseModule):
|
|
643
646
|
config=config,
|
644
647
|
)
|
645
648
|
|
649
|
+
request_url_dict: Optional[dict[str, str]]
|
646
650
|
if not self._api_client.vertexai:
|
647
651
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
648
652
|
else:
|
649
653
|
request_dict = _CreateBatchJobParameters_to_vertex(
|
650
654
|
self._api_client, parameter_model
|
651
655
|
)
|
652
|
-
|
656
|
+
request_url_dict = request_dict.get('_url')
|
657
|
+
if request_url_dict:
|
658
|
+
path = 'batchPredictionJobs'.format_map(request_url_dict)
|
659
|
+
else:
|
660
|
+
path = 'batchPredictionJobs'
|
653
661
|
|
654
662
|
query_params = request_dict.get('_query')
|
655
663
|
if query_params:
|
@@ -657,7 +665,7 @@ class Batches(_api_module.BaseModule):
|
|
657
665
|
# TODO: remove the hack that pops config.
|
658
666
|
request_dict.pop('config', None)
|
659
667
|
|
660
|
-
http_options = None
|
668
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
661
669
|
if isinstance(config, dict):
|
662
670
|
http_options = config.get('http_options', None)
|
663
671
|
elif hasattr(config, 'http_options'):
|
@@ -676,7 +684,7 @@ class Batches(_api_module.BaseModule):
|
|
676
684
|
response_dict = _BatchJob_from_mldev(self._api_client, response_dict)
|
677
685
|
|
678
686
|
return_value = types.BatchJob._from_response(
|
679
|
-
response=response_dict, kwargs=parameter_model
|
687
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
680
688
|
)
|
681
689
|
self._api_client._verify_response(return_value)
|
682
690
|
return return_value
|
@@ -707,13 +715,18 @@ class Batches(_api_module.BaseModule):
|
|
707
715
|
config=config,
|
708
716
|
)
|
709
717
|
|
718
|
+
request_url_dict: Optional[dict[str, str]]
|
710
719
|
if not self._api_client.vertexai:
|
711
720
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
712
721
|
else:
|
713
722
|
request_dict = _GetBatchJobParameters_to_vertex(
|
714
723
|
self._api_client, parameter_model
|
715
724
|
)
|
716
|
-
|
725
|
+
request_url_dict = request_dict.get('_url')
|
726
|
+
if request_url_dict:
|
727
|
+
path = 'batchPredictionJobs/{name}'.format_map(request_url_dict)
|
728
|
+
else:
|
729
|
+
path = 'batchPredictionJobs/{name}'
|
717
730
|
|
718
731
|
query_params = request_dict.get('_query')
|
719
732
|
if query_params:
|
@@ -721,7 +734,7 @@ class Batches(_api_module.BaseModule):
|
|
721
734
|
# TODO: remove the hack that pops config.
|
722
735
|
request_dict.pop('config', None)
|
723
736
|
|
724
|
-
http_options = None
|
737
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
725
738
|
if isinstance(config, dict):
|
726
739
|
http_options = config.get('http_options', None)
|
727
740
|
elif hasattr(config, 'http_options'):
|
@@ -740,7 +753,7 @@ class Batches(_api_module.BaseModule):
|
|
740
753
|
response_dict = _BatchJob_from_mldev(self._api_client, response_dict)
|
741
754
|
|
742
755
|
return_value = types.BatchJob._from_response(
|
743
|
-
response=response_dict, kwargs=parameter_model
|
756
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
744
757
|
)
|
745
758
|
self._api_client._verify_response(return_value)
|
746
759
|
return return_value
|
@@ -772,15 +785,18 @@ class Batches(_api_module.BaseModule):
|
|
772
785
|
config=config,
|
773
786
|
)
|
774
787
|
|
788
|
+
request_url_dict: Optional[dict[str, str]]
|
775
789
|
if not self._api_client.vertexai:
|
776
790
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
777
791
|
else:
|
778
792
|
request_dict = _CancelBatchJobParameters_to_vertex(
|
779
793
|
self._api_client, parameter_model
|
780
794
|
)
|
781
|
-
|
782
|
-
|
783
|
-
|
795
|
+
request_url_dict = request_dict.get('_url')
|
796
|
+
if request_url_dict:
|
797
|
+
path = 'batchPredictionJobs/{name}:cancel'.format_map(request_url_dict)
|
798
|
+
else:
|
799
|
+
path = 'batchPredictionJobs/{name}:cancel'
|
784
800
|
|
785
801
|
query_params = request_dict.get('_query')
|
786
802
|
if query_params:
|
@@ -788,7 +804,7 @@ class Batches(_api_module.BaseModule):
|
|
788
804
|
# TODO: remove the hack that pops config.
|
789
805
|
request_dict.pop('config', None)
|
790
806
|
|
791
|
-
http_options = None
|
807
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
792
808
|
if isinstance(config, dict):
|
793
809
|
http_options = config.get('http_options', None)
|
794
810
|
elif hasattr(config, 'http_options'):
|
@@ -808,13 +824,18 @@ class Batches(_api_module.BaseModule):
|
|
808
824
|
config=config,
|
809
825
|
)
|
810
826
|
|
827
|
+
request_url_dict: Optional[dict[str, str]]
|
811
828
|
if not self._api_client.vertexai:
|
812
829
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
813
830
|
else:
|
814
831
|
request_dict = _ListBatchJobsParameters_to_vertex(
|
815
832
|
self._api_client, parameter_model
|
816
833
|
)
|
817
|
-
|
834
|
+
request_url_dict = request_dict.get('_url')
|
835
|
+
if request_url_dict:
|
836
|
+
path = 'batchPredictionJobs'.format_map(request_url_dict)
|
837
|
+
else:
|
838
|
+
path = 'batchPredictionJobs'
|
818
839
|
|
819
840
|
query_params = request_dict.get('_query')
|
820
841
|
if query_params:
|
@@ -822,7 +843,7 @@ class Batches(_api_module.BaseModule):
|
|
822
843
|
# TODO: remove the hack that pops config.
|
823
844
|
request_dict.pop('config', None)
|
824
845
|
|
825
|
-
http_options = None
|
846
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
826
847
|
if isinstance(config, dict):
|
827
848
|
http_options = config.get('http_options', None)
|
828
849
|
elif hasattr(config, 'http_options'):
|
@@ -845,7 +866,7 @@ class Batches(_api_module.BaseModule):
|
|
845
866
|
)
|
846
867
|
|
847
868
|
return_value = types.ListBatchJobsResponse._from_response(
|
848
|
-
response=response_dict, kwargs=parameter_model
|
869
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
849
870
|
)
|
850
871
|
self._api_client._verify_response(return_value)
|
851
872
|
return return_value
|
@@ -878,13 +899,18 @@ class Batches(_api_module.BaseModule):
|
|
878
899
|
config=config,
|
879
900
|
)
|
880
901
|
|
902
|
+
request_url_dict: Optional[dict[str, str]]
|
881
903
|
if not self._api_client.vertexai:
|
882
904
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
883
905
|
else:
|
884
906
|
request_dict = _DeleteBatchJobParameters_to_vertex(
|
885
907
|
self._api_client, parameter_model
|
886
908
|
)
|
887
|
-
|
909
|
+
request_url_dict = request_dict.get('_url')
|
910
|
+
if request_url_dict:
|
911
|
+
path = 'batchPredictionJobs/{name}'.format_map(request_url_dict)
|
912
|
+
else:
|
913
|
+
path = 'batchPredictionJobs/{name}'
|
888
914
|
|
889
915
|
query_params = request_dict.get('_query')
|
890
916
|
if query_params:
|
@@ -892,7 +918,7 @@ class Batches(_api_module.BaseModule):
|
|
892
918
|
# TODO: remove the hack that pops config.
|
893
919
|
request_dict.pop('config', None)
|
894
920
|
|
895
|
-
http_options = None
|
921
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
896
922
|
if isinstance(config, dict):
|
897
923
|
http_options = config.get('http_options', None)
|
898
924
|
elif hasattr(config, 'http_options'):
|
@@ -915,7 +941,7 @@ class Batches(_api_module.BaseModule):
|
|
915
941
|
)
|
916
942
|
|
917
943
|
return_value = types.DeleteResourceJob._from_response(
|
918
|
-
response=response_dict, kwargs=parameter_model
|
944
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
919
945
|
)
|
920
946
|
self._api_client._verify_response(return_value)
|
921
947
|
return return_value
|
@@ -995,13 +1021,18 @@ class AsyncBatches(_api_module.BaseModule):
|
|
995
1021
|
config=config,
|
996
1022
|
)
|
997
1023
|
|
1024
|
+
request_url_dict: Optional[dict[str, str]]
|
998
1025
|
if not self._api_client.vertexai:
|
999
1026
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
1000
1027
|
else:
|
1001
1028
|
request_dict = _CreateBatchJobParameters_to_vertex(
|
1002
1029
|
self._api_client, parameter_model
|
1003
1030
|
)
|
1004
|
-
|
1031
|
+
request_url_dict = request_dict.get('_url')
|
1032
|
+
if request_url_dict:
|
1033
|
+
path = 'batchPredictionJobs'.format_map(request_url_dict)
|
1034
|
+
else:
|
1035
|
+
path = 'batchPredictionJobs'
|
1005
1036
|
|
1006
1037
|
query_params = request_dict.get('_query')
|
1007
1038
|
if query_params:
|
@@ -1009,7 +1040,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1009
1040
|
# TODO: remove the hack that pops config.
|
1010
1041
|
request_dict.pop('config', None)
|
1011
1042
|
|
1012
|
-
http_options = None
|
1043
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1013
1044
|
if isinstance(config, dict):
|
1014
1045
|
http_options = config.get('http_options', None)
|
1015
1046
|
elif hasattr(config, 'http_options'):
|
@@ -1028,7 +1059,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1028
1059
|
response_dict = _BatchJob_from_mldev(self._api_client, response_dict)
|
1029
1060
|
|
1030
1061
|
return_value = types.BatchJob._from_response(
|
1031
|
-
response=response_dict, kwargs=parameter_model
|
1062
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1032
1063
|
)
|
1033
1064
|
self._api_client._verify_response(return_value)
|
1034
1065
|
return return_value
|
@@ -1050,7 +1081,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1050
1081
|
|
1051
1082
|
.. code-block:: python
|
1052
1083
|
|
1053
|
-
batch_job = client.batches.get(name='123456789')
|
1084
|
+
batch_job = await client.aio.batches.get(name='123456789')
|
1054
1085
|
print(f"Batch job: {batch_job.name}, state {batch_job.state}")
|
1055
1086
|
"""
|
1056
1087
|
|
@@ -1059,13 +1090,18 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1059
1090
|
config=config,
|
1060
1091
|
)
|
1061
1092
|
|
1093
|
+
request_url_dict: Optional[dict[str, str]]
|
1062
1094
|
if not self._api_client.vertexai:
|
1063
1095
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
1064
1096
|
else:
|
1065
1097
|
request_dict = _GetBatchJobParameters_to_vertex(
|
1066
1098
|
self._api_client, parameter_model
|
1067
1099
|
)
|
1068
|
-
|
1100
|
+
request_url_dict = request_dict.get('_url')
|
1101
|
+
if request_url_dict:
|
1102
|
+
path = 'batchPredictionJobs/{name}'.format_map(request_url_dict)
|
1103
|
+
else:
|
1104
|
+
path = 'batchPredictionJobs/{name}'
|
1069
1105
|
|
1070
1106
|
query_params = request_dict.get('_query')
|
1071
1107
|
if query_params:
|
@@ -1073,7 +1109,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1073
1109
|
# TODO: remove the hack that pops config.
|
1074
1110
|
request_dict.pop('config', None)
|
1075
1111
|
|
1076
|
-
http_options = None
|
1112
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1077
1113
|
if isinstance(config, dict):
|
1078
1114
|
http_options = config.get('http_options', None)
|
1079
1115
|
elif hasattr(config, 'http_options'):
|
@@ -1092,7 +1128,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1092
1128
|
response_dict = _BatchJob_from_mldev(self._api_client, response_dict)
|
1093
1129
|
|
1094
1130
|
return_value = types.BatchJob._from_response(
|
1095
|
-
response=response_dict, kwargs=parameter_model
|
1131
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1096
1132
|
)
|
1097
1133
|
self._api_client._verify_response(return_value)
|
1098
1134
|
return return_value
|
@@ -1116,7 +1152,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1116
1152
|
|
1117
1153
|
.. code-block:: python
|
1118
1154
|
|
1119
|
-
client.batches.cancel(name='123456789')
|
1155
|
+
await client.aio.batches.cancel(name='123456789')
|
1120
1156
|
"""
|
1121
1157
|
|
1122
1158
|
parameter_model = types._CancelBatchJobParameters(
|
@@ -1124,15 +1160,18 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1124
1160
|
config=config,
|
1125
1161
|
)
|
1126
1162
|
|
1163
|
+
request_url_dict: Optional[dict[str, str]]
|
1127
1164
|
if not self._api_client.vertexai:
|
1128
1165
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
1129
1166
|
else:
|
1130
1167
|
request_dict = _CancelBatchJobParameters_to_vertex(
|
1131
1168
|
self._api_client, parameter_model
|
1132
1169
|
)
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1170
|
+
request_url_dict = request_dict.get('_url')
|
1171
|
+
if request_url_dict:
|
1172
|
+
path = 'batchPredictionJobs/{name}:cancel'.format_map(request_url_dict)
|
1173
|
+
else:
|
1174
|
+
path = 'batchPredictionJobs/{name}:cancel'
|
1136
1175
|
|
1137
1176
|
query_params = request_dict.get('_query')
|
1138
1177
|
if query_params:
|
@@ -1140,7 +1179,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1140
1179
|
# TODO: remove the hack that pops config.
|
1141
1180
|
request_dict.pop('config', None)
|
1142
1181
|
|
1143
|
-
http_options = None
|
1182
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1144
1183
|
if isinstance(config, dict):
|
1145
1184
|
http_options = config.get('http_options', None)
|
1146
1185
|
elif hasattr(config, 'http_options'):
|
@@ -1160,13 +1199,18 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1160
1199
|
config=config,
|
1161
1200
|
)
|
1162
1201
|
|
1202
|
+
request_url_dict: Optional[dict[str, str]]
|
1163
1203
|
if not self._api_client.vertexai:
|
1164
1204
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
1165
1205
|
else:
|
1166
1206
|
request_dict = _ListBatchJobsParameters_to_vertex(
|
1167
1207
|
self._api_client, parameter_model
|
1168
1208
|
)
|
1169
|
-
|
1209
|
+
request_url_dict = request_dict.get('_url')
|
1210
|
+
if request_url_dict:
|
1211
|
+
path = 'batchPredictionJobs'.format_map(request_url_dict)
|
1212
|
+
else:
|
1213
|
+
path = 'batchPredictionJobs'
|
1170
1214
|
|
1171
1215
|
query_params = request_dict.get('_query')
|
1172
1216
|
if query_params:
|
@@ -1174,7 +1218,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1174
1218
|
# TODO: remove the hack that pops config.
|
1175
1219
|
request_dict.pop('config', None)
|
1176
1220
|
|
1177
|
-
http_options = None
|
1221
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1178
1222
|
if isinstance(config, dict):
|
1179
1223
|
http_options = config.get('http_options', None)
|
1180
1224
|
elif hasattr(config, 'http_options'):
|
@@ -1197,7 +1241,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1197
1241
|
)
|
1198
1242
|
|
1199
1243
|
return_value = types.ListBatchJobsResponse._from_response(
|
1200
|
-
response=response_dict, kwargs=parameter_model
|
1244
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1201
1245
|
)
|
1202
1246
|
self._api_client._verify_response(return_value)
|
1203
1247
|
return return_value
|
@@ -1222,7 +1266,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1222
1266
|
|
1223
1267
|
.. code-block:: python
|
1224
1268
|
|
1225
|
-
client.batches.delete(name='123456789')
|
1269
|
+
await client.aio.batches.delete(name='123456789')
|
1226
1270
|
"""
|
1227
1271
|
|
1228
1272
|
parameter_model = types._DeleteBatchJobParameters(
|
@@ -1230,13 +1274,18 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1230
1274
|
config=config,
|
1231
1275
|
)
|
1232
1276
|
|
1277
|
+
request_url_dict: Optional[dict[str, str]]
|
1233
1278
|
if not self._api_client.vertexai:
|
1234
1279
|
raise ValueError('This method is only supported in the Vertex AI client.')
|
1235
1280
|
else:
|
1236
1281
|
request_dict = _DeleteBatchJobParameters_to_vertex(
|
1237
1282
|
self._api_client, parameter_model
|
1238
1283
|
)
|
1239
|
-
|
1284
|
+
request_url_dict = request_dict.get('_url')
|
1285
|
+
if request_url_dict:
|
1286
|
+
path = 'batchPredictionJobs/{name}'.format_map(request_url_dict)
|
1287
|
+
else:
|
1288
|
+
path = 'batchPredictionJobs/{name}'
|
1240
1289
|
|
1241
1290
|
query_params = request_dict.get('_query')
|
1242
1291
|
if query_params:
|
@@ -1244,7 +1293,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1244
1293
|
# TODO: remove the hack that pops config.
|
1245
1294
|
request_dict.pop('config', None)
|
1246
1295
|
|
1247
|
-
http_options = None
|
1296
|
+
http_options: Optional[types.HttpOptionsOrDict] = None
|
1248
1297
|
if isinstance(config, dict):
|
1249
1298
|
http_options = config.get('http_options', None)
|
1250
1299
|
elif hasattr(config, 'http_options'):
|
@@ -1267,7 +1316,7 @@ class AsyncBatches(_api_module.BaseModule):
|
|
1267
1316
|
)
|
1268
1317
|
|
1269
1318
|
return_value = types.DeleteResourceJob._from_response(
|
1270
|
-
response=response_dict, kwargs=parameter_model
|
1319
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
1271
1320
|
)
|
1272
1321
|
self._api_client._verify_response(return_value)
|
1273
1322
|
return return_value
|