google-genai 1.38.0__py3-none-any.whl → 1.39.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/genai/_api_client.py +12 -0
- google/genai/_common.py +25 -10
- google/genai/_live_converters.py +2074 -1924
- google/genai/_operations_converters.py +108 -117
- google/genai/_replay_api_client.py +8 -4
- google/genai/_tokens_converters.py +465 -458
- google/genai/_transformers.py +44 -26
- google/genai/batches.py +1101 -1138
- google/genai/caches.py +747 -771
- google/genai/client.py +87 -0
- google/genai/files.py +110 -123
- google/genai/local_tokenizer.py +7 -2
- google/genai/models.py +2716 -2814
- google/genai/operations.py +10 -22
- google/genai/tunings.py +358 -391
- google/genai/types.py +192 -4
- google/genai/version.py +1 -1
- {google_genai-1.38.0.dist-info → google_genai-1.39.0.dist-info}/METADATA +82 -1
- google_genai-1.39.0.dist-info/RECORD +39 -0
- google_genai-1.38.0.dist-info/RECORD +0 -39
- {google_genai-1.38.0.dist-info → google_genai-1.39.0.dist-info}/WHEEL +0 -0
- {google_genai-1.38.0.dist-info → google_genai-1.39.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.38.0.dist-info → google_genai-1.39.0.dist-info}/top_level.txt +0 -0
google/genai/batches.py
CHANGED
@@ -34,653 +34,947 @@ from .pagers import AsyncPager, Pager
|
|
34
34
|
logger = logging.getLogger('google_genai.batches')
|
35
35
|
|
36
36
|
|
37
|
-
def
|
37
|
+
def _BatchJobDestination_from_mldev(
|
38
38
|
from_object: Union[dict[str, Any], object],
|
39
39
|
parent_object: Optional[dict[str, Any]] = None,
|
40
40
|
) -> dict[str, Any]:
|
41
41
|
to_object: dict[str, Any] = {}
|
42
|
-
if getv(from_object, ['fps']) is not None:
|
43
|
-
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
44
42
|
|
45
|
-
if getv(from_object, ['
|
46
|
-
setv(to_object, ['
|
43
|
+
if getv(from_object, ['responsesFile']) is not None:
|
44
|
+
setv(to_object, ['file_name'], getv(from_object, ['responsesFile']))
|
47
45
|
|
48
|
-
if getv(from_object, ['
|
49
|
-
setv(
|
46
|
+
if getv(from_object, ['inlinedResponses', 'inlinedResponses']) is not None:
|
47
|
+
setv(
|
48
|
+
to_object,
|
49
|
+
['inlined_responses'],
|
50
|
+
[
|
51
|
+
_InlinedResponse_from_mldev(item, to_object)
|
52
|
+
for item in getv(
|
53
|
+
from_object, ['inlinedResponses', 'inlinedResponses']
|
54
|
+
)
|
55
|
+
],
|
56
|
+
)
|
57
|
+
|
58
|
+
if (
|
59
|
+
getv(from_object, ['inlinedEmbedContentResponses', 'inlinedResponses'])
|
60
|
+
is not None
|
61
|
+
):
|
62
|
+
setv(
|
63
|
+
to_object,
|
64
|
+
['inlined_embed_content_responses'],
|
65
|
+
[
|
66
|
+
_InlinedEmbedContentResponse_from_mldev(item, to_object)
|
67
|
+
for item in getv(
|
68
|
+
from_object,
|
69
|
+
['inlinedEmbedContentResponses', 'inlinedResponses'],
|
70
|
+
)
|
71
|
+
],
|
72
|
+
)
|
50
73
|
|
51
74
|
return to_object
|
52
75
|
|
53
76
|
|
54
|
-
def
|
77
|
+
def _BatchJobDestination_from_vertex(
|
55
78
|
from_object: Union[dict[str, Any], object],
|
56
79
|
parent_object: Optional[dict[str, Any]] = None,
|
57
80
|
) -> dict[str, Any]:
|
58
81
|
to_object: dict[str, Any] = {}
|
59
|
-
if getv(from_object, ['
|
60
|
-
|
82
|
+
if getv(from_object, ['predictionsFormat']) is not None:
|
83
|
+
setv(to_object, ['format'], getv(from_object, ['predictionsFormat']))
|
61
84
|
|
62
|
-
if getv(from_object, ['
|
63
|
-
setv(
|
85
|
+
if getv(from_object, ['gcsDestination', 'outputUriPrefix']) is not None:
|
86
|
+
setv(
|
87
|
+
to_object,
|
88
|
+
['gcs_uri'],
|
89
|
+
getv(from_object, ['gcsDestination', 'outputUriPrefix']),
|
90
|
+
)
|
64
91
|
|
65
|
-
if getv(from_object, ['
|
66
|
-
setv(
|
92
|
+
if getv(from_object, ['bigqueryDestination', 'outputUri']) is not None:
|
93
|
+
setv(
|
94
|
+
to_object,
|
95
|
+
['bigquery_uri'],
|
96
|
+
getv(from_object, ['bigqueryDestination', 'outputUri']),
|
97
|
+
)
|
67
98
|
|
68
99
|
return to_object
|
69
100
|
|
70
101
|
|
71
|
-
def
|
102
|
+
def _BatchJobDestination_to_vertex(
|
72
103
|
from_object: Union[dict[str, Any], object],
|
73
104
|
parent_object: Optional[dict[str, Any]] = None,
|
74
105
|
) -> dict[str, Any]:
|
75
106
|
to_object: dict[str, Any] = {}
|
76
|
-
if getv(from_object, ['
|
77
|
-
|
107
|
+
if getv(from_object, ['format']) is not None:
|
108
|
+
setv(to_object, ['predictionsFormat'], getv(from_object, ['format']))
|
78
109
|
|
79
|
-
if getv(from_object, ['
|
80
|
-
setv(
|
110
|
+
if getv(from_object, ['gcs_uri']) is not None:
|
111
|
+
setv(
|
112
|
+
to_object,
|
113
|
+
['gcsDestination', 'outputUriPrefix'],
|
114
|
+
getv(from_object, ['gcs_uri']),
|
115
|
+
)
|
81
116
|
|
82
|
-
if getv(from_object, ['
|
83
|
-
setv(
|
117
|
+
if getv(from_object, ['bigquery_uri']) is not None:
|
118
|
+
setv(
|
119
|
+
to_object,
|
120
|
+
['bigqueryDestination', 'outputUri'],
|
121
|
+
getv(from_object, ['bigquery_uri']),
|
122
|
+
)
|
123
|
+
|
124
|
+
if getv(from_object, ['file_name']) is not None:
|
125
|
+
raise ValueError('file_name parameter is not supported in Vertex AI.')
|
126
|
+
|
127
|
+
if getv(from_object, ['inlined_responses']) is not None:
|
128
|
+
raise ValueError(
|
129
|
+
'inlined_responses parameter is not supported in Vertex AI.'
|
130
|
+
)
|
131
|
+
|
132
|
+
if getv(from_object, ['inlined_embed_content_responses']) is not None:
|
133
|
+
raise ValueError(
|
134
|
+
'inlined_embed_content_responses parameter is not supported in'
|
135
|
+
' Vertex AI.'
|
136
|
+
)
|
84
137
|
|
85
138
|
return to_object
|
86
139
|
|
87
140
|
|
88
|
-
def
|
141
|
+
def _BatchJobSource_from_vertex(
|
89
142
|
from_object: Union[dict[str, Any], object],
|
90
143
|
parent_object: Optional[dict[str, Any]] = None,
|
91
144
|
) -> dict[str, Any]:
|
92
145
|
to_object: dict[str, Any] = {}
|
93
|
-
if getv(from_object, ['
|
94
|
-
setv(to_object, ['
|
146
|
+
if getv(from_object, ['instancesFormat']) is not None:
|
147
|
+
setv(to_object, ['format'], getv(from_object, ['instancesFormat']))
|
95
148
|
|
96
|
-
if getv(from_object, ['
|
97
|
-
setv(to_object, ['
|
149
|
+
if getv(from_object, ['gcsSource', 'uris']) is not None:
|
150
|
+
setv(to_object, ['gcs_uri'], getv(from_object, ['gcsSource', 'uris']))
|
98
151
|
|
99
|
-
if getv(from_object, ['
|
100
|
-
setv(
|
152
|
+
if getv(from_object, ['bigquerySource', 'inputUri']) is not None:
|
153
|
+
setv(
|
154
|
+
to_object,
|
155
|
+
['bigquery_uri'],
|
156
|
+
getv(from_object, ['bigquerySource', 'inputUri']),
|
157
|
+
)
|
101
158
|
|
102
159
|
return to_object
|
103
160
|
|
104
161
|
|
105
|
-
def
|
162
|
+
def _BatchJobSource_to_mldev(
|
163
|
+
api_client: BaseApiClient,
|
106
164
|
from_object: Union[dict[str, Any], object],
|
107
165
|
parent_object: Optional[dict[str, Any]] = None,
|
108
166
|
) -> dict[str, Any]:
|
109
167
|
to_object: dict[str, Any] = {}
|
110
|
-
if getv(from_object, ['
|
168
|
+
if getv(from_object, ['format']) is not None:
|
169
|
+
raise ValueError('format parameter is not supported in Gemini API.')
|
170
|
+
|
171
|
+
if getv(from_object, ['gcs_uri']) is not None:
|
172
|
+
raise ValueError('gcs_uri parameter is not supported in Gemini API.')
|
173
|
+
|
174
|
+
if getv(from_object, ['bigquery_uri']) is not None:
|
175
|
+
raise ValueError('bigquery_uri parameter is not supported in Gemini API.')
|
176
|
+
|
177
|
+
if getv(from_object, ['file_name']) is not None:
|
178
|
+
setv(to_object, ['fileName'], getv(from_object, ['file_name']))
|
179
|
+
|
180
|
+
if getv(from_object, ['inlined_requests']) is not None:
|
111
181
|
setv(
|
112
182
|
to_object,
|
113
|
-
['
|
114
|
-
|
115
|
-
|
116
|
-
|
183
|
+
['requests', 'requests'],
|
184
|
+
[
|
185
|
+
_InlinedRequest_to_mldev(api_client, item, to_object)
|
186
|
+
for item in getv(from_object, ['inlined_requests'])
|
187
|
+
],
|
117
188
|
)
|
118
189
|
|
119
|
-
|
120
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
190
|
+
return to_object
|
121
191
|
|
122
|
-
|
192
|
+
|
193
|
+
def _BatchJobSource_to_vertex(
|
194
|
+
from_object: Union[dict[str, Any], object],
|
195
|
+
parent_object: Optional[dict[str, Any]] = None,
|
196
|
+
) -> dict[str, Any]:
|
197
|
+
to_object: dict[str, Any] = {}
|
198
|
+
if getv(from_object, ['format']) is not None:
|
199
|
+
setv(to_object, ['instancesFormat'], getv(from_object, ['format']))
|
200
|
+
|
201
|
+
if getv(from_object, ['gcs_uri']) is not None:
|
202
|
+
setv(to_object, ['gcsSource', 'uris'], getv(from_object, ['gcs_uri']))
|
203
|
+
|
204
|
+
if getv(from_object, ['bigquery_uri']) is not None:
|
123
205
|
setv(
|
124
206
|
to_object,
|
125
|
-
['
|
126
|
-
|
207
|
+
['bigquerySource', 'inputUri'],
|
208
|
+
getv(from_object, ['bigquery_uri']),
|
127
209
|
)
|
128
210
|
|
129
|
-
if getv(from_object, ['
|
211
|
+
if getv(from_object, ['file_name']) is not None:
|
212
|
+
raise ValueError('file_name parameter is not supported in Vertex AI.')
|
213
|
+
|
214
|
+
if getv(from_object, ['inlined_requests']) is not None:
|
215
|
+
raise ValueError(
|
216
|
+
'inlined_requests parameter is not supported in Vertex AI.'
|
217
|
+
)
|
218
|
+
|
219
|
+
return to_object
|
220
|
+
|
221
|
+
|
222
|
+
def _BatchJob_from_mldev(
|
223
|
+
from_object: Union[dict[str, Any], object],
|
224
|
+
parent_object: Optional[dict[str, Any]] = None,
|
225
|
+
) -> dict[str, Any]:
|
226
|
+
to_object: dict[str, Any] = {}
|
227
|
+
if getv(from_object, ['name']) is not None:
|
228
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
229
|
+
|
230
|
+
if getv(from_object, ['metadata', 'displayName']) is not None:
|
130
231
|
setv(
|
131
232
|
to_object,
|
132
|
-
['
|
133
|
-
|
233
|
+
['display_name'],
|
234
|
+
getv(from_object, ['metadata', 'displayName']),
|
134
235
|
)
|
135
236
|
|
136
|
-
if getv(from_object, ['
|
237
|
+
if getv(from_object, ['metadata', 'state']) is not None:
|
137
238
|
setv(
|
138
239
|
to_object,
|
139
|
-
['
|
140
|
-
getv(from_object, ['
|
240
|
+
['state'],
|
241
|
+
t.t_job_state(getv(from_object, ['metadata', 'state'])),
|
141
242
|
)
|
142
243
|
|
143
|
-
if getv(from_object, ['
|
244
|
+
if getv(from_object, ['metadata', 'createTime']) is not None:
|
144
245
|
setv(
|
145
246
|
to_object,
|
146
|
-
['
|
147
|
-
|
247
|
+
['create_time'],
|
248
|
+
getv(from_object, ['metadata', 'createTime']),
|
148
249
|
)
|
149
250
|
|
150
|
-
if getv(from_object, ['
|
251
|
+
if getv(from_object, ['metadata', 'endTime']) is not None:
|
252
|
+
setv(to_object, ['end_time'], getv(from_object, ['metadata', 'endTime']))
|
253
|
+
|
254
|
+
if getv(from_object, ['metadata', 'updateTime']) is not None:
|
151
255
|
setv(
|
152
256
|
to_object,
|
153
|
-
['
|
154
|
-
getv(from_object, ['
|
257
|
+
['update_time'],
|
258
|
+
getv(from_object, ['metadata', 'updateTime']),
|
155
259
|
)
|
156
260
|
|
157
|
-
if getv(from_object, ['
|
158
|
-
setv(to_object, ['
|
261
|
+
if getv(from_object, ['metadata', 'model']) is not None:
|
262
|
+
setv(to_object, ['model'], getv(from_object, ['metadata', 'model']))
|
159
263
|
|
160
|
-
if getv(from_object, ['
|
264
|
+
if getv(from_object, ['metadata', 'output']) is not None:
|
161
265
|
setv(
|
162
266
|
to_object,
|
163
|
-
['
|
164
|
-
|
267
|
+
['dest'],
|
268
|
+
_BatchJobDestination_from_mldev(
|
269
|
+
t.t_recv_batch_job_destination(
|
270
|
+
getv(from_object, ['metadata', 'output'])
|
271
|
+
),
|
272
|
+
to_object,
|
273
|
+
),
|
165
274
|
)
|
166
275
|
|
167
|
-
if getv(from_object, ['text']) is not None:
|
168
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
169
|
-
|
170
276
|
return to_object
|
171
277
|
|
172
278
|
|
173
|
-
def
|
279
|
+
def _BatchJob_from_vertex(
|
174
280
|
from_object: Union[dict[str, Any], object],
|
175
281
|
parent_object: Optional[dict[str, Any]] = None,
|
176
282
|
) -> dict[str, Any]:
|
177
283
|
to_object: dict[str, Any] = {}
|
178
|
-
if getv(from_object, ['
|
284
|
+
if getv(from_object, ['name']) is not None:
|
285
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
286
|
+
|
287
|
+
if getv(from_object, ['displayName']) is not None:
|
288
|
+
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
289
|
+
|
290
|
+
if getv(from_object, ['state']) is not None:
|
291
|
+
setv(to_object, ['state'], t.t_job_state(getv(from_object, ['state'])))
|
292
|
+
|
293
|
+
if getv(from_object, ['error']) is not None:
|
179
294
|
setv(
|
180
295
|
to_object,
|
181
|
-
['
|
182
|
-
[
|
183
|
-
_Part_to_mldev(item, to_object)
|
184
|
-
for item in getv(from_object, ['parts'])
|
185
|
-
],
|
296
|
+
['error'],
|
297
|
+
_JobError_from_vertex(getv(from_object, ['error']), to_object),
|
186
298
|
)
|
187
299
|
|
188
|
-
if getv(from_object, ['
|
189
|
-
setv(to_object, ['
|
300
|
+
if getv(from_object, ['createTime']) is not None:
|
301
|
+
setv(to_object, ['create_time'], getv(from_object, ['createTime']))
|
190
302
|
|
191
|
-
|
303
|
+
if getv(from_object, ['startTime']) is not None:
|
304
|
+
setv(to_object, ['start_time'], getv(from_object, ['startTime']))
|
192
305
|
|
306
|
+
if getv(from_object, ['endTime']) is not None:
|
307
|
+
setv(to_object, ['end_time'], getv(from_object, ['endTime']))
|
193
308
|
|
194
|
-
|
195
|
-
|
196
|
-
parent_object: Optional[dict[str, Any]] = None,
|
197
|
-
) -> dict[str, Any]:
|
198
|
-
to_object: dict[str, Any] = {}
|
199
|
-
if getv(from_object, ['additional_properties']) is not None:
|
200
|
-
raise ValueError(
|
201
|
-
'additional_properties parameter is not supported in Gemini API.'
|
202
|
-
)
|
203
|
-
|
204
|
-
if getv(from_object, ['defs']) is not None:
|
205
|
-
raise ValueError('defs parameter is not supported in Gemini API.')
|
206
|
-
|
207
|
-
if getv(from_object, ['ref']) is not None:
|
208
|
-
raise ValueError('ref parameter is not supported in Gemini API.')
|
209
|
-
|
210
|
-
if getv(from_object, ['any_of']) is not None:
|
211
|
-
setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
|
212
|
-
|
213
|
-
if getv(from_object, ['default']) is not None:
|
214
|
-
setv(to_object, ['default'], getv(from_object, ['default']))
|
215
|
-
|
216
|
-
if getv(from_object, ['description']) is not None:
|
217
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
218
|
-
|
219
|
-
if getv(from_object, ['enum']) is not None:
|
220
|
-
setv(to_object, ['enum'], getv(from_object, ['enum']))
|
221
|
-
|
222
|
-
if getv(from_object, ['example']) is not None:
|
223
|
-
setv(to_object, ['example'], getv(from_object, ['example']))
|
224
|
-
|
225
|
-
if getv(from_object, ['format']) is not None:
|
226
|
-
setv(to_object, ['format'], getv(from_object, ['format']))
|
227
|
-
|
228
|
-
if getv(from_object, ['items']) is not None:
|
229
|
-
setv(to_object, ['items'], getv(from_object, ['items']))
|
230
|
-
|
231
|
-
if getv(from_object, ['max_items']) is not None:
|
232
|
-
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
233
|
-
|
234
|
-
if getv(from_object, ['max_length']) is not None:
|
235
|
-
setv(to_object, ['maxLength'], getv(from_object, ['max_length']))
|
236
|
-
|
237
|
-
if getv(from_object, ['max_properties']) is not None:
|
238
|
-
setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
|
239
|
-
|
240
|
-
if getv(from_object, ['maximum']) is not None:
|
241
|
-
setv(to_object, ['maximum'], getv(from_object, ['maximum']))
|
242
|
-
|
243
|
-
if getv(from_object, ['min_items']) is not None:
|
244
|
-
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
245
|
-
|
246
|
-
if getv(from_object, ['min_length']) is not None:
|
247
|
-
setv(to_object, ['minLength'], getv(from_object, ['min_length']))
|
248
|
-
|
249
|
-
if getv(from_object, ['min_properties']) is not None:
|
250
|
-
setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
|
251
|
-
|
252
|
-
if getv(from_object, ['minimum']) is not None:
|
253
|
-
setv(to_object, ['minimum'], getv(from_object, ['minimum']))
|
254
|
-
|
255
|
-
if getv(from_object, ['nullable']) is not None:
|
256
|
-
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
257
|
-
|
258
|
-
if getv(from_object, ['pattern']) is not None:
|
259
|
-
setv(to_object, ['pattern'], getv(from_object, ['pattern']))
|
309
|
+
if getv(from_object, ['updateTime']) is not None:
|
310
|
+
setv(to_object, ['update_time'], getv(from_object, ['updateTime']))
|
260
311
|
|
261
|
-
if getv(from_object, ['
|
262
|
-
setv(to_object, ['
|
312
|
+
if getv(from_object, ['model']) is not None:
|
313
|
+
setv(to_object, ['model'], getv(from_object, ['model']))
|
263
314
|
|
264
|
-
if getv(from_object, ['
|
315
|
+
if getv(from_object, ['inputConfig']) is not None:
|
265
316
|
setv(
|
266
317
|
to_object,
|
267
|
-
['
|
268
|
-
|
318
|
+
['src'],
|
319
|
+
_BatchJobSource_from_vertex(
|
320
|
+
getv(from_object, ['inputConfig']), to_object
|
321
|
+
),
|
269
322
|
)
|
270
323
|
|
271
|
-
if getv(from_object, ['
|
272
|
-
setv(
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
324
|
+
if getv(from_object, ['outputConfig']) is not None:
|
325
|
+
setv(
|
326
|
+
to_object,
|
327
|
+
['dest'],
|
328
|
+
_BatchJobDestination_from_vertex(
|
329
|
+
t.t_recv_batch_job_destination(getv(from_object, ['outputConfig'])),
|
330
|
+
to_object,
|
331
|
+
),
|
332
|
+
)
|
279
333
|
|
280
334
|
return to_object
|
281
335
|
|
282
336
|
|
283
|
-
def
|
337
|
+
def _Blob_from_mldev(
|
284
338
|
from_object: Union[dict[str, Any], object],
|
285
339
|
parent_object: Optional[dict[str, Any]] = None,
|
286
340
|
) -> dict[str, Any]:
|
287
341
|
to_object: dict[str, Any] = {}
|
288
|
-
if getv(from_object, ['method']) is not None:
|
289
|
-
raise ValueError('method parameter is not supported in Gemini API.')
|
290
342
|
|
291
|
-
if getv(from_object, ['
|
292
|
-
setv(to_object, ['
|
343
|
+
if getv(from_object, ['data']) is not None:
|
344
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
293
345
|
|
294
|
-
if getv(from_object, ['
|
295
|
-
setv(to_object, ['
|
346
|
+
if getv(from_object, ['mimeType']) is not None:
|
347
|
+
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
296
348
|
|
297
349
|
return to_object
|
298
350
|
|
299
351
|
|
300
|
-
def
|
352
|
+
def _Blob_to_mldev(
|
301
353
|
from_object: Union[dict[str, Any], object],
|
302
354
|
parent_object: Optional[dict[str, Any]] = None,
|
303
355
|
) -> dict[str, Any]:
|
304
356
|
to_object: dict[str, Any] = {}
|
305
|
-
if getv(from_object, ['
|
306
|
-
|
307
|
-
|
308
|
-
if getv(from_object, ['description']) is not None:
|
309
|
-
setv(to_object, ['description'], getv(from_object, ['description']))
|
357
|
+
if getv(from_object, ['display_name']) is not None:
|
358
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
310
359
|
|
311
|
-
if getv(from_object, ['
|
312
|
-
setv(to_object, ['
|
360
|
+
if getv(from_object, ['data']) is not None:
|
361
|
+
setv(to_object, ['data'], getv(from_object, ['data']))
|
313
362
|
|
314
|
-
if getv(from_object, ['
|
315
|
-
setv(to_object, ['
|
363
|
+
if getv(from_object, ['mime_type']) is not None:
|
364
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
316
365
|
|
317
|
-
|
318
|
-
setv(
|
319
|
-
to_object,
|
320
|
-
['parametersJsonSchema'],
|
321
|
-
getv(from_object, ['parameters_json_schema']),
|
322
|
-
)
|
366
|
+
return to_object
|
323
367
|
|
324
|
-
if getv(from_object, ['response']) is not None:
|
325
|
-
setv(to_object, ['response'], getv(from_object, ['response']))
|
326
368
|
|
327
|
-
|
369
|
+
def _CancelBatchJobParameters_to_mldev(
|
370
|
+
api_client: BaseApiClient,
|
371
|
+
from_object: Union[dict[str, Any], object],
|
372
|
+
parent_object: Optional[dict[str, Any]] = None,
|
373
|
+
) -> dict[str, Any]:
|
374
|
+
to_object: dict[str, Any] = {}
|
375
|
+
if getv(from_object, ['name']) is not None:
|
328
376
|
setv(
|
329
377
|
to_object,
|
330
|
-
['
|
331
|
-
getv(from_object, ['
|
378
|
+
['_url', 'name'],
|
379
|
+
t.t_batch_job_name(api_client, getv(from_object, ['name'])),
|
332
380
|
)
|
333
381
|
|
334
382
|
return to_object
|
335
383
|
|
336
384
|
|
337
|
-
def
|
385
|
+
def _CancelBatchJobParameters_to_vertex(
|
386
|
+
api_client: BaseApiClient,
|
338
387
|
from_object: Union[dict[str, Any], object],
|
339
388
|
parent_object: Optional[dict[str, Any]] = None,
|
340
389
|
) -> dict[str, Any]:
|
341
390
|
to_object: dict[str, Any] = {}
|
342
|
-
if getv(from_object, ['
|
343
|
-
setv(
|
344
|
-
|
345
|
-
|
346
|
-
|
391
|
+
if getv(from_object, ['name']) is not None:
|
392
|
+
setv(
|
393
|
+
to_object,
|
394
|
+
['_url', 'name'],
|
395
|
+
t.t_batch_job_name(api_client, getv(from_object, ['name'])),
|
396
|
+
)
|
347
397
|
|
348
398
|
return to_object
|
349
399
|
|
350
400
|
|
351
|
-
def
|
401
|
+
def _Candidate_from_mldev(
|
352
402
|
from_object: Union[dict[str, Any], object],
|
353
403
|
parent_object: Optional[dict[str, Any]] = None,
|
354
404
|
) -> dict[str, Any]:
|
355
405
|
to_object: dict[str, Any] = {}
|
356
|
-
if getv(from_object, ['
|
406
|
+
if getv(from_object, ['content']) is not None:
|
357
407
|
setv(
|
358
408
|
to_object,
|
359
|
-
['
|
360
|
-
|
409
|
+
['content'],
|
410
|
+
_Content_from_mldev(getv(from_object, ['content']), to_object),
|
361
411
|
)
|
362
412
|
|
363
|
-
if getv(from_object, ['
|
364
|
-
|
365
|
-
|
413
|
+
if getv(from_object, ['citationMetadata']) is not None:
|
414
|
+
setv(
|
415
|
+
to_object,
|
416
|
+
['citation_metadata'],
|
417
|
+
_CitationMetadata_from_mldev(
|
418
|
+
getv(from_object, ['citationMetadata']), to_object
|
419
|
+
),
|
366
420
|
)
|
367
421
|
|
368
|
-
|
422
|
+
if getv(from_object, ['tokenCount']) is not None:
|
423
|
+
setv(to_object, ['token_count'], getv(from_object, ['tokenCount']))
|
369
424
|
|
425
|
+
if getv(from_object, ['finishReason']) is not None:
|
426
|
+
setv(to_object, ['finish_reason'], getv(from_object, ['finishReason']))
|
370
427
|
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
428
|
+
if getv(from_object, ['urlContextMetadata']) is not None:
|
429
|
+
setv(
|
430
|
+
to_object,
|
431
|
+
['url_context_metadata'],
|
432
|
+
_UrlContextMetadata_from_mldev(
|
433
|
+
getv(from_object, ['urlContextMetadata']), to_object
|
434
|
+
),
|
435
|
+
)
|
378
436
|
|
379
|
-
if getv(from_object, ['
|
437
|
+
if getv(from_object, ['avgLogprobs']) is not None:
|
438
|
+
setv(to_object, ['avg_logprobs'], getv(from_object, ['avgLogprobs']))
|
439
|
+
|
440
|
+
if getv(from_object, ['groundingMetadata']) is not None:
|
380
441
|
setv(
|
381
442
|
to_object,
|
382
|
-
['
|
383
|
-
getv(from_object, ['
|
443
|
+
['grounding_metadata'],
|
444
|
+
getv(from_object, ['groundingMetadata']),
|
384
445
|
)
|
385
446
|
|
447
|
+
if getv(from_object, ['index']) is not None:
|
448
|
+
setv(to_object, ['index'], getv(from_object, ['index']))
|
449
|
+
|
450
|
+
if getv(from_object, ['logprobsResult']) is not None:
|
451
|
+
setv(to_object, ['logprobs_result'], getv(from_object, ['logprobsResult']))
|
452
|
+
|
453
|
+
if getv(from_object, ['safetyRatings']) is not None:
|
454
|
+
setv(to_object, ['safety_ratings'], getv(from_object, ['safetyRatings']))
|
455
|
+
|
386
456
|
return to_object
|
387
457
|
|
388
458
|
|
389
|
-
def
|
459
|
+
def _CitationMetadata_from_mldev(
|
390
460
|
from_object: Union[dict[str, Any], object],
|
391
461
|
parent_object: Optional[dict[str, Any]] = None,
|
392
462
|
) -> dict[str, Any]:
|
393
463
|
to_object: dict[str, Any] = {}
|
394
|
-
if getv(from_object, ['
|
395
|
-
setv(
|
396
|
-
to_object,
|
397
|
-
['dynamicRetrievalConfig'],
|
398
|
-
_DynamicRetrievalConfig_to_mldev(
|
399
|
-
getv(from_object, ['dynamic_retrieval_config']), to_object
|
400
|
-
),
|
401
|
-
)
|
464
|
+
if getv(from_object, ['citationSources']) is not None:
|
465
|
+
setv(to_object, ['citations'], getv(from_object, ['citationSources']))
|
402
466
|
|
403
467
|
return to_object
|
404
468
|
|
405
469
|
|
406
|
-
def
|
470
|
+
def _ContentEmbedding_from_mldev(
|
407
471
|
from_object: Union[dict[str, Any], object],
|
408
472
|
parent_object: Optional[dict[str, Any]] = None,
|
409
473
|
) -> dict[str, Any]:
|
410
474
|
to_object: dict[str, Any] = {}
|
475
|
+
if getv(from_object, ['values']) is not None:
|
476
|
+
setv(to_object, ['values'], getv(from_object, ['values']))
|
411
477
|
|
412
478
|
return to_object
|
413
479
|
|
414
480
|
|
415
|
-
def
|
481
|
+
def _Content_from_mldev(
|
416
482
|
from_object: Union[dict[str, Any], object],
|
417
483
|
parent_object: Optional[dict[str, Any]] = None,
|
418
484
|
) -> dict[str, Any]:
|
419
485
|
to_object: dict[str, Any] = {}
|
420
|
-
if getv(from_object, ['
|
421
|
-
setv(
|
486
|
+
if getv(from_object, ['parts']) is not None:
|
487
|
+
setv(
|
488
|
+
to_object,
|
489
|
+
['parts'],
|
490
|
+
[
|
491
|
+
_Part_from_mldev(item, to_object)
|
492
|
+
for item in getv(from_object, ['parts'])
|
493
|
+
],
|
494
|
+
)
|
495
|
+
|
496
|
+
if getv(from_object, ['role']) is not None:
|
497
|
+
setv(to_object, ['role'], getv(from_object, ['role']))
|
422
498
|
|
423
499
|
return to_object
|
424
500
|
|
425
501
|
|
426
|
-
def
|
502
|
+
def _Content_to_mldev(
|
427
503
|
from_object: Union[dict[str, Any], object],
|
428
504
|
parent_object: Optional[dict[str, Any]] = None,
|
429
505
|
) -> dict[str, Any]:
|
430
506
|
to_object: dict[str, Any] = {}
|
431
|
-
if getv(from_object, ['
|
507
|
+
if getv(from_object, ['parts']) is not None:
|
432
508
|
setv(
|
433
509
|
to_object,
|
434
|
-
['
|
510
|
+
['parts'],
|
435
511
|
[
|
436
|
-
|
437
|
-
for item in getv(from_object, ['
|
512
|
+
_Part_to_mldev(item, to_object)
|
513
|
+
for item in getv(from_object, ['parts'])
|
438
514
|
],
|
439
515
|
)
|
440
516
|
|
441
|
-
if getv(from_object, ['
|
442
|
-
|
517
|
+
if getv(from_object, ['role']) is not None:
|
518
|
+
setv(to_object, ['role'], getv(from_object, ['role']))
|
443
519
|
|
444
|
-
|
445
|
-
setv(
|
446
|
-
to_object,
|
447
|
-
['googleSearch'],
|
448
|
-
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
449
|
-
)
|
520
|
+
return to_object
|
450
521
|
|
451
|
-
|
522
|
+
|
523
|
+
def _CreateBatchJobConfig_to_mldev(
|
524
|
+
from_object: Union[dict[str, Any], object],
|
525
|
+
parent_object: Optional[dict[str, Any]] = None,
|
526
|
+
) -> dict[str, Any]:
|
527
|
+
to_object: dict[str, Any] = {}
|
528
|
+
|
529
|
+
if getv(from_object, ['display_name']) is not None:
|
452
530
|
setv(
|
453
|
-
|
454
|
-
['
|
455
|
-
|
456
|
-
getv(from_object, ['google_search_retrieval']), to_object
|
457
|
-
),
|
531
|
+
parent_object,
|
532
|
+
['batch', 'displayName'],
|
533
|
+
getv(from_object, ['display_name']),
|
458
534
|
)
|
459
535
|
|
460
|
-
if getv(from_object, ['
|
461
|
-
raise ValueError(
|
462
|
-
'enterprise_web_search parameter is not supported in Gemini API.'
|
463
|
-
)
|
536
|
+
if getv(from_object, ['dest']) is not None:
|
537
|
+
raise ValueError('dest parameter is not supported in Gemini API.')
|
464
538
|
|
465
|
-
|
466
|
-
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
539
|
+
return to_object
|
467
540
|
|
468
|
-
if getv(from_object, ['url_context']) is not None:
|
469
|
-
setv(
|
470
|
-
to_object,
|
471
|
-
['urlContext'],
|
472
|
-
_UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
|
473
|
-
)
|
474
541
|
|
475
|
-
|
542
|
+
def _CreateBatchJobConfig_to_vertex(
|
543
|
+
from_object: Union[dict[str, Any], object],
|
544
|
+
parent_object: Optional[dict[str, Any]] = None,
|
545
|
+
) -> dict[str, Any]:
|
546
|
+
to_object: dict[str, Any] = {}
|
547
|
+
|
548
|
+
if getv(from_object, ['display_name']) is not None:
|
549
|
+
setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
|
550
|
+
|
551
|
+
if getv(from_object, ['dest']) is not None:
|
476
552
|
setv(
|
477
|
-
|
478
|
-
['
|
479
|
-
|
480
|
-
getv(from_object, ['
|
553
|
+
parent_object,
|
554
|
+
['outputConfig'],
|
555
|
+
_BatchJobDestination_to_vertex(
|
556
|
+
t.t_batch_job_destination(getv(from_object, ['dest'])), to_object
|
481
557
|
),
|
482
558
|
)
|
483
559
|
|
484
|
-
if getv(from_object, ['code_execution']) is not None:
|
485
|
-
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
486
|
-
|
487
560
|
return to_object
|
488
561
|
|
489
562
|
|
490
|
-
def
|
563
|
+
def _CreateBatchJobParameters_to_mldev(
|
564
|
+
api_client: BaseApiClient,
|
491
565
|
from_object: Union[dict[str, Any], object],
|
492
566
|
parent_object: Optional[dict[str, Any]] = None,
|
493
567
|
) -> dict[str, Any]:
|
494
568
|
to_object: dict[str, Any] = {}
|
495
|
-
if getv(from_object, ['
|
496
|
-
setv(
|
569
|
+
if getv(from_object, ['model']) is not None:
|
570
|
+
setv(
|
571
|
+
to_object,
|
572
|
+
['_url', 'model'],
|
573
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
574
|
+
)
|
497
575
|
|
498
|
-
if getv(from_object, ['
|
576
|
+
if getv(from_object, ['src']) is not None:
|
499
577
|
setv(
|
500
578
|
to_object,
|
501
|
-
['
|
502
|
-
|
579
|
+
['batch', 'inputConfig'],
|
580
|
+
_BatchJobSource_to_mldev(
|
581
|
+
api_client,
|
582
|
+
t.t_batch_job_source(api_client, getv(from_object, ['src'])),
|
583
|
+
to_object,
|
584
|
+
),
|
503
585
|
)
|
504
586
|
|
587
|
+
if getv(from_object, ['config']) is not None:
|
588
|
+
_CreateBatchJobConfig_to_mldev(getv(from_object, ['config']), to_object)
|
589
|
+
|
505
590
|
return to_object
|
506
591
|
|
507
592
|
|
508
|
-
def
|
593
|
+
def _CreateBatchJobParameters_to_vertex(
|
594
|
+
api_client: BaseApiClient,
|
509
595
|
from_object: Union[dict[str, Any], object],
|
510
596
|
parent_object: Optional[dict[str, Any]] = None,
|
511
597
|
) -> dict[str, Any]:
|
512
598
|
to_object: dict[str, Any] = {}
|
513
|
-
if getv(from_object, ['
|
514
|
-
setv(
|
599
|
+
if getv(from_object, ['model']) is not None:
|
600
|
+
setv(
|
601
|
+
to_object,
|
602
|
+
['model'],
|
603
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
604
|
+
)
|
515
605
|
|
516
|
-
if getv(from_object, ['
|
517
|
-
setv(
|
606
|
+
if getv(from_object, ['src']) is not None:
|
607
|
+
setv(
|
608
|
+
to_object,
|
609
|
+
['inputConfig'],
|
610
|
+
_BatchJobSource_to_vertex(
|
611
|
+
t.t_batch_job_source(api_client, getv(from_object, ['src'])),
|
612
|
+
to_object,
|
613
|
+
),
|
614
|
+
)
|
615
|
+
|
616
|
+
if getv(from_object, ['config']) is not None:
|
617
|
+
_CreateBatchJobConfig_to_vertex(getv(from_object, ['config']), to_object)
|
518
618
|
|
519
619
|
return to_object
|
520
620
|
|
521
621
|
|
522
|
-
def
|
622
|
+
def _CreateEmbeddingsBatchJobConfig_to_mldev(
|
523
623
|
from_object: Union[dict[str, Any], object],
|
524
624
|
parent_object: Optional[dict[str, Any]] = None,
|
525
625
|
) -> dict[str, Any]:
|
526
626
|
to_object: dict[str, Any] = {}
|
527
|
-
|
627
|
+
|
628
|
+
if getv(from_object, ['display_name']) is not None:
|
528
629
|
setv(
|
529
|
-
|
530
|
-
['
|
531
|
-
|
630
|
+
parent_object,
|
631
|
+
['batch', 'displayName'],
|
632
|
+
getv(from_object, ['display_name']),
|
532
633
|
)
|
533
634
|
|
534
|
-
if getv(from_object, ['language_code']) is not None:
|
535
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
536
|
-
|
537
635
|
return to_object
|
538
636
|
|
539
637
|
|
540
|
-
def
|
638
|
+
def _CreateEmbeddingsBatchJobParameters_to_mldev(
|
639
|
+
api_client: BaseApiClient,
|
541
640
|
from_object: Union[dict[str, Any], object],
|
542
641
|
parent_object: Optional[dict[str, Any]] = None,
|
543
642
|
) -> dict[str, Any]:
|
544
643
|
to_object: dict[str, Any] = {}
|
545
|
-
if getv(from_object, ['
|
644
|
+
if getv(from_object, ['model']) is not None:
|
546
645
|
setv(
|
547
646
|
to_object,
|
548
|
-
['
|
549
|
-
|
550
|
-
getv(from_object, ['function_calling_config']), to_object
|
551
|
-
),
|
647
|
+
['_url', 'model'],
|
648
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
552
649
|
)
|
553
650
|
|
554
|
-
if getv(from_object, ['
|
651
|
+
if getv(from_object, ['src']) is not None:
|
555
652
|
setv(
|
556
653
|
to_object,
|
557
|
-
['
|
558
|
-
|
559
|
-
getv(from_object, ['
|
654
|
+
['batch', 'inputConfig'],
|
655
|
+
_EmbeddingsBatchJobSource_to_mldev(
|
656
|
+
api_client, getv(from_object, ['src']), to_object
|
560
657
|
),
|
561
658
|
)
|
562
659
|
|
660
|
+
if getv(from_object, ['config']) is not None:
|
661
|
+
_CreateEmbeddingsBatchJobConfig_to_mldev(
|
662
|
+
getv(from_object, ['config']), to_object
|
663
|
+
)
|
664
|
+
|
563
665
|
return to_object
|
564
666
|
|
565
667
|
|
566
|
-
def
|
668
|
+
def _DeleteBatchJobParameters_to_mldev(
|
669
|
+
api_client: BaseApiClient,
|
567
670
|
from_object: Union[dict[str, Any], object],
|
568
671
|
parent_object: Optional[dict[str, Any]] = None,
|
569
672
|
) -> dict[str, Any]:
|
570
673
|
to_object: dict[str, Any] = {}
|
571
|
-
if getv(from_object, ['
|
572
|
-
setv(
|
674
|
+
if getv(from_object, ['name']) is not None:
|
675
|
+
setv(
|
676
|
+
to_object,
|
677
|
+
['_url', 'name'],
|
678
|
+
t.t_batch_job_name(api_client, getv(from_object, ['name'])),
|
679
|
+
)
|
573
680
|
|
574
681
|
return to_object
|
575
682
|
|
576
683
|
|
577
|
-
def
|
684
|
+
def _DeleteBatchJobParameters_to_vertex(
|
685
|
+
api_client: BaseApiClient,
|
578
686
|
from_object: Union[dict[str, Any], object],
|
579
687
|
parent_object: Optional[dict[str, Any]] = None,
|
580
688
|
) -> dict[str, Any]:
|
581
689
|
to_object: dict[str, Any] = {}
|
582
|
-
if getv(from_object, ['
|
690
|
+
if getv(from_object, ['name']) is not None:
|
583
691
|
setv(
|
584
692
|
to_object,
|
585
|
-
['
|
586
|
-
|
587
|
-
getv(from_object, ['prebuilt_voice_config']), to_object
|
588
|
-
),
|
693
|
+
['_url', 'name'],
|
694
|
+
t.t_batch_job_name(api_client, getv(from_object, ['name'])),
|
589
695
|
)
|
590
696
|
|
591
697
|
return to_object
|
592
698
|
|
593
699
|
|
594
|
-
def
|
700
|
+
def _DeleteResourceJob_from_mldev(
|
595
701
|
from_object: Union[dict[str, Any], object],
|
596
702
|
parent_object: Optional[dict[str, Any]] = None,
|
597
703
|
) -> dict[str, Any]:
|
598
704
|
to_object: dict[str, Any] = {}
|
599
|
-
if getv(from_object, ['
|
600
|
-
setv(
|
705
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
706
|
+
setv(
|
707
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
708
|
+
)
|
601
709
|
|
602
|
-
if getv(from_object, ['
|
710
|
+
if getv(from_object, ['name']) is not None:
|
711
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
712
|
+
|
713
|
+
if getv(from_object, ['done']) is not None:
|
714
|
+
setv(to_object, ['done'], getv(from_object, ['done']))
|
715
|
+
|
716
|
+
if getv(from_object, ['error']) is not None:
|
603
717
|
setv(
|
604
718
|
to_object,
|
605
|
-
['
|
606
|
-
|
719
|
+
['error'],
|
720
|
+
_JobError_from_mldev(getv(from_object, ['error']), to_object),
|
607
721
|
)
|
608
722
|
|
609
723
|
return to_object
|
610
724
|
|
611
725
|
|
612
|
-
def
|
726
|
+
def _DeleteResourceJob_from_vertex(
|
613
727
|
from_object: Union[dict[str, Any], object],
|
614
728
|
parent_object: Optional[dict[str, Any]] = None,
|
615
729
|
) -> dict[str, Any]:
|
616
730
|
to_object: dict[str, Any] = {}
|
617
|
-
if getv(from_object, ['
|
731
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
732
|
+
setv(
|
733
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
734
|
+
)
|
735
|
+
|
736
|
+
if getv(from_object, ['name']) is not None:
|
737
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
738
|
+
|
739
|
+
if getv(from_object, ['done']) is not None:
|
740
|
+
setv(to_object, ['done'], getv(from_object, ['done']))
|
741
|
+
|
742
|
+
if getv(from_object, ['error']) is not None:
|
618
743
|
setv(
|
619
744
|
to_object,
|
620
|
-
['
|
621
|
-
[
|
622
|
-
_SpeakerVoiceConfig_to_mldev(item, to_object)
|
623
|
-
for item in getv(from_object, ['speaker_voice_configs'])
|
624
|
-
],
|
745
|
+
['error'],
|
746
|
+
_JobError_from_vertex(getv(from_object, ['error']), to_object),
|
625
747
|
)
|
626
748
|
|
627
749
|
return to_object
|
628
750
|
|
629
751
|
|
630
|
-
def
|
752
|
+
def _DynamicRetrievalConfig_to_mldev(
|
631
753
|
from_object: Union[dict[str, Any], object],
|
632
754
|
parent_object: Optional[dict[str, Any]] = None,
|
633
755
|
) -> dict[str, Any]:
|
634
756
|
to_object: dict[str, Any] = {}
|
635
|
-
if getv(from_object, ['
|
636
|
-
setv(
|
637
|
-
to_object,
|
638
|
-
['voiceConfig'],
|
639
|
-
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
640
|
-
)
|
757
|
+
if getv(from_object, ['mode']) is not None:
|
758
|
+
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
641
759
|
|
642
|
-
if getv(from_object, ['
|
760
|
+
if getv(from_object, ['dynamic_threshold']) is not None:
|
643
761
|
setv(
|
644
762
|
to_object,
|
645
|
-
['
|
646
|
-
|
647
|
-
getv(from_object, ['multi_speaker_voice_config']), to_object
|
648
|
-
),
|
763
|
+
['dynamicThreshold'],
|
764
|
+
getv(from_object, ['dynamic_threshold']),
|
649
765
|
)
|
650
766
|
|
651
|
-
if getv(from_object, ['language_code']) is not None:
|
652
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
653
|
-
|
654
767
|
return to_object
|
655
768
|
|
656
769
|
|
657
|
-
def
|
770
|
+
def _EmbedContentBatch_to_mldev(
|
771
|
+
api_client: BaseApiClient,
|
658
772
|
from_object: Union[dict[str, Any], object],
|
659
773
|
parent_object: Optional[dict[str, Any]] = None,
|
660
774
|
) -> dict[str, Any]:
|
661
775
|
to_object: dict[str, Any] = {}
|
662
|
-
if getv(from_object, ['
|
776
|
+
if getv(from_object, ['contents']) is not None:
|
663
777
|
setv(
|
664
|
-
to_object,
|
778
|
+
to_object,
|
779
|
+
['requests[]', 'request', 'content'],
|
780
|
+
t.t_contents_for_embed(api_client, getv(from_object, ['contents'])),
|
665
781
|
)
|
666
782
|
|
667
|
-
if getv(from_object, ['
|
668
|
-
setv(
|
783
|
+
if getv(from_object, ['config']) is not None:
|
784
|
+
setv(
|
785
|
+
to_object,
|
786
|
+
['config'],
|
787
|
+
_EmbedContentConfig_to_mldev(getv(from_object, ['config']), to_object),
|
788
|
+
)
|
669
789
|
|
670
790
|
return to_object
|
671
791
|
|
672
792
|
|
673
|
-
def
|
674
|
-
api_client: BaseApiClient,
|
793
|
+
def _EmbedContentConfig_to_mldev(
|
675
794
|
from_object: Union[dict[str, Any], object],
|
676
795
|
parent_object: Optional[dict[str, Any]] = None,
|
677
796
|
) -> dict[str, Any]:
|
678
797
|
to_object: dict[str, Any] = {}
|
679
798
|
|
680
|
-
if getv(from_object, ['
|
799
|
+
if getv(from_object, ['task_type']) is not None:
|
681
800
|
setv(
|
682
801
|
parent_object,
|
683
|
-
['
|
802
|
+
['requests[]', 'taskType'],
|
803
|
+
getv(from_object, ['task_type']),
|
804
|
+
)
|
805
|
+
|
806
|
+
if getv(from_object, ['title']) is not None:
|
807
|
+
setv(parent_object, ['requests[]', 'title'], getv(from_object, ['title']))
|
808
|
+
|
809
|
+
if getv(from_object, ['output_dimensionality']) is not None:
|
810
|
+
setv(
|
811
|
+
parent_object,
|
812
|
+
['requests[]', 'outputDimensionality'],
|
813
|
+
getv(from_object, ['output_dimensionality']),
|
814
|
+
)
|
815
|
+
|
816
|
+
if getv(from_object, ['mime_type']) is not None:
|
817
|
+
raise ValueError('mime_type parameter is not supported in Gemini API.')
|
818
|
+
|
819
|
+
if getv(from_object, ['auto_truncate']) is not None:
|
820
|
+
raise ValueError('auto_truncate parameter is not supported in Gemini API.')
|
821
|
+
|
822
|
+
return to_object
|
823
|
+
|
824
|
+
|
825
|
+
def _EmbeddingsBatchJobSource_to_mldev(
|
826
|
+
api_client: BaseApiClient,
|
827
|
+
from_object: Union[dict[str, Any], object],
|
828
|
+
parent_object: Optional[dict[str, Any]] = None,
|
829
|
+
) -> dict[str, Any]:
|
830
|
+
to_object: dict[str, Any] = {}
|
831
|
+
if getv(from_object, ['file_name']) is not None:
|
832
|
+
setv(to_object, ['file_name'], getv(from_object, ['file_name']))
|
833
|
+
|
834
|
+
if getv(from_object, ['inlined_requests']) is not None:
|
835
|
+
setv(
|
836
|
+
to_object,
|
837
|
+
['requests'],
|
838
|
+
_EmbedContentBatch_to_mldev(
|
839
|
+
api_client, getv(from_object, ['inlined_requests']), to_object
|
840
|
+
),
|
841
|
+
)
|
842
|
+
|
843
|
+
return to_object
|
844
|
+
|
845
|
+
|
846
|
+
def _FileData_from_mldev(
|
847
|
+
from_object: Union[dict[str, Any], object],
|
848
|
+
parent_object: Optional[dict[str, Any]] = None,
|
849
|
+
) -> dict[str, Any]:
|
850
|
+
to_object: dict[str, Any] = {}
|
851
|
+
|
852
|
+
if getv(from_object, ['fileUri']) is not None:
|
853
|
+
setv(to_object, ['file_uri'], getv(from_object, ['fileUri']))
|
854
|
+
|
855
|
+
if getv(from_object, ['mimeType']) is not None:
|
856
|
+
setv(to_object, ['mime_type'], getv(from_object, ['mimeType']))
|
857
|
+
|
858
|
+
return to_object
|
859
|
+
|
860
|
+
|
861
|
+
def _FileData_to_mldev(
|
862
|
+
from_object: Union[dict[str, Any], object],
|
863
|
+
parent_object: Optional[dict[str, Any]] = None,
|
864
|
+
) -> dict[str, Any]:
|
865
|
+
to_object: dict[str, Any] = {}
|
866
|
+
if getv(from_object, ['display_name']) is not None:
|
867
|
+
raise ValueError('display_name parameter is not supported in Gemini API.')
|
868
|
+
|
869
|
+
if getv(from_object, ['file_uri']) is not None:
|
870
|
+
setv(to_object, ['fileUri'], getv(from_object, ['file_uri']))
|
871
|
+
|
872
|
+
if getv(from_object, ['mime_type']) is not None:
|
873
|
+
setv(to_object, ['mimeType'], getv(from_object, ['mime_type']))
|
874
|
+
|
875
|
+
return to_object
|
876
|
+
|
877
|
+
|
878
|
+
def _FunctionCall_from_mldev(
|
879
|
+
from_object: Union[dict[str, Any], object],
|
880
|
+
parent_object: Optional[dict[str, Any]] = None,
|
881
|
+
) -> dict[str, Any]:
|
882
|
+
to_object: dict[str, Any] = {}
|
883
|
+
if getv(from_object, ['id']) is not None:
|
884
|
+
setv(to_object, ['id'], getv(from_object, ['id']))
|
885
|
+
|
886
|
+
if getv(from_object, ['args']) is not None:
|
887
|
+
setv(to_object, ['args'], getv(from_object, ['args']))
|
888
|
+
|
889
|
+
if getv(from_object, ['name']) is not None:
|
890
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
891
|
+
|
892
|
+
return to_object
|
893
|
+
|
894
|
+
|
895
|
+
def _FunctionCall_to_mldev(
|
896
|
+
from_object: Union[dict[str, Any], object],
|
897
|
+
parent_object: Optional[dict[str, Any]] = None,
|
898
|
+
) -> dict[str, Any]:
|
899
|
+
to_object: dict[str, Any] = {}
|
900
|
+
if getv(from_object, ['id']) is not None:
|
901
|
+
setv(to_object, ['id'], getv(from_object, ['id']))
|
902
|
+
|
903
|
+
if getv(from_object, ['args']) is not None:
|
904
|
+
setv(to_object, ['args'], getv(from_object, ['args']))
|
905
|
+
|
906
|
+
if getv(from_object, ['name']) is not None:
|
907
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
908
|
+
|
909
|
+
return to_object
|
910
|
+
|
911
|
+
|
912
|
+
def _FunctionCallingConfig_to_mldev(
|
913
|
+
from_object: Union[dict[str, Any], object],
|
914
|
+
parent_object: Optional[dict[str, Any]] = None,
|
915
|
+
) -> dict[str, Any]:
|
916
|
+
to_object: dict[str, Any] = {}
|
917
|
+
if getv(from_object, ['mode']) is not None:
|
918
|
+
setv(to_object, ['mode'], getv(from_object, ['mode']))
|
919
|
+
|
920
|
+
if getv(from_object, ['allowed_function_names']) is not None:
|
921
|
+
setv(
|
922
|
+
to_object,
|
923
|
+
['allowedFunctionNames'],
|
924
|
+
getv(from_object, ['allowed_function_names']),
|
925
|
+
)
|
926
|
+
|
927
|
+
return to_object
|
928
|
+
|
929
|
+
|
930
|
+
def _FunctionDeclaration_to_mldev(
|
931
|
+
from_object: Union[dict[str, Any], object],
|
932
|
+
parent_object: Optional[dict[str, Any]] = None,
|
933
|
+
) -> dict[str, Any]:
|
934
|
+
to_object: dict[str, Any] = {}
|
935
|
+
if getv(from_object, ['behavior']) is not None:
|
936
|
+
setv(to_object, ['behavior'], getv(from_object, ['behavior']))
|
937
|
+
|
938
|
+
if getv(from_object, ['description']) is not None:
|
939
|
+
setv(to_object, ['description'], getv(from_object, ['description']))
|
940
|
+
|
941
|
+
if getv(from_object, ['name']) is not None:
|
942
|
+
setv(to_object, ['name'], getv(from_object, ['name']))
|
943
|
+
|
944
|
+
if getv(from_object, ['parameters']) is not None:
|
945
|
+
setv(to_object, ['parameters'], getv(from_object, ['parameters']))
|
946
|
+
|
947
|
+
if getv(from_object, ['parameters_json_schema']) is not None:
|
948
|
+
setv(
|
949
|
+
to_object,
|
950
|
+
['parametersJsonSchema'],
|
951
|
+
getv(from_object, ['parameters_json_schema']),
|
952
|
+
)
|
953
|
+
|
954
|
+
if getv(from_object, ['response']) is not None:
|
955
|
+
setv(to_object, ['response'], getv(from_object, ['response']))
|
956
|
+
|
957
|
+
if getv(from_object, ['response_json_schema']) is not None:
|
958
|
+
setv(
|
959
|
+
to_object,
|
960
|
+
['responseJsonSchema'],
|
961
|
+
getv(from_object, ['response_json_schema']),
|
962
|
+
)
|
963
|
+
|
964
|
+
return to_object
|
965
|
+
|
966
|
+
|
967
|
+
def _GenerateContentConfig_to_mldev(
|
968
|
+
api_client: BaseApiClient,
|
969
|
+
from_object: Union[dict[str, Any], object],
|
970
|
+
parent_object: Optional[dict[str, Any]] = None,
|
971
|
+
) -> dict[str, Any]:
|
972
|
+
to_object: dict[str, Any] = {}
|
973
|
+
|
974
|
+
if getv(from_object, ['system_instruction']) is not None:
|
975
|
+
setv(
|
976
|
+
parent_object,
|
977
|
+
['systemInstruction'],
|
684
978
|
_Content_to_mldev(
|
685
979
|
t.t_content(getv(from_object, ['system_instruction'])), to_object
|
686
980
|
),
|
@@ -840,287 +1134,251 @@ def _GenerateContentConfig_to_mldev(
|
|
840
1134
|
return to_object
|
841
1135
|
|
842
1136
|
|
843
|
-
def
|
844
|
-
api_client: BaseApiClient,
|
1137
|
+
def _GenerateContentResponse_from_mldev(
|
845
1138
|
from_object: Union[dict[str, Any], object],
|
846
1139
|
parent_object: Optional[dict[str, Any]] = None,
|
847
1140
|
) -> dict[str, Any]:
|
848
1141
|
to_object: dict[str, Any] = {}
|
849
|
-
if getv(from_object, ['
|
1142
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
850
1143
|
setv(
|
851
|
-
to_object,
|
852
|
-
['request', 'model'],
|
853
|
-
t.t_model(api_client, getv(from_object, ['model'])),
|
1144
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
854
1145
|
)
|
855
1146
|
|
856
|
-
if getv(from_object, ['
|
1147
|
+
if getv(from_object, ['candidates']) is not None:
|
857
1148
|
setv(
|
858
1149
|
to_object,
|
859
|
-
['
|
1150
|
+
['candidates'],
|
860
1151
|
[
|
861
|
-
|
862
|
-
for item in
|
1152
|
+
_Candidate_from_mldev(item, to_object)
|
1153
|
+
for item in getv(from_object, ['candidates'])
|
863
1154
|
],
|
864
1155
|
)
|
865
1156
|
|
866
|
-
if getv(from_object, ['
|
867
|
-
setv(
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
)
|
1157
|
+
if getv(from_object, ['modelVersion']) is not None:
|
1158
|
+
setv(to_object, ['model_version'], getv(from_object, ['modelVersion']))
|
1159
|
+
|
1160
|
+
if getv(from_object, ['promptFeedback']) is not None:
|
1161
|
+
setv(to_object, ['prompt_feedback'], getv(from_object, ['promptFeedback']))
|
1162
|
+
|
1163
|
+
if getv(from_object, ['responseId']) is not None:
|
1164
|
+
setv(to_object, ['response_id'], getv(from_object, ['responseId']))
|
1165
|
+
|
1166
|
+
if getv(from_object, ['usageMetadata']) is not None:
|
1167
|
+
setv(to_object, ['usage_metadata'], getv(from_object, ['usageMetadata']))
|
874
1168
|
|
875
1169
|
return to_object
|
876
1170
|
|
877
1171
|
|
878
|
-
def
|
1172
|
+
def _GetBatchJobParameters_to_mldev(
|
879
1173
|
api_client: BaseApiClient,
|
880
1174
|
from_object: Union[dict[str, Any], object],
|
881
1175
|
parent_object: Optional[dict[str, Any]] = None,
|
882
1176
|
) -> dict[str, Any]:
|
883
1177
|
to_object: dict[str, Any] = {}
|
884
|
-
if getv(from_object, ['
|
885
|
-
raise ValueError('format parameter is not supported in Gemini API.')
|
886
|
-
|
887
|
-
if getv(from_object, ['gcs_uri']) is not None:
|
888
|
-
raise ValueError('gcs_uri parameter is not supported in Gemini API.')
|
889
|
-
|
890
|
-
if getv(from_object, ['bigquery_uri']) is not None:
|
891
|
-
raise ValueError('bigquery_uri parameter is not supported in Gemini API.')
|
892
|
-
|
893
|
-
if getv(from_object, ['file_name']) is not None:
|
894
|
-
setv(to_object, ['fileName'], getv(from_object, ['file_name']))
|
895
|
-
|
896
|
-
if getv(from_object, ['inlined_requests']) is not None:
|
1178
|
+
if getv(from_object, ['name']) is not None:
|
897
1179
|
setv(
|
898
1180
|
to_object,
|
899
|
-
['
|
900
|
-
[
|
901
|
-
_InlinedRequest_to_mldev(api_client, item, to_object)
|
902
|
-
for item in getv(from_object, ['inlined_requests'])
|
903
|
-
],
|
1181
|
+
['_url', 'name'],
|
1182
|
+
t.t_batch_job_name(api_client, getv(from_object, ['name'])),
|
904
1183
|
)
|
905
1184
|
|
906
1185
|
return to_object
|
907
1186
|
|
908
1187
|
|
909
|
-
def
|
1188
|
+
def _GetBatchJobParameters_to_vertex(
|
1189
|
+
api_client: BaseApiClient,
|
910
1190
|
from_object: Union[dict[str, Any], object],
|
911
1191
|
parent_object: Optional[dict[str, Any]] = None,
|
912
1192
|
) -> dict[str, Any]:
|
913
1193
|
to_object: dict[str, Any] = {}
|
914
|
-
|
915
|
-
if getv(from_object, ['display_name']) is not None:
|
1194
|
+
if getv(from_object, ['name']) is not None:
|
916
1195
|
setv(
|
917
|
-
|
918
|
-
['
|
919
|
-
getv(from_object, ['
|
1196
|
+
to_object,
|
1197
|
+
['_url', 'name'],
|
1198
|
+
t.t_batch_job_name(api_client, getv(from_object, ['name'])),
|
920
1199
|
)
|
921
1200
|
|
922
|
-
if getv(from_object, ['dest']) is not None:
|
923
|
-
raise ValueError('dest parameter is not supported in Gemini API.')
|
924
|
-
|
925
1201
|
return to_object
|
926
1202
|
|
927
1203
|
|
928
|
-
def
|
929
|
-
api_client: BaseApiClient,
|
1204
|
+
def _GoogleSearchRetrieval_to_mldev(
|
930
1205
|
from_object: Union[dict[str, Any], object],
|
931
1206
|
parent_object: Optional[dict[str, Any]] = None,
|
932
1207
|
) -> dict[str, Any]:
|
933
1208
|
to_object: dict[str, Any] = {}
|
934
|
-
if getv(from_object, ['
|
1209
|
+
if getv(from_object, ['dynamic_retrieval_config']) is not None:
|
935
1210
|
setv(
|
936
1211
|
to_object,
|
937
|
-
['
|
938
|
-
|
1212
|
+
['dynamicRetrievalConfig'],
|
1213
|
+
_DynamicRetrievalConfig_to_mldev(
|
1214
|
+
getv(from_object, ['dynamic_retrieval_config']), to_object
|
1215
|
+
),
|
939
1216
|
)
|
940
1217
|
|
941
|
-
|
1218
|
+
return to_object
|
1219
|
+
|
1220
|
+
|
1221
|
+
def _GoogleSearch_to_mldev(
|
1222
|
+
from_object: Union[dict[str, Any], object],
|
1223
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1224
|
+
) -> dict[str, Any]:
|
1225
|
+
to_object: dict[str, Any] = {}
|
1226
|
+
if getv(from_object, ['time_range_filter']) is not None:
|
942
1227
|
setv(
|
943
1228
|
to_object,
|
944
|
-
['
|
945
|
-
|
946
|
-
api_client,
|
947
|
-
t.t_batch_job_source(api_client, getv(from_object, ['src'])),
|
948
|
-
to_object,
|
949
|
-
),
|
1229
|
+
['timeRangeFilter'],
|
1230
|
+
_Interval_to_mldev(getv(from_object, ['time_range_filter']), to_object),
|
950
1231
|
)
|
951
1232
|
|
952
|
-
if getv(from_object, ['
|
953
|
-
|
954
|
-
|
955
|
-
['config'],
|
956
|
-
_CreateBatchJobConfig_to_mldev(
|
957
|
-
getv(from_object, ['config']), to_object
|
958
|
-
),
|
1233
|
+
if getv(from_object, ['exclude_domains']) is not None:
|
1234
|
+
raise ValueError(
|
1235
|
+
'exclude_domains parameter is not supported in Gemini API.'
|
959
1236
|
)
|
960
1237
|
|
961
1238
|
return to_object
|
962
1239
|
|
963
1240
|
|
964
|
-
def
|
1241
|
+
def _InlinedEmbedContentResponse_from_mldev(
|
965
1242
|
from_object: Union[dict[str, Any], object],
|
966
1243
|
parent_object: Optional[dict[str, Any]] = None,
|
967
1244
|
) -> dict[str, Any]:
|
968
1245
|
to_object: dict[str, Any] = {}
|
969
|
-
|
970
|
-
if getv(from_object, ['task_type']) is not None:
|
1246
|
+
if getv(from_object, ['response']) is not None:
|
971
1247
|
setv(
|
972
|
-
|
973
|
-
['
|
974
|
-
|
1248
|
+
to_object,
|
1249
|
+
['response'],
|
1250
|
+
_SingleEmbedContentResponse_from_mldev(
|
1251
|
+
getv(from_object, ['response']), to_object
|
1252
|
+
),
|
975
1253
|
)
|
976
1254
|
|
977
|
-
if getv(from_object, ['
|
978
|
-
setv(parent_object, ['requests[]', 'title'], getv(from_object, ['title']))
|
979
|
-
|
980
|
-
if getv(from_object, ['output_dimensionality']) is not None:
|
1255
|
+
if getv(from_object, ['error']) is not None:
|
981
1256
|
setv(
|
982
|
-
|
983
|
-
['
|
984
|
-
getv(from_object, ['
|
1257
|
+
to_object,
|
1258
|
+
['error'],
|
1259
|
+
_JobError_from_mldev(getv(from_object, ['error']), to_object),
|
985
1260
|
)
|
986
1261
|
|
987
|
-
if getv(from_object, ['mime_type']) is not None:
|
988
|
-
raise ValueError('mime_type parameter is not supported in Gemini API.')
|
989
|
-
|
990
|
-
if getv(from_object, ['auto_truncate']) is not None:
|
991
|
-
raise ValueError('auto_truncate parameter is not supported in Gemini API.')
|
992
|
-
|
993
1262
|
return to_object
|
994
1263
|
|
995
1264
|
|
996
|
-
def
|
1265
|
+
def _InlinedRequest_to_mldev(
|
997
1266
|
api_client: BaseApiClient,
|
998
1267
|
from_object: Union[dict[str, Any], object],
|
999
1268
|
parent_object: Optional[dict[str, Any]] = None,
|
1000
1269
|
) -> dict[str, Any]:
|
1001
1270
|
to_object: dict[str, Any] = {}
|
1271
|
+
if getv(from_object, ['model']) is not None:
|
1272
|
+
setv(
|
1273
|
+
to_object,
|
1274
|
+
['request', 'model'],
|
1275
|
+
t.t_model(api_client, getv(from_object, ['model'])),
|
1276
|
+
)
|
1277
|
+
|
1002
1278
|
if getv(from_object, ['contents']) is not None:
|
1003
1279
|
setv(
|
1004
1280
|
to_object,
|
1005
|
-
['
|
1006
|
-
|
1281
|
+
['request', 'contents'],
|
1282
|
+
[
|
1283
|
+
_Content_to_mldev(item, to_object)
|
1284
|
+
for item in t.t_contents(getv(from_object, ['contents']))
|
1285
|
+
],
|
1007
1286
|
)
|
1008
1287
|
|
1009
1288
|
if getv(from_object, ['config']) is not None:
|
1010
1289
|
setv(
|
1011
1290
|
to_object,
|
1012
|
-
['
|
1013
|
-
|
1291
|
+
['request', 'generationConfig'],
|
1292
|
+
_GenerateContentConfig_to_mldev(
|
1293
|
+
api_client, getv(from_object, ['config']), to_object
|
1294
|
+
),
|
1014
1295
|
)
|
1015
1296
|
|
1016
1297
|
return to_object
|
1017
1298
|
|
1018
1299
|
|
1019
|
-
def
|
1020
|
-
api_client: BaseApiClient,
|
1300
|
+
def _InlinedResponse_from_mldev(
|
1021
1301
|
from_object: Union[dict[str, Any], object],
|
1022
1302
|
parent_object: Optional[dict[str, Any]] = None,
|
1023
1303
|
) -> dict[str, Any]:
|
1024
1304
|
to_object: dict[str, Any] = {}
|
1025
|
-
if getv(from_object, ['
|
1026
|
-
setv(to_object, ['file_name'], getv(from_object, ['file_name']))
|
1027
|
-
|
1028
|
-
if getv(from_object, ['inlined_requests']) is not None:
|
1305
|
+
if getv(from_object, ['response']) is not None:
|
1029
1306
|
setv(
|
1030
1307
|
to_object,
|
1031
|
-
['
|
1032
|
-
|
1033
|
-
|
1308
|
+
['response'],
|
1309
|
+
_GenerateContentResponse_from_mldev(
|
1310
|
+
getv(from_object, ['response']), to_object
|
1034
1311
|
),
|
1035
1312
|
)
|
1036
1313
|
|
1314
|
+
if getv(from_object, ['error']) is not None:
|
1315
|
+
setv(
|
1316
|
+
to_object,
|
1317
|
+
['error'],
|
1318
|
+
_JobError_from_mldev(getv(from_object, ['error']), to_object),
|
1319
|
+
)
|
1320
|
+
|
1037
1321
|
return to_object
|
1038
1322
|
|
1039
1323
|
|
1040
|
-
def
|
1324
|
+
def _Interval_to_mldev(
|
1041
1325
|
from_object: Union[dict[str, Any], object],
|
1042
1326
|
parent_object: Optional[dict[str, Any]] = None,
|
1043
1327
|
) -> dict[str, Any]:
|
1044
1328
|
to_object: dict[str, Any] = {}
|
1329
|
+
if getv(from_object, ['start_time']) is not None:
|
1330
|
+
setv(to_object, ['startTime'], getv(from_object, ['start_time']))
|
1045
1331
|
|
1046
|
-
if getv(from_object, ['
|
1047
|
-
setv(
|
1048
|
-
parent_object,
|
1049
|
-
['batch', 'displayName'],
|
1050
|
-
getv(from_object, ['display_name']),
|
1051
|
-
)
|
1332
|
+
if getv(from_object, ['end_time']) is not None:
|
1333
|
+
setv(to_object, ['endTime'], getv(from_object, ['end_time']))
|
1052
1334
|
|
1053
1335
|
return to_object
|
1054
1336
|
|
1055
1337
|
|
1056
|
-
def
|
1057
|
-
api_client: BaseApiClient,
|
1338
|
+
def _JobError_from_mldev(
|
1058
1339
|
from_object: Union[dict[str, Any], object],
|
1059
1340
|
parent_object: Optional[dict[str, Any]] = None,
|
1060
1341
|
) -> dict[str, Any]:
|
1061
1342
|
to_object: dict[str, Any] = {}
|
1062
|
-
if getv(from_object, ['
|
1063
|
-
setv(
|
1064
|
-
to_object,
|
1065
|
-
['_url', 'model'],
|
1066
|
-
t.t_model(api_client, getv(from_object, ['model'])),
|
1067
|
-
)
|
1343
|
+
if getv(from_object, ['details']) is not None:
|
1344
|
+
setv(to_object, ['details'], getv(from_object, ['details']))
|
1068
1345
|
|
1069
|
-
if getv(from_object, ['
|
1070
|
-
setv(
|
1071
|
-
to_object,
|
1072
|
-
['batch', 'inputConfig'],
|
1073
|
-
_EmbeddingsBatchJobSource_to_mldev(
|
1074
|
-
api_client, getv(from_object, ['src']), to_object
|
1075
|
-
),
|
1076
|
-
)
|
1346
|
+
if getv(from_object, ['code']) is not None:
|
1347
|
+
setv(to_object, ['code'], getv(from_object, ['code']))
|
1077
1348
|
|
1078
|
-
if getv(from_object, ['
|
1079
|
-
setv(
|
1080
|
-
to_object,
|
1081
|
-
['config'],
|
1082
|
-
_CreateEmbeddingsBatchJobConfig_to_mldev(
|
1083
|
-
getv(from_object, ['config']), to_object
|
1084
|
-
),
|
1085
|
-
)
|
1349
|
+
if getv(from_object, ['message']) is not None:
|
1350
|
+
setv(to_object, ['message'], getv(from_object, ['message']))
|
1086
1351
|
|
1087
1352
|
return to_object
|
1088
1353
|
|
1089
1354
|
|
1090
|
-
def
|
1091
|
-
api_client: BaseApiClient,
|
1355
|
+
def _JobError_from_vertex(
|
1092
1356
|
from_object: Union[dict[str, Any], object],
|
1093
1357
|
parent_object: Optional[dict[str, Any]] = None,
|
1094
1358
|
) -> dict[str, Any]:
|
1095
1359
|
to_object: dict[str, Any] = {}
|
1096
|
-
if getv(from_object, ['
|
1097
|
-
setv(
|
1098
|
-
to_object,
|
1099
|
-
['_url', 'name'],
|
1100
|
-
t.t_batch_job_name(api_client, getv(from_object, ['name'])),
|
1101
|
-
)
|
1360
|
+
if getv(from_object, ['details']) is not None:
|
1361
|
+
setv(to_object, ['details'], getv(from_object, ['details']))
|
1102
1362
|
|
1103
|
-
if getv(from_object, ['
|
1104
|
-
setv(to_object, ['
|
1363
|
+
if getv(from_object, ['code']) is not None:
|
1364
|
+
setv(to_object, ['code'], getv(from_object, ['code']))
|
1365
|
+
|
1366
|
+
if getv(from_object, ['message']) is not None:
|
1367
|
+
setv(to_object, ['message'], getv(from_object, ['message']))
|
1105
1368
|
|
1106
1369
|
return to_object
|
1107
1370
|
|
1108
1371
|
|
1109
|
-
def
|
1110
|
-
api_client: BaseApiClient,
|
1372
|
+
def _LatLng_to_mldev(
|
1111
1373
|
from_object: Union[dict[str, Any], object],
|
1112
1374
|
parent_object: Optional[dict[str, Any]] = None,
|
1113
1375
|
) -> dict[str, Any]:
|
1114
1376
|
to_object: dict[str, Any] = {}
|
1115
|
-
if getv(from_object, ['
|
1116
|
-
setv(
|
1117
|
-
to_object,
|
1118
|
-
['_url', 'name'],
|
1119
|
-
t.t_batch_job_name(api_client, getv(from_object, ['name'])),
|
1120
|
-
)
|
1377
|
+
if getv(from_object, ['latitude']) is not None:
|
1378
|
+
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
|
1121
1379
|
|
1122
|
-
if getv(from_object, ['
|
1123
|
-
setv(to_object, ['
|
1380
|
+
if getv(from_object, ['longitude']) is not None:
|
1381
|
+
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
|
1124
1382
|
|
1125
1383
|
return to_object
|
1126
1384
|
|
@@ -1149,605 +1407,391 @@ def _ListBatchJobsConfig_to_mldev(
|
|
1149
1407
|
return to_object
|
1150
1408
|
|
1151
1409
|
|
1152
|
-
def
|
1410
|
+
def _ListBatchJobsConfig_to_vertex(
|
1153
1411
|
from_object: Union[dict[str, Any], object],
|
1154
1412
|
parent_object: Optional[dict[str, Any]] = None,
|
1155
1413
|
) -> dict[str, Any]:
|
1156
1414
|
to_object: dict[str, Any] = {}
|
1157
|
-
|
1415
|
+
|
1416
|
+
if getv(from_object, ['page_size']) is not None:
|
1158
1417
|
setv(
|
1159
|
-
|
1160
|
-
['config'],
|
1161
|
-
_ListBatchJobsConfig_to_mldev(getv(from_object, ['config']), to_object),
|
1418
|
+
parent_object, ['_query', 'pageSize'], getv(from_object, ['page_size'])
|
1162
1419
|
)
|
1163
1420
|
|
1421
|
+
if getv(from_object, ['page_token']) is not None:
|
1422
|
+
setv(
|
1423
|
+
parent_object,
|
1424
|
+
['_query', 'pageToken'],
|
1425
|
+
getv(from_object, ['page_token']),
|
1426
|
+
)
|
1427
|
+
|
1428
|
+
if getv(from_object, ['filter']) is not None:
|
1429
|
+
setv(parent_object, ['_query', 'filter'], getv(from_object, ['filter']))
|
1430
|
+
|
1164
1431
|
return to_object
|
1165
1432
|
|
1166
1433
|
|
1167
|
-
def
|
1168
|
-
api_client: BaseApiClient,
|
1434
|
+
def _ListBatchJobsParameters_to_mldev(
|
1169
1435
|
from_object: Union[dict[str, Any], object],
|
1170
1436
|
parent_object: Optional[dict[str, Any]] = None,
|
1171
1437
|
) -> dict[str, Any]:
|
1172
1438
|
to_object: dict[str, Any] = {}
|
1173
|
-
if getv(from_object, ['name']) is not None:
|
1174
|
-
setv(
|
1175
|
-
to_object,
|
1176
|
-
['_url', 'name'],
|
1177
|
-
t.t_batch_job_name(api_client, getv(from_object, ['name'])),
|
1178
|
-
)
|
1179
|
-
|
1180
1439
|
if getv(from_object, ['config']) is not None:
|
1181
|
-
|
1440
|
+
_ListBatchJobsConfig_to_mldev(getv(from_object, ['config']), to_object)
|
1182
1441
|
|
1183
1442
|
return to_object
|
1184
1443
|
|
1185
1444
|
|
1186
|
-
def
|
1445
|
+
def _ListBatchJobsParameters_to_vertex(
|
1187
1446
|
from_object: Union[dict[str, Any], object],
|
1188
1447
|
parent_object: Optional[dict[str, Any]] = None,
|
1189
1448
|
) -> dict[str, Any]:
|
1190
1449
|
to_object: dict[str, Any] = {}
|
1191
|
-
if getv(from_object, ['
|
1192
|
-
|
1450
|
+
if getv(from_object, ['config']) is not None:
|
1451
|
+
_ListBatchJobsConfig_to_vertex(getv(from_object, ['config']), to_object)
|
1193
1452
|
|
1194
|
-
|
1195
|
-
setv(to_object, ['gcsSource', 'uris'], getv(from_object, ['gcs_uri']))
|
1453
|
+
return to_object
|
1196
1454
|
|
1197
|
-
|
1455
|
+
|
1456
|
+
def _ListBatchJobsResponse_from_mldev(
|
1457
|
+
from_object: Union[dict[str, Any], object],
|
1458
|
+
parent_object: Optional[dict[str, Any]] = None,
|
1459
|
+
) -> dict[str, Any]:
|
1460
|
+
to_object: dict[str, Any] = {}
|
1461
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
1198
1462
|
setv(
|
1199
|
-
to_object,
|
1200
|
-
['bigquerySource', 'inputUri'],
|
1201
|
-
getv(from_object, ['bigquery_uri']),
|
1463
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
1202
1464
|
)
|
1203
1465
|
|
1204
|
-
if getv(from_object, ['
|
1205
|
-
|
1466
|
+
if getv(from_object, ['nextPageToken']) is not None:
|
1467
|
+
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
1206
1468
|
|
1207
|
-
if getv(from_object, ['
|
1208
|
-
|
1209
|
-
|
1469
|
+
if getv(from_object, ['operations']) is not None:
|
1470
|
+
setv(
|
1471
|
+
to_object,
|
1472
|
+
['batch_jobs'],
|
1473
|
+
[
|
1474
|
+
_BatchJob_from_mldev(item, to_object)
|
1475
|
+
for item in getv(from_object, ['operations'])
|
1476
|
+
],
|
1210
1477
|
)
|
1211
1478
|
|
1212
1479
|
return to_object
|
1213
1480
|
|
1214
1481
|
|
1215
|
-
def
|
1482
|
+
def _ListBatchJobsResponse_from_vertex(
|
1216
1483
|
from_object: Union[dict[str, Any], object],
|
1217
1484
|
parent_object: Optional[dict[str, Any]] = None,
|
1218
1485
|
) -> dict[str, Any]:
|
1219
1486
|
to_object: dict[str, Any] = {}
|
1220
|
-
if getv(from_object, ['
|
1221
|
-
setv(to_object, ['predictionsFormat'], getv(from_object, ['format']))
|
1222
|
-
|
1223
|
-
if getv(from_object, ['gcs_uri']) is not None:
|
1487
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
1224
1488
|
setv(
|
1225
|
-
to_object,
|
1226
|
-
['gcsDestination', 'outputUriPrefix'],
|
1227
|
-
getv(from_object, ['gcs_uri']),
|
1489
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
1228
1490
|
)
|
1229
1491
|
|
1230
|
-
if getv(from_object, ['
|
1492
|
+
if getv(from_object, ['nextPageToken']) is not None:
|
1493
|
+
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
1494
|
+
|
1495
|
+
if getv(from_object, ['batchPredictionJobs']) is not None:
|
1231
1496
|
setv(
|
1232
1497
|
to_object,
|
1233
|
-
['
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
raise ValueError('file_name parameter is not supported in Vertex AI.')
|
1239
|
-
|
1240
|
-
if getv(from_object, ['inlined_responses']) is not None:
|
1241
|
-
raise ValueError(
|
1242
|
-
'inlined_responses parameter is not supported in Vertex AI.'
|
1243
|
-
)
|
1244
|
-
|
1245
|
-
if getv(from_object, ['inlined_embed_content_responses']) is not None:
|
1246
|
-
raise ValueError(
|
1247
|
-
'inlined_embed_content_responses parameter is not supported in'
|
1248
|
-
' Vertex AI.'
|
1498
|
+
['batch_jobs'],
|
1499
|
+
[
|
1500
|
+
_BatchJob_from_vertex(item, to_object)
|
1501
|
+
for item in getv(from_object, ['batchPredictionJobs'])
|
1502
|
+
],
|
1249
1503
|
)
|
1250
1504
|
|
1251
1505
|
return to_object
|
1252
1506
|
|
1253
1507
|
|
1254
|
-
def
|
1508
|
+
def _MultiSpeakerVoiceConfig_to_mldev(
|
1255
1509
|
from_object: Union[dict[str, Any], object],
|
1256
1510
|
parent_object: Optional[dict[str, Any]] = None,
|
1257
1511
|
) -> dict[str, Any]:
|
1258
1512
|
to_object: dict[str, Any] = {}
|
1259
|
-
|
1260
|
-
if getv(from_object, ['display_name']) is not None:
|
1261
|
-
setv(parent_object, ['displayName'], getv(from_object, ['display_name']))
|
1262
|
-
|
1263
|
-
if getv(from_object, ['dest']) is not None:
|
1513
|
+
if getv(from_object, ['speaker_voice_configs']) is not None:
|
1264
1514
|
setv(
|
1265
|
-
|
1266
|
-
['
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1515
|
+
to_object,
|
1516
|
+
['speakerVoiceConfigs'],
|
1517
|
+
[
|
1518
|
+
_SpeakerVoiceConfig_to_mldev(item, to_object)
|
1519
|
+
for item in getv(from_object, ['speaker_voice_configs'])
|
1520
|
+
],
|
1270
1521
|
)
|
1271
1522
|
|
1272
1523
|
return to_object
|
1273
1524
|
|
1274
1525
|
|
1275
|
-
def
|
1276
|
-
api_client: BaseApiClient,
|
1526
|
+
def _Part_from_mldev(
|
1277
1527
|
from_object: Union[dict[str, Any], object],
|
1278
1528
|
parent_object: Optional[dict[str, Any]] = None,
|
1279
1529
|
) -> dict[str, Any]:
|
1280
1530
|
to_object: dict[str, Any] = {}
|
1281
|
-
if getv(from_object, ['
|
1531
|
+
if getv(from_object, ['videoMetadata']) is not None:
|
1282
1532
|
setv(
|
1283
1533
|
to_object,
|
1284
|
-
['
|
1285
|
-
|
1534
|
+
['video_metadata'],
|
1535
|
+
_VideoMetadata_from_mldev(
|
1536
|
+
getv(from_object, ['videoMetadata']), to_object
|
1537
|
+
),
|
1286
1538
|
)
|
1287
1539
|
|
1288
|
-
if getv(from_object, ['
|
1540
|
+
if getv(from_object, ['thought']) is not None:
|
1541
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
1542
|
+
|
1543
|
+
if getv(from_object, ['inlineData']) is not None:
|
1289
1544
|
setv(
|
1290
1545
|
to_object,
|
1291
|
-
['
|
1292
|
-
|
1293
|
-
t.t_batch_job_source(api_client, getv(from_object, ['src'])),
|
1294
|
-
to_object,
|
1295
|
-
),
|
1546
|
+
['inline_data'],
|
1547
|
+
_Blob_from_mldev(getv(from_object, ['inlineData']), to_object),
|
1296
1548
|
)
|
1297
1549
|
|
1298
|
-
if getv(from_object, ['
|
1550
|
+
if getv(from_object, ['fileData']) is not None:
|
1299
1551
|
setv(
|
1300
1552
|
to_object,
|
1301
|
-
['
|
1302
|
-
|
1303
|
-
|
1553
|
+
['file_data'],
|
1554
|
+
_FileData_from_mldev(getv(from_object, ['fileData']), to_object),
|
1555
|
+
)
|
1556
|
+
|
1557
|
+
if getv(from_object, ['thoughtSignature']) is not None:
|
1558
|
+
setv(
|
1559
|
+
to_object,
|
1560
|
+
['thought_signature'],
|
1561
|
+
getv(from_object, ['thoughtSignature']),
|
1562
|
+
)
|
1563
|
+
|
1564
|
+
if getv(from_object, ['functionCall']) is not None:
|
1565
|
+
setv(
|
1566
|
+
to_object,
|
1567
|
+
['function_call'],
|
1568
|
+
_FunctionCall_from_mldev(
|
1569
|
+
getv(from_object, ['functionCall']), to_object
|
1304
1570
|
),
|
1305
1571
|
)
|
1306
1572
|
|
1307
|
-
|
1573
|
+
if getv(from_object, ['codeExecutionResult']) is not None:
|
1574
|
+
setv(
|
1575
|
+
to_object,
|
1576
|
+
['code_execution_result'],
|
1577
|
+
getv(from_object, ['codeExecutionResult']),
|
1578
|
+
)
|
1308
1579
|
|
1580
|
+
if getv(from_object, ['executableCode']) is not None:
|
1581
|
+
setv(to_object, ['executable_code'], getv(from_object, ['executableCode']))
|
1309
1582
|
|
1310
|
-
|
1311
|
-
api_client: BaseApiClient,
|
1312
|
-
from_object: Union[dict[str, Any], object],
|
1313
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1314
|
-
) -> dict[str, Any]:
|
1315
|
-
to_object: dict[str, Any] = {}
|
1316
|
-
if getv(from_object, ['name']) is not None:
|
1583
|
+
if getv(from_object, ['functionResponse']) is not None:
|
1317
1584
|
setv(
|
1318
1585
|
to_object,
|
1319
|
-
['
|
1320
|
-
|
1586
|
+
['function_response'],
|
1587
|
+
getv(from_object, ['functionResponse']),
|
1321
1588
|
)
|
1322
1589
|
|
1323
|
-
if getv(from_object, ['
|
1324
|
-
setv(to_object, ['
|
1590
|
+
if getv(from_object, ['text']) is not None:
|
1591
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
1325
1592
|
|
1326
1593
|
return to_object
|
1327
1594
|
|
1328
1595
|
|
1329
|
-
def
|
1330
|
-
api_client: BaseApiClient,
|
1596
|
+
def _Part_to_mldev(
|
1331
1597
|
from_object: Union[dict[str, Any], object],
|
1332
1598
|
parent_object: Optional[dict[str, Any]] = None,
|
1333
1599
|
) -> dict[str, Any]:
|
1334
1600
|
to_object: dict[str, Any] = {}
|
1335
|
-
if getv(from_object, ['
|
1601
|
+
if getv(from_object, ['video_metadata']) is not None:
|
1336
1602
|
setv(
|
1337
1603
|
to_object,
|
1338
|
-
['
|
1339
|
-
|
1604
|
+
['videoMetadata'],
|
1605
|
+
_VideoMetadata_to_mldev(
|
1606
|
+
getv(from_object, ['video_metadata']), to_object
|
1607
|
+
),
|
1340
1608
|
)
|
1341
1609
|
|
1342
|
-
if getv(from_object, ['
|
1343
|
-
setv(to_object, ['
|
1610
|
+
if getv(from_object, ['thought']) is not None:
|
1611
|
+
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
1344
1612
|
|
1345
|
-
|
1613
|
+
if getv(from_object, ['inline_data']) is not None:
|
1614
|
+
setv(
|
1615
|
+
to_object,
|
1616
|
+
['inlineData'],
|
1617
|
+
_Blob_to_mldev(getv(from_object, ['inline_data']), to_object),
|
1618
|
+
)
|
1619
|
+
|
1620
|
+
if getv(from_object, ['file_data']) is not None:
|
1621
|
+
setv(
|
1622
|
+
to_object,
|
1623
|
+
['fileData'],
|
1624
|
+
_FileData_to_mldev(getv(from_object, ['file_data']), to_object),
|
1625
|
+
)
|
1346
1626
|
|
1627
|
+
if getv(from_object, ['thought_signature']) is not None:
|
1628
|
+
setv(
|
1629
|
+
to_object,
|
1630
|
+
['thoughtSignature'],
|
1631
|
+
getv(from_object, ['thought_signature']),
|
1632
|
+
)
|
1347
1633
|
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1634
|
+
if getv(from_object, ['function_call']) is not None:
|
1635
|
+
setv(
|
1636
|
+
to_object,
|
1637
|
+
['functionCall'],
|
1638
|
+
_FunctionCall_to_mldev(getv(from_object, ['function_call']), to_object),
|
1639
|
+
)
|
1353
1640
|
|
1354
|
-
if getv(from_object, ['
|
1641
|
+
if getv(from_object, ['code_execution_result']) is not None:
|
1355
1642
|
setv(
|
1356
|
-
|
1643
|
+
to_object,
|
1644
|
+
['codeExecutionResult'],
|
1645
|
+
getv(from_object, ['code_execution_result']),
|
1357
1646
|
)
|
1358
1647
|
|
1359
|
-
if getv(from_object, ['
|
1648
|
+
if getv(from_object, ['executable_code']) is not None:
|
1649
|
+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
|
1650
|
+
|
1651
|
+
if getv(from_object, ['function_response']) is not None:
|
1360
1652
|
setv(
|
1361
|
-
|
1362
|
-
['
|
1363
|
-
getv(from_object, ['
|
1653
|
+
to_object,
|
1654
|
+
['functionResponse'],
|
1655
|
+
getv(from_object, ['function_response']),
|
1364
1656
|
)
|
1365
1657
|
|
1366
|
-
if getv(from_object, ['
|
1367
|
-
setv(
|
1658
|
+
if getv(from_object, ['text']) is not None:
|
1659
|
+
setv(to_object, ['text'], getv(from_object, ['text']))
|
1368
1660
|
|
1369
1661
|
return to_object
|
1370
1662
|
|
1371
1663
|
|
1372
|
-
def
|
1664
|
+
def _PrebuiltVoiceConfig_to_mldev(
|
1373
1665
|
from_object: Union[dict[str, Any], object],
|
1374
1666
|
parent_object: Optional[dict[str, Any]] = None,
|
1375
1667
|
) -> dict[str, Any]:
|
1376
1668
|
to_object: dict[str, Any] = {}
|
1377
|
-
if getv(from_object, ['
|
1378
|
-
setv(
|
1379
|
-
to_object,
|
1380
|
-
['config'],
|
1381
|
-
_ListBatchJobsConfig_to_vertex(
|
1382
|
-
getv(from_object, ['config']), to_object
|
1383
|
-
),
|
1384
|
-
)
|
1669
|
+
if getv(from_object, ['voice_name']) is not None:
|
1670
|
+
setv(to_object, ['voiceName'], getv(from_object, ['voice_name']))
|
1385
1671
|
|
1386
1672
|
return to_object
|
1387
1673
|
|
1388
1674
|
|
1389
|
-
def
|
1390
|
-
api_client: BaseApiClient,
|
1675
|
+
def _RetrievalConfig_to_mldev(
|
1391
1676
|
from_object: Union[dict[str, Any], object],
|
1392
1677
|
parent_object: Optional[dict[str, Any]] = None,
|
1393
1678
|
) -> dict[str, Any]:
|
1394
1679
|
to_object: dict[str, Any] = {}
|
1395
|
-
if getv(from_object, ['
|
1680
|
+
if getv(from_object, ['lat_lng']) is not None:
|
1396
1681
|
setv(
|
1397
1682
|
to_object,
|
1398
|
-
['
|
1399
|
-
|
1683
|
+
['latLng'],
|
1684
|
+
_LatLng_to_mldev(getv(from_object, ['lat_lng']), to_object),
|
1400
1685
|
)
|
1401
1686
|
|
1402
|
-
if getv(from_object, ['
|
1403
|
-
setv(to_object, ['
|
1687
|
+
if getv(from_object, ['language_code']) is not None:
|
1688
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
1404
1689
|
|
1405
1690
|
return to_object
|
1406
1691
|
|
1407
1692
|
|
1408
|
-
def
|
1693
|
+
def _SafetySetting_to_mldev(
|
1409
1694
|
from_object: Union[dict[str, Any], object],
|
1410
1695
|
parent_object: Optional[dict[str, Any]] = None,
|
1411
1696
|
) -> dict[str, Any]:
|
1412
1697
|
to_object: dict[str, Any] = {}
|
1413
|
-
if getv(from_object, ['
|
1414
|
-
|
1698
|
+
if getv(from_object, ['method']) is not None:
|
1699
|
+
raise ValueError('method parameter is not supported in Gemini API.')
|
1415
1700
|
|
1416
|
-
if getv(from_object, ['
|
1417
|
-
setv(to_object, ['
|
1701
|
+
if getv(from_object, ['category']) is not None:
|
1702
|
+
setv(to_object, ['category'], getv(from_object, ['category']))
|
1418
1703
|
|
1419
|
-
if getv(from_object, ['
|
1420
|
-
setv(to_object, ['
|
1704
|
+
if getv(from_object, ['threshold']) is not None:
|
1705
|
+
setv(to_object, ['threshold'], getv(from_object, ['threshold']))
|
1421
1706
|
|
1422
1707
|
return to_object
|
1423
1708
|
|
1424
1709
|
|
1425
|
-
def
|
1710
|
+
def _Schema_to_mldev(
|
1426
1711
|
from_object: Union[dict[str, Any], object],
|
1427
1712
|
parent_object: Optional[dict[str, Any]] = None,
|
1428
1713
|
) -> dict[str, Any]:
|
1429
1714
|
to_object: dict[str, Any] = {}
|
1715
|
+
if getv(from_object, ['additional_properties']) is not None:
|
1716
|
+
raise ValueError(
|
1717
|
+
'additional_properties parameter is not supported in Gemini API.'
|
1718
|
+
)
|
1430
1719
|
|
1431
|
-
if getv(from_object, ['
|
1432
|
-
|
1720
|
+
if getv(from_object, ['defs']) is not None:
|
1721
|
+
raise ValueError('defs parameter is not supported in Gemini API.')
|
1433
1722
|
|
1434
|
-
if getv(from_object, ['
|
1435
|
-
|
1723
|
+
if getv(from_object, ['ref']) is not None:
|
1724
|
+
raise ValueError('ref parameter is not supported in Gemini API.')
|
1436
1725
|
|
1437
|
-
|
1726
|
+
if getv(from_object, ['any_of']) is not None:
|
1727
|
+
setv(to_object, ['anyOf'], getv(from_object, ['any_of']))
|
1438
1728
|
|
1729
|
+
if getv(from_object, ['default']) is not None:
|
1730
|
+
setv(to_object, ['default'], getv(from_object, ['default']))
|
1439
1731
|
|
1440
|
-
|
1441
|
-
|
1442
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1443
|
-
) -> dict[str, Any]:
|
1444
|
-
to_object: dict[str, Any] = {}
|
1732
|
+
if getv(from_object, ['description']) is not None:
|
1733
|
+
setv(to_object, ['description'], getv(from_object, ['description']))
|
1445
1734
|
|
1446
|
-
if getv(from_object, ['
|
1447
|
-
setv(to_object, ['
|
1735
|
+
if getv(from_object, ['enum']) is not None:
|
1736
|
+
setv(to_object, ['enum'], getv(from_object, ['enum']))
|
1448
1737
|
|
1449
|
-
if getv(from_object, ['
|
1450
|
-
setv(to_object, ['
|
1738
|
+
if getv(from_object, ['example']) is not None:
|
1739
|
+
setv(to_object, ['example'], getv(from_object, ['example']))
|
1451
1740
|
|
1452
|
-
|
1741
|
+
if getv(from_object, ['format']) is not None:
|
1742
|
+
setv(to_object, ['format'], getv(from_object, ['format']))
|
1453
1743
|
|
1744
|
+
if getv(from_object, ['items']) is not None:
|
1745
|
+
setv(to_object, ['items'], getv(from_object, ['items']))
|
1454
1746
|
|
1455
|
-
|
1456
|
-
|
1457
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1458
|
-
) -> dict[str, Any]:
|
1459
|
-
to_object: dict[str, Any] = {}
|
1460
|
-
if getv(from_object, ['id']) is not None:
|
1461
|
-
setv(to_object, ['id'], getv(from_object, ['id']))
|
1747
|
+
if getv(from_object, ['max_items']) is not None:
|
1748
|
+
setv(to_object, ['maxItems'], getv(from_object, ['max_items']))
|
1462
1749
|
|
1463
|
-
if getv(from_object, ['
|
1464
|
-
setv(to_object, ['
|
1465
|
-
|
1466
|
-
if getv(from_object, ['name']) is not None:
|
1467
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1468
|
-
|
1469
|
-
return to_object
|
1470
|
-
|
1471
|
-
|
1472
|
-
def _Part_from_mldev(
|
1473
|
-
from_object: Union[dict[str, Any], object],
|
1474
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1475
|
-
) -> dict[str, Any]:
|
1476
|
-
to_object: dict[str, Any] = {}
|
1477
|
-
if getv(from_object, ['videoMetadata']) is not None:
|
1478
|
-
setv(
|
1479
|
-
to_object,
|
1480
|
-
['video_metadata'],
|
1481
|
-
_VideoMetadata_from_mldev(
|
1482
|
-
getv(from_object, ['videoMetadata']), to_object
|
1483
|
-
),
|
1484
|
-
)
|
1485
|
-
|
1486
|
-
if getv(from_object, ['thought']) is not None:
|
1487
|
-
setv(to_object, ['thought'], getv(from_object, ['thought']))
|
1488
|
-
|
1489
|
-
if getv(from_object, ['inlineData']) is not None:
|
1490
|
-
setv(
|
1491
|
-
to_object,
|
1492
|
-
['inline_data'],
|
1493
|
-
_Blob_from_mldev(getv(from_object, ['inlineData']), to_object),
|
1494
|
-
)
|
1495
|
-
|
1496
|
-
if getv(from_object, ['fileData']) is not None:
|
1497
|
-
setv(
|
1498
|
-
to_object,
|
1499
|
-
['file_data'],
|
1500
|
-
_FileData_from_mldev(getv(from_object, ['fileData']), to_object),
|
1501
|
-
)
|
1502
|
-
|
1503
|
-
if getv(from_object, ['thoughtSignature']) is not None:
|
1504
|
-
setv(
|
1505
|
-
to_object,
|
1506
|
-
['thought_signature'],
|
1507
|
-
getv(from_object, ['thoughtSignature']),
|
1508
|
-
)
|
1509
|
-
|
1510
|
-
if getv(from_object, ['functionCall']) is not None:
|
1511
|
-
setv(
|
1512
|
-
to_object,
|
1513
|
-
['function_call'],
|
1514
|
-
_FunctionCall_from_mldev(
|
1515
|
-
getv(from_object, ['functionCall']), to_object
|
1516
|
-
),
|
1517
|
-
)
|
1518
|
-
|
1519
|
-
if getv(from_object, ['codeExecutionResult']) is not None:
|
1520
|
-
setv(
|
1521
|
-
to_object,
|
1522
|
-
['code_execution_result'],
|
1523
|
-
getv(from_object, ['codeExecutionResult']),
|
1524
|
-
)
|
1525
|
-
|
1526
|
-
if getv(from_object, ['executableCode']) is not None:
|
1527
|
-
setv(to_object, ['executable_code'], getv(from_object, ['executableCode']))
|
1528
|
-
|
1529
|
-
if getv(from_object, ['functionResponse']) is not None:
|
1530
|
-
setv(
|
1531
|
-
to_object,
|
1532
|
-
['function_response'],
|
1533
|
-
getv(from_object, ['functionResponse']),
|
1534
|
-
)
|
1535
|
-
|
1536
|
-
if getv(from_object, ['text']) is not None:
|
1537
|
-
setv(to_object, ['text'], getv(from_object, ['text']))
|
1538
|
-
|
1539
|
-
return to_object
|
1540
|
-
|
1541
|
-
|
1542
|
-
def _Content_from_mldev(
|
1543
|
-
from_object: Union[dict[str, Any], object],
|
1544
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1545
|
-
) -> dict[str, Any]:
|
1546
|
-
to_object: dict[str, Any] = {}
|
1547
|
-
if getv(from_object, ['parts']) is not None:
|
1548
|
-
setv(
|
1549
|
-
to_object,
|
1550
|
-
['parts'],
|
1551
|
-
[
|
1552
|
-
_Part_from_mldev(item, to_object)
|
1553
|
-
for item in getv(from_object, ['parts'])
|
1554
|
-
],
|
1555
|
-
)
|
1556
|
-
|
1557
|
-
if getv(from_object, ['role']) is not None:
|
1558
|
-
setv(to_object, ['role'], getv(from_object, ['role']))
|
1559
|
-
|
1560
|
-
return to_object
|
1561
|
-
|
1562
|
-
|
1563
|
-
def _CitationMetadata_from_mldev(
|
1564
|
-
from_object: Union[dict[str, Any], object],
|
1565
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1566
|
-
) -> dict[str, Any]:
|
1567
|
-
to_object: dict[str, Any] = {}
|
1568
|
-
if getv(from_object, ['citationSources']) is not None:
|
1569
|
-
setv(to_object, ['citations'], getv(from_object, ['citationSources']))
|
1570
|
-
|
1571
|
-
return to_object
|
1572
|
-
|
1573
|
-
|
1574
|
-
def _UrlMetadata_from_mldev(
|
1575
|
-
from_object: Union[dict[str, Any], object],
|
1576
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1577
|
-
) -> dict[str, Any]:
|
1578
|
-
to_object: dict[str, Any] = {}
|
1579
|
-
if getv(from_object, ['retrievedUrl']) is not None:
|
1580
|
-
setv(to_object, ['retrieved_url'], getv(from_object, ['retrievedUrl']))
|
1581
|
-
|
1582
|
-
if getv(from_object, ['urlRetrievalStatus']) is not None:
|
1583
|
-
setv(
|
1584
|
-
to_object,
|
1585
|
-
['url_retrieval_status'],
|
1586
|
-
getv(from_object, ['urlRetrievalStatus']),
|
1587
|
-
)
|
1588
|
-
|
1589
|
-
return to_object
|
1590
|
-
|
1591
|
-
|
1592
|
-
def _UrlContextMetadata_from_mldev(
|
1593
|
-
from_object: Union[dict[str, Any], object],
|
1594
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1595
|
-
) -> dict[str, Any]:
|
1596
|
-
to_object: dict[str, Any] = {}
|
1597
|
-
if getv(from_object, ['urlMetadata']) is not None:
|
1598
|
-
setv(
|
1599
|
-
to_object,
|
1600
|
-
['url_metadata'],
|
1601
|
-
[
|
1602
|
-
_UrlMetadata_from_mldev(item, to_object)
|
1603
|
-
for item in getv(from_object, ['urlMetadata'])
|
1604
|
-
],
|
1605
|
-
)
|
1606
|
-
|
1607
|
-
return to_object
|
1608
|
-
|
1609
|
-
|
1610
|
-
def _Candidate_from_mldev(
|
1611
|
-
from_object: Union[dict[str, Any], object],
|
1612
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1613
|
-
) -> dict[str, Any]:
|
1614
|
-
to_object: dict[str, Any] = {}
|
1615
|
-
if getv(from_object, ['content']) is not None:
|
1616
|
-
setv(
|
1617
|
-
to_object,
|
1618
|
-
['content'],
|
1619
|
-
_Content_from_mldev(getv(from_object, ['content']), to_object),
|
1620
|
-
)
|
1621
|
-
|
1622
|
-
if getv(from_object, ['citationMetadata']) is not None:
|
1623
|
-
setv(
|
1624
|
-
to_object,
|
1625
|
-
['citation_metadata'],
|
1626
|
-
_CitationMetadata_from_mldev(
|
1627
|
-
getv(from_object, ['citationMetadata']), to_object
|
1628
|
-
),
|
1629
|
-
)
|
1630
|
-
|
1631
|
-
if getv(from_object, ['tokenCount']) is not None:
|
1632
|
-
setv(to_object, ['token_count'], getv(from_object, ['tokenCount']))
|
1633
|
-
|
1634
|
-
if getv(from_object, ['finishReason']) is not None:
|
1635
|
-
setv(to_object, ['finish_reason'], getv(from_object, ['finishReason']))
|
1636
|
-
|
1637
|
-
if getv(from_object, ['urlContextMetadata']) is not None:
|
1638
|
-
setv(
|
1639
|
-
to_object,
|
1640
|
-
['url_context_metadata'],
|
1641
|
-
_UrlContextMetadata_from_mldev(
|
1642
|
-
getv(from_object, ['urlContextMetadata']), to_object
|
1643
|
-
),
|
1644
|
-
)
|
1645
|
-
|
1646
|
-
if getv(from_object, ['avgLogprobs']) is not None:
|
1647
|
-
setv(to_object, ['avg_logprobs'], getv(from_object, ['avgLogprobs']))
|
1648
|
-
|
1649
|
-
if getv(from_object, ['groundingMetadata']) is not None:
|
1650
|
-
setv(
|
1651
|
-
to_object,
|
1652
|
-
['grounding_metadata'],
|
1653
|
-
getv(from_object, ['groundingMetadata']),
|
1654
|
-
)
|
1655
|
-
|
1656
|
-
if getv(from_object, ['index']) is not None:
|
1657
|
-
setv(to_object, ['index'], getv(from_object, ['index']))
|
1658
|
-
|
1659
|
-
if getv(from_object, ['logprobsResult']) is not None:
|
1660
|
-
setv(to_object, ['logprobs_result'], getv(from_object, ['logprobsResult']))
|
1661
|
-
|
1662
|
-
if getv(from_object, ['safetyRatings']) is not None:
|
1663
|
-
setv(to_object, ['safety_ratings'], getv(from_object, ['safetyRatings']))
|
1664
|
-
|
1665
|
-
return to_object
|
1666
|
-
|
1667
|
-
|
1668
|
-
def _GenerateContentResponse_from_mldev(
|
1669
|
-
from_object: Union[dict[str, Any], object],
|
1670
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1671
|
-
) -> dict[str, Any]:
|
1672
|
-
to_object: dict[str, Any] = {}
|
1673
|
-
if getv(from_object, ['sdkHttpResponse']) is not None:
|
1674
|
-
setv(
|
1675
|
-
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
1676
|
-
)
|
1677
|
-
|
1678
|
-
if getv(from_object, ['candidates']) is not None:
|
1679
|
-
setv(
|
1680
|
-
to_object,
|
1681
|
-
['candidates'],
|
1682
|
-
[
|
1683
|
-
_Candidate_from_mldev(item, to_object)
|
1684
|
-
for item in getv(from_object, ['candidates'])
|
1685
|
-
],
|
1686
|
-
)
|
1687
|
-
|
1688
|
-
if getv(from_object, ['modelVersion']) is not None:
|
1689
|
-
setv(to_object, ['model_version'], getv(from_object, ['modelVersion']))
|
1690
|
-
|
1691
|
-
if getv(from_object, ['promptFeedback']) is not None:
|
1692
|
-
setv(to_object, ['prompt_feedback'], getv(from_object, ['promptFeedback']))
|
1693
|
-
|
1694
|
-
if getv(from_object, ['responseId']) is not None:
|
1695
|
-
setv(to_object, ['response_id'], getv(from_object, ['responseId']))
|
1750
|
+
if getv(from_object, ['max_length']) is not None:
|
1751
|
+
setv(to_object, ['maxLength'], getv(from_object, ['max_length']))
|
1696
1752
|
|
1697
|
-
if getv(from_object, ['
|
1698
|
-
setv(to_object, ['
|
1753
|
+
if getv(from_object, ['max_properties']) is not None:
|
1754
|
+
setv(to_object, ['maxProperties'], getv(from_object, ['max_properties']))
|
1699
1755
|
|
1700
|
-
|
1756
|
+
if getv(from_object, ['maximum']) is not None:
|
1757
|
+
setv(to_object, ['maximum'], getv(from_object, ['maximum']))
|
1701
1758
|
|
1759
|
+
if getv(from_object, ['min_items']) is not None:
|
1760
|
+
setv(to_object, ['minItems'], getv(from_object, ['min_items']))
|
1702
1761
|
|
1703
|
-
|
1704
|
-
|
1705
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1706
|
-
) -> dict[str, Any]:
|
1707
|
-
to_object: dict[str, Any] = {}
|
1708
|
-
if getv(from_object, ['details']) is not None:
|
1709
|
-
setv(to_object, ['details'], getv(from_object, ['details']))
|
1762
|
+
if getv(from_object, ['min_length']) is not None:
|
1763
|
+
setv(to_object, ['minLength'], getv(from_object, ['min_length']))
|
1710
1764
|
|
1711
|
-
if getv(from_object, ['
|
1712
|
-
setv(to_object, ['
|
1765
|
+
if getv(from_object, ['min_properties']) is not None:
|
1766
|
+
setv(to_object, ['minProperties'], getv(from_object, ['min_properties']))
|
1713
1767
|
|
1714
|
-
if getv(from_object, ['
|
1715
|
-
setv(to_object, ['
|
1768
|
+
if getv(from_object, ['minimum']) is not None:
|
1769
|
+
setv(to_object, ['minimum'], getv(from_object, ['minimum']))
|
1716
1770
|
|
1717
|
-
|
1771
|
+
if getv(from_object, ['nullable']) is not None:
|
1772
|
+
setv(to_object, ['nullable'], getv(from_object, ['nullable']))
|
1718
1773
|
|
1774
|
+
if getv(from_object, ['pattern']) is not None:
|
1775
|
+
setv(to_object, ['pattern'], getv(from_object, ['pattern']))
|
1719
1776
|
|
1720
|
-
|
1721
|
-
|
1722
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1723
|
-
) -> dict[str, Any]:
|
1724
|
-
to_object: dict[str, Any] = {}
|
1725
|
-
if getv(from_object, ['response']) is not None:
|
1726
|
-
setv(
|
1727
|
-
to_object,
|
1728
|
-
['response'],
|
1729
|
-
_GenerateContentResponse_from_mldev(
|
1730
|
-
getv(from_object, ['response']), to_object
|
1731
|
-
),
|
1732
|
-
)
|
1777
|
+
if getv(from_object, ['properties']) is not None:
|
1778
|
+
setv(to_object, ['properties'], getv(from_object, ['properties']))
|
1733
1779
|
|
1734
|
-
if getv(from_object, ['
|
1780
|
+
if getv(from_object, ['property_ordering']) is not None:
|
1735
1781
|
setv(
|
1736
1782
|
to_object,
|
1737
|
-
['
|
1738
|
-
|
1783
|
+
['propertyOrdering'],
|
1784
|
+
getv(from_object, ['property_ordering']),
|
1739
1785
|
)
|
1740
1786
|
|
1741
|
-
|
1787
|
+
if getv(from_object, ['required']) is not None:
|
1788
|
+
setv(to_object, ['required'], getv(from_object, ['required']))
|
1742
1789
|
|
1790
|
+
if getv(from_object, ['title']) is not None:
|
1791
|
+
setv(to_object, ['title'], getv(from_object, ['title']))
|
1743
1792
|
|
1744
|
-
|
1745
|
-
|
1746
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1747
|
-
) -> dict[str, Any]:
|
1748
|
-
to_object: dict[str, Any] = {}
|
1749
|
-
if getv(from_object, ['values']) is not None:
|
1750
|
-
setv(to_object, ['values'], getv(from_object, ['values']))
|
1793
|
+
if getv(from_object, ['type']) is not None:
|
1794
|
+
setv(to_object, ['type'], getv(from_object, ['type']))
|
1751
1795
|
|
1752
1796
|
return to_object
|
1753
1797
|
|
@@ -1767,352 +1811,271 @@ def _SingleEmbedContentResponse_from_mldev(
|
|
1767
1811
|
)
|
1768
1812
|
|
1769
1813
|
if getv(from_object, ['tokenCount']) is not None:
|
1770
|
-
setv(to_object, ['token_count'], getv(from_object, ['tokenCount']))
|
1771
|
-
|
1772
|
-
return to_object
|
1773
|
-
|
1774
|
-
|
1775
|
-
def _InlinedEmbedContentResponse_from_mldev(
|
1776
|
-
from_object: Union[dict[str, Any], object],
|
1777
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1778
|
-
) -> dict[str, Any]:
|
1779
|
-
to_object: dict[str, Any] = {}
|
1780
|
-
if getv(from_object, ['response']) is not None:
|
1781
|
-
setv(
|
1782
|
-
to_object,
|
1783
|
-
['response'],
|
1784
|
-
_SingleEmbedContentResponse_from_mldev(
|
1785
|
-
getv(from_object, ['response']), to_object
|
1786
|
-
),
|
1787
|
-
)
|
1788
|
-
|
1789
|
-
if getv(from_object, ['error']) is not None:
|
1790
|
-
setv(
|
1791
|
-
to_object,
|
1792
|
-
['error'],
|
1793
|
-
_JobError_from_mldev(getv(from_object, ['error']), to_object),
|
1794
|
-
)
|
1795
|
-
|
1796
|
-
return to_object
|
1797
|
-
|
1798
|
-
|
1799
|
-
def _BatchJobDestination_from_mldev(
|
1800
|
-
from_object: Union[dict[str, Any], object],
|
1801
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1802
|
-
) -> dict[str, Any]:
|
1803
|
-
to_object: dict[str, Any] = {}
|
1804
|
-
|
1805
|
-
if getv(from_object, ['responsesFile']) is not None:
|
1806
|
-
setv(to_object, ['file_name'], getv(from_object, ['responsesFile']))
|
1807
|
-
|
1808
|
-
if getv(from_object, ['inlinedResponses', 'inlinedResponses']) is not None:
|
1809
|
-
setv(
|
1810
|
-
to_object,
|
1811
|
-
['inlined_responses'],
|
1812
|
-
[
|
1813
|
-
_InlinedResponse_from_mldev(item, to_object)
|
1814
|
-
for item in getv(
|
1815
|
-
from_object, ['inlinedResponses', 'inlinedResponses']
|
1816
|
-
)
|
1817
|
-
],
|
1818
|
-
)
|
1819
|
-
|
1820
|
-
if (
|
1821
|
-
getv(from_object, ['inlinedEmbedContentResponses', 'inlinedResponses'])
|
1822
|
-
is not None
|
1823
|
-
):
|
1824
|
-
setv(
|
1825
|
-
to_object,
|
1826
|
-
['inlined_embed_content_responses'],
|
1827
|
-
[
|
1828
|
-
_InlinedEmbedContentResponse_from_mldev(item, to_object)
|
1829
|
-
for item in getv(
|
1830
|
-
from_object,
|
1831
|
-
['inlinedEmbedContentResponses', 'inlinedResponses'],
|
1832
|
-
)
|
1833
|
-
],
|
1834
|
-
)
|
1835
|
-
|
1836
|
-
return to_object
|
1837
|
-
|
1838
|
-
|
1839
|
-
def _BatchJob_from_mldev(
|
1840
|
-
from_object: Union[dict[str, Any], object],
|
1841
|
-
parent_object: Optional[dict[str, Any]] = None,
|
1842
|
-
) -> dict[str, Any]:
|
1843
|
-
to_object: dict[str, Any] = {}
|
1844
|
-
if getv(from_object, ['name']) is not None:
|
1845
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1846
|
-
|
1847
|
-
if getv(from_object, ['metadata', 'displayName']) is not None:
|
1848
|
-
setv(
|
1849
|
-
to_object,
|
1850
|
-
['display_name'],
|
1851
|
-
getv(from_object, ['metadata', 'displayName']),
|
1852
|
-
)
|
1853
|
-
|
1854
|
-
if getv(from_object, ['metadata', 'state']) is not None:
|
1855
|
-
setv(
|
1856
|
-
to_object,
|
1857
|
-
['state'],
|
1858
|
-
t.t_job_state(getv(from_object, ['metadata', 'state'])),
|
1859
|
-
)
|
1860
|
-
|
1861
|
-
if getv(from_object, ['metadata', 'createTime']) is not None:
|
1862
|
-
setv(
|
1863
|
-
to_object,
|
1864
|
-
['create_time'],
|
1865
|
-
getv(from_object, ['metadata', 'createTime']),
|
1866
|
-
)
|
1867
|
-
|
1868
|
-
if getv(from_object, ['metadata', 'endTime']) is not None:
|
1869
|
-
setv(to_object, ['end_time'], getv(from_object, ['metadata', 'endTime']))
|
1870
|
-
|
1871
|
-
if getv(from_object, ['metadata', 'updateTime']) is not None:
|
1872
|
-
setv(
|
1873
|
-
to_object,
|
1874
|
-
['update_time'],
|
1875
|
-
getv(from_object, ['metadata', 'updateTime']),
|
1876
|
-
)
|
1877
|
-
|
1878
|
-
if getv(from_object, ['metadata', 'model']) is not None:
|
1879
|
-
setv(to_object, ['model'], getv(from_object, ['metadata', 'model']))
|
1880
|
-
|
1881
|
-
if getv(from_object, ['metadata', 'output']) is not None:
|
1882
|
-
setv(
|
1883
|
-
to_object,
|
1884
|
-
['dest'],
|
1885
|
-
_BatchJobDestination_from_mldev(
|
1886
|
-
t.t_recv_batch_job_destination(
|
1887
|
-
getv(from_object, ['metadata', 'output'])
|
1888
|
-
),
|
1889
|
-
to_object,
|
1890
|
-
),
|
1891
|
-
)
|
1814
|
+
setv(to_object, ['token_count'], getv(from_object, ['tokenCount']))
|
1892
1815
|
|
1893
1816
|
return to_object
|
1894
1817
|
|
1895
1818
|
|
1896
|
-
def
|
1819
|
+
def _SpeakerVoiceConfig_to_mldev(
|
1897
1820
|
from_object: Union[dict[str, Any], object],
|
1898
1821
|
parent_object: Optional[dict[str, Any]] = None,
|
1899
1822
|
) -> dict[str, Any]:
|
1900
1823
|
to_object: dict[str, Any] = {}
|
1901
|
-
if getv(from_object, ['
|
1902
|
-
setv(
|
1903
|
-
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
1904
|
-
)
|
1905
|
-
|
1906
|
-
if getv(from_object, ['nextPageToken']) is not None:
|
1907
|
-
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
1824
|
+
if getv(from_object, ['speaker']) is not None:
|
1825
|
+
setv(to_object, ['speaker'], getv(from_object, ['speaker']))
|
1908
1826
|
|
1909
|
-
if getv(from_object, ['
|
1827
|
+
if getv(from_object, ['voice_config']) is not None:
|
1910
1828
|
setv(
|
1911
1829
|
to_object,
|
1912
|
-
['
|
1913
|
-
[
|
1914
|
-
_BatchJob_from_mldev(item, to_object)
|
1915
|
-
for item in getv(from_object, ['operations'])
|
1916
|
-
],
|
1830
|
+
['voiceConfig'],
|
1831
|
+
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
1917
1832
|
)
|
1918
1833
|
|
1919
1834
|
return to_object
|
1920
1835
|
|
1921
1836
|
|
1922
|
-
def
|
1837
|
+
def _SpeechConfig_to_mldev(
|
1923
1838
|
from_object: Union[dict[str, Any], object],
|
1924
1839
|
parent_object: Optional[dict[str, Any]] = None,
|
1925
1840
|
) -> dict[str, Any]:
|
1926
1841
|
to_object: dict[str, Any] = {}
|
1927
|
-
if getv(from_object, ['
|
1842
|
+
if getv(from_object, ['voice_config']) is not None:
|
1928
1843
|
setv(
|
1929
|
-
to_object,
|
1844
|
+
to_object,
|
1845
|
+
['voiceConfig'],
|
1846
|
+
_VoiceConfig_to_mldev(getv(from_object, ['voice_config']), to_object),
|
1930
1847
|
)
|
1931
1848
|
|
1932
|
-
if getv(from_object, ['
|
1933
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
1934
|
-
|
1935
|
-
if getv(from_object, ['done']) is not None:
|
1936
|
-
setv(to_object, ['done'], getv(from_object, ['done']))
|
1937
|
-
|
1938
|
-
if getv(from_object, ['error']) is not None:
|
1849
|
+
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
1939
1850
|
setv(
|
1940
1851
|
to_object,
|
1941
|
-
['
|
1942
|
-
|
1852
|
+
['multiSpeakerVoiceConfig'],
|
1853
|
+
_MultiSpeakerVoiceConfig_to_mldev(
|
1854
|
+
getv(from_object, ['multi_speaker_voice_config']), to_object
|
1855
|
+
),
|
1943
1856
|
)
|
1944
1857
|
|
1858
|
+
if getv(from_object, ['language_code']) is not None:
|
1859
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
1860
|
+
|
1945
1861
|
return to_object
|
1946
1862
|
|
1947
1863
|
|
1948
|
-
def
|
1864
|
+
def _ThinkingConfig_to_mldev(
|
1949
1865
|
from_object: Union[dict[str, Any], object],
|
1950
1866
|
parent_object: Optional[dict[str, Any]] = None,
|
1951
1867
|
) -> dict[str, Any]:
|
1952
1868
|
to_object: dict[str, Any] = {}
|
1953
|
-
if getv(from_object, ['
|
1954
|
-
setv(
|
1955
|
-
|
1956
|
-
|
1957
|
-
setv(to_object, ['code'], getv(from_object, ['code']))
|
1869
|
+
if getv(from_object, ['include_thoughts']) is not None:
|
1870
|
+
setv(
|
1871
|
+
to_object, ['includeThoughts'], getv(from_object, ['include_thoughts'])
|
1872
|
+
)
|
1958
1873
|
|
1959
|
-
if getv(from_object, ['
|
1960
|
-
setv(to_object, ['
|
1874
|
+
if getv(from_object, ['thinking_budget']) is not None:
|
1875
|
+
setv(to_object, ['thinkingBudget'], getv(from_object, ['thinking_budget']))
|
1961
1876
|
|
1962
1877
|
return to_object
|
1963
1878
|
|
1964
1879
|
|
1965
|
-
def
|
1880
|
+
def _ToolComputerUse_to_mldev(
|
1966
1881
|
from_object: Union[dict[str, Any], object],
|
1967
1882
|
parent_object: Optional[dict[str, Any]] = None,
|
1968
1883
|
) -> dict[str, Any]:
|
1969
1884
|
to_object: dict[str, Any] = {}
|
1970
|
-
if getv(from_object, ['
|
1971
|
-
setv(to_object, ['
|
1972
|
-
|
1973
|
-
if getv(from_object, ['gcsSource', 'uris']) is not None:
|
1974
|
-
setv(to_object, ['gcs_uri'], getv(from_object, ['gcsSource', 'uris']))
|
1885
|
+
if getv(from_object, ['environment']) is not None:
|
1886
|
+
setv(to_object, ['environment'], getv(from_object, ['environment']))
|
1975
1887
|
|
1976
|
-
if getv(from_object, ['
|
1888
|
+
if getv(from_object, ['excluded_predefined_functions']) is not None:
|
1977
1889
|
setv(
|
1978
1890
|
to_object,
|
1979
|
-
['
|
1980
|
-
getv(from_object, ['
|
1891
|
+
['excludedPredefinedFunctions'],
|
1892
|
+
getv(from_object, ['excluded_predefined_functions']),
|
1981
1893
|
)
|
1982
1894
|
|
1983
1895
|
return to_object
|
1984
1896
|
|
1985
1897
|
|
1986
|
-
def
|
1898
|
+
def _ToolConfig_to_mldev(
|
1987
1899
|
from_object: Union[dict[str, Any], object],
|
1988
1900
|
parent_object: Optional[dict[str, Any]] = None,
|
1989
1901
|
) -> dict[str, Any]:
|
1990
1902
|
to_object: dict[str, Any] = {}
|
1991
|
-
if getv(from_object, ['
|
1992
|
-
setv(to_object, ['format'], getv(from_object, ['predictionsFormat']))
|
1993
|
-
|
1994
|
-
if getv(from_object, ['gcsDestination', 'outputUriPrefix']) is not None:
|
1903
|
+
if getv(from_object, ['function_calling_config']) is not None:
|
1995
1904
|
setv(
|
1996
1905
|
to_object,
|
1997
|
-
['
|
1998
|
-
|
1906
|
+
['functionCallingConfig'],
|
1907
|
+
_FunctionCallingConfig_to_mldev(
|
1908
|
+
getv(from_object, ['function_calling_config']), to_object
|
1909
|
+
),
|
1999
1910
|
)
|
2000
1911
|
|
2001
|
-
if getv(from_object, ['
|
1912
|
+
if getv(from_object, ['retrieval_config']) is not None:
|
2002
1913
|
setv(
|
2003
1914
|
to_object,
|
2004
|
-
['
|
2005
|
-
|
1915
|
+
['retrievalConfig'],
|
1916
|
+
_RetrievalConfig_to_mldev(
|
1917
|
+
getv(from_object, ['retrieval_config']), to_object
|
1918
|
+
),
|
2006
1919
|
)
|
2007
1920
|
|
2008
1921
|
return to_object
|
2009
1922
|
|
2010
1923
|
|
2011
|
-
def
|
1924
|
+
def _Tool_to_mldev(
|
2012
1925
|
from_object: Union[dict[str, Any], object],
|
2013
1926
|
parent_object: Optional[dict[str, Any]] = None,
|
2014
1927
|
) -> dict[str, Any]:
|
2015
1928
|
to_object: dict[str, Any] = {}
|
2016
|
-
if getv(from_object, ['
|
2017
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
2018
|
-
|
2019
|
-
if getv(from_object, ['displayName']) is not None:
|
2020
|
-
setv(to_object, ['display_name'], getv(from_object, ['displayName']))
|
2021
|
-
|
2022
|
-
if getv(from_object, ['state']) is not None:
|
2023
|
-
setv(to_object, ['state'], t.t_job_state(getv(from_object, ['state'])))
|
2024
|
-
|
2025
|
-
if getv(from_object, ['error']) is not None:
|
1929
|
+
if getv(from_object, ['function_declarations']) is not None:
|
2026
1930
|
setv(
|
2027
1931
|
to_object,
|
2028
|
-
['
|
2029
|
-
|
1932
|
+
['functionDeclarations'],
|
1933
|
+
[
|
1934
|
+
_FunctionDeclaration_to_mldev(item, to_object)
|
1935
|
+
for item in getv(from_object, ['function_declarations'])
|
1936
|
+
],
|
2030
1937
|
)
|
2031
1938
|
|
2032
|
-
if getv(from_object, ['
|
2033
|
-
|
1939
|
+
if getv(from_object, ['retrieval']) is not None:
|
1940
|
+
raise ValueError('retrieval parameter is not supported in Gemini API.')
|
2034
1941
|
|
2035
|
-
if getv(from_object, ['
|
2036
|
-
setv(
|
1942
|
+
if getv(from_object, ['google_search']) is not None:
|
1943
|
+
setv(
|
1944
|
+
to_object,
|
1945
|
+
['googleSearch'],
|
1946
|
+
_GoogleSearch_to_mldev(getv(from_object, ['google_search']), to_object),
|
1947
|
+
)
|
2037
1948
|
|
2038
|
-
if getv(from_object, ['
|
2039
|
-
setv(
|
1949
|
+
if getv(from_object, ['google_search_retrieval']) is not None:
|
1950
|
+
setv(
|
1951
|
+
to_object,
|
1952
|
+
['googleSearchRetrieval'],
|
1953
|
+
_GoogleSearchRetrieval_to_mldev(
|
1954
|
+
getv(from_object, ['google_search_retrieval']), to_object
|
1955
|
+
),
|
1956
|
+
)
|
2040
1957
|
|
2041
|
-
if getv(from_object, ['
|
2042
|
-
|
1958
|
+
if getv(from_object, ['enterprise_web_search']) is not None:
|
1959
|
+
raise ValueError(
|
1960
|
+
'enterprise_web_search parameter is not supported in Gemini API.'
|
1961
|
+
)
|
2043
1962
|
|
2044
|
-
if getv(from_object, ['
|
2045
|
-
|
1963
|
+
if getv(from_object, ['google_maps']) is not None:
|
1964
|
+
raise ValueError('google_maps parameter is not supported in Gemini API.')
|
2046
1965
|
|
2047
|
-
if getv(from_object, ['
|
1966
|
+
if getv(from_object, ['url_context']) is not None:
|
2048
1967
|
setv(
|
2049
1968
|
to_object,
|
2050
|
-
['
|
2051
|
-
|
2052
|
-
getv(from_object, ['inputConfig']), to_object
|
2053
|
-
),
|
1969
|
+
['urlContext'],
|
1970
|
+
_UrlContext_to_mldev(getv(from_object, ['url_context']), to_object),
|
2054
1971
|
)
|
2055
1972
|
|
2056
|
-
if getv(from_object, ['
|
1973
|
+
if getv(from_object, ['computer_use']) is not None:
|
2057
1974
|
setv(
|
2058
1975
|
to_object,
|
2059
|
-
['
|
2060
|
-
|
2061
|
-
|
2062
|
-
to_object,
|
1976
|
+
['computerUse'],
|
1977
|
+
_ToolComputerUse_to_mldev(
|
1978
|
+
getv(from_object, ['computer_use']), to_object
|
2063
1979
|
),
|
2064
1980
|
)
|
2065
1981
|
|
1982
|
+
if getv(from_object, ['code_execution']) is not None:
|
1983
|
+
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
1984
|
+
|
2066
1985
|
return to_object
|
2067
1986
|
|
2068
1987
|
|
2069
|
-
def
|
1988
|
+
def _UrlContextMetadata_from_mldev(
|
2070
1989
|
from_object: Union[dict[str, Any], object],
|
2071
1990
|
parent_object: Optional[dict[str, Any]] = None,
|
2072
1991
|
) -> dict[str, Any]:
|
2073
1992
|
to_object: dict[str, Any] = {}
|
2074
|
-
if getv(from_object, ['
|
2075
|
-
setv(
|
2076
|
-
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
2077
|
-
)
|
2078
|
-
|
2079
|
-
if getv(from_object, ['nextPageToken']) is not None:
|
2080
|
-
setv(to_object, ['next_page_token'], getv(from_object, ['nextPageToken']))
|
2081
|
-
|
2082
|
-
if getv(from_object, ['batchPredictionJobs']) is not None:
|
1993
|
+
if getv(from_object, ['urlMetadata']) is not None:
|
2083
1994
|
setv(
|
2084
1995
|
to_object,
|
2085
|
-
['
|
1996
|
+
['url_metadata'],
|
2086
1997
|
[
|
2087
|
-
|
2088
|
-
for item in getv(from_object, ['
|
1998
|
+
_UrlMetadata_from_mldev(item, to_object)
|
1999
|
+
for item in getv(from_object, ['urlMetadata'])
|
2089
2000
|
],
|
2090
2001
|
)
|
2091
2002
|
|
2092
2003
|
return to_object
|
2093
2004
|
|
2094
2005
|
|
2095
|
-
def
|
2006
|
+
def _UrlContext_to_mldev(
|
2096
2007
|
from_object: Union[dict[str, Any], object],
|
2097
2008
|
parent_object: Optional[dict[str, Any]] = None,
|
2098
2009
|
) -> dict[str, Any]:
|
2099
2010
|
to_object: dict[str, Any] = {}
|
2100
|
-
|
2011
|
+
|
2012
|
+
return to_object
|
2013
|
+
|
2014
|
+
|
2015
|
+
def _UrlMetadata_from_mldev(
|
2016
|
+
from_object: Union[dict[str, Any], object],
|
2017
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2018
|
+
) -> dict[str, Any]:
|
2019
|
+
to_object: dict[str, Any] = {}
|
2020
|
+
if getv(from_object, ['retrievedUrl']) is not None:
|
2021
|
+
setv(to_object, ['retrieved_url'], getv(from_object, ['retrievedUrl']))
|
2022
|
+
|
2023
|
+
if getv(from_object, ['urlRetrievalStatus']) is not None:
|
2101
2024
|
setv(
|
2102
|
-
to_object,
|
2025
|
+
to_object,
|
2026
|
+
['url_retrieval_status'],
|
2027
|
+
getv(from_object, ['urlRetrievalStatus']),
|
2103
2028
|
)
|
2104
2029
|
|
2105
|
-
|
2106
|
-
setv(to_object, ['name'], getv(from_object, ['name']))
|
2030
|
+
return to_object
|
2107
2031
|
|
2108
|
-
if getv(from_object, ['done']) is not None:
|
2109
|
-
setv(to_object, ['done'], getv(from_object, ['done']))
|
2110
2032
|
|
2111
|
-
|
2033
|
+
def _VideoMetadata_from_mldev(
|
2034
|
+
from_object: Union[dict[str, Any], object],
|
2035
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2036
|
+
) -> dict[str, Any]:
|
2037
|
+
to_object: dict[str, Any] = {}
|
2038
|
+
if getv(from_object, ['fps']) is not None:
|
2039
|
+
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
2040
|
+
|
2041
|
+
if getv(from_object, ['endOffset']) is not None:
|
2042
|
+
setv(to_object, ['end_offset'], getv(from_object, ['endOffset']))
|
2043
|
+
|
2044
|
+
if getv(from_object, ['startOffset']) is not None:
|
2045
|
+
setv(to_object, ['start_offset'], getv(from_object, ['startOffset']))
|
2046
|
+
|
2047
|
+
return to_object
|
2048
|
+
|
2049
|
+
|
2050
|
+
def _VideoMetadata_to_mldev(
|
2051
|
+
from_object: Union[dict[str, Any], object],
|
2052
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2053
|
+
) -> dict[str, Any]:
|
2054
|
+
to_object: dict[str, Any] = {}
|
2055
|
+
if getv(from_object, ['fps']) is not None:
|
2056
|
+
setv(to_object, ['fps'], getv(from_object, ['fps']))
|
2057
|
+
|
2058
|
+
if getv(from_object, ['end_offset']) is not None:
|
2059
|
+
setv(to_object, ['endOffset'], getv(from_object, ['end_offset']))
|
2060
|
+
|
2061
|
+
if getv(from_object, ['start_offset']) is not None:
|
2062
|
+
setv(to_object, ['startOffset'], getv(from_object, ['start_offset']))
|
2063
|
+
|
2064
|
+
return to_object
|
2065
|
+
|
2066
|
+
|
2067
|
+
def _VoiceConfig_to_mldev(
|
2068
|
+
from_object: Union[dict[str, Any], object],
|
2069
|
+
parent_object: Optional[dict[str, Any]] = None,
|
2070
|
+
) -> dict[str, Any]:
|
2071
|
+
to_object: dict[str, Any] = {}
|
2072
|
+
if getv(from_object, ['prebuilt_voice_config']) is not None:
|
2112
2073
|
setv(
|
2113
2074
|
to_object,
|
2114
|
-
['
|
2115
|
-
|
2075
|
+
['prebuiltVoiceConfig'],
|
2076
|
+
_PrebuiltVoiceConfig_to_mldev(
|
2077
|
+
getv(from_object, ['prebuilt_voice_config']), to_object
|
2078
|
+
),
|
2116
2079
|
)
|
2117
2080
|
|
2118
2081
|
return to_object
|