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