@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/node/index.cjs
CHANGED
|
@@ -173,7 +173,16 @@ function setValueByPath(data, keys, value) {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
else {
|
|
176
|
-
|
|
176
|
+
if (keyToSet === '_self' &&
|
|
177
|
+
typeof value === 'object' &&
|
|
178
|
+
value !== null &&
|
|
179
|
+
!Array.isArray(value)) {
|
|
180
|
+
const valueAsRecord = value;
|
|
181
|
+
Object.assign(data, valueAsRecord);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
data[keyToSet] = value;
|
|
185
|
+
}
|
|
177
186
|
}
|
|
178
187
|
}
|
|
179
188
|
function getValueByPath(data, keys) {
|
|
@@ -232,6 +241,216 @@ function tBytes$1(fromBytes) {
|
|
|
232
241
|
* SPDX-License-Identifier: Apache-2.0
|
|
233
242
|
*/
|
|
234
243
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
244
|
+
function getOperationParametersToMldev(fromObject) {
|
|
245
|
+
const toObject = {};
|
|
246
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
247
|
+
'operationName',
|
|
248
|
+
]);
|
|
249
|
+
if (fromOperationName != null) {
|
|
250
|
+
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
251
|
+
}
|
|
252
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
253
|
+
if (fromConfig != null) {
|
|
254
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
255
|
+
}
|
|
256
|
+
return toObject;
|
|
257
|
+
}
|
|
258
|
+
function fetchPredictOperationParametersToVertex(fromObject) {
|
|
259
|
+
const toObject = {};
|
|
260
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
261
|
+
'operationName',
|
|
262
|
+
]);
|
|
263
|
+
if (fromOperationName != null) {
|
|
264
|
+
setValueByPath(toObject, ['operationName'], fromOperationName);
|
|
265
|
+
}
|
|
266
|
+
const fromResourceName = getValueByPath(fromObject, ['resourceName']);
|
|
267
|
+
if (fromResourceName != null) {
|
|
268
|
+
setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
|
|
269
|
+
}
|
|
270
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
271
|
+
if (fromConfig != null) {
|
|
272
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
273
|
+
}
|
|
274
|
+
return toObject;
|
|
275
|
+
}
|
|
276
|
+
function getOperationParametersToVertex(fromObject) {
|
|
277
|
+
const toObject = {};
|
|
278
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
279
|
+
'operationName',
|
|
280
|
+
]);
|
|
281
|
+
if (fromOperationName != null) {
|
|
282
|
+
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
283
|
+
}
|
|
284
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
285
|
+
if (fromConfig != null) {
|
|
286
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
287
|
+
}
|
|
288
|
+
return toObject;
|
|
289
|
+
}
|
|
290
|
+
function videoFromMldev$1(fromObject) {
|
|
291
|
+
const toObject = {};
|
|
292
|
+
const fromUri = getValueByPath(fromObject, ['video', 'uri']);
|
|
293
|
+
if (fromUri != null) {
|
|
294
|
+
setValueByPath(toObject, ['uri'], fromUri);
|
|
295
|
+
}
|
|
296
|
+
const fromVideoBytes = getValueByPath(fromObject, [
|
|
297
|
+
'video',
|
|
298
|
+
'encodedVideo',
|
|
299
|
+
]);
|
|
300
|
+
if (fromVideoBytes != null) {
|
|
301
|
+
setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
|
|
302
|
+
}
|
|
303
|
+
const fromMimeType = getValueByPath(fromObject, ['encoding']);
|
|
304
|
+
if (fromMimeType != null) {
|
|
305
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
306
|
+
}
|
|
307
|
+
return toObject;
|
|
308
|
+
}
|
|
309
|
+
function generatedVideoFromMldev$1(fromObject) {
|
|
310
|
+
const toObject = {};
|
|
311
|
+
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
312
|
+
if (fromVideo != null) {
|
|
313
|
+
setValueByPath(toObject, ['video'], videoFromMldev$1(fromVideo));
|
|
314
|
+
}
|
|
315
|
+
return toObject;
|
|
316
|
+
}
|
|
317
|
+
function generateVideosResponseFromMldev$1(fromObject) {
|
|
318
|
+
const toObject = {};
|
|
319
|
+
const fromGeneratedVideos = getValueByPath(fromObject, [
|
|
320
|
+
'generatedSamples',
|
|
321
|
+
]);
|
|
322
|
+
if (fromGeneratedVideos != null) {
|
|
323
|
+
let transformedList = fromGeneratedVideos;
|
|
324
|
+
if (Array.isArray(transformedList)) {
|
|
325
|
+
transformedList = transformedList.map((item) => {
|
|
326
|
+
return generatedVideoFromMldev$1(item);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
330
|
+
}
|
|
331
|
+
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
332
|
+
'raiMediaFilteredCount',
|
|
333
|
+
]);
|
|
334
|
+
if (fromRaiMediaFilteredCount != null) {
|
|
335
|
+
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
336
|
+
}
|
|
337
|
+
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
338
|
+
'raiMediaFilteredReasons',
|
|
339
|
+
]);
|
|
340
|
+
if (fromRaiMediaFilteredReasons != null) {
|
|
341
|
+
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
342
|
+
}
|
|
343
|
+
return toObject;
|
|
344
|
+
}
|
|
345
|
+
function generateVideosOperationFromMldev$1(fromObject) {
|
|
346
|
+
const toObject = {};
|
|
347
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
348
|
+
if (fromName != null) {
|
|
349
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
350
|
+
}
|
|
351
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
352
|
+
if (fromMetadata != null) {
|
|
353
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
354
|
+
}
|
|
355
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
356
|
+
if (fromDone != null) {
|
|
357
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
358
|
+
}
|
|
359
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
360
|
+
if (fromError != null) {
|
|
361
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
362
|
+
}
|
|
363
|
+
const fromResponse = getValueByPath(fromObject, [
|
|
364
|
+
'response',
|
|
365
|
+
'generateVideoResponse',
|
|
366
|
+
]);
|
|
367
|
+
if (fromResponse != null) {
|
|
368
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(fromResponse));
|
|
369
|
+
}
|
|
370
|
+
return toObject;
|
|
371
|
+
}
|
|
372
|
+
function videoFromVertex$1(fromObject) {
|
|
373
|
+
const toObject = {};
|
|
374
|
+
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
375
|
+
if (fromUri != null) {
|
|
376
|
+
setValueByPath(toObject, ['uri'], fromUri);
|
|
377
|
+
}
|
|
378
|
+
const fromVideoBytes = getValueByPath(fromObject, [
|
|
379
|
+
'bytesBase64Encoded',
|
|
380
|
+
]);
|
|
381
|
+
if (fromVideoBytes != null) {
|
|
382
|
+
setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
|
|
383
|
+
}
|
|
384
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
385
|
+
if (fromMimeType != null) {
|
|
386
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
387
|
+
}
|
|
388
|
+
return toObject;
|
|
389
|
+
}
|
|
390
|
+
function generatedVideoFromVertex$1(fromObject) {
|
|
391
|
+
const toObject = {};
|
|
392
|
+
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
393
|
+
if (fromVideo != null) {
|
|
394
|
+
setValueByPath(toObject, ['video'], videoFromVertex$1(fromVideo));
|
|
395
|
+
}
|
|
396
|
+
return toObject;
|
|
397
|
+
}
|
|
398
|
+
function generateVideosResponseFromVertex$1(fromObject) {
|
|
399
|
+
const toObject = {};
|
|
400
|
+
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
401
|
+
if (fromGeneratedVideos != null) {
|
|
402
|
+
let transformedList = fromGeneratedVideos;
|
|
403
|
+
if (Array.isArray(transformedList)) {
|
|
404
|
+
transformedList = transformedList.map((item) => {
|
|
405
|
+
return generatedVideoFromVertex$1(item);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
409
|
+
}
|
|
410
|
+
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
411
|
+
'raiMediaFilteredCount',
|
|
412
|
+
]);
|
|
413
|
+
if (fromRaiMediaFilteredCount != null) {
|
|
414
|
+
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
415
|
+
}
|
|
416
|
+
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
417
|
+
'raiMediaFilteredReasons',
|
|
418
|
+
]);
|
|
419
|
+
if (fromRaiMediaFilteredReasons != null) {
|
|
420
|
+
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
421
|
+
}
|
|
422
|
+
return toObject;
|
|
423
|
+
}
|
|
424
|
+
function generateVideosOperationFromVertex$1(fromObject) {
|
|
425
|
+
const toObject = {};
|
|
426
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
427
|
+
if (fromName != null) {
|
|
428
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
429
|
+
}
|
|
430
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
431
|
+
if (fromMetadata != null) {
|
|
432
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
433
|
+
}
|
|
434
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
435
|
+
if (fromDone != null) {
|
|
436
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
437
|
+
}
|
|
438
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
439
|
+
if (fromError != null) {
|
|
440
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
441
|
+
}
|
|
442
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
443
|
+
if (fromResponse != null) {
|
|
444
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(fromResponse));
|
|
445
|
+
}
|
|
446
|
+
return toObject;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* @license
|
|
451
|
+
* Copyright 2025 Google LLC
|
|
452
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
453
|
+
*/
|
|
235
454
|
/** Required. Outcome of the code execution. */
|
|
236
455
|
exports.Outcome = void 0;
|
|
237
456
|
(function (Outcome) {
|
|
@@ -1623,54 +1842,15 @@ class GenerateVideosOperation {
|
|
|
1623
1842
|
*/
|
|
1624
1843
|
_fromAPIResponse({ apiResponse, isVertexAI, }) {
|
|
1625
1844
|
const operation = new GenerateVideosOperation();
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
operation.done = apiResponse['done'];
|
|
1629
|
-
operation.error = apiResponse['error'];
|
|
1845
|
+
let response;
|
|
1846
|
+
const op = apiResponse;
|
|
1630
1847
|
if (isVertexAI) {
|
|
1631
|
-
|
|
1632
|
-
if (response) {
|
|
1633
|
-
const operationResponse = new GenerateVideosResponse();
|
|
1634
|
-
const responseVideos = response['videos'];
|
|
1635
|
-
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1636
|
-
return {
|
|
1637
|
-
video: {
|
|
1638
|
-
uri: generatedVideo['gcsUri'],
|
|
1639
|
-
videoBytes: generatedVideo['bytesBase64Encoded']
|
|
1640
|
-
? tBytes$1(generatedVideo['bytesBase64Encoded'])
|
|
1641
|
-
: undefined,
|
|
1642
|
-
mimeType: generatedVideo['mimeType'],
|
|
1643
|
-
},
|
|
1644
|
-
};
|
|
1645
|
-
});
|
|
1646
|
-
operationResponse.raiMediaFilteredCount = response['raiMediaFilteredCount'];
|
|
1647
|
-
operationResponse.raiMediaFilteredReasons = response['raiMediaFilteredReasons'];
|
|
1648
|
-
operation.response = operationResponse;
|
|
1649
|
-
}
|
|
1848
|
+
response = generateVideosOperationFromVertex$1(op);
|
|
1650
1849
|
}
|
|
1651
1850
|
else {
|
|
1652
|
-
|
|
1653
|
-
if (response) {
|
|
1654
|
-
const operationResponse = new GenerateVideosResponse();
|
|
1655
|
-
const generatedVideoResponse = response['generateVideoResponse'];
|
|
1656
|
-
const responseVideos = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['generatedSamples'];
|
|
1657
|
-
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1658
|
-
const video = generatedVideo['video'];
|
|
1659
|
-
return {
|
|
1660
|
-
video: {
|
|
1661
|
-
uri: video === null || video === void 0 ? void 0 : video['uri'],
|
|
1662
|
-
videoBytes: (video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1663
|
-
? tBytes$1(video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1664
|
-
: undefined,
|
|
1665
|
-
mimeType: generatedVideo['encoding'],
|
|
1666
|
-
},
|
|
1667
|
-
};
|
|
1668
|
-
});
|
|
1669
|
-
operationResponse.raiMediaFilteredCount = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredCount'];
|
|
1670
|
-
operationResponse.raiMediaFilteredReasons = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredReasons'];
|
|
1671
|
-
operation.response = operationResponse;
|
|
1672
|
-
}
|
|
1851
|
+
response = generateVideosOperationFromMldev$1(op);
|
|
1673
1852
|
}
|
|
1853
|
+
Object.assign(operation, response);
|
|
1674
1854
|
return operation;
|
|
1675
1855
|
}
|
|
1676
1856
|
}
|
|
@@ -1694,6 +1874,12 @@ class DeleteFileResponse {
|
|
|
1694
1874
|
/** Config for `inlined_responses` parameter. */
|
|
1695
1875
|
class InlinedResponse {
|
|
1696
1876
|
}
|
|
1877
|
+
/** Config for `response` parameter. */
|
|
1878
|
+
class SingleEmbedContentResponse {
|
|
1879
|
+
}
|
|
1880
|
+
/** Config for `inlined_embedding_responses` parameter. */
|
|
1881
|
+
class InlinedEmbedContentResponse {
|
|
1882
|
+
}
|
|
1697
1883
|
/** Config for batches.list return value. */
|
|
1698
1884
|
class ListBatchJobsResponse {
|
|
1699
1885
|
}
|
|
@@ -2545,51 +2731,59 @@ function mcpToolsToGeminiTool(mcpTools, config = {}) {
|
|
|
2545
2731
|
return { functionDeclarations: functionDeclarations };
|
|
2546
2732
|
}
|
|
2547
2733
|
// Transforms a source input into a BatchJobSource object with validation.
|
|
2548
|
-
function tBatchJobSource(
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2734
|
+
function tBatchJobSource(client, src) {
|
|
2735
|
+
let sourceObj;
|
|
2736
|
+
if (typeof src === 'string') {
|
|
2737
|
+
if (client.isVertexAI()) {
|
|
2738
|
+
if (src.startsWith('gs://')) {
|
|
2739
|
+
sourceObj = { format: 'jsonl', gcsUri: [src] };
|
|
2740
|
+
}
|
|
2741
|
+
else if (src.startsWith('bq://')) {
|
|
2742
|
+
sourceObj = { format: 'bigquery', bigqueryUri: src };
|
|
2553
2743
|
}
|
|
2554
|
-
else
|
|
2555
|
-
throw new Error(
|
|
2744
|
+
else {
|
|
2745
|
+
throw new Error(`Unsupported string source for Vertex AI: ${src}`);
|
|
2556
2746
|
}
|
|
2557
2747
|
}
|
|
2558
2748
|
else {
|
|
2559
|
-
//
|
|
2560
|
-
if (src.
|
|
2561
|
-
|
|
2749
|
+
// MLDEV
|
|
2750
|
+
if (src.startsWith('files/')) {
|
|
2751
|
+
sourceObj = { fileName: src }; // Default to fileName for string input
|
|
2562
2752
|
}
|
|
2563
|
-
else
|
|
2564
|
-
throw new Error(
|
|
2753
|
+
else {
|
|
2754
|
+
throw new Error(`Unsupported string source for Gemini API: ${src}`);
|
|
2565
2755
|
}
|
|
2566
2756
|
}
|
|
2567
|
-
return src;
|
|
2568
2757
|
}
|
|
2569
|
-
// If src is an array (list in Python)
|
|
2570
2758
|
else if (Array.isArray(src)) {
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
else if (typeof src === 'string') {
|
|
2574
|
-
if (src.startsWith('gs://')) {
|
|
2575
|
-
return {
|
|
2576
|
-
format: 'jsonl',
|
|
2577
|
-
gcsUri: [src], // GCS URI is expected as an array
|
|
2578
|
-
};
|
|
2759
|
+
if (client.isVertexAI()) {
|
|
2760
|
+
throw new Error('InlinedRequest[] is not supported in Vertex AI.');
|
|
2579
2761
|
}
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2762
|
+
sourceObj = { inlinedRequests: src };
|
|
2763
|
+
}
|
|
2764
|
+
else {
|
|
2765
|
+
// It's already a BatchJobSource object
|
|
2766
|
+
sourceObj = src;
|
|
2767
|
+
}
|
|
2768
|
+
// Validation logic
|
|
2769
|
+
const vertexSourcesCount = [sourceObj.gcsUri, sourceObj.bigqueryUri].filter(Boolean).length;
|
|
2770
|
+
const mldevSourcesCount = [
|
|
2771
|
+
sourceObj.inlinedRequests,
|
|
2772
|
+
sourceObj.fileName,
|
|
2773
|
+
].filter(Boolean).length;
|
|
2774
|
+
if (client.isVertexAI()) {
|
|
2775
|
+
if (mldevSourcesCount > 0 || vertexSourcesCount !== 1) {
|
|
2776
|
+
throw new Error('Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.');
|
|
2585
2777
|
}
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2778
|
+
}
|
|
2779
|
+
else {
|
|
2780
|
+
// MLDEV
|
|
2781
|
+
if (vertexSourcesCount > 0 || mldevSourcesCount !== 1) {
|
|
2782
|
+
throw new Error('Exactly one of `inlinedRequests`, `fileName`, ' +
|
|
2783
|
+
'must be set for Gemini API.');
|
|
2590
2784
|
}
|
|
2591
2785
|
}
|
|
2592
|
-
|
|
2786
|
+
return sourceObj;
|
|
2593
2787
|
}
|
|
2594
2788
|
function tBatchJobDestination(dest) {
|
|
2595
2789
|
if (typeof dest !== 'string') {
|
|
@@ -2612,6 +2806,52 @@ function tBatchJobDestination(dest) {
|
|
|
2612
2806
|
throw new Error(`Unsupported destination: ${destString}`);
|
|
2613
2807
|
}
|
|
2614
2808
|
}
|
|
2809
|
+
function tRecvBatchJobDestination(dest) {
|
|
2810
|
+
// Ensure dest is a non-null object before proceeding.
|
|
2811
|
+
if (typeof dest !== 'object' || dest === null) {
|
|
2812
|
+
// If the input is not an object, it cannot be a valid BatchJobDestination
|
|
2813
|
+
// based on the operations performed. Return it cast, or handle as an error.
|
|
2814
|
+
// Casting an empty object might be a safe default.
|
|
2815
|
+
return {};
|
|
2816
|
+
}
|
|
2817
|
+
// Cast to Record<string, unknown> to allow string property access.
|
|
2818
|
+
const obj = dest;
|
|
2819
|
+
// Safely access nested properties.
|
|
2820
|
+
const inlineResponsesVal = obj['inlinedResponses'];
|
|
2821
|
+
if (typeof inlineResponsesVal !== 'object' || inlineResponsesVal === null) {
|
|
2822
|
+
return dest;
|
|
2823
|
+
}
|
|
2824
|
+
const inlineResponsesObj = inlineResponsesVal;
|
|
2825
|
+
const responsesArray = inlineResponsesObj['inlinedResponses'];
|
|
2826
|
+
if (!Array.isArray(responsesArray) || responsesArray.length === 0) {
|
|
2827
|
+
return dest;
|
|
2828
|
+
}
|
|
2829
|
+
// Check if any response has the 'embedding' property.
|
|
2830
|
+
let hasEmbedding = false;
|
|
2831
|
+
for (const responseItem of responsesArray) {
|
|
2832
|
+
if (typeof responseItem !== 'object' || responseItem === null) {
|
|
2833
|
+
continue;
|
|
2834
|
+
}
|
|
2835
|
+
const responseItemObj = responseItem;
|
|
2836
|
+
const responseVal = responseItemObj['response'];
|
|
2837
|
+
if (typeof responseVal !== 'object' || responseVal === null) {
|
|
2838
|
+
continue;
|
|
2839
|
+
}
|
|
2840
|
+
const responseObj = responseVal;
|
|
2841
|
+
// Check for the existence of the 'embedding' key.
|
|
2842
|
+
if (responseObj['embedding'] !== undefined) {
|
|
2843
|
+
hasEmbedding = true;
|
|
2844
|
+
break;
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
// Perform the transformation if an embedding was found.
|
|
2848
|
+
if (hasEmbedding) {
|
|
2849
|
+
obj['inlinedEmbedContentResponses'] = obj['inlinedResponses'];
|
|
2850
|
+
delete obj['inlinedResponses'];
|
|
2851
|
+
}
|
|
2852
|
+
// Cast the (potentially) modified object to the target type.
|
|
2853
|
+
return dest;
|
|
2854
|
+
}
|
|
2615
2855
|
function tBatchJobName(apiClient, name) {
|
|
2616
2856
|
const nameString = name;
|
|
2617
2857
|
if (!apiClient.isVertexAI()) {
|
|
@@ -2707,6 +2947,22 @@ function fileDataToMldev$4(fromObject) {
|
|
|
2707
2947
|
}
|
|
2708
2948
|
return toObject;
|
|
2709
2949
|
}
|
|
2950
|
+
function functionCallToMldev$4(fromObject) {
|
|
2951
|
+
const toObject = {};
|
|
2952
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
2953
|
+
if (fromId != null) {
|
|
2954
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
2955
|
+
}
|
|
2956
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
2957
|
+
if (fromArgs != null) {
|
|
2958
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
2959
|
+
}
|
|
2960
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
2961
|
+
if (fromName != null) {
|
|
2962
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
2963
|
+
}
|
|
2964
|
+
return toObject;
|
|
2965
|
+
}
|
|
2710
2966
|
function partToMldev$4(fromObject) {
|
|
2711
2967
|
const toObject = {};
|
|
2712
2968
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -2733,6 +2989,10 @@ function partToMldev$4(fromObject) {
|
|
|
2733
2989
|
if (fromThoughtSignature != null) {
|
|
2734
2990
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2735
2991
|
}
|
|
2992
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2993
|
+
if (fromFunctionCall != null) {
|
|
2994
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
|
|
2995
|
+
}
|
|
2736
2996
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2737
2997
|
'codeExecutionResult',
|
|
2738
2998
|
]);
|
|
@@ -2745,10 +3005,6 @@ function partToMldev$4(fromObject) {
|
|
|
2745
3005
|
if (fromExecutableCode != null) {
|
|
2746
3006
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
2747
3007
|
}
|
|
2748
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2749
|
-
if (fromFunctionCall != null) {
|
|
2750
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
2751
|
-
}
|
|
2752
3008
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
2753
3009
|
'functionResponse',
|
|
2754
3010
|
]);
|
|
@@ -3373,18 +3629,92 @@ function batchJobSourceToMldev(apiClient, fromObject) {
|
|
|
3373
3629
|
}
|
|
3374
3630
|
return toObject;
|
|
3375
3631
|
}
|
|
3376
|
-
function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3632
|
+
function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3633
|
+
const toObject = {};
|
|
3634
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3635
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3636
|
+
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3637
|
+
}
|
|
3638
|
+
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
3639
|
+
throw new Error('dest parameter is not supported in Gemini API.');
|
|
3640
|
+
}
|
|
3641
|
+
return toObject;
|
|
3642
|
+
}
|
|
3643
|
+
function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3644
|
+
const toObject = {};
|
|
3645
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3646
|
+
if (fromModel != null) {
|
|
3647
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3648
|
+
}
|
|
3649
|
+
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3650
|
+
if (fromSrc != null) {
|
|
3651
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], batchJobSourceToMldev(apiClient, tBatchJobSource(apiClient, fromSrc)));
|
|
3652
|
+
}
|
|
3653
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3654
|
+
if (fromConfig != null) {
|
|
3655
|
+
setValueByPath(toObject, ['config'], createBatchJobConfigToMldev(fromConfig, toObject));
|
|
3656
|
+
}
|
|
3657
|
+
return toObject;
|
|
3658
|
+
}
|
|
3659
|
+
function embedContentConfigToMldev$1(fromObject, parentObject) {
|
|
3660
|
+
const toObject = {};
|
|
3661
|
+
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
3662
|
+
if (parentObject !== undefined && fromTaskType != null) {
|
|
3663
|
+
setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
|
|
3664
|
+
}
|
|
3665
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3666
|
+
if (parentObject !== undefined && fromTitle != null) {
|
|
3667
|
+
setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
|
|
3668
|
+
}
|
|
3669
|
+
const fromOutputDimensionality = getValueByPath(fromObject, [
|
|
3670
|
+
'outputDimensionality',
|
|
3671
|
+
]);
|
|
3672
|
+
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
3673
|
+
setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
|
|
3674
|
+
}
|
|
3675
|
+
if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
|
|
3676
|
+
throw new Error('mimeType parameter is not supported in Gemini API.');
|
|
3677
|
+
}
|
|
3678
|
+
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
3679
|
+
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
3680
|
+
}
|
|
3681
|
+
return toObject;
|
|
3682
|
+
}
|
|
3683
|
+
function embedContentBatchToMldev(apiClient, fromObject) {
|
|
3684
|
+
const toObject = {};
|
|
3685
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3686
|
+
if (fromContents != null) {
|
|
3687
|
+
setValueByPath(toObject, ['requests[]', 'request', 'content'], tContentsForEmbed(apiClient, fromContents));
|
|
3688
|
+
}
|
|
3689
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3690
|
+
if (fromConfig != null) {
|
|
3691
|
+
setValueByPath(toObject, ['config'], embedContentConfigToMldev$1(fromConfig, toObject));
|
|
3692
|
+
}
|
|
3693
|
+
return toObject;
|
|
3694
|
+
}
|
|
3695
|
+
function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
|
|
3696
|
+
const toObject = {};
|
|
3697
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
3698
|
+
if (fromFileName != null) {
|
|
3699
|
+
setValueByPath(toObject, ['file_name'], fromFileName);
|
|
3700
|
+
}
|
|
3701
|
+
const fromInlinedRequests = getValueByPath(fromObject, [
|
|
3702
|
+
'inlinedRequests',
|
|
3703
|
+
]);
|
|
3704
|
+
if (fromInlinedRequests != null) {
|
|
3705
|
+
setValueByPath(toObject, ['requests'], embedContentBatchToMldev(apiClient, fromInlinedRequests));
|
|
3706
|
+
}
|
|
3707
|
+
return toObject;
|
|
3708
|
+
}
|
|
3709
|
+
function createEmbeddingsBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3377
3710
|
const toObject = {};
|
|
3378
3711
|
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3379
3712
|
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3380
3713
|
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3381
3714
|
}
|
|
3382
|
-
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
3383
|
-
throw new Error('dest parameter is not supported in Gemini API.');
|
|
3384
|
-
}
|
|
3385
3715
|
return toObject;
|
|
3386
3716
|
}
|
|
3387
|
-
function
|
|
3717
|
+
function createEmbeddingsBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3388
3718
|
const toObject = {};
|
|
3389
3719
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3390
3720
|
if (fromModel != null) {
|
|
@@ -3392,11 +3722,11 @@ function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
|
3392
3722
|
}
|
|
3393
3723
|
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3394
3724
|
if (fromSrc != null) {
|
|
3395
|
-
setValueByPath(toObject, ['batch', 'inputConfig'],
|
|
3725
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], embeddingsBatchJobSourceToMldev(apiClient, fromSrc));
|
|
3396
3726
|
}
|
|
3397
3727
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3398
3728
|
if (fromConfig != null) {
|
|
3399
|
-
setValueByPath(toObject, ['config'],
|
|
3729
|
+
setValueByPath(toObject, ['config'], createEmbeddingsBatchJobConfigToMldev(fromConfig, toObject));
|
|
3400
3730
|
}
|
|
3401
3731
|
return toObject;
|
|
3402
3732
|
}
|
|
@@ -3501,6 +3831,10 @@ function batchJobDestinationToVertex(fromObject) {
|
|
|
3501
3831
|
if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
|
|
3502
3832
|
throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
|
|
3503
3833
|
}
|
|
3834
|
+
if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
|
|
3835
|
+
undefined) {
|
|
3836
|
+
throw new Error('inlinedEmbedContentResponses parameter is not supported in Vertex AI.');
|
|
3837
|
+
}
|
|
3504
3838
|
return toObject;
|
|
3505
3839
|
}
|
|
3506
3840
|
function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -3631,6 +3965,22 @@ function fileDataFromMldev$2(fromObject) {
|
|
|
3631
3965
|
}
|
|
3632
3966
|
return toObject;
|
|
3633
3967
|
}
|
|
3968
|
+
function functionCallFromMldev$2(fromObject) {
|
|
3969
|
+
const toObject = {};
|
|
3970
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
3971
|
+
if (fromId != null) {
|
|
3972
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
3973
|
+
}
|
|
3974
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
3975
|
+
if (fromArgs != null) {
|
|
3976
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
3977
|
+
}
|
|
3978
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3979
|
+
if (fromName != null) {
|
|
3980
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3981
|
+
}
|
|
3982
|
+
return toObject;
|
|
3983
|
+
}
|
|
3634
3984
|
function partFromMldev$2(fromObject) {
|
|
3635
3985
|
const toObject = {};
|
|
3636
3986
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -3657,6 +4007,10 @@ function partFromMldev$2(fromObject) {
|
|
|
3657
4007
|
if (fromThoughtSignature != null) {
|
|
3658
4008
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
3659
4009
|
}
|
|
4010
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4011
|
+
if (fromFunctionCall != null) {
|
|
4012
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$2(fromFunctionCall));
|
|
4013
|
+
}
|
|
3660
4014
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3661
4015
|
'codeExecutionResult',
|
|
3662
4016
|
]);
|
|
@@ -3669,10 +4023,6 @@ function partFromMldev$2(fromObject) {
|
|
|
3669
4023
|
if (fromExecutableCode != null) {
|
|
3670
4024
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
3671
4025
|
}
|
|
3672
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3673
|
-
if (fromFunctionCall != null) {
|
|
3674
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3675
|
-
}
|
|
3676
4026
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
3677
4027
|
'functionResponse',
|
|
3678
4028
|
]);
|
|
@@ -3861,6 +4211,38 @@ function inlinedResponseFromMldev(fromObject) {
|
|
|
3861
4211
|
}
|
|
3862
4212
|
return toObject;
|
|
3863
4213
|
}
|
|
4214
|
+
function contentEmbeddingFromMldev$1(fromObject) {
|
|
4215
|
+
const toObject = {};
|
|
4216
|
+
const fromValues = getValueByPath(fromObject, ['values']);
|
|
4217
|
+
if (fromValues != null) {
|
|
4218
|
+
setValueByPath(toObject, ['values'], fromValues);
|
|
4219
|
+
}
|
|
4220
|
+
return toObject;
|
|
4221
|
+
}
|
|
4222
|
+
function singleEmbedContentResponseFromMldev(fromObject) {
|
|
4223
|
+
const toObject = {};
|
|
4224
|
+
const fromEmbedding = getValueByPath(fromObject, ['embedding']);
|
|
4225
|
+
if (fromEmbedding != null) {
|
|
4226
|
+
setValueByPath(toObject, ['embedding'], contentEmbeddingFromMldev$1(fromEmbedding));
|
|
4227
|
+
}
|
|
4228
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
4229
|
+
if (fromTokenCount != null) {
|
|
4230
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
4231
|
+
}
|
|
4232
|
+
return toObject;
|
|
4233
|
+
}
|
|
4234
|
+
function inlinedEmbedContentResponseFromMldev(fromObject) {
|
|
4235
|
+
const toObject = {};
|
|
4236
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
4237
|
+
if (fromResponse != null) {
|
|
4238
|
+
setValueByPath(toObject, ['response'], singleEmbedContentResponseFromMldev(fromResponse));
|
|
4239
|
+
}
|
|
4240
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
4241
|
+
if (fromError != null) {
|
|
4242
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev(fromError));
|
|
4243
|
+
}
|
|
4244
|
+
return toObject;
|
|
4245
|
+
}
|
|
3864
4246
|
function batchJobDestinationFromMldev(fromObject) {
|
|
3865
4247
|
const toObject = {};
|
|
3866
4248
|
const fromFileName = getValueByPath(fromObject, ['responsesFile']);
|
|
@@ -3880,6 +4262,19 @@ function batchJobDestinationFromMldev(fromObject) {
|
|
|
3880
4262
|
}
|
|
3881
4263
|
setValueByPath(toObject, ['inlinedResponses'], transformedList);
|
|
3882
4264
|
}
|
|
4265
|
+
const fromInlinedEmbedContentResponses = getValueByPath(fromObject, [
|
|
4266
|
+
'inlinedEmbedContentResponses',
|
|
4267
|
+
'inlinedResponses',
|
|
4268
|
+
]);
|
|
4269
|
+
if (fromInlinedEmbedContentResponses != null) {
|
|
4270
|
+
let transformedList = fromInlinedEmbedContentResponses;
|
|
4271
|
+
if (Array.isArray(transformedList)) {
|
|
4272
|
+
transformedList = transformedList.map((item) => {
|
|
4273
|
+
return inlinedEmbedContentResponseFromMldev(item);
|
|
4274
|
+
});
|
|
4275
|
+
}
|
|
4276
|
+
setValueByPath(toObject, ['inlinedEmbedContentResponses'], transformedList);
|
|
4277
|
+
}
|
|
3883
4278
|
return toObject;
|
|
3884
4279
|
}
|
|
3885
4280
|
function batchJobFromMldev(fromObject) {
|
|
@@ -3926,7 +4321,7 @@ function batchJobFromMldev(fromObject) {
|
|
|
3926
4321
|
}
|
|
3927
4322
|
const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
|
|
3928
4323
|
if (fromDest != null) {
|
|
3929
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
|
|
4324
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(tRecvBatchJobDestination(fromDest)));
|
|
3930
4325
|
}
|
|
3931
4326
|
return toObject;
|
|
3932
4327
|
}
|
|
@@ -4079,7 +4474,7 @@ function batchJobFromVertex(fromObject) {
|
|
|
4079
4474
|
}
|
|
4080
4475
|
const fromDest = getValueByPath(fromObject, ['outputConfig']);
|
|
4081
4476
|
if (fromDest != null) {
|
|
4082
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
|
|
4477
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
|
|
4083
4478
|
}
|
|
4084
4479
|
return toObject;
|
|
4085
4480
|
}
|
|
@@ -4345,79 +4740,87 @@ class Batches extends BaseModule {
|
|
|
4345
4740
|
this.create = async (params) => {
|
|
4346
4741
|
var _a, _b;
|
|
4347
4742
|
if (this.apiClient.isVertexAI()) {
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
'Google Cloud Storage URI or BigQuery URI instead.');
|
|
4353
|
-
}
|
|
4354
|
-
params.config = params.config || {};
|
|
4355
|
-
if (params.config.displayName === undefined) {
|
|
4356
|
-
params.config.displayName = 'genaiBatchJob_${timestampStr}';
|
|
4357
|
-
}
|
|
4358
|
-
if (params.config.dest === undefined && typeof params.src === 'string') {
|
|
4359
|
-
if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
|
|
4360
|
-
params.config.dest = `${params.src.slice(0, -6)}/dest`;
|
|
4361
|
-
}
|
|
4362
|
-
else if (params.src.startsWith('bq://')) {
|
|
4363
|
-
params.config.dest =
|
|
4364
|
-
`${params.src}_dest_${timestampStr}`;
|
|
4365
|
-
}
|
|
4366
|
-
else {
|
|
4367
|
-
throw new Error('Unsupported source:' + params.src);
|
|
4368
|
-
}
|
|
4369
|
-
}
|
|
4743
|
+
// Format destination if not provided
|
|
4744
|
+
// Cast params.src as Vertex AI path does not handle InlinedRequest[]
|
|
4745
|
+
params.config = this.formatDestination(params.src, params.config);
|
|
4746
|
+
return this.createInternal(params);
|
|
4370
4747
|
}
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4748
|
+
// MLDEV
|
|
4749
|
+
const src = params.src;
|
|
4750
|
+
const is_inlined = Array.isArray(params.src) || src.inlinedRequests !== undefined;
|
|
4751
|
+
if (!is_inlined) {
|
|
4752
|
+
return this.createInternal(params);
|
|
4753
|
+
}
|
|
4754
|
+
// Inlined generate content requests handling
|
|
4755
|
+
const result = this.createInlinedGenerateContentRequest(params);
|
|
4756
|
+
const path = result.path;
|
|
4757
|
+
const requestBody = result.body;
|
|
4758
|
+
const queryParams = createBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4759
|
+
const response = this.apiClient
|
|
4760
|
+
.request({
|
|
4761
|
+
path: path,
|
|
4762
|
+
queryParams: queryParams,
|
|
4763
|
+
body: JSON.stringify(requestBody),
|
|
4764
|
+
httpMethod: 'POST',
|
|
4765
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4766
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4767
|
+
})
|
|
4768
|
+
.then((httpResponse) => {
|
|
4769
|
+
return httpResponse.json();
|
|
4770
|
+
});
|
|
4771
|
+
return response.then((apiResponse) => {
|
|
4772
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4773
|
+
return resp;
|
|
4774
|
+
});
|
|
4775
|
+
};
|
|
4776
|
+
/**
|
|
4777
|
+
* **Experimental** Creates an embedding batch job.
|
|
4778
|
+
*
|
|
4779
|
+
* @param params - The parameters for create embedding batch job request.
|
|
4780
|
+
* @return The created batch job.
|
|
4781
|
+
*
|
|
4782
|
+
* @example
|
|
4783
|
+
* ```ts
|
|
4784
|
+
* const response = await ai.batches.createEmbeddings({
|
|
4785
|
+
* model: 'text-embedding-004',
|
|
4786
|
+
* src: {fileName: 'files/my_embedding_input'},
|
|
4787
|
+
* });
|
|
4788
|
+
* console.log(response);
|
|
4789
|
+
* ```
|
|
4790
|
+
*/
|
|
4791
|
+
this.createEmbeddings = async (params) => {
|
|
4792
|
+
var _a, _b;
|
|
4793
|
+
console.warn('batches.createEmbeddings() is experimental and may change without notice.');
|
|
4794
|
+
if (this.apiClient.isVertexAI()) {
|
|
4795
|
+
throw new Error('Vertex AI does not support batches.createEmbeddings.');
|
|
4796
|
+
}
|
|
4797
|
+
// MLDEV
|
|
4798
|
+
const src = params.src;
|
|
4799
|
+
const is_inlined = src.inlinedRequests !== undefined;
|
|
4800
|
+
if (!is_inlined) {
|
|
4801
|
+
return this.createEmbeddingsInternal(params); // Fixed typo here
|
|
4419
4802
|
}
|
|
4420
|
-
|
|
4803
|
+
// Inlined embed content requests handling
|
|
4804
|
+
const result = this.createInlinedEmbedContentRequest(params);
|
|
4805
|
+
const path = result.path;
|
|
4806
|
+
const requestBody = result.body;
|
|
4807
|
+
const queryParams = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4808
|
+
const response = this.apiClient
|
|
4809
|
+
.request({
|
|
4810
|
+
path: path,
|
|
4811
|
+
queryParams: queryParams,
|
|
4812
|
+
body: JSON.stringify(requestBody),
|
|
4813
|
+
httpMethod: 'POST',
|
|
4814
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4815
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4816
|
+
})
|
|
4817
|
+
.then((httpResponse) => {
|
|
4818
|
+
return httpResponse.json();
|
|
4819
|
+
});
|
|
4820
|
+
return response.then((apiResponse) => {
|
|
4821
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4822
|
+
return resp;
|
|
4823
|
+
});
|
|
4421
4824
|
};
|
|
4422
4825
|
/**
|
|
4423
4826
|
* Lists batch job configurations.
|
|
@@ -4437,6 +4840,112 @@ class Batches extends BaseModule {
|
|
|
4437
4840
|
return new Pager(exports.PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4438
4841
|
};
|
|
4439
4842
|
}
|
|
4843
|
+
// Helper function to handle inlined generate content requests
|
|
4844
|
+
createInlinedGenerateContentRequest(params) {
|
|
4845
|
+
const body = createBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4846
|
+
params);
|
|
4847
|
+
const urlParams = body['_url'];
|
|
4848
|
+
const path = formatMap('{model}:batchGenerateContent', urlParams);
|
|
4849
|
+
const batch = body['batch'];
|
|
4850
|
+
const inputConfig = batch['inputConfig'];
|
|
4851
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4852
|
+
const requests = requestsWrapper['requests'];
|
|
4853
|
+
const newRequests = [];
|
|
4854
|
+
for (const request of requests) {
|
|
4855
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4856
|
+
if (requestDict['systemInstruction']) {
|
|
4857
|
+
const systemInstructionValue = requestDict['systemInstruction'];
|
|
4858
|
+
delete requestDict['systemInstruction'];
|
|
4859
|
+
const requestContent = requestDict['request'];
|
|
4860
|
+
requestContent['systemInstruction'] = systemInstructionValue;
|
|
4861
|
+
requestDict['request'] = requestContent;
|
|
4862
|
+
}
|
|
4863
|
+
newRequests.push(requestDict);
|
|
4864
|
+
}
|
|
4865
|
+
requestsWrapper['requests'] = newRequests;
|
|
4866
|
+
delete body['config'];
|
|
4867
|
+
delete body['_url'];
|
|
4868
|
+
delete body['_query'];
|
|
4869
|
+
return { path, body };
|
|
4870
|
+
}
|
|
4871
|
+
// Helper function to handle inlined embedding requests
|
|
4872
|
+
createInlinedEmbedContentRequest(params) {
|
|
4873
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4874
|
+
params);
|
|
4875
|
+
const urlParams = body['_url'];
|
|
4876
|
+
const path = formatMap('{model}:asyncBatchEmbedContent', urlParams);
|
|
4877
|
+
const batch = body['batch'];
|
|
4878
|
+
const inputConfig = batch['inputConfig'];
|
|
4879
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4880
|
+
const requests = requestsWrapper['requests'];
|
|
4881
|
+
const newRequests = [];
|
|
4882
|
+
delete requestsWrapper['config']; // Remove top-level config
|
|
4883
|
+
for (const request of requests) {
|
|
4884
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4885
|
+
const innerRequest = requestDict['request'];
|
|
4886
|
+
for (const key in requestDict) {
|
|
4887
|
+
if (key !== 'request') {
|
|
4888
|
+
innerRequest[key] = requestDict[key];
|
|
4889
|
+
delete requestDict[key];
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
newRequests.push(requestDict);
|
|
4893
|
+
}
|
|
4894
|
+
requestsWrapper['requests'] = newRequests;
|
|
4895
|
+
delete body['config'];
|
|
4896
|
+
delete body['_url'];
|
|
4897
|
+
delete body['_query'];
|
|
4898
|
+
return { path, body };
|
|
4899
|
+
}
|
|
4900
|
+
// Helper function to get the first GCS URI
|
|
4901
|
+
getGcsUri(src) {
|
|
4902
|
+
if (typeof src === 'string') {
|
|
4903
|
+
return src.startsWith('gs://') ? src : undefined;
|
|
4904
|
+
}
|
|
4905
|
+
if (!Array.isArray(src) && src.gcsUri && src.gcsUri.length > 0) {
|
|
4906
|
+
return src.gcsUri[0];
|
|
4907
|
+
}
|
|
4908
|
+
return undefined;
|
|
4909
|
+
}
|
|
4910
|
+
// Helper function to get the BigQuery URI
|
|
4911
|
+
getBigqueryUri(src) {
|
|
4912
|
+
if (typeof src === 'string') {
|
|
4913
|
+
return src.startsWith('bq://') ? src : undefined;
|
|
4914
|
+
}
|
|
4915
|
+
if (!Array.isArray(src)) {
|
|
4916
|
+
return src.bigqueryUri;
|
|
4917
|
+
}
|
|
4918
|
+
return undefined;
|
|
4919
|
+
}
|
|
4920
|
+
// Function to format the destination configuration for Vertex AI
|
|
4921
|
+
formatDestination(src, config) {
|
|
4922
|
+
const newConfig = config ? Object.assign({}, config) : {};
|
|
4923
|
+
const timestampStr = Date.now().toString();
|
|
4924
|
+
if (!newConfig.displayName) {
|
|
4925
|
+
newConfig.displayName = `genaiBatchJob_${timestampStr}`;
|
|
4926
|
+
}
|
|
4927
|
+
if (newConfig.dest === undefined) {
|
|
4928
|
+
const gcsUri = this.getGcsUri(src);
|
|
4929
|
+
const bigqueryUri = this.getBigqueryUri(src);
|
|
4930
|
+
if (gcsUri) {
|
|
4931
|
+
if (gcsUri.endsWith('.jsonl')) {
|
|
4932
|
+
// For .jsonl files, remove suffix and add /dest
|
|
4933
|
+
newConfig.dest = `${gcsUri.slice(0, -6)}/dest`;
|
|
4934
|
+
}
|
|
4935
|
+
else {
|
|
4936
|
+
// Fallback for other GCS URIs
|
|
4937
|
+
newConfig.dest = `${gcsUri}_dest_${timestampStr}`;
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
4940
|
+
else if (bigqueryUri) {
|
|
4941
|
+
newConfig.dest = `${bigqueryUri}_dest_${timestampStr}`;
|
|
4942
|
+
}
|
|
4943
|
+
else {
|
|
4944
|
+
throw new Error('Unsupported source for Vertex AI: No GCS or BigQuery URI found.');
|
|
4945
|
+
}
|
|
4946
|
+
}
|
|
4947
|
+
return newConfig;
|
|
4948
|
+
}
|
|
4440
4949
|
/**
|
|
4441
4950
|
* Internal method to create batch job.
|
|
4442
4951
|
*
|
|
@@ -4498,6 +5007,46 @@ class Batches extends BaseModule {
|
|
|
4498
5007
|
});
|
|
4499
5008
|
}
|
|
4500
5009
|
}
|
|
5010
|
+
/**
|
|
5011
|
+
* Internal method to create batch job.
|
|
5012
|
+
*
|
|
5013
|
+
* @param params - The parameters for create batch job request.
|
|
5014
|
+
* @return The created batch job.
|
|
5015
|
+
*
|
|
5016
|
+
*/
|
|
5017
|
+
async createEmbeddingsInternal(params) {
|
|
5018
|
+
var _a, _b;
|
|
5019
|
+
let response;
|
|
5020
|
+
let path = '';
|
|
5021
|
+
let queryParams = {};
|
|
5022
|
+
if (this.apiClient.isVertexAI()) {
|
|
5023
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
5024
|
+
}
|
|
5025
|
+
else {
|
|
5026
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params);
|
|
5027
|
+
path = formatMap('{model}:asyncBatchEmbedContent', body['_url']);
|
|
5028
|
+
queryParams = body['_query'];
|
|
5029
|
+
delete body['config'];
|
|
5030
|
+
delete body['_url'];
|
|
5031
|
+
delete body['_query'];
|
|
5032
|
+
response = this.apiClient
|
|
5033
|
+
.request({
|
|
5034
|
+
path: path,
|
|
5035
|
+
queryParams: queryParams,
|
|
5036
|
+
body: JSON.stringify(body),
|
|
5037
|
+
httpMethod: 'POST',
|
|
5038
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
5039
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
5040
|
+
})
|
|
5041
|
+
.then((httpResponse) => {
|
|
5042
|
+
return httpResponse.json();
|
|
5043
|
+
});
|
|
5044
|
+
return response.then((apiResponse) => {
|
|
5045
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
5046
|
+
return resp;
|
|
5047
|
+
});
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
4501
5050
|
/**
|
|
4502
5051
|
* Gets batch job configurations.
|
|
4503
5052
|
*
|
|
@@ -4811,6 +5360,22 @@ function fileDataToMldev$3(fromObject) {
|
|
|
4811
5360
|
}
|
|
4812
5361
|
return toObject;
|
|
4813
5362
|
}
|
|
5363
|
+
function functionCallToMldev$3(fromObject) {
|
|
5364
|
+
const toObject = {};
|
|
5365
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5366
|
+
if (fromId != null) {
|
|
5367
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5368
|
+
}
|
|
5369
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5370
|
+
if (fromArgs != null) {
|
|
5371
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5372
|
+
}
|
|
5373
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5374
|
+
if (fromName != null) {
|
|
5375
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5376
|
+
}
|
|
5377
|
+
return toObject;
|
|
5378
|
+
}
|
|
4814
5379
|
function partToMldev$3(fromObject) {
|
|
4815
5380
|
const toObject = {};
|
|
4816
5381
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -4837,6 +5402,10 @@ function partToMldev$3(fromObject) {
|
|
|
4837
5402
|
if (fromThoughtSignature != null) {
|
|
4838
5403
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
4839
5404
|
}
|
|
5405
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5406
|
+
if (fromFunctionCall != null) {
|
|
5407
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
|
|
5408
|
+
}
|
|
4840
5409
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4841
5410
|
'codeExecutionResult',
|
|
4842
5411
|
]);
|
|
@@ -4849,10 +5418,6 @@ function partToMldev$3(fromObject) {
|
|
|
4849
5418
|
if (fromExecutableCode != null) {
|
|
4850
5419
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4851
5420
|
}
|
|
4852
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4853
|
-
if (fromFunctionCall != null) {
|
|
4854
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4855
|
-
}
|
|
4856
5421
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4857
5422
|
'functionResponse',
|
|
4858
5423
|
]);
|
|
@@ -5260,6 +5825,22 @@ function fileDataToVertex$2(fromObject) {
|
|
|
5260
5825
|
}
|
|
5261
5826
|
return toObject;
|
|
5262
5827
|
}
|
|
5828
|
+
function functionCallToVertex$2(fromObject) {
|
|
5829
|
+
const toObject = {};
|
|
5830
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5831
|
+
if (fromId != null) {
|
|
5832
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5833
|
+
}
|
|
5834
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5835
|
+
if (fromArgs != null) {
|
|
5836
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5837
|
+
}
|
|
5838
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5839
|
+
if (fromName != null) {
|
|
5840
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5841
|
+
}
|
|
5842
|
+
return toObject;
|
|
5843
|
+
}
|
|
5263
5844
|
function partToVertex$2(fromObject) {
|
|
5264
5845
|
const toObject = {};
|
|
5265
5846
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -5286,6 +5867,10 @@ function partToVertex$2(fromObject) {
|
|
|
5286
5867
|
if (fromThoughtSignature != null) {
|
|
5287
5868
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5288
5869
|
}
|
|
5870
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5871
|
+
if (fromFunctionCall != null) {
|
|
5872
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$2(fromFunctionCall));
|
|
5873
|
+
}
|
|
5289
5874
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5290
5875
|
'codeExecutionResult',
|
|
5291
5876
|
]);
|
|
@@ -5298,10 +5883,6 @@ function partToVertex$2(fromObject) {
|
|
|
5298
5883
|
if (fromExecutableCode != null) {
|
|
5299
5884
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
5300
5885
|
}
|
|
5301
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5302
|
-
if (fromFunctionCall != null) {
|
|
5303
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
5304
|
-
}
|
|
5305
5886
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
5306
5887
|
'functionResponse',
|
|
5307
5888
|
]);
|
|
@@ -7331,6 +7912,22 @@ function fileDataToMldev$2(fromObject) {
|
|
|
7331
7912
|
}
|
|
7332
7913
|
return toObject;
|
|
7333
7914
|
}
|
|
7915
|
+
function functionCallToMldev$2(fromObject) {
|
|
7916
|
+
const toObject = {};
|
|
7917
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
7918
|
+
if (fromId != null) {
|
|
7919
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
7920
|
+
}
|
|
7921
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
7922
|
+
if (fromArgs != null) {
|
|
7923
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
7924
|
+
}
|
|
7925
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7926
|
+
if (fromName != null) {
|
|
7927
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
7928
|
+
}
|
|
7929
|
+
return toObject;
|
|
7930
|
+
}
|
|
7334
7931
|
function partToMldev$2(fromObject) {
|
|
7335
7932
|
const toObject = {};
|
|
7336
7933
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -7357,6 +7954,10 @@ function partToMldev$2(fromObject) {
|
|
|
7357
7954
|
if (fromThoughtSignature != null) {
|
|
7358
7955
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7359
7956
|
}
|
|
7957
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
7958
|
+
if (fromFunctionCall != null) {
|
|
7959
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
|
|
7960
|
+
}
|
|
7360
7961
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7361
7962
|
'codeExecutionResult',
|
|
7362
7963
|
]);
|
|
@@ -7369,10 +7970,6 @@ function partToMldev$2(fromObject) {
|
|
|
7369
7970
|
if (fromExecutableCode != null) {
|
|
7370
7971
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
7371
7972
|
}
|
|
7372
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
7373
|
-
if (fromFunctionCall != null) {
|
|
7374
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
7375
|
-
}
|
|
7376
7973
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
7377
7974
|
'functionResponse',
|
|
7378
7975
|
]);
|
|
@@ -8035,6 +8632,22 @@ function fileDataToVertex$1(fromObject) {
|
|
|
8035
8632
|
}
|
|
8036
8633
|
return toObject;
|
|
8037
8634
|
}
|
|
8635
|
+
function functionCallToVertex$1(fromObject) {
|
|
8636
|
+
const toObject = {};
|
|
8637
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
8638
|
+
if (fromId != null) {
|
|
8639
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
8640
|
+
}
|
|
8641
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
8642
|
+
if (fromArgs != null) {
|
|
8643
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
8644
|
+
}
|
|
8645
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
8646
|
+
if (fromName != null) {
|
|
8647
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
8648
|
+
}
|
|
8649
|
+
return toObject;
|
|
8650
|
+
}
|
|
8038
8651
|
function partToVertex$1(fromObject) {
|
|
8039
8652
|
const toObject = {};
|
|
8040
8653
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -8061,6 +8674,10 @@ function partToVertex$1(fromObject) {
|
|
|
8061
8674
|
if (fromThoughtSignature != null) {
|
|
8062
8675
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8063
8676
|
}
|
|
8677
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8678
|
+
if (fromFunctionCall != null) {
|
|
8679
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$1(fromFunctionCall));
|
|
8680
|
+
}
|
|
8064
8681
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8065
8682
|
'codeExecutionResult',
|
|
8066
8683
|
]);
|
|
@@ -8073,10 +8690,6 @@ function partToVertex$1(fromObject) {
|
|
|
8073
8690
|
if (fromExecutableCode != null) {
|
|
8074
8691
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8075
8692
|
}
|
|
8076
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8077
|
-
if (fromFunctionCall != null) {
|
|
8078
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8079
|
-
}
|
|
8080
8693
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8081
8694
|
'functionResponse',
|
|
8082
8695
|
]);
|
|
@@ -8624,6 +9237,22 @@ function fileDataFromMldev$1(fromObject) {
|
|
|
8624
9237
|
}
|
|
8625
9238
|
return toObject;
|
|
8626
9239
|
}
|
|
9240
|
+
function functionCallFromMldev$1(fromObject) {
|
|
9241
|
+
const toObject = {};
|
|
9242
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
9243
|
+
if (fromId != null) {
|
|
9244
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
9245
|
+
}
|
|
9246
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9247
|
+
if (fromArgs != null) {
|
|
9248
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9249
|
+
}
|
|
9250
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9251
|
+
if (fromName != null) {
|
|
9252
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9253
|
+
}
|
|
9254
|
+
return toObject;
|
|
9255
|
+
}
|
|
8627
9256
|
function partFromMldev$1(fromObject) {
|
|
8628
9257
|
const toObject = {};
|
|
8629
9258
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -8650,6 +9279,10 @@ function partFromMldev$1(fromObject) {
|
|
|
8650
9279
|
if (fromThoughtSignature != null) {
|
|
8651
9280
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8652
9281
|
}
|
|
9282
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9283
|
+
if (fromFunctionCall != null) {
|
|
9284
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$1(fromFunctionCall));
|
|
9285
|
+
}
|
|
8653
9286
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8654
9287
|
'codeExecutionResult',
|
|
8655
9288
|
]);
|
|
@@ -8662,10 +9295,6 @@ function partFromMldev$1(fromObject) {
|
|
|
8662
9295
|
if (fromExecutableCode != null) {
|
|
8663
9296
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8664
9297
|
}
|
|
8665
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8666
|
-
if (fromFunctionCall != null) {
|
|
8667
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8668
|
-
}
|
|
8669
9298
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8670
9299
|
'functionResponse',
|
|
8671
9300
|
]);
|
|
@@ -8782,22 +9411,6 @@ function liveServerContentFromMldev(fromObject) {
|
|
|
8782
9411
|
}
|
|
8783
9412
|
return toObject;
|
|
8784
9413
|
}
|
|
8785
|
-
function functionCallFromMldev(fromObject) {
|
|
8786
|
-
const toObject = {};
|
|
8787
|
-
const fromId = getValueByPath(fromObject, ['id']);
|
|
8788
|
-
if (fromId != null) {
|
|
8789
|
-
setValueByPath(toObject, ['id'], fromId);
|
|
8790
|
-
}
|
|
8791
|
-
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
8792
|
-
if (fromArgs != null) {
|
|
8793
|
-
setValueByPath(toObject, ['args'], fromArgs);
|
|
8794
|
-
}
|
|
8795
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
8796
|
-
if (fromName != null) {
|
|
8797
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
8798
|
-
}
|
|
8799
|
-
return toObject;
|
|
8800
|
-
}
|
|
8801
9414
|
function liveServerToolCallFromMldev(fromObject) {
|
|
8802
9415
|
const toObject = {};
|
|
8803
9416
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -8807,7 +9420,7 @@ function liveServerToolCallFromMldev(fromObject) {
|
|
|
8807
9420
|
let transformedList = fromFunctionCalls;
|
|
8808
9421
|
if (Array.isArray(transformedList)) {
|
|
8809
9422
|
transformedList = transformedList.map((item) => {
|
|
8810
|
-
return functionCallFromMldev(item);
|
|
9423
|
+
return functionCallFromMldev$1(item);
|
|
8811
9424
|
});
|
|
8812
9425
|
}
|
|
8813
9426
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -9218,6 +9831,22 @@ function fileDataFromVertex$1(fromObject) {
|
|
|
9218
9831
|
}
|
|
9219
9832
|
return toObject;
|
|
9220
9833
|
}
|
|
9834
|
+
function functionCallFromVertex$1(fromObject) {
|
|
9835
|
+
const toObject = {};
|
|
9836
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
9837
|
+
if (fromId != null) {
|
|
9838
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
9839
|
+
}
|
|
9840
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9841
|
+
if (fromArgs != null) {
|
|
9842
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9843
|
+
}
|
|
9844
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9845
|
+
if (fromName != null) {
|
|
9846
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9847
|
+
}
|
|
9848
|
+
return toObject;
|
|
9849
|
+
}
|
|
9221
9850
|
function partFromVertex$1(fromObject) {
|
|
9222
9851
|
const toObject = {};
|
|
9223
9852
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9244,6 +9873,10 @@ function partFromVertex$1(fromObject) {
|
|
|
9244
9873
|
if (fromThoughtSignature != null) {
|
|
9245
9874
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9246
9875
|
}
|
|
9876
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9877
|
+
if (fromFunctionCall != null) {
|
|
9878
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex$1(fromFunctionCall));
|
|
9879
|
+
}
|
|
9247
9880
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9248
9881
|
'codeExecutionResult',
|
|
9249
9882
|
]);
|
|
@@ -9256,10 +9889,6 @@ function partFromVertex$1(fromObject) {
|
|
|
9256
9889
|
if (fromExecutableCode != null) {
|
|
9257
9890
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9258
9891
|
}
|
|
9259
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9260
|
-
if (fromFunctionCall != null) {
|
|
9261
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9262
|
-
}
|
|
9263
9892
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9264
9893
|
'functionResponse',
|
|
9265
9894
|
]);
|
|
@@ -9342,18 +9971,6 @@ function liveServerContentFromVertex(fromObject) {
|
|
|
9342
9971
|
}
|
|
9343
9972
|
return toObject;
|
|
9344
9973
|
}
|
|
9345
|
-
function functionCallFromVertex(fromObject) {
|
|
9346
|
-
const toObject = {};
|
|
9347
|
-
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9348
|
-
if (fromArgs != null) {
|
|
9349
|
-
setValueByPath(toObject, ['args'], fromArgs);
|
|
9350
|
-
}
|
|
9351
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
9352
|
-
if (fromName != null) {
|
|
9353
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
9354
|
-
}
|
|
9355
|
-
return toObject;
|
|
9356
|
-
}
|
|
9357
9974
|
function liveServerToolCallFromVertex(fromObject) {
|
|
9358
9975
|
const toObject = {};
|
|
9359
9976
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -9363,7 +9980,7 @@ function liveServerToolCallFromVertex(fromObject) {
|
|
|
9363
9980
|
let transformedList = fromFunctionCalls;
|
|
9364
9981
|
if (Array.isArray(transformedList)) {
|
|
9365
9982
|
transformedList = transformedList.map((item) => {
|
|
9366
|
-
return functionCallFromVertex(item);
|
|
9983
|
+
return functionCallFromVertex$1(item);
|
|
9367
9984
|
});
|
|
9368
9985
|
}
|
|
9369
9986
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -9602,6 +10219,22 @@ function fileDataToMldev$1(fromObject) {
|
|
|
9602
10219
|
}
|
|
9603
10220
|
return toObject;
|
|
9604
10221
|
}
|
|
10222
|
+
function functionCallToMldev$1(fromObject) {
|
|
10223
|
+
const toObject = {};
|
|
10224
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
10225
|
+
if (fromId != null) {
|
|
10226
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
10227
|
+
}
|
|
10228
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10229
|
+
if (fromArgs != null) {
|
|
10230
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
10231
|
+
}
|
|
10232
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
10233
|
+
if (fromName != null) {
|
|
10234
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
10235
|
+
}
|
|
10236
|
+
return toObject;
|
|
10237
|
+
}
|
|
9605
10238
|
function partToMldev$1(fromObject) {
|
|
9606
10239
|
const toObject = {};
|
|
9607
10240
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9628,6 +10261,10 @@ function partToMldev$1(fromObject) {
|
|
|
9628
10261
|
if (fromThoughtSignature != null) {
|
|
9629
10262
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9630
10263
|
}
|
|
10264
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10265
|
+
if (fromFunctionCall != null) {
|
|
10266
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
|
|
10267
|
+
}
|
|
9631
10268
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9632
10269
|
'codeExecutionResult',
|
|
9633
10270
|
]);
|
|
@@ -9640,10 +10277,6 @@ function partToMldev$1(fromObject) {
|
|
|
9640
10277
|
if (fromExecutableCode != null) {
|
|
9641
10278
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9642
10279
|
}
|
|
9643
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9644
|
-
if (fromFunctionCall != null) {
|
|
9645
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9646
|
-
}
|
|
9647
10280
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9648
10281
|
'functionResponse',
|
|
9649
10282
|
]);
|
|
@@ -10586,6 +11219,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
10586
11219
|
if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
|
|
10587
11220
|
throw new Error('referenceImages parameter is not supported in Gemini API.');
|
|
10588
11221
|
}
|
|
11222
|
+
if (getValueByPath(fromObject, ['mask']) !== undefined) {
|
|
11223
|
+
throw new Error('mask parameter is not supported in Gemini API.');
|
|
11224
|
+
}
|
|
10589
11225
|
if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
|
|
10590
11226
|
throw new Error('compressionQuality parameter is not supported in Gemini API.');
|
|
10591
11227
|
}
|
|
@@ -10666,6 +11302,22 @@ function fileDataToVertex(fromObject) {
|
|
|
10666
11302
|
}
|
|
10667
11303
|
return toObject;
|
|
10668
11304
|
}
|
|
11305
|
+
function functionCallToVertex(fromObject) {
|
|
11306
|
+
const toObject = {};
|
|
11307
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
11308
|
+
if (fromId != null) {
|
|
11309
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
11310
|
+
}
|
|
11311
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
11312
|
+
if (fromArgs != null) {
|
|
11313
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
11314
|
+
}
|
|
11315
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
11316
|
+
if (fromName != null) {
|
|
11317
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
11318
|
+
}
|
|
11319
|
+
return toObject;
|
|
11320
|
+
}
|
|
10669
11321
|
function partToVertex(fromObject) {
|
|
10670
11322
|
const toObject = {};
|
|
10671
11323
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -10692,6 +11344,10 @@ function partToVertex(fromObject) {
|
|
|
10692
11344
|
if (fromThoughtSignature != null) {
|
|
10693
11345
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10694
11346
|
}
|
|
11347
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11348
|
+
if (fromFunctionCall != null) {
|
|
11349
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex(fromFunctionCall));
|
|
11350
|
+
}
|
|
10695
11351
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10696
11352
|
'codeExecutionResult',
|
|
10697
11353
|
]);
|
|
@@ -10704,10 +11360,6 @@ function partToVertex(fromObject) {
|
|
|
10704
11360
|
if (fromExecutableCode != null) {
|
|
10705
11361
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
10706
11362
|
}
|
|
10707
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10708
|
-
if (fromFunctionCall != null) {
|
|
10709
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
10710
|
-
}
|
|
10711
11363
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
10712
11364
|
'functionResponse',
|
|
10713
11365
|
]);
|
|
@@ -12178,6 +12830,18 @@ function videoGenerationReferenceImageToVertex(fromObject) {
|
|
|
12178
12830
|
}
|
|
12179
12831
|
return toObject;
|
|
12180
12832
|
}
|
|
12833
|
+
function videoGenerationMaskToVertex(fromObject) {
|
|
12834
|
+
const toObject = {};
|
|
12835
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
12836
|
+
if (fromImage != null) {
|
|
12837
|
+
setValueByPath(toObject, ['_self'], imageToVertex(fromImage));
|
|
12838
|
+
}
|
|
12839
|
+
const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
|
|
12840
|
+
if (fromMaskMode != null) {
|
|
12841
|
+
setValueByPath(toObject, ['maskMode'], fromMaskMode);
|
|
12842
|
+
}
|
|
12843
|
+
return toObject;
|
|
12844
|
+
}
|
|
12181
12845
|
function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
12182
12846
|
const toObject = {};
|
|
12183
12847
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -12256,6 +12920,10 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
|
12256
12920
|
}
|
|
12257
12921
|
setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
|
|
12258
12922
|
}
|
|
12923
|
+
const fromMask = getValueByPath(fromObject, ['mask']);
|
|
12924
|
+
if (parentObject !== undefined && fromMask != null) {
|
|
12925
|
+
setValueByPath(parentObject, ['instances[0]', 'mask'], videoGenerationMaskToVertex(fromMask));
|
|
12926
|
+
}
|
|
12259
12927
|
const fromCompressionQuality = getValueByPath(fromObject, [
|
|
12260
12928
|
'compressionQuality',
|
|
12261
12929
|
]);
|
|
@@ -12332,6 +13000,22 @@ function fileDataFromMldev(fromObject) {
|
|
|
12332
13000
|
}
|
|
12333
13001
|
return toObject;
|
|
12334
13002
|
}
|
|
13003
|
+
function functionCallFromMldev(fromObject) {
|
|
13004
|
+
const toObject = {};
|
|
13005
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
13006
|
+
if (fromId != null) {
|
|
13007
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
13008
|
+
}
|
|
13009
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
13010
|
+
if (fromArgs != null) {
|
|
13011
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
13012
|
+
}
|
|
13013
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13014
|
+
if (fromName != null) {
|
|
13015
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13016
|
+
}
|
|
13017
|
+
return toObject;
|
|
13018
|
+
}
|
|
12335
13019
|
function partFromMldev(fromObject) {
|
|
12336
13020
|
const toObject = {};
|
|
12337
13021
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -12358,6 +13042,10 @@ function partFromMldev(fromObject) {
|
|
|
12358
13042
|
if (fromThoughtSignature != null) {
|
|
12359
13043
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
12360
13044
|
}
|
|
13045
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13046
|
+
if (fromFunctionCall != null) {
|
|
13047
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev(fromFunctionCall));
|
|
13048
|
+
}
|
|
12361
13049
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
12362
13050
|
'codeExecutionResult',
|
|
12363
13051
|
]);
|
|
@@ -12370,10 +13058,6 @@ function partFromMldev(fromObject) {
|
|
|
12370
13058
|
if (fromExecutableCode != null) {
|
|
12371
13059
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
12372
13060
|
}
|
|
12373
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
12374
|
-
if (fromFunctionCall != null) {
|
|
12375
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
12376
|
-
}
|
|
12377
13061
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
12378
13062
|
'functionResponse',
|
|
12379
13063
|
]);
|
|
@@ -12896,6 +13580,22 @@ function fileDataFromVertex(fromObject) {
|
|
|
12896
13580
|
}
|
|
12897
13581
|
return toObject;
|
|
12898
13582
|
}
|
|
13583
|
+
function functionCallFromVertex(fromObject) {
|
|
13584
|
+
const toObject = {};
|
|
13585
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
13586
|
+
if (fromId != null) {
|
|
13587
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
13588
|
+
}
|
|
13589
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
13590
|
+
if (fromArgs != null) {
|
|
13591
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
13592
|
+
}
|
|
13593
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13594
|
+
if (fromName != null) {
|
|
13595
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13596
|
+
}
|
|
13597
|
+
return toObject;
|
|
13598
|
+
}
|
|
12899
13599
|
function partFromVertex(fromObject) {
|
|
12900
13600
|
const toObject = {};
|
|
12901
13601
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -12922,6 +13622,10 @@ function partFromVertex(fromObject) {
|
|
|
12922
13622
|
if (fromThoughtSignature != null) {
|
|
12923
13623
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
12924
13624
|
}
|
|
13625
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13626
|
+
if (fromFunctionCall != null) {
|
|
13627
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex(fromFunctionCall));
|
|
13628
|
+
}
|
|
12925
13629
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
12926
13630
|
'codeExecutionResult',
|
|
12927
13631
|
]);
|
|
@@ -12934,10 +13638,6 @@ function partFromVertex(fromObject) {
|
|
|
12934
13638
|
if (fromExecutableCode != null) {
|
|
12935
13639
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
12936
13640
|
}
|
|
12937
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
12938
|
-
if (fromFunctionCall != null) {
|
|
12939
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
12940
|
-
}
|
|
12941
13641
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
12942
13642
|
'functionResponse',
|
|
12943
13643
|
]);
|
|
@@ -13612,7 +14312,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
13612
14312
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
13613
14313
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
13614
14314
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
13615
|
-
const SDK_VERSION = '1.
|
|
14315
|
+
const SDK_VERSION = '1.19.0'; // x-release-please-version
|
|
13616
14316
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
13617
14317
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
13618
14318
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -16597,59 +17297,6 @@ class Models extends BaseModule {
|
|
|
16597
17297
|
}
|
|
16598
17298
|
}
|
|
16599
17299
|
|
|
16600
|
-
/**
|
|
16601
|
-
* @license
|
|
16602
|
-
* Copyright 2025 Google LLC
|
|
16603
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
16604
|
-
*/
|
|
16605
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
16606
|
-
function getOperationParametersToMldev(fromObject) {
|
|
16607
|
-
const toObject = {};
|
|
16608
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
16609
|
-
'operationName',
|
|
16610
|
-
]);
|
|
16611
|
-
if (fromOperationName != null) {
|
|
16612
|
-
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
16613
|
-
}
|
|
16614
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
16615
|
-
if (fromConfig != null) {
|
|
16616
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
16617
|
-
}
|
|
16618
|
-
return toObject;
|
|
16619
|
-
}
|
|
16620
|
-
function fetchPredictOperationParametersToVertex(fromObject) {
|
|
16621
|
-
const toObject = {};
|
|
16622
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
16623
|
-
'operationName',
|
|
16624
|
-
]);
|
|
16625
|
-
if (fromOperationName != null) {
|
|
16626
|
-
setValueByPath(toObject, ['operationName'], fromOperationName);
|
|
16627
|
-
}
|
|
16628
|
-
const fromResourceName = getValueByPath(fromObject, ['resourceName']);
|
|
16629
|
-
if (fromResourceName != null) {
|
|
16630
|
-
setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
|
|
16631
|
-
}
|
|
16632
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
16633
|
-
if (fromConfig != null) {
|
|
16634
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
16635
|
-
}
|
|
16636
|
-
return toObject;
|
|
16637
|
-
}
|
|
16638
|
-
function getOperationParametersToVertex(fromObject) {
|
|
16639
|
-
const toObject = {};
|
|
16640
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
16641
|
-
'operationName',
|
|
16642
|
-
]);
|
|
16643
|
-
if (fromOperationName != null) {
|
|
16644
|
-
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
16645
|
-
}
|
|
16646
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
16647
|
-
if (fromConfig != null) {
|
|
16648
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
16649
|
-
}
|
|
16650
|
-
return toObject;
|
|
16651
|
-
}
|
|
16652
|
-
|
|
16653
17300
|
/**
|
|
16654
17301
|
* @license
|
|
16655
17302
|
* Copyright 2025 Google LLC
|
|
@@ -16933,6 +17580,22 @@ function fileDataToMldev(fromObject) {
|
|
|
16933
17580
|
}
|
|
16934
17581
|
return toObject;
|
|
16935
17582
|
}
|
|
17583
|
+
function functionCallToMldev(fromObject) {
|
|
17584
|
+
const toObject = {};
|
|
17585
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
17586
|
+
if (fromId != null) {
|
|
17587
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
17588
|
+
}
|
|
17589
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
17590
|
+
if (fromArgs != null) {
|
|
17591
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
17592
|
+
}
|
|
17593
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
17594
|
+
if (fromName != null) {
|
|
17595
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
17596
|
+
}
|
|
17597
|
+
return toObject;
|
|
17598
|
+
}
|
|
16936
17599
|
function partToMldev(fromObject) {
|
|
16937
17600
|
const toObject = {};
|
|
16938
17601
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -16959,6 +17622,10 @@ function partToMldev(fromObject) {
|
|
|
16959
17622
|
if (fromThoughtSignature != null) {
|
|
16960
17623
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
16961
17624
|
}
|
|
17625
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
17626
|
+
if (fromFunctionCall != null) {
|
|
17627
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
|
|
17628
|
+
}
|
|
16962
17629
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
16963
17630
|
'codeExecutionResult',
|
|
16964
17631
|
]);
|
|
@@ -16971,10 +17638,6 @@ function partToMldev(fromObject) {
|
|
|
16971
17638
|
if (fromExecutableCode != null) {
|
|
16972
17639
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
16973
17640
|
}
|
|
16974
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
16975
|
-
if (fromFunctionCall != null) {
|
|
16976
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
16977
|
-
}
|
|
16978
17641
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
16979
17642
|
'functionResponse',
|
|
16980
17643
|
]);
|
|
@@ -17989,6 +18652,9 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
17989
18652
|
if (parentObject !== undefined && fromLearningRate != null) {
|
|
17990
18653
|
setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
|
|
17991
18654
|
}
|
|
18655
|
+
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
18656
|
+
throw new Error('labels parameter is not supported in Gemini API.');
|
|
18657
|
+
}
|
|
17992
18658
|
return toObject;
|
|
17993
18659
|
}
|
|
17994
18660
|
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
@@ -18144,6 +18810,10 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
18144
18810
|
if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
|
|
18145
18811
|
throw new Error('learningRate parameter is not supported in Vertex AI.');
|
|
18146
18812
|
}
|
|
18813
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
18814
|
+
if (parentObject !== undefined && fromLabels != null) {
|
|
18815
|
+
setValueByPath(parentObject, ['labels'], fromLabels);
|
|
18816
|
+
}
|
|
18147
18817
|
return toObject;
|
|
18148
18818
|
}
|
|
18149
18819
|
function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
@@ -19274,6 +19944,7 @@ exports.GenerateVideosOperation = GenerateVideosOperation;
|
|
|
19274
19944
|
exports.GenerateVideosResponse = GenerateVideosResponse;
|
|
19275
19945
|
exports.GoogleGenAI = GoogleGenAI;
|
|
19276
19946
|
exports.HttpResponse = HttpResponse;
|
|
19947
|
+
exports.InlinedEmbedContentResponse = InlinedEmbedContentResponse;
|
|
19277
19948
|
exports.InlinedResponse = InlinedResponse;
|
|
19278
19949
|
exports.ListBatchJobsResponse = ListBatchJobsResponse;
|
|
19279
19950
|
exports.ListCachedContentsResponse = ListCachedContentsResponse;
|
|
@@ -19294,6 +19965,7 @@ exports.RecontextImageResponse = RecontextImageResponse;
|
|
|
19294
19965
|
exports.ReplayResponse = ReplayResponse;
|
|
19295
19966
|
exports.SegmentImageResponse = SegmentImageResponse;
|
|
19296
19967
|
exports.Session = Session;
|
|
19968
|
+
exports.SingleEmbedContentResponse = SingleEmbedContentResponse;
|
|
19297
19969
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
19298
19970
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
19299
19971
|
exports.Tokens = Tokens;
|