@google/genai 1.16.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 +189 -140
- package/dist/index.cjs +718 -230
- package/dist/index.mjs +717 -231
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +718 -230
- package/dist/node/index.mjs +717 -231
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +189 -140
- package/dist/web/index.mjs +717 -231
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +189 -140
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -117,7 +117,16 @@ function setValueByPath(data, keys, value) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
else {
|
|
120
|
-
|
|
120
|
+
if (keyToSet === '_self' &&
|
|
121
|
+
typeof value === 'object' &&
|
|
122
|
+
value !== null &&
|
|
123
|
+
!Array.isArray(value)) {
|
|
124
|
+
const valueAsRecord = value;
|
|
125
|
+
Object.assign(data, valueAsRecord);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
data[keyToSet] = value;
|
|
129
|
+
}
|
|
121
130
|
}
|
|
122
131
|
}
|
|
123
132
|
function getValueByPath(data, keys) {
|
|
@@ -861,7 +870,7 @@ exports.SubjectReferenceType = void 0;
|
|
|
861
870
|
SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
|
|
862
871
|
SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
|
|
863
872
|
})(exports.SubjectReferenceType || (exports.SubjectReferenceType = {}));
|
|
864
|
-
/** Enum representing the
|
|
873
|
+
/** Enum representing the editing mode. */
|
|
865
874
|
exports.EditMode = void 0;
|
|
866
875
|
(function (EditMode) {
|
|
867
876
|
EditMode["EDIT_MODE_DEFAULT"] = "EDIT_MODE_DEFAULT";
|
|
@@ -1638,6 +1647,12 @@ class DeleteFileResponse {
|
|
|
1638
1647
|
/** Config for `inlined_responses` parameter. */
|
|
1639
1648
|
class InlinedResponse {
|
|
1640
1649
|
}
|
|
1650
|
+
/** Config for `response` parameter. */
|
|
1651
|
+
class SingleEmbedContentResponse {
|
|
1652
|
+
}
|
|
1653
|
+
/** Config for `inlined_embedding_responses` parameter. */
|
|
1654
|
+
class InlinedEmbedContentResponse {
|
|
1655
|
+
}
|
|
1641
1656
|
/** Config for batches.list return value. */
|
|
1642
1657
|
class ListBatchJobsResponse {
|
|
1643
1658
|
}
|
|
@@ -2489,51 +2504,59 @@ function mcpToolsToGeminiTool(mcpTools, config = {}) {
|
|
|
2489
2504
|
return { functionDeclarations: functionDeclarations };
|
|
2490
2505
|
}
|
|
2491
2506
|
// Transforms a source input into a BatchJobSource object with validation.
|
|
2492
|
-
function tBatchJobSource(
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2507
|
+
function tBatchJobSource(client, src) {
|
|
2508
|
+
let sourceObj;
|
|
2509
|
+
if (typeof src === 'string') {
|
|
2510
|
+
if (client.isVertexAI()) {
|
|
2511
|
+
if (src.startsWith('gs://')) {
|
|
2512
|
+
sourceObj = { format: 'jsonl', gcsUri: [src] };
|
|
2513
|
+
}
|
|
2514
|
+
else if (src.startsWith('bq://')) {
|
|
2515
|
+
sourceObj = { format: 'bigquery', bigqueryUri: src };
|
|
2497
2516
|
}
|
|
2498
|
-
else
|
|
2499
|
-
throw new Error(
|
|
2517
|
+
else {
|
|
2518
|
+
throw new Error(`Unsupported string source for Vertex AI: ${src}`);
|
|
2500
2519
|
}
|
|
2501
2520
|
}
|
|
2502
2521
|
else {
|
|
2503
|
-
//
|
|
2504
|
-
if (src.
|
|
2505
|
-
|
|
2522
|
+
// MLDEV
|
|
2523
|
+
if (src.startsWith('files/')) {
|
|
2524
|
+
sourceObj = { fileName: src }; // Default to fileName for string input
|
|
2506
2525
|
}
|
|
2507
|
-
else
|
|
2508
|
-
throw new Error(
|
|
2526
|
+
else {
|
|
2527
|
+
throw new Error(`Unsupported string source for Gemini API: ${src}`);
|
|
2509
2528
|
}
|
|
2510
2529
|
}
|
|
2511
|
-
return src;
|
|
2512
2530
|
}
|
|
2513
|
-
// If src is an array (list in Python)
|
|
2514
2531
|
else if (Array.isArray(src)) {
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
else if (typeof src === 'string') {
|
|
2518
|
-
if (src.startsWith('gs://')) {
|
|
2519
|
-
return {
|
|
2520
|
-
format: 'jsonl',
|
|
2521
|
-
gcsUri: [src], // GCS URI is expected as an array
|
|
2522
|
-
};
|
|
2532
|
+
if (client.isVertexAI()) {
|
|
2533
|
+
throw new Error('InlinedRequest[] is not supported in Vertex AI.');
|
|
2523
2534
|
}
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2535
|
+
sourceObj = { inlinedRequests: src };
|
|
2536
|
+
}
|
|
2537
|
+
else {
|
|
2538
|
+
// It's already a BatchJobSource object
|
|
2539
|
+
sourceObj = src;
|
|
2540
|
+
}
|
|
2541
|
+
// Validation logic
|
|
2542
|
+
const vertexSourcesCount = [sourceObj.gcsUri, sourceObj.bigqueryUri].filter(Boolean).length;
|
|
2543
|
+
const mldevSourcesCount = [
|
|
2544
|
+
sourceObj.inlinedRequests,
|
|
2545
|
+
sourceObj.fileName,
|
|
2546
|
+
].filter(Boolean).length;
|
|
2547
|
+
if (client.isVertexAI()) {
|
|
2548
|
+
if (mldevSourcesCount > 0 || vertexSourcesCount !== 1) {
|
|
2549
|
+
throw new Error('Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.');
|
|
2529
2550
|
}
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2551
|
+
}
|
|
2552
|
+
else {
|
|
2553
|
+
// MLDEV
|
|
2554
|
+
if (vertexSourcesCount > 0 || mldevSourcesCount !== 1) {
|
|
2555
|
+
throw new Error('Exactly one of `inlinedRequests`, `fileName`, ' +
|
|
2556
|
+
'must be set for Gemini API.');
|
|
2534
2557
|
}
|
|
2535
2558
|
}
|
|
2536
|
-
|
|
2559
|
+
return sourceObj;
|
|
2537
2560
|
}
|
|
2538
2561
|
function tBatchJobDestination(dest) {
|
|
2539
2562
|
if (typeof dest !== 'string') {
|
|
@@ -2556,6 +2579,52 @@ function tBatchJobDestination(dest) {
|
|
|
2556
2579
|
throw new Error(`Unsupported destination: ${destString}`);
|
|
2557
2580
|
}
|
|
2558
2581
|
}
|
|
2582
|
+
function tRecvBatchJobDestination(dest) {
|
|
2583
|
+
// Ensure dest is a non-null object before proceeding.
|
|
2584
|
+
if (typeof dest !== 'object' || dest === null) {
|
|
2585
|
+
// If the input is not an object, it cannot be a valid BatchJobDestination
|
|
2586
|
+
// based on the operations performed. Return it cast, or handle as an error.
|
|
2587
|
+
// Casting an empty object might be a safe default.
|
|
2588
|
+
return {};
|
|
2589
|
+
}
|
|
2590
|
+
// Cast to Record<string, unknown> to allow string property access.
|
|
2591
|
+
const obj = dest;
|
|
2592
|
+
// Safely access nested properties.
|
|
2593
|
+
const inlineResponsesVal = obj['inlinedResponses'];
|
|
2594
|
+
if (typeof inlineResponsesVal !== 'object' || inlineResponsesVal === null) {
|
|
2595
|
+
return dest;
|
|
2596
|
+
}
|
|
2597
|
+
const inlineResponsesObj = inlineResponsesVal;
|
|
2598
|
+
const responsesArray = inlineResponsesObj['inlinedResponses'];
|
|
2599
|
+
if (!Array.isArray(responsesArray) || responsesArray.length === 0) {
|
|
2600
|
+
return dest;
|
|
2601
|
+
}
|
|
2602
|
+
// Check if any response has the 'embedding' property.
|
|
2603
|
+
let hasEmbedding = false;
|
|
2604
|
+
for (const responseItem of responsesArray) {
|
|
2605
|
+
if (typeof responseItem !== 'object' || responseItem === null) {
|
|
2606
|
+
continue;
|
|
2607
|
+
}
|
|
2608
|
+
const responseItemObj = responseItem;
|
|
2609
|
+
const responseVal = responseItemObj['response'];
|
|
2610
|
+
if (typeof responseVal !== 'object' || responseVal === null) {
|
|
2611
|
+
continue;
|
|
2612
|
+
}
|
|
2613
|
+
const responseObj = responseVal;
|
|
2614
|
+
// Check for the existence of the 'embedding' key.
|
|
2615
|
+
if (responseObj['embedding'] !== undefined) {
|
|
2616
|
+
hasEmbedding = true;
|
|
2617
|
+
break;
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
// Perform the transformation if an embedding was found.
|
|
2621
|
+
if (hasEmbedding) {
|
|
2622
|
+
obj['inlinedEmbedContentResponses'] = obj['inlinedResponses'];
|
|
2623
|
+
delete obj['inlinedResponses'];
|
|
2624
|
+
}
|
|
2625
|
+
// Cast the (potentially) modified object to the target type.
|
|
2626
|
+
return dest;
|
|
2627
|
+
}
|
|
2559
2628
|
function tBatchJobName(apiClient, name) {
|
|
2560
2629
|
const nameString = name;
|
|
2561
2630
|
if (!apiClient.isVertexAI()) {
|
|
@@ -2651,6 +2720,22 @@ function fileDataToMldev$4(fromObject) {
|
|
|
2651
2720
|
}
|
|
2652
2721
|
return toObject;
|
|
2653
2722
|
}
|
|
2723
|
+
function functionCallToMldev$4(fromObject) {
|
|
2724
|
+
const toObject = {};
|
|
2725
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
2726
|
+
if (fromId != null) {
|
|
2727
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
2728
|
+
}
|
|
2729
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
2730
|
+
if (fromArgs != null) {
|
|
2731
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
2732
|
+
}
|
|
2733
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
2734
|
+
if (fromName != null) {
|
|
2735
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
2736
|
+
}
|
|
2737
|
+
return toObject;
|
|
2738
|
+
}
|
|
2654
2739
|
function partToMldev$4(fromObject) {
|
|
2655
2740
|
const toObject = {};
|
|
2656
2741
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -2677,6 +2762,10 @@ function partToMldev$4(fromObject) {
|
|
|
2677
2762
|
if (fromThoughtSignature != null) {
|
|
2678
2763
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2679
2764
|
}
|
|
2765
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2766
|
+
if (fromFunctionCall != null) {
|
|
2767
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
|
|
2768
|
+
}
|
|
2680
2769
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2681
2770
|
'codeExecutionResult',
|
|
2682
2771
|
]);
|
|
@@ -2689,10 +2778,6 @@ function partToMldev$4(fromObject) {
|
|
|
2689
2778
|
if (fromExecutableCode != null) {
|
|
2690
2779
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
2691
2780
|
}
|
|
2692
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2693
|
-
if (fromFunctionCall != null) {
|
|
2694
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
2695
|
-
}
|
|
2696
2781
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
2697
2782
|
'functionResponse',
|
|
2698
2783
|
]);
|
|
@@ -3344,6 +3429,80 @@ function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
|
3344
3429
|
}
|
|
3345
3430
|
return toObject;
|
|
3346
3431
|
}
|
|
3432
|
+
function embedContentConfigToMldev$1(fromObject, parentObject) {
|
|
3433
|
+
const toObject = {};
|
|
3434
|
+
const fromTaskType = getValueByPath(fromObject, ['taskType']);
|
|
3435
|
+
if (parentObject !== undefined && fromTaskType != null) {
|
|
3436
|
+
setValueByPath(parentObject, ['requests[]', 'taskType'], fromTaskType);
|
|
3437
|
+
}
|
|
3438
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
3439
|
+
if (parentObject !== undefined && fromTitle != null) {
|
|
3440
|
+
setValueByPath(parentObject, ['requests[]', 'title'], fromTitle);
|
|
3441
|
+
}
|
|
3442
|
+
const fromOutputDimensionality = getValueByPath(fromObject, [
|
|
3443
|
+
'outputDimensionality',
|
|
3444
|
+
]);
|
|
3445
|
+
if (parentObject !== undefined && fromOutputDimensionality != null) {
|
|
3446
|
+
setValueByPath(parentObject, ['requests[]', 'outputDimensionality'], fromOutputDimensionality);
|
|
3447
|
+
}
|
|
3448
|
+
if (getValueByPath(fromObject, ['mimeType']) !== undefined) {
|
|
3449
|
+
throw new Error('mimeType parameter is not supported in Gemini API.');
|
|
3450
|
+
}
|
|
3451
|
+
if (getValueByPath(fromObject, ['autoTruncate']) !== undefined) {
|
|
3452
|
+
throw new Error('autoTruncate parameter is not supported in Gemini API.');
|
|
3453
|
+
}
|
|
3454
|
+
return toObject;
|
|
3455
|
+
}
|
|
3456
|
+
function embedContentBatchToMldev(apiClient, fromObject) {
|
|
3457
|
+
const toObject = {};
|
|
3458
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3459
|
+
if (fromContents != null) {
|
|
3460
|
+
setValueByPath(toObject, ['requests[]', 'request', 'content'], tContentsForEmbed(apiClient, fromContents));
|
|
3461
|
+
}
|
|
3462
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3463
|
+
if (fromConfig != null) {
|
|
3464
|
+
setValueByPath(toObject, ['config'], embedContentConfigToMldev$1(fromConfig, toObject));
|
|
3465
|
+
}
|
|
3466
|
+
return toObject;
|
|
3467
|
+
}
|
|
3468
|
+
function embeddingsBatchJobSourceToMldev(apiClient, fromObject) {
|
|
3469
|
+
const toObject = {};
|
|
3470
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
3471
|
+
if (fromFileName != null) {
|
|
3472
|
+
setValueByPath(toObject, ['file_name'], fromFileName);
|
|
3473
|
+
}
|
|
3474
|
+
const fromInlinedRequests = getValueByPath(fromObject, [
|
|
3475
|
+
'inlinedRequests',
|
|
3476
|
+
]);
|
|
3477
|
+
if (fromInlinedRequests != null) {
|
|
3478
|
+
setValueByPath(toObject, ['requests'], embedContentBatchToMldev(apiClient, fromInlinedRequests));
|
|
3479
|
+
}
|
|
3480
|
+
return toObject;
|
|
3481
|
+
}
|
|
3482
|
+
function createEmbeddingsBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3483
|
+
const toObject = {};
|
|
3484
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3485
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3486
|
+
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3487
|
+
}
|
|
3488
|
+
return toObject;
|
|
3489
|
+
}
|
|
3490
|
+
function createEmbeddingsBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3491
|
+
const toObject = {};
|
|
3492
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3493
|
+
if (fromModel != null) {
|
|
3494
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3495
|
+
}
|
|
3496
|
+
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3497
|
+
if (fromSrc != null) {
|
|
3498
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], embeddingsBatchJobSourceToMldev(apiClient, fromSrc));
|
|
3499
|
+
}
|
|
3500
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3501
|
+
if (fromConfig != null) {
|
|
3502
|
+
setValueByPath(toObject, ['config'], createEmbeddingsBatchJobConfigToMldev(fromConfig, toObject));
|
|
3503
|
+
}
|
|
3504
|
+
return toObject;
|
|
3505
|
+
}
|
|
3347
3506
|
function getBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3348
3507
|
const toObject = {};
|
|
3349
3508
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -3445,6 +3604,10 @@ function batchJobDestinationToVertex(fromObject) {
|
|
|
3445
3604
|
if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
|
|
3446
3605
|
throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
|
|
3447
3606
|
}
|
|
3607
|
+
if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
|
|
3608
|
+
undefined) {
|
|
3609
|
+
throw new Error('inlinedEmbedContentResponses parameter is not supported in Vertex AI.');
|
|
3610
|
+
}
|
|
3448
3611
|
return toObject;
|
|
3449
3612
|
}
|
|
3450
3613
|
function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -3575,6 +3738,22 @@ function fileDataFromMldev$2(fromObject) {
|
|
|
3575
3738
|
}
|
|
3576
3739
|
return toObject;
|
|
3577
3740
|
}
|
|
3741
|
+
function functionCallFromMldev$2(fromObject) {
|
|
3742
|
+
const toObject = {};
|
|
3743
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
3744
|
+
if (fromId != null) {
|
|
3745
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
3746
|
+
}
|
|
3747
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
3748
|
+
if (fromArgs != null) {
|
|
3749
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
3750
|
+
}
|
|
3751
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3752
|
+
if (fromName != null) {
|
|
3753
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3754
|
+
}
|
|
3755
|
+
return toObject;
|
|
3756
|
+
}
|
|
3578
3757
|
function partFromMldev$2(fromObject) {
|
|
3579
3758
|
const toObject = {};
|
|
3580
3759
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -3601,6 +3780,10 @@ function partFromMldev$2(fromObject) {
|
|
|
3601
3780
|
if (fromThoughtSignature != null) {
|
|
3602
3781
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
3603
3782
|
}
|
|
3783
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3784
|
+
if (fromFunctionCall != null) {
|
|
3785
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$2(fromFunctionCall));
|
|
3786
|
+
}
|
|
3604
3787
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3605
3788
|
'codeExecutionResult',
|
|
3606
3789
|
]);
|
|
@@ -3613,10 +3796,6 @@ function partFromMldev$2(fromObject) {
|
|
|
3613
3796
|
if (fromExecutableCode != null) {
|
|
3614
3797
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
3615
3798
|
}
|
|
3616
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3617
|
-
if (fromFunctionCall != null) {
|
|
3618
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3619
|
-
}
|
|
3620
3799
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
3621
3800
|
'functionResponse',
|
|
3622
3801
|
]);
|
|
@@ -3805,6 +3984,38 @@ function inlinedResponseFromMldev(fromObject) {
|
|
|
3805
3984
|
}
|
|
3806
3985
|
return toObject;
|
|
3807
3986
|
}
|
|
3987
|
+
function contentEmbeddingFromMldev$1(fromObject) {
|
|
3988
|
+
const toObject = {};
|
|
3989
|
+
const fromValues = getValueByPath(fromObject, ['values']);
|
|
3990
|
+
if (fromValues != null) {
|
|
3991
|
+
setValueByPath(toObject, ['values'], fromValues);
|
|
3992
|
+
}
|
|
3993
|
+
return toObject;
|
|
3994
|
+
}
|
|
3995
|
+
function singleEmbedContentResponseFromMldev(fromObject) {
|
|
3996
|
+
const toObject = {};
|
|
3997
|
+
const fromEmbedding = getValueByPath(fromObject, ['embedding']);
|
|
3998
|
+
if (fromEmbedding != null) {
|
|
3999
|
+
setValueByPath(toObject, ['embedding'], contentEmbeddingFromMldev$1(fromEmbedding));
|
|
4000
|
+
}
|
|
4001
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
4002
|
+
if (fromTokenCount != null) {
|
|
4003
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
4004
|
+
}
|
|
4005
|
+
return toObject;
|
|
4006
|
+
}
|
|
4007
|
+
function inlinedEmbedContentResponseFromMldev(fromObject) {
|
|
4008
|
+
const toObject = {};
|
|
4009
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
4010
|
+
if (fromResponse != null) {
|
|
4011
|
+
setValueByPath(toObject, ['response'], singleEmbedContentResponseFromMldev(fromResponse));
|
|
4012
|
+
}
|
|
4013
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
4014
|
+
if (fromError != null) {
|
|
4015
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev(fromError));
|
|
4016
|
+
}
|
|
4017
|
+
return toObject;
|
|
4018
|
+
}
|
|
3808
4019
|
function batchJobDestinationFromMldev(fromObject) {
|
|
3809
4020
|
const toObject = {};
|
|
3810
4021
|
const fromFileName = getValueByPath(fromObject, ['responsesFile']);
|
|
@@ -3824,6 +4035,19 @@ function batchJobDestinationFromMldev(fromObject) {
|
|
|
3824
4035
|
}
|
|
3825
4036
|
setValueByPath(toObject, ['inlinedResponses'], transformedList);
|
|
3826
4037
|
}
|
|
4038
|
+
const fromInlinedEmbedContentResponses = getValueByPath(fromObject, [
|
|
4039
|
+
'inlinedEmbedContentResponses',
|
|
4040
|
+
'inlinedResponses',
|
|
4041
|
+
]);
|
|
4042
|
+
if (fromInlinedEmbedContentResponses != null) {
|
|
4043
|
+
let transformedList = fromInlinedEmbedContentResponses;
|
|
4044
|
+
if (Array.isArray(transformedList)) {
|
|
4045
|
+
transformedList = transformedList.map((item) => {
|
|
4046
|
+
return inlinedEmbedContentResponseFromMldev(item);
|
|
4047
|
+
});
|
|
4048
|
+
}
|
|
4049
|
+
setValueByPath(toObject, ['inlinedEmbedContentResponses'], transformedList);
|
|
4050
|
+
}
|
|
3827
4051
|
return toObject;
|
|
3828
4052
|
}
|
|
3829
4053
|
function batchJobFromMldev(fromObject) {
|
|
@@ -3870,7 +4094,7 @@ function batchJobFromMldev(fromObject) {
|
|
|
3870
4094
|
}
|
|
3871
4095
|
const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
|
|
3872
4096
|
if (fromDest != null) {
|
|
3873
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
|
|
4097
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(tRecvBatchJobDestination(fromDest)));
|
|
3874
4098
|
}
|
|
3875
4099
|
return toObject;
|
|
3876
4100
|
}
|
|
@@ -4023,7 +4247,7 @@ function batchJobFromVertex(fromObject) {
|
|
|
4023
4247
|
}
|
|
4024
4248
|
const fromDest = getValueByPath(fromObject, ['outputConfig']);
|
|
4025
4249
|
if (fromDest != null) {
|
|
4026
|
-
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
|
|
4250
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
|
|
4027
4251
|
}
|
|
4028
4252
|
return toObject;
|
|
4029
4253
|
}
|
|
@@ -4289,79 +4513,87 @@ class Batches extends BaseModule {
|
|
|
4289
4513
|
this.create = async (params) => {
|
|
4290
4514
|
var _a, _b;
|
|
4291
4515
|
if (this.apiClient.isVertexAI()) {
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
'Google Cloud Storage URI or BigQuery URI instead.');
|
|
4297
|
-
}
|
|
4298
|
-
params.config = params.config || {};
|
|
4299
|
-
if (params.config.displayName === undefined) {
|
|
4300
|
-
params.config.displayName = 'genaiBatchJob_${timestampStr}';
|
|
4301
|
-
}
|
|
4302
|
-
if (params.config.dest === undefined && typeof params.src === 'string') {
|
|
4303
|
-
if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
|
|
4304
|
-
params.config.dest = `${params.src.slice(0, -6)}/dest`;
|
|
4305
|
-
}
|
|
4306
|
-
else if (params.src.startsWith('bq://')) {
|
|
4307
|
-
params.config.dest =
|
|
4308
|
-
`${params.src}_dest_${timestampStr}`;
|
|
4309
|
-
}
|
|
4310
|
-
else {
|
|
4311
|
-
throw new Error('Unsupported source:' + params.src);
|
|
4312
|
-
}
|
|
4313
|
-
}
|
|
4516
|
+
// Format destination if not provided
|
|
4517
|
+
// Cast params.src as Vertex AI path does not handle InlinedRequest[]
|
|
4518
|
+
params.config = this.formatDestination(params.src, params.config);
|
|
4519
|
+
return this.createInternal(params);
|
|
4314
4520
|
}
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
let queryParams = {};
|
|
4321
|
-
const body = createBatchJobParametersToMldev(this.apiClient, params);
|
|
4322
|
-
path = formatMap('{model}:batchGenerateContent', body['_url']);
|
|
4323
|
-
queryParams = body['_query'];
|
|
4324
|
-
// Move system instruction to 'request':
|
|
4325
|
-
// {'systemInstruction': system_instruction}
|
|
4326
|
-
const batch = body['batch'];
|
|
4327
|
-
const inputConfig = batch['inputConfig'];
|
|
4328
|
-
const requestsWrapper = inputConfig['requests'];
|
|
4329
|
-
const requests = requestsWrapper['requests'];
|
|
4330
|
-
const newRequests = [];
|
|
4331
|
-
for (const request of requests) {
|
|
4332
|
-
const requestDict = request;
|
|
4333
|
-
if (requestDict['systemInstruction']) {
|
|
4334
|
-
const systemInstructionValue = requestDict['systemInstruction'];
|
|
4335
|
-
delete requestDict['systemInstruction'];
|
|
4336
|
-
const requestContent = requestDict['request'];
|
|
4337
|
-
requestContent['systemInstruction'] = systemInstructionValue;
|
|
4338
|
-
requestDict['request'] = requestContent;
|
|
4339
|
-
}
|
|
4340
|
-
newRequests.push(requestDict);
|
|
4341
|
-
}
|
|
4342
|
-
requestsWrapper['requests'] = newRequests;
|
|
4343
|
-
delete body['config'];
|
|
4344
|
-
delete body['_url'];
|
|
4345
|
-
delete body['_query'];
|
|
4346
|
-
const response = this.apiClient
|
|
4347
|
-
.request({
|
|
4348
|
-
path: path,
|
|
4349
|
-
queryParams: queryParams,
|
|
4350
|
-
body: JSON.stringify(body),
|
|
4351
|
-
httpMethod: 'POST',
|
|
4352
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4353
|
-
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4354
|
-
})
|
|
4355
|
-
.then((httpResponse) => {
|
|
4356
|
-
return httpResponse.json();
|
|
4357
|
-
});
|
|
4358
|
-
return response.then((apiResponse) => {
|
|
4359
|
-
const resp = batchJobFromMldev(apiResponse);
|
|
4360
|
-
return resp;
|
|
4361
|
-
});
|
|
4362
|
-
}
|
|
4521
|
+
// MLDEV
|
|
4522
|
+
const src = params.src;
|
|
4523
|
+
const is_inlined = Array.isArray(params.src) || src.inlinedRequests !== undefined;
|
|
4524
|
+
if (!is_inlined) {
|
|
4525
|
+
return this.createInternal(params);
|
|
4363
4526
|
}
|
|
4364
|
-
|
|
4527
|
+
// Inlined generate content requests handling
|
|
4528
|
+
const result = this.createInlinedGenerateContentRequest(params);
|
|
4529
|
+
const path = result.path;
|
|
4530
|
+
const requestBody = result.body;
|
|
4531
|
+
const queryParams = createBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4532
|
+
const response = this.apiClient
|
|
4533
|
+
.request({
|
|
4534
|
+
path: path,
|
|
4535
|
+
queryParams: queryParams,
|
|
4536
|
+
body: JSON.stringify(requestBody),
|
|
4537
|
+
httpMethod: 'POST',
|
|
4538
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4539
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4540
|
+
})
|
|
4541
|
+
.then((httpResponse) => {
|
|
4542
|
+
return httpResponse.json();
|
|
4543
|
+
});
|
|
4544
|
+
return response.then((apiResponse) => {
|
|
4545
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4546
|
+
return resp;
|
|
4547
|
+
});
|
|
4548
|
+
};
|
|
4549
|
+
/**
|
|
4550
|
+
* **Experimental** Creates an embedding batch job.
|
|
4551
|
+
*
|
|
4552
|
+
* @param params - The parameters for create embedding batch job request.
|
|
4553
|
+
* @return The created batch job.
|
|
4554
|
+
*
|
|
4555
|
+
* @example
|
|
4556
|
+
* ```ts
|
|
4557
|
+
* const response = await ai.batches.createEmbeddings({
|
|
4558
|
+
* model: 'text-embedding-004',
|
|
4559
|
+
* src: {fileName: 'files/my_embedding_input'},
|
|
4560
|
+
* });
|
|
4561
|
+
* console.log(response);
|
|
4562
|
+
* ```
|
|
4563
|
+
*/
|
|
4564
|
+
this.createEmbeddings = async (params) => {
|
|
4565
|
+
var _a, _b;
|
|
4566
|
+
console.warn('batches.createEmbeddings() is experimental and may change without notice.');
|
|
4567
|
+
if (this.apiClient.isVertexAI()) {
|
|
4568
|
+
throw new Error('Vertex AI does not support batches.createEmbeddings.');
|
|
4569
|
+
}
|
|
4570
|
+
// MLDEV
|
|
4571
|
+
const src = params.src;
|
|
4572
|
+
const is_inlined = src.inlinedRequests !== undefined;
|
|
4573
|
+
if (!is_inlined) {
|
|
4574
|
+
return this.createEmbeddingsInternal(params); // Fixed typo here
|
|
4575
|
+
}
|
|
4576
|
+
// Inlined embed content requests handling
|
|
4577
|
+
const result = this.createInlinedEmbedContentRequest(params);
|
|
4578
|
+
const path = result.path;
|
|
4579
|
+
const requestBody = result.body;
|
|
4580
|
+
const queryParams = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params)['_query'] || {};
|
|
4581
|
+
const response = this.apiClient
|
|
4582
|
+
.request({
|
|
4583
|
+
path: path,
|
|
4584
|
+
queryParams: queryParams,
|
|
4585
|
+
body: JSON.stringify(requestBody),
|
|
4586
|
+
httpMethod: 'POST',
|
|
4587
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4588
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4589
|
+
})
|
|
4590
|
+
.then((httpResponse) => {
|
|
4591
|
+
return httpResponse.json();
|
|
4592
|
+
});
|
|
4593
|
+
return response.then((apiResponse) => {
|
|
4594
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4595
|
+
return resp;
|
|
4596
|
+
});
|
|
4365
4597
|
};
|
|
4366
4598
|
/**
|
|
4367
4599
|
* Lists batch job configurations.
|
|
@@ -4381,6 +4613,112 @@ class Batches extends BaseModule {
|
|
|
4381
4613
|
return new Pager(exports.PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4382
4614
|
};
|
|
4383
4615
|
}
|
|
4616
|
+
// Helper function to handle inlined generate content requests
|
|
4617
|
+
createInlinedGenerateContentRequest(params) {
|
|
4618
|
+
const body = createBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4619
|
+
params);
|
|
4620
|
+
const urlParams = body['_url'];
|
|
4621
|
+
const path = formatMap('{model}:batchGenerateContent', urlParams);
|
|
4622
|
+
const batch = body['batch'];
|
|
4623
|
+
const inputConfig = batch['inputConfig'];
|
|
4624
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4625
|
+
const requests = requestsWrapper['requests'];
|
|
4626
|
+
const newRequests = [];
|
|
4627
|
+
for (const request of requests) {
|
|
4628
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4629
|
+
if (requestDict['systemInstruction']) {
|
|
4630
|
+
const systemInstructionValue = requestDict['systemInstruction'];
|
|
4631
|
+
delete requestDict['systemInstruction'];
|
|
4632
|
+
const requestContent = requestDict['request'];
|
|
4633
|
+
requestContent['systemInstruction'] = systemInstructionValue;
|
|
4634
|
+
requestDict['request'] = requestContent;
|
|
4635
|
+
}
|
|
4636
|
+
newRequests.push(requestDict);
|
|
4637
|
+
}
|
|
4638
|
+
requestsWrapper['requests'] = newRequests;
|
|
4639
|
+
delete body['config'];
|
|
4640
|
+
delete body['_url'];
|
|
4641
|
+
delete body['_query'];
|
|
4642
|
+
return { path, body };
|
|
4643
|
+
}
|
|
4644
|
+
// Helper function to handle inlined embedding requests
|
|
4645
|
+
createInlinedEmbedContentRequest(params) {
|
|
4646
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, // Use instance apiClient
|
|
4647
|
+
params);
|
|
4648
|
+
const urlParams = body['_url'];
|
|
4649
|
+
const path = formatMap('{model}:asyncBatchEmbedContent', urlParams);
|
|
4650
|
+
const batch = body['batch'];
|
|
4651
|
+
const inputConfig = batch['inputConfig'];
|
|
4652
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4653
|
+
const requests = requestsWrapper['requests'];
|
|
4654
|
+
const newRequests = [];
|
|
4655
|
+
delete requestsWrapper['config']; // Remove top-level config
|
|
4656
|
+
for (const request of requests) {
|
|
4657
|
+
const requestDict = Object.assign({}, request); // Clone
|
|
4658
|
+
const innerRequest = requestDict['request'];
|
|
4659
|
+
for (const key in requestDict) {
|
|
4660
|
+
if (key !== 'request') {
|
|
4661
|
+
innerRequest[key] = requestDict[key];
|
|
4662
|
+
delete requestDict[key];
|
|
4663
|
+
}
|
|
4664
|
+
}
|
|
4665
|
+
newRequests.push(requestDict);
|
|
4666
|
+
}
|
|
4667
|
+
requestsWrapper['requests'] = newRequests;
|
|
4668
|
+
delete body['config'];
|
|
4669
|
+
delete body['_url'];
|
|
4670
|
+
delete body['_query'];
|
|
4671
|
+
return { path, body };
|
|
4672
|
+
}
|
|
4673
|
+
// Helper function to get the first GCS URI
|
|
4674
|
+
getGcsUri(src) {
|
|
4675
|
+
if (typeof src === 'string') {
|
|
4676
|
+
return src.startsWith('gs://') ? src : undefined;
|
|
4677
|
+
}
|
|
4678
|
+
if (!Array.isArray(src) && src.gcsUri && src.gcsUri.length > 0) {
|
|
4679
|
+
return src.gcsUri[0];
|
|
4680
|
+
}
|
|
4681
|
+
return undefined;
|
|
4682
|
+
}
|
|
4683
|
+
// Helper function to get the BigQuery URI
|
|
4684
|
+
getBigqueryUri(src) {
|
|
4685
|
+
if (typeof src === 'string') {
|
|
4686
|
+
return src.startsWith('bq://') ? src : undefined;
|
|
4687
|
+
}
|
|
4688
|
+
if (!Array.isArray(src)) {
|
|
4689
|
+
return src.bigqueryUri;
|
|
4690
|
+
}
|
|
4691
|
+
return undefined;
|
|
4692
|
+
}
|
|
4693
|
+
// Function to format the destination configuration for Vertex AI
|
|
4694
|
+
formatDestination(src, config) {
|
|
4695
|
+
const newConfig = config ? Object.assign({}, config) : {};
|
|
4696
|
+
const timestampStr = Date.now().toString();
|
|
4697
|
+
if (!newConfig.displayName) {
|
|
4698
|
+
newConfig.displayName = `genaiBatchJob_${timestampStr}`;
|
|
4699
|
+
}
|
|
4700
|
+
if (newConfig.dest === undefined) {
|
|
4701
|
+
const gcsUri = this.getGcsUri(src);
|
|
4702
|
+
const bigqueryUri = this.getBigqueryUri(src);
|
|
4703
|
+
if (gcsUri) {
|
|
4704
|
+
if (gcsUri.endsWith('.jsonl')) {
|
|
4705
|
+
// For .jsonl files, remove suffix and add /dest
|
|
4706
|
+
newConfig.dest = `${gcsUri.slice(0, -6)}/dest`;
|
|
4707
|
+
}
|
|
4708
|
+
else {
|
|
4709
|
+
// Fallback for other GCS URIs
|
|
4710
|
+
newConfig.dest = `${gcsUri}_dest_${timestampStr}`;
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
else if (bigqueryUri) {
|
|
4714
|
+
newConfig.dest = `${bigqueryUri}_dest_${timestampStr}`;
|
|
4715
|
+
}
|
|
4716
|
+
else {
|
|
4717
|
+
throw new Error('Unsupported source for Vertex AI: No GCS or BigQuery URI found.');
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4720
|
+
return newConfig;
|
|
4721
|
+
}
|
|
4384
4722
|
/**
|
|
4385
4723
|
* Internal method to create batch job.
|
|
4386
4724
|
*
|
|
@@ -4442,6 +4780,46 @@ class Batches extends BaseModule {
|
|
|
4442
4780
|
});
|
|
4443
4781
|
}
|
|
4444
4782
|
}
|
|
4783
|
+
/**
|
|
4784
|
+
* Internal method to create batch job.
|
|
4785
|
+
*
|
|
4786
|
+
* @param params - The parameters for create batch job request.
|
|
4787
|
+
* @return The created batch job.
|
|
4788
|
+
*
|
|
4789
|
+
*/
|
|
4790
|
+
async createEmbeddingsInternal(params) {
|
|
4791
|
+
var _a, _b;
|
|
4792
|
+
let response;
|
|
4793
|
+
let path = '';
|
|
4794
|
+
let queryParams = {};
|
|
4795
|
+
if (this.apiClient.isVertexAI()) {
|
|
4796
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
4797
|
+
}
|
|
4798
|
+
else {
|
|
4799
|
+
const body = createEmbeddingsBatchJobParametersToMldev(this.apiClient, params);
|
|
4800
|
+
path = formatMap('{model}:asyncBatchEmbedContent', body['_url']);
|
|
4801
|
+
queryParams = body['_query'];
|
|
4802
|
+
delete body['config'];
|
|
4803
|
+
delete body['_url'];
|
|
4804
|
+
delete body['_query'];
|
|
4805
|
+
response = this.apiClient
|
|
4806
|
+
.request({
|
|
4807
|
+
path: path,
|
|
4808
|
+
queryParams: queryParams,
|
|
4809
|
+
body: JSON.stringify(body),
|
|
4810
|
+
httpMethod: 'POST',
|
|
4811
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4812
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4813
|
+
})
|
|
4814
|
+
.then((httpResponse) => {
|
|
4815
|
+
return httpResponse.json();
|
|
4816
|
+
});
|
|
4817
|
+
return response.then((apiResponse) => {
|
|
4818
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4819
|
+
return resp;
|
|
4820
|
+
});
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4445
4823
|
/**
|
|
4446
4824
|
* Gets batch job configurations.
|
|
4447
4825
|
*
|
|
@@ -4755,6 +5133,22 @@ function fileDataToMldev$3(fromObject) {
|
|
|
4755
5133
|
}
|
|
4756
5134
|
return toObject;
|
|
4757
5135
|
}
|
|
5136
|
+
function functionCallToMldev$3(fromObject) {
|
|
5137
|
+
const toObject = {};
|
|
5138
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5139
|
+
if (fromId != null) {
|
|
5140
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5141
|
+
}
|
|
5142
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5143
|
+
if (fromArgs != null) {
|
|
5144
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5145
|
+
}
|
|
5146
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5147
|
+
if (fromName != null) {
|
|
5148
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5149
|
+
}
|
|
5150
|
+
return toObject;
|
|
5151
|
+
}
|
|
4758
5152
|
function partToMldev$3(fromObject) {
|
|
4759
5153
|
const toObject = {};
|
|
4760
5154
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -4781,6 +5175,10 @@ function partToMldev$3(fromObject) {
|
|
|
4781
5175
|
if (fromThoughtSignature != null) {
|
|
4782
5176
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
4783
5177
|
}
|
|
5178
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5179
|
+
if (fromFunctionCall != null) {
|
|
5180
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
|
|
5181
|
+
}
|
|
4784
5182
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4785
5183
|
'codeExecutionResult',
|
|
4786
5184
|
]);
|
|
@@ -4793,10 +5191,6 @@ function partToMldev$3(fromObject) {
|
|
|
4793
5191
|
if (fromExecutableCode != null) {
|
|
4794
5192
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4795
5193
|
}
|
|
4796
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4797
|
-
if (fromFunctionCall != null) {
|
|
4798
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4799
|
-
}
|
|
4800
5194
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4801
5195
|
'functionResponse',
|
|
4802
5196
|
]);
|
|
@@ -5204,6 +5598,21 @@ function fileDataToVertex$2(fromObject) {
|
|
|
5204
5598
|
}
|
|
5205
5599
|
return toObject;
|
|
5206
5600
|
}
|
|
5601
|
+
function functionCallToVertex$2(fromObject) {
|
|
5602
|
+
const toObject = {};
|
|
5603
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
5604
|
+
throw new Error('id parameter is not supported in Vertex AI.');
|
|
5605
|
+
}
|
|
5606
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5607
|
+
if (fromArgs != null) {
|
|
5608
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5609
|
+
}
|
|
5610
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5611
|
+
if (fromName != null) {
|
|
5612
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5613
|
+
}
|
|
5614
|
+
return toObject;
|
|
5615
|
+
}
|
|
5207
5616
|
function partToVertex$2(fromObject) {
|
|
5208
5617
|
const toObject = {};
|
|
5209
5618
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -5230,6 +5639,10 @@ function partToVertex$2(fromObject) {
|
|
|
5230
5639
|
if (fromThoughtSignature != null) {
|
|
5231
5640
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5232
5641
|
}
|
|
5642
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5643
|
+
if (fromFunctionCall != null) {
|
|
5644
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$2(fromFunctionCall));
|
|
5645
|
+
}
|
|
5233
5646
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5234
5647
|
'codeExecutionResult',
|
|
5235
5648
|
]);
|
|
@@ -5242,10 +5655,6 @@ function partToVertex$2(fromObject) {
|
|
|
5242
5655
|
if (fromExecutableCode != null) {
|
|
5243
5656
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
5244
5657
|
}
|
|
5245
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5246
|
-
if (fromFunctionCall != null) {
|
|
5247
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
5248
|
-
}
|
|
5249
5658
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
5250
5659
|
'functionResponse',
|
|
5251
5660
|
]);
|
|
@@ -6617,7 +7026,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6617
7026
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6618
7027
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6619
7028
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6620
|
-
const SDK_VERSION = '1.
|
|
7029
|
+
const SDK_VERSION = '1.18.0'; // x-release-please-version
|
|
6621
7030
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6622
7031
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6623
7032
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -7972,6 +8381,22 @@ function fileDataToMldev$2(fromObject) {
|
|
|
7972
8381
|
}
|
|
7973
8382
|
return toObject;
|
|
7974
8383
|
}
|
|
8384
|
+
function functionCallToMldev$2(fromObject) {
|
|
8385
|
+
const toObject = {};
|
|
8386
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
8387
|
+
if (fromId != null) {
|
|
8388
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
8389
|
+
}
|
|
8390
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
8391
|
+
if (fromArgs != null) {
|
|
8392
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
8393
|
+
}
|
|
8394
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
8395
|
+
if (fromName != null) {
|
|
8396
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
8397
|
+
}
|
|
8398
|
+
return toObject;
|
|
8399
|
+
}
|
|
7975
8400
|
function partToMldev$2(fromObject) {
|
|
7976
8401
|
const toObject = {};
|
|
7977
8402
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -7998,6 +8423,10 @@ function partToMldev$2(fromObject) {
|
|
|
7998
8423
|
if (fromThoughtSignature != null) {
|
|
7999
8424
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8000
8425
|
}
|
|
8426
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8427
|
+
if (fromFunctionCall != null) {
|
|
8428
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
|
|
8429
|
+
}
|
|
8001
8430
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8002
8431
|
'codeExecutionResult',
|
|
8003
8432
|
]);
|
|
@@ -8010,10 +8439,6 @@ function partToMldev$2(fromObject) {
|
|
|
8010
8439
|
if (fromExecutableCode != null) {
|
|
8011
8440
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8012
8441
|
}
|
|
8013
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8014
|
-
if (fromFunctionCall != null) {
|
|
8015
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8016
|
-
}
|
|
8017
8442
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8018
8443
|
'functionResponse',
|
|
8019
8444
|
]);
|
|
@@ -8676,6 +9101,21 @@ function fileDataToVertex$1(fromObject) {
|
|
|
8676
9101
|
}
|
|
8677
9102
|
return toObject;
|
|
8678
9103
|
}
|
|
9104
|
+
function functionCallToVertex$1(fromObject) {
|
|
9105
|
+
const toObject = {};
|
|
9106
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
9107
|
+
throw new Error('id parameter is not supported in Vertex AI.');
|
|
9108
|
+
}
|
|
9109
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9110
|
+
if (fromArgs != null) {
|
|
9111
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9112
|
+
}
|
|
9113
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9114
|
+
if (fromName != null) {
|
|
9115
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9116
|
+
}
|
|
9117
|
+
return toObject;
|
|
9118
|
+
}
|
|
8679
9119
|
function partToVertex$1(fromObject) {
|
|
8680
9120
|
const toObject = {};
|
|
8681
9121
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -8702,6 +9142,10 @@ function partToVertex$1(fromObject) {
|
|
|
8702
9142
|
if (fromThoughtSignature != null) {
|
|
8703
9143
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8704
9144
|
}
|
|
9145
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9146
|
+
if (fromFunctionCall != null) {
|
|
9147
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex$1(fromFunctionCall));
|
|
9148
|
+
}
|
|
8705
9149
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8706
9150
|
'codeExecutionResult',
|
|
8707
9151
|
]);
|
|
@@ -8714,10 +9158,6 @@ function partToVertex$1(fromObject) {
|
|
|
8714
9158
|
if (fromExecutableCode != null) {
|
|
8715
9159
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
8716
9160
|
}
|
|
8717
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
8718
|
-
if (fromFunctionCall != null) {
|
|
8719
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
8720
|
-
}
|
|
8721
9161
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8722
9162
|
'functionResponse',
|
|
8723
9163
|
]);
|
|
@@ -9265,6 +9705,22 @@ function fileDataFromMldev$1(fromObject) {
|
|
|
9265
9705
|
}
|
|
9266
9706
|
return toObject;
|
|
9267
9707
|
}
|
|
9708
|
+
function functionCallFromMldev$1(fromObject) {
|
|
9709
|
+
const toObject = {};
|
|
9710
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
9711
|
+
if (fromId != null) {
|
|
9712
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
9713
|
+
}
|
|
9714
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9715
|
+
if (fromArgs != null) {
|
|
9716
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
9717
|
+
}
|
|
9718
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
9719
|
+
if (fromName != null) {
|
|
9720
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
9721
|
+
}
|
|
9722
|
+
return toObject;
|
|
9723
|
+
}
|
|
9268
9724
|
function partFromMldev$1(fromObject) {
|
|
9269
9725
|
const toObject = {};
|
|
9270
9726
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9291,6 +9747,10 @@ function partFromMldev$1(fromObject) {
|
|
|
9291
9747
|
if (fromThoughtSignature != null) {
|
|
9292
9748
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9293
9749
|
}
|
|
9750
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9751
|
+
if (fromFunctionCall != null) {
|
|
9752
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev$1(fromFunctionCall));
|
|
9753
|
+
}
|
|
9294
9754
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9295
9755
|
'codeExecutionResult',
|
|
9296
9756
|
]);
|
|
@@ -9303,10 +9763,6 @@ function partFromMldev$1(fromObject) {
|
|
|
9303
9763
|
if (fromExecutableCode != null) {
|
|
9304
9764
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9305
9765
|
}
|
|
9306
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9307
|
-
if (fromFunctionCall != null) {
|
|
9308
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9309
|
-
}
|
|
9310
9766
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9311
9767
|
'functionResponse',
|
|
9312
9768
|
]);
|
|
@@ -9423,22 +9879,6 @@ function liveServerContentFromMldev(fromObject) {
|
|
|
9423
9879
|
}
|
|
9424
9880
|
return toObject;
|
|
9425
9881
|
}
|
|
9426
|
-
function functionCallFromMldev(fromObject) {
|
|
9427
|
-
const toObject = {};
|
|
9428
|
-
const fromId = getValueByPath(fromObject, ['id']);
|
|
9429
|
-
if (fromId != null) {
|
|
9430
|
-
setValueByPath(toObject, ['id'], fromId);
|
|
9431
|
-
}
|
|
9432
|
-
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9433
|
-
if (fromArgs != null) {
|
|
9434
|
-
setValueByPath(toObject, ['args'], fromArgs);
|
|
9435
|
-
}
|
|
9436
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
9437
|
-
if (fromName != null) {
|
|
9438
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
9439
|
-
}
|
|
9440
|
-
return toObject;
|
|
9441
|
-
}
|
|
9442
9882
|
function liveServerToolCallFromMldev(fromObject) {
|
|
9443
9883
|
const toObject = {};
|
|
9444
9884
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -9448,7 +9888,7 @@ function liveServerToolCallFromMldev(fromObject) {
|
|
|
9448
9888
|
let transformedList = fromFunctionCalls;
|
|
9449
9889
|
if (Array.isArray(transformedList)) {
|
|
9450
9890
|
transformedList = transformedList.map((item) => {
|
|
9451
|
-
return functionCallFromMldev(item);
|
|
9891
|
+
return functionCallFromMldev$1(item);
|
|
9452
9892
|
});
|
|
9453
9893
|
}
|
|
9454
9894
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -9859,6 +10299,18 @@ function fileDataFromVertex$1(fromObject) {
|
|
|
9859
10299
|
}
|
|
9860
10300
|
return toObject;
|
|
9861
10301
|
}
|
|
10302
|
+
function functionCallFromVertex$1(fromObject) {
|
|
10303
|
+
const toObject = {};
|
|
10304
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10305
|
+
if (fromArgs != null) {
|
|
10306
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
10307
|
+
}
|
|
10308
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
10309
|
+
if (fromName != null) {
|
|
10310
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
10311
|
+
}
|
|
10312
|
+
return toObject;
|
|
10313
|
+
}
|
|
9862
10314
|
function partFromVertex$1(fromObject) {
|
|
9863
10315
|
const toObject = {};
|
|
9864
10316
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -9885,6 +10337,10 @@ function partFromVertex$1(fromObject) {
|
|
|
9885
10337
|
if (fromThoughtSignature != null) {
|
|
9886
10338
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9887
10339
|
}
|
|
10340
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10341
|
+
if (fromFunctionCall != null) {
|
|
10342
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex$1(fromFunctionCall));
|
|
10343
|
+
}
|
|
9888
10344
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9889
10345
|
'codeExecutionResult',
|
|
9890
10346
|
]);
|
|
@@ -9897,10 +10353,6 @@ function partFromVertex$1(fromObject) {
|
|
|
9897
10353
|
if (fromExecutableCode != null) {
|
|
9898
10354
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
9899
10355
|
}
|
|
9900
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9901
|
-
if (fromFunctionCall != null) {
|
|
9902
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
9903
|
-
}
|
|
9904
10356
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
9905
10357
|
'functionResponse',
|
|
9906
10358
|
]);
|
|
@@ -9983,18 +10435,6 @@ function liveServerContentFromVertex(fromObject) {
|
|
|
9983
10435
|
}
|
|
9984
10436
|
return toObject;
|
|
9985
10437
|
}
|
|
9986
|
-
function functionCallFromVertex(fromObject) {
|
|
9987
|
-
const toObject = {};
|
|
9988
|
-
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
9989
|
-
if (fromArgs != null) {
|
|
9990
|
-
setValueByPath(toObject, ['args'], fromArgs);
|
|
9991
|
-
}
|
|
9992
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
9993
|
-
if (fromName != null) {
|
|
9994
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
9995
|
-
}
|
|
9996
|
-
return toObject;
|
|
9997
|
-
}
|
|
9998
10438
|
function liveServerToolCallFromVertex(fromObject) {
|
|
9999
10439
|
const toObject = {};
|
|
10000
10440
|
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
@@ -10004,7 +10444,7 @@ function liveServerToolCallFromVertex(fromObject) {
|
|
|
10004
10444
|
let transformedList = fromFunctionCalls;
|
|
10005
10445
|
if (Array.isArray(transformedList)) {
|
|
10006
10446
|
transformedList = transformedList.map((item) => {
|
|
10007
|
-
return functionCallFromVertex(item);
|
|
10447
|
+
return functionCallFromVertex$1(item);
|
|
10008
10448
|
});
|
|
10009
10449
|
}
|
|
10010
10450
|
setValueByPath(toObject, ['functionCalls'], transformedList);
|
|
@@ -10243,6 +10683,22 @@ function fileDataToMldev$1(fromObject) {
|
|
|
10243
10683
|
}
|
|
10244
10684
|
return toObject;
|
|
10245
10685
|
}
|
|
10686
|
+
function functionCallToMldev$1(fromObject) {
|
|
10687
|
+
const toObject = {};
|
|
10688
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
10689
|
+
if (fromId != null) {
|
|
10690
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
10691
|
+
}
|
|
10692
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10693
|
+
if (fromArgs != null) {
|
|
10694
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
10695
|
+
}
|
|
10696
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
10697
|
+
if (fromName != null) {
|
|
10698
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
10699
|
+
}
|
|
10700
|
+
return toObject;
|
|
10701
|
+
}
|
|
10246
10702
|
function partToMldev$1(fromObject) {
|
|
10247
10703
|
const toObject = {};
|
|
10248
10704
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -10269,6 +10725,10 @@ function partToMldev$1(fromObject) {
|
|
|
10269
10725
|
if (fromThoughtSignature != null) {
|
|
10270
10726
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10271
10727
|
}
|
|
10728
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10729
|
+
if (fromFunctionCall != null) {
|
|
10730
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
|
|
10731
|
+
}
|
|
10272
10732
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10273
10733
|
'codeExecutionResult',
|
|
10274
10734
|
]);
|
|
@@ -10281,10 +10741,6 @@ function partToMldev$1(fromObject) {
|
|
|
10281
10741
|
if (fromExecutableCode != null) {
|
|
10282
10742
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
10283
10743
|
}
|
|
10284
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10285
|
-
if (fromFunctionCall != null) {
|
|
10286
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
10287
|
-
}
|
|
10288
10744
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
10289
10745
|
'functionResponse',
|
|
10290
10746
|
]);
|
|
@@ -11193,8 +11649,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
11193
11649
|
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
11194
11650
|
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
11195
11651
|
}
|
|
11196
|
-
|
|
11197
|
-
|
|
11652
|
+
const fromResolution = getValueByPath(fromObject, ['resolution']);
|
|
11653
|
+
if (parentObject !== undefined && fromResolution != null) {
|
|
11654
|
+
setValueByPath(parentObject, ['parameters', 'resolution'], fromResolution);
|
|
11198
11655
|
}
|
|
11199
11656
|
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
11200
11657
|
'personGeneration',
|
|
@@ -11306,6 +11763,21 @@ function fileDataToVertex(fromObject) {
|
|
|
11306
11763
|
}
|
|
11307
11764
|
return toObject;
|
|
11308
11765
|
}
|
|
11766
|
+
function functionCallToVertex(fromObject) {
|
|
11767
|
+
const toObject = {};
|
|
11768
|
+
if (getValueByPath(fromObject, ['id']) !== undefined) {
|
|
11769
|
+
throw new Error('id parameter is not supported in Vertex AI.');
|
|
11770
|
+
}
|
|
11771
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
11772
|
+
if (fromArgs != null) {
|
|
11773
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
11774
|
+
}
|
|
11775
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
11776
|
+
if (fromName != null) {
|
|
11777
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
11778
|
+
}
|
|
11779
|
+
return toObject;
|
|
11780
|
+
}
|
|
11309
11781
|
function partToVertex(fromObject) {
|
|
11310
11782
|
const toObject = {};
|
|
11311
11783
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -11332,6 +11804,10 @@ function partToVertex(fromObject) {
|
|
|
11332
11804
|
if (fromThoughtSignature != null) {
|
|
11333
11805
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
11334
11806
|
}
|
|
11807
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11808
|
+
if (fromFunctionCall != null) {
|
|
11809
|
+
setValueByPath(toObject, ['functionCall'], functionCallToVertex(fromFunctionCall));
|
|
11810
|
+
}
|
|
11335
11811
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
11336
11812
|
'codeExecutionResult',
|
|
11337
11813
|
]);
|
|
@@ -11344,10 +11820,6 @@ function partToVertex(fromObject) {
|
|
|
11344
11820
|
if (fromExecutableCode != null) {
|
|
11345
11821
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
11346
11822
|
}
|
|
11347
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11348
|
-
if (fromFunctionCall != null) {
|
|
11349
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
11350
|
-
}
|
|
11351
11823
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
11352
11824
|
'functionResponse',
|
|
11353
11825
|
]);
|
|
@@ -12972,6 +13444,22 @@ function fileDataFromMldev(fromObject) {
|
|
|
12972
13444
|
}
|
|
12973
13445
|
return toObject;
|
|
12974
13446
|
}
|
|
13447
|
+
function functionCallFromMldev(fromObject) {
|
|
13448
|
+
const toObject = {};
|
|
13449
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
13450
|
+
if (fromId != null) {
|
|
13451
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
13452
|
+
}
|
|
13453
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
13454
|
+
if (fromArgs != null) {
|
|
13455
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
13456
|
+
}
|
|
13457
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13458
|
+
if (fromName != null) {
|
|
13459
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13460
|
+
}
|
|
13461
|
+
return toObject;
|
|
13462
|
+
}
|
|
12975
13463
|
function partFromMldev(fromObject) {
|
|
12976
13464
|
const toObject = {};
|
|
12977
13465
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -12998,6 +13486,10 @@ function partFromMldev(fromObject) {
|
|
|
12998
13486
|
if (fromThoughtSignature != null) {
|
|
12999
13487
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13000
13488
|
}
|
|
13489
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13490
|
+
if (fromFunctionCall != null) {
|
|
13491
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromMldev(fromFunctionCall));
|
|
13492
|
+
}
|
|
13001
13493
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13002
13494
|
'codeExecutionResult',
|
|
13003
13495
|
]);
|
|
@@ -13010,10 +13502,6 @@ function partFromMldev(fromObject) {
|
|
|
13010
13502
|
if (fromExecutableCode != null) {
|
|
13011
13503
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13012
13504
|
}
|
|
13013
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13014
|
-
if (fromFunctionCall != null) {
|
|
13015
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13016
|
-
}
|
|
13017
13505
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13018
13506
|
'functionResponse',
|
|
13019
13507
|
]);
|
|
@@ -13536,6 +14024,18 @@ function fileDataFromVertex(fromObject) {
|
|
|
13536
14024
|
}
|
|
13537
14025
|
return toObject;
|
|
13538
14026
|
}
|
|
14027
|
+
function functionCallFromVertex(fromObject) {
|
|
14028
|
+
const toObject = {};
|
|
14029
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
14030
|
+
if (fromArgs != null) {
|
|
14031
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
14032
|
+
}
|
|
14033
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14034
|
+
if (fromName != null) {
|
|
14035
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14036
|
+
}
|
|
14037
|
+
return toObject;
|
|
14038
|
+
}
|
|
13539
14039
|
function partFromVertex(fromObject) {
|
|
13540
14040
|
const toObject = {};
|
|
13541
14041
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -13562,6 +14062,10 @@ function partFromVertex(fromObject) {
|
|
|
13562
14062
|
if (fromThoughtSignature != null) {
|
|
13563
14063
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13564
14064
|
}
|
|
14065
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
14066
|
+
if (fromFunctionCall != null) {
|
|
14067
|
+
setValueByPath(toObject, ['functionCall'], functionCallFromVertex(fromFunctionCall));
|
|
14068
|
+
}
|
|
13565
14069
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13566
14070
|
'codeExecutionResult',
|
|
13567
14071
|
]);
|
|
@@ -13574,10 +14078,6 @@ function partFromVertex(fromObject) {
|
|
|
13574
14078
|
if (fromExecutableCode != null) {
|
|
13575
14079
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13576
14080
|
}
|
|
13577
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13578
|
-
if (fromFunctionCall != null) {
|
|
13579
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13580
|
-
}
|
|
13581
14081
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13582
14082
|
'functionResponse',
|
|
13583
14083
|
]);
|
|
@@ -15883,23 +16383,7 @@ class Models extends BaseModule {
|
|
|
15883
16383
|
}
|
|
15884
16384
|
}
|
|
15885
16385
|
/**
|
|
15886
|
-
*
|
|
15887
|
-
*
|
|
15888
|
-
* @param params - The parameters for generating images.
|
|
15889
|
-
* @return The response from the API.
|
|
15890
|
-
*
|
|
15891
|
-
* @example
|
|
15892
|
-
* ```ts
|
|
15893
|
-
* const response = await ai.models.generateImages({
|
|
15894
|
-
* model: 'imagen-3.0-generate-002',
|
|
15895
|
-
* prompt: 'Robot holding a red skateboard',
|
|
15896
|
-
* config: {
|
|
15897
|
-
* numberOfImages: 1,
|
|
15898
|
-
* includeRaiReason: true,
|
|
15899
|
-
* },
|
|
15900
|
-
* });
|
|
15901
|
-
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
15902
|
-
* ```
|
|
16386
|
+
* Private method for generating images.
|
|
15903
16387
|
*/
|
|
15904
16388
|
async generateImagesInternal(params) {
|
|
15905
16389
|
var _a, _b, _c, _d;
|
|
@@ -15971,6 +16455,9 @@ class Models extends BaseModule {
|
|
|
15971
16455
|
});
|
|
15972
16456
|
}
|
|
15973
16457
|
}
|
|
16458
|
+
/**
|
|
16459
|
+
* Private method for editing an image.
|
|
16460
|
+
*/
|
|
15974
16461
|
async editImageInternal(params) {
|
|
15975
16462
|
var _a, _b;
|
|
15976
16463
|
let response;
|
|
@@ -16012,6 +16499,9 @@ class Models extends BaseModule {
|
|
|
16012
16499
|
throw new Error('This method is only supported by the Vertex AI.');
|
|
16013
16500
|
}
|
|
16014
16501
|
}
|
|
16502
|
+
/**
|
|
16503
|
+
* Private method for upscaling an image.
|
|
16504
|
+
*/
|
|
16015
16505
|
async upscaleImageInternal(params) {
|
|
16016
16506
|
var _a, _b;
|
|
16017
16507
|
let response;
|
|
@@ -16611,27 +17101,7 @@ class Models extends BaseModule {
|
|
|
16611
17101
|
}
|
|
16612
17102
|
}
|
|
16613
17103
|
/**
|
|
16614
|
-
*
|
|
16615
|
-
*
|
|
16616
|
-
* @param params - The parameters for generating videos.
|
|
16617
|
-
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
16618
|
-
*
|
|
16619
|
-
* @example
|
|
16620
|
-
* ```ts
|
|
16621
|
-
* const operation = await ai.models.generateVideos({
|
|
16622
|
-
* model: 'veo-2.0-generate-001',
|
|
16623
|
-
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
16624
|
-
* config: {
|
|
16625
|
-
* numberOfVideos: 1
|
|
16626
|
-
* });
|
|
16627
|
-
*
|
|
16628
|
-
* while (!operation.done) {
|
|
16629
|
-
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
16630
|
-
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
16631
|
-
* }
|
|
16632
|
-
*
|
|
16633
|
-
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
16634
|
-
* ```
|
|
17104
|
+
* Private method for generating videos.
|
|
16635
17105
|
*/
|
|
16636
17106
|
async generateVideosInternal(params) {
|
|
16637
17107
|
var _a, _b, _c, _d;
|
|
@@ -17029,6 +17499,22 @@ function fileDataToMldev(fromObject) {
|
|
|
17029
17499
|
}
|
|
17030
17500
|
return toObject;
|
|
17031
17501
|
}
|
|
17502
|
+
function functionCallToMldev(fromObject) {
|
|
17503
|
+
const toObject = {};
|
|
17504
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
17505
|
+
if (fromId != null) {
|
|
17506
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
17507
|
+
}
|
|
17508
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
17509
|
+
if (fromArgs != null) {
|
|
17510
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
17511
|
+
}
|
|
17512
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
17513
|
+
if (fromName != null) {
|
|
17514
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
17515
|
+
}
|
|
17516
|
+
return toObject;
|
|
17517
|
+
}
|
|
17032
17518
|
function partToMldev(fromObject) {
|
|
17033
17519
|
const toObject = {};
|
|
17034
17520
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
@@ -17055,6 +17541,10 @@ function partToMldev(fromObject) {
|
|
|
17055
17541
|
if (fromThoughtSignature != null) {
|
|
17056
17542
|
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
17057
17543
|
}
|
|
17544
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
17545
|
+
if (fromFunctionCall != null) {
|
|
17546
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
|
|
17547
|
+
}
|
|
17058
17548
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
17059
17549
|
'codeExecutionResult',
|
|
17060
17550
|
]);
|
|
@@ -17067,10 +17557,6 @@ function partToMldev(fromObject) {
|
|
|
17067
17557
|
if (fromExecutableCode != null) {
|
|
17068
17558
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
17069
17559
|
}
|
|
17070
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
17071
|
-
if (fromFunctionCall != null) {
|
|
17072
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
17073
|
-
}
|
|
17074
17560
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
17075
17561
|
'functionResponse',
|
|
17076
17562
|
]);
|
|
@@ -18885,6 +19371,7 @@ exports.GenerateVideosOperation = GenerateVideosOperation;
|
|
|
18885
19371
|
exports.GenerateVideosResponse = GenerateVideosResponse;
|
|
18886
19372
|
exports.GoogleGenAI = GoogleGenAI;
|
|
18887
19373
|
exports.HttpResponse = HttpResponse;
|
|
19374
|
+
exports.InlinedEmbedContentResponse = InlinedEmbedContentResponse;
|
|
18888
19375
|
exports.InlinedResponse = InlinedResponse;
|
|
18889
19376
|
exports.ListBatchJobsResponse = ListBatchJobsResponse;
|
|
18890
19377
|
exports.ListCachedContentsResponse = ListCachedContentsResponse;
|
|
@@ -18905,6 +19392,7 @@ exports.RecontextImageResponse = RecontextImageResponse;
|
|
|
18905
19392
|
exports.ReplayResponse = ReplayResponse;
|
|
18906
19393
|
exports.SegmentImageResponse = SegmentImageResponse;
|
|
18907
19394
|
exports.Session = Session;
|
|
19395
|
+
exports.SingleEmbedContentResponse = SingleEmbedContentResponse;
|
|
18908
19396
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
18909
19397
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
18910
19398
|
exports.Tokens = Tokens;
|