google-genai 1.7.0__py3-none-any.whl → 1.8.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 +93 -78
- google/genai/_replay_api_client.py +22 -14
- google/genai/_transformers.py +23 -14
- google/genai/batches.py +60 -294
- google/genai/caches.py +545 -525
- google/genai/chats.py +15 -8
- google/genai/client.py +5 -3
- google/genai/errors.py +46 -23
- google/genai/files.py +88 -304
- google/genai/live.py +4 -4
- google/genai/models.py +1991 -2290
- google/genai/operations.py +103 -123
- google/genai/tunings.py +255 -271
- google/genai/types.py +207 -74
- google/genai/version.py +1 -1
- {google_genai-1.7.0.dist-info → google_genai-1.8.0.dist-info}/METADATA +3 -2
- google_genai-1.8.0.dist-info/RECORD +27 -0
- {google_genai-1.7.0.dist-info → google_genai-1.8.0.dist-info}/WHEEL +1 -1
- google_genai-1.7.0.dist-info/RECORD +0 -27
- {google_genai-1.7.0.dist-info → google_genai-1.8.0.dist-info/licenses}/LICENSE +0 -0
- {google_genai-1.7.0.dist-info → google_genai-1.8.0.dist-info}/top_level.txt +0 -0
google/genai/tunings.py
CHANGED
@@ -45,21 +45,6 @@ def _GetTuningJobParameters_to_mldev(
|
|
45
45
|
return to_object
|
46
46
|
|
47
47
|
|
48
|
-
def _GetTuningJobParameters_to_vertex(
|
49
|
-
api_client: BaseApiClient,
|
50
|
-
from_object: Union[dict, object],
|
51
|
-
parent_object: Optional[dict] = None,
|
52
|
-
) -> dict:
|
53
|
-
to_object: dict[str, Any] = {}
|
54
|
-
if getv(from_object, ['name']) is not None:
|
55
|
-
setv(to_object, ['_url', 'name'], getv(from_object, ['name']))
|
56
|
-
|
57
|
-
if getv(from_object, ['config']) is not None:
|
58
|
-
setv(to_object, ['config'], getv(from_object, ['config']))
|
59
|
-
|
60
|
-
return to_object
|
61
|
-
|
62
|
-
|
63
48
|
def _ListTuningJobsConfig_to_mldev(
|
64
49
|
api_client: BaseApiClient,
|
65
50
|
from_object: Union[dict, object],
|
@@ -85,31 +70,6 @@ def _ListTuningJobsConfig_to_mldev(
|
|
85
70
|
return to_object
|
86
71
|
|
87
72
|
|
88
|
-
def _ListTuningJobsConfig_to_vertex(
|
89
|
-
api_client: BaseApiClient,
|
90
|
-
from_object: Union[dict, object],
|
91
|
-
parent_object: Optional[dict] = None,
|
92
|
-
) -> dict:
|
93
|
-
to_object: dict[str, Any] = {}
|
94
|
-
|
95
|
-
if getv(from_object, ['page_size']) is not None:
|
96
|
-
setv(
|
97
|
-
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
98
|
-
)
|
99
|
-
|
100
|
-
if getv(from_object, ['page_token']) is not None:
|
101
|
-
setv(
|
102
|
-
parent_object,
|
103
|
-
['_query', 'pageToken'],
|
104
|
-
getv(from_object, ['page_token']),
|
105
|
-
)
|
106
|
-
|
107
|
-
if getv(from_object, ['filter']) is not None:
|
108
|
-
setv(parent_object, ['_query', 'filter'], getv(from_object, ['filter']))
|
109
|
-
|
110
|
-
return to_object
|
111
|
-
|
112
|
-
|
113
73
|
def _ListTuningJobsParameters_to_mldev(
|
114
74
|
api_client: BaseApiClient,
|
115
75
|
from_object: Union[dict, object],
|
@@ -128,24 +88,6 @@ def _ListTuningJobsParameters_to_mldev(
|
|
128
88
|
return to_object
|
129
89
|
|
130
90
|
|
131
|
-
def _ListTuningJobsParameters_to_vertex(
|
132
|
-
api_client: BaseApiClient,
|
133
|
-
from_object: Union[dict, object],
|
134
|
-
parent_object: Optional[dict] = None,
|
135
|
-
) -> dict:
|
136
|
-
to_object: dict[str, Any] = {}
|
137
|
-
if getv(from_object, ['config']) is not None:
|
138
|
-
setv(
|
139
|
-
to_object,
|
140
|
-
['config'],
|
141
|
-
_ListTuningJobsConfig_to_vertex(
|
142
|
-
api_client, getv(from_object, ['config']), to_object
|
143
|
-
),
|
144
|
-
)
|
145
|
-
|
146
|
-
return to_object
|
147
|
-
|
148
|
-
|
149
91
|
def _TuningExample_to_mldev(
|
150
92
|
api_client: BaseApiClient,
|
151
93
|
from_object: Union[dict, object],
|
@@ -161,21 +103,6 @@ def _TuningExample_to_mldev(
|
|
161
103
|
return to_object
|
162
104
|
|
163
105
|
|
164
|
-
def _TuningExample_to_vertex(
|
165
|
-
api_client: BaseApiClient,
|
166
|
-
from_object: Union[dict, object],
|
167
|
-
parent_object: Optional[dict] = None,
|
168
|
-
) -> dict:
|
169
|
-
to_object: dict[str, Any] = {}
|
170
|
-
if getv(from_object, ['text_input']) is not None:
|
171
|
-
raise ValueError('text_input parameter is not supported in Vertex AI.')
|
172
|
-
|
173
|
-
if getv(from_object, ['output']) is not None:
|
174
|
-
raise ValueError('output parameter is not supported in Vertex AI.')
|
175
|
-
|
176
|
-
return to_object
|
177
|
-
|
178
|
-
|
179
106
|
def _TuningDataset_to_mldev(
|
180
107
|
api_client: BaseApiClient,
|
181
108
|
from_object: Union[dict, object],
|
@@ -198,25 +125,6 @@ def _TuningDataset_to_mldev(
|
|
198
125
|
return to_object
|
199
126
|
|
200
127
|
|
201
|
-
def _TuningDataset_to_vertex(
|
202
|
-
api_client: BaseApiClient,
|
203
|
-
from_object: Union[dict, object],
|
204
|
-
parent_object: Optional[dict] = None,
|
205
|
-
) -> dict:
|
206
|
-
to_object: dict[str, Any] = {}
|
207
|
-
if getv(from_object, ['gcs_uri']) is not None:
|
208
|
-
setv(
|
209
|
-
parent_object,
|
210
|
-
['supervisedTuningSpec', 'trainingDatasetUri'],
|
211
|
-
getv(from_object, ['gcs_uri']),
|
212
|
-
)
|
213
|
-
|
214
|
-
if getv(from_object, ['examples']) is not None:
|
215
|
-
raise ValueError('examples parameter is not supported in Vertex AI.')
|
216
|
-
|
217
|
-
return to_object
|
218
|
-
|
219
|
-
|
220
128
|
def _TuningValidationDataset_to_mldev(
|
221
129
|
api_client: BaseApiClient,
|
222
130
|
from_object: Union[dict, object],
|
@@ -229,18 +137,6 @@ def _TuningValidationDataset_to_mldev(
|
|
229
137
|
return to_object
|
230
138
|
|
231
139
|
|
232
|
-
def _TuningValidationDataset_to_vertex(
|
233
|
-
api_client: BaseApiClient,
|
234
|
-
from_object: Union[dict, object],
|
235
|
-
parent_object: Optional[dict] = None,
|
236
|
-
) -> dict:
|
237
|
-
to_object: dict[str, Any] = {}
|
238
|
-
if getv(from_object, ['gcs_uri']) is not None:
|
239
|
-
setv(to_object, ['validationDatasetUri'], getv(from_object, ['gcs_uri']))
|
240
|
-
|
241
|
-
return to_object
|
242
|
-
|
243
|
-
|
244
140
|
def _CreateTuningJobConfig_to_mldev(
|
245
141
|
api_client: BaseApiClient,
|
246
142
|
from_object: Union[dict, object],
|
@@ -297,6 +193,140 @@ def _CreateTuningJobConfig_to_mldev(
|
|
297
193
|
return to_object
|
298
194
|
|
299
195
|
|
196
|
+
def _CreateTuningJobParameters_to_mldev(
|
197
|
+
api_client: BaseApiClient,
|
198
|
+
from_object: Union[dict, object],
|
199
|
+
parent_object: Optional[dict] = None,
|
200
|
+
) -> dict:
|
201
|
+
to_object: dict[str, Any] = {}
|
202
|
+
if getv(from_object, ['base_model']) is not None:
|
203
|
+
setv(to_object, ['baseModel'], getv(from_object, ['base_model']))
|
204
|
+
|
205
|
+
if getv(from_object, ['training_dataset']) is not None:
|
206
|
+
setv(
|
207
|
+
to_object,
|
208
|
+
['tuningTask', 'trainingData'],
|
209
|
+
_TuningDataset_to_mldev(
|
210
|
+
api_client, getv(from_object, ['training_dataset']), to_object
|
211
|
+
),
|
212
|
+
)
|
213
|
+
|
214
|
+
if getv(from_object, ['config']) is not None:
|
215
|
+
setv(
|
216
|
+
to_object,
|
217
|
+
['config'],
|
218
|
+
_CreateTuningJobConfig_to_mldev(
|
219
|
+
api_client, getv(from_object, ['config']), to_object
|
220
|
+
),
|
221
|
+
)
|
222
|
+
|
223
|
+
return to_object
|
224
|
+
|
225
|
+
|
226
|
+
def _GetTuningJobParameters_to_vertex(
|
227
|
+
api_client: BaseApiClient,
|
228
|
+
from_object: Union[dict, object],
|
229
|
+
parent_object: Optional[dict] = None,
|
230
|
+
) -> dict:
|
231
|
+
to_object: dict[str, Any] = {}
|
232
|
+
if getv(from_object, ['name']) is not None:
|
233
|
+
setv(to_object, ['_url', 'name'], getv(from_object, ['name']))
|
234
|
+
|
235
|
+
if getv(from_object, ['config']) is not None:
|
236
|
+
setv(to_object, ['config'], getv(from_object, ['config']))
|
237
|
+
|
238
|
+
return to_object
|
239
|
+
|
240
|
+
|
241
|
+
def _ListTuningJobsConfig_to_vertex(
|
242
|
+
api_client: BaseApiClient,
|
243
|
+
from_object: Union[dict, object],
|
244
|
+
parent_object: Optional[dict] = None,
|
245
|
+
) -> dict:
|
246
|
+
to_object: dict[str, Any] = {}
|
247
|
+
|
248
|
+
if getv(from_object, ['page_size']) is not None:
|
249
|
+
setv(
|
250
|
+
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
251
|
+
)
|
252
|
+
|
253
|
+
if getv(from_object, ['page_token']) is not None:
|
254
|
+
setv(
|
255
|
+
parent_object,
|
256
|
+
['_query', 'pageToken'],
|
257
|
+
getv(from_object, ['page_token']),
|
258
|
+
)
|
259
|
+
|
260
|
+
if getv(from_object, ['filter']) is not None:
|
261
|
+
setv(parent_object, ['_query', 'filter'], getv(from_object, ['filter']))
|
262
|
+
|
263
|
+
return to_object
|
264
|
+
|
265
|
+
|
266
|
+
def _ListTuningJobsParameters_to_vertex(
|
267
|
+
api_client: BaseApiClient,
|
268
|
+
from_object: Union[dict, object],
|
269
|
+
parent_object: Optional[dict] = None,
|
270
|
+
) -> dict:
|
271
|
+
to_object: dict[str, Any] = {}
|
272
|
+
if getv(from_object, ['config']) is not None:
|
273
|
+
setv(
|
274
|
+
to_object,
|
275
|
+
['config'],
|
276
|
+
_ListTuningJobsConfig_to_vertex(
|
277
|
+
api_client, getv(from_object, ['config']), to_object
|
278
|
+
),
|
279
|
+
)
|
280
|
+
|
281
|
+
return to_object
|
282
|
+
|
283
|
+
|
284
|
+
def _TuningExample_to_vertex(
|
285
|
+
api_client: BaseApiClient,
|
286
|
+
from_object: Union[dict, object],
|
287
|
+
parent_object: Optional[dict] = None,
|
288
|
+
) -> dict:
|
289
|
+
to_object: dict[str, Any] = {}
|
290
|
+
if getv(from_object, ['text_input']) is not None:
|
291
|
+
raise ValueError('text_input parameter is not supported in Vertex AI.')
|
292
|
+
|
293
|
+
if getv(from_object, ['output']) is not None:
|
294
|
+
raise ValueError('output parameter is not supported in Vertex AI.')
|
295
|
+
|
296
|
+
return to_object
|
297
|
+
|
298
|
+
|
299
|
+
def _TuningDataset_to_vertex(
|
300
|
+
api_client: BaseApiClient,
|
301
|
+
from_object: Union[dict, object],
|
302
|
+
parent_object: Optional[dict] = None,
|
303
|
+
) -> dict:
|
304
|
+
to_object: dict[str, Any] = {}
|
305
|
+
if getv(from_object, ['gcs_uri']) is not None:
|
306
|
+
setv(
|
307
|
+
parent_object,
|
308
|
+
['supervisedTuningSpec', 'trainingDatasetUri'],
|
309
|
+
getv(from_object, ['gcs_uri']),
|
310
|
+
)
|
311
|
+
|
312
|
+
if getv(from_object, ['examples']) is not None:
|
313
|
+
raise ValueError('examples parameter is not supported in Vertex AI.')
|
314
|
+
|
315
|
+
return to_object
|
316
|
+
|
317
|
+
|
318
|
+
def _TuningValidationDataset_to_vertex(
|
319
|
+
api_client: BaseApiClient,
|
320
|
+
from_object: Union[dict, object],
|
321
|
+
parent_object: Optional[dict] = None,
|
322
|
+
) -> dict:
|
323
|
+
to_object: dict[str, Any] = {}
|
324
|
+
if getv(from_object, ['gcs_uri']) is not None:
|
325
|
+
setv(to_object, ['validationDatasetUri'], getv(from_object, ['gcs_uri']))
|
326
|
+
|
327
|
+
return to_object
|
328
|
+
|
329
|
+
|
300
330
|
def _CreateTuningJobConfig_to_vertex(
|
301
331
|
api_client: BaseApiClient,
|
302
332
|
from_object: Union[dict, object],
|
@@ -353,36 +383,6 @@ def _CreateTuningJobConfig_to_vertex(
|
|
353
383
|
return to_object
|
354
384
|
|
355
385
|
|
356
|
-
def _CreateTuningJobParameters_to_mldev(
|
357
|
-
api_client: BaseApiClient,
|
358
|
-
from_object: Union[dict, object],
|
359
|
-
parent_object: Optional[dict] = None,
|
360
|
-
) -> dict:
|
361
|
-
to_object: dict[str, Any] = {}
|
362
|
-
if getv(from_object, ['base_model']) is not None:
|
363
|
-
setv(to_object, ['baseModel'], getv(from_object, ['base_model']))
|
364
|
-
|
365
|
-
if getv(from_object, ['training_dataset']) is not None:
|
366
|
-
setv(
|
367
|
-
to_object,
|
368
|
-
['tuningTask', 'trainingData'],
|
369
|
-
_TuningDataset_to_mldev(
|
370
|
-
api_client, getv(from_object, ['training_dataset']), to_object
|
371
|
-
),
|
372
|
-
)
|
373
|
-
|
374
|
-
if getv(from_object, ['config']) is not None:
|
375
|
-
setv(
|
376
|
-
to_object,
|
377
|
-
['config'],
|
378
|
-
_CreateTuningJobConfig_to_mldev(
|
379
|
-
api_client, getv(from_object, ['config']), to_object
|
380
|
-
),
|
381
|
-
)
|
382
|
-
|
383
|
-
return to_object
|
384
|
-
|
385
|
-
|
386
386
|
def _CreateTuningJobParameters_to_vertex(
|
387
387
|
api_client: BaseApiClient,
|
388
388
|
from_object: Union[dict, object],
|
@@ -428,21 +428,6 @@ def _TunedModel_from_mldev(
|
|
428
428
|
return to_object
|
429
429
|
|
430
430
|
|
431
|
-
def _TunedModel_from_vertex(
|
432
|
-
api_client: BaseApiClient,
|
433
|
-
from_object: Union[dict, object],
|
434
|
-
parent_object: Optional[dict] = None,
|
435
|
-
) -> dict:
|
436
|
-
to_object: dict[str, Any] = {}
|
437
|
-
if getv(from_object, ['model']) is not None:
|
438
|
-
setv(to_object, ['model'], getv(from_object, ['model']))
|
439
|
-
|
440
|
-
if getv(from_object, ['endpoint']) is not None:
|
441
|
-
setv(to_object, ['endpoint'], getv(from_object, ['endpoint']))
|
442
|
-
|
443
|
-
return to_object
|
444
|
-
|
445
|
-
|
446
431
|
def _TuningJob_from_mldev(
|
447
432
|
api_client: BaseApiClient,
|
448
433
|
from_object: Union[dict, object],
|
@@ -520,6 +505,67 @@ def _TuningJob_from_mldev(
|
|
520
505
|
return to_object
|
521
506
|
|
522
507
|
|
508
|
+
def _ListTuningJobsResponse_from_mldev(
|
509
|
+
api_client: BaseApiClient,
|
510
|
+
from_object: Union[dict, object],
|
511
|
+
parent_object: Optional[dict] = None,
|
512
|
+
) -> dict:
|
513
|
+
to_object: dict[str, Any] = {}
|
514
|
+
if getv(from_object, ['nextPageToken']) is not None:
|
515
|
+
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
516
|
+
|
517
|
+
if getv(from_object, ['tunedModels']) is not None:
|
518
|
+
setv(
|
519
|
+
to_object,
|
520
|
+
['tuning_jobs'],
|
521
|
+
[
|
522
|
+
_TuningJob_from_mldev(api_client, item, to_object)
|
523
|
+
for item in getv(from_object, ['tunedModels'])
|
524
|
+
],
|
525
|
+
)
|
526
|
+
|
527
|
+
return to_object
|
528
|
+
|
529
|
+
|
530
|
+
def _Operation_from_mldev(
|
531
|
+
api_client: BaseApiClient,
|
532
|
+
from_object: Union[dict, object],
|
533
|
+
parent_object: Optional[dict] = None,
|
534
|
+
) -> dict:
|
535
|
+
to_object: dict[str, Any] = {}
|
536
|
+
if getv(from_object, ['name']) is not None:
|
537
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
538
|
+
|
539
|
+
if getv(from_object, ['metadata']) is not None:
|
540
|
+
setv(to_object, ['metadata'], getv(from_object, ['metadata']))
|
541
|
+
|
542
|
+
if getv(from_object, ['done']) is not None:
|
543
|
+
setv(to_object, ['done'], getv(from_object, ['done']))
|
544
|
+
|
545
|
+
if getv(from_object, ['error']) is not None:
|
546
|
+
setv(to_object, ['error'], getv(from_object, ['error']))
|
547
|
+
|
548
|
+
if getv(from_object, ['response']) is not None:
|
549
|
+
setv(to_object, ['response'], getv(from_object, ['response']))
|
550
|
+
|
551
|
+
return to_object
|
552
|
+
|
553
|
+
|
554
|
+
def _TunedModel_from_vertex(
|
555
|
+
api_client: BaseApiClient,
|
556
|
+
from_object: Union[dict, object],
|
557
|
+
parent_object: Optional[dict] = None,
|
558
|
+
) -> dict:
|
559
|
+
to_object: dict[str, Any] = {}
|
560
|
+
if getv(from_object, ['model']) is not None:
|
561
|
+
setv(to_object, ['model'], getv(from_object, ['model']))
|
562
|
+
|
563
|
+
if getv(from_object, ['endpoint']) is not None:
|
564
|
+
setv(to_object, ['endpoint'], getv(from_object, ['endpoint']))
|
565
|
+
|
566
|
+
return to_object
|
567
|
+
|
568
|
+
|
523
569
|
def _TuningJob_from_vertex(
|
524
570
|
api_client: BaseApiClient,
|
525
571
|
from_object: Union[dict, object],
|
@@ -614,28 +660,6 @@ def _TuningJob_from_vertex(
|
|
614
660
|
return to_object
|
615
661
|
|
616
662
|
|
617
|
-
def _ListTuningJobsResponse_from_mldev(
|
618
|
-
api_client: BaseApiClient,
|
619
|
-
from_object: Union[dict, object],
|
620
|
-
parent_object: Optional[dict] = None,
|
621
|
-
) -> dict:
|
622
|
-
to_object: dict[str, Any] = {}
|
623
|
-
if getv(from_object, ['nextPageToken']) is not None:
|
624
|
-
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
625
|
-
|
626
|
-
if getv(from_object, ['tunedModels']) is not None:
|
627
|
-
setv(
|
628
|
-
to_object,
|
629
|
-
['tuning_jobs'],
|
630
|
-
[
|
631
|
-
_TuningJob_from_mldev(api_client, item, to_object)
|
632
|
-
for item in getv(from_object, ['tunedModels'])
|
633
|
-
],
|
634
|
-
)
|
635
|
-
|
636
|
-
return to_object
|
637
|
-
|
638
|
-
|
639
663
|
def _ListTuningJobsResponse_from_vertex(
|
640
664
|
api_client: BaseApiClient,
|
641
665
|
from_object: Union[dict, object],
|
@@ -658,54 +682,6 @@ def _ListTuningJobsResponse_from_vertex(
|
|
658
682
|
return to_object
|
659
683
|
|
660
684
|
|
661
|
-
def _Operation_from_mldev(
|
662
|
-
api_client: BaseApiClient,
|
663
|
-
from_object: Union[dict, object],
|
664
|
-
parent_object: Optional[dict] = None,
|
665
|
-
) -> dict:
|
666
|
-
to_object: dict[str, Any] = {}
|
667
|
-
if getv(from_object, ['name']) is not None:
|
668
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
669
|
-
|
670
|
-
if getv(from_object, ['metadata']) is not None:
|
671
|
-
setv(to_object, ['metadata'], getv(from_object, ['metadata']))
|
672
|
-
|
673
|
-
if getv(from_object, ['done']) is not None:
|
674
|
-
setv(to_object, ['done'], getv(from_object, ['done']))
|
675
|
-
|
676
|
-
if getv(from_object, ['error']) is not None:
|
677
|
-
setv(to_object, ['error'], getv(from_object, ['error']))
|
678
|
-
|
679
|
-
if getv(from_object, ['response']) is not None:
|
680
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
681
|
-
|
682
|
-
return to_object
|
683
|
-
|
684
|
-
|
685
|
-
def _Operation_from_vertex(
|
686
|
-
api_client: BaseApiClient,
|
687
|
-
from_object: Union[dict, object],
|
688
|
-
parent_object: Optional[dict] = None,
|
689
|
-
) -> dict:
|
690
|
-
to_object: dict[str, Any] = {}
|
691
|
-
if getv(from_object, ['name']) is not None:
|
692
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
693
|
-
|
694
|
-
if getv(from_object, ['metadata']) is not None:
|
695
|
-
setv(to_object, ['metadata'], getv(from_object, ['metadata']))
|
696
|
-
|
697
|
-
if getv(from_object, ['done']) is not None:
|
698
|
-
setv(to_object, ['done'], getv(from_object, ['done']))
|
699
|
-
|
700
|
-
if getv(from_object, ['error']) is not None:
|
701
|
-
setv(to_object, ['error'], getv(from_object, ['error']))
|
702
|
-
|
703
|
-
if getv(from_object, ['response']) is not None:
|
704
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
705
|
-
|
706
|
-
return to_object
|
707
|
-
|
708
|
-
|
709
685
|
class Tunings(_api_module.BaseModule):
|
710
686
|
|
711
687
|
def _get(
|
@@ -754,11 +730,12 @@ class Tunings(_api_module.BaseModule):
|
|
754
730
|
# TODO: remove the hack that pops config.
|
755
731
|
request_dict.pop('config', None)
|
756
732
|
|
757
|
-
http_options: Optional[types.
|
758
|
-
if
|
759
|
-
|
760
|
-
|
761
|
-
|
733
|
+
http_options: Optional[types.HttpOptions] = None
|
734
|
+
if (
|
735
|
+
parameter_model.config is not None
|
736
|
+
and parameter_model.config.http_options is not None
|
737
|
+
):
|
738
|
+
http_options = parameter_model.config.http_options
|
762
739
|
|
763
740
|
request_dict = _common.convert_to_dict(request_dict)
|
764
741
|
request_dict = _common.encode_unserializable_types(request_dict)
|
@@ -769,6 +746,7 @@ class Tunings(_api_module.BaseModule):
|
|
769
746
|
|
770
747
|
if self._api_client.vertexai:
|
771
748
|
response_dict = _TuningJob_from_vertex(self._api_client, response_dict)
|
749
|
+
|
772
750
|
else:
|
773
751
|
response_dict = _TuningJob_from_mldev(self._api_client, response_dict)
|
774
752
|
|
@@ -820,11 +798,12 @@ class Tunings(_api_module.BaseModule):
|
|
820
798
|
# TODO: remove the hack that pops config.
|
821
799
|
request_dict.pop('config', None)
|
822
800
|
|
823
|
-
http_options: Optional[types.
|
824
|
-
if
|
825
|
-
|
826
|
-
|
827
|
-
|
801
|
+
http_options: Optional[types.HttpOptions] = None
|
802
|
+
if (
|
803
|
+
parameter_model.config is not None
|
804
|
+
and parameter_model.config.http_options is not None
|
805
|
+
):
|
806
|
+
http_options = parameter_model.config.http_options
|
828
807
|
|
829
808
|
request_dict = _common.convert_to_dict(request_dict)
|
830
809
|
request_dict = _common.encode_unserializable_types(request_dict)
|
@@ -837,6 +816,7 @@ class Tunings(_api_module.BaseModule):
|
|
837
816
|
response_dict = _ListTuningJobsResponse_from_vertex(
|
838
817
|
self._api_client, response_dict
|
839
818
|
)
|
819
|
+
|
840
820
|
else:
|
841
821
|
response_dict = _ListTuningJobsResponse_from_mldev(
|
842
822
|
self._api_client, response_dict
|
@@ -891,11 +871,12 @@ class Tunings(_api_module.BaseModule):
|
|
891
871
|
# TODO: remove the hack that pops config.
|
892
872
|
request_dict.pop('config', None)
|
893
873
|
|
894
|
-
http_options: Optional[types.
|
895
|
-
if
|
896
|
-
|
897
|
-
|
898
|
-
|
874
|
+
http_options: Optional[types.HttpOptions] = None
|
875
|
+
if (
|
876
|
+
parameter_model.config is not None
|
877
|
+
and parameter_model.config.http_options is not None
|
878
|
+
):
|
879
|
+
http_options = parameter_model.config.http_options
|
899
880
|
|
900
881
|
request_dict = _common.convert_to_dict(request_dict)
|
901
882
|
request_dict = _common.encode_unserializable_types(request_dict)
|
@@ -906,8 +887,6 @@ class Tunings(_api_module.BaseModule):
|
|
906
887
|
|
907
888
|
if self._api_client.vertexai:
|
908
889
|
response_dict = _TuningJob_from_vertex(self._api_client, response_dict)
|
909
|
-
else:
|
910
|
-
response_dict = _TuningJob_from_mldev(self._api_client, response_dict)
|
911
890
|
|
912
891
|
return_value = types.TuningJob._from_response(
|
913
892
|
response=response_dict, kwargs=parameter_model.model_dump()
|
@@ -941,7 +920,9 @@ class Tunings(_api_module.BaseModule):
|
|
941
920
|
|
942
921
|
request_url_dict: Optional[dict[str, str]]
|
943
922
|
if self._api_client.vertexai:
|
944
|
-
raise ValueError(
|
923
|
+
raise ValueError(
|
924
|
+
'This method is only supported in the Gemini Developer client.'
|
925
|
+
)
|
945
926
|
else:
|
946
927
|
request_dict = _CreateTuningJobParameters_to_mldev(
|
947
928
|
self._api_client, parameter_model
|
@@ -958,11 +939,12 @@ class Tunings(_api_module.BaseModule):
|
|
958
939
|
# TODO: remove the hack that pops config.
|
959
940
|
request_dict.pop('config', None)
|
960
941
|
|
961
|
-
http_options: Optional[types.
|
962
|
-
if
|
963
|
-
|
964
|
-
|
965
|
-
|
942
|
+
http_options: Optional[types.HttpOptions] = None
|
943
|
+
if (
|
944
|
+
parameter_model.config is not None
|
945
|
+
and parameter_model.config.http_options is not None
|
946
|
+
):
|
947
|
+
http_options = parameter_model.config.http_options
|
966
948
|
|
967
949
|
request_dict = _common.convert_to_dict(request_dict)
|
968
950
|
request_dict = _common.encode_unserializable_types(request_dict)
|
@@ -971,9 +953,7 @@ class Tunings(_api_module.BaseModule):
|
|
971
953
|
'post', path, request_dict, http_options
|
972
954
|
)
|
973
955
|
|
974
|
-
if self._api_client.vertexai:
|
975
|
-
response_dict = _Operation_from_vertex(self._api_client, response_dict)
|
976
|
-
else:
|
956
|
+
if not self._api_client.vertexai:
|
977
957
|
response_dict = _Operation_from_mldev(self._api_client, response_dict)
|
978
958
|
|
979
959
|
return_value = types.Operation._from_response(
|
@@ -1098,11 +1078,12 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1098
1078
|
# TODO: remove the hack that pops config.
|
1099
1079
|
request_dict.pop('config', None)
|
1100
1080
|
|
1101
|
-
http_options: Optional[types.
|
1102
|
-
if
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1081
|
+
http_options: Optional[types.HttpOptions] = None
|
1082
|
+
if (
|
1083
|
+
parameter_model.config is not None
|
1084
|
+
and parameter_model.config.http_options is not None
|
1085
|
+
):
|
1086
|
+
http_options = parameter_model.config.http_options
|
1106
1087
|
|
1107
1088
|
request_dict = _common.convert_to_dict(request_dict)
|
1108
1089
|
request_dict = _common.encode_unserializable_types(request_dict)
|
@@ -1113,6 +1094,7 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1113
1094
|
|
1114
1095
|
if self._api_client.vertexai:
|
1115
1096
|
response_dict = _TuningJob_from_vertex(self._api_client, response_dict)
|
1097
|
+
|
1116
1098
|
else:
|
1117
1099
|
response_dict = _TuningJob_from_mldev(self._api_client, response_dict)
|
1118
1100
|
|
@@ -1164,11 +1146,12 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1164
1146
|
# TODO: remove the hack that pops config.
|
1165
1147
|
request_dict.pop('config', None)
|
1166
1148
|
|
1167
|
-
http_options: Optional[types.
|
1168
|
-
if
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1149
|
+
http_options: Optional[types.HttpOptions] = None
|
1150
|
+
if (
|
1151
|
+
parameter_model.config is not None
|
1152
|
+
and parameter_model.config.http_options is not None
|
1153
|
+
):
|
1154
|
+
http_options = parameter_model.config.http_options
|
1172
1155
|
|
1173
1156
|
request_dict = _common.convert_to_dict(request_dict)
|
1174
1157
|
request_dict = _common.encode_unserializable_types(request_dict)
|
@@ -1181,6 +1164,7 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1181
1164
|
response_dict = _ListTuningJobsResponse_from_vertex(
|
1182
1165
|
self._api_client, response_dict
|
1183
1166
|
)
|
1167
|
+
|
1184
1168
|
else:
|
1185
1169
|
response_dict = _ListTuningJobsResponse_from_mldev(
|
1186
1170
|
self._api_client, response_dict
|
@@ -1235,11 +1219,12 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1235
1219
|
# TODO: remove the hack that pops config.
|
1236
1220
|
request_dict.pop('config', None)
|
1237
1221
|
|
1238
|
-
http_options: Optional[types.
|
1239
|
-
if
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1222
|
+
http_options: Optional[types.HttpOptions] = None
|
1223
|
+
if (
|
1224
|
+
parameter_model.config is not None
|
1225
|
+
and parameter_model.config.http_options is not None
|
1226
|
+
):
|
1227
|
+
http_options = parameter_model.config.http_options
|
1243
1228
|
|
1244
1229
|
request_dict = _common.convert_to_dict(request_dict)
|
1245
1230
|
request_dict = _common.encode_unserializable_types(request_dict)
|
@@ -1250,8 +1235,6 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1250
1235
|
|
1251
1236
|
if self._api_client.vertexai:
|
1252
1237
|
response_dict = _TuningJob_from_vertex(self._api_client, response_dict)
|
1253
|
-
else:
|
1254
|
-
response_dict = _TuningJob_from_mldev(self._api_client, response_dict)
|
1255
1238
|
|
1256
1239
|
return_value = types.TuningJob._from_response(
|
1257
1240
|
response=response_dict, kwargs=parameter_model.model_dump()
|
@@ -1285,7 +1268,9 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1285
1268
|
|
1286
1269
|
request_url_dict: Optional[dict[str, str]]
|
1287
1270
|
if self._api_client.vertexai:
|
1288
|
-
raise ValueError(
|
1271
|
+
raise ValueError(
|
1272
|
+
'This method is only supported in the Gemini Developer client.'
|
1273
|
+
)
|
1289
1274
|
else:
|
1290
1275
|
request_dict = _CreateTuningJobParameters_to_mldev(
|
1291
1276
|
self._api_client, parameter_model
|
@@ -1302,11 +1287,12 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1302
1287
|
# TODO: remove the hack that pops config.
|
1303
1288
|
request_dict.pop('config', None)
|
1304
1289
|
|
1305
|
-
http_options: Optional[types.
|
1306
|
-
if
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1290
|
+
http_options: Optional[types.HttpOptions] = None
|
1291
|
+
if (
|
1292
|
+
parameter_model.config is not None
|
1293
|
+
and parameter_model.config.http_options is not None
|
1294
|
+
):
|
1295
|
+
http_options = parameter_model.config.http_options
|
1310
1296
|
|
1311
1297
|
request_dict = _common.convert_to_dict(request_dict)
|
1312
1298
|
request_dict = _common.encode_unserializable_types(request_dict)
|
@@ -1315,9 +1301,7 @@ class AsyncTunings(_api_module.BaseModule):
|
|
1315
1301
|
'post', path, request_dict, http_options
|
1316
1302
|
)
|
1317
1303
|
|
1318
|
-
if self._api_client.vertexai:
|
1319
|
-
response_dict = _Operation_from_vertex(self._api_client, response_dict)
|
1320
|
-
else:
|
1304
|
+
if not self._api_client.vertexai:
|
1321
1305
|
response_dict = _Operation_from_mldev(self._api_client, response_dict)
|
1322
1306
|
|
1323
1307
|
return_value = types.Operation._from_response(
|