@google/genai 1.17.0 → 1.19.0
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.
- package/dist/genai.d.ts +131 -5
- package/dist/index.cjs +965 -293
- package/dist/index.mjs +964 -294
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +965 -293
- package/dist/node/index.mjs +964 -294
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +131 -5
- package/dist/web/index.mjs +964 -294
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +131 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -117,7 +117,16 @@ function setValueByPath(data, keys, value) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
else {
|
|
120
|
-
|
|
120
|
+
if (keyToSet === '_self' &&
|
|
121
|
+
typeof value === 'object' &&
|
|
122
|
+
value !== null &&
|
|
123
|
+
!Array.isArray(value)) {
|
|
124
|
+
const valueAsRecord = value;
|
|
125
|
+
Object.assign(data, valueAsRecord);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
data[keyToSet] = value;
|
|
129
|
+
}
|
|
121
130
|
}
|
|
122
131
|
}
|
|
123
132
|
function getValueByPath(data, keys) {
|
|
@@ -176,6 +185,216 @@ function tBytes$1(fromBytes) {
|
|
|
176
185
|
* SPDX-License-Identifier: Apache-2.0
|
|
177
186
|
*/
|
|
178
187
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
188
|
+
function getOperationParametersToMldev(fromObject) {
|
|
189
|
+
const toObject = {};
|
|
190
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
191
|
+
'operationName',
|
|
192
|
+
]);
|
|
193
|
+
if (fromOperationName != null) {
|
|
194
|
+
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
195
|
+
}
|
|
196
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
197
|
+
if (fromConfig != null) {
|
|
198
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
199
|
+
}
|
|
200
|
+
return toObject;
|
|
201
|
+
}
|
|
202
|
+
function fetchPredictOperationParametersToVertex(fromObject) {
|
|
203
|
+
const toObject = {};
|
|
204
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
205
|
+
'operationName',
|
|
206
|
+
]);
|
|
207
|
+
if (fromOperationName != null) {
|
|
208
|
+
setValueByPath(toObject, ['operationName'], fromOperationName);
|
|
209
|
+
}
|
|
210
|
+
const fromResourceName = getValueByPath(fromObject, ['resourceName']);
|
|
211
|
+
if (fromResourceName != null) {
|
|
212
|
+
setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
|
|
213
|
+
}
|
|
214
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
215
|
+
if (fromConfig != null) {
|
|
216
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
217
|
+
}
|
|
218
|
+
return toObject;
|
|
219
|
+
}
|
|
220
|
+
function getOperationParametersToVertex(fromObject) {
|
|
221
|
+
const toObject = {};
|
|
222
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
223
|
+
'operationName',
|
|
224
|
+
]);
|
|
225
|
+
if (fromOperationName != null) {
|
|
226
|
+
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
227
|
+
}
|
|
228
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
229
|
+
if (fromConfig != null) {
|
|
230
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
231
|
+
}
|
|
232
|
+
return toObject;
|
|
233
|
+
}
|
|
234
|
+
function videoFromMldev$1(fromObject) {
|
|
235
|
+
const toObject = {};
|
|
236
|
+
const fromUri = getValueByPath(fromObject, ['video', 'uri']);
|
|
237
|
+
if (fromUri != null) {
|
|
238
|
+
setValueByPath(toObject, ['uri'], fromUri);
|
|
239
|
+
}
|
|
240
|
+
const fromVideoBytes = getValueByPath(fromObject, [
|
|
241
|
+
'video',
|
|
242
|
+
'encodedVideo',
|
|
243
|
+
]);
|
|
244
|
+
if (fromVideoBytes != null) {
|
|
245
|
+
setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
|
|
246
|
+
}
|
|
247
|
+
const fromMimeType = getValueByPath(fromObject, ['encoding']);
|
|
248
|
+
if (fromMimeType != null) {
|
|
249
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
250
|
+
}
|
|
251
|
+
return toObject;
|
|
252
|
+
}
|
|
253
|
+
function generatedVideoFromMldev$1(fromObject) {
|
|
254
|
+
const toObject = {};
|
|
255
|
+
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
256
|
+
if (fromVideo != null) {
|
|
257
|
+
setValueByPath(toObject, ['video'], videoFromMldev$1(fromVideo));
|
|
258
|
+
}
|
|
259
|
+
return toObject;
|
|
260
|
+
}
|
|
261
|
+
function generateVideosResponseFromMldev$1(fromObject) {
|
|
262
|
+
const toObject = {};
|
|
263
|
+
const fromGeneratedVideos = getValueByPath(fromObject, [
|
|
264
|
+
'generatedSamples',
|
|
265
|
+
]);
|
|
266
|
+
if (fromGeneratedVideos != null) {
|
|
267
|
+
let transformedList = fromGeneratedVideos;
|
|
268
|
+
if (Array.isArray(transformedList)) {
|
|
269
|
+
transformedList = transformedList.map((item) => {
|
|
270
|
+
return generatedVideoFromMldev$1(item);
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
274
|
+
}
|
|
275
|
+
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
276
|
+
'raiMediaFilteredCount',
|
|
277
|
+
]);
|
|
278
|
+
if (fromRaiMediaFilteredCount != null) {
|
|
279
|
+
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
280
|
+
}
|
|
281
|
+
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
282
|
+
'raiMediaFilteredReasons',
|
|
283
|
+
]);
|
|
284
|
+
if (fromRaiMediaFilteredReasons != null) {
|
|
285
|
+
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
286
|
+
}
|
|
287
|
+
return toObject;
|
|
288
|
+
}
|
|
289
|
+
function generateVideosOperationFromMldev$1(fromObject) {
|
|
290
|
+
const toObject = {};
|
|
291
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
292
|
+
if (fromName != null) {
|
|
293
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
294
|
+
}
|
|
295
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
296
|
+
if (fromMetadata != null) {
|
|
297
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
298
|
+
}
|
|
299
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
300
|
+
if (fromDone != null) {
|
|
301
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
302
|
+
}
|
|
303
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
304
|
+
if (fromError != null) {
|
|
305
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
306
|
+
}
|
|
307
|
+
const fromResponse = getValueByPath(fromObject, [
|
|
308
|
+
'response',
|
|
309
|
+
'generateVideoResponse',
|
|
310
|
+
]);
|
|
311
|
+
if (fromResponse != null) {
|
|
312
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(fromResponse));
|
|
313
|
+
}
|
|
314
|
+
return toObject;
|
|
315
|
+
}
|
|
316
|
+
function videoFromVertex$1(fromObject) {
|
|
317
|
+
const toObject = {};
|
|
318
|
+
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
319
|
+
if (fromUri != null) {
|
|
320
|
+
setValueByPath(toObject, ['uri'], fromUri);
|
|
321
|
+
}
|
|
322
|
+
const fromVideoBytes = getValueByPath(fromObject, [
|
|
323
|
+
'bytesBase64Encoded',
|
|
324
|
+
]);
|
|
325
|
+
if (fromVideoBytes != null) {
|
|
326
|
+
setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
|
|
327
|
+
}
|
|
328
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
329
|
+
if (fromMimeType != null) {
|
|
330
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
331
|
+
}
|
|
332
|
+
return toObject;
|
|
333
|
+
}
|
|
334
|
+
function generatedVideoFromVertex$1(fromObject) {
|
|
335
|
+
const toObject = {};
|
|
336
|
+
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
337
|
+
if (fromVideo != null) {
|
|
338
|
+
setValueByPath(toObject, ['video'], videoFromVertex$1(fromVideo));
|
|
339
|
+
}
|
|
340
|
+
return toObject;
|
|
341
|
+
}
|
|
342
|
+
function generateVideosResponseFromVertex$1(fromObject) {
|
|
343
|
+
const toObject = {};
|
|
344
|
+
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
345
|
+
if (fromGeneratedVideos != null) {
|
|
346
|
+
let transformedList = fromGeneratedVideos;
|
|
347
|
+
if (Array.isArray(transformedList)) {
|
|
348
|
+
transformedList = transformedList.map((item) => {
|
|
349
|
+
return generatedVideoFromVertex$1(item);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
353
|
+
}
|
|
354
|
+
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
355
|
+
'raiMediaFilteredCount',
|
|
356
|
+
]);
|
|
357
|
+
if (fromRaiMediaFilteredCount != null) {
|
|
358
|
+
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
359
|
+
}
|
|
360
|
+
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
361
|
+
'raiMediaFilteredReasons',
|
|
362
|
+
]);
|
|
363
|
+
if (fromRaiMediaFilteredReasons != null) {
|
|
364
|
+
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
365
|
+
}
|
|
366
|
+
return toObject;
|
|
367
|
+
}
|
|
368
|
+
function generateVideosOperationFromVertex$1(fromObject) {
|
|
369
|
+
const toObject = {};
|
|
370
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
371
|
+
if (fromName != null) {
|
|
372
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
373
|
+
}
|
|
374
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
375
|
+
if (fromMetadata != null) {
|
|
376
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
377
|
+
}
|
|
378
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
379
|
+
if (fromDone != null) {
|
|
380
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
381
|
+
}
|
|
382
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
383
|
+
if (fromError != null) {
|
|
384
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
385
|
+
}
|
|
386
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
387
|
+
if (fromResponse != null) {
|
|
388
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(fromResponse));
|
|
389
|
+
}
|
|
390
|
+
return toObject;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* @license
|
|
395
|
+
* Copyright 2025 Google LLC
|
|
396
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
397
|
+
*/
|
|
179
398
|
/** Required. Outcome of the code execution. */
|
|
180
399
|
exports.Outcome = void 0;
|
|
181
400
|
(function (Outcome) {
|
|
@@ -1567,54 +1786,15 @@ class GenerateVideosOperation {
|
|
|
1567
1786
|
*/
|
|
1568
1787
|
_fromAPIResponse({ apiResponse, isVertexAI, }) {
|
|
1569
1788
|
const operation = new GenerateVideosOperation();
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
operation.done = apiResponse['done'];
|
|
1573
|
-
operation.error = apiResponse['error'];
|
|
1789
|
+
let response;
|
|
1790
|
+
const op = apiResponse;
|
|
1574
1791
|
if (isVertexAI) {
|
|
1575
|
-
|
|
1576
|
-
if (response) {
|
|
1577
|
-
const operationResponse = new GenerateVideosResponse();
|
|
1578
|
-
const responseVideos = response['videos'];
|
|
1579
|
-
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1580
|
-
return {
|
|
1581
|
-
video: {
|
|
1582
|
-
uri: generatedVideo['gcsUri'],
|
|
1583
|
-
videoBytes: generatedVideo['bytesBase64Encoded']
|
|
1584
|
-
? tBytes$1(generatedVideo['bytesBase64Encoded'])
|
|
1585
|
-
: undefined,
|
|
1586
|
-
mimeType: generatedVideo['mimeType'],
|
|
1587
|
-
},
|
|
1588
|
-
};
|
|
1589
|
-
});
|
|
1590
|
-
operationResponse.raiMediaFilteredCount = response['raiMediaFilteredCount'];
|
|
1591
|
-
operationResponse.raiMediaFilteredReasons = response['raiMediaFilteredReasons'];
|
|
1592
|
-
operation.response = operationResponse;
|
|
1593
|
-
}
|
|
1792
|
+
response = generateVideosOperationFromVertex$1(op);
|
|
1594
1793
|
}
|
|
1595
1794
|
else {
|
|
1596
|
-
|
|
1597
|
-
if (response) {
|
|
1598
|
-
const operationResponse = new GenerateVideosResponse();
|
|
1599
|
-
const generatedVideoResponse = response['generateVideoResponse'];
|
|
1600
|
-
const responseVideos = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['generatedSamples'];
|
|
1601
|
-
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1602
|
-
const video = generatedVideo['video'];
|
|
1603
|
-
return {
|
|
1604
|
-
video: {
|
|
1605
|
-
uri: video === null || video === void 0 ? void 0 : video['uri'],
|
|
1606
|
-
videoBytes: (video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1607
|
-
? tBytes$1(video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1608
|
-
: undefined,
|
|
1609
|
-
mimeType: generatedVideo['encoding'],
|
|
1610
|
-
},
|
|
1611
|
-
};
|
|
1612
|
-
});
|
|
1613
|
-
operationResponse.raiMediaFilteredCount = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredCount'];
|
|
1614
|
-
operationResponse.raiMediaFilteredReasons = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredReasons'];
|
|
1615
|
-
operation.response = operationResponse;
|
|
1616
|
-
}
|
|
1795
|
+
response = generateVideosOperationFromMldev$1(op);
|
|
1617
1796
|
}
|
|
1797
|
+
Object.assign(operation, response);
|
|
1618
1798
|
return operation;
|
|
1619
1799
|
}
|
|
1620
1800
|
}
|
|
@@ -1638,6 +1818,12 @@ class DeleteFileResponse {
|
|
|
1638
1818
|
/** Config for `inlined_responses` parameter. */
|
|
1639
1819
|
class InlinedResponse {
|
|
1640
1820
|
}
|
|
1821
|
+
/** Config for `response` parameter. */
|
|
1822
|
+
class SingleEmbedContentResponse {
|
|
1823
|
+
}
|
|
1824
|
+
/** Config for `inlined_embedding_responses` parameter. */
|
|
1825
|
+
class InlinedEmbedContentResponse {
|
|
1826
|
+
}
|
|
1641
1827
|
/** Config for batches.list return value. */
|
|
1642
1828
|
class ListBatchJobsResponse {
|
|
1643
1829
|
}
|
|
@@ -2489,51 +2675,59 @@ function mcpToolsToGeminiTool(mcpTools, config = {}) {
|
|
|
2489
2675
|
return { functionDeclarations: functionDeclarations };
|
|
2490
2676
|
}
|
|
2491
2677
|
// Transforms a source input into a BatchJobSource object with validation.
|
|
2492
|
-
function tBatchJobSource(
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2678
|
+
function tBatchJobSource(client, src) {
|
|
2679
|
+
let sourceObj;
|
|
2680
|
+
if (typeof src === 'string') {
|
|
2681
|
+
if (client.isVertexAI()) {
|
|
2682
|
+
if (src.startsWith('gs://')) {
|
|
2683
|
+
sourceObj = { format: 'jsonl', gcsUri: [src] };
|
|
2684
|
+
}
|
|
2685
|
+
else if (src.startsWith('bq://')) {
|
|
2686
|
+
sourceObj = { format: 'bigquery', bigqueryUri: src };
|
|
2497
2687
|
}
|
|
2498
|
-
else
|
|
2499
|
-
throw new Error(
|
|
2688
|
+
else {
|
|
2689
|
+
throw new Error(`Unsupported string source for Vertex AI: ${src}`);
|
|
2500
2690
|
}
|
|
2501
2691
|
}
|
|
2502
2692
|
else {
|
|
2503
|
-
//
|
|
2504
|
-
if (src.
|
|
2505
|
-
|
|
2693
|
+
// MLDEV
|
|
2694
|
+
if (src.startsWith('files/')) {
|
|
2695
|
+
sourceObj = { fileName: src }; // Default to fileName for string input
|
|
2506
2696
|
}
|
|
2507
|
-
else
|
|
2508
|
-
throw new Error(
|
|
2697
|
+
else {
|
|
2698
|
+
throw new Error(`Unsupported string source for Gemini API: ${src}`);
|
|
2509
2699
|
}
|
|
2510
2700
|
}
|
|
2511
|
-
return src;
|
|
2512
2701
|
}
|
|
2513
|
-
// If src is an array (list in Python)
|
|
2514
2702
|
else if (Array.isArray(src)) {
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
else if (typeof src === 'string') {
|
|
2518
|
-
if (src.startsWith('gs://')) {
|
|
2519
|
-
return {
|
|
2520
|
-
format: 'jsonl',
|
|
2521
|
-
gcsUri: [src], // GCS URI is expected as an array
|
|
2522
|
-
};
|
|
2703
|
+
if (client.isVertexAI()) {
|
|
2704
|
+
throw new Error('InlinedRequest[] is not supported in Vertex AI.');
|
|
2523
2705
|
}
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2706
|
+
sourceObj = { inlinedRequests: src };
|
|
2707
|
+
}
|
|
2708
|
+
else {
|
|
2709
|
+
// It's already a BatchJobSource object
|
|
2710
|
+
sourceObj = src;
|
|
2711
|
+
}
|
|
2712
|
+
// Validation logic
|
|
2713
|
+
const vertexSourcesCount = [sourceObj.gcsUri, sourceObj.bigqueryUri].filter(Boolean).length;
|
|
2714
|
+
const mldevSourcesCount = [
|
|
2715
|
+
sourceObj.inlinedRequests,
|
|
2716
|
+
sourceObj.fileName,
|
|
2717
|
+
].filter(Boolean).length;
|
|
2718
|
+
if (client.isVertexAI()) {
|
|
2719
|
+
if (mldevSourcesCount > 0 || vertexSourcesCount !== 1) {
|
|
2720
|
+
throw new Error('Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.');
|
|
2529
2721
|
}
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2722
|
+
}
|
|
2723
|
+
else {
|
|
2724
|
+
// MLDEV
|
|
2725
|
+
if (vertexSourcesCount > 0 || mldevSourcesCount !== 1) {
|
|
2726
|
+
throw new Error('Exactly one of `inlinedRequests`, `fileName`, ' +
|
|
2727
|
+
'must be set for Gemini API.');
|
|
2534
2728
|
}
|
|
2535
2729
|
}
|
|
2536
|
-
|
|
2730
|
+
return sourceObj;
|
|
2537
2731
|
}
|
|
2538
2732
|
function tBatchJobDestination(dest) {
|
|
2539
2733
|
if (typeof dest !== 'string') {
|
|
@@ -2556,6 +2750,52 @@ function tBatchJobDestination(dest) {
|
|
|
2556
2750
|
throw new Error(`Unsupported destination: ${destString}`);
|
|
2557
2751
|
}
|
|
2558
2752
|
}
|
|
2753
|
+
function tRecvBatchJobDestination(dest) {
|
|
2754
|
+
// Ensure dest is a non-null object before proceeding.
|
|
2755
|
+
if (typeof dest !== 'object' || dest === null) {
|
|
2756
|
+
// If the input is not an object, it cannot be a valid BatchJobDestination
|
|
2757
|
+
// based on the operations performed. Return it cast, or handle as an error.
|
|
2758
|
+
// Casting an empty object might be a safe default.
|
|
2759
|
+
return {};
|
|
2760
|
+
}
|
|
2761
|
+
// Cast to Record<string, unknown> to allow string property access.
|
|
2762
|
+
const obj = dest;
|
|
2763
|
+
// Safely access nested properties.
|
|
2764
|
+
const inlineResponsesVal = obj['inlinedResponses'];
|
|
2765
|
+
if (typeof inlineResponsesVal !== 'object' || inlineResponsesVal === null) {
|
|
2766
|
+
return dest;
|
|
2767
|
+
}
|
|
2768
|
+
const inlineResponsesObj = inlineResponsesVal;
|
|
2769
|
+
const responsesArray = inlineResponsesObj['inlinedResponses'];
|
|
2770
|
+
if (!Array.isArray(responsesArray) || responsesArray.length === 0) {
|
|
2771
|
+
return dest;
|
|
2772
|
+
}
|
|
2773
|
+
// Check if any response has the 'embedding' property.
|
|
2774
|
+
let hasEmbedding = false;
|
|
2775
|
+
for (const responseItem of responsesArray) {
|
|
2776
|
+
if (typeof responseItem !== 'object' || responseItem === null) {
|
|
2777
|
+
continue;
|
|
2778
|
+
}
|
|
2779
|
+
const responseItemObj = responseItem;
|
|
2780
|
+
const responseVal = responseItemObj['response'];
|
|
2781
|
+
if (typeof responseVal !== 'object' || responseVal === null) {
|
|
2782
|
+
continue;
|
|
2783
|
+
}
|
|
2784
|
+
const responseObj = responseVal;
|
|
2785
|
+
// Check for the existence of the 'embedding' key.
|
|
2786
|
+
if (responseObj['embedding'] !== undefined) {
|
|
2787
|
+
hasEmbedding = true;
|
|
2788
|
+
break;
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
// Perform the transformation if an embedding was found.
|
|
2792
|
+
if (hasEmbedding) {
|
|
2793
|
+
obj['inlinedEmbedContentResponses'] = obj['inlinedResponses'];
|
|
2794
|
+
delete obj['inlinedResponses'];
|
|
2795
|
+
}
|
|
2796
|
+
// Cast the (potentially) modified object to the target type.
|
|
2797
|
+
return dest;
|
|
2798
|
+
}
|
|
2559
2799
|
function tBatchJobName(apiClient, name) {
|
|
2560
2800
|
const nameString = name;
|
|
2561
2801
|
if (!apiClient.isVertexAI()) {
|
|
@@ -2651,6 +2891,22 @@ function fileDataToMldev$4(fromObject) {
|
|
|
2651
2891
|
}
|
|
2652
2892
|
return toObject;
|
|
2653
2893
|
}
|
|
2894
|
+
function functionCallToMldev$4(fromObject) {
|
|
2895
|
+
const toObject = {};
|
|
2896
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
2897
|
+
if (fromId != null) {
|
|
2898
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
2899
|
+
}
|
|
2900
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
2901
|
+
if (fromArgs != null) {
|
|
2902
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
2903
|
+
}
|
|
2904
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
2905
|
+
if (fromName != null) {
|
|
2906
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
2907
|
+
}
|
|
2908
|
+
return toObject;
|
|
2909
|
+
}
|
|
2654
2910
|
function partToMldev$4(fromObject) {
|
|
2655
2911
|
const toObject = {};
|
|
2656
2912
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -2677,6 +2933,10 @@ function partToMldev$4(fromObject) {
|
|
|
2677
2933
|
if (fromThoughtSignature != null) {
|
|
2678
2934
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2679
2935
|
}
|
|
2936
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2937
|
+
if (fromFunctionCall != null) {
|
|
2938
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
|
|
2939
|
+
}
|
|
2680
2940
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2681
2941
|
'codeExecutionResult',
|
|
2682
2942
|
]);
|
|
@@ -2689,10 +2949,6 @@ function partToMldev$4(fromObject) {
|
|
|
2689
2949
|
if (fromExecutableCode != null) {
|
|
2690
2950
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
2691
2951
|
}
|
|
2692
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2693
|
-
if (fromFunctionCall != null) {
|
|
2694
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
2695
|
-
}
|
|
2696
2952
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
2697
2953
|
'functionResponse',
|
|
2698
2954
|
]);
|
|
@@ -3317,18 +3573,92 @@ function batchJobSourceToMldev(apiClient, fromObject) {
|
|
|
3317
3573
|
}
|
|
3318
3574
|
return toObject;
|
|
3319
3575
|
}
|
|
3320
|
-
function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3576
|
+
function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3577
|
+
const toObject = {};
|
|
3578
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3579
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3580
|
+
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3581
|
+
}
|
|
3582
|
+
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
3583
|
+
throw new Error('dest parameter is not supported in Gemini API.');
|
|
3584
|
+
}
|
|
3585
|
+
return toObject;
|
|
3586
|
+
}
|
|
3587
|
+
function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3588
|
+
const toObject = {};
|
|
3589
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3590
|
+
if (fromModel != null) {
|
|
3591
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3592
|
+
}
|
|
3593
|
+
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3594
|
+
if (fromSrc != null) {
|
|
3595
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], batchJobSourceToMldev(apiClient, tBatchJobSource(apiClient, fromSrc)));
|
|
3596
|
+
}
|
|
3597
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3598
|
+
if (fromConfig != null) {
|
|
3599
|
+
setValueByPath(toObject, ['config'], createBatchJobConfigToMldev(fromConfig, toObject));
|
|
3600
|
+
}
|
|
3601
|
+
return toObject;
|
|
3602
|
+
}
|
|
3603
|
+
function embedContentConfigToMldev$1(fromObject, parentObject) {
|
|
3604
|
+
const toObject = {};
|
|
3605
|
+
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
3606
|
+
if (parentObject !== undefined && fromTaskType != null) {
|
|
3607
|
+
setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
|
|
3608
|
+
}
|
|
3609
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3610
|
+
if (parentObject !== undefined && fromTitle != null) {
|
|
3611
|
+
setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
|
|
3612
|
+
}
|
|
3613
|
+
const fromOutputDimensionality = getValueByPath(fromObject, [
|
|
3614
|
+
'outputDimensionality',
|
|
3615
|
+
]);
|
|
3616
|
+
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
3617
|
+
setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
|
|
3618
|
+
}
|
|
3619
|
+
if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
|
|
3620
|
+
throw new Error('mimeType parameter is not supported in Gemini API.');
|
|
3621
|
+
}
|
|
3622
|
+
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
3623
|
+
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
3624
|
+
}
|
|
3625
|
+
return toObject;
|
|
3626
|
+
}
|
|
3627
|
+
function embedContentBatchToMldev(apiClient, fromObject) {
|
|
3628
|
+
const toObject = {};
|
|
3629
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3630
|
+
if (fromContents != null) {
|
|
3631
|
+
setValueByPath(toObject, ['requests[]', 'request', 'content'], tContentsForEmbed(apiClient, fromContents));
|
|
3632
|
+
}
|
|
3633
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3634
|
+
if (fromConfig != null) {
|
|
3635
|
+
setValueByPath(toObject, ['config'], embedContentConfigToMldev$1(fromConfig, toObject));
|
|
3636
|
+
}
|
|
3637
|
+
return toObject;
|
|
3638
|
+
}
|
|
3639
|
+
function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
|
|
3640
|
+
const toObject = {};
|
|
3641
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
3642
|
+
if (fromFileName != null) {
|
|
3643
|
+
setValueByPath(toObject, ['file_name'], fromFileName);
|
|
3644
|
+
}
|
|
3645
|
+
const fromInlinedRequests = getValueByPath(fromObject, [
|
|
3646
|
+
'inlinedRequests',
|
|
3647
|
+
]);
|
|
3648
|
+
if (fromInlinedRequests != null) {
|
|
3649
|
+
setValueByPath(toObject, ['requests'], embedContentBatchToMldev(apiClient, fromInlinedRequests));
|
|
3650
|
+
}
|
|
3651
|
+
return toObject;
|
|
3652
|
+
}
|
|
3653
|
+
function createEmbeddingsBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3321
3654
|
const toObject = {};
|
|
3322
3655
|
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3323
3656
|
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3324
3657
|
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3325
3658
|
}
|
|
3326
|
-
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
3327
|
-
throw new Error('dest parameter is not supported in Gemini API.');
|
|
3328
|
-
}
|
|
3329
3659
|
return toObject;
|
|
3330
3660
|
}
|
|
3331
|
-
function
|
|
3661
|
+
function createEmbeddingsBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3332
3662
|
const toObject = {};
|
|
3333
3663
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3334
3664
|
if (fromModel != null) {
|
|
@@ -3336,11 +3666,11 @@ function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
|
3336
3666
|
}
|
|
3337
3667
|
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3338
3668
|
if (fromSrc != null) {
|
|
3339
|
-
setValueByPath(toObject, ['batch', 'inputConfig'],
|
|
3669
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], embeddingsBatchJobSourceToMldev(apiClient, fromSrc));
|
|
3340
3670
|
}
|
|
3341
3671
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3342
3672
|
if (fromConfig != null) {
|
|
3343
|
-
setValueByPath(toObject, ['config'],
|
|
3673
|
+
setValueByPath(toObject, ['config'], createEmbeddingsBatchJobConfigToMldev(fromConfig, toObject));
|
|
3344
3674
|
}
|
|
3345
3675
|
return toObject;
|
|
3346
3676
|
}
|
|
@@ -3445,6 +3775,10 @@ function batchJobDestinationToVertex(fromObject) {
|
|
|
3445
3775
|
if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
|
|
3446
3776
|
throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
|
|
3447
3777
|
}
|
|
3778
|
+
if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
|
|
3779
|
+
undefined) {
|
|
3780
|
+
throw new Error('inlinedEmbedContentResponses parameter is not supported in Vertex AI.');
|
|
3781
|
+
}
|
|
3448
3782
|
return toObject;
|
|
3449
3783
|
}
|
|
3450
3784
|
function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -3575,6 +3909,22 @@ function fileDataFromMldev$2(fromObject) {
|
|
|
3575
3909
|
}
|
|
3576
3910
|
return toObject;
|
|
3577
3911
|
}
|
|
3912
|
+
function functionCallFromMldev$2(fromObject) {
|
|
3913
|
+
const toObject = {};
|
|
3914
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
3915
|
+
if (fromId != null) {
|
|
3916
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
3917
|
+
}
|
|
3918
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
3919
|
+
if (fromArgs != null) {
|
|
3920
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
3921
|
+
}
|
|
3922
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3923
|
+
if (fromName != null) {
|
|
3924
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3925
|
+
}
|
|
3926
|
+
return toObject;
|
|
3927
|
+
}
|
|
3578
3928
|
function partFromMldev$2(fromObject) {
|
|
3579
3929
|
const toObject = {};
|
|
3580
3930
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -3601,6 +3951,10 @@ function partFromMldev$2(fromObject) {
|
|
|
3601
3951
|
if (fromThoughtSignature != null) {
|
|
3602
3952
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
3603
3953
|
}
|
|
3954
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3955
|
+
if (fromFunctionCall != null) {
|
|
3956
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$2(fromFunctionCall));
|
|
3957
|
+
}
|
|
3604
3958
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3605
3959
|
'codeExecutionResult',
|
|
3606
3960
|
]);
|
|
@@ -3613,10 +3967,6 @@ function partFromMldev$2(fromObject) {
|
|
|
3613
3967
|
if (fromExecutableCode != null) {
|
|
3614
3968
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
3615
3969
|
}
|
|
3616
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3617
|
-
if (fromFunctionCall != null) {
|
|
3618
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3619
|
-
}
|
|
3620
3970
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
3621
3971
|
'functionResponse',
|
|
3622
3972
|
]);
|
|
@@ -3805,6 +4155,38 @@ function inlinedResponseFromMldev(fromObject) {
|
|
|
3805
4155
|
}
|
|
3806
4156
|
return toObject;
|
|
3807
4157
|
}
|
|
4158
|
+
function contentEmbeddingFromMldev$1(fromObject) {
|
|
4159
|
+
const toObject = {};
|
|
4160
|
+
const fromValues = getValueByPath(fromObject, ['values']);
|
|
4161
|
+
if (fromValues != null) {
|
|
4162
|
+
setValueByPath(toObject, ['values'], fromValues);
|
|
4163
|
+
}
|
|
4164
|
+
return toObject;
|
|
4165
|
+
}
|
|
4166
|
+
function singleEmbedContentResponseFromMldev(fromObject) {
|
|
4167
|
+
const toObject = {};
|
|
4168
|
+
const fromEmbedding = getValueByPath(fromObject, ['embedding']);
|
|
4169
|
+
if (fromEmbedding != null) {
|
|
4170
|
+
setValueByPath(toObject, ['embedding'], contentEmbeddingFromMldev$1(fromEmbedding));
|
|
4171
|
+
}
|
|
4172
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
4173
|
+
if (fromTokenCount != null) {
|
|
4174
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
4175
|
+
}
|
|
4176
|
+
return toObject;
|
|
4177
|
+
}
|
|
4178
|
+
function inlinedEmbedContentResponseFromMldev(fromObject) {
|
|
4179
|
+
const toObject = {};
|
|
4180
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
4181
|
+
if (fromResponse != null) {
|
|
4182
|
+
setValueByPath(toObject, ['response'], singleEmbedContentResponseFromMldev(fromResponse));
|
|
4183
|
+
}
|
|
4184
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
4185
|
+
if (fromError != null) {
|
|
4186
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev(fromError));
|
|
4187
|
+
}
|
|
4188
|
+
return toObject;
|
|
4189
|
+
}
|
|
3808
4190
|
function batchJobDestinationFromMldev(fromObject) {
|
|
3809
4191
|
const toObject = {};
|
|
3810
4192
|
const fromFileName = getValueByPath(fromObject, ['responsesFile']);
|
|
@@ -3824,6 +4206,19 @@ function batchJobDestinationFromMldev(fromObject) {
|
|
|
3824
4206
|
}
|
|
3825
4207
|
setValueByPath(toObject, ['inlinedResponses'], transformedList);
|
|
3826
4208
|
}
|
|
4209
|
+
const fromInlinedEmbedContentResponses = getValueByPath(fromObject, [
|
|
4210
|
+
'inlinedEmbedContentResponses',
|
|
4211
|
+
'inlinedResponses',
|
|
4212
|
+
]);
|
|
4213
|
+
if (fromInlinedEmbedContentResponses != null) {
|
|
4214
|
+
let transformedList = fromInlinedEmbedContentResponses;
|
|
4215
|
+
if (Array.isArray(transformedList)) {
|
|
4216
|
+
transformedList = transformedList.map((item) => {
|
|
4217
|
+
return inlinedEmbedContentResponseFromMldev(item);
|
|
4218
|
+
});
|
|
4219
|
+
}
|
|
4220
|
+
setValueByPath(toObject, ['inlinedEmbedContentResponses'], transformedList);
|
|
4221
|
+
}
|
|
3827
4222
|
return toObject;
|
|
3828
4223
|
}
|
|
3829
4224
|
function batchJobFromMldev(fromObject) {
|
|
@@ -3870,7 +4265,7 @@ function batchJobFromMldev(fromObject) {
|
|
|
3870
4265
|
}
|
|
3871
4266
|
const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
|
|
3872
4267
|
if (fromDest != null) {
|
|
3873
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
|
|
4268
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(tRecvBatchJobDestination(fromDest)));
|
|
3874
4269
|
}
|
|
3875
4270
|
return toObject;
|
|
3876
4271
|
}
|
|
@@ -4023,7 +4418,7 @@ function batchJobFromVertex(fromObject) {
|
|
|
4023
4418
|
}
|
|
4024
4419
|
const fromDest = getValueByPath(fromObject, ['outputConfig']);
|
|
4025
4420
|
if (fromDest != null) {
|
|
4026
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
|
|
4421
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
|
|
4027
4422
|
}
|
|
4028
4423
|
return toObject;
|
|
4029
4424
|
}
|
|
@@ -4289,79 +4684,87 @@ class Batches extends BaseModule {
|
|
|
4289
4684
|
this.create = async (params) => {
|
|
4290
4685
|
var _a, _b;
|
|
4291
4686
|
if (this.apiClient.isVertexAI()) {
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
'Google Cloud Storage URI or BigQuery URI instead.');
|
|
4297
|
-
}
|
|
4298
|
-
params.config = params.config || {};
|
|
4299
|
-
if (params.config.displayName === undefined) {
|
|
4300
|
-
params.config.displayName = 'genaiBatchJob_${timestampStr}';
|
|
4301
|
-
}
|
|
4302
|
-
if (params.config.dest === undefined && typeof params.src === 'string') {
|
|
4303
|
-
if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
|
|
4304
|
-
params.config.dest = `${params.src.slice(0, -6)}/dest`;
|
|
4305
|
-
}
|
|
4306
|
-
else if (params.src.startsWith('bq://')) {
|
|
4307
|
-
params.config.dest =
|
|
4308
|
-
`${params.src}_dest_${timestampStr}`;
|
|
4309
|
-
}
|
|
4310
|
-
else {
|
|
4311
|
-
throw new Error('Unsupported source:' + params.src);
|
|
4312
|
-
}
|
|
4313
|
-
}
|
|
4687
|
+
// Format destination if not provided
|
|
4688
|
+
// Cast params.src as Vertex AI path does not handle InlinedRequest[]
|
|
4689
|
+
params.config = this.formatDestination(params.src, params.config);
|
|
4690
|
+
return this.createInternal(params);
|
|
4314
4691
|
}
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4692
|
+
// MLDEV
|
|
4693
|
+
const src = params.src;
|
|
4694
|
+
const is_inlined = Array.isArray(params.src) || src.inlinedRequests !== undefined;
|
|
4695
|
+
if (!is_inlined) {
|
|
4696
|
+
return this.createInternal(params);
|
|
4697
|
+
}
|
|
4698
|
+
// Inlined generate content requests handling
|
|
4699
|
+
const result = this.createInlinedGenerateContentRequest(params);
|
|
4700
|
+
const path = result.path;
|
|
4701
|
+
const requestBody = result.body;
|
|
4702
|
+
const queryParams = createBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4703
|
+
const response = this.apiClient
|
|
4704
|
+
.request({
|
|
4705
|
+
path: path,
|
|
4706
|
+
queryParams: queryParams,
|
|
4707
|
+
body: JSON.stringify(requestBody),
|
|
4708
|
+
httpMethod: 'POST',
|
|
4709
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4710
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4711
|
+
})
|
|
4712
|
+
.then((httpResponse) => {
|
|
4713
|
+
return httpResponse.json();
|
|
4714
|
+
});
|
|
4715
|
+
return response.then((apiResponse) => {
|
|
4716
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4717
|
+
return resp;
|
|
4718
|
+
});
|
|
4719
|
+
};
|
|
4720
|
+
/**
|
|
4721
|
+
* **Experimental** Creates an embedding batch job.
|
|
4722
|
+
*
|
|
4723
|
+
* @param params - The parameters for create embedding batch job request.
|
|
4724
|
+
* @return The created batch job.
|
|
4725
|
+
*
|
|
4726
|
+
* @example
|
|
4727
|
+
* ```ts
|
|
4728
|
+
* const response = await ai.batches.createEmbeddings({
|
|
4729
|
+
* model: 'text-embedding-004',
|
|
4730
|
+
* src: {fileName: 'files/my_embedding_input'},
|
|
4731
|
+
* });
|
|
4732
|
+
* console.log(response);
|
|
4733
|
+
* ```
|
|
4734
|
+
*/
|
|
4735
|
+
this.createEmbeddings = async (params) => {
|
|
4736
|
+
var _a, _b;
|
|
4737
|
+
console.warn('batches.createEmbeddings() is experimental and may change without notice.');
|
|
4738
|
+
if (this.apiClient.isVertexAI()) {
|
|
4739
|
+
throw new Error('Vertex AI does not support batches.createEmbeddings.');
|
|
4740
|
+
}
|
|
4741
|
+
// MLDEV
|
|
4742
|
+
const src = params.src;
|
|
4743
|
+
const is_inlined = src.inlinedRequests !== undefined;
|
|
4744
|
+
if (!is_inlined) {
|
|
4745
|
+
return this.createEmbeddingsInternal(params); // Fixed typo here
|
|
4363
4746
|
}
|
|
4364
|
-
|
|
4747
|
+
// Inlined embed content requests handling
|
|
4748
|
+
const result = this.createInlinedEmbedContentRequest(params);
|
|
4749
|
+
const path = result.path;
|
|
4750
|
+
const requestBody = result.body;
|
|
4751
|
+
const queryParams = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4752
|
+
const response = this.apiClient
|
|
4753
|
+
.request({
|
|
4754
|
+
path: path,
|
|
4755
|
+
queryParams: queryParams,
|
|
4756
|
+
body: JSON.stringify(requestBody),
|
|
4757
|
+
httpMethod: 'POST',
|
|
4758
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4759
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4760
|
+
})
|
|
4761
|
+
.then((httpResponse) => {
|
|
4762
|
+
return httpResponse.json();
|
|
4763
|
+
});
|
|
4764
|
+
return response.then((apiResponse) => {
|
|
4765
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4766
|
+
return resp;
|
|
4767
|
+
});
|
|
4365
4768
|
};
|
|
4366
4769
|
/**
|
|
4367
4770
|
* Lists batch job configurations.
|
|
@@ -4381,6 +4784,112 @@ class Batches extends BaseModule {
|
|
|
4381
4784
|
return new Pager(exports.PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4382
4785
|
};
|
|
4383
4786
|
}
|
|
4787
|
+
// Helper function to handle inlined generate content requests
|
|
4788
|
+
createInlinedGenerateContentRequest(params) {
|
|
4789
|
+
const body = createBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4790
|
+
params);
|
|
4791
|
+
const urlParams = body['_url'];
|
|
4792
|
+
const path = formatMap('{model}:batchGenerateContent', urlParams);
|
|
4793
|
+
const batch = body['batch'];
|
|
4794
|
+
const inputConfig = batch['inputConfig'];
|
|
4795
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4796
|
+
const requests = requestsWrapper['requests'];
|
|
4797
|
+
const newRequests = [];
|
|
4798
|
+
for (const request of requests) {
|
|
4799
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4800
|
+
if (requestDict['systemInstruction']) {
|
|
4801
|
+
const systemInstructionValue = requestDict['systemInstruction'];
|
|
4802
|
+
delete requestDict['systemInstruction'];
|
|
4803
|
+
const requestContent = requestDict['request'];
|
|
4804
|
+
requestContent['systemInstruction'] = systemInstructionValue;
|
|
4805
|
+
requestDict['request'] = requestContent;
|
|
4806
|
+
}
|
|
4807
|
+
newRequests.push(requestDict);
|
|
4808
|
+
}
|
|
4809
|
+
requestsWrapper['requests'] = newRequests;
|
|
4810
|
+
delete body['config'];
|
|
4811
|
+
delete body['_url'];
|
|
4812
|
+
delete body['_query'];
|
|
4813
|
+
return { path, body };
|
|
4814
|
+
}
|
|
4815
|
+
// Helper function to handle inlined embedding requests
|
|
4816
|
+
createInlinedEmbedContentRequest(params) {
|
|
4817
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4818
|
+
params);
|
|
4819
|
+
const urlParams = body['_url'];
|
|
4820
|
+
const path = formatMap('{model}:asyncBatchEmbedContent', urlParams);
|
|
4821
|
+
const batch = body['batch'];
|
|
4822
|
+
const inputConfig = batch['inputConfig'];
|
|
4823
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4824
|
+
const requests = requestsWrapper['requests'];
|
|
4825
|
+
const newRequests = [];
|
|
4826
|
+
delete requestsWrapper['config']; // Remove top-level config
|
|
4827
|
+
for (const request of requests) {
|
|
4828
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4829
|
+
const innerRequest = requestDict['request'];
|
|
4830
|
+
for (const key in requestDict) {
|
|
4831
|
+
if (key !== 'request') {
|
|
4832
|
+
innerRequest[key] = requestDict[key];
|
|
4833
|
+
delete requestDict[key];
|
|
4834
|
+
}
|
|
4835
|
+
}
|
|
4836
|
+
newRequests.push(requestDict);
|
|
4837
|
+
}
|
|
4838
|
+
requestsWrapper['requests'] = newRequests;
|
|
4839
|
+
delete body['config'];
|
|
4840
|
+
delete body['_url'];
|
|
4841
|
+
delete body['_query'];
|
|
4842
|
+
return { path, body };
|
|
4843
|
+
}
|
|
4844
|
+
// Helper function to get the first GCS URI
|
|
4845
|
+
getGcsUri(src) {
|
|
4846
|
+
if (typeof src === 'string') {
|
|
4847
|
+
return src.startsWith('gs://') ? src : undefined;
|
|
4848
|
+
}
|
|
4849
|
+
if (!Array.isArray(src) && src.gcsUri && src.gcsUri.length > 0) {
|
|
4850
|
+
return src.gcsUri[0];
|
|
4851
|
+
}
|
|
4852
|
+
return undefined;
|
|
4853
|
+
}
|
|
4854
|
+
// Helper function to get the BigQuery URI
|
|
4855
|
+
getBigqueryUri(src) {
|
|
4856
|
+
if (typeof src === 'string') {
|
|
4857
|
+
return src.startsWith('bq://') ? src : undefined;
|
|
4858
|
+
}
|
|
4859
|
+
if (!Array.isArray(src)) {
|
|
4860
|
+
return src.bigqueryUri;
|
|
4861
|
+
}
|
|
4862
|
+
return undefined;
|
|
4863
|
+
}
|
|
4864
|
+
// Function to format the destination configuration for Vertex AI
|
|
4865
|
+
formatDestination(src, config) {
|
|
4866
|
+
const newConfig = config ? Object.assign({}, config) : {};
|
|
4867
|
+
const timestampStr = Date.now().toString();
|
|
4868
|
+
if (!newConfig.displayName) {
|
|
4869
|
+
newConfig.displayName = `genaiBatchJob_${timestampStr}`;
|
|
4870
|
+
}
|
|
4871
|
+
if (newConfig.dest === undefined) {
|
|
4872
|
+
const gcsUri = this.getGcsUri(src);
|
|
4873
|
+
const bigqueryUri = this.getBigqueryUri(src);
|
|
4874
|
+
if (gcsUri) {
|
|
4875
|
+
if (gcsUri.endsWith('.jsonl')) {
|
|
4876
|
+
// For .jsonl files, remove suffix and add /dest
|
|
4877
|
+
newConfig.dest = `${gcsUri.slice(0, -6)}/dest`;
|
|
4878
|
+
}
|
|
4879
|
+
else {
|
|
4880
|
+
// Fallback for other GCS URIs
|
|
4881
|
+
newConfig.dest = `${gcsUri}_dest_${timestampStr}`;
|
|
4882
|
+
}
|
|
4883
|
+
}
|
|
4884
|
+
else if (bigqueryUri) {
|
|
4885
|
+
newConfig.dest = `${bigqueryUri}_dest_${timestampStr}`;
|
|
4886
|
+
}
|
|
4887
|
+
else {
|
|
4888
|
+
throw new Error('Unsupported source for Vertex AI: No GCS or BigQuery URI found.');
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
return newConfig;
|
|
4892
|
+
}
|
|
4384
4893
|
/**
|
|
4385
4894
|
* Internal method to create batch job.
|
|
4386
4895
|
*
|
|
@@ -4442,6 +4951,46 @@ class Batches extends BaseModule {
|
|
|
4442
4951
|
});
|
|
4443
4952
|
}
|
|
4444
4953
|
}
|
|
4954
|
+
/**
|
|
4955
|
+
* Internal method to create batch job.
|
|
4956
|
+
*
|
|
4957
|
+
* @param params - The parameters for create batch job request.
|
|
4958
|
+
* @return The created batch job.
|
|
4959
|
+
*
|
|
4960
|
+
*/
|
|
4961
|
+
async createEmbeddingsInternal(params) {
|
|
4962
|
+
var _a, _b;
|
|
4963
|
+
let response;
|
|
4964
|
+
let path = '';
|
|
4965
|
+
let queryParams = {};
|
|
4966
|
+
if (this.apiClient.isVertexAI()) {
|
|
4967
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
4968
|
+
}
|
|
4969
|
+
else {
|
|
4970
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params);
|
|
4971
|
+
path = formatMap('{model}:asyncBatchEmbedContent', body['_url']);
|
|
4972
|
+
queryParams = body['_query'];
|
|
4973
|
+
delete body['config'];
|
|
4974
|
+
delete body['_url'];
|
|
4975
|
+
delete body['_query'];
|
|
4976
|
+
response = this.apiClient
|
|
4977
|
+
.request({
|
|
4978
|
+
path: path,
|
|
4979
|
+
queryParams: queryParams,
|
|
4980
|
+
body: JSON.stringify(body),
|
|
4981
|
+
httpMethod: 'POST',
|
|
4982
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4983
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4984
|
+
})
|
|
4985
|
+
.then((httpResponse) => {
|
|
4986
|
+
return httpResponse.json();
|
|
4987
|
+
});
|
|
4988
|
+
return response.then((apiResponse) => {
|
|
4989
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4990
|
+
return resp;
|
|
4991
|
+
});
|
|
4992
|
+
}
|
|
4993
|
+
}
|
|
4445
4994
|
/**
|
|
4446
4995
|
* Gets batch job configurations.
|
|
4447
4996
|
*
|
|
@@ -4755,6 +5304,22 @@ function fileDataToMldev$3(fromObject) {
|
|
|
4755
5304
|
}
|
|
4756
5305
|
return toObject;
|
|
4757
5306
|
}
|
|
5307
|
+
function functionCallToMldev$3(fromObject) {
|
|
5308
|
+
const toObject = {};
|
|
5309
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5310
|
+
if (fromId != null) {
|
|
5311
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5312
|
+
}
|
|
5313
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5314
|
+
if (fromArgs != null) {
|
|
5315
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5316
|
+
}
|
|
5317
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5318
|
+
if (fromName != null) {
|
|
5319
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5320
|
+
}
|
|
5321
|
+
return toObject;
|
|
5322
|
+
}
|
|
4758
5323
|
function partToMldev$3(fromObject) {
|
|
4759
5324
|
const toObject = {};
|
|
4760
5325
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -4781,6 +5346,10 @@ function partToMldev$3(fromObject) {
|
|
|
4781
5346
|
if (fromThoughtSignature != null) {
|
|
4782
5347
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
4783
5348
|
}
|
|
5349
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5350
|
+
if (fromFunctionCall != null) {
|
|
5351
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
|
|
5352
|
+
}
|
|
4784
5353
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4785
5354
|
'codeExecutionResult',
|
|
4786
5355
|
]);
|
|
@@ -4793,10 +5362,6 @@ function partToMldev$3(fromObject) {
|
|
|
4793
5362
|
if (fromExecutableCode != null) {
|
|
4794
5363
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4795
5364
|
}
|
|
4796
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4797
|
-
if (fromFunctionCall != null) {
|
|
4798
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4799
|
-
}
|
|
4800
5365
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4801
5366
|
'functionResponse',
|
|
4802
5367
|
]);
|
|
@@ -5204,6 +5769,22 @@ function fileDataToVertex$2(fromObject) {
|
|
|
5204
5769
|
}
|
|
5205
5770
|
return toObject;
|
|
5206
5771
|
}
|
|
5772
|
+
function functionCallToVertex$2(fromObject) {
|
|
5773
|
+
const toObject = {};
|
|
5774
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5775
|
+
if (fromId != null) {
|
|
5776
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5777
|
+
}
|
|
5778
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5779
|
+
if (fromArgs != null) {
|
|
5780
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5781
|
+
}
|
|
5782
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5783
|
+
if (fromName != null) {
|
|
5784
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5785
|
+
}
|
|
5786
|
+
return toObject;
|
|
5787
|
+
}
|
|
5207
5788
|
function partToVertex$2(fromObject) {
|
|
5208
5789
|
const toObject = {};
|
|
5209
5790
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -5230,6 +5811,10 @@ function partToVertex$2(fromObject) {
|
|
|
5230
5811
|
if (fromThoughtSignature != null) {
|
|
5231
5812
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5232
5813
|
}
|
|
5814
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5815
|
+
if (fromFunctionCall != null) {
|
|
5816
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$2(fromFunctionCall));
|
|
5817
|
+
}
|
|
5233
5818
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5234
5819
|
'codeExecutionResult',
|
|
5235
5820
|
]);
|
|
@@ -5242,10 +5827,6 @@ function partToVertex$2(fromObject) {
|
|
|
5242
5827
|
if (fromExecutableCode != null) {
|
|
5243
5828
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
5244
5829
|
}
|
|
5245
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5246
|
-
if (fromFunctionCall != null) {
|
|
5247
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
5248
|
-
}
|
|
5249
5830
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
5250
5831
|
'functionResponse',
|
|
5251
5832
|
]);
|
|
@@ -6617,7 +7198,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6617
7198
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6618
7199
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6619
7200
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6620
|
-
const SDK_VERSION = '1.
|
|
7201
|
+
const SDK_VERSION = '1.19.0'; // x-release-please-version
|
|
6621
7202
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6622
7203
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6623
7204
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -7972,6 +8553,22 @@ function fileDataToMldev$2(fromObject) {
|
|
|
7972
8553
|
}
|
|
7973
8554
|
return toObject;
|
|
7974
8555
|
}
|
|
8556
|
+
function functionCallToMldev$2(fromObject) {
|
|
8557
|
+
const toObject = {};
|
|
8558
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
8559
|
+
if (fromId != null) {
|
|
8560
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
8561
|
+
}
|
|
8562
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
8563
|
+
if (fromArgs != null) {
|
|
8564
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
8565
|
+
}
|
|
8566
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
8567
|
+
if (fromName != null) {
|
|
8568
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
8569
|
+
}
|
|
8570
|
+
return toObject;
|
|
8571
|
+
}
|
|
7975
8572
|
function partToMldev$2(fromObject) {
|
|
7976
8573
|
const toObject = {};
|
|
7977
8574
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -7998,6 +8595,10 @@ function partToMldev$2(fromObject) {
|
|
|
7998
8595
|
if (fromThoughtSignature != null) {
|
|
7999
8596
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8000
8597
|
}
|
|
8598
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8599
|
+
if (fromFunctionCall != null) {
|
|
8600
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
|
|
8601
|
+
}
|
|
8001
8602
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8002
8603
|
'codeExecutionResult',
|
|
8003
8604
|
]);
|
|
@@ -8010,10 +8611,6 @@ function partToMldev$2(fromObject) {
|
|
|
8010
8611
|
if (fromExecutableCode != null) {
|
|
8011
8612
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8012
8613
|
}
|
|
8013
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8014
|
-
if (fromFunctionCall != null) {
|
|
8015
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8016
|
-
}
|
|
8017
8614
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8018
8615
|
'functionResponse',
|
|
8019
8616
|
]);
|
|
@@ -8676,6 +9273,22 @@ function fileDataToVertex$1(fromObject) {
|
|
|
8676
9273
|
}
|
|
8677
9274
|
return toObject;
|
|
8678
9275
|
}
|
|
9276
|
+
function functionCallToVertex$1(fromObject) {
|
|
9277
|
+
const toObject = {};
|
|
9278
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
9279
|
+
if (fromId != null) {
|
|
9280
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
9281
|
+
}
|
|
9282
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9283
|
+
if (fromArgs != null) {
|
|
9284
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9285
|
+
}
|
|
9286
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9287
|
+
if (fromName != null) {
|
|
9288
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9289
|
+
}
|
|
9290
|
+
return toObject;
|
|
9291
|
+
}
|
|
8679
9292
|
function partToVertex$1(fromObject) {
|
|
8680
9293
|
const toObject = {};
|
|
8681
9294
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -8702,6 +9315,10 @@ function partToVertex$1(fromObject) {
|
|
|
8702
9315
|
if (fromThoughtSignature != null) {
|
|
8703
9316
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8704
9317
|
}
|
|
9318
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9319
|
+
if (fromFunctionCall != null) {
|
|
9320
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$1(fromFunctionCall));
|
|
9321
|
+
}
|
|
8705
9322
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8706
9323
|
'codeExecutionResult',
|
|
8707
9324
|
]);
|
|
@@ -8714,10 +9331,6 @@ function partToVertex$1(fromObject) {
|
|
|
8714
9331
|
if (fromExecutableCode != null) {
|
|
8715
9332
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8716
9333
|
}
|
|
8717
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8718
|
-
if (fromFunctionCall != null) {
|
|
8719
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8720
|
-
}
|
|
8721
9334
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8722
9335
|
'functionResponse',
|
|
8723
9336
|
]);
|
|
@@ -9265,6 +9878,22 @@ function fileDataFromMldev$1(fromObject) {
|
|
|
9265
9878
|
}
|
|
9266
9879
|
return toObject;
|
|
9267
9880
|
}
|
|
9881
|
+
function functionCallFromMldev$1(fromObject) {
|
|
9882
|
+
const toObject = {};
|
|
9883
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
9884
|
+
if (fromId != null) {
|
|
9885
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
9886
|
+
}
|
|
9887
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9888
|
+
if (fromArgs != null) {
|
|
9889
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9890
|
+
}
|
|
9891
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9892
|
+
if (fromName != null) {
|
|
9893
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9894
|
+
}
|
|
9895
|
+
return toObject;
|
|
9896
|
+
}
|
|
9268
9897
|
function partFromMldev$1(fromObject) {
|
|
9269
9898
|
const toObject = {};
|
|
9270
9899
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9291,6 +9920,10 @@ function partFromMldev$1(fromObject) {
|
|
|
9291
9920
|
if (fromThoughtSignature != null) {
|
|
9292
9921
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9293
9922
|
}
|
|
9923
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9924
|
+
if (fromFunctionCall != null) {
|
|
9925
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$1(fromFunctionCall));
|
|
9926
|
+
}
|
|
9294
9927
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9295
9928
|
'codeExecutionResult',
|
|
9296
9929
|
]);
|
|
@@ -9303,10 +9936,6 @@ function partFromMldev$1(fromObject) {
|
|
|
9303
9936
|
if (fromExecutableCode != null) {
|
|
9304
9937
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9305
9938
|
}
|
|
9306
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9307
|
-
if (fromFunctionCall != null) {
|
|
9308
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9309
|
-
}
|
|
9310
9939
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9311
9940
|
'functionResponse',
|
|
9312
9941
|
]);
|
|
@@ -9423,22 +10052,6 @@ function liveServerContentFromMldev(fromObject) {
|
|
|
9423
10052
|
}
|
|
9424
10053
|
return toObject;
|
|
9425
10054
|
}
|
|
9426
|
-
function functionCallFromMldev(fromObject) {
|
|
9427
|
-
const toObject = {};
|
|
9428
|
-
const fromId = getValueByPath(fromObject, ['id']);
|
|
9429
|
-
if (fromId != null) {
|
|
9430
|
-
setValueByPath(toObject, ['id'], fromId);
|
|
9431
|
-
}
|
|
9432
|
-
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9433
|
-
if (fromArgs != null) {
|
|
9434
|
-
setValueByPath(toObject, ['args'], fromArgs);
|
|
9435
|
-
}
|
|
9436
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
9437
|
-
if (fromName != null) {
|
|
9438
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
9439
|
-
}
|
|
9440
|
-
return toObject;
|
|
9441
|
-
}
|
|
9442
10055
|
function liveServerToolCallFromMldev(fromObject) {
|
|
9443
10056
|
const toObject = {};
|
|
9444
10057
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -9448,7 +10061,7 @@ function liveServerToolCallFromMldev(fromObject) {
|
|
|
9448
10061
|
let transformedList = fromFunctionCalls;
|
|
9449
10062
|
if (Array.isArray(transformedList)) {
|
|
9450
10063
|
transformedList = transformedList.map((item) => {
|
|
9451
|
-
return functionCallFromMldev(item);
|
|
10064
|
+
return functionCallFromMldev$1(item);
|
|
9452
10065
|
});
|
|
9453
10066
|
}
|
|
9454
10067
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -9859,6 +10472,22 @@ function fileDataFromVertex$1(fromObject) {
|
|
|
9859
10472
|
}
|
|
9860
10473
|
return toObject;
|
|
9861
10474
|
}
|
|
10475
|
+
function functionCallFromVertex$1(fromObject) {
|
|
10476
|
+
const toObject = {};
|
|
10477
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
10478
|
+
if (fromId != null) {
|
|
10479
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
10480
|
+
}
|
|
10481
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10482
|
+
if (fromArgs != null) {
|
|
10483
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
10484
|
+
}
|
|
10485
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
10486
|
+
if (fromName != null) {
|
|
10487
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
10488
|
+
}
|
|
10489
|
+
return toObject;
|
|
10490
|
+
}
|
|
9862
10491
|
function partFromVertex$1(fromObject) {
|
|
9863
10492
|
const toObject = {};
|
|
9864
10493
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9885,6 +10514,10 @@ function partFromVertex$1(fromObject) {
|
|
|
9885
10514
|
if (fromThoughtSignature != null) {
|
|
9886
10515
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9887
10516
|
}
|
|
10517
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10518
|
+
if (fromFunctionCall != null) {
|
|
10519
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex$1(fromFunctionCall));
|
|
10520
|
+
}
|
|
9888
10521
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9889
10522
|
'codeExecutionResult',
|
|
9890
10523
|
]);
|
|
@@ -9897,10 +10530,6 @@ function partFromVertex$1(fromObject) {
|
|
|
9897
10530
|
if (fromExecutableCode != null) {
|
|
9898
10531
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9899
10532
|
}
|
|
9900
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9901
|
-
if (fromFunctionCall != null) {
|
|
9902
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9903
|
-
}
|
|
9904
10533
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9905
10534
|
'functionResponse',
|
|
9906
10535
|
]);
|
|
@@ -9983,18 +10612,6 @@ function liveServerContentFromVertex(fromObject) {
|
|
|
9983
10612
|
}
|
|
9984
10613
|
return toObject;
|
|
9985
10614
|
}
|
|
9986
|
-
function functionCallFromVertex(fromObject) {
|
|
9987
|
-
const toObject = {};
|
|
9988
|
-
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9989
|
-
if (fromArgs != null) {
|
|
9990
|
-
setValueByPath(toObject, ['args'], fromArgs);
|
|
9991
|
-
}
|
|
9992
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
9993
|
-
if (fromName != null) {
|
|
9994
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
9995
|
-
}
|
|
9996
|
-
return toObject;
|
|
9997
|
-
}
|
|
9998
10615
|
function liveServerToolCallFromVertex(fromObject) {
|
|
9999
10616
|
const toObject = {};
|
|
10000
10617
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -10004,7 +10621,7 @@ function liveServerToolCallFromVertex(fromObject) {
|
|
|
10004
10621
|
let transformedList = fromFunctionCalls;
|
|
10005
10622
|
if (Array.isArray(transformedList)) {
|
|
10006
10623
|
transformedList = transformedList.map((item) => {
|
|
10007
|
-
return functionCallFromVertex(item);
|
|
10624
|
+
return functionCallFromVertex$1(item);
|
|
10008
10625
|
});
|
|
10009
10626
|
}
|
|
10010
10627
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -10243,6 +10860,22 @@ function fileDataToMldev$1(fromObject) {
|
|
|
10243
10860
|
}
|
|
10244
10861
|
return toObject;
|
|
10245
10862
|
}
|
|
10863
|
+
function functionCallToMldev$1(fromObject) {
|
|
10864
|
+
const toObject = {};
|
|
10865
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
10866
|
+
if (fromId != null) {
|
|
10867
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
10868
|
+
}
|
|
10869
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10870
|
+
if (fromArgs != null) {
|
|
10871
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
10872
|
+
}
|
|
10873
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
10874
|
+
if (fromName != null) {
|
|
10875
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
10876
|
+
}
|
|
10877
|
+
return toObject;
|
|
10878
|
+
}
|
|
10246
10879
|
function partToMldev$1(fromObject) {
|
|
10247
10880
|
const toObject = {};
|
|
10248
10881
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -10269,6 +10902,10 @@ function partToMldev$1(fromObject) {
|
|
|
10269
10902
|
if (fromThoughtSignature != null) {
|
|
10270
10903
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10271
10904
|
}
|
|
10905
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10906
|
+
if (fromFunctionCall != null) {
|
|
10907
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
|
|
10908
|
+
}
|
|
10272
10909
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10273
10910
|
'codeExecutionResult',
|
|
10274
10911
|
]);
|
|
@@ -10281,10 +10918,6 @@ function partToMldev$1(fromObject) {
|
|
|
10281
10918
|
if (fromExecutableCode != null) {
|
|
10282
10919
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
10283
10920
|
}
|
|
10284
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10285
|
-
if (fromFunctionCall != null) {
|
|
10286
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
10287
|
-
}
|
|
10288
10921
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
10289
10922
|
'functionResponse',
|
|
10290
10923
|
]);
|
|
@@ -11227,6 +11860,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
11227
11860
|
if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
|
|
11228
11861
|
throw new Error('referenceImages parameter is not supported in Gemini API.');
|
|
11229
11862
|
}
|
|
11863
|
+
if (getValueByPath(fromObject, ['mask']) !== undefined) {
|
|
11864
|
+
throw new Error('mask parameter is not supported in Gemini API.');
|
|
11865
|
+
}
|
|
11230
11866
|
if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
|
|
11231
11867
|
throw new Error('compressionQuality parameter is not supported in Gemini API.');
|
|
11232
11868
|
}
|
|
@@ -11307,6 +11943,22 @@ function fileDataToVertex(fromObject) {
|
|
|
11307
11943
|
}
|
|
11308
11944
|
return toObject;
|
|
11309
11945
|
}
|
|
11946
|
+
function functionCallToVertex(fromObject) {
|
|
11947
|
+
const toObject = {};
|
|
11948
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
11949
|
+
if (fromId != null) {
|
|
11950
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
11951
|
+
}
|
|
11952
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
11953
|
+
if (fromArgs != null) {
|
|
11954
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
11955
|
+
}
|
|
11956
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
11957
|
+
if (fromName != null) {
|
|
11958
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
11959
|
+
}
|
|
11960
|
+
return toObject;
|
|
11961
|
+
}
|
|
11310
11962
|
function partToVertex(fromObject) {
|
|
11311
11963
|
const toObject = {};
|
|
11312
11964
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -11333,6 +11985,10 @@ function partToVertex(fromObject) {
|
|
|
11333
11985
|
if (fromThoughtSignature != null) {
|
|
11334
11986
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
11335
11987
|
}
|
|
11988
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11989
|
+
if (fromFunctionCall != null) {
|
|
11990
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex(fromFunctionCall));
|
|
11991
|
+
}
|
|
11336
11992
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
11337
11993
|
'codeExecutionResult',
|
|
11338
11994
|
]);
|
|
@@ -11345,10 +12001,6 @@ function partToVertex(fromObject) {
|
|
|
11345
12001
|
if (fromExecutableCode != null) {
|
|
11346
12002
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
11347
12003
|
}
|
|
11348
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11349
|
-
if (fromFunctionCall != null) {
|
|
11350
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
11351
|
-
}
|
|
11352
12004
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
11353
12005
|
'functionResponse',
|
|
11354
12006
|
]);
|
|
@@ -12819,6 +13471,18 @@ function videoGenerationReferenceImageToVertex(fromObject) {
|
|
|
12819
13471
|
}
|
|
12820
13472
|
return toObject;
|
|
12821
13473
|
}
|
|
13474
|
+
function videoGenerationMaskToVertex(fromObject) {
|
|
13475
|
+
const toObject = {};
|
|
13476
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
13477
|
+
if (fromImage != null) {
|
|
13478
|
+
setValueByPath(toObject, ['_self'], imageToVertex(fromImage));
|
|
13479
|
+
}
|
|
13480
|
+
const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
|
|
13481
|
+
if (fromMaskMode != null) {
|
|
13482
|
+
setValueByPath(toObject, ['maskMode'], fromMaskMode);
|
|
13483
|
+
}
|
|
13484
|
+
return toObject;
|
|
13485
|
+
}
|
|
12822
13486
|
function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
12823
13487
|
const toObject = {};
|
|
12824
13488
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -12897,6 +13561,10 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
|
12897
13561
|
}
|
|
12898
13562
|
setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
|
|
12899
13563
|
}
|
|
13564
|
+
const fromMask = getValueByPath(fromObject, ['mask']);
|
|
13565
|
+
if (parentObject !== undefined && fromMask != null) {
|
|
13566
|
+
setValueByPath(parentObject, ['instances[0]', 'mask'], videoGenerationMaskToVertex(fromMask));
|
|
13567
|
+
}
|
|
12900
13568
|
const fromCompressionQuality = getValueByPath(fromObject, [
|
|
12901
13569
|
'compressionQuality',
|
|
12902
13570
|
]);
|
|
@@ -12973,6 +13641,22 @@ function fileDataFromMldev(fromObject) {
|
|
|
12973
13641
|
}
|
|
12974
13642
|
return toObject;
|
|
12975
13643
|
}
|
|
13644
|
+
function functionCallFromMldev(fromObject) {
|
|
13645
|
+
const toObject = {};
|
|
13646
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
13647
|
+
if (fromId != null) {
|
|
13648
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
13649
|
+
}
|
|
13650
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
13651
|
+
if (fromArgs != null) {
|
|
13652
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
13653
|
+
}
|
|
13654
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13655
|
+
if (fromName != null) {
|
|
13656
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13657
|
+
}
|
|
13658
|
+
return toObject;
|
|
13659
|
+
}
|
|
12976
13660
|
function partFromMldev(fromObject) {
|
|
12977
13661
|
const toObject = {};
|
|
12978
13662
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -12999,6 +13683,10 @@ function partFromMldev(fromObject) {
|
|
|
12999
13683
|
if (fromThoughtSignature != null) {
|
|
13000
13684
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13001
13685
|
}
|
|
13686
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13687
|
+
if (fromFunctionCall != null) {
|
|
13688
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev(fromFunctionCall));
|
|
13689
|
+
}
|
|
13002
13690
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13003
13691
|
'codeExecutionResult',
|
|
13004
13692
|
]);
|
|
@@ -13011,10 +13699,6 @@ function partFromMldev(fromObject) {
|
|
|
13011
13699
|
if (fromExecutableCode != null) {
|
|
13012
13700
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13013
13701
|
}
|
|
13014
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13015
|
-
if (fromFunctionCall != null) {
|
|
13016
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13017
|
-
}
|
|
13018
13702
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13019
13703
|
'functionResponse',
|
|
13020
13704
|
]);
|
|
@@ -13537,6 +14221,22 @@ function fileDataFromVertex(fromObject) {
|
|
|
13537
14221
|
}
|
|
13538
14222
|
return toObject;
|
|
13539
14223
|
}
|
|
14224
|
+
function functionCallFromVertex(fromObject) {
|
|
14225
|
+
const toObject = {};
|
|
14226
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
14227
|
+
if (fromId != null) {
|
|
14228
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
14229
|
+
}
|
|
14230
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
14231
|
+
if (fromArgs != null) {
|
|
14232
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
14233
|
+
}
|
|
14234
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14235
|
+
if (fromName != null) {
|
|
14236
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14237
|
+
}
|
|
14238
|
+
return toObject;
|
|
14239
|
+
}
|
|
13540
14240
|
function partFromVertex(fromObject) {
|
|
13541
14241
|
const toObject = {};
|
|
13542
14242
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -13563,6 +14263,10 @@ function partFromVertex(fromObject) {
|
|
|
13563
14263
|
if (fromThoughtSignature != null) {
|
|
13564
14264
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13565
14265
|
}
|
|
14266
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
14267
|
+
if (fromFunctionCall != null) {
|
|
14268
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex(fromFunctionCall));
|
|
14269
|
+
}
|
|
13566
14270
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13567
14271
|
'codeExecutionResult',
|
|
13568
14272
|
]);
|
|
@@ -13575,10 +14279,6 @@ function partFromVertex(fromObject) {
|
|
|
13575
14279
|
if (fromExecutableCode != null) {
|
|
13576
14280
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13577
14281
|
}
|
|
13578
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13579
|
-
if (fromFunctionCall != null) {
|
|
13580
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13581
|
-
}
|
|
13582
14282
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13583
14283
|
'functionResponse',
|
|
13584
14284
|
]);
|
|
@@ -16664,59 +17364,6 @@ class Models extends BaseModule {
|
|
|
16664
17364
|
}
|
|
16665
17365
|
}
|
|
16666
17366
|
|
|
16667
|
-
/**
|
|
16668
|
-
* @license
|
|
16669
|
-
* Copyright 2025 Google LLC
|
|
16670
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
16671
|
-
*/
|
|
16672
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
16673
|
-
function getOperationParametersToMldev(fromObject) {
|
|
16674
|
-
const toObject = {};
|
|
16675
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
16676
|
-
'operationName',
|
|
16677
|
-
]);
|
|
16678
|
-
if (fromOperationName != null) {
|
|
16679
|
-
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
16680
|
-
}
|
|
16681
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
16682
|
-
if (fromConfig != null) {
|
|
16683
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
16684
|
-
}
|
|
16685
|
-
return toObject;
|
|
16686
|
-
}
|
|
16687
|
-
function fetchPredictOperationParametersToVertex(fromObject) {
|
|
16688
|
-
const toObject = {};
|
|
16689
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
16690
|
-
'operationName',
|
|
16691
|
-
]);
|
|
16692
|
-
if (fromOperationName != null) {
|
|
16693
|
-
setValueByPath(toObject, ['operationName'], fromOperationName);
|
|
16694
|
-
}
|
|
16695
|
-
const fromResourceName = getValueByPath(fromObject, ['resourceName']);
|
|
16696
|
-
if (fromResourceName != null) {
|
|
16697
|
-
setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
|
|
16698
|
-
}
|
|
16699
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
16700
|
-
if (fromConfig != null) {
|
|
16701
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
16702
|
-
}
|
|
16703
|
-
return toObject;
|
|
16704
|
-
}
|
|
16705
|
-
function getOperationParametersToVertex(fromObject) {
|
|
16706
|
-
const toObject = {};
|
|
16707
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
16708
|
-
'operationName',
|
|
16709
|
-
]);
|
|
16710
|
-
if (fromOperationName != null) {
|
|
16711
|
-
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
16712
|
-
}
|
|
16713
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
16714
|
-
if (fromConfig != null) {
|
|
16715
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
16716
|
-
}
|
|
16717
|
-
return toObject;
|
|
16718
|
-
}
|
|
16719
|
-
|
|
16720
17367
|
/**
|
|
16721
17368
|
* @license
|
|
16722
17369
|
* Copyright 2025 Google LLC
|
|
@@ -17000,6 +17647,22 @@ function fileDataToMldev(fromObject) {
|
|
|
17000
17647
|
}
|
|
17001
17648
|
return toObject;
|
|
17002
17649
|
}
|
|
17650
|
+
function functionCallToMldev(fromObject) {
|
|
17651
|
+
const toObject = {};
|
|
17652
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
17653
|
+
if (fromId != null) {
|
|
17654
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
17655
|
+
}
|
|
17656
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
17657
|
+
if (fromArgs != null) {
|
|
17658
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
17659
|
+
}
|
|
17660
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
17661
|
+
if (fromName != null) {
|
|
17662
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
17663
|
+
}
|
|
17664
|
+
return toObject;
|
|
17665
|
+
}
|
|
17003
17666
|
function partToMldev(fromObject) {
|
|
17004
17667
|
const toObject = {};
|
|
17005
17668
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -17026,6 +17689,10 @@ function partToMldev(fromObject) {
|
|
|
17026
17689
|
if (fromThoughtSignature != null) {
|
|
17027
17690
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
17028
17691
|
}
|
|
17692
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
17693
|
+
if (fromFunctionCall != null) {
|
|
17694
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
|
|
17695
|
+
}
|
|
17029
17696
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
17030
17697
|
'codeExecutionResult',
|
|
17031
17698
|
]);
|
|
@@ -17038,10 +17705,6 @@ function partToMldev(fromObject) {
|
|
|
17038
17705
|
if (fromExecutableCode != null) {
|
|
17039
17706
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
17040
17707
|
}
|
|
17041
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
17042
|
-
if (fromFunctionCall != null) {
|
|
17043
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
17044
|
-
}
|
|
17045
17708
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
17046
17709
|
'functionResponse',
|
|
17047
17710
|
]);
|
|
@@ -17882,6 +18545,9 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
17882
18545
|
if (parentObject !== undefined && fromLearningRate != null) {
|
|
17883
18546
|
setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
|
|
17884
18547
|
}
|
|
18548
|
+
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
18549
|
+
throw new Error('labels parameter is not supported in Gemini API.');
|
|
18550
|
+
}
|
|
17885
18551
|
return toObject;
|
|
17886
18552
|
}
|
|
17887
18553
|
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
@@ -18037,6 +18703,10 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
18037
18703
|
if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
|
|
18038
18704
|
throw new Error('learningRate parameter is not supported in Vertex AI.');
|
|
18039
18705
|
}
|
|
18706
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
18707
|
+
if (parentObject !== undefined && fromLabels != null) {
|
|
18708
|
+
setValueByPath(parentObject, ['labels'], fromLabels);
|
|
18709
|
+
}
|
|
18040
18710
|
return toObject;
|
|
18041
18711
|
}
|
|
18042
18712
|
function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
@@ -18856,6 +19526,7 @@ exports.GenerateVideosOperation = GenerateVideosOperation;
|
|
|
18856
19526
|
exports.GenerateVideosResponse = GenerateVideosResponse;
|
|
18857
19527
|
exports.GoogleGenAI = GoogleGenAI;
|
|
18858
19528
|
exports.HttpResponse = HttpResponse;
|
|
19529
|
+
exports.InlinedEmbedContentResponse = InlinedEmbedContentResponse;
|
|
18859
19530
|
exports.InlinedResponse = InlinedResponse;
|
|
18860
19531
|
exports.ListBatchJobsResponse = ListBatchJobsResponse;
|
|
18861
19532
|
exports.ListCachedContentsResponse = ListCachedContentsResponse;
|
|
@@ -18876,6 +19547,7 @@ exports.RecontextImageResponse = RecontextImageResponse;
|
|
|
18876
19547
|
exports.ReplayResponse = ReplayResponse;
|
|
18877
19548
|
exports.SegmentImageResponse = SegmentImageResponse;
|
|
18878
19549
|
exports.Session = Session;
|
|
19550
|
+
exports.SingleEmbedContentResponse = SingleEmbedContentResponse;
|
|
18879
19551
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
18880
19552
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
18881
19553
|
exports.Tokens = Tokens;
|