@google/genai 1.17.0 → 1.18.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 +114 -3
- package/dist/index.cjs +710 -193
- package/dist/index.mjs +709 -194
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +710 -193
- package/dist/node/index.mjs +709 -194
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +114 -3
- package/dist/web/index.mjs +709 -194
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +114 -3
- 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) {
|
|
@@ -1636,6 +1645,12 @@ class DeleteFileResponse {
|
|
|
1636
1645
|
/** Config for `inlined_responses` parameter. */
|
|
1637
1646
|
class InlinedResponse {
|
|
1638
1647
|
}
|
|
1648
|
+
/** Config for `response` parameter. */
|
|
1649
|
+
class SingleEmbedContentResponse {
|
|
1650
|
+
}
|
|
1651
|
+
/** Config for `inlined_embedding_responses` parameter. */
|
|
1652
|
+
class InlinedEmbedContentResponse {
|
|
1653
|
+
}
|
|
1639
1654
|
/** Config for batches.list return value. */
|
|
1640
1655
|
class ListBatchJobsResponse {
|
|
1641
1656
|
}
|
|
@@ -2487,51 +2502,59 @@ function mcpToolsToGeminiTool(mcpTools, config = {}) {
|
|
|
2487
2502
|
return { functionDeclarations: functionDeclarations };
|
|
2488
2503
|
}
|
|
2489
2504
|
// Transforms a source input into a BatchJobSource object with validation.
|
|
2490
|
-
function tBatchJobSource(
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2505
|
+
function tBatchJobSource(client, src) {
|
|
2506
|
+
let sourceObj;
|
|
2507
|
+
if (typeof src === 'string') {
|
|
2508
|
+
if (client.isVertexAI()) {
|
|
2509
|
+
if (src.startsWith('gs://')) {
|
|
2510
|
+
sourceObj = { format: 'jsonl', gcsUri: [src] };
|
|
2511
|
+
}
|
|
2512
|
+
else if (src.startsWith('bq://')) {
|
|
2513
|
+
sourceObj = { format: 'bigquery', bigqueryUri: src };
|
|
2495
2514
|
}
|
|
2496
|
-
else
|
|
2497
|
-
throw new Error(
|
|
2515
|
+
else {
|
|
2516
|
+
throw new Error(`Unsupported string source for Vertex AI: ${src}`);
|
|
2498
2517
|
}
|
|
2499
2518
|
}
|
|
2500
2519
|
else {
|
|
2501
|
-
//
|
|
2502
|
-
if (src.
|
|
2503
|
-
|
|
2520
|
+
// MLDEV
|
|
2521
|
+
if (src.startsWith('files/')) {
|
|
2522
|
+
sourceObj = { fileName: src }; // Default to fileName for string input
|
|
2504
2523
|
}
|
|
2505
|
-
else
|
|
2506
|
-
throw new Error(
|
|
2524
|
+
else {
|
|
2525
|
+
throw new Error(`Unsupported string source for Gemini API: ${src}`);
|
|
2507
2526
|
}
|
|
2508
2527
|
}
|
|
2509
|
-
return src;
|
|
2510
2528
|
}
|
|
2511
|
-
// If src is an array (list in Python)
|
|
2512
2529
|
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
|
-
};
|
|
2530
|
+
if (client.isVertexAI()) {
|
|
2531
|
+
throw new Error('InlinedRequest[] is not supported in Vertex AI.');
|
|
2521
2532
|
}
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2533
|
+
sourceObj = { inlinedRequests: src };
|
|
2534
|
+
}
|
|
2535
|
+
else {
|
|
2536
|
+
// It's already a BatchJobSource object
|
|
2537
|
+
sourceObj = src;
|
|
2538
|
+
}
|
|
2539
|
+
// Validation logic
|
|
2540
|
+
const vertexSourcesCount = [sourceObj.gcsUri, sourceObj.bigqueryUri].filter(Boolean).length;
|
|
2541
|
+
const mldevSourcesCount = [
|
|
2542
|
+
sourceObj.inlinedRequests,
|
|
2543
|
+
sourceObj.fileName,
|
|
2544
|
+
].filter(Boolean).length;
|
|
2545
|
+
if (client.isVertexAI()) {
|
|
2546
|
+
if (mldevSourcesCount > 0 || vertexSourcesCount !== 1) {
|
|
2547
|
+
throw new Error('Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.');
|
|
2527
2548
|
}
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2549
|
+
}
|
|
2550
|
+
else {
|
|
2551
|
+
// MLDEV
|
|
2552
|
+
if (vertexSourcesCount > 0 || mldevSourcesCount !== 1) {
|
|
2553
|
+
throw new Error('Exactly one of `inlinedRequests`, `fileName`, ' +
|
|
2554
|
+
'must be set for Gemini API.');
|
|
2532
2555
|
}
|
|
2533
2556
|
}
|
|
2534
|
-
|
|
2557
|
+
return sourceObj;
|
|
2535
2558
|
}
|
|
2536
2559
|
function tBatchJobDestination(dest) {
|
|
2537
2560
|
if (typeof dest !== 'string') {
|
|
@@ -2554,6 +2577,52 @@ function tBatchJobDestination(dest) {
|
|
|
2554
2577
|
throw new Error(`Unsupported destination: ${destString}`);
|
|
2555
2578
|
}
|
|
2556
2579
|
}
|
|
2580
|
+
function tRecvBatchJobDestination(dest) {
|
|
2581
|
+
// Ensure dest is a non-null object before proceeding.
|
|
2582
|
+
if (typeof dest !== 'object' || dest === null) {
|
|
2583
|
+
// If the input is not an object, it cannot be a valid BatchJobDestination
|
|
2584
|
+
// based on the operations performed. Return it cast, or handle as an error.
|
|
2585
|
+
// Casting an empty object might be a safe default.
|
|
2586
|
+
return {};
|
|
2587
|
+
}
|
|
2588
|
+
// Cast to Record<string, unknown> to allow string property access.
|
|
2589
|
+
const obj = dest;
|
|
2590
|
+
// Safely access nested properties.
|
|
2591
|
+
const inlineResponsesVal = obj['inlinedResponses'];
|
|
2592
|
+
if (typeof inlineResponsesVal !== 'object' || inlineResponsesVal === null) {
|
|
2593
|
+
return dest;
|
|
2594
|
+
}
|
|
2595
|
+
const inlineResponsesObj = inlineResponsesVal;
|
|
2596
|
+
const responsesArray = inlineResponsesObj['inlinedResponses'];
|
|
2597
|
+
if (!Array.isArray(responsesArray) || responsesArray.length === 0) {
|
|
2598
|
+
return dest;
|
|
2599
|
+
}
|
|
2600
|
+
// Check if any response has the 'embedding' property.
|
|
2601
|
+
let hasEmbedding = false;
|
|
2602
|
+
for (const responseItem of responsesArray) {
|
|
2603
|
+
if (typeof responseItem !== 'object' || responseItem === null) {
|
|
2604
|
+
continue;
|
|
2605
|
+
}
|
|
2606
|
+
const responseItemObj = responseItem;
|
|
2607
|
+
const responseVal = responseItemObj['response'];
|
|
2608
|
+
if (typeof responseVal !== 'object' || responseVal === null) {
|
|
2609
|
+
continue;
|
|
2610
|
+
}
|
|
2611
|
+
const responseObj = responseVal;
|
|
2612
|
+
// Check for the existence of the 'embedding' key.
|
|
2613
|
+
if (responseObj['embedding'] !== undefined) {
|
|
2614
|
+
hasEmbedding = true;
|
|
2615
|
+
break;
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
// Perform the transformation if an embedding was found.
|
|
2619
|
+
if (hasEmbedding) {
|
|
2620
|
+
obj['inlinedEmbedContentResponses'] = obj['inlinedResponses'];
|
|
2621
|
+
delete obj['inlinedResponses'];
|
|
2622
|
+
}
|
|
2623
|
+
// Cast the (potentially) modified object to the target type.
|
|
2624
|
+
return dest;
|
|
2625
|
+
}
|
|
2557
2626
|
function tBatchJobName(apiClient, name) {
|
|
2558
2627
|
const nameString = name;
|
|
2559
2628
|
if (!apiClient.isVertexAI()) {
|
|
@@ -2649,6 +2718,22 @@ function fileDataToMldev$4(fromObject) {
|
|
|
2649
2718
|
}
|
|
2650
2719
|
return toObject;
|
|
2651
2720
|
}
|
|
2721
|
+
function functionCallToMldev$4(fromObject) {
|
|
2722
|
+
const toObject = {};
|
|
2723
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
2724
|
+
if (fromId != null) {
|
|
2725
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
2726
|
+
}
|
|
2727
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
2728
|
+
if (fromArgs != null) {
|
|
2729
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
2730
|
+
}
|
|
2731
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
2732
|
+
if (fromName != null) {
|
|
2733
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
2734
|
+
}
|
|
2735
|
+
return toObject;
|
|
2736
|
+
}
|
|
2652
2737
|
function partToMldev$4(fromObject) {
|
|
2653
2738
|
const toObject = {};
|
|
2654
2739
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -2675,6 +2760,10 @@ function partToMldev$4(fromObject) {
|
|
|
2675
2760
|
if (fromThoughtSignature != null) {
|
|
2676
2761
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2677
2762
|
}
|
|
2763
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2764
|
+
if (fromFunctionCall != null) {
|
|
2765
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
|
|
2766
|
+
}
|
|
2678
2767
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2679
2768
|
'codeExecutionResult',
|
|
2680
2769
|
]);
|
|
@@ -2687,10 +2776,6 @@ function partToMldev$4(fromObject) {
|
|
|
2687
2776
|
if (fromExecutableCode != null) {
|
|
2688
2777
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
2689
2778
|
}
|
|
2690
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2691
|
-
if (fromFunctionCall != null) {
|
|
2692
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
2693
|
-
}
|
|
2694
2779
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
2695
2780
|
'functionResponse',
|
|
2696
2781
|
]);
|
|
@@ -3342,6 +3427,80 @@ function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
|
3342
3427
|
}
|
|
3343
3428
|
return toObject;
|
|
3344
3429
|
}
|
|
3430
|
+
function embedContentConfigToMldev$1(fromObject, parentObject) {
|
|
3431
|
+
const toObject = {};
|
|
3432
|
+
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
3433
|
+
if (parentObject !== undefined && fromTaskType != null) {
|
|
3434
|
+
setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
|
|
3435
|
+
}
|
|
3436
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3437
|
+
if (parentObject !== undefined && fromTitle != null) {
|
|
3438
|
+
setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
|
|
3439
|
+
}
|
|
3440
|
+
const fromOutputDimensionality = getValueByPath(fromObject, [
|
|
3441
|
+
'outputDimensionality',
|
|
3442
|
+
]);
|
|
3443
|
+
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
3444
|
+
setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
|
|
3445
|
+
}
|
|
3446
|
+
if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
|
|
3447
|
+
throw new Error('mimeType parameter is not supported in Gemini API.');
|
|
3448
|
+
}
|
|
3449
|
+
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
3450
|
+
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
3451
|
+
}
|
|
3452
|
+
return toObject;
|
|
3453
|
+
}
|
|
3454
|
+
function embedContentBatchToMldev(apiClient, fromObject) {
|
|
3455
|
+
const toObject = {};
|
|
3456
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3457
|
+
if (fromContents != null) {
|
|
3458
|
+
setValueByPath(toObject, ['requests[]', 'request', 'content'], tContentsForEmbed(apiClient, fromContents));
|
|
3459
|
+
}
|
|
3460
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3461
|
+
if (fromConfig != null) {
|
|
3462
|
+
setValueByPath(toObject, ['config'], embedContentConfigToMldev$1(fromConfig, toObject));
|
|
3463
|
+
}
|
|
3464
|
+
return toObject;
|
|
3465
|
+
}
|
|
3466
|
+
function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
|
|
3467
|
+
const toObject = {};
|
|
3468
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
3469
|
+
if (fromFileName != null) {
|
|
3470
|
+
setValueByPath(toObject, ['file_name'], fromFileName);
|
|
3471
|
+
}
|
|
3472
|
+
const fromInlinedRequests = getValueByPath(fromObject, [
|
|
3473
|
+
'inlinedRequests',
|
|
3474
|
+
]);
|
|
3475
|
+
if (fromInlinedRequests != null) {
|
|
3476
|
+
setValueByPath(toObject, ['requests'], embedContentBatchToMldev(apiClient, fromInlinedRequests));
|
|
3477
|
+
}
|
|
3478
|
+
return toObject;
|
|
3479
|
+
}
|
|
3480
|
+
function createEmbeddingsBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3481
|
+
const toObject = {};
|
|
3482
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3483
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3484
|
+
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3485
|
+
}
|
|
3486
|
+
return toObject;
|
|
3487
|
+
}
|
|
3488
|
+
function createEmbeddingsBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3489
|
+
const toObject = {};
|
|
3490
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3491
|
+
if (fromModel != null) {
|
|
3492
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3493
|
+
}
|
|
3494
|
+
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3495
|
+
if (fromSrc != null) {
|
|
3496
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], embeddingsBatchJobSourceToMldev(apiClient, fromSrc));
|
|
3497
|
+
}
|
|
3498
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3499
|
+
if (fromConfig != null) {
|
|
3500
|
+
setValueByPath(toObject, ['config'], createEmbeddingsBatchJobConfigToMldev(fromConfig, toObject));
|
|
3501
|
+
}
|
|
3502
|
+
return toObject;
|
|
3503
|
+
}
|
|
3345
3504
|
function getBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3346
3505
|
const toObject = {};
|
|
3347
3506
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -3443,6 +3602,10 @@ function batchJobDestinationToVertex(fromObject) {
|
|
|
3443
3602
|
if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
|
|
3444
3603
|
throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
|
|
3445
3604
|
}
|
|
3605
|
+
if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
|
|
3606
|
+
undefined) {
|
|
3607
|
+
throw new Error('inlinedEmbedContentResponses parameter is not supported in Vertex AI.');
|
|
3608
|
+
}
|
|
3446
3609
|
return toObject;
|
|
3447
3610
|
}
|
|
3448
3611
|
function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -3573,6 +3736,22 @@ function fileDataFromMldev$2(fromObject) {
|
|
|
3573
3736
|
}
|
|
3574
3737
|
return toObject;
|
|
3575
3738
|
}
|
|
3739
|
+
function functionCallFromMldev$2(fromObject) {
|
|
3740
|
+
const toObject = {};
|
|
3741
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
3742
|
+
if (fromId != null) {
|
|
3743
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
3744
|
+
}
|
|
3745
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
3746
|
+
if (fromArgs != null) {
|
|
3747
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
3748
|
+
}
|
|
3749
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3750
|
+
if (fromName != null) {
|
|
3751
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3752
|
+
}
|
|
3753
|
+
return toObject;
|
|
3754
|
+
}
|
|
3576
3755
|
function partFromMldev$2(fromObject) {
|
|
3577
3756
|
const toObject = {};
|
|
3578
3757
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -3599,6 +3778,10 @@ function partFromMldev$2(fromObject) {
|
|
|
3599
3778
|
if (fromThoughtSignature != null) {
|
|
3600
3779
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
3601
3780
|
}
|
|
3781
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3782
|
+
if (fromFunctionCall != null) {
|
|
3783
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$2(fromFunctionCall));
|
|
3784
|
+
}
|
|
3602
3785
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3603
3786
|
'codeExecutionResult',
|
|
3604
3787
|
]);
|
|
@@ -3611,10 +3794,6 @@ function partFromMldev$2(fromObject) {
|
|
|
3611
3794
|
if (fromExecutableCode != null) {
|
|
3612
3795
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
3613
3796
|
}
|
|
3614
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3615
|
-
if (fromFunctionCall != null) {
|
|
3616
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3617
|
-
}
|
|
3618
3797
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
3619
3798
|
'functionResponse',
|
|
3620
3799
|
]);
|
|
@@ -3803,6 +3982,38 @@ function inlinedResponseFromMldev(fromObject) {
|
|
|
3803
3982
|
}
|
|
3804
3983
|
return toObject;
|
|
3805
3984
|
}
|
|
3985
|
+
function contentEmbeddingFromMldev$1(fromObject) {
|
|
3986
|
+
const toObject = {};
|
|
3987
|
+
const fromValues = getValueByPath(fromObject, ['values']);
|
|
3988
|
+
if (fromValues != null) {
|
|
3989
|
+
setValueByPath(toObject, ['values'], fromValues);
|
|
3990
|
+
}
|
|
3991
|
+
return toObject;
|
|
3992
|
+
}
|
|
3993
|
+
function singleEmbedContentResponseFromMldev(fromObject) {
|
|
3994
|
+
const toObject = {};
|
|
3995
|
+
const fromEmbedding = getValueByPath(fromObject, ['embedding']);
|
|
3996
|
+
if (fromEmbedding != null) {
|
|
3997
|
+
setValueByPath(toObject, ['embedding'], contentEmbeddingFromMldev$1(fromEmbedding));
|
|
3998
|
+
}
|
|
3999
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
4000
|
+
if (fromTokenCount != null) {
|
|
4001
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
4002
|
+
}
|
|
4003
|
+
return toObject;
|
|
4004
|
+
}
|
|
4005
|
+
function inlinedEmbedContentResponseFromMldev(fromObject) {
|
|
4006
|
+
const toObject = {};
|
|
4007
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
4008
|
+
if (fromResponse != null) {
|
|
4009
|
+
setValueByPath(toObject, ['response'], singleEmbedContentResponseFromMldev(fromResponse));
|
|
4010
|
+
}
|
|
4011
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
4012
|
+
if (fromError != null) {
|
|
4013
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev(fromError));
|
|
4014
|
+
}
|
|
4015
|
+
return toObject;
|
|
4016
|
+
}
|
|
3806
4017
|
function batchJobDestinationFromMldev(fromObject) {
|
|
3807
4018
|
const toObject = {};
|
|
3808
4019
|
const fromFileName = getValueByPath(fromObject, ['responsesFile']);
|
|
@@ -3822,6 +4033,19 @@ function batchJobDestinationFromMldev(fromObject) {
|
|
|
3822
4033
|
}
|
|
3823
4034
|
setValueByPath(toObject, ['inlinedResponses'], transformedList);
|
|
3824
4035
|
}
|
|
4036
|
+
const fromInlinedEmbedContentResponses = getValueByPath(fromObject, [
|
|
4037
|
+
'inlinedEmbedContentResponses',
|
|
4038
|
+
'inlinedResponses',
|
|
4039
|
+
]);
|
|
4040
|
+
if (fromInlinedEmbedContentResponses != null) {
|
|
4041
|
+
let transformedList = fromInlinedEmbedContentResponses;
|
|
4042
|
+
if (Array.isArray(transformedList)) {
|
|
4043
|
+
transformedList = transformedList.map((item) => {
|
|
4044
|
+
return inlinedEmbedContentResponseFromMldev(item);
|
|
4045
|
+
});
|
|
4046
|
+
}
|
|
4047
|
+
setValueByPath(toObject, ['inlinedEmbedContentResponses'], transformedList);
|
|
4048
|
+
}
|
|
3825
4049
|
return toObject;
|
|
3826
4050
|
}
|
|
3827
4051
|
function batchJobFromMldev(fromObject) {
|
|
@@ -3868,7 +4092,7 @@ function batchJobFromMldev(fromObject) {
|
|
|
3868
4092
|
}
|
|
3869
4093
|
const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
|
|
3870
4094
|
if (fromDest != null) {
|
|
3871
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
|
|
4095
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(tRecvBatchJobDestination(fromDest)));
|
|
3872
4096
|
}
|
|
3873
4097
|
return toObject;
|
|
3874
4098
|
}
|
|
@@ -4021,7 +4245,7 @@ function batchJobFromVertex(fromObject) {
|
|
|
4021
4245
|
}
|
|
4022
4246
|
const fromDest = getValueByPath(fromObject, ['outputConfig']);
|
|
4023
4247
|
if (fromDest != null) {
|
|
4024
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
|
|
4248
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
|
|
4025
4249
|
}
|
|
4026
4250
|
return toObject;
|
|
4027
4251
|
}
|
|
@@ -4287,79 +4511,87 @@ class Batches extends BaseModule {
|
|
|
4287
4511
|
this.create = async (params) => {
|
|
4288
4512
|
var _a, _b;
|
|
4289
4513
|
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
|
-
}
|
|
4514
|
+
// Format destination if not provided
|
|
4515
|
+
// Cast params.src as Vertex AI path does not handle InlinedRequest[]
|
|
4516
|
+
params.config = this.formatDestination(params.src, params.config);
|
|
4517
|
+
return this.createInternal(params);
|
|
4312
4518
|
}
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
let queryParams = {};
|
|
4319
|
-
const body = createBatchJobParametersToMldev(this.apiClient, params);
|
|
4320
|
-
path = formatMap('{model}:batchGenerateContent', body['_url']);
|
|
4321
|
-
queryParams = body['_query'];
|
|
4322
|
-
// Move system instruction to 'request':
|
|
4323
|
-
// {'systemInstruction': system_instruction}
|
|
4324
|
-
const batch = body['batch'];
|
|
4325
|
-
const inputConfig = batch['inputConfig'];
|
|
4326
|
-
const requestsWrapper = inputConfig['requests'];
|
|
4327
|
-
const requests = requestsWrapper['requests'];
|
|
4328
|
-
const newRequests = [];
|
|
4329
|
-
for (const request of requests) {
|
|
4330
|
-
const requestDict = request;
|
|
4331
|
-
if (requestDict['systemInstruction']) {
|
|
4332
|
-
const systemInstructionValue = requestDict['systemInstruction'];
|
|
4333
|
-
delete requestDict['systemInstruction'];
|
|
4334
|
-
const requestContent = requestDict['request'];
|
|
4335
|
-
requestContent['systemInstruction'] = systemInstructionValue;
|
|
4336
|
-
requestDict['request'] = requestContent;
|
|
4337
|
-
}
|
|
4338
|
-
newRequests.push(requestDict);
|
|
4339
|
-
}
|
|
4340
|
-
requestsWrapper['requests'] = newRequests;
|
|
4341
|
-
delete body['config'];
|
|
4342
|
-
delete body['_url'];
|
|
4343
|
-
delete body['_query'];
|
|
4344
|
-
const response = this.apiClient
|
|
4345
|
-
.request({
|
|
4346
|
-
path: path,
|
|
4347
|
-
queryParams: queryParams,
|
|
4348
|
-
body: JSON.stringify(body),
|
|
4349
|
-
httpMethod: 'POST',
|
|
4350
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4351
|
-
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4352
|
-
})
|
|
4353
|
-
.then((httpResponse) => {
|
|
4354
|
-
return httpResponse.json();
|
|
4355
|
-
});
|
|
4356
|
-
return response.then((apiResponse) => {
|
|
4357
|
-
const resp = batchJobFromMldev(apiResponse);
|
|
4358
|
-
return resp;
|
|
4359
|
-
});
|
|
4360
|
-
}
|
|
4519
|
+
// MLDEV
|
|
4520
|
+
const src = params.src;
|
|
4521
|
+
const is_inlined = Array.isArray(params.src) || src.inlinedRequests !== undefined;
|
|
4522
|
+
if (!is_inlined) {
|
|
4523
|
+
return this.createInternal(params);
|
|
4361
4524
|
}
|
|
4362
|
-
|
|
4525
|
+
// Inlined generate content requests handling
|
|
4526
|
+
const result = this.createInlinedGenerateContentRequest(params);
|
|
4527
|
+
const path = result.path;
|
|
4528
|
+
const requestBody = result.body;
|
|
4529
|
+
const queryParams = createBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4530
|
+
const response = this.apiClient
|
|
4531
|
+
.request({
|
|
4532
|
+
path: path,
|
|
4533
|
+
queryParams: queryParams,
|
|
4534
|
+
body: JSON.stringify(requestBody),
|
|
4535
|
+
httpMethod: 'POST',
|
|
4536
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4537
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4538
|
+
})
|
|
4539
|
+
.then((httpResponse) => {
|
|
4540
|
+
return httpResponse.json();
|
|
4541
|
+
});
|
|
4542
|
+
return response.then((apiResponse) => {
|
|
4543
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4544
|
+
return resp;
|
|
4545
|
+
});
|
|
4546
|
+
};
|
|
4547
|
+
/**
|
|
4548
|
+
* **Experimental** Creates an embedding batch job.
|
|
4549
|
+
*
|
|
4550
|
+
* @param params - The parameters for create embedding batch job request.
|
|
4551
|
+
* @return The created batch job.
|
|
4552
|
+
*
|
|
4553
|
+
* @example
|
|
4554
|
+
* ```ts
|
|
4555
|
+
* const response = await ai.batches.createEmbeddings({
|
|
4556
|
+
* model: 'text-embedding-004',
|
|
4557
|
+
* src: {fileName: 'files/my_embedding_input'},
|
|
4558
|
+
* });
|
|
4559
|
+
* console.log(response);
|
|
4560
|
+
* ```
|
|
4561
|
+
*/
|
|
4562
|
+
this.createEmbeddings = async (params) => {
|
|
4563
|
+
var _a, _b;
|
|
4564
|
+
console.warn('batches.createEmbeddings() is experimental and may change without notice.');
|
|
4565
|
+
if (this.apiClient.isVertexAI()) {
|
|
4566
|
+
throw new Error('Vertex AI does not support batches.createEmbeddings.');
|
|
4567
|
+
}
|
|
4568
|
+
// MLDEV
|
|
4569
|
+
const src = params.src;
|
|
4570
|
+
const is_inlined = src.inlinedRequests !== undefined;
|
|
4571
|
+
if (!is_inlined) {
|
|
4572
|
+
return this.createEmbeddingsInternal(params); // Fixed typo here
|
|
4573
|
+
}
|
|
4574
|
+
// Inlined embed content requests handling
|
|
4575
|
+
const result = this.createInlinedEmbedContentRequest(params);
|
|
4576
|
+
const path = result.path;
|
|
4577
|
+
const requestBody = result.body;
|
|
4578
|
+
const queryParams = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4579
|
+
const response = this.apiClient
|
|
4580
|
+
.request({
|
|
4581
|
+
path: path,
|
|
4582
|
+
queryParams: queryParams,
|
|
4583
|
+
body: JSON.stringify(requestBody),
|
|
4584
|
+
httpMethod: 'POST',
|
|
4585
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4586
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4587
|
+
})
|
|
4588
|
+
.then((httpResponse) => {
|
|
4589
|
+
return httpResponse.json();
|
|
4590
|
+
});
|
|
4591
|
+
return response.then((apiResponse) => {
|
|
4592
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4593
|
+
return resp;
|
|
4594
|
+
});
|
|
4363
4595
|
};
|
|
4364
4596
|
/**
|
|
4365
4597
|
* Lists batch job configurations.
|
|
@@ -4379,6 +4611,112 @@ class Batches extends BaseModule {
|
|
|
4379
4611
|
return new Pager(PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4380
4612
|
};
|
|
4381
4613
|
}
|
|
4614
|
+
// Helper function to handle inlined generate content requests
|
|
4615
|
+
createInlinedGenerateContentRequest(params) {
|
|
4616
|
+
const body = createBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4617
|
+
params);
|
|
4618
|
+
const urlParams = body['_url'];
|
|
4619
|
+
const path = formatMap('{model}:batchGenerateContent', urlParams);
|
|
4620
|
+
const batch = body['batch'];
|
|
4621
|
+
const inputConfig = batch['inputConfig'];
|
|
4622
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4623
|
+
const requests = requestsWrapper['requests'];
|
|
4624
|
+
const newRequests = [];
|
|
4625
|
+
for (const request of requests) {
|
|
4626
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4627
|
+
if (requestDict['systemInstruction']) {
|
|
4628
|
+
const systemInstructionValue = requestDict['systemInstruction'];
|
|
4629
|
+
delete requestDict['systemInstruction'];
|
|
4630
|
+
const requestContent = requestDict['request'];
|
|
4631
|
+
requestContent['systemInstruction'] = systemInstructionValue;
|
|
4632
|
+
requestDict['request'] = requestContent;
|
|
4633
|
+
}
|
|
4634
|
+
newRequests.push(requestDict);
|
|
4635
|
+
}
|
|
4636
|
+
requestsWrapper['requests'] = newRequests;
|
|
4637
|
+
delete body['config'];
|
|
4638
|
+
delete body['_url'];
|
|
4639
|
+
delete body['_query'];
|
|
4640
|
+
return { path, body };
|
|
4641
|
+
}
|
|
4642
|
+
// Helper function to handle inlined embedding requests
|
|
4643
|
+
createInlinedEmbedContentRequest(params) {
|
|
4644
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4645
|
+
params);
|
|
4646
|
+
const urlParams = body['_url'];
|
|
4647
|
+
const path = formatMap('{model}:asyncBatchEmbedContent', urlParams);
|
|
4648
|
+
const batch = body['batch'];
|
|
4649
|
+
const inputConfig = batch['inputConfig'];
|
|
4650
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4651
|
+
const requests = requestsWrapper['requests'];
|
|
4652
|
+
const newRequests = [];
|
|
4653
|
+
delete requestsWrapper['config']; // Remove top-level config
|
|
4654
|
+
for (const request of requests) {
|
|
4655
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4656
|
+
const innerRequest = requestDict['request'];
|
|
4657
|
+
for (const key in requestDict) {
|
|
4658
|
+
if (key !== 'request') {
|
|
4659
|
+
innerRequest[key] = requestDict[key];
|
|
4660
|
+
delete requestDict[key];
|
|
4661
|
+
}
|
|
4662
|
+
}
|
|
4663
|
+
newRequests.push(requestDict);
|
|
4664
|
+
}
|
|
4665
|
+
requestsWrapper['requests'] = newRequests;
|
|
4666
|
+
delete body['config'];
|
|
4667
|
+
delete body['_url'];
|
|
4668
|
+
delete body['_query'];
|
|
4669
|
+
return { path, body };
|
|
4670
|
+
}
|
|
4671
|
+
// Helper function to get the first GCS URI
|
|
4672
|
+
getGcsUri(src) {
|
|
4673
|
+
if (typeof src === 'string') {
|
|
4674
|
+
return src.startsWith('gs://') ? src : undefined;
|
|
4675
|
+
}
|
|
4676
|
+
if (!Array.isArray(src) && src.gcsUri && src.gcsUri.length > 0) {
|
|
4677
|
+
return src.gcsUri[0];
|
|
4678
|
+
}
|
|
4679
|
+
return undefined;
|
|
4680
|
+
}
|
|
4681
|
+
// Helper function to get the BigQuery URI
|
|
4682
|
+
getBigqueryUri(src) {
|
|
4683
|
+
if (typeof src === 'string') {
|
|
4684
|
+
return src.startsWith('bq://') ? src : undefined;
|
|
4685
|
+
}
|
|
4686
|
+
if (!Array.isArray(src)) {
|
|
4687
|
+
return src.bigqueryUri;
|
|
4688
|
+
}
|
|
4689
|
+
return undefined;
|
|
4690
|
+
}
|
|
4691
|
+
// Function to format the destination configuration for Vertex AI
|
|
4692
|
+
formatDestination(src, config) {
|
|
4693
|
+
const newConfig = config ? Object.assign({}, config) : {};
|
|
4694
|
+
const timestampStr = Date.now().toString();
|
|
4695
|
+
if (!newConfig.displayName) {
|
|
4696
|
+
newConfig.displayName = `genaiBatchJob_${timestampStr}`;
|
|
4697
|
+
}
|
|
4698
|
+
if (newConfig.dest === undefined) {
|
|
4699
|
+
const gcsUri = this.getGcsUri(src);
|
|
4700
|
+
const bigqueryUri = this.getBigqueryUri(src);
|
|
4701
|
+
if (gcsUri) {
|
|
4702
|
+
if (gcsUri.endsWith('.jsonl')) {
|
|
4703
|
+
// For .jsonl files, remove suffix and add /dest
|
|
4704
|
+
newConfig.dest = `${gcsUri.slice(0, -6)}/dest`;
|
|
4705
|
+
}
|
|
4706
|
+
else {
|
|
4707
|
+
// Fallback for other GCS URIs
|
|
4708
|
+
newConfig.dest = `${gcsUri}_dest_${timestampStr}`;
|
|
4709
|
+
}
|
|
4710
|
+
}
|
|
4711
|
+
else if (bigqueryUri) {
|
|
4712
|
+
newConfig.dest = `${bigqueryUri}_dest_${timestampStr}`;
|
|
4713
|
+
}
|
|
4714
|
+
else {
|
|
4715
|
+
throw new Error('Unsupported source for Vertex AI: No GCS or BigQuery URI found.');
|
|
4716
|
+
}
|
|
4717
|
+
}
|
|
4718
|
+
return newConfig;
|
|
4719
|
+
}
|
|
4382
4720
|
/**
|
|
4383
4721
|
* Internal method to create batch job.
|
|
4384
4722
|
*
|
|
@@ -4416,8 +4754,48 @@ class Batches extends BaseModule {
|
|
|
4416
4754
|
});
|
|
4417
4755
|
}
|
|
4418
4756
|
else {
|
|
4419
|
-
const body = createBatchJobParametersToMldev(this.apiClient, params);
|
|
4420
|
-
path = formatMap('{model}:batchGenerateContent', body['_url']);
|
|
4757
|
+
const body = createBatchJobParametersToMldev(this.apiClient, params);
|
|
4758
|
+
path = formatMap('{model}:batchGenerateContent', body['_url']);
|
|
4759
|
+
queryParams = body['_query'];
|
|
4760
|
+
delete body['config'];
|
|
4761
|
+
delete body['_url'];
|
|
4762
|
+
delete body['_query'];
|
|
4763
|
+
response = this.apiClient
|
|
4764
|
+
.request({
|
|
4765
|
+
path: path,
|
|
4766
|
+
queryParams: queryParams,
|
|
4767
|
+
body: JSON.stringify(body),
|
|
4768
|
+
httpMethod: 'POST',
|
|
4769
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4770
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4771
|
+
})
|
|
4772
|
+
.then((httpResponse) => {
|
|
4773
|
+
return httpResponse.json();
|
|
4774
|
+
});
|
|
4775
|
+
return response.then((apiResponse) => {
|
|
4776
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4777
|
+
return resp;
|
|
4778
|
+
});
|
|
4779
|
+
}
|
|
4780
|
+
}
|
|
4781
|
+
/**
|
|
4782
|
+
* Internal method to create batch job.
|
|
4783
|
+
*
|
|
4784
|
+
* @param params - The parameters for create batch job request.
|
|
4785
|
+
* @return The created batch job.
|
|
4786
|
+
*
|
|
4787
|
+
*/
|
|
4788
|
+
async createEmbeddingsInternal(params) {
|
|
4789
|
+
var _a, _b;
|
|
4790
|
+
let response;
|
|
4791
|
+
let path = '';
|
|
4792
|
+
let queryParams = {};
|
|
4793
|
+
if (this.apiClient.isVertexAI()) {
|
|
4794
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
4795
|
+
}
|
|
4796
|
+
else {
|
|
4797
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params);
|
|
4798
|
+
path = formatMap('{model}:asyncBatchEmbedContent', body['_url']);
|
|
4421
4799
|
queryParams = body['_query'];
|
|
4422
4800
|
delete body['config'];
|
|
4423
4801
|
delete body['_url'];
|
|
@@ -4428,8 +4806,8 @@ class Batches extends BaseModule {
|
|
|
4428
4806
|
queryParams: queryParams,
|
|
4429
4807
|
body: JSON.stringify(body),
|
|
4430
4808
|
httpMethod: 'POST',
|
|
4431
|
-
httpOptions: (
|
|
4432
|
-
abortSignal: (
|
|
4809
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4810
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4433
4811
|
})
|
|
4434
4812
|
.then((httpResponse) => {
|
|
4435
4813
|
return httpResponse.json();
|
|
@@ -4753,6 +5131,22 @@ function fileDataToMldev$3(fromObject) {
|
|
|
4753
5131
|
}
|
|
4754
5132
|
return toObject;
|
|
4755
5133
|
}
|
|
5134
|
+
function functionCallToMldev$3(fromObject) {
|
|
5135
|
+
const toObject = {};
|
|
5136
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5137
|
+
if (fromId != null) {
|
|
5138
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5139
|
+
}
|
|
5140
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5141
|
+
if (fromArgs != null) {
|
|
5142
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5143
|
+
}
|
|
5144
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5145
|
+
if (fromName != null) {
|
|
5146
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5147
|
+
}
|
|
5148
|
+
return toObject;
|
|
5149
|
+
}
|
|
4756
5150
|
function partToMldev$3(fromObject) {
|
|
4757
5151
|
const toObject = {};
|
|
4758
5152
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -4779,6 +5173,10 @@ function partToMldev$3(fromObject) {
|
|
|
4779
5173
|
if (fromThoughtSignature != null) {
|
|
4780
5174
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
4781
5175
|
}
|
|
5176
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5177
|
+
if (fromFunctionCall != null) {
|
|
5178
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
|
|
5179
|
+
}
|
|
4782
5180
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4783
5181
|
'codeExecutionResult',
|
|
4784
5182
|
]);
|
|
@@ -4791,10 +5189,6 @@ function partToMldev$3(fromObject) {
|
|
|
4791
5189
|
if (fromExecutableCode != null) {
|
|
4792
5190
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4793
5191
|
}
|
|
4794
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4795
|
-
if (fromFunctionCall != null) {
|
|
4796
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4797
|
-
}
|
|
4798
5192
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4799
5193
|
'functionResponse',
|
|
4800
5194
|
]);
|
|
@@ -5202,6 +5596,21 @@ function fileDataToVertex$2(fromObject) {
|
|
|
5202
5596
|
}
|
|
5203
5597
|
return toObject;
|
|
5204
5598
|
}
|
|
5599
|
+
function functionCallToVertex$2(fromObject) {
|
|
5600
|
+
const toObject = {};
|
|
5601
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
5602
|
+
throw new Error('id parameter is not supported in Vertex AI.');
|
|
5603
|
+
}
|
|
5604
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5605
|
+
if (fromArgs != null) {
|
|
5606
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5607
|
+
}
|
|
5608
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5609
|
+
if (fromName != null) {
|
|
5610
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5611
|
+
}
|
|
5612
|
+
return toObject;
|
|
5613
|
+
}
|
|
5205
5614
|
function partToVertex$2(fromObject) {
|
|
5206
5615
|
const toObject = {};
|
|
5207
5616
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -5228,6 +5637,10 @@ function partToVertex$2(fromObject) {
|
|
|
5228
5637
|
if (fromThoughtSignature != null) {
|
|
5229
5638
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5230
5639
|
}
|
|
5640
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5641
|
+
if (fromFunctionCall != null) {
|
|
5642
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$2(fromFunctionCall));
|
|
5643
|
+
}
|
|
5231
5644
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5232
5645
|
'codeExecutionResult',
|
|
5233
5646
|
]);
|
|
@@ -5240,10 +5653,6 @@ function partToVertex$2(fromObject) {
|
|
|
5240
5653
|
if (fromExecutableCode != null) {
|
|
5241
5654
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
5242
5655
|
}
|
|
5243
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5244
|
-
if (fromFunctionCall != null) {
|
|
5245
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
5246
|
-
}
|
|
5247
5656
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
5248
5657
|
'functionResponse',
|
|
5249
5658
|
]);
|
|
@@ -6615,7 +7024,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6615
7024
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6616
7025
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6617
7026
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6618
|
-
const SDK_VERSION = '1.
|
|
7027
|
+
const SDK_VERSION = '1.18.0'; // x-release-please-version
|
|
6619
7028
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6620
7029
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6621
7030
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -7970,6 +8379,22 @@ function fileDataToMldev$2(fromObject) {
|
|
|
7970
8379
|
}
|
|
7971
8380
|
return toObject;
|
|
7972
8381
|
}
|
|
8382
|
+
function functionCallToMldev$2(fromObject) {
|
|
8383
|
+
const toObject = {};
|
|
8384
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
8385
|
+
if (fromId != null) {
|
|
8386
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
8387
|
+
}
|
|
8388
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
8389
|
+
if (fromArgs != null) {
|
|
8390
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
8391
|
+
}
|
|
8392
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
8393
|
+
if (fromName != null) {
|
|
8394
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
8395
|
+
}
|
|
8396
|
+
return toObject;
|
|
8397
|
+
}
|
|
7973
8398
|
function partToMldev$2(fromObject) {
|
|
7974
8399
|
const toObject = {};
|
|
7975
8400
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -7996,6 +8421,10 @@ function partToMldev$2(fromObject) {
|
|
|
7996
8421
|
if (fromThoughtSignature != null) {
|
|
7997
8422
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7998
8423
|
}
|
|
8424
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8425
|
+
if (fromFunctionCall != null) {
|
|
8426
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
|
|
8427
|
+
}
|
|
7999
8428
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8000
8429
|
'codeExecutionResult',
|
|
8001
8430
|
]);
|
|
@@ -8008,10 +8437,6 @@ function partToMldev$2(fromObject) {
|
|
|
8008
8437
|
if (fromExecutableCode != null) {
|
|
8009
8438
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8010
8439
|
}
|
|
8011
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8012
|
-
if (fromFunctionCall != null) {
|
|
8013
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8014
|
-
}
|
|
8015
8440
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8016
8441
|
'functionResponse',
|
|
8017
8442
|
]);
|
|
@@ -8674,6 +9099,21 @@ function fileDataToVertex$1(fromObject) {
|
|
|
8674
9099
|
}
|
|
8675
9100
|
return toObject;
|
|
8676
9101
|
}
|
|
9102
|
+
function functionCallToVertex$1(fromObject) {
|
|
9103
|
+
const toObject = {};
|
|
9104
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
9105
|
+
throw new Error('id parameter is not supported in Vertex AI.');
|
|
9106
|
+
}
|
|
9107
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9108
|
+
if (fromArgs != null) {
|
|
9109
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9110
|
+
}
|
|
9111
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9112
|
+
if (fromName != null) {
|
|
9113
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9114
|
+
}
|
|
9115
|
+
return toObject;
|
|
9116
|
+
}
|
|
8677
9117
|
function partToVertex$1(fromObject) {
|
|
8678
9118
|
const toObject = {};
|
|
8679
9119
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -8700,6 +9140,10 @@ function partToVertex$1(fromObject) {
|
|
|
8700
9140
|
if (fromThoughtSignature != null) {
|
|
8701
9141
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8702
9142
|
}
|
|
9143
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9144
|
+
if (fromFunctionCall != null) {
|
|
9145
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$1(fromFunctionCall));
|
|
9146
|
+
}
|
|
8703
9147
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8704
9148
|
'codeExecutionResult',
|
|
8705
9149
|
]);
|
|
@@ -8712,10 +9156,6 @@ function partToVertex$1(fromObject) {
|
|
|
8712
9156
|
if (fromExecutableCode != null) {
|
|
8713
9157
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8714
9158
|
}
|
|
8715
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8716
|
-
if (fromFunctionCall != null) {
|
|
8717
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8718
|
-
}
|
|
8719
9159
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8720
9160
|
'functionResponse',
|
|
8721
9161
|
]);
|
|
@@ -9263,6 +9703,22 @@ function fileDataFromMldev$1(fromObject) {
|
|
|
9263
9703
|
}
|
|
9264
9704
|
return toObject;
|
|
9265
9705
|
}
|
|
9706
|
+
function functionCallFromMldev$1(fromObject) {
|
|
9707
|
+
const toObject = {};
|
|
9708
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
9709
|
+
if (fromId != null) {
|
|
9710
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
9711
|
+
}
|
|
9712
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9713
|
+
if (fromArgs != null) {
|
|
9714
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9715
|
+
}
|
|
9716
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9717
|
+
if (fromName != null) {
|
|
9718
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9719
|
+
}
|
|
9720
|
+
return toObject;
|
|
9721
|
+
}
|
|
9266
9722
|
function partFromMldev$1(fromObject) {
|
|
9267
9723
|
const toObject = {};
|
|
9268
9724
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9289,6 +9745,10 @@ function partFromMldev$1(fromObject) {
|
|
|
9289
9745
|
if (fromThoughtSignature != null) {
|
|
9290
9746
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9291
9747
|
}
|
|
9748
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9749
|
+
if (fromFunctionCall != null) {
|
|
9750
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$1(fromFunctionCall));
|
|
9751
|
+
}
|
|
9292
9752
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9293
9753
|
'codeExecutionResult',
|
|
9294
9754
|
]);
|
|
@@ -9301,10 +9761,6 @@ function partFromMldev$1(fromObject) {
|
|
|
9301
9761
|
if (fromExecutableCode != null) {
|
|
9302
9762
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9303
9763
|
}
|
|
9304
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9305
|
-
if (fromFunctionCall != null) {
|
|
9306
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9307
|
-
}
|
|
9308
9764
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9309
9765
|
'functionResponse',
|
|
9310
9766
|
]);
|
|
@@ -9421,22 +9877,6 @@ function liveServerContentFromMldev(fromObject) {
|
|
|
9421
9877
|
}
|
|
9422
9878
|
return toObject;
|
|
9423
9879
|
}
|
|
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
9880
|
function liveServerToolCallFromMldev(fromObject) {
|
|
9441
9881
|
const toObject = {};
|
|
9442
9882
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -9446,7 +9886,7 @@ function liveServerToolCallFromMldev(fromObject) {
|
|
|
9446
9886
|
let transformedList = fromFunctionCalls;
|
|
9447
9887
|
if (Array.isArray(transformedList)) {
|
|
9448
9888
|
transformedList = transformedList.map((item) => {
|
|
9449
|
-
return functionCallFromMldev(item);
|
|
9889
|
+
return functionCallFromMldev$1(item);
|
|
9450
9890
|
});
|
|
9451
9891
|
}
|
|
9452
9892
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -9857,6 +10297,18 @@ function fileDataFromVertex$1(fromObject) {
|
|
|
9857
10297
|
}
|
|
9858
10298
|
return toObject;
|
|
9859
10299
|
}
|
|
10300
|
+
function functionCallFromVertex$1(fromObject) {
|
|
10301
|
+
const toObject = {};
|
|
10302
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10303
|
+
if (fromArgs != null) {
|
|
10304
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
10305
|
+
}
|
|
10306
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
10307
|
+
if (fromName != null) {
|
|
10308
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
10309
|
+
}
|
|
10310
|
+
return toObject;
|
|
10311
|
+
}
|
|
9860
10312
|
function partFromVertex$1(fromObject) {
|
|
9861
10313
|
const toObject = {};
|
|
9862
10314
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9883,6 +10335,10 @@ function partFromVertex$1(fromObject) {
|
|
|
9883
10335
|
if (fromThoughtSignature != null) {
|
|
9884
10336
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9885
10337
|
}
|
|
10338
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10339
|
+
if (fromFunctionCall != null) {
|
|
10340
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex$1(fromFunctionCall));
|
|
10341
|
+
}
|
|
9886
10342
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9887
10343
|
'codeExecutionResult',
|
|
9888
10344
|
]);
|
|
@@ -9895,10 +10351,6 @@ function partFromVertex$1(fromObject) {
|
|
|
9895
10351
|
if (fromExecutableCode != null) {
|
|
9896
10352
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9897
10353
|
}
|
|
9898
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9899
|
-
if (fromFunctionCall != null) {
|
|
9900
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9901
|
-
}
|
|
9902
10354
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9903
10355
|
'functionResponse',
|
|
9904
10356
|
]);
|
|
@@ -9981,18 +10433,6 @@ function liveServerContentFromVertex(fromObject) {
|
|
|
9981
10433
|
}
|
|
9982
10434
|
return toObject;
|
|
9983
10435
|
}
|
|
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
10436
|
function liveServerToolCallFromVertex(fromObject) {
|
|
9997
10437
|
const toObject = {};
|
|
9998
10438
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -10002,7 +10442,7 @@ function liveServerToolCallFromVertex(fromObject) {
|
|
|
10002
10442
|
let transformedList = fromFunctionCalls;
|
|
10003
10443
|
if (Array.isArray(transformedList)) {
|
|
10004
10444
|
transformedList = transformedList.map((item) => {
|
|
10005
|
-
return functionCallFromVertex(item);
|
|
10445
|
+
return functionCallFromVertex$1(item);
|
|
10006
10446
|
});
|
|
10007
10447
|
}
|
|
10008
10448
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -10241,6 +10681,22 @@ function fileDataToMldev$1(fromObject) {
|
|
|
10241
10681
|
}
|
|
10242
10682
|
return toObject;
|
|
10243
10683
|
}
|
|
10684
|
+
function functionCallToMldev$1(fromObject) {
|
|
10685
|
+
const toObject = {};
|
|
10686
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
10687
|
+
if (fromId != null) {
|
|
10688
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
10689
|
+
}
|
|
10690
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10691
|
+
if (fromArgs != null) {
|
|
10692
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
10693
|
+
}
|
|
10694
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
10695
|
+
if (fromName != null) {
|
|
10696
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
10697
|
+
}
|
|
10698
|
+
return toObject;
|
|
10699
|
+
}
|
|
10244
10700
|
function partToMldev$1(fromObject) {
|
|
10245
10701
|
const toObject = {};
|
|
10246
10702
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -10267,6 +10723,10 @@ function partToMldev$1(fromObject) {
|
|
|
10267
10723
|
if (fromThoughtSignature != null) {
|
|
10268
10724
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10269
10725
|
}
|
|
10726
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10727
|
+
if (fromFunctionCall != null) {
|
|
10728
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
|
|
10729
|
+
}
|
|
10270
10730
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10271
10731
|
'codeExecutionResult',
|
|
10272
10732
|
]);
|
|
@@ -10279,10 +10739,6 @@ function partToMldev$1(fromObject) {
|
|
|
10279
10739
|
if (fromExecutableCode != null) {
|
|
10280
10740
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
10281
10741
|
}
|
|
10282
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10283
|
-
if (fromFunctionCall != null) {
|
|
10284
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
10285
|
-
}
|
|
10286
10742
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
10287
10743
|
'functionResponse',
|
|
10288
10744
|
]);
|
|
@@ -11305,6 +11761,21 @@ function fileDataToVertex(fromObject) {
|
|
|
11305
11761
|
}
|
|
11306
11762
|
return toObject;
|
|
11307
11763
|
}
|
|
11764
|
+
function functionCallToVertex(fromObject) {
|
|
11765
|
+
const toObject = {};
|
|
11766
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
11767
|
+
throw new Error('id parameter is not supported in Vertex AI.');
|
|
11768
|
+
}
|
|
11769
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
11770
|
+
if (fromArgs != null) {
|
|
11771
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
11772
|
+
}
|
|
11773
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
11774
|
+
if (fromName != null) {
|
|
11775
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
11776
|
+
}
|
|
11777
|
+
return toObject;
|
|
11778
|
+
}
|
|
11308
11779
|
function partToVertex(fromObject) {
|
|
11309
11780
|
const toObject = {};
|
|
11310
11781
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -11331,6 +11802,10 @@ function partToVertex(fromObject) {
|
|
|
11331
11802
|
if (fromThoughtSignature != null) {
|
|
11332
11803
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
11333
11804
|
}
|
|
11805
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11806
|
+
if (fromFunctionCall != null) {
|
|
11807
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex(fromFunctionCall));
|
|
11808
|
+
}
|
|
11334
11809
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
11335
11810
|
'codeExecutionResult',
|
|
11336
11811
|
]);
|
|
@@ -11343,10 +11818,6 @@ function partToVertex(fromObject) {
|
|
|
11343
11818
|
if (fromExecutableCode != null) {
|
|
11344
11819
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
11345
11820
|
}
|
|
11346
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11347
|
-
if (fromFunctionCall != null) {
|
|
11348
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
11349
|
-
}
|
|
11350
11821
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
11351
11822
|
'functionResponse',
|
|
11352
11823
|
]);
|
|
@@ -12971,6 +13442,22 @@ function fileDataFromMldev(fromObject) {
|
|
|
12971
13442
|
}
|
|
12972
13443
|
return toObject;
|
|
12973
13444
|
}
|
|
13445
|
+
function functionCallFromMldev(fromObject) {
|
|
13446
|
+
const toObject = {};
|
|
13447
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
13448
|
+
if (fromId != null) {
|
|
13449
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
13450
|
+
}
|
|
13451
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
13452
|
+
if (fromArgs != null) {
|
|
13453
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
13454
|
+
}
|
|
13455
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13456
|
+
if (fromName != null) {
|
|
13457
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13458
|
+
}
|
|
13459
|
+
return toObject;
|
|
13460
|
+
}
|
|
12974
13461
|
function partFromMldev(fromObject) {
|
|
12975
13462
|
const toObject = {};
|
|
12976
13463
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -12997,6 +13484,10 @@ function partFromMldev(fromObject) {
|
|
|
12997
13484
|
if (fromThoughtSignature != null) {
|
|
12998
13485
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
12999
13486
|
}
|
|
13487
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13488
|
+
if (fromFunctionCall != null) {
|
|
13489
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev(fromFunctionCall));
|
|
13490
|
+
}
|
|
13000
13491
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13001
13492
|
'codeExecutionResult',
|
|
13002
13493
|
]);
|
|
@@ -13009,10 +13500,6 @@ function partFromMldev(fromObject) {
|
|
|
13009
13500
|
if (fromExecutableCode != null) {
|
|
13010
13501
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13011
13502
|
}
|
|
13012
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13013
|
-
if (fromFunctionCall != null) {
|
|
13014
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13015
|
-
}
|
|
13016
13503
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13017
13504
|
'functionResponse',
|
|
13018
13505
|
]);
|
|
@@ -13535,6 +14022,18 @@ function fileDataFromVertex(fromObject) {
|
|
|
13535
14022
|
}
|
|
13536
14023
|
return toObject;
|
|
13537
14024
|
}
|
|
14025
|
+
function functionCallFromVertex(fromObject) {
|
|
14026
|
+
const toObject = {};
|
|
14027
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
14028
|
+
if (fromArgs != null) {
|
|
14029
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
14030
|
+
}
|
|
14031
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14032
|
+
if (fromName != null) {
|
|
14033
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14034
|
+
}
|
|
14035
|
+
return toObject;
|
|
14036
|
+
}
|
|
13538
14037
|
function partFromVertex(fromObject) {
|
|
13539
14038
|
const toObject = {};
|
|
13540
14039
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -13561,6 +14060,10 @@ function partFromVertex(fromObject) {
|
|
|
13561
14060
|
if (fromThoughtSignature != null) {
|
|
13562
14061
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13563
14062
|
}
|
|
14063
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
14064
|
+
if (fromFunctionCall != null) {
|
|
14065
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex(fromFunctionCall));
|
|
14066
|
+
}
|
|
13564
14067
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13565
14068
|
'codeExecutionResult',
|
|
13566
14069
|
]);
|
|
@@ -13573,10 +14076,6 @@ function partFromVertex(fromObject) {
|
|
|
13573
14076
|
if (fromExecutableCode != null) {
|
|
13574
14077
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13575
14078
|
}
|
|
13576
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13577
|
-
if (fromFunctionCall != null) {
|
|
13578
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13579
|
-
}
|
|
13580
14079
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13581
14080
|
'functionResponse',
|
|
13582
14081
|
]);
|
|
@@ -16998,6 +17497,22 @@ function fileDataToMldev(fromObject) {
|
|
|
16998
17497
|
}
|
|
16999
17498
|
return toObject;
|
|
17000
17499
|
}
|
|
17500
|
+
function functionCallToMldev(fromObject) {
|
|
17501
|
+
const toObject = {};
|
|
17502
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
17503
|
+
if (fromId != null) {
|
|
17504
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
17505
|
+
}
|
|
17506
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
17507
|
+
if (fromArgs != null) {
|
|
17508
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
17509
|
+
}
|
|
17510
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
17511
|
+
if (fromName != null) {
|
|
17512
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
17513
|
+
}
|
|
17514
|
+
return toObject;
|
|
17515
|
+
}
|
|
17001
17516
|
function partToMldev(fromObject) {
|
|
17002
17517
|
const toObject = {};
|
|
17003
17518
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -17024,6 +17539,10 @@ function partToMldev(fromObject) {
|
|
|
17024
17539
|
if (fromThoughtSignature != null) {
|
|
17025
17540
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
17026
17541
|
}
|
|
17542
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
17543
|
+
if (fromFunctionCall != null) {
|
|
17544
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
|
|
17545
|
+
}
|
|
17027
17546
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
17028
17547
|
'codeExecutionResult',
|
|
17029
17548
|
]);
|
|
@@ -17036,10 +17555,6 @@ function partToMldev(fromObject) {
|
|
|
17036
17555
|
if (fromExecutableCode != null) {
|
|
17037
17556
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
17038
17557
|
}
|
|
17039
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
17040
|
-
if (fromFunctionCall != null) {
|
|
17041
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
17042
|
-
}
|
|
17043
17558
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
17044
17559
|
'functionResponse',
|
|
17045
17560
|
]);
|
|
@@ -18830,5 +19345,5 @@ class GoogleGenAI {
|
|
|
18830
19345
|
}
|
|
18831
19346
|
}
|
|
18832
19347
|
|
|
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 };
|
|
19348
|
+
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
19349
|
//# sourceMappingURL=index.mjs.map
|