@google/genai 1.2.0 → 1.4.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/README.md +42 -1
- package/dist/genai.d.ts +141 -24
- package/dist/index.cjs +1115 -157
- package/dist/index.mjs +1115 -158
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +1120 -158
- package/dist/node/index.mjs +1120 -159
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +141 -24
- package/dist/web/index.mjs +1115 -158
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +141 -24
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -219,7 +219,6 @@ function getValueByPath(data, keys) {
|
|
|
219
219
|
* Copyright 2025 Google LLC
|
|
220
220
|
* SPDX-License-Identifier: Apache-2.0
|
|
221
221
|
*/
|
|
222
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
223
222
|
/** Required. Outcome of the code execution. */
|
|
224
223
|
exports.Outcome = void 0;
|
|
225
224
|
(function (Outcome) {
|
|
@@ -455,6 +454,10 @@ exports.FinishReason = void 0;
|
|
|
455
454
|
* Token generation stopped because generated images have safety violations.
|
|
456
455
|
*/
|
|
457
456
|
FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
457
|
+
/**
|
|
458
|
+
* The tool call generated by the model is invalid.
|
|
459
|
+
*/
|
|
460
|
+
FinishReason["UNEXPECTED_TOOL_CALL"] = "UNEXPECTED_TOOL_CALL";
|
|
458
461
|
})(exports.FinishReason || (exports.FinishReason = {}));
|
|
459
462
|
/** Output only. Harm probability levels in the content. */
|
|
460
463
|
exports.HarmProbability = void 0;
|
|
@@ -1448,7 +1451,6 @@ class ReplayResponse {
|
|
|
1448
1451
|
*/
|
|
1449
1452
|
class RawReferenceImage {
|
|
1450
1453
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1451
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1452
1454
|
toReferenceImageAPI() {
|
|
1453
1455
|
const referenceImageAPI = {
|
|
1454
1456
|
referenceType: 'REFERENCE_TYPE_RAW',
|
|
@@ -1470,7 +1472,6 @@ class RawReferenceImage {
|
|
|
1470
1472
|
*/
|
|
1471
1473
|
class MaskReferenceImage {
|
|
1472
1474
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1473
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1474
1475
|
toReferenceImageAPI() {
|
|
1475
1476
|
const referenceImageAPI = {
|
|
1476
1477
|
referenceType: 'REFERENCE_TYPE_MASK',
|
|
@@ -1493,7 +1494,6 @@ class MaskReferenceImage {
|
|
|
1493
1494
|
*/
|
|
1494
1495
|
class ControlReferenceImage {
|
|
1495
1496
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1496
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1497
1497
|
toReferenceImageAPI() {
|
|
1498
1498
|
const referenceImageAPI = {
|
|
1499
1499
|
referenceType: 'REFERENCE_TYPE_CONTROL',
|
|
@@ -1514,7 +1514,6 @@ class ControlReferenceImage {
|
|
|
1514
1514
|
*/
|
|
1515
1515
|
class StyleReferenceImage {
|
|
1516
1516
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1517
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1518
1517
|
toReferenceImageAPI() {
|
|
1519
1518
|
const referenceImageAPI = {
|
|
1520
1519
|
referenceType: 'REFERENCE_TYPE_STYLE',
|
|
@@ -1535,7 +1534,6 @@ class StyleReferenceImage {
|
|
|
1535
1534
|
*/
|
|
1536
1535
|
class SubjectReferenceImage {
|
|
1537
1536
|
/* Internal method to convert to ReferenceImageAPIInternal. */
|
|
1538
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1539
1537
|
toReferenceImageAPI() {
|
|
1540
1538
|
const referenceImageAPI = {
|
|
1541
1539
|
referenceType: 'REFERENCE_TYPE_SUBJECT',
|
|
@@ -1982,16 +1980,16 @@ function flattenTypeArrayToAnyOf(typeList, resultingSchema) {
|
|
|
1982
1980
|
}
|
|
1983
1981
|
const listWithoutNull = typeList.filter((type) => type !== 'null');
|
|
1984
1982
|
if (listWithoutNull.length === 1) {
|
|
1985
|
-
resultingSchema['type'] = Object.
|
|
1986
|
-
?
|
|
1983
|
+
resultingSchema['type'] = Object.values(exports.Type).includes(listWithoutNull[0].toUpperCase())
|
|
1984
|
+
? listWithoutNull[0].toUpperCase()
|
|
1987
1985
|
: exports.Type.TYPE_UNSPECIFIED;
|
|
1988
1986
|
}
|
|
1989
1987
|
else {
|
|
1990
1988
|
resultingSchema['anyOf'] = [];
|
|
1991
1989
|
for (const i of listWithoutNull) {
|
|
1992
1990
|
resultingSchema['anyOf'].push({
|
|
1993
|
-
'type': Object.
|
|
1994
|
-
?
|
|
1991
|
+
'type': Object.values(exports.Type).includes(i.toUpperCase())
|
|
1992
|
+
? i.toUpperCase()
|
|
1995
1993
|
: exports.Type.TYPE_UNSPECIFIED,
|
|
1996
1994
|
});
|
|
1997
1995
|
}
|
|
@@ -2075,7 +2073,7 @@ function processJsonSchema(_jsonSchema) {
|
|
|
2075
2073
|
// beginning of this function.
|
|
2076
2074
|
continue;
|
|
2077
2075
|
}
|
|
2078
|
-
genAISchema['type'] = Object.
|
|
2076
|
+
genAISchema['type'] = Object.values(exports.Type).includes(fieldValue.toUpperCase())
|
|
2079
2077
|
? fieldValue.toUpperCase()
|
|
2080
2078
|
: exports.Type.TYPE_UNSPECIFIED;
|
|
2081
2079
|
}
|
|
@@ -2434,7 +2432,7 @@ function filterToJsonSchema(schema) {
|
|
|
2434
2432
|
}
|
|
2435
2433
|
else if (fieldName === 'type') {
|
|
2436
2434
|
const typeValue = fieldValue.toUpperCase();
|
|
2437
|
-
filteredSchema[fieldName] = Object.
|
|
2435
|
+
filteredSchema[fieldName] = Object.values(exports.Type).includes(typeValue)
|
|
2438
2436
|
? typeValue
|
|
2439
2437
|
: exports.Type.TYPE_UNSPECIFIED;
|
|
2440
2438
|
}
|
|
@@ -2450,7 +2448,7 @@ function filterToJsonSchema(schema) {
|
|
|
2450
2448
|
* Copyright 2025 Google LLC
|
|
2451
2449
|
* SPDX-License-Identifier: Apache-2.0
|
|
2452
2450
|
*/
|
|
2453
|
-
function videoMetadataToMldev$
|
|
2451
|
+
function videoMetadataToMldev$3(apiClient, fromObject) {
|
|
2454
2452
|
const toObject = {};
|
|
2455
2453
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
2456
2454
|
if (fromFps != null) {
|
|
@@ -2466,7 +2464,7 @@ function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
|
2466
2464
|
}
|
|
2467
2465
|
return toObject;
|
|
2468
2466
|
}
|
|
2469
|
-
function blobToMldev$
|
|
2467
|
+
function blobToMldev$3(apiClient, fromObject) {
|
|
2470
2468
|
const toObject = {};
|
|
2471
2469
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2472
2470
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2481,7 +2479,7 @@ function blobToMldev$2(apiClient, fromObject) {
|
|
|
2481
2479
|
}
|
|
2482
2480
|
return toObject;
|
|
2483
2481
|
}
|
|
2484
|
-
function fileDataToMldev$
|
|
2482
|
+
function fileDataToMldev$3(apiClient, fromObject) {
|
|
2485
2483
|
const toObject = {};
|
|
2486
2484
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2487
2485
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2496,13 +2494,13 @@ function fileDataToMldev$2(apiClient, fromObject) {
|
|
|
2496
2494
|
}
|
|
2497
2495
|
return toObject;
|
|
2498
2496
|
}
|
|
2499
|
-
function partToMldev$
|
|
2497
|
+
function partToMldev$3(apiClient, fromObject) {
|
|
2500
2498
|
const toObject = {};
|
|
2501
2499
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
2502
2500
|
'videoMetadata',
|
|
2503
2501
|
]);
|
|
2504
2502
|
if (fromVideoMetadata != null) {
|
|
2505
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
2503
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$3(apiClient, fromVideoMetadata));
|
|
2506
2504
|
}
|
|
2507
2505
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
2508
2506
|
if (fromThought != null) {
|
|
@@ -2510,11 +2508,17 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2510
2508
|
}
|
|
2511
2509
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
2512
2510
|
if (fromInlineData != null) {
|
|
2513
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
2511
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$3(apiClient, fromInlineData));
|
|
2514
2512
|
}
|
|
2515
2513
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
2516
2514
|
if (fromFileData != null) {
|
|
2517
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
2515
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$3(apiClient, fromFileData));
|
|
2516
|
+
}
|
|
2517
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2518
|
+
'thoughtSignature',
|
|
2519
|
+
]);
|
|
2520
|
+
if (fromThoughtSignature != null) {
|
|
2521
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2518
2522
|
}
|
|
2519
2523
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2520
2524
|
'codeExecutionResult',
|
|
@@ -2544,14 +2548,14 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2544
2548
|
}
|
|
2545
2549
|
return toObject;
|
|
2546
2550
|
}
|
|
2547
|
-
function contentToMldev$
|
|
2551
|
+
function contentToMldev$3(apiClient, fromObject) {
|
|
2548
2552
|
const toObject = {};
|
|
2549
2553
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2550
2554
|
if (fromParts != null) {
|
|
2551
2555
|
let transformedList = fromParts;
|
|
2552
2556
|
if (Array.isArray(transformedList)) {
|
|
2553
2557
|
transformedList = transformedList.map((item) => {
|
|
2554
|
-
return partToMldev$
|
|
2558
|
+
return partToMldev$3(apiClient, item);
|
|
2555
2559
|
});
|
|
2556
2560
|
}
|
|
2557
2561
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -2562,7 +2566,7 @@ function contentToMldev$2(apiClient, fromObject) {
|
|
|
2562
2566
|
}
|
|
2563
2567
|
return toObject;
|
|
2564
2568
|
}
|
|
2565
|
-
function functionDeclarationToMldev$
|
|
2569
|
+
function functionDeclarationToMldev$3(apiClient, fromObject) {
|
|
2566
2570
|
const toObject = {};
|
|
2567
2571
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
2568
2572
|
if (fromBehavior != null) {
|
|
@@ -2586,7 +2590,7 @@ function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
|
2586
2590
|
}
|
|
2587
2591
|
return toObject;
|
|
2588
2592
|
}
|
|
2589
|
-
function intervalToMldev$
|
|
2593
|
+
function intervalToMldev$3(apiClient, fromObject) {
|
|
2590
2594
|
const toObject = {};
|
|
2591
2595
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
2592
2596
|
if (fromStartTime != null) {
|
|
@@ -2598,17 +2602,17 @@ function intervalToMldev$2(apiClient, fromObject) {
|
|
|
2598
2602
|
}
|
|
2599
2603
|
return toObject;
|
|
2600
2604
|
}
|
|
2601
|
-
function googleSearchToMldev$
|
|
2605
|
+
function googleSearchToMldev$3(apiClient, fromObject) {
|
|
2602
2606
|
const toObject = {};
|
|
2603
2607
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
2604
2608
|
'timeRangeFilter',
|
|
2605
2609
|
]);
|
|
2606
2610
|
if (fromTimeRangeFilter != null) {
|
|
2607
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
2611
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(apiClient, fromTimeRangeFilter));
|
|
2608
2612
|
}
|
|
2609
2613
|
return toObject;
|
|
2610
2614
|
}
|
|
2611
|
-
function dynamicRetrievalConfigToMldev$
|
|
2615
|
+
function dynamicRetrievalConfigToMldev$3(apiClient, fromObject) {
|
|
2612
2616
|
const toObject = {};
|
|
2613
2617
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2614
2618
|
if (fromMode != null) {
|
|
@@ -2622,21 +2626,21 @@ function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
|
2622
2626
|
}
|
|
2623
2627
|
return toObject;
|
|
2624
2628
|
}
|
|
2625
|
-
function googleSearchRetrievalToMldev$
|
|
2629
|
+
function googleSearchRetrievalToMldev$3(apiClient, fromObject) {
|
|
2626
2630
|
const toObject = {};
|
|
2627
2631
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
2628
2632
|
'dynamicRetrievalConfig',
|
|
2629
2633
|
]);
|
|
2630
2634
|
if (fromDynamicRetrievalConfig != null) {
|
|
2631
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
2635
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$3(apiClient, fromDynamicRetrievalConfig));
|
|
2632
2636
|
}
|
|
2633
2637
|
return toObject;
|
|
2634
2638
|
}
|
|
2635
|
-
function urlContextToMldev$
|
|
2639
|
+
function urlContextToMldev$3() {
|
|
2636
2640
|
const toObject = {};
|
|
2637
2641
|
return toObject;
|
|
2638
2642
|
}
|
|
2639
|
-
function toolToMldev$
|
|
2643
|
+
function toolToMldev$3(apiClient, fromObject) {
|
|
2640
2644
|
const toObject = {};
|
|
2641
2645
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
2642
2646
|
'functionDeclarations',
|
|
@@ -2645,7 +2649,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2645
2649
|
let transformedList = fromFunctionDeclarations;
|
|
2646
2650
|
if (Array.isArray(transformedList)) {
|
|
2647
2651
|
transformedList = transformedList.map((item) => {
|
|
2648
|
-
return functionDeclarationToMldev$
|
|
2652
|
+
return functionDeclarationToMldev$3(apiClient, item);
|
|
2649
2653
|
});
|
|
2650
2654
|
}
|
|
2651
2655
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -2655,13 +2659,13 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2655
2659
|
}
|
|
2656
2660
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
2657
2661
|
if (fromGoogleSearch != null) {
|
|
2658
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
2662
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(apiClient, fromGoogleSearch));
|
|
2659
2663
|
}
|
|
2660
2664
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
2661
2665
|
'googleSearchRetrieval',
|
|
2662
2666
|
]);
|
|
2663
2667
|
if (fromGoogleSearchRetrieval != null) {
|
|
2664
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
2668
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$3(apiClient, fromGoogleSearchRetrieval));
|
|
2665
2669
|
}
|
|
2666
2670
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
2667
2671
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -2671,7 +2675,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2671
2675
|
}
|
|
2672
2676
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
2673
2677
|
if (fromUrlContext != null) {
|
|
2674
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
2678
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
|
|
2675
2679
|
}
|
|
2676
2680
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
2677
2681
|
'codeExecution',
|
|
@@ -2754,7 +2758,7 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2754
2758
|
let transformedList = tContents(apiClient, fromContents);
|
|
2755
2759
|
if (Array.isArray(transformedList)) {
|
|
2756
2760
|
transformedList = transformedList.map((item) => {
|
|
2757
|
-
return contentToMldev$
|
|
2761
|
+
return contentToMldev$3(apiClient, item);
|
|
2758
2762
|
});
|
|
2759
2763
|
}
|
|
2760
2764
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -2763,14 +2767,14 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2763
2767
|
'systemInstruction',
|
|
2764
2768
|
]);
|
|
2765
2769
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
2766
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$
|
|
2770
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$3(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
2767
2771
|
}
|
|
2768
2772
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
2769
2773
|
if (parentObject !== undefined && fromTools != null) {
|
|
2770
2774
|
let transformedList = fromTools;
|
|
2771
2775
|
if (Array.isArray(transformedList)) {
|
|
2772
2776
|
transformedList = transformedList.map((item) => {
|
|
2773
|
-
return toolToMldev$
|
|
2777
|
+
return toolToMldev$3(apiClient, item);
|
|
2774
2778
|
});
|
|
2775
2779
|
}
|
|
2776
2780
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -2932,6 +2936,12 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
2932
2936
|
if (fromFileData != null) {
|
|
2933
2937
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$2(apiClient, fromFileData));
|
|
2934
2938
|
}
|
|
2939
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2940
|
+
'thoughtSignature',
|
|
2941
|
+
]);
|
|
2942
|
+
if (fromThoughtSignature != null) {
|
|
2943
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2944
|
+
}
|
|
2935
2945
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2936
2946
|
'codeExecutionResult',
|
|
2937
2947
|
]);
|
|
@@ -3099,6 +3109,10 @@ function googleMapsToVertex$2(apiClient, fromObject) {
|
|
|
3099
3109
|
}
|
|
3100
3110
|
return toObject;
|
|
3101
3111
|
}
|
|
3112
|
+
function urlContextToVertex$2() {
|
|
3113
|
+
const toObject = {};
|
|
3114
|
+
return toObject;
|
|
3115
|
+
}
|
|
3102
3116
|
function toolToVertex$2(apiClient, fromObject) {
|
|
3103
3117
|
const toObject = {};
|
|
3104
3118
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -3137,8 +3151,9 @@ function toolToVertex$2(apiClient, fromObject) {
|
|
|
3137
3151
|
if (fromGoogleMaps != null) {
|
|
3138
3152
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$2(apiClient, fromGoogleMaps));
|
|
3139
3153
|
}
|
|
3140
|
-
|
|
3141
|
-
|
|
3154
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
3155
|
+
if (fromUrlContext != null) {
|
|
3156
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
|
|
3142
3157
|
}
|
|
3143
3158
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3144
3159
|
'codeExecution',
|
|
@@ -4910,7 +4925,7 @@ class Files extends BaseModule {
|
|
|
4910
4925
|
* Copyright 2025 Google LLC
|
|
4911
4926
|
* SPDX-License-Identifier: Apache-2.0
|
|
4912
4927
|
*/
|
|
4913
|
-
function prebuiltVoiceConfigToMldev$
|
|
4928
|
+
function prebuiltVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4914
4929
|
const toObject = {};
|
|
4915
4930
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
4916
4931
|
if (fromVoiceName != null) {
|
|
@@ -4926,13 +4941,13 @@ function prebuiltVoiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
4926
4941
|
}
|
|
4927
4942
|
return toObject;
|
|
4928
4943
|
}
|
|
4929
|
-
function voiceConfigToMldev$
|
|
4944
|
+
function voiceConfigToMldev$2(apiClient, fromObject) {
|
|
4930
4945
|
const toObject = {};
|
|
4931
4946
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
4932
4947
|
'prebuiltVoiceConfig',
|
|
4933
4948
|
]);
|
|
4934
4949
|
if (fromPrebuiltVoiceConfig != null) {
|
|
4935
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$
|
|
4950
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$2(apiClient, fromPrebuiltVoiceConfig));
|
|
4936
4951
|
}
|
|
4937
4952
|
return toObject;
|
|
4938
4953
|
}
|
|
@@ -4946,7 +4961,7 @@ function voiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
4946
4961
|
}
|
|
4947
4962
|
return toObject;
|
|
4948
4963
|
}
|
|
4949
|
-
function speakerVoiceConfigToMldev$
|
|
4964
|
+
function speakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4950
4965
|
const toObject = {};
|
|
4951
4966
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
4952
4967
|
if (fromSpeaker != null) {
|
|
@@ -4954,11 +4969,11 @@ function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
4954
4969
|
}
|
|
4955
4970
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
4956
4971
|
if (fromVoiceConfig != null) {
|
|
4957
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
4972
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
4958
4973
|
}
|
|
4959
4974
|
return toObject;
|
|
4960
4975
|
}
|
|
4961
|
-
function multiSpeakerVoiceConfigToMldev$
|
|
4976
|
+
function multiSpeakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4962
4977
|
const toObject = {};
|
|
4963
4978
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
4964
4979
|
'speakerVoiceConfigs',
|
|
@@ -4967,24 +4982,24 @@ function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
4967
4982
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
4968
4983
|
if (Array.isArray(transformedList)) {
|
|
4969
4984
|
transformedList = transformedList.map((item) => {
|
|
4970
|
-
return speakerVoiceConfigToMldev$
|
|
4985
|
+
return speakerVoiceConfigToMldev$2(apiClient, item);
|
|
4971
4986
|
});
|
|
4972
4987
|
}
|
|
4973
4988
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
4974
4989
|
}
|
|
4975
4990
|
return toObject;
|
|
4976
4991
|
}
|
|
4977
|
-
function speechConfigToMldev$
|
|
4992
|
+
function speechConfigToMldev$2(apiClient, fromObject) {
|
|
4978
4993
|
const toObject = {};
|
|
4979
4994
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
4980
4995
|
if (fromVoiceConfig != null) {
|
|
4981
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
4996
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
4982
4997
|
}
|
|
4983
4998
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
4984
4999
|
'multiSpeakerVoiceConfig',
|
|
4985
5000
|
]);
|
|
4986
5001
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
4987
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$
|
|
5002
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$2(apiClient, fromMultiSpeakerVoiceConfig));
|
|
4988
5003
|
}
|
|
4989
5004
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
4990
5005
|
if (fromLanguageCode != null) {
|
|
@@ -5007,7 +5022,7 @@ function speechConfigToVertex$1(apiClient, fromObject) {
|
|
|
5007
5022
|
}
|
|
5008
5023
|
return toObject;
|
|
5009
5024
|
}
|
|
5010
|
-
function videoMetadataToMldev$
|
|
5025
|
+
function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
5011
5026
|
const toObject = {};
|
|
5012
5027
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
5013
5028
|
if (fromFps != null) {
|
|
@@ -5039,7 +5054,7 @@ function videoMetadataToVertex$1(apiClient, fromObject) {
|
|
|
5039
5054
|
}
|
|
5040
5055
|
return toObject;
|
|
5041
5056
|
}
|
|
5042
|
-
function blobToMldev$
|
|
5057
|
+
function blobToMldev$2(apiClient, fromObject) {
|
|
5043
5058
|
const toObject = {};
|
|
5044
5059
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5045
5060
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5070,7 +5085,7 @@ function blobToVertex$1(apiClient, fromObject) {
|
|
|
5070
5085
|
}
|
|
5071
5086
|
return toObject;
|
|
5072
5087
|
}
|
|
5073
|
-
function fileDataToMldev$
|
|
5088
|
+
function fileDataToMldev$2(apiClient, fromObject) {
|
|
5074
5089
|
const toObject = {};
|
|
5075
5090
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5076
5091
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5101,13 +5116,13 @@ function fileDataToVertex$1(apiClient, fromObject) {
|
|
|
5101
5116
|
}
|
|
5102
5117
|
return toObject;
|
|
5103
5118
|
}
|
|
5104
|
-
function partToMldev$
|
|
5119
|
+
function partToMldev$2(apiClient, fromObject) {
|
|
5105
5120
|
const toObject = {};
|
|
5106
5121
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
5107
5122
|
'videoMetadata',
|
|
5108
5123
|
]);
|
|
5109
5124
|
if (fromVideoMetadata != null) {
|
|
5110
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
5125
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$2(apiClient, fromVideoMetadata));
|
|
5111
5126
|
}
|
|
5112
5127
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
5113
5128
|
if (fromThought != null) {
|
|
@@ -5115,11 +5130,17 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
5115
5130
|
}
|
|
5116
5131
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5117
5132
|
if (fromInlineData != null) {
|
|
5118
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
5133
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
5119
5134
|
}
|
|
5120
5135
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
5121
5136
|
if (fromFileData != null) {
|
|
5122
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
5137
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
|
|
5138
|
+
}
|
|
5139
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5140
|
+
'thoughtSignature',
|
|
5141
|
+
]);
|
|
5142
|
+
if (fromThoughtSignature != null) {
|
|
5143
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5123
5144
|
}
|
|
5124
5145
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5125
5146
|
'codeExecutionResult',
|
|
@@ -5169,6 +5190,12 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5169
5190
|
if (fromFileData != null) {
|
|
5170
5191
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
|
|
5171
5192
|
}
|
|
5193
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5194
|
+
'thoughtSignature',
|
|
5195
|
+
]);
|
|
5196
|
+
if (fromThoughtSignature != null) {
|
|
5197
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5198
|
+
}
|
|
5172
5199
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5173
5200
|
'codeExecutionResult',
|
|
5174
5201
|
]);
|
|
@@ -5197,14 +5224,14 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5197
5224
|
}
|
|
5198
5225
|
return toObject;
|
|
5199
5226
|
}
|
|
5200
|
-
function contentToMldev$
|
|
5227
|
+
function contentToMldev$2(apiClient, fromObject) {
|
|
5201
5228
|
const toObject = {};
|
|
5202
5229
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5203
5230
|
if (fromParts != null) {
|
|
5204
5231
|
let transformedList = fromParts;
|
|
5205
5232
|
if (Array.isArray(transformedList)) {
|
|
5206
5233
|
transformedList = transformedList.map((item) => {
|
|
5207
|
-
return partToMldev$
|
|
5234
|
+
return partToMldev$2(apiClient, item);
|
|
5208
5235
|
});
|
|
5209
5236
|
}
|
|
5210
5237
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5233,7 +5260,7 @@ function contentToVertex$1(apiClient, fromObject) {
|
|
|
5233
5260
|
}
|
|
5234
5261
|
return toObject;
|
|
5235
5262
|
}
|
|
5236
|
-
function functionDeclarationToMldev$
|
|
5263
|
+
function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
5237
5264
|
const toObject = {};
|
|
5238
5265
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
5239
5266
|
if (fromBehavior != null) {
|
|
@@ -5280,7 +5307,7 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
|
5280
5307
|
}
|
|
5281
5308
|
return toObject;
|
|
5282
5309
|
}
|
|
5283
|
-
function intervalToMldev$
|
|
5310
|
+
function intervalToMldev$2(apiClient, fromObject) {
|
|
5284
5311
|
const toObject = {};
|
|
5285
5312
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
5286
5313
|
if (fromStartTime != null) {
|
|
@@ -5304,13 +5331,13 @@ function intervalToVertex$1(apiClient, fromObject) {
|
|
|
5304
5331
|
}
|
|
5305
5332
|
return toObject;
|
|
5306
5333
|
}
|
|
5307
|
-
function googleSearchToMldev$
|
|
5334
|
+
function googleSearchToMldev$2(apiClient, fromObject) {
|
|
5308
5335
|
const toObject = {};
|
|
5309
5336
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
5310
5337
|
'timeRangeFilter',
|
|
5311
5338
|
]);
|
|
5312
5339
|
if (fromTimeRangeFilter != null) {
|
|
5313
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
5340
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(apiClient, fromTimeRangeFilter));
|
|
5314
5341
|
}
|
|
5315
5342
|
return toObject;
|
|
5316
5343
|
}
|
|
@@ -5324,7 +5351,7 @@ function googleSearchToVertex$1(apiClient, fromObject) {
|
|
|
5324
5351
|
}
|
|
5325
5352
|
return toObject;
|
|
5326
5353
|
}
|
|
5327
|
-
function dynamicRetrievalConfigToMldev$
|
|
5354
|
+
function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
5328
5355
|
const toObject = {};
|
|
5329
5356
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5330
5357
|
if (fromMode != null) {
|
|
@@ -5352,13 +5379,13 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
|
5352
5379
|
}
|
|
5353
5380
|
return toObject;
|
|
5354
5381
|
}
|
|
5355
|
-
function googleSearchRetrievalToMldev$
|
|
5382
|
+
function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
|
|
5356
5383
|
const toObject = {};
|
|
5357
5384
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
5358
5385
|
'dynamicRetrievalConfig',
|
|
5359
5386
|
]);
|
|
5360
5387
|
if (fromDynamicRetrievalConfig != null) {
|
|
5361
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
5388
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
|
|
5362
5389
|
}
|
|
5363
5390
|
return toObject;
|
|
5364
5391
|
}
|
|
@@ -5424,11 +5451,15 @@ function googleMapsToVertex$1(apiClient, fromObject) {
|
|
|
5424
5451
|
}
|
|
5425
5452
|
return toObject;
|
|
5426
5453
|
}
|
|
5427
|
-
function urlContextToMldev$
|
|
5454
|
+
function urlContextToMldev$2() {
|
|
5428
5455
|
const toObject = {};
|
|
5429
5456
|
return toObject;
|
|
5430
5457
|
}
|
|
5431
|
-
function
|
|
5458
|
+
function urlContextToVertex$1() {
|
|
5459
|
+
const toObject = {};
|
|
5460
|
+
return toObject;
|
|
5461
|
+
}
|
|
5462
|
+
function toolToMldev$2(apiClient, fromObject) {
|
|
5432
5463
|
const toObject = {};
|
|
5433
5464
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5434
5465
|
'functionDeclarations',
|
|
@@ -5437,7 +5468,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5437
5468
|
let transformedList = fromFunctionDeclarations;
|
|
5438
5469
|
if (Array.isArray(transformedList)) {
|
|
5439
5470
|
transformedList = transformedList.map((item) => {
|
|
5440
|
-
return functionDeclarationToMldev$
|
|
5471
|
+
return functionDeclarationToMldev$2(apiClient, item);
|
|
5441
5472
|
});
|
|
5442
5473
|
}
|
|
5443
5474
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -5447,13 +5478,13 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5447
5478
|
}
|
|
5448
5479
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5449
5480
|
if (fromGoogleSearch != null) {
|
|
5450
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
5481
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(apiClient, fromGoogleSearch));
|
|
5451
5482
|
}
|
|
5452
5483
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5453
5484
|
'googleSearchRetrieval',
|
|
5454
5485
|
]);
|
|
5455
5486
|
if (fromGoogleSearchRetrieval != null) {
|
|
5456
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
5487
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
|
|
5457
5488
|
}
|
|
5458
5489
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5459
5490
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -5463,7 +5494,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5463
5494
|
}
|
|
5464
5495
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5465
5496
|
if (fromUrlContext != null) {
|
|
5466
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
5497
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
|
|
5467
5498
|
}
|
|
5468
5499
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5469
5500
|
'codeExecution',
|
|
@@ -5511,8 +5542,9 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
5511
5542
|
if (fromGoogleMaps != null) {
|
|
5512
5543
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$1(apiClient, fromGoogleMaps));
|
|
5513
5544
|
}
|
|
5514
|
-
|
|
5515
|
-
|
|
5545
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5546
|
+
if (fromUrlContext != null) {
|
|
5547
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
|
|
5516
5548
|
}
|
|
5517
5549
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5518
5550
|
'codeExecution',
|
|
@@ -5522,7 +5554,7 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
5522
5554
|
}
|
|
5523
5555
|
return toObject;
|
|
5524
5556
|
}
|
|
5525
|
-
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
5557
|
+
function sessionResumptionConfigToMldev$1(apiClient, fromObject) {
|
|
5526
5558
|
const toObject = {};
|
|
5527
5559
|
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
5528
5560
|
if (fromHandle != null) {
|
|
@@ -5545,7 +5577,7 @@ function sessionResumptionConfigToVertex(apiClient, fromObject) {
|
|
|
5545
5577
|
}
|
|
5546
5578
|
return toObject;
|
|
5547
5579
|
}
|
|
5548
|
-
function audioTranscriptionConfigToMldev() {
|
|
5580
|
+
function audioTranscriptionConfigToMldev$1() {
|
|
5549
5581
|
const toObject = {};
|
|
5550
5582
|
return toObject;
|
|
5551
5583
|
}
|
|
@@ -5553,7 +5585,7 @@ function audioTranscriptionConfigToVertex() {
|
|
|
5553
5585
|
const toObject = {};
|
|
5554
5586
|
return toObject;
|
|
5555
5587
|
}
|
|
5556
|
-
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
5588
|
+
function automaticActivityDetectionToMldev$1(apiClient, fromObject) {
|
|
5557
5589
|
const toObject = {};
|
|
5558
5590
|
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
5559
5591
|
if (fromDisabled != null) {
|
|
@@ -5617,13 +5649,13 @@ function automaticActivityDetectionToVertex(apiClient, fromObject) {
|
|
|
5617
5649
|
}
|
|
5618
5650
|
return toObject;
|
|
5619
5651
|
}
|
|
5620
|
-
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
5652
|
+
function realtimeInputConfigToMldev$1(apiClient, fromObject) {
|
|
5621
5653
|
const toObject = {};
|
|
5622
5654
|
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
5623
5655
|
'automaticActivityDetection',
|
|
5624
5656
|
]);
|
|
5625
5657
|
if (fromAutomaticActivityDetection != null) {
|
|
5626
|
-
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
5658
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev$1(apiClient, fromAutomaticActivityDetection));
|
|
5627
5659
|
}
|
|
5628
5660
|
const fromActivityHandling = getValueByPath(fromObject, [
|
|
5629
5661
|
'activityHandling',
|
|
@@ -5657,7 +5689,7 @@ function realtimeInputConfigToVertex(apiClient, fromObject) {
|
|
|
5657
5689
|
}
|
|
5658
5690
|
return toObject;
|
|
5659
5691
|
}
|
|
5660
|
-
function slidingWindowToMldev(apiClient, fromObject) {
|
|
5692
|
+
function slidingWindowToMldev$1(apiClient, fromObject) {
|
|
5661
5693
|
const toObject = {};
|
|
5662
5694
|
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
5663
5695
|
if (fromTargetTokens != null) {
|
|
@@ -5673,7 +5705,7 @@ function slidingWindowToVertex(apiClient, fromObject) {
|
|
|
5673
5705
|
}
|
|
5674
5706
|
return toObject;
|
|
5675
5707
|
}
|
|
5676
|
-
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
5708
|
+
function contextWindowCompressionConfigToMldev$1(apiClient, fromObject) {
|
|
5677
5709
|
const toObject = {};
|
|
5678
5710
|
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
5679
5711
|
'triggerTokens',
|
|
@@ -5685,7 +5717,7 @@ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
|
5685
5717
|
'slidingWindow',
|
|
5686
5718
|
]);
|
|
5687
5719
|
if (fromSlidingWindow != null) {
|
|
5688
|
-
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
5720
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev$1(apiClient, fromSlidingWindow));
|
|
5689
5721
|
}
|
|
5690
5722
|
return toObject;
|
|
5691
5723
|
}
|
|
@@ -5705,7 +5737,7 @@ function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
|
|
|
5705
5737
|
}
|
|
5706
5738
|
return toObject;
|
|
5707
5739
|
}
|
|
5708
|
-
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
5740
|
+
function proactivityConfigToMldev$1(apiClient, fromObject) {
|
|
5709
5741
|
const toObject = {};
|
|
5710
5742
|
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
5711
5743
|
'proactiveAudio',
|
|
@@ -5725,7 +5757,7 @@ function proactivityConfigToVertex(apiClient, fromObject) {
|
|
|
5725
5757
|
}
|
|
5726
5758
|
return toObject;
|
|
5727
5759
|
}
|
|
5728
|
-
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
5760
|
+
function liveConnectConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
5729
5761
|
const toObject = {};
|
|
5730
5762
|
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
5731
5763
|
'generationConfig',
|
|
@@ -5769,7 +5801,7 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5769
5801
|
}
|
|
5770
5802
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
5771
5803
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
5772
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$
|
|
5804
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$2(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
5773
5805
|
}
|
|
5774
5806
|
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
5775
5807
|
'enableAffectiveDialog',
|
|
@@ -5781,14 +5813,14 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5781
5813
|
'systemInstruction',
|
|
5782
5814
|
]);
|
|
5783
5815
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
5784
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$
|
|
5816
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
5785
5817
|
}
|
|
5786
5818
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5787
5819
|
if (parentObject !== undefined && fromTools != null) {
|
|
5788
5820
|
let transformedList = tTools(apiClient, fromTools);
|
|
5789
5821
|
if (Array.isArray(transformedList)) {
|
|
5790
5822
|
transformedList = transformedList.map((item) => {
|
|
5791
|
-
return toolToMldev$
|
|
5823
|
+
return toolToMldev$2(apiClient, tTool(apiClient, item));
|
|
5792
5824
|
});
|
|
5793
5825
|
}
|
|
5794
5826
|
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
@@ -5797,35 +5829,35 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5797
5829
|
'sessionResumption',
|
|
5798
5830
|
]);
|
|
5799
5831
|
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
5800
|
-
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
5832
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev$1(apiClient, fromSessionResumption));
|
|
5801
5833
|
}
|
|
5802
5834
|
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
5803
5835
|
'inputAudioTranscription',
|
|
5804
5836
|
]);
|
|
5805
5837
|
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
5806
|
-
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
5838
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
5807
5839
|
}
|
|
5808
5840
|
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
5809
5841
|
'outputAudioTranscription',
|
|
5810
5842
|
]);
|
|
5811
5843
|
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
5812
|
-
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
5844
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
5813
5845
|
}
|
|
5814
5846
|
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
5815
5847
|
'realtimeInputConfig',
|
|
5816
5848
|
]);
|
|
5817
5849
|
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
5818
|
-
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
5850
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev$1(apiClient, fromRealtimeInputConfig));
|
|
5819
5851
|
}
|
|
5820
5852
|
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
5821
5853
|
'contextWindowCompression',
|
|
5822
5854
|
]);
|
|
5823
5855
|
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
5824
|
-
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
5856
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev$1(apiClient, fromContextWindowCompression));
|
|
5825
5857
|
}
|
|
5826
5858
|
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
5827
5859
|
if (parentObject !== undefined && fromProactivity != null) {
|
|
5828
|
-
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
5860
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev$1(apiClient, fromProactivity));
|
|
5829
5861
|
}
|
|
5830
5862
|
return toObject;
|
|
5831
5863
|
}
|
|
@@ -5941,7 +5973,7 @@ function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
|
5941
5973
|
}
|
|
5942
5974
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5943
5975
|
if (fromConfig != null) {
|
|
5944
|
-
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
5976
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev$1(apiClient, fromConfig, toObject));
|
|
5945
5977
|
}
|
|
5946
5978
|
return toObject;
|
|
5947
5979
|
}
|
|
@@ -6296,6 +6328,12 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
6296
6328
|
if (fromFileData != null) {
|
|
6297
6329
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
|
|
6298
6330
|
}
|
|
6331
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6332
|
+
'thoughtSignature',
|
|
6333
|
+
]);
|
|
6334
|
+
if (fromThoughtSignature != null) {
|
|
6335
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6336
|
+
}
|
|
6299
6337
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6300
6338
|
'codeExecutionResult',
|
|
6301
6339
|
]);
|
|
@@ -6344,6 +6382,12 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
6344
6382
|
if (fromFileData != null) {
|
|
6345
6383
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
|
|
6346
6384
|
}
|
|
6385
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6386
|
+
'thoughtSignature',
|
|
6387
|
+
]);
|
|
6388
|
+
if (fromThoughtSignature != null) {
|
|
6389
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6390
|
+
}
|
|
6347
6391
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6348
6392
|
'codeExecutionResult',
|
|
6349
6393
|
]);
|
|
@@ -7134,7 +7178,7 @@ function liveMusicServerMessageFromMldev(apiClient, fromObject) {
|
|
|
7134
7178
|
* Copyright 2025 Google LLC
|
|
7135
7179
|
* SPDX-License-Identifier: Apache-2.0
|
|
7136
7180
|
*/
|
|
7137
|
-
function videoMetadataToMldev(apiClient, fromObject) {
|
|
7181
|
+
function videoMetadataToMldev$1(apiClient, fromObject) {
|
|
7138
7182
|
const toObject = {};
|
|
7139
7183
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
7140
7184
|
if (fromFps != null) {
|
|
@@ -7150,7 +7194,7 @@ function videoMetadataToMldev(apiClient, fromObject) {
|
|
|
7150
7194
|
}
|
|
7151
7195
|
return toObject;
|
|
7152
7196
|
}
|
|
7153
|
-
function blobToMldev(apiClient, fromObject) {
|
|
7197
|
+
function blobToMldev$1(apiClient, fromObject) {
|
|
7154
7198
|
const toObject = {};
|
|
7155
7199
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7156
7200
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7165,7 +7209,7 @@ function blobToMldev(apiClient, fromObject) {
|
|
|
7165
7209
|
}
|
|
7166
7210
|
return toObject;
|
|
7167
7211
|
}
|
|
7168
|
-
function fileDataToMldev(apiClient, fromObject) {
|
|
7212
|
+
function fileDataToMldev$1(apiClient, fromObject) {
|
|
7169
7213
|
const toObject = {};
|
|
7170
7214
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7171
7215
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7180,13 +7224,13 @@ function fileDataToMldev(apiClient, fromObject) {
|
|
|
7180
7224
|
}
|
|
7181
7225
|
return toObject;
|
|
7182
7226
|
}
|
|
7183
|
-
function partToMldev(apiClient, fromObject) {
|
|
7227
|
+
function partToMldev$1(apiClient, fromObject) {
|
|
7184
7228
|
const toObject = {};
|
|
7185
7229
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
7186
7230
|
'videoMetadata',
|
|
7187
7231
|
]);
|
|
7188
7232
|
if (fromVideoMetadata != null) {
|
|
7189
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
7233
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$1(apiClient, fromVideoMetadata));
|
|
7190
7234
|
}
|
|
7191
7235
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
7192
7236
|
if (fromThought != null) {
|
|
@@ -7194,11 +7238,17 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7194
7238
|
}
|
|
7195
7239
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7196
7240
|
if (fromInlineData != null) {
|
|
7197
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
7241
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
7198
7242
|
}
|
|
7199
7243
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
7200
7244
|
if (fromFileData != null) {
|
|
7201
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
7245
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
|
|
7246
|
+
}
|
|
7247
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
7248
|
+
'thoughtSignature',
|
|
7249
|
+
]);
|
|
7250
|
+
if (fromThoughtSignature != null) {
|
|
7251
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7202
7252
|
}
|
|
7203
7253
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7204
7254
|
'codeExecutionResult',
|
|
@@ -7228,14 +7278,14 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7228
7278
|
}
|
|
7229
7279
|
return toObject;
|
|
7230
7280
|
}
|
|
7231
|
-
function contentToMldev(apiClient, fromObject) {
|
|
7281
|
+
function contentToMldev$1(apiClient, fromObject) {
|
|
7232
7282
|
const toObject = {};
|
|
7233
7283
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7234
7284
|
if (fromParts != null) {
|
|
7235
7285
|
let transformedList = fromParts;
|
|
7236
7286
|
if (Array.isArray(transformedList)) {
|
|
7237
7287
|
transformedList = transformedList.map((item) => {
|
|
7238
|
-
return partToMldev(apiClient, item);
|
|
7288
|
+
return partToMldev$1(apiClient, item);
|
|
7239
7289
|
});
|
|
7240
7290
|
}
|
|
7241
7291
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -7359,7 +7409,7 @@ function safetySettingToMldev(apiClient, fromObject) {
|
|
|
7359
7409
|
}
|
|
7360
7410
|
return toObject;
|
|
7361
7411
|
}
|
|
7362
|
-
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
7412
|
+
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
7363
7413
|
const toObject = {};
|
|
7364
7414
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
7365
7415
|
if (fromBehavior != null) {
|
|
@@ -7383,7 +7433,7 @@ function functionDeclarationToMldev(apiClient, fromObject) {
|
|
|
7383
7433
|
}
|
|
7384
7434
|
return toObject;
|
|
7385
7435
|
}
|
|
7386
|
-
function intervalToMldev(apiClient, fromObject) {
|
|
7436
|
+
function intervalToMldev$1(apiClient, fromObject) {
|
|
7387
7437
|
const toObject = {};
|
|
7388
7438
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
7389
7439
|
if (fromStartTime != null) {
|
|
@@ -7395,17 +7445,17 @@ function intervalToMldev(apiClient, fromObject) {
|
|
|
7395
7445
|
}
|
|
7396
7446
|
return toObject;
|
|
7397
7447
|
}
|
|
7398
|
-
function googleSearchToMldev(apiClient, fromObject) {
|
|
7448
|
+
function googleSearchToMldev$1(apiClient, fromObject) {
|
|
7399
7449
|
const toObject = {};
|
|
7400
7450
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
7401
7451
|
'timeRangeFilter',
|
|
7402
7452
|
]);
|
|
7403
7453
|
if (fromTimeRangeFilter != null) {
|
|
7404
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
7454
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(apiClient, fromTimeRangeFilter));
|
|
7405
7455
|
}
|
|
7406
7456
|
return toObject;
|
|
7407
7457
|
}
|
|
7408
|
-
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
7458
|
+
function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
7409
7459
|
const toObject = {};
|
|
7410
7460
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
7411
7461
|
if (fromMode != null) {
|
|
@@ -7419,21 +7469,21 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
|
7419
7469
|
}
|
|
7420
7470
|
return toObject;
|
|
7421
7471
|
}
|
|
7422
|
-
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
7472
|
+
function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
7423
7473
|
const toObject = {};
|
|
7424
7474
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
7425
7475
|
'dynamicRetrievalConfig',
|
|
7426
7476
|
]);
|
|
7427
7477
|
if (fromDynamicRetrievalConfig != null) {
|
|
7428
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
7478
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
|
|
7429
7479
|
}
|
|
7430
7480
|
return toObject;
|
|
7431
7481
|
}
|
|
7432
|
-
function urlContextToMldev() {
|
|
7482
|
+
function urlContextToMldev$1() {
|
|
7433
7483
|
const toObject = {};
|
|
7434
7484
|
return toObject;
|
|
7435
7485
|
}
|
|
7436
|
-
function toolToMldev(apiClient, fromObject) {
|
|
7486
|
+
function toolToMldev$1(apiClient, fromObject) {
|
|
7437
7487
|
const toObject = {};
|
|
7438
7488
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7439
7489
|
'functionDeclarations',
|
|
@@ -7442,7 +7492,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7442
7492
|
let transformedList = fromFunctionDeclarations;
|
|
7443
7493
|
if (Array.isArray(transformedList)) {
|
|
7444
7494
|
transformedList = transformedList.map((item) => {
|
|
7445
|
-
return functionDeclarationToMldev(apiClient, item);
|
|
7495
|
+
return functionDeclarationToMldev$1(apiClient, item);
|
|
7446
7496
|
});
|
|
7447
7497
|
}
|
|
7448
7498
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -7452,13 +7502,13 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7452
7502
|
}
|
|
7453
7503
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
7454
7504
|
if (fromGoogleSearch != null) {
|
|
7455
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
7505
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(apiClient, fromGoogleSearch));
|
|
7456
7506
|
}
|
|
7457
7507
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7458
7508
|
'googleSearchRetrieval',
|
|
7459
7509
|
]);
|
|
7460
7510
|
if (fromGoogleSearchRetrieval != null) {
|
|
7461
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
7511
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
|
|
7462
7512
|
}
|
|
7463
7513
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
7464
7514
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -7468,7 +7518,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7468
7518
|
}
|
|
7469
7519
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
7470
7520
|
if (fromUrlContext != null) {
|
|
7471
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
7521
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
|
|
7472
7522
|
}
|
|
7473
7523
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
7474
7524
|
'codeExecution',
|
|
@@ -7532,7 +7582,7 @@ function toolConfigToMldev(apiClient, fromObject) {
|
|
|
7532
7582
|
}
|
|
7533
7583
|
return toObject;
|
|
7534
7584
|
}
|
|
7535
|
-
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
7585
|
+
function prebuiltVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7536
7586
|
const toObject = {};
|
|
7537
7587
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
7538
7588
|
if (fromVoiceName != null) {
|
|
@@ -7540,17 +7590,17 @@ function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7540
7590
|
}
|
|
7541
7591
|
return toObject;
|
|
7542
7592
|
}
|
|
7543
|
-
function voiceConfigToMldev(apiClient, fromObject) {
|
|
7593
|
+
function voiceConfigToMldev$1(apiClient, fromObject) {
|
|
7544
7594
|
const toObject = {};
|
|
7545
7595
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
7546
7596
|
'prebuiltVoiceConfig',
|
|
7547
7597
|
]);
|
|
7548
7598
|
if (fromPrebuiltVoiceConfig != null) {
|
|
7549
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
7599
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$1(apiClient, fromPrebuiltVoiceConfig));
|
|
7550
7600
|
}
|
|
7551
7601
|
return toObject;
|
|
7552
7602
|
}
|
|
7553
|
-
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
7603
|
+
function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7554
7604
|
const toObject = {};
|
|
7555
7605
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
7556
7606
|
if (fromSpeaker != null) {
|
|
@@ -7558,11 +7608,11 @@ function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7558
7608
|
}
|
|
7559
7609
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7560
7610
|
if (fromVoiceConfig != null) {
|
|
7561
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
7611
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
7562
7612
|
}
|
|
7563
7613
|
return toObject;
|
|
7564
7614
|
}
|
|
7565
|
-
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
7615
|
+
function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7566
7616
|
const toObject = {};
|
|
7567
7617
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
7568
7618
|
'speakerVoiceConfigs',
|
|
@@ -7571,24 +7621,24 @@ function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7571
7621
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
7572
7622
|
if (Array.isArray(transformedList)) {
|
|
7573
7623
|
transformedList = transformedList.map((item) => {
|
|
7574
|
-
return speakerVoiceConfigToMldev(apiClient, item);
|
|
7624
|
+
return speakerVoiceConfigToMldev$1(apiClient, item);
|
|
7575
7625
|
});
|
|
7576
7626
|
}
|
|
7577
7627
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
7578
7628
|
}
|
|
7579
7629
|
return toObject;
|
|
7580
7630
|
}
|
|
7581
|
-
function speechConfigToMldev(apiClient, fromObject) {
|
|
7631
|
+
function speechConfigToMldev$1(apiClient, fromObject) {
|
|
7582
7632
|
const toObject = {};
|
|
7583
7633
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7584
7634
|
if (fromVoiceConfig != null) {
|
|
7585
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
7635
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
7586
7636
|
}
|
|
7587
7637
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
7588
7638
|
'multiSpeakerVoiceConfig',
|
|
7589
7639
|
]);
|
|
7590
7640
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
7591
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
7641
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$1(apiClient, fromMultiSpeakerVoiceConfig));
|
|
7592
7642
|
}
|
|
7593
7643
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
7594
7644
|
if (fromLanguageCode != null) {
|
|
@@ -7618,7 +7668,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7618
7668
|
'systemInstruction',
|
|
7619
7669
|
]);
|
|
7620
7670
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
7621
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
7671
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
7622
7672
|
}
|
|
7623
7673
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
7624
7674
|
if (fromTemperature != null) {
|
|
@@ -7711,7 +7761,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7711
7761
|
let transformedList = tTools(apiClient, fromTools);
|
|
7712
7762
|
if (Array.isArray(transformedList)) {
|
|
7713
7763
|
transformedList = transformedList.map((item) => {
|
|
7714
|
-
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
7764
|
+
return toolToMldev$1(apiClient, tTool(apiClient, item));
|
|
7715
7765
|
});
|
|
7716
7766
|
}
|
|
7717
7767
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -7743,7 +7793,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7743
7793
|
}
|
|
7744
7794
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
7745
7795
|
if (fromSpeechConfig != null) {
|
|
7746
|
-
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
7796
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$1(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
7747
7797
|
}
|
|
7748
7798
|
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
7749
7799
|
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
@@ -7767,7 +7817,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
|
|
|
7767
7817
|
let transformedList = tContents(apiClient, fromContents);
|
|
7768
7818
|
if (Array.isArray(transformedList)) {
|
|
7769
7819
|
transformedList = transformedList.map((item) => {
|
|
7770
|
-
return contentToMldev(apiClient, item);
|
|
7820
|
+
return contentToMldev$1(apiClient, item);
|
|
7771
7821
|
});
|
|
7772
7822
|
}
|
|
7773
7823
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8019,7 +8069,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
|
|
|
8019
8069
|
let transformedList = tContents(apiClient, fromContents);
|
|
8020
8070
|
if (Array.isArray(transformedList)) {
|
|
8021
8071
|
transformedList = transformedList.map((item) => {
|
|
8022
|
-
return contentToMldev(apiClient, item);
|
|
8072
|
+
return contentToMldev$1(apiClient, item);
|
|
8023
8073
|
});
|
|
8024
8074
|
}
|
|
8025
8075
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8090,8 +8140,11 @@ function generateVideosConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8090
8140
|
if (parentObject !== undefined && fromNegativePrompt != null) {
|
|
8091
8141
|
setValueByPath(parentObject, ['parameters', 'negativePrompt'], fromNegativePrompt);
|
|
8092
8142
|
}
|
|
8093
|
-
|
|
8094
|
-
|
|
8143
|
+
const fromEnhancePrompt = getValueByPath(fromObject, [
|
|
8144
|
+
'enhancePrompt',
|
|
8145
|
+
]);
|
|
8146
|
+
if (parentObject !== undefined && fromEnhancePrompt != null) {
|
|
8147
|
+
setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
|
|
8095
8148
|
}
|
|
8096
8149
|
if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
|
|
8097
8150
|
throw new Error('generateAudio parameter is not supported in Gemini API.');
|
|
@@ -8186,6 +8239,12 @@ function partToVertex(apiClient, fromObject) {
|
|
|
8186
8239
|
if (fromFileData != null) {
|
|
8187
8240
|
setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
|
|
8188
8241
|
}
|
|
8242
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
8243
|
+
'thoughtSignature',
|
|
8244
|
+
]);
|
|
8245
|
+
if (fromThoughtSignature != null) {
|
|
8246
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8247
|
+
}
|
|
8189
8248
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8190
8249
|
'codeExecutionResult',
|
|
8191
8250
|
]);
|
|
@@ -8477,6 +8536,10 @@ function googleMapsToVertex(apiClient, fromObject) {
|
|
|
8477
8536
|
}
|
|
8478
8537
|
return toObject;
|
|
8479
8538
|
}
|
|
8539
|
+
function urlContextToVertex() {
|
|
8540
|
+
const toObject = {};
|
|
8541
|
+
return toObject;
|
|
8542
|
+
}
|
|
8480
8543
|
function toolToVertex(apiClient, fromObject) {
|
|
8481
8544
|
const toObject = {};
|
|
8482
8545
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -8515,8 +8578,9 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
8515
8578
|
if (fromGoogleMaps != null) {
|
|
8516
8579
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex(apiClient, fromGoogleMaps));
|
|
8517
8580
|
}
|
|
8518
|
-
|
|
8519
|
-
|
|
8581
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
8582
|
+
if (fromUrlContext != null) {
|
|
8583
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex());
|
|
8520
8584
|
}
|
|
8521
8585
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8522
8586
|
'codeExecution',
|
|
@@ -9523,6 +9587,12 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
9523
9587
|
if (fromFileData != null) {
|
|
9524
9588
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
|
|
9525
9589
|
}
|
|
9590
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
9591
|
+
'thoughtSignature',
|
|
9592
|
+
]);
|
|
9593
|
+
if (fromThoughtSignature != null) {
|
|
9594
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9595
|
+
}
|
|
9526
9596
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9527
9597
|
'codeExecutionResult',
|
|
9528
9598
|
]);
|
|
@@ -10041,6 +10111,12 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
10041
10111
|
if (fromFileData != null) {
|
|
10042
10112
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
|
|
10043
10113
|
}
|
|
10114
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
10115
|
+
'thoughtSignature',
|
|
10116
|
+
]);
|
|
10117
|
+
if (fromThoughtSignature != null) {
|
|
10118
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10119
|
+
}
|
|
10044
10120
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10045
10121
|
'codeExecutionResult',
|
|
10046
10122
|
]);
|
|
@@ -10095,6 +10171,34 @@ function citationMetadataFromVertex(apiClient, fromObject) {
|
|
|
10095
10171
|
}
|
|
10096
10172
|
return toObject;
|
|
10097
10173
|
}
|
|
10174
|
+
function urlMetadataFromVertex(apiClient, fromObject) {
|
|
10175
|
+
const toObject = {};
|
|
10176
|
+
const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
|
|
10177
|
+
if (fromRetrievedUrl != null) {
|
|
10178
|
+
setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
|
|
10179
|
+
}
|
|
10180
|
+
const fromUrlRetrievalStatus = getValueByPath(fromObject, [
|
|
10181
|
+
'urlRetrievalStatus',
|
|
10182
|
+
]);
|
|
10183
|
+
if (fromUrlRetrievalStatus != null) {
|
|
10184
|
+
setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
|
|
10185
|
+
}
|
|
10186
|
+
return toObject;
|
|
10187
|
+
}
|
|
10188
|
+
function urlContextMetadataFromVertex(apiClient, fromObject) {
|
|
10189
|
+
const toObject = {};
|
|
10190
|
+
const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
|
|
10191
|
+
if (fromUrlMetadata != null) {
|
|
10192
|
+
let transformedList = fromUrlMetadata;
|
|
10193
|
+
if (Array.isArray(transformedList)) {
|
|
10194
|
+
transformedList = transformedList.map((item) => {
|
|
10195
|
+
return urlMetadataFromVertex(apiClient, item);
|
|
10196
|
+
});
|
|
10197
|
+
}
|
|
10198
|
+
setValueByPath(toObject, ['urlMetadata'], transformedList);
|
|
10199
|
+
}
|
|
10200
|
+
return toObject;
|
|
10201
|
+
}
|
|
10098
10202
|
function candidateFromVertex(apiClient, fromObject) {
|
|
10099
10203
|
const toObject = {};
|
|
10100
10204
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
@@ -10117,6 +10221,12 @@ function candidateFromVertex(apiClient, fromObject) {
|
|
|
10117
10221
|
if (fromFinishReason != null) {
|
|
10118
10222
|
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
10119
10223
|
}
|
|
10224
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
10225
|
+
'urlContextMetadata',
|
|
10226
|
+
]);
|
|
10227
|
+
if (fromUrlContextMetadata != null) {
|
|
10228
|
+
setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromVertex(apiClient, fromUrlContextMetadata));
|
|
10229
|
+
}
|
|
10120
10230
|
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
10121
10231
|
if (fromAvgLogprobs != null) {
|
|
10122
10232
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
@@ -10583,7 +10693,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10583
10693
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10584
10694
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10585
10695
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10586
|
-
const SDK_VERSION = '1.
|
|
10696
|
+
const SDK_VERSION = '1.4.0'; // x-release-please-version
|
|
10587
10697
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10588
10698
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10589
10699
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11135,11 +11245,9 @@ function hasNonMcpTools(params) {
|
|
|
11135
11245
|
}
|
|
11136
11246
|
// Returns true if the object is a MCP CallableTool, otherwise false.
|
|
11137
11247
|
function isMcpCallableTool(object) {
|
|
11138
|
-
// TODO: b/418266406 - Add a more robust check for the MCP CallableTool.
|
|
11139
11248
|
return (object !== null &&
|
|
11140
11249
|
typeof object === 'object' &&
|
|
11141
|
-
|
|
11142
|
-
'callTool' in object);
|
|
11250
|
+
object instanceof McpCallableTool);
|
|
11143
11251
|
}
|
|
11144
11252
|
// List all tools from the MCP client.
|
|
11145
11253
|
function listAllTools(mcpClient, maxTools = 100) {
|
|
@@ -11619,7 +11727,14 @@ class Live {
|
|
|
11619
11727
|
}
|
|
11620
11728
|
else {
|
|
11621
11729
|
const apiKey = this.apiClient.getApiKey();
|
|
11622
|
-
|
|
11730
|
+
let method = 'BidiGenerateContent';
|
|
11731
|
+
let keyName = 'key';
|
|
11732
|
+
if (apiKey === null || apiKey === void 0 ? void 0 : apiKey.startsWith('auth_tokens/')) {
|
|
11733
|
+
console.warn('Warning: Ephemeral token support is experimental and may change in future versions.');
|
|
11734
|
+
method = 'BidiGenerateContentConstrained';
|
|
11735
|
+
keyName = 'access_token';
|
|
11736
|
+
}
|
|
11737
|
+
url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.${method}?${keyName}=${apiKey}`;
|
|
11623
11738
|
}
|
|
11624
11739
|
let onopenResolve = () => { };
|
|
11625
11740
|
const onopenPromise = new Promise((resolve) => {
|
|
@@ -11725,7 +11840,7 @@ class Session {
|
|
|
11725
11840
|
contents = contents.map((item) => contentToVertex(apiClient, item));
|
|
11726
11841
|
}
|
|
11727
11842
|
else {
|
|
11728
|
-
contents = contents.map((item) => contentToMldev(apiClient, item));
|
|
11843
|
+
contents = contents.map((item) => contentToMldev$1(apiClient, item));
|
|
11729
11844
|
}
|
|
11730
11845
|
}
|
|
11731
11846
|
catch (_a) {
|
|
@@ -12023,7 +12138,6 @@ class Models extends BaseModule {
|
|
|
12023
12138
|
if (!hasMcpClientTools(params) || shouldDisableAfc(params.config)) {
|
|
12024
12139
|
return await this.generateContentInternal(transformedParams);
|
|
12025
12140
|
}
|
|
12026
|
-
// TODO: b/418266406 - Improve the check for CallableTools and Tools.
|
|
12027
12141
|
if (hasNonMcpTools(params)) {
|
|
12028
12142
|
throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
|
|
12029
12143
|
}
|
|
@@ -13578,23 +13692,861 @@ class Operations extends BaseModule {
|
|
|
13578
13692
|
* Copyright 2025 Google LLC
|
|
13579
13693
|
* SPDX-License-Identifier: Apache-2.0
|
|
13580
13694
|
*/
|
|
13581
|
-
|
|
13582
|
-
const
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
this.apiKey = opts.apiKey;
|
|
13587
|
-
return;
|
|
13588
|
-
}
|
|
13589
|
-
const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
|
|
13590
|
-
this.googleAuth = new googleAuthLibrary.GoogleAuth(vertexAuthOptions);
|
|
13695
|
+
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
13696
|
+
const toObject = {};
|
|
13697
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
13698
|
+
if (fromVoiceName != null) {
|
|
13699
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
13591
13700
|
}
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
|
|
13597
|
-
|
|
13701
|
+
return toObject;
|
|
13702
|
+
}
|
|
13703
|
+
function voiceConfigToMldev(apiClient, fromObject) {
|
|
13704
|
+
const toObject = {};
|
|
13705
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
13706
|
+
'prebuiltVoiceConfig',
|
|
13707
|
+
]);
|
|
13708
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
13709
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
13710
|
+
}
|
|
13711
|
+
return toObject;
|
|
13712
|
+
}
|
|
13713
|
+
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13714
|
+
const toObject = {};
|
|
13715
|
+
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
13716
|
+
if (fromSpeaker != null) {
|
|
13717
|
+
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
13718
|
+
}
|
|
13719
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13720
|
+
if (fromVoiceConfig != null) {
|
|
13721
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13722
|
+
}
|
|
13723
|
+
return toObject;
|
|
13724
|
+
}
|
|
13725
|
+
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13726
|
+
const toObject = {};
|
|
13727
|
+
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
13728
|
+
'speakerVoiceConfigs',
|
|
13729
|
+
]);
|
|
13730
|
+
if (fromSpeakerVoiceConfigs != null) {
|
|
13731
|
+
let transformedList = fromSpeakerVoiceConfigs;
|
|
13732
|
+
if (Array.isArray(transformedList)) {
|
|
13733
|
+
transformedList = transformedList.map((item) => {
|
|
13734
|
+
return speakerVoiceConfigToMldev(apiClient, item);
|
|
13735
|
+
});
|
|
13736
|
+
}
|
|
13737
|
+
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
13738
|
+
}
|
|
13739
|
+
return toObject;
|
|
13740
|
+
}
|
|
13741
|
+
function speechConfigToMldev(apiClient, fromObject) {
|
|
13742
|
+
const toObject = {};
|
|
13743
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13744
|
+
if (fromVoiceConfig != null) {
|
|
13745
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13746
|
+
}
|
|
13747
|
+
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
13748
|
+
'multiSpeakerVoiceConfig',
|
|
13749
|
+
]);
|
|
13750
|
+
if (fromMultiSpeakerVoiceConfig != null) {
|
|
13751
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
13752
|
+
}
|
|
13753
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
13754
|
+
if (fromLanguageCode != null) {
|
|
13755
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
13756
|
+
}
|
|
13757
|
+
return toObject;
|
|
13758
|
+
}
|
|
13759
|
+
function videoMetadataToMldev(apiClient, fromObject) {
|
|
13760
|
+
const toObject = {};
|
|
13761
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
13762
|
+
if (fromFps != null) {
|
|
13763
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
13764
|
+
}
|
|
13765
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
13766
|
+
if (fromEndOffset != null) {
|
|
13767
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
13768
|
+
}
|
|
13769
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
13770
|
+
if (fromStartOffset != null) {
|
|
13771
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
13772
|
+
}
|
|
13773
|
+
return toObject;
|
|
13774
|
+
}
|
|
13775
|
+
function blobToMldev(apiClient, fromObject) {
|
|
13776
|
+
const toObject = {};
|
|
13777
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13778
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13779
|
+
}
|
|
13780
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
13781
|
+
if (fromData != null) {
|
|
13782
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
13783
|
+
}
|
|
13784
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13785
|
+
if (fromMimeType != null) {
|
|
13786
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13787
|
+
}
|
|
13788
|
+
return toObject;
|
|
13789
|
+
}
|
|
13790
|
+
function fileDataToMldev(apiClient, fromObject) {
|
|
13791
|
+
const toObject = {};
|
|
13792
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13793
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13794
|
+
}
|
|
13795
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
13796
|
+
if (fromFileUri != null) {
|
|
13797
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
13798
|
+
}
|
|
13799
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13800
|
+
if (fromMimeType != null) {
|
|
13801
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13802
|
+
}
|
|
13803
|
+
return toObject;
|
|
13804
|
+
}
|
|
13805
|
+
function partToMldev(apiClient, fromObject) {
|
|
13806
|
+
const toObject = {};
|
|
13807
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
13808
|
+
'videoMetadata',
|
|
13809
|
+
]);
|
|
13810
|
+
if (fromVideoMetadata != null) {
|
|
13811
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
13812
|
+
}
|
|
13813
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
13814
|
+
if (fromThought != null) {
|
|
13815
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
13816
|
+
}
|
|
13817
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
13818
|
+
if (fromInlineData != null) {
|
|
13819
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
13820
|
+
}
|
|
13821
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
13822
|
+
if (fromFileData != null) {
|
|
13823
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
13824
|
+
}
|
|
13825
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
13826
|
+
'thoughtSignature',
|
|
13827
|
+
]);
|
|
13828
|
+
if (fromThoughtSignature != null) {
|
|
13829
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13830
|
+
}
|
|
13831
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13832
|
+
'codeExecutionResult',
|
|
13833
|
+
]);
|
|
13834
|
+
if (fromCodeExecutionResult != null) {
|
|
13835
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
13836
|
+
}
|
|
13837
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
13838
|
+
'executableCode',
|
|
13839
|
+
]);
|
|
13840
|
+
if (fromExecutableCode != null) {
|
|
13841
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13842
|
+
}
|
|
13843
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13844
|
+
if (fromFunctionCall != null) {
|
|
13845
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13846
|
+
}
|
|
13847
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13848
|
+
'functionResponse',
|
|
13849
|
+
]);
|
|
13850
|
+
if (fromFunctionResponse != null) {
|
|
13851
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
13852
|
+
}
|
|
13853
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
13854
|
+
if (fromText != null) {
|
|
13855
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
13856
|
+
}
|
|
13857
|
+
return toObject;
|
|
13858
|
+
}
|
|
13859
|
+
function contentToMldev(apiClient, fromObject) {
|
|
13860
|
+
const toObject = {};
|
|
13861
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13862
|
+
if (fromParts != null) {
|
|
13863
|
+
let transformedList = fromParts;
|
|
13864
|
+
if (Array.isArray(transformedList)) {
|
|
13865
|
+
transformedList = transformedList.map((item) => {
|
|
13866
|
+
return partToMldev(apiClient, item);
|
|
13867
|
+
});
|
|
13868
|
+
}
|
|
13869
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
13870
|
+
}
|
|
13871
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
13872
|
+
if (fromRole != null) {
|
|
13873
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
13874
|
+
}
|
|
13875
|
+
return toObject;
|
|
13876
|
+
}
|
|
13877
|
+
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
13878
|
+
const toObject = {};
|
|
13879
|
+
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
13880
|
+
if (fromBehavior != null) {
|
|
13881
|
+
setValueByPath(toObject, ['behavior'], fromBehavior);
|
|
13882
|
+
}
|
|
13883
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
13884
|
+
if (fromDescription != null) {
|
|
13885
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
13886
|
+
}
|
|
13887
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13888
|
+
if (fromName != null) {
|
|
13889
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13890
|
+
}
|
|
13891
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
13892
|
+
if (fromParameters != null) {
|
|
13893
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
13894
|
+
}
|
|
13895
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
13896
|
+
if (fromResponse != null) {
|
|
13897
|
+
setValueByPath(toObject, ['response'], fromResponse);
|
|
13898
|
+
}
|
|
13899
|
+
return toObject;
|
|
13900
|
+
}
|
|
13901
|
+
function intervalToMldev(apiClient, fromObject) {
|
|
13902
|
+
const toObject = {};
|
|
13903
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
13904
|
+
if (fromStartTime != null) {
|
|
13905
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
13906
|
+
}
|
|
13907
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
13908
|
+
if (fromEndTime != null) {
|
|
13909
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
13910
|
+
}
|
|
13911
|
+
return toObject;
|
|
13912
|
+
}
|
|
13913
|
+
function googleSearchToMldev(apiClient, fromObject) {
|
|
13914
|
+
const toObject = {};
|
|
13915
|
+
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
13916
|
+
'timeRangeFilter',
|
|
13917
|
+
]);
|
|
13918
|
+
if (fromTimeRangeFilter != null) {
|
|
13919
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
13920
|
+
}
|
|
13921
|
+
return toObject;
|
|
13922
|
+
}
|
|
13923
|
+
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
13924
|
+
const toObject = {};
|
|
13925
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
13926
|
+
if (fromMode != null) {
|
|
13927
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
13928
|
+
}
|
|
13929
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
13930
|
+
'dynamicThreshold',
|
|
13931
|
+
]);
|
|
13932
|
+
if (fromDynamicThreshold != null) {
|
|
13933
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
13934
|
+
}
|
|
13935
|
+
return toObject;
|
|
13936
|
+
}
|
|
13937
|
+
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
13938
|
+
const toObject = {};
|
|
13939
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
13940
|
+
'dynamicRetrievalConfig',
|
|
13941
|
+
]);
|
|
13942
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
13943
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
13944
|
+
}
|
|
13945
|
+
return toObject;
|
|
13946
|
+
}
|
|
13947
|
+
function urlContextToMldev() {
|
|
13948
|
+
const toObject = {};
|
|
13949
|
+
return toObject;
|
|
13950
|
+
}
|
|
13951
|
+
function toolToMldev(apiClient, fromObject) {
|
|
13952
|
+
const toObject = {};
|
|
13953
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
13954
|
+
'functionDeclarations',
|
|
13955
|
+
]);
|
|
13956
|
+
if (fromFunctionDeclarations != null) {
|
|
13957
|
+
let transformedList = fromFunctionDeclarations;
|
|
13958
|
+
if (Array.isArray(transformedList)) {
|
|
13959
|
+
transformedList = transformedList.map((item) => {
|
|
13960
|
+
return functionDeclarationToMldev(apiClient, item);
|
|
13961
|
+
});
|
|
13962
|
+
}
|
|
13963
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
13964
|
+
}
|
|
13965
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
13966
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
13967
|
+
}
|
|
13968
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
13969
|
+
if (fromGoogleSearch != null) {
|
|
13970
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
13971
|
+
}
|
|
13972
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
13973
|
+
'googleSearchRetrieval',
|
|
13974
|
+
]);
|
|
13975
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
13976
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
13977
|
+
}
|
|
13978
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
13979
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
13980
|
+
}
|
|
13981
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
13982
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
13983
|
+
}
|
|
13984
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
13985
|
+
if (fromUrlContext != null) {
|
|
13986
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
13987
|
+
}
|
|
13988
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
13989
|
+
'codeExecution',
|
|
13990
|
+
]);
|
|
13991
|
+
if (fromCodeExecution != null) {
|
|
13992
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
13993
|
+
}
|
|
13994
|
+
return toObject;
|
|
13995
|
+
}
|
|
13996
|
+
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
13997
|
+
const toObject = {};
|
|
13998
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
13999
|
+
if (fromHandle != null) {
|
|
14000
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
14001
|
+
}
|
|
14002
|
+
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
14003
|
+
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
14004
|
+
}
|
|
14005
|
+
return toObject;
|
|
14006
|
+
}
|
|
14007
|
+
function audioTranscriptionConfigToMldev() {
|
|
14008
|
+
const toObject = {};
|
|
14009
|
+
return toObject;
|
|
14010
|
+
}
|
|
14011
|
+
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
14012
|
+
const toObject = {};
|
|
14013
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
14014
|
+
if (fromDisabled != null) {
|
|
14015
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
14016
|
+
}
|
|
14017
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
14018
|
+
'startOfSpeechSensitivity',
|
|
14019
|
+
]);
|
|
14020
|
+
if (fromStartOfSpeechSensitivity != null) {
|
|
14021
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
14022
|
+
}
|
|
14023
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
14024
|
+
'endOfSpeechSensitivity',
|
|
14025
|
+
]);
|
|
14026
|
+
if (fromEndOfSpeechSensitivity != null) {
|
|
14027
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
14028
|
+
}
|
|
14029
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
14030
|
+
'prefixPaddingMs',
|
|
14031
|
+
]);
|
|
14032
|
+
if (fromPrefixPaddingMs != null) {
|
|
14033
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
14034
|
+
}
|
|
14035
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
14036
|
+
'silenceDurationMs',
|
|
14037
|
+
]);
|
|
14038
|
+
if (fromSilenceDurationMs != null) {
|
|
14039
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
14040
|
+
}
|
|
14041
|
+
return toObject;
|
|
14042
|
+
}
|
|
14043
|
+
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
14044
|
+
const toObject = {};
|
|
14045
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
14046
|
+
'automaticActivityDetection',
|
|
14047
|
+
]);
|
|
14048
|
+
if (fromAutomaticActivityDetection != null) {
|
|
14049
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
14050
|
+
}
|
|
14051
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
14052
|
+
'activityHandling',
|
|
14053
|
+
]);
|
|
14054
|
+
if (fromActivityHandling != null) {
|
|
14055
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
14056
|
+
}
|
|
14057
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
14058
|
+
if (fromTurnCoverage != null) {
|
|
14059
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
14060
|
+
}
|
|
14061
|
+
return toObject;
|
|
14062
|
+
}
|
|
14063
|
+
function slidingWindowToMldev(apiClient, fromObject) {
|
|
14064
|
+
const toObject = {};
|
|
14065
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
14066
|
+
if (fromTargetTokens != null) {
|
|
14067
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
14068
|
+
}
|
|
14069
|
+
return toObject;
|
|
14070
|
+
}
|
|
14071
|
+
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
14072
|
+
const toObject = {};
|
|
14073
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
14074
|
+
'triggerTokens',
|
|
14075
|
+
]);
|
|
14076
|
+
if (fromTriggerTokens != null) {
|
|
14077
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
14078
|
+
}
|
|
14079
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
14080
|
+
'slidingWindow',
|
|
14081
|
+
]);
|
|
14082
|
+
if (fromSlidingWindow != null) {
|
|
14083
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
14084
|
+
}
|
|
14085
|
+
return toObject;
|
|
14086
|
+
}
|
|
14087
|
+
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
14088
|
+
const toObject = {};
|
|
14089
|
+
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
14090
|
+
'proactiveAudio',
|
|
14091
|
+
]);
|
|
14092
|
+
if (fromProactiveAudio != null) {
|
|
14093
|
+
setValueByPath(toObject, ['proactiveAudio'], fromProactiveAudio);
|
|
14094
|
+
}
|
|
14095
|
+
return toObject;
|
|
14096
|
+
}
|
|
14097
|
+
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14098
|
+
const toObject = {};
|
|
14099
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
14100
|
+
'generationConfig',
|
|
14101
|
+
]);
|
|
14102
|
+
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
14103
|
+
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
14104
|
+
}
|
|
14105
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
14106
|
+
'responseModalities',
|
|
14107
|
+
]);
|
|
14108
|
+
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
14109
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
14110
|
+
}
|
|
14111
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
14112
|
+
if (parentObject !== undefined && fromTemperature != null) {
|
|
14113
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
14114
|
+
}
|
|
14115
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
14116
|
+
if (parentObject !== undefined && fromTopP != null) {
|
|
14117
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
14118
|
+
}
|
|
14119
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
14120
|
+
if (parentObject !== undefined && fromTopK != null) {
|
|
14121
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
14122
|
+
}
|
|
14123
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
14124
|
+
'maxOutputTokens',
|
|
14125
|
+
]);
|
|
14126
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
14127
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
14128
|
+
}
|
|
14129
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14130
|
+
'mediaResolution',
|
|
14131
|
+
]);
|
|
14132
|
+
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
14133
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
14134
|
+
}
|
|
14135
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
14136
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
14137
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
14138
|
+
}
|
|
14139
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
14140
|
+
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
14141
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
14142
|
+
}
|
|
14143
|
+
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
14144
|
+
'enableAffectiveDialog',
|
|
14145
|
+
]);
|
|
14146
|
+
if (parentObject !== undefined && fromEnableAffectiveDialog != null) {
|
|
14147
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'enableAffectiveDialog'], fromEnableAffectiveDialog);
|
|
14148
|
+
}
|
|
14149
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
14150
|
+
'systemInstruction',
|
|
14151
|
+
]);
|
|
14152
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
14153
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
14154
|
+
}
|
|
14155
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
14156
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
14157
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
14158
|
+
if (Array.isArray(transformedList)) {
|
|
14159
|
+
transformedList = transformedList.map((item) => {
|
|
14160
|
+
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
14161
|
+
});
|
|
14162
|
+
}
|
|
14163
|
+
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
14164
|
+
}
|
|
14165
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
14166
|
+
'sessionResumption',
|
|
14167
|
+
]);
|
|
14168
|
+
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
14169
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
14170
|
+
}
|
|
14171
|
+
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
14172
|
+
'inputAudioTranscription',
|
|
14173
|
+
]);
|
|
14174
|
+
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
14175
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14176
|
+
}
|
|
14177
|
+
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
14178
|
+
'outputAudioTranscription',
|
|
14179
|
+
]);
|
|
14180
|
+
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
14181
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14182
|
+
}
|
|
14183
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
14184
|
+
'realtimeInputConfig',
|
|
14185
|
+
]);
|
|
14186
|
+
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
14187
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
14188
|
+
}
|
|
14189
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
14190
|
+
'contextWindowCompression',
|
|
14191
|
+
]);
|
|
14192
|
+
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
14193
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
14194
|
+
}
|
|
14195
|
+
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
14196
|
+
if (parentObject !== undefined && fromProactivity != null) {
|
|
14197
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
14198
|
+
}
|
|
14199
|
+
return toObject;
|
|
14200
|
+
}
|
|
14201
|
+
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
14202
|
+
const toObject = {};
|
|
14203
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
14204
|
+
if (fromModel != null) {
|
|
14205
|
+
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
14206
|
+
}
|
|
14207
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14208
|
+
if (fromConfig != null) {
|
|
14209
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
14210
|
+
}
|
|
14211
|
+
return toObject;
|
|
14212
|
+
}
|
|
14213
|
+
function createAuthTokenConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14214
|
+
const toObject = {};
|
|
14215
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
14216
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
14217
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
14218
|
+
}
|
|
14219
|
+
const fromNewSessionExpireTime = getValueByPath(fromObject, [
|
|
14220
|
+
'newSessionExpireTime',
|
|
14221
|
+
]);
|
|
14222
|
+
if (parentObject !== undefined && fromNewSessionExpireTime != null) {
|
|
14223
|
+
setValueByPath(parentObject, ['newSessionExpireTime'], fromNewSessionExpireTime);
|
|
14224
|
+
}
|
|
14225
|
+
const fromUses = getValueByPath(fromObject, ['uses']);
|
|
14226
|
+
if (parentObject !== undefined && fromUses != null) {
|
|
14227
|
+
setValueByPath(parentObject, ['uses'], fromUses);
|
|
14228
|
+
}
|
|
14229
|
+
const fromLiveConnectConstraints = getValueByPath(fromObject, [
|
|
14230
|
+
'liveConnectConstraints',
|
|
14231
|
+
]);
|
|
14232
|
+
if (parentObject !== undefined && fromLiveConnectConstraints != null) {
|
|
14233
|
+
setValueByPath(parentObject, ['bidiGenerateContentSetup'], liveConnectConstraintsToMldev(apiClient, fromLiveConnectConstraints));
|
|
14234
|
+
}
|
|
14235
|
+
const fromLockAdditionalFields = getValueByPath(fromObject, [
|
|
14236
|
+
'lockAdditionalFields',
|
|
14237
|
+
]);
|
|
14238
|
+
if (parentObject !== undefined && fromLockAdditionalFields != null) {
|
|
14239
|
+
setValueByPath(parentObject, ['fieldMask'], fromLockAdditionalFields);
|
|
14240
|
+
}
|
|
14241
|
+
return toObject;
|
|
14242
|
+
}
|
|
14243
|
+
function createAuthTokenParametersToMldev(apiClient, fromObject) {
|
|
14244
|
+
const toObject = {};
|
|
14245
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14246
|
+
if (fromConfig != null) {
|
|
14247
|
+
setValueByPath(toObject, ['config'], createAuthTokenConfigToMldev(apiClient, fromConfig, toObject));
|
|
14248
|
+
}
|
|
14249
|
+
return toObject;
|
|
14250
|
+
}
|
|
14251
|
+
function authTokenFromMldev(apiClient, fromObject) {
|
|
14252
|
+
const toObject = {};
|
|
14253
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14254
|
+
if (fromName != null) {
|
|
14255
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14256
|
+
}
|
|
14257
|
+
return toObject;
|
|
14258
|
+
}
|
|
14259
|
+
|
|
14260
|
+
/**
|
|
14261
|
+
* @license
|
|
14262
|
+
* Copyright 2025 Google LLC
|
|
14263
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14264
|
+
*/
|
|
14265
|
+
/**
|
|
14266
|
+
* Returns a comma-separated list of field masks from a given object.
|
|
14267
|
+
*
|
|
14268
|
+
* @param setup The object to extract field masks from.
|
|
14269
|
+
* @return A comma-separated list of field masks.
|
|
14270
|
+
*/
|
|
14271
|
+
function getFieldMasks(setup) {
|
|
14272
|
+
const fields = [];
|
|
14273
|
+
for (const key in setup) {
|
|
14274
|
+
if (Object.prototype.hasOwnProperty.call(setup, key)) {
|
|
14275
|
+
const value = setup[key];
|
|
14276
|
+
// 2nd layer, recursively get field masks see TODO(b/418290100)
|
|
14277
|
+
if (typeof value === 'object' &&
|
|
14278
|
+
value != null &&
|
|
14279
|
+
Object.keys(value).length > 0) {
|
|
14280
|
+
const field = Object.keys(value).map((kk) => `${key}.${kk}`);
|
|
14281
|
+
fields.push(...field);
|
|
14282
|
+
}
|
|
14283
|
+
else {
|
|
14284
|
+
fields.push(key); // 1st layer
|
|
14285
|
+
}
|
|
14286
|
+
}
|
|
14287
|
+
}
|
|
14288
|
+
return fields.join(',');
|
|
14289
|
+
}
|
|
14290
|
+
/**
|
|
14291
|
+
* Converts bidiGenerateContentSetup.
|
|
14292
|
+
* @param requestDict - The request dictionary.
|
|
14293
|
+
* @param config - The configuration object.
|
|
14294
|
+
* @return - The modified request dictionary.
|
|
14295
|
+
*/
|
|
14296
|
+
function convertBidiSetupToTokenSetup(requestDict, config) {
|
|
14297
|
+
// Convert bidiGenerateContentSetup from bidiGenerateContentSetup.setup.
|
|
14298
|
+
let setupForMaskGeneration = null;
|
|
14299
|
+
const bidiGenerateContentSetupValue = requestDict['bidiGenerateContentSetup'];
|
|
14300
|
+
if (typeof bidiGenerateContentSetupValue === 'object' &&
|
|
14301
|
+
bidiGenerateContentSetupValue !== null &&
|
|
14302
|
+
'setup' in bidiGenerateContentSetupValue) {
|
|
14303
|
+
// Now we know bidiGenerateContentSetupValue is an object and has a 'setup'
|
|
14304
|
+
// property.
|
|
14305
|
+
const innerSetup = bidiGenerateContentSetupValue
|
|
14306
|
+
.setup;
|
|
14307
|
+
if (typeof innerSetup === 'object' && innerSetup !== null) {
|
|
14308
|
+
// Valid inner setup found.
|
|
14309
|
+
requestDict['bidiGenerateContentSetup'] = innerSetup;
|
|
14310
|
+
setupForMaskGeneration = innerSetup;
|
|
14311
|
+
}
|
|
14312
|
+
else {
|
|
14313
|
+
// `bidiGenerateContentSetupValue.setup` is not a valid object; treat as
|
|
14314
|
+
// if bidiGenerateContentSetup is invalid.
|
|
14315
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14316
|
+
}
|
|
14317
|
+
}
|
|
14318
|
+
else if (bidiGenerateContentSetupValue !== undefined) {
|
|
14319
|
+
// `bidiGenerateContentSetup` exists but not in the expected
|
|
14320
|
+
// shape {setup: {...}}; treat as invalid.
|
|
14321
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14322
|
+
}
|
|
14323
|
+
const preExistingFieldMask = requestDict['fieldMask'];
|
|
14324
|
+
// Handle mask generation setup.
|
|
14325
|
+
if (setupForMaskGeneration) {
|
|
14326
|
+
const generatedMaskFromBidi = getFieldMasks(setupForMaskGeneration);
|
|
14327
|
+
if (Array.isArray(config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14328
|
+
(config === null || config === void 0 ? void 0 : config.lockAdditionalFields.length) === 0) {
|
|
14329
|
+
// Case 1: lockAdditionalFields is an empty array. Lock only fields from
|
|
14330
|
+
// bidi setup.
|
|
14331
|
+
if (generatedMaskFromBidi) {
|
|
14332
|
+
// Only assign if mask is not empty
|
|
14333
|
+
requestDict['fieldMask'] = generatedMaskFromBidi;
|
|
14334
|
+
}
|
|
14335
|
+
else {
|
|
14336
|
+
delete requestDict['fieldMask']; // If mask is empty, effectively no
|
|
14337
|
+
// specific fields locked by bidi
|
|
14338
|
+
}
|
|
14339
|
+
}
|
|
14340
|
+
else if ((config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14341
|
+
config.lockAdditionalFields.length > 0 &&
|
|
14342
|
+
preExistingFieldMask !== null &&
|
|
14343
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14344
|
+
preExistingFieldMask.length > 0) {
|
|
14345
|
+
// Case 2: Lock fields from bidi setup + additional fields
|
|
14346
|
+
// (preExistingFieldMask).
|
|
14347
|
+
const generationConfigFields = [
|
|
14348
|
+
'temperature',
|
|
14349
|
+
'topK',
|
|
14350
|
+
'topP',
|
|
14351
|
+
'maxOutputTokens',
|
|
14352
|
+
'responseModalities',
|
|
14353
|
+
'seed',
|
|
14354
|
+
'speechConfig',
|
|
14355
|
+
];
|
|
14356
|
+
let mappedFieldsFromPreExisting = [];
|
|
14357
|
+
if (preExistingFieldMask.length > 0) {
|
|
14358
|
+
mappedFieldsFromPreExisting = preExistingFieldMask.map((field) => {
|
|
14359
|
+
if (generationConfigFields.includes(field)) {
|
|
14360
|
+
return `generationConfig.${field}`;
|
|
14361
|
+
}
|
|
14362
|
+
return field; // Keep original field name if not in
|
|
14363
|
+
// generationConfigFields
|
|
14364
|
+
});
|
|
14365
|
+
}
|
|
14366
|
+
const finalMaskParts = [];
|
|
14367
|
+
if (generatedMaskFromBidi) {
|
|
14368
|
+
finalMaskParts.push(generatedMaskFromBidi);
|
|
14369
|
+
}
|
|
14370
|
+
if (mappedFieldsFromPreExisting.length > 0) {
|
|
14371
|
+
finalMaskParts.push(...mappedFieldsFromPreExisting);
|
|
14372
|
+
}
|
|
14373
|
+
if (finalMaskParts.length > 0) {
|
|
14374
|
+
requestDict['fieldMask'] = finalMaskParts.join(',');
|
|
14375
|
+
}
|
|
14376
|
+
else {
|
|
14377
|
+
// If no fields from bidi and no valid additional fields from
|
|
14378
|
+
// pre-existing mask.
|
|
14379
|
+
delete requestDict['fieldMask'];
|
|
14380
|
+
}
|
|
14381
|
+
}
|
|
14382
|
+
else {
|
|
14383
|
+
// Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
|
|
14384
|
+
// defaults apply or all are mutable). This is hit if:
|
|
14385
|
+
// - `config.lockAdditionalFields` is undefined.
|
|
14386
|
+
// - `config.lockAdditionalFields` is non-empty, BUT
|
|
14387
|
+
// `preExistingFieldMask` is null, not a string, or an empty string.
|
|
14388
|
+
delete requestDict['fieldMask'];
|
|
14389
|
+
}
|
|
14390
|
+
}
|
|
14391
|
+
else {
|
|
14392
|
+
// No valid `bidiGenerateContentSetup` was found or extracted.
|
|
14393
|
+
// "Lock additional null fields if any".
|
|
14394
|
+
if (preExistingFieldMask !== null &&
|
|
14395
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14396
|
+
preExistingFieldMask.length > 0) {
|
|
14397
|
+
// If there's a pre-existing field mask, it's a string, and it's not
|
|
14398
|
+
// empty, then we should lock all fields.
|
|
14399
|
+
requestDict['fieldMask'] = preExistingFieldMask.join(',');
|
|
14400
|
+
}
|
|
14401
|
+
else {
|
|
14402
|
+
delete requestDict['fieldMask'];
|
|
14403
|
+
}
|
|
14404
|
+
}
|
|
14405
|
+
return requestDict;
|
|
14406
|
+
}
|
|
14407
|
+
class Tokens extends BaseModule {
|
|
14408
|
+
constructor(apiClient) {
|
|
14409
|
+
super();
|
|
14410
|
+
this.apiClient = apiClient;
|
|
14411
|
+
}
|
|
14412
|
+
/**
|
|
14413
|
+
* Creates an ephemeral auth token resource.
|
|
14414
|
+
*
|
|
14415
|
+
* @experimental
|
|
14416
|
+
*
|
|
14417
|
+
* @remarks
|
|
14418
|
+
* Ephermeral auth tokens is only supported in the Gemini Developer API.
|
|
14419
|
+
* It can be used for the session connection to the Live constrained API.
|
|
14420
|
+
*
|
|
14421
|
+
* @param params - The parameters for the create request.
|
|
14422
|
+
* @return The created auth token.
|
|
14423
|
+
*
|
|
14424
|
+
* @example
|
|
14425
|
+
* ```ts
|
|
14426
|
+
* // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
|
|
14427
|
+
* // when using the token in Live API sessions. Each session connection can
|
|
14428
|
+
* // use a different configuration.
|
|
14429
|
+
* const config: CreateAuthTokenConfig = {
|
|
14430
|
+
* uses: 3,
|
|
14431
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14432
|
+
* }
|
|
14433
|
+
* const token = await ai.tokens.create(config);
|
|
14434
|
+
*
|
|
14435
|
+
* // Case 2: If LiveEphemeralParameters is set, lock all fields in
|
|
14436
|
+
* // LiveConnectConfig when using the token in Live API sessions. For
|
|
14437
|
+
* // example, changing `outputAudioTranscription` in the Live API
|
|
14438
|
+
* // connection will be ignored by the API.
|
|
14439
|
+
* const config: CreateAuthTokenConfig =
|
|
14440
|
+
* uses: 3,
|
|
14441
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14442
|
+
* LiveEphemeralParameters: {
|
|
14443
|
+
* model: 'gemini-2.0-flash-001',
|
|
14444
|
+
* config: {
|
|
14445
|
+
* 'responseModalities': ['AUDIO'],
|
|
14446
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14447
|
+
* }
|
|
14448
|
+
* }
|
|
14449
|
+
* }
|
|
14450
|
+
* const token = await ai.tokens.create(config);
|
|
14451
|
+
*
|
|
14452
|
+
* // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14453
|
+
* // set, lock LiveConnectConfig with set and additional fields (e.g.
|
|
14454
|
+
* // responseModalities, systemInstruction, temperature in this example) when
|
|
14455
|
+
* // using the token in Live API sessions.
|
|
14456
|
+
* const config: CreateAuthTokenConfig =
|
|
14457
|
+
* uses: 3,
|
|
14458
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14459
|
+
* LiveEphemeralParameters: {
|
|
14460
|
+
* model: 'gemini-2.0-flash-001',
|
|
14461
|
+
* config: {
|
|
14462
|
+
* 'responseModalities': ['AUDIO'],
|
|
14463
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14464
|
+
* }
|
|
14465
|
+
* },
|
|
14466
|
+
* lockAdditionalFields: ['temperature'],
|
|
14467
|
+
* }
|
|
14468
|
+
* const token = await ai.tokens.create(config);
|
|
14469
|
+
*
|
|
14470
|
+
* // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14471
|
+
* // empty array, lock LiveConnectConfig with set fields (e.g.
|
|
14472
|
+
* // responseModalities, systemInstruction in this example) when using the
|
|
14473
|
+
* // token in Live API sessions.
|
|
14474
|
+
* const config: CreateAuthTokenConfig =
|
|
14475
|
+
* uses: 3,
|
|
14476
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14477
|
+
* LiveEphemeralParameters: {
|
|
14478
|
+
* model: 'gemini-2.0-flash-001',
|
|
14479
|
+
* config: {
|
|
14480
|
+
* 'responseModalities': ['AUDIO'],
|
|
14481
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14482
|
+
* }
|
|
14483
|
+
* },
|
|
14484
|
+
* lockAdditionalFields: [],
|
|
14485
|
+
* }
|
|
14486
|
+
* const token = await ai.tokens.create(config);
|
|
14487
|
+
* ```
|
|
14488
|
+
*/
|
|
14489
|
+
async create(params) {
|
|
14490
|
+
var _a, _b;
|
|
14491
|
+
let response;
|
|
14492
|
+
let path = '';
|
|
14493
|
+
let queryParams = {};
|
|
14494
|
+
if (this.apiClient.isVertexAI()) {
|
|
14495
|
+
throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
|
|
14496
|
+
}
|
|
14497
|
+
else {
|
|
14498
|
+
const body = createAuthTokenParametersToMldev(this.apiClient, params);
|
|
14499
|
+
path = formatMap('auth_tokens', body['_url']);
|
|
14500
|
+
queryParams = body['_query'];
|
|
14501
|
+
delete body['config'];
|
|
14502
|
+
delete body['_url'];
|
|
14503
|
+
delete body['_query'];
|
|
14504
|
+
const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
|
|
14505
|
+
response = this.apiClient
|
|
14506
|
+
.request({
|
|
14507
|
+
path: path,
|
|
14508
|
+
queryParams: queryParams,
|
|
14509
|
+
body: JSON.stringify(transformedBody),
|
|
14510
|
+
httpMethod: 'POST',
|
|
14511
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
14512
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14513
|
+
})
|
|
14514
|
+
.then((httpResponse) => {
|
|
14515
|
+
return httpResponse.json();
|
|
14516
|
+
});
|
|
14517
|
+
return response.then((apiResponse) => {
|
|
14518
|
+
const resp = authTokenFromMldev(this.apiClient, apiResponse);
|
|
14519
|
+
return resp;
|
|
14520
|
+
});
|
|
14521
|
+
}
|
|
14522
|
+
}
|
|
14523
|
+
}
|
|
14524
|
+
|
|
14525
|
+
/**
|
|
14526
|
+
* @license
|
|
14527
|
+
* Copyright 2025 Google LLC
|
|
14528
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14529
|
+
*/
|
|
14530
|
+
const GOOGLE_API_KEY_HEADER = 'x-goog-api-key';
|
|
14531
|
+
const REQUIRED_VERTEX_AI_SCOPE = 'https://www.googleapis.com/auth/cloud-platform';
|
|
14532
|
+
class NodeAuth {
|
|
14533
|
+
constructor(opts) {
|
|
14534
|
+
if (opts.apiKey !== undefined) {
|
|
14535
|
+
this.apiKey = opts.apiKey;
|
|
14536
|
+
return;
|
|
14537
|
+
}
|
|
14538
|
+
const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
|
|
14539
|
+
this.googleAuth = new googleAuthLibrary.GoogleAuth(vertexAuthOptions);
|
|
14540
|
+
}
|
|
14541
|
+
async addAuthHeaders(headers) {
|
|
14542
|
+
if (this.apiKey !== undefined) {
|
|
14543
|
+
if (this.apiKey.startsWith('auth_tokens/')) {
|
|
14544
|
+
throw new Error('Ephemeral tokens are only supported by the live API.');
|
|
14545
|
+
}
|
|
14546
|
+
this.addKeyHeader(headers);
|
|
14547
|
+
return;
|
|
14548
|
+
}
|
|
14549
|
+
return this.addGoogleAuthHeaders(headers);
|
|
13598
14550
|
}
|
|
13599
14551
|
addKeyHeader(headers) {
|
|
13600
14552
|
if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
|
|
@@ -14838,7 +15790,7 @@ class GoogleGenAI {
|
|
|
14838
15790
|
}
|
|
14839
15791
|
this.vertexai =
|
|
14840
15792
|
(_b = (_a = options.vertexai) !== null && _a !== void 0 ? _a : getBooleanEnv('GOOGLE_GENAI_USE_VERTEXAI')) !== null && _b !== void 0 ? _b : false;
|
|
14841
|
-
const envApiKey =
|
|
15793
|
+
const envApiKey = getApiKeyFromEnv();
|
|
14842
15794
|
const envProject = getEnv('GOOGLE_CLOUD_PROJECT');
|
|
14843
15795
|
const envLocation = getEnv('GOOGLE_CLOUD_LOCATION');
|
|
14844
15796
|
this.apiKey = (_c = options.apiKey) !== null && _c !== void 0 ? _c : envApiKey;
|
|
@@ -14899,6 +15851,7 @@ class GoogleGenAI {
|
|
|
14899
15851
|
this.caches = new Caches(this.apiClient);
|
|
14900
15852
|
this.files = new Files(this.apiClient);
|
|
14901
15853
|
this.operations = new Operations(this.apiClient);
|
|
15854
|
+
this.authTokens = new Tokens(this.apiClient);
|
|
14902
15855
|
this.tunings = new Tunings(this.apiClient);
|
|
14903
15856
|
}
|
|
14904
15857
|
}
|
|
@@ -14915,6 +15868,14 @@ function stringToBoolean(str) {
|
|
|
14915
15868
|
}
|
|
14916
15869
|
return str.toLowerCase() === 'true';
|
|
14917
15870
|
}
|
|
15871
|
+
function getApiKeyFromEnv() {
|
|
15872
|
+
const envGoogleApiKey = getEnv('GOOGLE_API_KEY');
|
|
15873
|
+
const envGeminiApiKey = getEnv('GEMINI_API_KEY');
|
|
15874
|
+
if (envGoogleApiKey && envGeminiApiKey) {
|
|
15875
|
+
console.warn('Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY.');
|
|
15876
|
+
}
|
|
15877
|
+
return envGoogleApiKey || envGeminiApiKey;
|
|
15878
|
+
}
|
|
14918
15879
|
|
|
14919
15880
|
exports.Caches = Caches;
|
|
14920
15881
|
exports.Chat = Chat;
|
|
@@ -14955,6 +15916,7 @@ exports.ReplayResponse = ReplayResponse;
|
|
|
14955
15916
|
exports.Session = Session;
|
|
14956
15917
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
14957
15918
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
15919
|
+
exports.Tokens = Tokens;
|
|
14958
15920
|
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
14959
15921
|
exports.createModelContent = createModelContent;
|
|
14960
15922
|
exports.createPartFromBase64 = createPartFromBase64;
|