@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/web/index.mjs
CHANGED
|
@@ -145,7 +145,16 @@ function setValueByPath(data, keys, value) {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
else {
|
|
148
|
-
|
|
148
|
+
if (keyToSet === '_self' &&
|
|
149
|
+
typeof value === 'object' &&
|
|
150
|
+
value !== null &&
|
|
151
|
+
!Array.isArray(value)) {
|
|
152
|
+
const valueAsRecord = value;
|
|
153
|
+
Object.assign(data, valueAsRecord);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
data[keyToSet] = value;
|
|
157
|
+
}
|
|
149
158
|
}
|
|
150
159
|
}
|
|
151
160
|
function getValueByPath(data, keys) {
|
|
@@ -204,6 +213,216 @@ function tBytes$1(fromBytes) {
|
|
|
204
213
|
* SPDX-License-Identifier: Apache-2.0
|
|
205
214
|
*/
|
|
206
215
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
216
|
+
function getOperationParametersToMldev(fromObject) {
|
|
217
|
+
const toObject = {};
|
|
218
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
219
|
+
'operationName',
|
|
220
|
+
]);
|
|
221
|
+
if (fromOperationName != null) {
|
|
222
|
+
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
223
|
+
}
|
|
224
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
225
|
+
if (fromConfig != null) {
|
|
226
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
227
|
+
}
|
|
228
|
+
return toObject;
|
|
229
|
+
}
|
|
230
|
+
function fetchPredictOperationParametersToVertex(fromObject) {
|
|
231
|
+
const toObject = {};
|
|
232
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
233
|
+
'operationName',
|
|
234
|
+
]);
|
|
235
|
+
if (fromOperationName != null) {
|
|
236
|
+
setValueByPath(toObject, ['operationName'], fromOperationName);
|
|
237
|
+
}
|
|
238
|
+
const fromResourceName = getValueByPath(fromObject, ['resourceName']);
|
|
239
|
+
if (fromResourceName != null) {
|
|
240
|
+
setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
|
|
241
|
+
}
|
|
242
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
243
|
+
if (fromConfig != null) {
|
|
244
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
245
|
+
}
|
|
246
|
+
return toObject;
|
|
247
|
+
}
|
|
248
|
+
function getOperationParametersToVertex(fromObject) {
|
|
249
|
+
const toObject = {};
|
|
250
|
+
const fromOperationName = getValueByPath(fromObject, [
|
|
251
|
+
'operationName',
|
|
252
|
+
]);
|
|
253
|
+
if (fromOperationName != null) {
|
|
254
|
+
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
255
|
+
}
|
|
256
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
257
|
+
if (fromConfig != null) {
|
|
258
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
259
|
+
}
|
|
260
|
+
return toObject;
|
|
261
|
+
}
|
|
262
|
+
function videoFromMldev$1(fromObject) {
|
|
263
|
+
const toObject = {};
|
|
264
|
+
const fromUri = getValueByPath(fromObject, ['video', 'uri']);
|
|
265
|
+
if (fromUri != null) {
|
|
266
|
+
setValueByPath(toObject, ['uri'], fromUri);
|
|
267
|
+
}
|
|
268
|
+
const fromVideoBytes = getValueByPath(fromObject, [
|
|
269
|
+
'video',
|
|
270
|
+
'encodedVideo',
|
|
271
|
+
]);
|
|
272
|
+
if (fromVideoBytes != null) {
|
|
273
|
+
setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
|
|
274
|
+
}
|
|
275
|
+
const fromMimeType = getValueByPath(fromObject, ['encoding']);
|
|
276
|
+
if (fromMimeType != null) {
|
|
277
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
278
|
+
}
|
|
279
|
+
return toObject;
|
|
280
|
+
}
|
|
281
|
+
function generatedVideoFromMldev$1(fromObject) {
|
|
282
|
+
const toObject = {};
|
|
283
|
+
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
284
|
+
if (fromVideo != null) {
|
|
285
|
+
setValueByPath(toObject, ['video'], videoFromMldev$1(fromVideo));
|
|
286
|
+
}
|
|
287
|
+
return toObject;
|
|
288
|
+
}
|
|
289
|
+
function generateVideosResponseFromMldev$1(fromObject) {
|
|
290
|
+
const toObject = {};
|
|
291
|
+
const fromGeneratedVideos = getValueByPath(fromObject, [
|
|
292
|
+
'generatedSamples',
|
|
293
|
+
]);
|
|
294
|
+
if (fromGeneratedVideos != null) {
|
|
295
|
+
let transformedList = fromGeneratedVideos;
|
|
296
|
+
if (Array.isArray(transformedList)) {
|
|
297
|
+
transformedList = transformedList.map((item) => {
|
|
298
|
+
return generatedVideoFromMldev$1(item);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
302
|
+
}
|
|
303
|
+
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
304
|
+
'raiMediaFilteredCount',
|
|
305
|
+
]);
|
|
306
|
+
if (fromRaiMediaFilteredCount != null) {
|
|
307
|
+
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
308
|
+
}
|
|
309
|
+
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
310
|
+
'raiMediaFilteredReasons',
|
|
311
|
+
]);
|
|
312
|
+
if (fromRaiMediaFilteredReasons != null) {
|
|
313
|
+
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
314
|
+
}
|
|
315
|
+
return toObject;
|
|
316
|
+
}
|
|
317
|
+
function generateVideosOperationFromMldev$1(fromObject) {
|
|
318
|
+
const toObject = {};
|
|
319
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
320
|
+
if (fromName != null) {
|
|
321
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
322
|
+
}
|
|
323
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
324
|
+
if (fromMetadata != null) {
|
|
325
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
326
|
+
}
|
|
327
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
328
|
+
if (fromDone != null) {
|
|
329
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
330
|
+
}
|
|
331
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
332
|
+
if (fromError != null) {
|
|
333
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
334
|
+
}
|
|
335
|
+
const fromResponse = getValueByPath(fromObject, [
|
|
336
|
+
'response',
|
|
337
|
+
'generateVideoResponse',
|
|
338
|
+
]);
|
|
339
|
+
if (fromResponse != null) {
|
|
340
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(fromResponse));
|
|
341
|
+
}
|
|
342
|
+
return toObject;
|
|
343
|
+
}
|
|
344
|
+
function videoFromVertex$1(fromObject) {
|
|
345
|
+
const toObject = {};
|
|
346
|
+
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
347
|
+
if (fromUri != null) {
|
|
348
|
+
setValueByPath(toObject, ['uri'], fromUri);
|
|
349
|
+
}
|
|
350
|
+
const fromVideoBytes = getValueByPath(fromObject, [
|
|
351
|
+
'bytesBase64Encoded',
|
|
352
|
+
]);
|
|
353
|
+
if (fromVideoBytes != null) {
|
|
354
|
+
setValueByPath(toObject, ['videoBytes'], tBytes$1(fromVideoBytes));
|
|
355
|
+
}
|
|
356
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
357
|
+
if (fromMimeType != null) {
|
|
358
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
359
|
+
}
|
|
360
|
+
return toObject;
|
|
361
|
+
}
|
|
362
|
+
function generatedVideoFromVertex$1(fromObject) {
|
|
363
|
+
const toObject = {};
|
|
364
|
+
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
365
|
+
if (fromVideo != null) {
|
|
366
|
+
setValueByPath(toObject, ['video'], videoFromVertex$1(fromVideo));
|
|
367
|
+
}
|
|
368
|
+
return toObject;
|
|
369
|
+
}
|
|
370
|
+
function generateVideosResponseFromVertex$1(fromObject) {
|
|
371
|
+
const toObject = {};
|
|
372
|
+
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
373
|
+
if (fromGeneratedVideos != null) {
|
|
374
|
+
let transformedList = fromGeneratedVideos;
|
|
375
|
+
if (Array.isArray(transformedList)) {
|
|
376
|
+
transformedList = transformedList.map((item) => {
|
|
377
|
+
return generatedVideoFromVertex$1(item);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
setValueByPath(toObject, ['generatedVideos'], transformedList);
|
|
381
|
+
}
|
|
382
|
+
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
383
|
+
'raiMediaFilteredCount',
|
|
384
|
+
]);
|
|
385
|
+
if (fromRaiMediaFilteredCount != null) {
|
|
386
|
+
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
387
|
+
}
|
|
388
|
+
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
389
|
+
'raiMediaFilteredReasons',
|
|
390
|
+
]);
|
|
391
|
+
if (fromRaiMediaFilteredReasons != null) {
|
|
392
|
+
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
393
|
+
}
|
|
394
|
+
return toObject;
|
|
395
|
+
}
|
|
396
|
+
function generateVideosOperationFromVertex$1(fromObject) {
|
|
397
|
+
const toObject = {};
|
|
398
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
399
|
+
if (fromName != null) {
|
|
400
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
401
|
+
}
|
|
402
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
403
|
+
if (fromMetadata != null) {
|
|
404
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
405
|
+
}
|
|
406
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
407
|
+
if (fromDone != null) {
|
|
408
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
409
|
+
}
|
|
410
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
411
|
+
if (fromError != null) {
|
|
412
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
413
|
+
}
|
|
414
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
415
|
+
if (fromResponse != null) {
|
|
416
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(fromResponse));
|
|
417
|
+
}
|
|
418
|
+
return toObject;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @license
|
|
423
|
+
* Copyright 2025 Google LLC
|
|
424
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
425
|
+
*/
|
|
207
426
|
/** Required. Outcome of the code execution. */
|
|
208
427
|
var Outcome;
|
|
209
428
|
(function (Outcome) {
|
|
@@ -1595,54 +1814,15 @@ class GenerateVideosOperation {
|
|
|
1595
1814
|
*/
|
|
1596
1815
|
_fromAPIResponse({ apiResponse, isVertexAI, }) {
|
|
1597
1816
|
const operation = new GenerateVideosOperation();
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
operation.done = apiResponse['done'];
|
|
1601
|
-
operation.error = apiResponse['error'];
|
|
1817
|
+
let response;
|
|
1818
|
+
const op = apiResponse;
|
|
1602
1819
|
if (isVertexAI) {
|
|
1603
|
-
|
|
1604
|
-
if (response) {
|
|
1605
|
-
const operationResponse = new GenerateVideosResponse();
|
|
1606
|
-
const responseVideos = response['videos'];
|
|
1607
|
-
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1608
|
-
return {
|
|
1609
|
-
video: {
|
|
1610
|
-
uri: generatedVideo['gcsUri'],
|
|
1611
|
-
videoBytes: generatedVideo['bytesBase64Encoded']
|
|
1612
|
-
? tBytes$1(generatedVideo['bytesBase64Encoded'])
|
|
1613
|
-
: undefined,
|
|
1614
|
-
mimeType: generatedVideo['mimeType'],
|
|
1615
|
-
},
|
|
1616
|
-
};
|
|
1617
|
-
});
|
|
1618
|
-
operationResponse.raiMediaFilteredCount = response['raiMediaFilteredCount'];
|
|
1619
|
-
operationResponse.raiMediaFilteredReasons = response['raiMediaFilteredReasons'];
|
|
1620
|
-
operation.response = operationResponse;
|
|
1621
|
-
}
|
|
1820
|
+
response = generateVideosOperationFromVertex$1(op);
|
|
1622
1821
|
}
|
|
1623
1822
|
else {
|
|
1624
|
-
|
|
1625
|
-
if (response) {
|
|
1626
|
-
const operationResponse = new GenerateVideosResponse();
|
|
1627
|
-
const generatedVideoResponse = response['generateVideoResponse'];
|
|
1628
|
-
const responseVideos = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['generatedSamples'];
|
|
1629
|
-
operationResponse.generatedVideos = responseVideos === null || responseVideos === void 0 ? void 0 : responseVideos.map((generatedVideo) => {
|
|
1630
|
-
const video = generatedVideo['video'];
|
|
1631
|
-
return {
|
|
1632
|
-
video: {
|
|
1633
|
-
uri: video === null || video === void 0 ? void 0 : video['uri'],
|
|
1634
|
-
videoBytes: (video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1635
|
-
? tBytes$1(video === null || video === void 0 ? void 0 : video['encodedVideo'])
|
|
1636
|
-
: undefined,
|
|
1637
|
-
mimeType: generatedVideo['encoding'],
|
|
1638
|
-
},
|
|
1639
|
-
};
|
|
1640
|
-
});
|
|
1641
|
-
operationResponse.raiMediaFilteredCount = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredCount'];
|
|
1642
|
-
operationResponse.raiMediaFilteredReasons = generatedVideoResponse === null || generatedVideoResponse === void 0 ? void 0 : generatedVideoResponse['raiMediaFilteredReasons'];
|
|
1643
|
-
operation.response = operationResponse;
|
|
1644
|
-
}
|
|
1823
|
+
response = generateVideosOperationFromMldev$1(op);
|
|
1645
1824
|
}
|
|
1825
|
+
Object.assign(operation, response);
|
|
1646
1826
|
return operation;
|
|
1647
1827
|
}
|
|
1648
1828
|
}
|
|
@@ -1666,6 +1846,12 @@ class DeleteFileResponse {
|
|
|
1666
1846
|
/** Config for `inlined_responses` parameter. */
|
|
1667
1847
|
class InlinedResponse {
|
|
1668
1848
|
}
|
|
1849
|
+
/** Config for `response` parameter. */
|
|
1850
|
+
class SingleEmbedContentResponse {
|
|
1851
|
+
}
|
|
1852
|
+
/** Config for `inlined_embedding_responses` parameter. */
|
|
1853
|
+
class InlinedEmbedContentResponse {
|
|
1854
|
+
}
|
|
1669
1855
|
/** Config for batches.list return value. */
|
|
1670
1856
|
class ListBatchJobsResponse {
|
|
1671
1857
|
}
|
|
@@ -2517,51 +2703,59 @@ function mcpToolsToGeminiTool(mcpTools, config = {}) {
|
|
|
2517
2703
|
return { functionDeclarations: functionDeclarations };
|
|
2518
2704
|
}
|
|
2519
2705
|
// Transforms a source input into a BatchJobSource object with validation.
|
|
2520
|
-
function tBatchJobSource(
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2706
|
+
function tBatchJobSource(client, src) {
|
|
2707
|
+
let sourceObj;
|
|
2708
|
+
if (typeof src === 'string') {
|
|
2709
|
+
if (client.isVertexAI()) {
|
|
2710
|
+
if (src.startsWith('gs://')) {
|
|
2711
|
+
sourceObj = { format: 'jsonl', gcsUri: [src] };
|
|
2712
|
+
}
|
|
2713
|
+
else if (src.startsWith('bq://')) {
|
|
2714
|
+
sourceObj = { format: 'bigquery', bigqueryUri: src };
|
|
2525
2715
|
}
|
|
2526
|
-
else
|
|
2527
|
-
throw new Error(
|
|
2716
|
+
else {
|
|
2717
|
+
throw new Error(`Unsupported string source for Vertex AI: ${src}`);
|
|
2528
2718
|
}
|
|
2529
2719
|
}
|
|
2530
2720
|
else {
|
|
2531
|
-
//
|
|
2532
|
-
if (src.
|
|
2533
|
-
|
|
2721
|
+
// MLDEV
|
|
2722
|
+
if (src.startsWith('files/')) {
|
|
2723
|
+
sourceObj = { fileName: src }; // Default to fileName for string input
|
|
2534
2724
|
}
|
|
2535
|
-
else
|
|
2536
|
-
throw new Error(
|
|
2725
|
+
else {
|
|
2726
|
+
throw new Error(`Unsupported string source for Gemini API: ${src}`);
|
|
2537
2727
|
}
|
|
2538
2728
|
}
|
|
2539
|
-
return src;
|
|
2540
2729
|
}
|
|
2541
|
-
// If src is an array (list in Python)
|
|
2542
2730
|
else if (Array.isArray(src)) {
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
else if (typeof src === 'string') {
|
|
2546
|
-
if (src.startsWith('gs://')) {
|
|
2547
|
-
return {
|
|
2548
|
-
format: 'jsonl',
|
|
2549
|
-
gcsUri: [src], // GCS URI is expected as an array
|
|
2550
|
-
};
|
|
2731
|
+
if (client.isVertexAI()) {
|
|
2732
|
+
throw new Error('InlinedRequest[] is not supported in Vertex AI.');
|
|
2551
2733
|
}
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2734
|
+
sourceObj = { inlinedRequests: src };
|
|
2735
|
+
}
|
|
2736
|
+
else {
|
|
2737
|
+
// It's already a BatchJobSource object
|
|
2738
|
+
sourceObj = src;
|
|
2739
|
+
}
|
|
2740
|
+
// Validation logic
|
|
2741
|
+
const vertexSourcesCount = [sourceObj.gcsUri, sourceObj.bigqueryUri].filter(Boolean).length;
|
|
2742
|
+
const mldevSourcesCount = [
|
|
2743
|
+
sourceObj.inlinedRequests,
|
|
2744
|
+
sourceObj.fileName,
|
|
2745
|
+
].filter(Boolean).length;
|
|
2746
|
+
if (client.isVertexAI()) {
|
|
2747
|
+
if (mldevSourcesCount > 0 || vertexSourcesCount !== 1) {
|
|
2748
|
+
throw new Error('Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.');
|
|
2557
2749
|
}
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2750
|
+
}
|
|
2751
|
+
else {
|
|
2752
|
+
// MLDEV
|
|
2753
|
+
if (vertexSourcesCount > 0 || mldevSourcesCount !== 1) {
|
|
2754
|
+
throw new Error('Exactly one of `inlinedRequests`, `fileName`, ' +
|
|
2755
|
+
'must be set for Gemini API.');
|
|
2562
2756
|
}
|
|
2563
2757
|
}
|
|
2564
|
-
|
|
2758
|
+
return sourceObj;
|
|
2565
2759
|
}
|
|
2566
2760
|
function tBatchJobDestination(dest) {
|
|
2567
2761
|
if (typeof dest !== 'string') {
|
|
@@ -2584,6 +2778,52 @@ function tBatchJobDestination(dest) {
|
|
|
2584
2778
|
throw new Error(`Unsupported destination: ${destString}`);
|
|
2585
2779
|
}
|
|
2586
2780
|
}
|
|
2781
|
+
function tRecvBatchJobDestination(dest) {
|
|
2782
|
+
// Ensure dest is a non-null object before proceeding.
|
|
2783
|
+
if (typeof dest !== 'object' || dest === null) {
|
|
2784
|
+
// If the input is not an object, it cannot be a valid BatchJobDestination
|
|
2785
|
+
// based on the operations performed. Return it cast, or handle as an error.
|
|
2786
|
+
// Casting an empty object might be a safe default.
|
|
2787
|
+
return {};
|
|
2788
|
+
}
|
|
2789
|
+
// Cast to Record<string, unknown> to allow string property access.
|
|
2790
|
+
const obj = dest;
|
|
2791
|
+
// Safely access nested properties.
|
|
2792
|
+
const inlineResponsesVal = obj['inlinedResponses'];
|
|
2793
|
+
if (typeof inlineResponsesVal !== 'object' || inlineResponsesVal === null) {
|
|
2794
|
+
return dest;
|
|
2795
|
+
}
|
|
2796
|
+
const inlineResponsesObj = inlineResponsesVal;
|
|
2797
|
+
const responsesArray = inlineResponsesObj['inlinedResponses'];
|
|
2798
|
+
if (!Array.isArray(responsesArray) || responsesArray.length === 0) {
|
|
2799
|
+
return dest;
|
|
2800
|
+
}
|
|
2801
|
+
// Check if any response has the 'embedding' property.
|
|
2802
|
+
let hasEmbedding = false;
|
|
2803
|
+
for (const responseItem of responsesArray) {
|
|
2804
|
+
if (typeof responseItem !== 'object' || responseItem === null) {
|
|
2805
|
+
continue;
|
|
2806
|
+
}
|
|
2807
|
+
const responseItemObj = responseItem;
|
|
2808
|
+
const responseVal = responseItemObj['response'];
|
|
2809
|
+
if (typeof responseVal !== 'object' || responseVal === null) {
|
|
2810
|
+
continue;
|
|
2811
|
+
}
|
|
2812
|
+
const responseObj = responseVal;
|
|
2813
|
+
// Check for the existence of the 'embedding' key.
|
|
2814
|
+
if (responseObj['embedding'] !== undefined) {
|
|
2815
|
+
hasEmbedding = true;
|
|
2816
|
+
break;
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
// Perform the transformation if an embedding was found.
|
|
2820
|
+
if (hasEmbedding) {
|
|
2821
|
+
obj['inlinedEmbedContentResponses'] = obj['inlinedResponses'];
|
|
2822
|
+
delete obj['inlinedResponses'];
|
|
2823
|
+
}
|
|
2824
|
+
// Cast the (potentially) modified object to the target type.
|
|
2825
|
+
return dest;
|
|
2826
|
+
}
|
|
2587
2827
|
function tBatchJobName(apiClient, name) {
|
|
2588
2828
|
const nameString = name;
|
|
2589
2829
|
if (!apiClient.isVertexAI()) {
|
|
@@ -2679,6 +2919,22 @@ function fileDataToMldev$4(fromObject) {
|
|
|
2679
2919
|
}
|
|
2680
2920
|
return toObject;
|
|
2681
2921
|
}
|
|
2922
|
+
function functionCallToMldev$4(fromObject) {
|
|
2923
|
+
const toObject = {};
|
|
2924
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
2925
|
+
if (fromId != null) {
|
|
2926
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
2927
|
+
}
|
|
2928
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
2929
|
+
if (fromArgs != null) {
|
|
2930
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
2931
|
+
}
|
|
2932
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
2933
|
+
if (fromName != null) {
|
|
2934
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
2935
|
+
}
|
|
2936
|
+
return toObject;
|
|
2937
|
+
}
|
|
2682
2938
|
function partToMldev$4(fromObject) {
|
|
2683
2939
|
const toObject = {};
|
|
2684
2940
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -2705,6 +2961,10 @@ function partToMldev$4(fromObject) {
|
|
|
2705
2961
|
if (fromThoughtSignature != null) {
|
|
2706
2962
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2707
2963
|
}
|
|
2964
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2965
|
+
if (fromFunctionCall != null) {
|
|
2966
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
|
|
2967
|
+
}
|
|
2708
2968
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2709
2969
|
'codeExecutionResult',
|
|
2710
2970
|
]);
|
|
@@ -2717,10 +2977,6 @@ function partToMldev$4(fromObject) {
|
|
|
2717
2977
|
if (fromExecutableCode != null) {
|
|
2718
2978
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
2719
2979
|
}
|
|
2720
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2721
|
-
if (fromFunctionCall != null) {
|
|
2722
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
2723
|
-
}
|
|
2724
2980
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
2725
2981
|
'functionResponse',
|
|
2726
2982
|
]);
|
|
@@ -3345,18 +3601,92 @@ function batchJobSourceToMldev(apiClient, fromObject) {
|
|
|
3345
3601
|
}
|
|
3346
3602
|
return toObject;
|
|
3347
3603
|
}
|
|
3348
|
-
function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3604
|
+
function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3605
|
+
const toObject = {};
|
|
3606
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3607
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3608
|
+
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3609
|
+
}
|
|
3610
|
+
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
3611
|
+
throw new Error('dest parameter is not supported in Gemini API.');
|
|
3612
|
+
}
|
|
3613
|
+
return toObject;
|
|
3614
|
+
}
|
|
3615
|
+
function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3616
|
+
const toObject = {};
|
|
3617
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3618
|
+
if (fromModel != null) {
|
|
3619
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3620
|
+
}
|
|
3621
|
+
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3622
|
+
if (fromSrc != null) {
|
|
3623
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], batchJobSourceToMldev(apiClient, tBatchJobSource(apiClient, fromSrc)));
|
|
3624
|
+
}
|
|
3625
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3626
|
+
if (fromConfig != null) {
|
|
3627
|
+
setValueByPath(toObject, ['config'], createBatchJobConfigToMldev(fromConfig, toObject));
|
|
3628
|
+
}
|
|
3629
|
+
return toObject;
|
|
3630
|
+
}
|
|
3631
|
+
function embedContentConfigToMldev$1(fromObject, parentObject) {
|
|
3632
|
+
const toObject = {};
|
|
3633
|
+
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
3634
|
+
if (parentObject !== undefined && fromTaskType != null) {
|
|
3635
|
+
setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
|
|
3636
|
+
}
|
|
3637
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3638
|
+
if (parentObject !== undefined && fromTitle != null) {
|
|
3639
|
+
setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
|
|
3640
|
+
}
|
|
3641
|
+
const fromOutputDimensionality = getValueByPath(fromObject, [
|
|
3642
|
+
'outputDimensionality',
|
|
3643
|
+
]);
|
|
3644
|
+
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
3645
|
+
setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
|
|
3646
|
+
}
|
|
3647
|
+
if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
|
|
3648
|
+
throw new Error('mimeType parameter is not supported in Gemini API.');
|
|
3649
|
+
}
|
|
3650
|
+
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
3651
|
+
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
3652
|
+
}
|
|
3653
|
+
return toObject;
|
|
3654
|
+
}
|
|
3655
|
+
function embedContentBatchToMldev(apiClient, fromObject) {
|
|
3656
|
+
const toObject = {};
|
|
3657
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3658
|
+
if (fromContents != null) {
|
|
3659
|
+
setValueByPath(toObject, ['requests[]', 'request', 'content'], tContentsForEmbed(apiClient, fromContents));
|
|
3660
|
+
}
|
|
3661
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3662
|
+
if (fromConfig != null) {
|
|
3663
|
+
setValueByPath(toObject, ['config'], embedContentConfigToMldev$1(fromConfig, toObject));
|
|
3664
|
+
}
|
|
3665
|
+
return toObject;
|
|
3666
|
+
}
|
|
3667
|
+
function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
|
|
3668
|
+
const toObject = {};
|
|
3669
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
3670
|
+
if (fromFileName != null) {
|
|
3671
|
+
setValueByPath(toObject, ['file_name'], fromFileName);
|
|
3672
|
+
}
|
|
3673
|
+
const fromInlinedRequests = getValueByPath(fromObject, [
|
|
3674
|
+
'inlinedRequests',
|
|
3675
|
+
]);
|
|
3676
|
+
if (fromInlinedRequests != null) {
|
|
3677
|
+
setValueByPath(toObject, ['requests'], embedContentBatchToMldev(apiClient, fromInlinedRequests));
|
|
3678
|
+
}
|
|
3679
|
+
return toObject;
|
|
3680
|
+
}
|
|
3681
|
+
function createEmbeddingsBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3349
3682
|
const toObject = {};
|
|
3350
3683
|
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3351
3684
|
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3352
3685
|
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3353
3686
|
}
|
|
3354
|
-
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
3355
|
-
throw new Error('dest parameter is not supported in Gemini API.');
|
|
3356
|
-
}
|
|
3357
3687
|
return toObject;
|
|
3358
3688
|
}
|
|
3359
|
-
function
|
|
3689
|
+
function createEmbeddingsBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3360
3690
|
const toObject = {};
|
|
3361
3691
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3362
3692
|
if (fromModel != null) {
|
|
@@ -3364,11 +3694,11 @@ function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
|
3364
3694
|
}
|
|
3365
3695
|
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3366
3696
|
if (fromSrc != null) {
|
|
3367
|
-
setValueByPath(toObject, ['batch', 'inputConfig'],
|
|
3697
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], embeddingsBatchJobSourceToMldev(apiClient, fromSrc));
|
|
3368
3698
|
}
|
|
3369
3699
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3370
3700
|
if (fromConfig != null) {
|
|
3371
|
-
setValueByPath(toObject, ['config'],
|
|
3701
|
+
setValueByPath(toObject, ['config'], createEmbeddingsBatchJobConfigToMldev(fromConfig, toObject));
|
|
3372
3702
|
}
|
|
3373
3703
|
return toObject;
|
|
3374
3704
|
}
|
|
@@ -3473,6 +3803,10 @@ function batchJobDestinationToVertex(fromObject) {
|
|
|
3473
3803
|
if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
|
|
3474
3804
|
throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
|
|
3475
3805
|
}
|
|
3806
|
+
if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
|
|
3807
|
+
undefined) {
|
|
3808
|
+
throw new Error('inlinedEmbedContentResponses parameter is not supported in Vertex AI.');
|
|
3809
|
+
}
|
|
3476
3810
|
return toObject;
|
|
3477
3811
|
}
|
|
3478
3812
|
function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -3603,6 +3937,22 @@ function fileDataFromMldev$2(fromObject) {
|
|
|
3603
3937
|
}
|
|
3604
3938
|
return toObject;
|
|
3605
3939
|
}
|
|
3940
|
+
function functionCallFromMldev$2(fromObject) {
|
|
3941
|
+
const toObject = {};
|
|
3942
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
3943
|
+
if (fromId != null) {
|
|
3944
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
3945
|
+
}
|
|
3946
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
3947
|
+
if (fromArgs != null) {
|
|
3948
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
3949
|
+
}
|
|
3950
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3951
|
+
if (fromName != null) {
|
|
3952
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3953
|
+
}
|
|
3954
|
+
return toObject;
|
|
3955
|
+
}
|
|
3606
3956
|
function partFromMldev$2(fromObject) {
|
|
3607
3957
|
const toObject = {};
|
|
3608
3958
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -3629,6 +3979,10 @@ function partFromMldev$2(fromObject) {
|
|
|
3629
3979
|
if (fromThoughtSignature != null) {
|
|
3630
3980
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
3631
3981
|
}
|
|
3982
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3983
|
+
if (fromFunctionCall != null) {
|
|
3984
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$2(fromFunctionCall));
|
|
3985
|
+
}
|
|
3632
3986
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3633
3987
|
'codeExecutionResult',
|
|
3634
3988
|
]);
|
|
@@ -3641,10 +3995,6 @@ function partFromMldev$2(fromObject) {
|
|
|
3641
3995
|
if (fromExecutableCode != null) {
|
|
3642
3996
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
3643
3997
|
}
|
|
3644
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3645
|
-
if (fromFunctionCall != null) {
|
|
3646
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3647
|
-
}
|
|
3648
3998
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
3649
3999
|
'functionResponse',
|
|
3650
4000
|
]);
|
|
@@ -3833,6 +4183,38 @@ function inlinedResponseFromMldev(fromObject) {
|
|
|
3833
4183
|
}
|
|
3834
4184
|
return toObject;
|
|
3835
4185
|
}
|
|
4186
|
+
function contentEmbeddingFromMldev$1(fromObject) {
|
|
4187
|
+
const toObject = {};
|
|
4188
|
+
const fromValues = getValueByPath(fromObject, ['values']);
|
|
4189
|
+
if (fromValues != null) {
|
|
4190
|
+
setValueByPath(toObject, ['values'], fromValues);
|
|
4191
|
+
}
|
|
4192
|
+
return toObject;
|
|
4193
|
+
}
|
|
4194
|
+
function singleEmbedContentResponseFromMldev(fromObject) {
|
|
4195
|
+
const toObject = {};
|
|
4196
|
+
const fromEmbedding = getValueByPath(fromObject, ['embedding']);
|
|
4197
|
+
if (fromEmbedding != null) {
|
|
4198
|
+
setValueByPath(toObject, ['embedding'], contentEmbeddingFromMldev$1(fromEmbedding));
|
|
4199
|
+
}
|
|
4200
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
4201
|
+
if (fromTokenCount != null) {
|
|
4202
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
4203
|
+
}
|
|
4204
|
+
return toObject;
|
|
4205
|
+
}
|
|
4206
|
+
function inlinedEmbedContentResponseFromMldev(fromObject) {
|
|
4207
|
+
const toObject = {};
|
|
4208
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
4209
|
+
if (fromResponse != null) {
|
|
4210
|
+
setValueByPath(toObject, ['response'], singleEmbedContentResponseFromMldev(fromResponse));
|
|
4211
|
+
}
|
|
4212
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
4213
|
+
if (fromError != null) {
|
|
4214
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev(fromError));
|
|
4215
|
+
}
|
|
4216
|
+
return toObject;
|
|
4217
|
+
}
|
|
3836
4218
|
function batchJobDestinationFromMldev(fromObject) {
|
|
3837
4219
|
const toObject = {};
|
|
3838
4220
|
const fromFileName = getValueByPath(fromObject, ['responsesFile']);
|
|
@@ -3852,6 +4234,19 @@ function batchJobDestinationFromMldev(fromObject) {
|
|
|
3852
4234
|
}
|
|
3853
4235
|
setValueByPath(toObject, ['inlinedResponses'], transformedList);
|
|
3854
4236
|
}
|
|
4237
|
+
const fromInlinedEmbedContentResponses = getValueByPath(fromObject, [
|
|
4238
|
+
'inlinedEmbedContentResponses',
|
|
4239
|
+
'inlinedResponses',
|
|
4240
|
+
]);
|
|
4241
|
+
if (fromInlinedEmbedContentResponses != null) {
|
|
4242
|
+
let transformedList = fromInlinedEmbedContentResponses;
|
|
4243
|
+
if (Array.isArray(transformedList)) {
|
|
4244
|
+
transformedList = transformedList.map((item) => {
|
|
4245
|
+
return inlinedEmbedContentResponseFromMldev(item);
|
|
4246
|
+
});
|
|
4247
|
+
}
|
|
4248
|
+
setValueByPath(toObject, ['inlinedEmbedContentResponses'], transformedList);
|
|
4249
|
+
}
|
|
3855
4250
|
return toObject;
|
|
3856
4251
|
}
|
|
3857
4252
|
function batchJobFromMldev(fromObject) {
|
|
@@ -3898,7 +4293,7 @@ function batchJobFromMldev(fromObject) {
|
|
|
3898
4293
|
}
|
|
3899
4294
|
const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
|
|
3900
4295
|
if (fromDest != null) {
|
|
3901
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
|
|
4296
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(tRecvBatchJobDestination(fromDest)));
|
|
3902
4297
|
}
|
|
3903
4298
|
return toObject;
|
|
3904
4299
|
}
|
|
@@ -4051,7 +4446,7 @@ function batchJobFromVertex(fromObject) {
|
|
|
4051
4446
|
}
|
|
4052
4447
|
const fromDest = getValueByPath(fromObject, ['outputConfig']);
|
|
4053
4448
|
if (fromDest != null) {
|
|
4054
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
|
|
4449
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
|
|
4055
4450
|
}
|
|
4056
4451
|
return toObject;
|
|
4057
4452
|
}
|
|
@@ -4317,79 +4712,87 @@ class Batches extends BaseModule {
|
|
|
4317
4712
|
this.create = async (params) => {
|
|
4318
4713
|
var _a, _b;
|
|
4319
4714
|
if (this.apiClient.isVertexAI()) {
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
'Google Cloud Storage URI or BigQuery URI instead.');
|
|
4325
|
-
}
|
|
4326
|
-
params.config = params.config || {};
|
|
4327
|
-
if (params.config.displayName === undefined) {
|
|
4328
|
-
params.config.displayName = 'genaiBatchJob_${timestampStr}';
|
|
4329
|
-
}
|
|
4330
|
-
if (params.config.dest === undefined && typeof params.src === 'string') {
|
|
4331
|
-
if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
|
|
4332
|
-
params.config.dest = `${params.src.slice(0, -6)}/dest`;
|
|
4333
|
-
}
|
|
4334
|
-
else if (params.src.startsWith('bq://')) {
|
|
4335
|
-
params.config.dest =
|
|
4336
|
-
`${params.src}_dest_${timestampStr}`;
|
|
4337
|
-
}
|
|
4338
|
-
else {
|
|
4339
|
-
throw new Error('Unsupported source:' + params.src);
|
|
4340
|
-
}
|
|
4341
|
-
}
|
|
4715
|
+
// Format destination if not provided
|
|
4716
|
+
// Cast params.src as Vertex AI path does not handle InlinedRequest[]
|
|
4717
|
+
params.config = this.formatDestination(params.src, params.config);
|
|
4718
|
+
return this.createInternal(params);
|
|
4342
4719
|
}
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4720
|
+
// MLDEV
|
|
4721
|
+
const src = params.src;
|
|
4722
|
+
const is_inlined = Array.isArray(params.src) || src.inlinedRequests !== undefined;
|
|
4723
|
+
if (!is_inlined) {
|
|
4724
|
+
return this.createInternal(params);
|
|
4725
|
+
}
|
|
4726
|
+
// Inlined generate content requests handling
|
|
4727
|
+
const result = this.createInlinedGenerateContentRequest(params);
|
|
4728
|
+
const path = result.path;
|
|
4729
|
+
const requestBody = result.body;
|
|
4730
|
+
const queryParams = createBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4731
|
+
const response = this.apiClient
|
|
4732
|
+
.request({
|
|
4733
|
+
path: path,
|
|
4734
|
+
queryParams: queryParams,
|
|
4735
|
+
body: JSON.stringify(requestBody),
|
|
4736
|
+
httpMethod: 'POST',
|
|
4737
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4738
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4739
|
+
})
|
|
4740
|
+
.then((httpResponse) => {
|
|
4741
|
+
return httpResponse.json();
|
|
4742
|
+
});
|
|
4743
|
+
return response.then((apiResponse) => {
|
|
4744
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4745
|
+
return resp;
|
|
4746
|
+
});
|
|
4747
|
+
};
|
|
4748
|
+
/**
|
|
4749
|
+
* **Experimental** Creates an embedding batch job.
|
|
4750
|
+
*
|
|
4751
|
+
* @param params - The parameters for create embedding batch job request.
|
|
4752
|
+
* @return The created batch job.
|
|
4753
|
+
*
|
|
4754
|
+
* @example
|
|
4755
|
+
* ```ts
|
|
4756
|
+
* const response = await ai.batches.createEmbeddings({
|
|
4757
|
+
* model: 'text-embedding-004',
|
|
4758
|
+
* src: {fileName: 'files/my_embedding_input'},
|
|
4759
|
+
* });
|
|
4760
|
+
* console.log(response);
|
|
4761
|
+
* ```
|
|
4762
|
+
*/
|
|
4763
|
+
this.createEmbeddings = async (params) => {
|
|
4764
|
+
var _a, _b;
|
|
4765
|
+
console.warn('batches.createEmbeddings() is experimental and may change without notice.');
|
|
4766
|
+
if (this.apiClient.isVertexAI()) {
|
|
4767
|
+
throw new Error('Vertex AI does not support batches.createEmbeddings.');
|
|
4768
|
+
}
|
|
4769
|
+
// MLDEV
|
|
4770
|
+
const src = params.src;
|
|
4771
|
+
const is_inlined = src.inlinedRequests !== undefined;
|
|
4772
|
+
if (!is_inlined) {
|
|
4773
|
+
return this.createEmbeddingsInternal(params); // Fixed typo here
|
|
4391
4774
|
}
|
|
4392
|
-
|
|
4775
|
+
// Inlined embed content requests handling
|
|
4776
|
+
const result = this.createInlinedEmbedContentRequest(params);
|
|
4777
|
+
const path = result.path;
|
|
4778
|
+
const requestBody = result.body;
|
|
4779
|
+
const queryParams = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4780
|
+
const response = this.apiClient
|
|
4781
|
+
.request({
|
|
4782
|
+
path: path,
|
|
4783
|
+
queryParams: queryParams,
|
|
4784
|
+
body: JSON.stringify(requestBody),
|
|
4785
|
+
httpMethod: 'POST',
|
|
4786
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4787
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4788
|
+
})
|
|
4789
|
+
.then((httpResponse) => {
|
|
4790
|
+
return httpResponse.json();
|
|
4791
|
+
});
|
|
4792
|
+
return response.then((apiResponse) => {
|
|
4793
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4794
|
+
return resp;
|
|
4795
|
+
});
|
|
4393
4796
|
};
|
|
4394
4797
|
/**
|
|
4395
4798
|
* Lists batch job configurations.
|
|
@@ -4409,6 +4812,112 @@ class Batches extends BaseModule {
|
|
|
4409
4812
|
return new Pager(PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4410
4813
|
};
|
|
4411
4814
|
}
|
|
4815
|
+
// Helper function to handle inlined generate content requests
|
|
4816
|
+
createInlinedGenerateContentRequest(params) {
|
|
4817
|
+
const body = createBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4818
|
+
params);
|
|
4819
|
+
const urlParams = body['_url'];
|
|
4820
|
+
const path = formatMap('{model}:batchGenerateContent', 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
|
+
for (const request of requests) {
|
|
4827
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4828
|
+
if (requestDict['systemInstruction']) {
|
|
4829
|
+
const systemInstructionValue = requestDict['systemInstruction'];
|
|
4830
|
+
delete requestDict['systemInstruction'];
|
|
4831
|
+
const requestContent = requestDict['request'];
|
|
4832
|
+
requestContent['systemInstruction'] = systemInstructionValue;
|
|
4833
|
+
requestDict['request'] = requestContent;
|
|
4834
|
+
}
|
|
4835
|
+
newRequests.push(requestDict);
|
|
4836
|
+
}
|
|
4837
|
+
requestsWrapper['requests'] = newRequests;
|
|
4838
|
+
delete body['config'];
|
|
4839
|
+
delete body['_url'];
|
|
4840
|
+
delete body['_query'];
|
|
4841
|
+
return { path, body };
|
|
4842
|
+
}
|
|
4843
|
+
// Helper function to handle inlined embedding requests
|
|
4844
|
+
createInlinedEmbedContentRequest(params) {
|
|
4845
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4846
|
+
params);
|
|
4847
|
+
const urlParams = body['_url'];
|
|
4848
|
+
const path = formatMap('{model}:asyncBatchEmbedContent', 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
|
+
delete requestsWrapper['config']; // Remove top-level config
|
|
4855
|
+
for (const request of requests) {
|
|
4856
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4857
|
+
const innerRequest = requestDict['request'];
|
|
4858
|
+
for (const key in requestDict) {
|
|
4859
|
+
if (key !== 'request') {
|
|
4860
|
+
innerRequest[key] = requestDict[key];
|
|
4861
|
+
delete requestDict[key];
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
newRequests.push(requestDict);
|
|
4865
|
+
}
|
|
4866
|
+
requestsWrapper['requests'] = newRequests;
|
|
4867
|
+
delete body['config'];
|
|
4868
|
+
delete body['_url'];
|
|
4869
|
+
delete body['_query'];
|
|
4870
|
+
return { path, body };
|
|
4871
|
+
}
|
|
4872
|
+
// Helper function to get the first GCS URI
|
|
4873
|
+
getGcsUri(src) {
|
|
4874
|
+
if (typeof src === 'string') {
|
|
4875
|
+
return src.startsWith('gs://') ? src : undefined;
|
|
4876
|
+
}
|
|
4877
|
+
if (!Array.isArray(src) && src.gcsUri && src.gcsUri.length > 0) {
|
|
4878
|
+
return src.gcsUri[0];
|
|
4879
|
+
}
|
|
4880
|
+
return undefined;
|
|
4881
|
+
}
|
|
4882
|
+
// Helper function to get the BigQuery URI
|
|
4883
|
+
getBigqueryUri(src) {
|
|
4884
|
+
if (typeof src === 'string') {
|
|
4885
|
+
return src.startsWith('bq://') ? src : undefined;
|
|
4886
|
+
}
|
|
4887
|
+
if (!Array.isArray(src)) {
|
|
4888
|
+
return src.bigqueryUri;
|
|
4889
|
+
}
|
|
4890
|
+
return undefined;
|
|
4891
|
+
}
|
|
4892
|
+
// Function to format the destination configuration for Vertex AI
|
|
4893
|
+
formatDestination(src, config) {
|
|
4894
|
+
const newConfig = config ? Object.assign({}, config) : {};
|
|
4895
|
+
const timestampStr = Date.now().toString();
|
|
4896
|
+
if (!newConfig.displayName) {
|
|
4897
|
+
newConfig.displayName = `genaiBatchJob_${timestampStr}`;
|
|
4898
|
+
}
|
|
4899
|
+
if (newConfig.dest === undefined) {
|
|
4900
|
+
const gcsUri = this.getGcsUri(src);
|
|
4901
|
+
const bigqueryUri = this.getBigqueryUri(src);
|
|
4902
|
+
if (gcsUri) {
|
|
4903
|
+
if (gcsUri.endsWith('.jsonl')) {
|
|
4904
|
+
// For .jsonl files, remove suffix and add /dest
|
|
4905
|
+
newConfig.dest = `${gcsUri.slice(0, -6)}/dest`;
|
|
4906
|
+
}
|
|
4907
|
+
else {
|
|
4908
|
+
// Fallback for other GCS URIs
|
|
4909
|
+
newConfig.dest = `${gcsUri}_dest_${timestampStr}`;
|
|
4910
|
+
}
|
|
4911
|
+
}
|
|
4912
|
+
else if (bigqueryUri) {
|
|
4913
|
+
newConfig.dest = `${bigqueryUri}_dest_${timestampStr}`;
|
|
4914
|
+
}
|
|
4915
|
+
else {
|
|
4916
|
+
throw new Error('Unsupported source for Vertex AI: No GCS or BigQuery URI found.');
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4919
|
+
return newConfig;
|
|
4920
|
+
}
|
|
4412
4921
|
/**
|
|
4413
4922
|
* Internal method to create batch job.
|
|
4414
4923
|
*
|
|
@@ -4470,6 +4979,46 @@ class Batches extends BaseModule {
|
|
|
4470
4979
|
});
|
|
4471
4980
|
}
|
|
4472
4981
|
}
|
|
4982
|
+
/**
|
|
4983
|
+
* Internal method to create batch job.
|
|
4984
|
+
*
|
|
4985
|
+
* @param params - The parameters for create batch job request.
|
|
4986
|
+
* @return The created batch job.
|
|
4987
|
+
*
|
|
4988
|
+
*/
|
|
4989
|
+
async createEmbeddingsInternal(params) {
|
|
4990
|
+
var _a, _b;
|
|
4991
|
+
let response;
|
|
4992
|
+
let path = '';
|
|
4993
|
+
let queryParams = {};
|
|
4994
|
+
if (this.apiClient.isVertexAI()) {
|
|
4995
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
4996
|
+
}
|
|
4997
|
+
else {
|
|
4998
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params);
|
|
4999
|
+
path = formatMap('{model}:asyncBatchEmbedContent', body['_url']);
|
|
5000
|
+
queryParams = body['_query'];
|
|
5001
|
+
delete body['config'];
|
|
5002
|
+
delete body['_url'];
|
|
5003
|
+
delete body['_query'];
|
|
5004
|
+
response = this.apiClient
|
|
5005
|
+
.request({
|
|
5006
|
+
path: path,
|
|
5007
|
+
queryParams: queryParams,
|
|
5008
|
+
body: JSON.stringify(body),
|
|
5009
|
+
httpMethod: 'POST',
|
|
5010
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
5011
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
5012
|
+
})
|
|
5013
|
+
.then((httpResponse) => {
|
|
5014
|
+
return httpResponse.json();
|
|
5015
|
+
});
|
|
5016
|
+
return response.then((apiResponse) => {
|
|
5017
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
5018
|
+
return resp;
|
|
5019
|
+
});
|
|
5020
|
+
}
|
|
5021
|
+
}
|
|
4473
5022
|
/**
|
|
4474
5023
|
* Gets batch job configurations.
|
|
4475
5024
|
*
|
|
@@ -4783,6 +5332,22 @@ function fileDataToMldev$3(fromObject) {
|
|
|
4783
5332
|
}
|
|
4784
5333
|
return toObject;
|
|
4785
5334
|
}
|
|
5335
|
+
function functionCallToMldev$3(fromObject) {
|
|
5336
|
+
const toObject = {};
|
|
5337
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5338
|
+
if (fromId != null) {
|
|
5339
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5340
|
+
}
|
|
5341
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5342
|
+
if (fromArgs != null) {
|
|
5343
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5344
|
+
}
|
|
5345
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5346
|
+
if (fromName != null) {
|
|
5347
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5348
|
+
}
|
|
5349
|
+
return toObject;
|
|
5350
|
+
}
|
|
4786
5351
|
function partToMldev$3(fromObject) {
|
|
4787
5352
|
const toObject = {};
|
|
4788
5353
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -4809,6 +5374,10 @@ function partToMldev$3(fromObject) {
|
|
|
4809
5374
|
if (fromThoughtSignature != null) {
|
|
4810
5375
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
4811
5376
|
}
|
|
5377
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5378
|
+
if (fromFunctionCall != null) {
|
|
5379
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
|
|
5380
|
+
}
|
|
4812
5381
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4813
5382
|
'codeExecutionResult',
|
|
4814
5383
|
]);
|
|
@@ -4821,10 +5390,6 @@ function partToMldev$3(fromObject) {
|
|
|
4821
5390
|
if (fromExecutableCode != null) {
|
|
4822
5391
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4823
5392
|
}
|
|
4824
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4825
|
-
if (fromFunctionCall != null) {
|
|
4826
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4827
|
-
}
|
|
4828
5393
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4829
5394
|
'functionResponse',
|
|
4830
5395
|
]);
|
|
@@ -5232,6 +5797,22 @@ function fileDataToVertex$2(fromObject) {
|
|
|
5232
5797
|
}
|
|
5233
5798
|
return toObject;
|
|
5234
5799
|
}
|
|
5800
|
+
function functionCallToVertex$2(fromObject) {
|
|
5801
|
+
const toObject = {};
|
|
5802
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5803
|
+
if (fromId != null) {
|
|
5804
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5805
|
+
}
|
|
5806
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5807
|
+
if (fromArgs != null) {
|
|
5808
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5809
|
+
}
|
|
5810
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5811
|
+
if (fromName != null) {
|
|
5812
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5813
|
+
}
|
|
5814
|
+
return toObject;
|
|
5815
|
+
}
|
|
5235
5816
|
function partToVertex$2(fromObject) {
|
|
5236
5817
|
const toObject = {};
|
|
5237
5818
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -5258,6 +5839,10 @@ function partToVertex$2(fromObject) {
|
|
|
5258
5839
|
if (fromThoughtSignature != null) {
|
|
5259
5840
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5260
5841
|
}
|
|
5842
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5843
|
+
if (fromFunctionCall != null) {
|
|
5844
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$2(fromFunctionCall));
|
|
5845
|
+
}
|
|
5261
5846
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5262
5847
|
'codeExecutionResult',
|
|
5263
5848
|
]);
|
|
@@ -5270,10 +5855,6 @@ function partToVertex$2(fromObject) {
|
|
|
5270
5855
|
if (fromExecutableCode != null) {
|
|
5271
5856
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
5272
5857
|
}
|
|
5273
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5274
|
-
if (fromFunctionCall != null) {
|
|
5275
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
5276
|
-
}
|
|
5277
5858
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
5278
5859
|
'functionResponse',
|
|
5279
5860
|
]);
|
|
@@ -7303,6 +7884,22 @@ function fileDataToMldev$2(fromObject) {
|
|
|
7303
7884
|
}
|
|
7304
7885
|
return toObject;
|
|
7305
7886
|
}
|
|
7887
|
+
function functionCallToMldev$2(fromObject) {
|
|
7888
|
+
const toObject = {};
|
|
7889
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
7890
|
+
if (fromId != null) {
|
|
7891
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
7892
|
+
}
|
|
7893
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
7894
|
+
if (fromArgs != null) {
|
|
7895
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
7896
|
+
}
|
|
7897
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7898
|
+
if (fromName != null) {
|
|
7899
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
7900
|
+
}
|
|
7901
|
+
return toObject;
|
|
7902
|
+
}
|
|
7306
7903
|
function partToMldev$2(fromObject) {
|
|
7307
7904
|
const toObject = {};
|
|
7308
7905
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -7329,6 +7926,10 @@ function partToMldev$2(fromObject) {
|
|
|
7329
7926
|
if (fromThoughtSignature != null) {
|
|
7330
7927
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7331
7928
|
}
|
|
7929
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
7930
|
+
if (fromFunctionCall != null) {
|
|
7931
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
|
|
7932
|
+
}
|
|
7332
7933
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7333
7934
|
'codeExecutionResult',
|
|
7334
7935
|
]);
|
|
@@ -7341,10 +7942,6 @@ function partToMldev$2(fromObject) {
|
|
|
7341
7942
|
if (fromExecutableCode != null) {
|
|
7342
7943
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
7343
7944
|
}
|
|
7344
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
7345
|
-
if (fromFunctionCall != null) {
|
|
7346
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
7347
|
-
}
|
|
7348
7945
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
7349
7946
|
'functionResponse',
|
|
7350
7947
|
]);
|
|
@@ -8007,6 +8604,22 @@ function fileDataToVertex$1(fromObject) {
|
|
|
8007
8604
|
}
|
|
8008
8605
|
return toObject;
|
|
8009
8606
|
}
|
|
8607
|
+
function functionCallToVertex$1(fromObject) {
|
|
8608
|
+
const toObject = {};
|
|
8609
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
8610
|
+
if (fromId != null) {
|
|
8611
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
8612
|
+
}
|
|
8613
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
8614
|
+
if (fromArgs != null) {
|
|
8615
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
8616
|
+
}
|
|
8617
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
8618
|
+
if (fromName != null) {
|
|
8619
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
8620
|
+
}
|
|
8621
|
+
return toObject;
|
|
8622
|
+
}
|
|
8010
8623
|
function partToVertex$1(fromObject) {
|
|
8011
8624
|
const toObject = {};
|
|
8012
8625
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -8033,6 +8646,10 @@ function partToVertex$1(fromObject) {
|
|
|
8033
8646
|
if (fromThoughtSignature != null) {
|
|
8034
8647
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8035
8648
|
}
|
|
8649
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8650
|
+
if (fromFunctionCall != null) {
|
|
8651
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$1(fromFunctionCall));
|
|
8652
|
+
}
|
|
8036
8653
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8037
8654
|
'codeExecutionResult',
|
|
8038
8655
|
]);
|
|
@@ -8045,10 +8662,6 @@ function partToVertex$1(fromObject) {
|
|
|
8045
8662
|
if (fromExecutableCode != null) {
|
|
8046
8663
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8047
8664
|
}
|
|
8048
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8049
|
-
if (fromFunctionCall != null) {
|
|
8050
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8051
|
-
}
|
|
8052
8665
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8053
8666
|
'functionResponse',
|
|
8054
8667
|
]);
|
|
@@ -8596,6 +9209,22 @@ function fileDataFromMldev$1(fromObject) {
|
|
|
8596
9209
|
}
|
|
8597
9210
|
return toObject;
|
|
8598
9211
|
}
|
|
9212
|
+
function functionCallFromMldev$1(fromObject) {
|
|
9213
|
+
const toObject = {};
|
|
9214
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
9215
|
+
if (fromId != null) {
|
|
9216
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
9217
|
+
}
|
|
9218
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9219
|
+
if (fromArgs != null) {
|
|
9220
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9221
|
+
}
|
|
9222
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9223
|
+
if (fromName != null) {
|
|
9224
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9225
|
+
}
|
|
9226
|
+
return toObject;
|
|
9227
|
+
}
|
|
8599
9228
|
function partFromMldev$1(fromObject) {
|
|
8600
9229
|
const toObject = {};
|
|
8601
9230
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -8622,6 +9251,10 @@ function partFromMldev$1(fromObject) {
|
|
|
8622
9251
|
if (fromThoughtSignature != null) {
|
|
8623
9252
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8624
9253
|
}
|
|
9254
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9255
|
+
if (fromFunctionCall != null) {
|
|
9256
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$1(fromFunctionCall));
|
|
9257
|
+
}
|
|
8625
9258
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8626
9259
|
'codeExecutionResult',
|
|
8627
9260
|
]);
|
|
@@ -8634,10 +9267,6 @@ function partFromMldev$1(fromObject) {
|
|
|
8634
9267
|
if (fromExecutableCode != null) {
|
|
8635
9268
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8636
9269
|
}
|
|
8637
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8638
|
-
if (fromFunctionCall != null) {
|
|
8639
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8640
|
-
}
|
|
8641
9270
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8642
9271
|
'functionResponse',
|
|
8643
9272
|
]);
|
|
@@ -8754,22 +9383,6 @@ function liveServerContentFromMldev(fromObject) {
|
|
|
8754
9383
|
}
|
|
8755
9384
|
return toObject;
|
|
8756
9385
|
}
|
|
8757
|
-
function functionCallFromMldev(fromObject) {
|
|
8758
|
-
const toObject = {};
|
|
8759
|
-
const fromId = getValueByPath(fromObject, ['id']);
|
|
8760
|
-
if (fromId != null) {
|
|
8761
|
-
setValueByPath(toObject, ['id'], fromId);
|
|
8762
|
-
}
|
|
8763
|
-
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
8764
|
-
if (fromArgs != null) {
|
|
8765
|
-
setValueByPath(toObject, ['args'], fromArgs);
|
|
8766
|
-
}
|
|
8767
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
8768
|
-
if (fromName != null) {
|
|
8769
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
8770
|
-
}
|
|
8771
|
-
return toObject;
|
|
8772
|
-
}
|
|
8773
9386
|
function liveServerToolCallFromMldev(fromObject) {
|
|
8774
9387
|
const toObject = {};
|
|
8775
9388
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -8779,7 +9392,7 @@ function liveServerToolCallFromMldev(fromObject) {
|
|
|
8779
9392
|
let transformedList = fromFunctionCalls;
|
|
8780
9393
|
if (Array.isArray(transformedList)) {
|
|
8781
9394
|
transformedList = transformedList.map((item) => {
|
|
8782
|
-
return functionCallFromMldev(item);
|
|
9395
|
+
return functionCallFromMldev$1(item);
|
|
8783
9396
|
});
|
|
8784
9397
|
}
|
|
8785
9398
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -9190,6 +9803,22 @@ function fileDataFromVertex$1(fromObject) {
|
|
|
9190
9803
|
}
|
|
9191
9804
|
return toObject;
|
|
9192
9805
|
}
|
|
9806
|
+
function functionCallFromVertex$1(fromObject) {
|
|
9807
|
+
const toObject = {};
|
|
9808
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
9809
|
+
if (fromId != null) {
|
|
9810
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
9811
|
+
}
|
|
9812
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9813
|
+
if (fromArgs != null) {
|
|
9814
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9815
|
+
}
|
|
9816
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9817
|
+
if (fromName != null) {
|
|
9818
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9819
|
+
}
|
|
9820
|
+
return toObject;
|
|
9821
|
+
}
|
|
9193
9822
|
function partFromVertex$1(fromObject) {
|
|
9194
9823
|
const toObject = {};
|
|
9195
9824
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9216,6 +9845,10 @@ function partFromVertex$1(fromObject) {
|
|
|
9216
9845
|
if (fromThoughtSignature != null) {
|
|
9217
9846
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9218
9847
|
}
|
|
9848
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9849
|
+
if (fromFunctionCall != null) {
|
|
9850
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex$1(fromFunctionCall));
|
|
9851
|
+
}
|
|
9219
9852
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9220
9853
|
'codeExecutionResult',
|
|
9221
9854
|
]);
|
|
@@ -9228,10 +9861,6 @@ function partFromVertex$1(fromObject) {
|
|
|
9228
9861
|
if (fromExecutableCode != null) {
|
|
9229
9862
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9230
9863
|
}
|
|
9231
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9232
|
-
if (fromFunctionCall != null) {
|
|
9233
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9234
|
-
}
|
|
9235
9864
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9236
9865
|
'functionResponse',
|
|
9237
9866
|
]);
|
|
@@ -9314,18 +9943,6 @@ function liveServerContentFromVertex(fromObject) {
|
|
|
9314
9943
|
}
|
|
9315
9944
|
return toObject;
|
|
9316
9945
|
}
|
|
9317
|
-
function functionCallFromVertex(fromObject) {
|
|
9318
|
-
const toObject = {};
|
|
9319
|
-
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9320
|
-
if (fromArgs != null) {
|
|
9321
|
-
setValueByPath(toObject, ['args'], fromArgs);
|
|
9322
|
-
}
|
|
9323
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
9324
|
-
if (fromName != null) {
|
|
9325
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
9326
|
-
}
|
|
9327
|
-
return toObject;
|
|
9328
|
-
}
|
|
9329
9946
|
function liveServerToolCallFromVertex(fromObject) {
|
|
9330
9947
|
const toObject = {};
|
|
9331
9948
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -9335,7 +9952,7 @@ function liveServerToolCallFromVertex(fromObject) {
|
|
|
9335
9952
|
let transformedList = fromFunctionCalls;
|
|
9336
9953
|
if (Array.isArray(transformedList)) {
|
|
9337
9954
|
transformedList = transformedList.map((item) => {
|
|
9338
|
-
return functionCallFromVertex(item);
|
|
9955
|
+
return functionCallFromVertex$1(item);
|
|
9339
9956
|
});
|
|
9340
9957
|
}
|
|
9341
9958
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -9574,6 +10191,22 @@ function fileDataToMldev$1(fromObject) {
|
|
|
9574
10191
|
}
|
|
9575
10192
|
return toObject;
|
|
9576
10193
|
}
|
|
10194
|
+
function functionCallToMldev$1(fromObject) {
|
|
10195
|
+
const toObject = {};
|
|
10196
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
10197
|
+
if (fromId != null) {
|
|
10198
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
10199
|
+
}
|
|
10200
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10201
|
+
if (fromArgs != null) {
|
|
10202
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
10203
|
+
}
|
|
10204
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
10205
|
+
if (fromName != null) {
|
|
10206
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
10207
|
+
}
|
|
10208
|
+
return toObject;
|
|
10209
|
+
}
|
|
9577
10210
|
function partToMldev$1(fromObject) {
|
|
9578
10211
|
const toObject = {};
|
|
9579
10212
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9600,6 +10233,10 @@ function partToMldev$1(fromObject) {
|
|
|
9600
10233
|
if (fromThoughtSignature != null) {
|
|
9601
10234
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9602
10235
|
}
|
|
10236
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10237
|
+
if (fromFunctionCall != null) {
|
|
10238
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
|
|
10239
|
+
}
|
|
9603
10240
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9604
10241
|
'codeExecutionResult',
|
|
9605
10242
|
]);
|
|
@@ -9612,10 +10249,6 @@ function partToMldev$1(fromObject) {
|
|
|
9612
10249
|
if (fromExecutableCode != null) {
|
|
9613
10250
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9614
10251
|
}
|
|
9615
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9616
|
-
if (fromFunctionCall != null) {
|
|
9617
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9618
|
-
}
|
|
9619
10252
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9620
10253
|
'functionResponse',
|
|
9621
10254
|
]);
|
|
@@ -10558,6 +11191,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
10558
11191
|
if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
|
|
10559
11192
|
throw new Error('referenceImages parameter is not supported in Gemini API.');
|
|
10560
11193
|
}
|
|
11194
|
+
if (getValueByPath(fromObject, ['mask']) !== undefined) {
|
|
11195
|
+
throw new Error('mask parameter is not supported in Gemini API.');
|
|
11196
|
+
}
|
|
10561
11197
|
if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
|
|
10562
11198
|
throw new Error('compressionQuality parameter is not supported in Gemini API.');
|
|
10563
11199
|
}
|
|
@@ -10638,6 +11274,22 @@ function fileDataToVertex(fromObject) {
|
|
|
10638
11274
|
}
|
|
10639
11275
|
return toObject;
|
|
10640
11276
|
}
|
|
11277
|
+
function functionCallToVertex(fromObject) {
|
|
11278
|
+
const toObject = {};
|
|
11279
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
11280
|
+
if (fromId != null) {
|
|
11281
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
11282
|
+
}
|
|
11283
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
11284
|
+
if (fromArgs != null) {
|
|
11285
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
11286
|
+
}
|
|
11287
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
11288
|
+
if (fromName != null) {
|
|
11289
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
11290
|
+
}
|
|
11291
|
+
return toObject;
|
|
11292
|
+
}
|
|
10641
11293
|
function partToVertex(fromObject) {
|
|
10642
11294
|
const toObject = {};
|
|
10643
11295
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -10664,6 +11316,10 @@ function partToVertex(fromObject) {
|
|
|
10664
11316
|
if (fromThoughtSignature != null) {
|
|
10665
11317
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10666
11318
|
}
|
|
11319
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11320
|
+
if (fromFunctionCall != null) {
|
|
11321
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex(fromFunctionCall));
|
|
11322
|
+
}
|
|
10667
11323
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10668
11324
|
'codeExecutionResult',
|
|
10669
11325
|
]);
|
|
@@ -10676,10 +11332,6 @@ function partToVertex(fromObject) {
|
|
|
10676
11332
|
if (fromExecutableCode != null) {
|
|
10677
11333
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
10678
11334
|
}
|
|
10679
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10680
|
-
if (fromFunctionCall != null) {
|
|
10681
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
10682
|
-
}
|
|
10683
11335
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
10684
11336
|
'functionResponse',
|
|
10685
11337
|
]);
|
|
@@ -12150,6 +12802,18 @@ function videoGenerationReferenceImageToVertex(fromObject) {
|
|
|
12150
12802
|
}
|
|
12151
12803
|
return toObject;
|
|
12152
12804
|
}
|
|
12805
|
+
function videoGenerationMaskToVertex(fromObject) {
|
|
12806
|
+
const toObject = {};
|
|
12807
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
12808
|
+
if (fromImage != null) {
|
|
12809
|
+
setValueByPath(toObject, ['_self'], imageToVertex(fromImage));
|
|
12810
|
+
}
|
|
12811
|
+
const fromMaskMode = getValueByPath(fromObject, ['maskMode']);
|
|
12812
|
+
if (fromMaskMode != null) {
|
|
12813
|
+
setValueByPath(toObject, ['maskMode'], fromMaskMode);
|
|
12814
|
+
}
|
|
12815
|
+
return toObject;
|
|
12816
|
+
}
|
|
12153
12817
|
function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
12154
12818
|
const toObject = {};
|
|
12155
12819
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -12228,6 +12892,10 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
|
12228
12892
|
}
|
|
12229
12893
|
setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
|
|
12230
12894
|
}
|
|
12895
|
+
const fromMask = getValueByPath(fromObject, ['mask']);
|
|
12896
|
+
if (parentObject !== undefined && fromMask != null) {
|
|
12897
|
+
setValueByPath(parentObject, ['instances[0]', 'mask'], videoGenerationMaskToVertex(fromMask));
|
|
12898
|
+
}
|
|
12231
12899
|
const fromCompressionQuality = getValueByPath(fromObject, [
|
|
12232
12900
|
'compressionQuality',
|
|
12233
12901
|
]);
|
|
@@ -12304,6 +12972,22 @@ function fileDataFromMldev(fromObject) {
|
|
|
12304
12972
|
}
|
|
12305
12973
|
return toObject;
|
|
12306
12974
|
}
|
|
12975
|
+
function functionCallFromMldev(fromObject) {
|
|
12976
|
+
const toObject = {};
|
|
12977
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
12978
|
+
if (fromId != null) {
|
|
12979
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
12980
|
+
}
|
|
12981
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
12982
|
+
if (fromArgs != null) {
|
|
12983
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
12984
|
+
}
|
|
12985
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
12986
|
+
if (fromName != null) {
|
|
12987
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
12988
|
+
}
|
|
12989
|
+
return toObject;
|
|
12990
|
+
}
|
|
12307
12991
|
function partFromMldev(fromObject) {
|
|
12308
12992
|
const toObject = {};
|
|
12309
12993
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -12330,6 +13014,10 @@ function partFromMldev(fromObject) {
|
|
|
12330
13014
|
if (fromThoughtSignature != null) {
|
|
12331
13015
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
12332
13016
|
}
|
|
13017
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13018
|
+
if (fromFunctionCall != null) {
|
|
13019
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev(fromFunctionCall));
|
|
13020
|
+
}
|
|
12333
13021
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
12334
13022
|
'codeExecutionResult',
|
|
12335
13023
|
]);
|
|
@@ -12342,10 +13030,6 @@ function partFromMldev(fromObject) {
|
|
|
12342
13030
|
if (fromExecutableCode != null) {
|
|
12343
13031
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
12344
13032
|
}
|
|
12345
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
12346
|
-
if (fromFunctionCall != null) {
|
|
12347
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
12348
|
-
}
|
|
12349
13033
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
12350
13034
|
'functionResponse',
|
|
12351
13035
|
]);
|
|
@@ -12868,6 +13552,22 @@ function fileDataFromVertex(fromObject) {
|
|
|
12868
13552
|
}
|
|
12869
13553
|
return toObject;
|
|
12870
13554
|
}
|
|
13555
|
+
function functionCallFromVertex(fromObject) {
|
|
13556
|
+
const toObject = {};
|
|
13557
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
13558
|
+
if (fromId != null) {
|
|
13559
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
13560
|
+
}
|
|
13561
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
13562
|
+
if (fromArgs != null) {
|
|
13563
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
13564
|
+
}
|
|
13565
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13566
|
+
if (fromName != null) {
|
|
13567
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13568
|
+
}
|
|
13569
|
+
return toObject;
|
|
13570
|
+
}
|
|
12871
13571
|
function partFromVertex(fromObject) {
|
|
12872
13572
|
const toObject = {};
|
|
12873
13573
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -12894,6 +13594,10 @@ function partFromVertex(fromObject) {
|
|
|
12894
13594
|
if (fromThoughtSignature != null) {
|
|
12895
13595
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
12896
13596
|
}
|
|
13597
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13598
|
+
if (fromFunctionCall != null) {
|
|
13599
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex(fromFunctionCall));
|
|
13600
|
+
}
|
|
12897
13601
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
12898
13602
|
'codeExecutionResult',
|
|
12899
13603
|
]);
|
|
@@ -12906,10 +13610,6 @@ function partFromVertex(fromObject) {
|
|
|
12906
13610
|
if (fromExecutableCode != null) {
|
|
12907
13611
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
12908
13612
|
}
|
|
12909
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
12910
|
-
if (fromFunctionCall != null) {
|
|
12911
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
12912
|
-
}
|
|
12913
13613
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
12914
13614
|
'functionResponse',
|
|
12915
13615
|
]);
|
|
@@ -13584,7 +14284,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
13584
14284
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
13585
14285
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
13586
14286
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
13587
|
-
const SDK_VERSION = '1.
|
|
14287
|
+
const SDK_VERSION = '1.19.0'; // x-release-please-version
|
|
13588
14288
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
13589
14289
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
13590
14290
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -16569,59 +17269,6 @@ class Models extends BaseModule {
|
|
|
16569
17269
|
}
|
|
16570
17270
|
}
|
|
16571
17271
|
|
|
16572
|
-
/**
|
|
16573
|
-
* @license
|
|
16574
|
-
* Copyright 2025 Google LLC
|
|
16575
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
16576
|
-
*/
|
|
16577
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
16578
|
-
function getOperationParametersToMldev(fromObject) {
|
|
16579
|
-
const toObject = {};
|
|
16580
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
16581
|
-
'operationName',
|
|
16582
|
-
]);
|
|
16583
|
-
if (fromOperationName != null) {
|
|
16584
|
-
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
16585
|
-
}
|
|
16586
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
16587
|
-
if (fromConfig != null) {
|
|
16588
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
16589
|
-
}
|
|
16590
|
-
return toObject;
|
|
16591
|
-
}
|
|
16592
|
-
function fetchPredictOperationParametersToVertex(fromObject) {
|
|
16593
|
-
const toObject = {};
|
|
16594
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
16595
|
-
'operationName',
|
|
16596
|
-
]);
|
|
16597
|
-
if (fromOperationName != null) {
|
|
16598
|
-
setValueByPath(toObject, ['operationName'], fromOperationName);
|
|
16599
|
-
}
|
|
16600
|
-
const fromResourceName = getValueByPath(fromObject, ['resourceName']);
|
|
16601
|
-
if (fromResourceName != null) {
|
|
16602
|
-
setValueByPath(toObject, ['_url', 'resourceName'], fromResourceName);
|
|
16603
|
-
}
|
|
16604
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
16605
|
-
if (fromConfig != null) {
|
|
16606
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
16607
|
-
}
|
|
16608
|
-
return toObject;
|
|
16609
|
-
}
|
|
16610
|
-
function getOperationParametersToVertex(fromObject) {
|
|
16611
|
-
const toObject = {};
|
|
16612
|
-
const fromOperationName = getValueByPath(fromObject, [
|
|
16613
|
-
'operationName',
|
|
16614
|
-
]);
|
|
16615
|
-
if (fromOperationName != null) {
|
|
16616
|
-
setValueByPath(toObject, ['_url', 'operationName'], fromOperationName);
|
|
16617
|
-
}
|
|
16618
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
16619
|
-
if (fromConfig != null) {
|
|
16620
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
16621
|
-
}
|
|
16622
|
-
return toObject;
|
|
16623
|
-
}
|
|
16624
|
-
|
|
16625
17272
|
/**
|
|
16626
17273
|
* @license
|
|
16627
17274
|
* Copyright 2025 Google LLC
|
|
@@ -16905,6 +17552,22 @@ function fileDataToMldev(fromObject) {
|
|
|
16905
17552
|
}
|
|
16906
17553
|
return toObject;
|
|
16907
17554
|
}
|
|
17555
|
+
function functionCallToMldev(fromObject) {
|
|
17556
|
+
const toObject = {};
|
|
17557
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
17558
|
+
if (fromId != null) {
|
|
17559
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
17560
|
+
}
|
|
17561
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
17562
|
+
if (fromArgs != null) {
|
|
17563
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
17564
|
+
}
|
|
17565
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
17566
|
+
if (fromName != null) {
|
|
17567
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
17568
|
+
}
|
|
17569
|
+
return toObject;
|
|
17570
|
+
}
|
|
16908
17571
|
function partToMldev(fromObject) {
|
|
16909
17572
|
const toObject = {};
|
|
16910
17573
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -16931,6 +17594,10 @@ function partToMldev(fromObject) {
|
|
|
16931
17594
|
if (fromThoughtSignature != null) {
|
|
16932
17595
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
16933
17596
|
}
|
|
17597
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
17598
|
+
if (fromFunctionCall != null) {
|
|
17599
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
|
|
17600
|
+
}
|
|
16934
17601
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
16935
17602
|
'codeExecutionResult',
|
|
16936
17603
|
]);
|
|
@@ -16943,10 +17610,6 @@ function partToMldev(fromObject) {
|
|
|
16943
17610
|
if (fromExecutableCode != null) {
|
|
16944
17611
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
16945
17612
|
}
|
|
16946
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
16947
|
-
if (fromFunctionCall != null) {
|
|
16948
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
16949
|
-
}
|
|
16950
17613
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
16951
17614
|
'functionResponse',
|
|
16952
17615
|
]);
|
|
@@ -17787,6 +18450,9 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
17787
18450
|
if (parentObject !== undefined && fromLearningRate != null) {
|
|
17788
18451
|
setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
|
|
17789
18452
|
}
|
|
18453
|
+
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
18454
|
+
throw new Error('labels parameter is not supported in Gemini API.');
|
|
18455
|
+
}
|
|
17790
18456
|
return toObject;
|
|
17791
18457
|
}
|
|
17792
18458
|
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
@@ -17942,6 +18608,10 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
17942
18608
|
if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
|
|
17943
18609
|
throw new Error('learningRate parameter is not supported in Vertex AI.');
|
|
17944
18610
|
}
|
|
18611
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
18612
|
+
if (parentObject !== undefined && fromLabels != null) {
|
|
18613
|
+
setValueByPath(parentObject, ['labels'], fromLabels);
|
|
18614
|
+
}
|
|
17945
18615
|
return toObject;
|
|
17946
18616
|
}
|
|
17947
18617
|
function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
@@ -18890,5 +19560,5 @@ class GoogleGenAI {
|
|
|
18890
19560
|
}
|
|
18891
19561
|
}
|
|
18892
19562
|
|
|
18893
|
-
export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationReferenceType, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
19563
|
+
export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationReferenceType, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
18894
19564
|
//# sourceMappingURL=index.mjs.map
|