@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.mjs
CHANGED
|
@@ -197,7 +197,6 @@ function getValueByPath(data, keys) {
|
|
|
197
197
|
* Copyright 2025 Google LLC
|
|
198
198
|
* SPDX-License-Identifier: Apache-2.0
|
|
199
199
|
*/
|
|
200
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
201
200
|
/** Required. Outcome of the code execution. */
|
|
202
201
|
var Outcome;
|
|
203
202
|
(function (Outcome) {
|
|
@@ -433,6 +432,10 @@ var FinishReason;
|
|
|
433
432
|
* Token generation stopped because generated images have safety violations.
|
|
434
433
|
*/
|
|
435
434
|
FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
435
|
+
/**
|
|
436
|
+
* The tool call generated by the model is invalid.
|
|
437
|
+
*/
|
|
438
|
+
FinishReason["UNEXPECTED_TOOL_CALL"] = "UNEXPECTED_TOOL_CALL";
|
|
436
439
|
})(FinishReason || (FinishReason = {}));
|
|
437
440
|
/** Output only. Harm probability levels in the content. */
|
|
438
441
|
var HarmProbability;
|
|
@@ -1426,7 +1429,6 @@ class ReplayResponse {
|
|
|
1426
1429
|
*/
|
|
1427
1430
|
class RawReferenceImage {
|
|
1428
1431
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1429
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1430
1432
|
toReferenceImageAPI() {
|
|
1431
1433
|
const referenceImageAPI = {
|
|
1432
1434
|
referenceType: 'REFERENCE_TYPE_RAW',
|
|
@@ -1448,7 +1450,6 @@ class RawReferenceImage {
|
|
|
1448
1450
|
*/
|
|
1449
1451
|
class MaskReferenceImage {
|
|
1450
1452
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1451
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1452
1453
|
toReferenceImageAPI() {
|
|
1453
1454
|
const referenceImageAPI = {
|
|
1454
1455
|
referenceType: 'REFERENCE_TYPE_MASK',
|
|
@@ -1471,7 +1472,6 @@ class MaskReferenceImage {
|
|
|
1471
1472
|
*/
|
|
1472
1473
|
class ControlReferenceImage {
|
|
1473
1474
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1474
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1475
1475
|
toReferenceImageAPI() {
|
|
1476
1476
|
const referenceImageAPI = {
|
|
1477
1477
|
referenceType: 'REFERENCE_TYPE_CONTROL',
|
|
@@ -1492,7 +1492,6 @@ class ControlReferenceImage {
|
|
|
1492
1492
|
*/
|
|
1493
1493
|
class StyleReferenceImage {
|
|
1494
1494
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1495
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1496
1495
|
toReferenceImageAPI() {
|
|
1497
1496
|
const referenceImageAPI = {
|
|
1498
1497
|
referenceType: 'REFERENCE_TYPE_STYLE',
|
|
@@ -1513,7 +1512,6 @@ class StyleReferenceImage {
|
|
|
1513
1512
|
*/
|
|
1514
1513
|
class SubjectReferenceImage {
|
|
1515
1514
|
/* Internal method to convert to ReferenceImageAPIInternal. */
|
|
1516
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1517
1515
|
toReferenceImageAPI() {
|
|
1518
1516
|
const referenceImageAPI = {
|
|
1519
1517
|
referenceType: 'REFERENCE_TYPE_SUBJECT',
|
|
@@ -1960,16 +1958,16 @@ function flattenTypeArrayToAnyOf(typeList, resultingSchema) {
|
|
|
1960
1958
|
}
|
|
1961
1959
|
const listWithoutNull = typeList.filter((type) => type !== 'null');
|
|
1962
1960
|
if (listWithoutNull.length === 1) {
|
|
1963
|
-
resultingSchema['type'] = Object.
|
|
1964
|
-
?
|
|
1961
|
+
resultingSchema['type'] = Object.values(Type).includes(listWithoutNull[0].toUpperCase())
|
|
1962
|
+
? listWithoutNull[0].toUpperCase()
|
|
1965
1963
|
: Type.TYPE_UNSPECIFIED;
|
|
1966
1964
|
}
|
|
1967
1965
|
else {
|
|
1968
1966
|
resultingSchema['anyOf'] = [];
|
|
1969
1967
|
for (const i of listWithoutNull) {
|
|
1970
1968
|
resultingSchema['anyOf'].push({
|
|
1971
|
-
'type': Object.
|
|
1972
|
-
?
|
|
1969
|
+
'type': Object.values(Type).includes(i.toUpperCase())
|
|
1970
|
+
? i.toUpperCase()
|
|
1973
1971
|
: Type.TYPE_UNSPECIFIED,
|
|
1974
1972
|
});
|
|
1975
1973
|
}
|
|
@@ -2053,7 +2051,7 @@ function processJsonSchema(_jsonSchema) {
|
|
|
2053
2051
|
// beginning of this function.
|
|
2054
2052
|
continue;
|
|
2055
2053
|
}
|
|
2056
|
-
genAISchema['type'] = Object.
|
|
2054
|
+
genAISchema['type'] = Object.values(Type).includes(fieldValue.toUpperCase())
|
|
2057
2055
|
? fieldValue.toUpperCase()
|
|
2058
2056
|
: Type.TYPE_UNSPECIFIED;
|
|
2059
2057
|
}
|
|
@@ -2412,7 +2410,7 @@ function filterToJsonSchema(schema) {
|
|
|
2412
2410
|
}
|
|
2413
2411
|
else if (fieldName === 'type') {
|
|
2414
2412
|
const typeValue = fieldValue.toUpperCase();
|
|
2415
|
-
filteredSchema[fieldName] = Object.
|
|
2413
|
+
filteredSchema[fieldName] = Object.values(Type).includes(typeValue)
|
|
2416
2414
|
? typeValue
|
|
2417
2415
|
: Type.TYPE_UNSPECIFIED;
|
|
2418
2416
|
}
|
|
@@ -2428,7 +2426,7 @@ function filterToJsonSchema(schema) {
|
|
|
2428
2426
|
* Copyright 2025 Google LLC
|
|
2429
2427
|
* SPDX-License-Identifier: Apache-2.0
|
|
2430
2428
|
*/
|
|
2431
|
-
function videoMetadataToMldev$
|
|
2429
|
+
function videoMetadataToMldev$3(apiClient, fromObject) {
|
|
2432
2430
|
const toObject = {};
|
|
2433
2431
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
2434
2432
|
if (fromFps != null) {
|
|
@@ -2444,7 +2442,7 @@ function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
|
2444
2442
|
}
|
|
2445
2443
|
return toObject;
|
|
2446
2444
|
}
|
|
2447
|
-
function blobToMldev$
|
|
2445
|
+
function blobToMldev$3(apiClient, fromObject) {
|
|
2448
2446
|
const toObject = {};
|
|
2449
2447
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2450
2448
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2459,7 +2457,7 @@ function blobToMldev$2(apiClient, fromObject) {
|
|
|
2459
2457
|
}
|
|
2460
2458
|
return toObject;
|
|
2461
2459
|
}
|
|
2462
|
-
function fileDataToMldev$
|
|
2460
|
+
function fileDataToMldev$3(apiClient, fromObject) {
|
|
2463
2461
|
const toObject = {};
|
|
2464
2462
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2465
2463
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2474,13 +2472,13 @@ function fileDataToMldev$2(apiClient, fromObject) {
|
|
|
2474
2472
|
}
|
|
2475
2473
|
return toObject;
|
|
2476
2474
|
}
|
|
2477
|
-
function partToMldev$
|
|
2475
|
+
function partToMldev$3(apiClient, fromObject) {
|
|
2478
2476
|
const toObject = {};
|
|
2479
2477
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
2480
2478
|
'videoMetadata',
|
|
2481
2479
|
]);
|
|
2482
2480
|
if (fromVideoMetadata != null) {
|
|
2483
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
2481
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$3(apiClient, fromVideoMetadata));
|
|
2484
2482
|
}
|
|
2485
2483
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
2486
2484
|
if (fromThought != null) {
|
|
@@ -2488,11 +2486,17 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2488
2486
|
}
|
|
2489
2487
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
2490
2488
|
if (fromInlineData != null) {
|
|
2491
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
2489
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$3(apiClient, fromInlineData));
|
|
2492
2490
|
}
|
|
2493
2491
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
2494
2492
|
if (fromFileData != null) {
|
|
2495
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
2493
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$3(apiClient, fromFileData));
|
|
2494
|
+
}
|
|
2495
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2496
|
+
'thoughtSignature',
|
|
2497
|
+
]);
|
|
2498
|
+
if (fromThoughtSignature != null) {
|
|
2499
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2496
2500
|
}
|
|
2497
2501
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2498
2502
|
'codeExecutionResult',
|
|
@@ -2522,14 +2526,14 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2522
2526
|
}
|
|
2523
2527
|
return toObject;
|
|
2524
2528
|
}
|
|
2525
|
-
function contentToMldev$
|
|
2529
|
+
function contentToMldev$3(apiClient, fromObject) {
|
|
2526
2530
|
const toObject = {};
|
|
2527
2531
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2528
2532
|
if (fromParts != null) {
|
|
2529
2533
|
let transformedList = fromParts;
|
|
2530
2534
|
if (Array.isArray(transformedList)) {
|
|
2531
2535
|
transformedList = transformedList.map((item) => {
|
|
2532
|
-
return partToMldev$
|
|
2536
|
+
return partToMldev$3(apiClient, item);
|
|
2533
2537
|
});
|
|
2534
2538
|
}
|
|
2535
2539
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -2540,7 +2544,7 @@ function contentToMldev$2(apiClient, fromObject) {
|
|
|
2540
2544
|
}
|
|
2541
2545
|
return toObject;
|
|
2542
2546
|
}
|
|
2543
|
-
function functionDeclarationToMldev$
|
|
2547
|
+
function functionDeclarationToMldev$3(apiClient, fromObject) {
|
|
2544
2548
|
const toObject = {};
|
|
2545
2549
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
2546
2550
|
if (fromBehavior != null) {
|
|
@@ -2564,7 +2568,7 @@ function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
|
2564
2568
|
}
|
|
2565
2569
|
return toObject;
|
|
2566
2570
|
}
|
|
2567
|
-
function intervalToMldev$
|
|
2571
|
+
function intervalToMldev$3(apiClient, fromObject) {
|
|
2568
2572
|
const toObject = {};
|
|
2569
2573
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
2570
2574
|
if (fromStartTime != null) {
|
|
@@ -2576,17 +2580,17 @@ function intervalToMldev$2(apiClient, fromObject) {
|
|
|
2576
2580
|
}
|
|
2577
2581
|
return toObject;
|
|
2578
2582
|
}
|
|
2579
|
-
function googleSearchToMldev$
|
|
2583
|
+
function googleSearchToMldev$3(apiClient, fromObject) {
|
|
2580
2584
|
const toObject = {};
|
|
2581
2585
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
2582
2586
|
'timeRangeFilter',
|
|
2583
2587
|
]);
|
|
2584
2588
|
if (fromTimeRangeFilter != null) {
|
|
2585
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
2589
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(apiClient, fromTimeRangeFilter));
|
|
2586
2590
|
}
|
|
2587
2591
|
return toObject;
|
|
2588
2592
|
}
|
|
2589
|
-
function dynamicRetrievalConfigToMldev$
|
|
2593
|
+
function dynamicRetrievalConfigToMldev$3(apiClient, fromObject) {
|
|
2590
2594
|
const toObject = {};
|
|
2591
2595
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2592
2596
|
if (fromMode != null) {
|
|
@@ -2600,21 +2604,21 @@ function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
|
2600
2604
|
}
|
|
2601
2605
|
return toObject;
|
|
2602
2606
|
}
|
|
2603
|
-
function googleSearchRetrievalToMldev$
|
|
2607
|
+
function googleSearchRetrievalToMldev$3(apiClient, fromObject) {
|
|
2604
2608
|
const toObject = {};
|
|
2605
2609
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
2606
2610
|
'dynamicRetrievalConfig',
|
|
2607
2611
|
]);
|
|
2608
2612
|
if (fromDynamicRetrievalConfig != null) {
|
|
2609
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
2613
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$3(apiClient, fromDynamicRetrievalConfig));
|
|
2610
2614
|
}
|
|
2611
2615
|
return toObject;
|
|
2612
2616
|
}
|
|
2613
|
-
function urlContextToMldev$
|
|
2617
|
+
function urlContextToMldev$3() {
|
|
2614
2618
|
const toObject = {};
|
|
2615
2619
|
return toObject;
|
|
2616
2620
|
}
|
|
2617
|
-
function toolToMldev$
|
|
2621
|
+
function toolToMldev$3(apiClient, fromObject) {
|
|
2618
2622
|
const toObject = {};
|
|
2619
2623
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
2620
2624
|
'functionDeclarations',
|
|
@@ -2623,7 +2627,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2623
2627
|
let transformedList = fromFunctionDeclarations;
|
|
2624
2628
|
if (Array.isArray(transformedList)) {
|
|
2625
2629
|
transformedList = transformedList.map((item) => {
|
|
2626
|
-
return functionDeclarationToMldev$
|
|
2630
|
+
return functionDeclarationToMldev$3(apiClient, item);
|
|
2627
2631
|
});
|
|
2628
2632
|
}
|
|
2629
2633
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -2633,13 +2637,13 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2633
2637
|
}
|
|
2634
2638
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
2635
2639
|
if (fromGoogleSearch != null) {
|
|
2636
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
2640
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(apiClient, fromGoogleSearch));
|
|
2637
2641
|
}
|
|
2638
2642
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
2639
2643
|
'googleSearchRetrieval',
|
|
2640
2644
|
]);
|
|
2641
2645
|
if (fromGoogleSearchRetrieval != null) {
|
|
2642
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
2646
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$3(apiClient, fromGoogleSearchRetrieval));
|
|
2643
2647
|
}
|
|
2644
2648
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
2645
2649
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -2649,7 +2653,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2649
2653
|
}
|
|
2650
2654
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
2651
2655
|
if (fromUrlContext != null) {
|
|
2652
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
2656
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
|
|
2653
2657
|
}
|
|
2654
2658
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
2655
2659
|
'codeExecution',
|
|
@@ -2732,7 +2736,7 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2732
2736
|
let transformedList = tContents(apiClient, fromContents);
|
|
2733
2737
|
if (Array.isArray(transformedList)) {
|
|
2734
2738
|
transformedList = transformedList.map((item) => {
|
|
2735
|
-
return contentToMldev$
|
|
2739
|
+
return contentToMldev$3(apiClient, item);
|
|
2736
2740
|
});
|
|
2737
2741
|
}
|
|
2738
2742
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -2741,14 +2745,14 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2741
2745
|
'systemInstruction',
|
|
2742
2746
|
]);
|
|
2743
2747
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
2744
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$
|
|
2748
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$3(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
2745
2749
|
}
|
|
2746
2750
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
2747
2751
|
if (parentObject !== undefined && fromTools != null) {
|
|
2748
2752
|
let transformedList = fromTools;
|
|
2749
2753
|
if (Array.isArray(transformedList)) {
|
|
2750
2754
|
transformedList = transformedList.map((item) => {
|
|
2751
|
-
return toolToMldev$
|
|
2755
|
+
return toolToMldev$3(apiClient, item);
|
|
2752
2756
|
});
|
|
2753
2757
|
}
|
|
2754
2758
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -2910,6 +2914,12 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
2910
2914
|
if (fromFileData != null) {
|
|
2911
2915
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$2(apiClient, fromFileData));
|
|
2912
2916
|
}
|
|
2917
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2918
|
+
'thoughtSignature',
|
|
2919
|
+
]);
|
|
2920
|
+
if (fromThoughtSignature != null) {
|
|
2921
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2922
|
+
}
|
|
2913
2923
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2914
2924
|
'codeExecutionResult',
|
|
2915
2925
|
]);
|
|
@@ -3077,6 +3087,10 @@ function googleMapsToVertex$2(apiClient, fromObject) {
|
|
|
3077
3087
|
}
|
|
3078
3088
|
return toObject;
|
|
3079
3089
|
}
|
|
3090
|
+
function urlContextToVertex$2() {
|
|
3091
|
+
const toObject = {};
|
|
3092
|
+
return toObject;
|
|
3093
|
+
}
|
|
3080
3094
|
function toolToVertex$2(apiClient, fromObject) {
|
|
3081
3095
|
const toObject = {};
|
|
3082
3096
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -3115,8 +3129,9 @@ function toolToVertex$2(apiClient, fromObject) {
|
|
|
3115
3129
|
if (fromGoogleMaps != null) {
|
|
3116
3130
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$2(apiClient, fromGoogleMaps));
|
|
3117
3131
|
}
|
|
3118
|
-
|
|
3119
|
-
|
|
3132
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
3133
|
+
if (fromUrlContext != null) {
|
|
3134
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
|
|
3120
3135
|
}
|
|
3121
3136
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3122
3137
|
'codeExecution',
|
|
@@ -4888,7 +4903,7 @@ class Files extends BaseModule {
|
|
|
4888
4903
|
* Copyright 2025 Google LLC
|
|
4889
4904
|
* SPDX-License-Identifier: Apache-2.0
|
|
4890
4905
|
*/
|
|
4891
|
-
function prebuiltVoiceConfigToMldev$
|
|
4906
|
+
function prebuiltVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4892
4907
|
const toObject = {};
|
|
4893
4908
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
4894
4909
|
if (fromVoiceName != null) {
|
|
@@ -4904,13 +4919,13 @@ function prebuiltVoiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
4904
4919
|
}
|
|
4905
4920
|
return toObject;
|
|
4906
4921
|
}
|
|
4907
|
-
function voiceConfigToMldev$
|
|
4922
|
+
function voiceConfigToMldev$2(apiClient, fromObject) {
|
|
4908
4923
|
const toObject = {};
|
|
4909
4924
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
4910
4925
|
'prebuiltVoiceConfig',
|
|
4911
4926
|
]);
|
|
4912
4927
|
if (fromPrebuiltVoiceConfig != null) {
|
|
4913
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$
|
|
4928
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$2(apiClient, fromPrebuiltVoiceConfig));
|
|
4914
4929
|
}
|
|
4915
4930
|
return toObject;
|
|
4916
4931
|
}
|
|
@@ -4924,7 +4939,7 @@ function voiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
4924
4939
|
}
|
|
4925
4940
|
return toObject;
|
|
4926
4941
|
}
|
|
4927
|
-
function speakerVoiceConfigToMldev$
|
|
4942
|
+
function speakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4928
4943
|
const toObject = {};
|
|
4929
4944
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
4930
4945
|
if (fromSpeaker != null) {
|
|
@@ -4932,11 +4947,11 @@ function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
4932
4947
|
}
|
|
4933
4948
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
4934
4949
|
if (fromVoiceConfig != null) {
|
|
4935
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
4950
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
4936
4951
|
}
|
|
4937
4952
|
return toObject;
|
|
4938
4953
|
}
|
|
4939
|
-
function multiSpeakerVoiceConfigToMldev$
|
|
4954
|
+
function multiSpeakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4940
4955
|
const toObject = {};
|
|
4941
4956
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
4942
4957
|
'speakerVoiceConfigs',
|
|
@@ -4945,24 +4960,24 @@ function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
4945
4960
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
4946
4961
|
if (Array.isArray(transformedList)) {
|
|
4947
4962
|
transformedList = transformedList.map((item) => {
|
|
4948
|
-
return speakerVoiceConfigToMldev$
|
|
4963
|
+
return speakerVoiceConfigToMldev$2(apiClient, item);
|
|
4949
4964
|
});
|
|
4950
4965
|
}
|
|
4951
4966
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
4952
4967
|
}
|
|
4953
4968
|
return toObject;
|
|
4954
4969
|
}
|
|
4955
|
-
function speechConfigToMldev$
|
|
4970
|
+
function speechConfigToMldev$2(apiClient, fromObject) {
|
|
4956
4971
|
const toObject = {};
|
|
4957
4972
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
4958
4973
|
if (fromVoiceConfig != null) {
|
|
4959
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
4974
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
4960
4975
|
}
|
|
4961
4976
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
4962
4977
|
'multiSpeakerVoiceConfig',
|
|
4963
4978
|
]);
|
|
4964
4979
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
4965
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$
|
|
4980
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$2(apiClient, fromMultiSpeakerVoiceConfig));
|
|
4966
4981
|
}
|
|
4967
4982
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
4968
4983
|
if (fromLanguageCode != null) {
|
|
@@ -4985,7 +5000,7 @@ function speechConfigToVertex$1(apiClient, fromObject) {
|
|
|
4985
5000
|
}
|
|
4986
5001
|
return toObject;
|
|
4987
5002
|
}
|
|
4988
|
-
function videoMetadataToMldev$
|
|
5003
|
+
function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
4989
5004
|
const toObject = {};
|
|
4990
5005
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
4991
5006
|
if (fromFps != null) {
|
|
@@ -5017,7 +5032,7 @@ function videoMetadataToVertex$1(apiClient, fromObject) {
|
|
|
5017
5032
|
}
|
|
5018
5033
|
return toObject;
|
|
5019
5034
|
}
|
|
5020
|
-
function blobToMldev$
|
|
5035
|
+
function blobToMldev$2(apiClient, fromObject) {
|
|
5021
5036
|
const toObject = {};
|
|
5022
5037
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5023
5038
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5048,7 +5063,7 @@ function blobToVertex$1(apiClient, fromObject) {
|
|
|
5048
5063
|
}
|
|
5049
5064
|
return toObject;
|
|
5050
5065
|
}
|
|
5051
|
-
function fileDataToMldev$
|
|
5066
|
+
function fileDataToMldev$2(apiClient, fromObject) {
|
|
5052
5067
|
const toObject = {};
|
|
5053
5068
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5054
5069
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5079,13 +5094,13 @@ function fileDataToVertex$1(apiClient, fromObject) {
|
|
|
5079
5094
|
}
|
|
5080
5095
|
return toObject;
|
|
5081
5096
|
}
|
|
5082
|
-
function partToMldev$
|
|
5097
|
+
function partToMldev$2(apiClient, fromObject) {
|
|
5083
5098
|
const toObject = {};
|
|
5084
5099
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
5085
5100
|
'videoMetadata',
|
|
5086
5101
|
]);
|
|
5087
5102
|
if (fromVideoMetadata != null) {
|
|
5088
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
5103
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$2(apiClient, fromVideoMetadata));
|
|
5089
5104
|
}
|
|
5090
5105
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
5091
5106
|
if (fromThought != null) {
|
|
@@ -5093,11 +5108,17 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
5093
5108
|
}
|
|
5094
5109
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5095
5110
|
if (fromInlineData != null) {
|
|
5096
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
5111
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
5097
5112
|
}
|
|
5098
5113
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
5099
5114
|
if (fromFileData != null) {
|
|
5100
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
5115
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
|
|
5116
|
+
}
|
|
5117
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5118
|
+
'thoughtSignature',
|
|
5119
|
+
]);
|
|
5120
|
+
if (fromThoughtSignature != null) {
|
|
5121
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5101
5122
|
}
|
|
5102
5123
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5103
5124
|
'codeExecutionResult',
|
|
@@ -5147,6 +5168,12 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5147
5168
|
if (fromFileData != null) {
|
|
5148
5169
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
|
|
5149
5170
|
}
|
|
5171
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5172
|
+
'thoughtSignature',
|
|
5173
|
+
]);
|
|
5174
|
+
if (fromThoughtSignature != null) {
|
|
5175
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5176
|
+
}
|
|
5150
5177
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5151
5178
|
'codeExecutionResult',
|
|
5152
5179
|
]);
|
|
@@ -5175,14 +5202,14 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5175
5202
|
}
|
|
5176
5203
|
return toObject;
|
|
5177
5204
|
}
|
|
5178
|
-
function contentToMldev$
|
|
5205
|
+
function contentToMldev$2(apiClient, fromObject) {
|
|
5179
5206
|
const toObject = {};
|
|
5180
5207
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5181
5208
|
if (fromParts != null) {
|
|
5182
5209
|
let transformedList = fromParts;
|
|
5183
5210
|
if (Array.isArray(transformedList)) {
|
|
5184
5211
|
transformedList = transformedList.map((item) => {
|
|
5185
|
-
return partToMldev$
|
|
5212
|
+
return partToMldev$2(apiClient, item);
|
|
5186
5213
|
});
|
|
5187
5214
|
}
|
|
5188
5215
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5211,7 +5238,7 @@ function contentToVertex$1(apiClient, fromObject) {
|
|
|
5211
5238
|
}
|
|
5212
5239
|
return toObject;
|
|
5213
5240
|
}
|
|
5214
|
-
function functionDeclarationToMldev$
|
|
5241
|
+
function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
5215
5242
|
const toObject = {};
|
|
5216
5243
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
5217
5244
|
if (fromBehavior != null) {
|
|
@@ -5258,7 +5285,7 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
|
5258
5285
|
}
|
|
5259
5286
|
return toObject;
|
|
5260
5287
|
}
|
|
5261
|
-
function intervalToMldev$
|
|
5288
|
+
function intervalToMldev$2(apiClient, fromObject) {
|
|
5262
5289
|
const toObject = {};
|
|
5263
5290
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
5264
5291
|
if (fromStartTime != null) {
|
|
@@ -5282,13 +5309,13 @@ function intervalToVertex$1(apiClient, fromObject) {
|
|
|
5282
5309
|
}
|
|
5283
5310
|
return toObject;
|
|
5284
5311
|
}
|
|
5285
|
-
function googleSearchToMldev$
|
|
5312
|
+
function googleSearchToMldev$2(apiClient, fromObject) {
|
|
5286
5313
|
const toObject = {};
|
|
5287
5314
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
5288
5315
|
'timeRangeFilter',
|
|
5289
5316
|
]);
|
|
5290
5317
|
if (fromTimeRangeFilter != null) {
|
|
5291
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
5318
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(apiClient, fromTimeRangeFilter));
|
|
5292
5319
|
}
|
|
5293
5320
|
return toObject;
|
|
5294
5321
|
}
|
|
@@ -5302,7 +5329,7 @@ function googleSearchToVertex$1(apiClient, fromObject) {
|
|
|
5302
5329
|
}
|
|
5303
5330
|
return toObject;
|
|
5304
5331
|
}
|
|
5305
|
-
function dynamicRetrievalConfigToMldev$
|
|
5332
|
+
function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
5306
5333
|
const toObject = {};
|
|
5307
5334
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5308
5335
|
if (fromMode != null) {
|
|
@@ -5330,13 +5357,13 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
|
5330
5357
|
}
|
|
5331
5358
|
return toObject;
|
|
5332
5359
|
}
|
|
5333
|
-
function googleSearchRetrievalToMldev$
|
|
5360
|
+
function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
|
|
5334
5361
|
const toObject = {};
|
|
5335
5362
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
5336
5363
|
'dynamicRetrievalConfig',
|
|
5337
5364
|
]);
|
|
5338
5365
|
if (fromDynamicRetrievalConfig != null) {
|
|
5339
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
5366
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
|
|
5340
5367
|
}
|
|
5341
5368
|
return toObject;
|
|
5342
5369
|
}
|
|
@@ -5402,11 +5429,15 @@ function googleMapsToVertex$1(apiClient, fromObject) {
|
|
|
5402
5429
|
}
|
|
5403
5430
|
return toObject;
|
|
5404
5431
|
}
|
|
5405
|
-
function urlContextToMldev$
|
|
5432
|
+
function urlContextToMldev$2() {
|
|
5406
5433
|
const toObject = {};
|
|
5407
5434
|
return toObject;
|
|
5408
5435
|
}
|
|
5409
|
-
function
|
|
5436
|
+
function urlContextToVertex$1() {
|
|
5437
|
+
const toObject = {};
|
|
5438
|
+
return toObject;
|
|
5439
|
+
}
|
|
5440
|
+
function toolToMldev$2(apiClient, fromObject) {
|
|
5410
5441
|
const toObject = {};
|
|
5411
5442
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5412
5443
|
'functionDeclarations',
|
|
@@ -5415,7 +5446,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5415
5446
|
let transformedList = fromFunctionDeclarations;
|
|
5416
5447
|
if (Array.isArray(transformedList)) {
|
|
5417
5448
|
transformedList = transformedList.map((item) => {
|
|
5418
|
-
return functionDeclarationToMldev$
|
|
5449
|
+
return functionDeclarationToMldev$2(apiClient, item);
|
|
5419
5450
|
});
|
|
5420
5451
|
}
|
|
5421
5452
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -5425,13 +5456,13 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5425
5456
|
}
|
|
5426
5457
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5427
5458
|
if (fromGoogleSearch != null) {
|
|
5428
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
5459
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(apiClient, fromGoogleSearch));
|
|
5429
5460
|
}
|
|
5430
5461
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5431
5462
|
'googleSearchRetrieval',
|
|
5432
5463
|
]);
|
|
5433
5464
|
if (fromGoogleSearchRetrieval != null) {
|
|
5434
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
5465
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
|
|
5435
5466
|
}
|
|
5436
5467
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5437
5468
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -5441,7 +5472,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5441
5472
|
}
|
|
5442
5473
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5443
5474
|
if (fromUrlContext != null) {
|
|
5444
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
5475
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
|
|
5445
5476
|
}
|
|
5446
5477
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5447
5478
|
'codeExecution',
|
|
@@ -5489,8 +5520,9 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
5489
5520
|
if (fromGoogleMaps != null) {
|
|
5490
5521
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$1(apiClient, fromGoogleMaps));
|
|
5491
5522
|
}
|
|
5492
|
-
|
|
5493
|
-
|
|
5523
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5524
|
+
if (fromUrlContext != null) {
|
|
5525
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
|
|
5494
5526
|
}
|
|
5495
5527
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5496
5528
|
'codeExecution',
|
|
@@ -5500,7 +5532,7 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
5500
5532
|
}
|
|
5501
5533
|
return toObject;
|
|
5502
5534
|
}
|
|
5503
|
-
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
5535
|
+
function sessionResumptionConfigToMldev$1(apiClient, fromObject) {
|
|
5504
5536
|
const toObject = {};
|
|
5505
5537
|
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
5506
5538
|
if (fromHandle != null) {
|
|
@@ -5523,7 +5555,7 @@ function sessionResumptionConfigToVertex(apiClient, fromObject) {
|
|
|
5523
5555
|
}
|
|
5524
5556
|
return toObject;
|
|
5525
5557
|
}
|
|
5526
|
-
function audioTranscriptionConfigToMldev() {
|
|
5558
|
+
function audioTranscriptionConfigToMldev$1() {
|
|
5527
5559
|
const toObject = {};
|
|
5528
5560
|
return toObject;
|
|
5529
5561
|
}
|
|
@@ -5531,7 +5563,7 @@ function audioTranscriptionConfigToVertex() {
|
|
|
5531
5563
|
const toObject = {};
|
|
5532
5564
|
return toObject;
|
|
5533
5565
|
}
|
|
5534
|
-
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
5566
|
+
function automaticActivityDetectionToMldev$1(apiClient, fromObject) {
|
|
5535
5567
|
const toObject = {};
|
|
5536
5568
|
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
5537
5569
|
if (fromDisabled != null) {
|
|
@@ -5595,13 +5627,13 @@ function automaticActivityDetectionToVertex(apiClient, fromObject) {
|
|
|
5595
5627
|
}
|
|
5596
5628
|
return toObject;
|
|
5597
5629
|
}
|
|
5598
|
-
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
5630
|
+
function realtimeInputConfigToMldev$1(apiClient, fromObject) {
|
|
5599
5631
|
const toObject = {};
|
|
5600
5632
|
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
5601
5633
|
'automaticActivityDetection',
|
|
5602
5634
|
]);
|
|
5603
5635
|
if (fromAutomaticActivityDetection != null) {
|
|
5604
|
-
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
5636
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev$1(apiClient, fromAutomaticActivityDetection));
|
|
5605
5637
|
}
|
|
5606
5638
|
const fromActivityHandling = getValueByPath(fromObject, [
|
|
5607
5639
|
'activityHandling',
|
|
@@ -5635,7 +5667,7 @@ function realtimeInputConfigToVertex(apiClient, fromObject) {
|
|
|
5635
5667
|
}
|
|
5636
5668
|
return toObject;
|
|
5637
5669
|
}
|
|
5638
|
-
function slidingWindowToMldev(apiClient, fromObject) {
|
|
5670
|
+
function slidingWindowToMldev$1(apiClient, fromObject) {
|
|
5639
5671
|
const toObject = {};
|
|
5640
5672
|
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
5641
5673
|
if (fromTargetTokens != null) {
|
|
@@ -5651,7 +5683,7 @@ function slidingWindowToVertex(apiClient, fromObject) {
|
|
|
5651
5683
|
}
|
|
5652
5684
|
return toObject;
|
|
5653
5685
|
}
|
|
5654
|
-
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
5686
|
+
function contextWindowCompressionConfigToMldev$1(apiClient, fromObject) {
|
|
5655
5687
|
const toObject = {};
|
|
5656
5688
|
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
5657
5689
|
'triggerTokens',
|
|
@@ -5663,7 +5695,7 @@ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
|
5663
5695
|
'slidingWindow',
|
|
5664
5696
|
]);
|
|
5665
5697
|
if (fromSlidingWindow != null) {
|
|
5666
|
-
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
5698
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev$1(apiClient, fromSlidingWindow));
|
|
5667
5699
|
}
|
|
5668
5700
|
return toObject;
|
|
5669
5701
|
}
|
|
@@ -5683,7 +5715,7 @@ function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
|
|
|
5683
5715
|
}
|
|
5684
5716
|
return toObject;
|
|
5685
5717
|
}
|
|
5686
|
-
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
5718
|
+
function proactivityConfigToMldev$1(apiClient, fromObject) {
|
|
5687
5719
|
const toObject = {};
|
|
5688
5720
|
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
5689
5721
|
'proactiveAudio',
|
|
@@ -5703,7 +5735,7 @@ function proactivityConfigToVertex(apiClient, fromObject) {
|
|
|
5703
5735
|
}
|
|
5704
5736
|
return toObject;
|
|
5705
5737
|
}
|
|
5706
|
-
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
5738
|
+
function liveConnectConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
5707
5739
|
const toObject = {};
|
|
5708
5740
|
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
5709
5741
|
'generationConfig',
|
|
@@ -5747,7 +5779,7 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5747
5779
|
}
|
|
5748
5780
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
5749
5781
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
5750
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$
|
|
5782
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$2(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
5751
5783
|
}
|
|
5752
5784
|
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
5753
5785
|
'enableAffectiveDialog',
|
|
@@ -5759,14 +5791,14 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5759
5791
|
'systemInstruction',
|
|
5760
5792
|
]);
|
|
5761
5793
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
5762
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$
|
|
5794
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
5763
5795
|
}
|
|
5764
5796
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5765
5797
|
if (parentObject !== undefined && fromTools != null) {
|
|
5766
5798
|
let transformedList = tTools(apiClient, fromTools);
|
|
5767
5799
|
if (Array.isArray(transformedList)) {
|
|
5768
5800
|
transformedList = transformedList.map((item) => {
|
|
5769
|
-
return toolToMldev$
|
|
5801
|
+
return toolToMldev$2(apiClient, tTool(apiClient, item));
|
|
5770
5802
|
});
|
|
5771
5803
|
}
|
|
5772
5804
|
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
@@ -5775,35 +5807,35 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5775
5807
|
'sessionResumption',
|
|
5776
5808
|
]);
|
|
5777
5809
|
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
5778
|
-
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
5810
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev$1(apiClient, fromSessionResumption));
|
|
5779
5811
|
}
|
|
5780
5812
|
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
5781
5813
|
'inputAudioTranscription',
|
|
5782
5814
|
]);
|
|
5783
5815
|
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
5784
|
-
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
5816
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
5785
5817
|
}
|
|
5786
5818
|
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
5787
5819
|
'outputAudioTranscription',
|
|
5788
5820
|
]);
|
|
5789
5821
|
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
5790
|
-
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
5822
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
5791
5823
|
}
|
|
5792
5824
|
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
5793
5825
|
'realtimeInputConfig',
|
|
5794
5826
|
]);
|
|
5795
5827
|
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
5796
|
-
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
5828
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev$1(apiClient, fromRealtimeInputConfig));
|
|
5797
5829
|
}
|
|
5798
5830
|
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
5799
5831
|
'contextWindowCompression',
|
|
5800
5832
|
]);
|
|
5801
5833
|
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
5802
|
-
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
5834
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev$1(apiClient, fromContextWindowCompression));
|
|
5803
5835
|
}
|
|
5804
5836
|
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
5805
5837
|
if (parentObject !== undefined && fromProactivity != null) {
|
|
5806
|
-
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
5838
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev$1(apiClient, fromProactivity));
|
|
5807
5839
|
}
|
|
5808
5840
|
return toObject;
|
|
5809
5841
|
}
|
|
@@ -5919,7 +5951,7 @@ function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
|
5919
5951
|
}
|
|
5920
5952
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5921
5953
|
if (fromConfig != null) {
|
|
5922
|
-
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
5954
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev$1(apiClient, fromConfig, toObject));
|
|
5923
5955
|
}
|
|
5924
5956
|
return toObject;
|
|
5925
5957
|
}
|
|
@@ -6274,6 +6306,12 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
6274
6306
|
if (fromFileData != null) {
|
|
6275
6307
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
|
|
6276
6308
|
}
|
|
6309
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6310
|
+
'thoughtSignature',
|
|
6311
|
+
]);
|
|
6312
|
+
if (fromThoughtSignature != null) {
|
|
6313
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6314
|
+
}
|
|
6277
6315
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6278
6316
|
'codeExecutionResult',
|
|
6279
6317
|
]);
|
|
@@ -6322,6 +6360,12 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
6322
6360
|
if (fromFileData != null) {
|
|
6323
6361
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
|
|
6324
6362
|
}
|
|
6363
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6364
|
+
'thoughtSignature',
|
|
6365
|
+
]);
|
|
6366
|
+
if (fromThoughtSignature != null) {
|
|
6367
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6368
|
+
}
|
|
6325
6369
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6326
6370
|
'codeExecutionResult',
|
|
6327
6371
|
]);
|
|
@@ -7112,7 +7156,7 @@ function liveMusicServerMessageFromMldev(apiClient, fromObject) {
|
|
|
7112
7156
|
* Copyright 2025 Google LLC
|
|
7113
7157
|
* SPDX-License-Identifier: Apache-2.0
|
|
7114
7158
|
*/
|
|
7115
|
-
function videoMetadataToMldev(apiClient, fromObject) {
|
|
7159
|
+
function videoMetadataToMldev$1(apiClient, fromObject) {
|
|
7116
7160
|
const toObject = {};
|
|
7117
7161
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
7118
7162
|
if (fromFps != null) {
|
|
@@ -7128,7 +7172,7 @@ function videoMetadataToMldev(apiClient, fromObject) {
|
|
|
7128
7172
|
}
|
|
7129
7173
|
return toObject;
|
|
7130
7174
|
}
|
|
7131
|
-
function blobToMldev(apiClient, fromObject) {
|
|
7175
|
+
function blobToMldev$1(apiClient, fromObject) {
|
|
7132
7176
|
const toObject = {};
|
|
7133
7177
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7134
7178
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7143,7 +7187,7 @@ function blobToMldev(apiClient, fromObject) {
|
|
|
7143
7187
|
}
|
|
7144
7188
|
return toObject;
|
|
7145
7189
|
}
|
|
7146
|
-
function fileDataToMldev(apiClient, fromObject) {
|
|
7190
|
+
function fileDataToMldev$1(apiClient, fromObject) {
|
|
7147
7191
|
const toObject = {};
|
|
7148
7192
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7149
7193
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7158,13 +7202,13 @@ function fileDataToMldev(apiClient, fromObject) {
|
|
|
7158
7202
|
}
|
|
7159
7203
|
return toObject;
|
|
7160
7204
|
}
|
|
7161
|
-
function partToMldev(apiClient, fromObject) {
|
|
7205
|
+
function partToMldev$1(apiClient, fromObject) {
|
|
7162
7206
|
const toObject = {};
|
|
7163
7207
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
7164
7208
|
'videoMetadata',
|
|
7165
7209
|
]);
|
|
7166
7210
|
if (fromVideoMetadata != null) {
|
|
7167
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
7211
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$1(apiClient, fromVideoMetadata));
|
|
7168
7212
|
}
|
|
7169
7213
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
7170
7214
|
if (fromThought != null) {
|
|
@@ -7172,11 +7216,17 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7172
7216
|
}
|
|
7173
7217
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7174
7218
|
if (fromInlineData != null) {
|
|
7175
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
7219
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
7176
7220
|
}
|
|
7177
7221
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
7178
7222
|
if (fromFileData != null) {
|
|
7179
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
7223
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
|
|
7224
|
+
}
|
|
7225
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
7226
|
+
'thoughtSignature',
|
|
7227
|
+
]);
|
|
7228
|
+
if (fromThoughtSignature != null) {
|
|
7229
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7180
7230
|
}
|
|
7181
7231
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7182
7232
|
'codeExecutionResult',
|
|
@@ -7206,14 +7256,14 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7206
7256
|
}
|
|
7207
7257
|
return toObject;
|
|
7208
7258
|
}
|
|
7209
|
-
function contentToMldev(apiClient, fromObject) {
|
|
7259
|
+
function contentToMldev$1(apiClient, fromObject) {
|
|
7210
7260
|
const toObject = {};
|
|
7211
7261
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7212
7262
|
if (fromParts != null) {
|
|
7213
7263
|
let transformedList = fromParts;
|
|
7214
7264
|
if (Array.isArray(transformedList)) {
|
|
7215
7265
|
transformedList = transformedList.map((item) => {
|
|
7216
|
-
return partToMldev(apiClient, item);
|
|
7266
|
+
return partToMldev$1(apiClient, item);
|
|
7217
7267
|
});
|
|
7218
7268
|
}
|
|
7219
7269
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -7337,7 +7387,7 @@ function safetySettingToMldev(apiClient, fromObject) {
|
|
|
7337
7387
|
}
|
|
7338
7388
|
return toObject;
|
|
7339
7389
|
}
|
|
7340
|
-
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
7390
|
+
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
7341
7391
|
const toObject = {};
|
|
7342
7392
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
7343
7393
|
if (fromBehavior != null) {
|
|
@@ -7361,7 +7411,7 @@ function functionDeclarationToMldev(apiClient, fromObject) {
|
|
|
7361
7411
|
}
|
|
7362
7412
|
return toObject;
|
|
7363
7413
|
}
|
|
7364
|
-
function intervalToMldev(apiClient, fromObject) {
|
|
7414
|
+
function intervalToMldev$1(apiClient, fromObject) {
|
|
7365
7415
|
const toObject = {};
|
|
7366
7416
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
7367
7417
|
if (fromStartTime != null) {
|
|
@@ -7373,17 +7423,17 @@ function intervalToMldev(apiClient, fromObject) {
|
|
|
7373
7423
|
}
|
|
7374
7424
|
return toObject;
|
|
7375
7425
|
}
|
|
7376
|
-
function googleSearchToMldev(apiClient, fromObject) {
|
|
7426
|
+
function googleSearchToMldev$1(apiClient, fromObject) {
|
|
7377
7427
|
const toObject = {};
|
|
7378
7428
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
7379
7429
|
'timeRangeFilter',
|
|
7380
7430
|
]);
|
|
7381
7431
|
if (fromTimeRangeFilter != null) {
|
|
7382
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
7432
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(apiClient, fromTimeRangeFilter));
|
|
7383
7433
|
}
|
|
7384
7434
|
return toObject;
|
|
7385
7435
|
}
|
|
7386
|
-
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
7436
|
+
function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
7387
7437
|
const toObject = {};
|
|
7388
7438
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
7389
7439
|
if (fromMode != null) {
|
|
@@ -7397,21 +7447,21 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
|
7397
7447
|
}
|
|
7398
7448
|
return toObject;
|
|
7399
7449
|
}
|
|
7400
|
-
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
7450
|
+
function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
7401
7451
|
const toObject = {};
|
|
7402
7452
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
7403
7453
|
'dynamicRetrievalConfig',
|
|
7404
7454
|
]);
|
|
7405
7455
|
if (fromDynamicRetrievalConfig != null) {
|
|
7406
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
7456
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
|
|
7407
7457
|
}
|
|
7408
7458
|
return toObject;
|
|
7409
7459
|
}
|
|
7410
|
-
function urlContextToMldev() {
|
|
7460
|
+
function urlContextToMldev$1() {
|
|
7411
7461
|
const toObject = {};
|
|
7412
7462
|
return toObject;
|
|
7413
7463
|
}
|
|
7414
|
-
function toolToMldev(apiClient, fromObject) {
|
|
7464
|
+
function toolToMldev$1(apiClient, fromObject) {
|
|
7415
7465
|
const toObject = {};
|
|
7416
7466
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7417
7467
|
'functionDeclarations',
|
|
@@ -7420,7 +7470,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7420
7470
|
let transformedList = fromFunctionDeclarations;
|
|
7421
7471
|
if (Array.isArray(transformedList)) {
|
|
7422
7472
|
transformedList = transformedList.map((item) => {
|
|
7423
|
-
return functionDeclarationToMldev(apiClient, item);
|
|
7473
|
+
return functionDeclarationToMldev$1(apiClient, item);
|
|
7424
7474
|
});
|
|
7425
7475
|
}
|
|
7426
7476
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -7430,13 +7480,13 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7430
7480
|
}
|
|
7431
7481
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
7432
7482
|
if (fromGoogleSearch != null) {
|
|
7433
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
7483
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(apiClient, fromGoogleSearch));
|
|
7434
7484
|
}
|
|
7435
7485
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7436
7486
|
'googleSearchRetrieval',
|
|
7437
7487
|
]);
|
|
7438
7488
|
if (fromGoogleSearchRetrieval != null) {
|
|
7439
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
7489
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
|
|
7440
7490
|
}
|
|
7441
7491
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
7442
7492
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -7446,7 +7496,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7446
7496
|
}
|
|
7447
7497
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
7448
7498
|
if (fromUrlContext != null) {
|
|
7449
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
7499
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
|
|
7450
7500
|
}
|
|
7451
7501
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
7452
7502
|
'codeExecution',
|
|
@@ -7510,7 +7560,7 @@ function toolConfigToMldev(apiClient, fromObject) {
|
|
|
7510
7560
|
}
|
|
7511
7561
|
return toObject;
|
|
7512
7562
|
}
|
|
7513
|
-
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
7563
|
+
function prebuiltVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7514
7564
|
const toObject = {};
|
|
7515
7565
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
7516
7566
|
if (fromVoiceName != null) {
|
|
@@ -7518,17 +7568,17 @@ function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7518
7568
|
}
|
|
7519
7569
|
return toObject;
|
|
7520
7570
|
}
|
|
7521
|
-
function voiceConfigToMldev(apiClient, fromObject) {
|
|
7571
|
+
function voiceConfigToMldev$1(apiClient, fromObject) {
|
|
7522
7572
|
const toObject = {};
|
|
7523
7573
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
7524
7574
|
'prebuiltVoiceConfig',
|
|
7525
7575
|
]);
|
|
7526
7576
|
if (fromPrebuiltVoiceConfig != null) {
|
|
7527
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
7577
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$1(apiClient, fromPrebuiltVoiceConfig));
|
|
7528
7578
|
}
|
|
7529
7579
|
return toObject;
|
|
7530
7580
|
}
|
|
7531
|
-
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
7581
|
+
function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7532
7582
|
const toObject = {};
|
|
7533
7583
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
7534
7584
|
if (fromSpeaker != null) {
|
|
@@ -7536,11 +7586,11 @@ function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7536
7586
|
}
|
|
7537
7587
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7538
7588
|
if (fromVoiceConfig != null) {
|
|
7539
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
7589
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
7540
7590
|
}
|
|
7541
7591
|
return toObject;
|
|
7542
7592
|
}
|
|
7543
|
-
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
7593
|
+
function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7544
7594
|
const toObject = {};
|
|
7545
7595
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
7546
7596
|
'speakerVoiceConfigs',
|
|
@@ -7549,24 +7599,24 @@ function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7549
7599
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
7550
7600
|
if (Array.isArray(transformedList)) {
|
|
7551
7601
|
transformedList = transformedList.map((item) => {
|
|
7552
|
-
return speakerVoiceConfigToMldev(apiClient, item);
|
|
7602
|
+
return speakerVoiceConfigToMldev$1(apiClient, item);
|
|
7553
7603
|
});
|
|
7554
7604
|
}
|
|
7555
7605
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
7556
7606
|
}
|
|
7557
7607
|
return toObject;
|
|
7558
7608
|
}
|
|
7559
|
-
function speechConfigToMldev(apiClient, fromObject) {
|
|
7609
|
+
function speechConfigToMldev$1(apiClient, fromObject) {
|
|
7560
7610
|
const toObject = {};
|
|
7561
7611
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7562
7612
|
if (fromVoiceConfig != null) {
|
|
7563
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
7613
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
7564
7614
|
}
|
|
7565
7615
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
7566
7616
|
'multiSpeakerVoiceConfig',
|
|
7567
7617
|
]);
|
|
7568
7618
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
7569
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
7619
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$1(apiClient, fromMultiSpeakerVoiceConfig));
|
|
7570
7620
|
}
|
|
7571
7621
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
7572
7622
|
if (fromLanguageCode != null) {
|
|
@@ -7596,7 +7646,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7596
7646
|
'systemInstruction',
|
|
7597
7647
|
]);
|
|
7598
7648
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
7599
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
7649
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
7600
7650
|
}
|
|
7601
7651
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
7602
7652
|
if (fromTemperature != null) {
|
|
@@ -7689,7 +7739,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7689
7739
|
let transformedList = tTools(apiClient, fromTools);
|
|
7690
7740
|
if (Array.isArray(transformedList)) {
|
|
7691
7741
|
transformedList = transformedList.map((item) => {
|
|
7692
|
-
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
7742
|
+
return toolToMldev$1(apiClient, tTool(apiClient, item));
|
|
7693
7743
|
});
|
|
7694
7744
|
}
|
|
7695
7745
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -7721,7 +7771,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7721
7771
|
}
|
|
7722
7772
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
7723
7773
|
if (fromSpeechConfig != null) {
|
|
7724
|
-
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
7774
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$1(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
7725
7775
|
}
|
|
7726
7776
|
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
7727
7777
|
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
@@ -7745,7 +7795,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
|
|
|
7745
7795
|
let transformedList = tContents(apiClient, fromContents);
|
|
7746
7796
|
if (Array.isArray(transformedList)) {
|
|
7747
7797
|
transformedList = transformedList.map((item) => {
|
|
7748
|
-
return contentToMldev(apiClient, item);
|
|
7798
|
+
return contentToMldev$1(apiClient, item);
|
|
7749
7799
|
});
|
|
7750
7800
|
}
|
|
7751
7801
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -7997,7 +8047,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
|
|
|
7997
8047
|
let transformedList = tContents(apiClient, fromContents);
|
|
7998
8048
|
if (Array.isArray(transformedList)) {
|
|
7999
8049
|
transformedList = transformedList.map((item) => {
|
|
8000
|
-
return contentToMldev(apiClient, item);
|
|
8050
|
+
return contentToMldev$1(apiClient, item);
|
|
8001
8051
|
});
|
|
8002
8052
|
}
|
|
8003
8053
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8068,8 +8118,11 @@ function generateVideosConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8068
8118
|
if (parentObject !== undefined && fromNegativePrompt != null) {
|
|
8069
8119
|
setValueByPath(parentObject, ['parameters', 'negativePrompt'], fromNegativePrompt);
|
|
8070
8120
|
}
|
|
8071
|
-
|
|
8072
|
-
|
|
8121
|
+
const fromEnhancePrompt = getValueByPath(fromObject, [
|
|
8122
|
+
'enhancePrompt',
|
|
8123
|
+
]);
|
|
8124
|
+
if (parentObject !== undefined && fromEnhancePrompt != null) {
|
|
8125
|
+
setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
|
|
8073
8126
|
}
|
|
8074
8127
|
if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
|
|
8075
8128
|
throw new Error('generateAudio parameter is not supported in Gemini API.');
|
|
@@ -8164,6 +8217,12 @@ function partToVertex(apiClient, fromObject) {
|
|
|
8164
8217
|
if (fromFileData != null) {
|
|
8165
8218
|
setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
|
|
8166
8219
|
}
|
|
8220
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
8221
|
+
'thoughtSignature',
|
|
8222
|
+
]);
|
|
8223
|
+
if (fromThoughtSignature != null) {
|
|
8224
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8225
|
+
}
|
|
8167
8226
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8168
8227
|
'codeExecutionResult',
|
|
8169
8228
|
]);
|
|
@@ -8455,6 +8514,10 @@ function googleMapsToVertex(apiClient, fromObject) {
|
|
|
8455
8514
|
}
|
|
8456
8515
|
return toObject;
|
|
8457
8516
|
}
|
|
8517
|
+
function urlContextToVertex() {
|
|
8518
|
+
const toObject = {};
|
|
8519
|
+
return toObject;
|
|
8520
|
+
}
|
|
8458
8521
|
function toolToVertex(apiClient, fromObject) {
|
|
8459
8522
|
const toObject = {};
|
|
8460
8523
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -8493,8 +8556,9 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
8493
8556
|
if (fromGoogleMaps != null) {
|
|
8494
8557
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex(apiClient, fromGoogleMaps));
|
|
8495
8558
|
}
|
|
8496
|
-
|
|
8497
|
-
|
|
8559
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
8560
|
+
if (fromUrlContext != null) {
|
|
8561
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex());
|
|
8498
8562
|
}
|
|
8499
8563
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8500
8564
|
'codeExecution',
|
|
@@ -9501,6 +9565,12 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
9501
9565
|
if (fromFileData != null) {
|
|
9502
9566
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
|
|
9503
9567
|
}
|
|
9568
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
9569
|
+
'thoughtSignature',
|
|
9570
|
+
]);
|
|
9571
|
+
if (fromThoughtSignature != null) {
|
|
9572
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9573
|
+
}
|
|
9504
9574
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9505
9575
|
'codeExecutionResult',
|
|
9506
9576
|
]);
|
|
@@ -10019,6 +10089,12 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
10019
10089
|
if (fromFileData != null) {
|
|
10020
10090
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
|
|
10021
10091
|
}
|
|
10092
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
10093
|
+
'thoughtSignature',
|
|
10094
|
+
]);
|
|
10095
|
+
if (fromThoughtSignature != null) {
|
|
10096
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10097
|
+
}
|
|
10022
10098
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10023
10099
|
'codeExecutionResult',
|
|
10024
10100
|
]);
|
|
@@ -10073,6 +10149,34 @@ function citationMetadataFromVertex(apiClient, fromObject) {
|
|
|
10073
10149
|
}
|
|
10074
10150
|
return toObject;
|
|
10075
10151
|
}
|
|
10152
|
+
function urlMetadataFromVertex(apiClient, fromObject) {
|
|
10153
|
+
const toObject = {};
|
|
10154
|
+
const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
|
|
10155
|
+
if (fromRetrievedUrl != null) {
|
|
10156
|
+
setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
|
|
10157
|
+
}
|
|
10158
|
+
const fromUrlRetrievalStatus = getValueByPath(fromObject, [
|
|
10159
|
+
'urlRetrievalStatus',
|
|
10160
|
+
]);
|
|
10161
|
+
if (fromUrlRetrievalStatus != null) {
|
|
10162
|
+
setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
|
|
10163
|
+
}
|
|
10164
|
+
return toObject;
|
|
10165
|
+
}
|
|
10166
|
+
function urlContextMetadataFromVertex(apiClient, fromObject) {
|
|
10167
|
+
const toObject = {};
|
|
10168
|
+
const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
|
|
10169
|
+
if (fromUrlMetadata != null) {
|
|
10170
|
+
let transformedList = fromUrlMetadata;
|
|
10171
|
+
if (Array.isArray(transformedList)) {
|
|
10172
|
+
transformedList = transformedList.map((item) => {
|
|
10173
|
+
return urlMetadataFromVertex(apiClient, item);
|
|
10174
|
+
});
|
|
10175
|
+
}
|
|
10176
|
+
setValueByPath(toObject, ['urlMetadata'], transformedList);
|
|
10177
|
+
}
|
|
10178
|
+
return toObject;
|
|
10179
|
+
}
|
|
10076
10180
|
function candidateFromVertex(apiClient, fromObject) {
|
|
10077
10181
|
const toObject = {};
|
|
10078
10182
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
@@ -10095,6 +10199,12 @@ function candidateFromVertex(apiClient, fromObject) {
|
|
|
10095
10199
|
if (fromFinishReason != null) {
|
|
10096
10200
|
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
10097
10201
|
}
|
|
10202
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
10203
|
+
'urlContextMetadata',
|
|
10204
|
+
]);
|
|
10205
|
+
if (fromUrlContextMetadata != null) {
|
|
10206
|
+
setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromVertex(apiClient, fromUrlContextMetadata));
|
|
10207
|
+
}
|
|
10098
10208
|
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
10099
10209
|
if (fromAvgLogprobs != null) {
|
|
10100
10210
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
@@ -10561,7 +10671,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10561
10671
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10562
10672
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10563
10673
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10564
|
-
const SDK_VERSION = '1.
|
|
10674
|
+
const SDK_VERSION = '1.4.0'; // x-release-please-version
|
|
10565
10675
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10566
10676
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10567
10677
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11113,11 +11223,9 @@ function hasNonMcpTools(params) {
|
|
|
11113
11223
|
}
|
|
11114
11224
|
// Returns true if the object is a MCP CallableTool, otherwise false.
|
|
11115
11225
|
function isMcpCallableTool(object) {
|
|
11116
|
-
// TODO: b/418266406 - Add a more robust check for the MCP CallableTool.
|
|
11117
11226
|
return (object !== null &&
|
|
11118
11227
|
typeof object === 'object' &&
|
|
11119
|
-
|
|
11120
|
-
'callTool' in object);
|
|
11228
|
+
object instanceof McpCallableTool);
|
|
11121
11229
|
}
|
|
11122
11230
|
// List all tools from the MCP client.
|
|
11123
11231
|
function listAllTools(mcpClient, maxTools = 100) {
|
|
@@ -11597,7 +11705,14 @@ class Live {
|
|
|
11597
11705
|
}
|
|
11598
11706
|
else {
|
|
11599
11707
|
const apiKey = this.apiClient.getApiKey();
|
|
11600
|
-
|
|
11708
|
+
let method = 'BidiGenerateContent';
|
|
11709
|
+
let keyName = 'key';
|
|
11710
|
+
if (apiKey === null || apiKey === void 0 ? void 0 : apiKey.startsWith('auth_tokens/')) {
|
|
11711
|
+
console.warn('Warning: Ephemeral token support is experimental and may change in future versions.');
|
|
11712
|
+
method = 'BidiGenerateContentConstrained';
|
|
11713
|
+
keyName = 'access_token';
|
|
11714
|
+
}
|
|
11715
|
+
url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.${method}?${keyName}=${apiKey}`;
|
|
11601
11716
|
}
|
|
11602
11717
|
let onopenResolve = () => { };
|
|
11603
11718
|
const onopenPromise = new Promise((resolve) => {
|
|
@@ -11703,7 +11818,7 @@ class Session {
|
|
|
11703
11818
|
contents = contents.map((item) => contentToVertex(apiClient, item));
|
|
11704
11819
|
}
|
|
11705
11820
|
else {
|
|
11706
|
-
contents = contents.map((item) => contentToMldev(apiClient, item));
|
|
11821
|
+
contents = contents.map((item) => contentToMldev$1(apiClient, item));
|
|
11707
11822
|
}
|
|
11708
11823
|
}
|
|
11709
11824
|
catch (_a) {
|
|
@@ -12001,7 +12116,6 @@ class Models extends BaseModule {
|
|
|
12001
12116
|
if (!hasMcpClientTools(params) || shouldDisableAfc(params.config)) {
|
|
12002
12117
|
return await this.generateContentInternal(transformedParams);
|
|
12003
12118
|
}
|
|
12004
|
-
// TODO: b/418266406 - Improve the check for CallableTools and Tools.
|
|
12005
12119
|
if (hasNonMcpTools(params)) {
|
|
12006
12120
|
throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
|
|
12007
12121
|
}
|
|
@@ -13556,23 +13670,861 @@ class Operations extends BaseModule {
|
|
|
13556
13670
|
* Copyright 2025 Google LLC
|
|
13557
13671
|
* SPDX-License-Identifier: Apache-2.0
|
|
13558
13672
|
*/
|
|
13559
|
-
|
|
13560
|
-
const
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
this.apiKey = opts.apiKey;
|
|
13565
|
-
return;
|
|
13566
|
-
}
|
|
13567
|
-
const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
|
|
13568
|
-
this.googleAuth = new GoogleAuth(vertexAuthOptions);
|
|
13673
|
+
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
13674
|
+
const toObject = {};
|
|
13675
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
13676
|
+
if (fromVoiceName != null) {
|
|
13677
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
13569
13678
|
}
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13679
|
+
return toObject;
|
|
13680
|
+
}
|
|
13681
|
+
function voiceConfigToMldev(apiClient, fromObject) {
|
|
13682
|
+
const toObject = {};
|
|
13683
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
13684
|
+
'prebuiltVoiceConfig',
|
|
13685
|
+
]);
|
|
13686
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
13687
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
13688
|
+
}
|
|
13689
|
+
return toObject;
|
|
13690
|
+
}
|
|
13691
|
+
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13692
|
+
const toObject = {};
|
|
13693
|
+
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
13694
|
+
if (fromSpeaker != null) {
|
|
13695
|
+
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
13696
|
+
}
|
|
13697
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13698
|
+
if (fromVoiceConfig != null) {
|
|
13699
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13700
|
+
}
|
|
13701
|
+
return toObject;
|
|
13702
|
+
}
|
|
13703
|
+
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13704
|
+
const toObject = {};
|
|
13705
|
+
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
13706
|
+
'speakerVoiceConfigs',
|
|
13707
|
+
]);
|
|
13708
|
+
if (fromSpeakerVoiceConfigs != null) {
|
|
13709
|
+
let transformedList = fromSpeakerVoiceConfigs;
|
|
13710
|
+
if (Array.isArray(transformedList)) {
|
|
13711
|
+
transformedList = transformedList.map((item) => {
|
|
13712
|
+
return speakerVoiceConfigToMldev(apiClient, item);
|
|
13713
|
+
});
|
|
13714
|
+
}
|
|
13715
|
+
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
13716
|
+
}
|
|
13717
|
+
return toObject;
|
|
13718
|
+
}
|
|
13719
|
+
function speechConfigToMldev(apiClient, fromObject) {
|
|
13720
|
+
const toObject = {};
|
|
13721
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13722
|
+
if (fromVoiceConfig != null) {
|
|
13723
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13724
|
+
}
|
|
13725
|
+
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
13726
|
+
'multiSpeakerVoiceConfig',
|
|
13727
|
+
]);
|
|
13728
|
+
if (fromMultiSpeakerVoiceConfig != null) {
|
|
13729
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
13730
|
+
}
|
|
13731
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
13732
|
+
if (fromLanguageCode != null) {
|
|
13733
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
13734
|
+
}
|
|
13735
|
+
return toObject;
|
|
13736
|
+
}
|
|
13737
|
+
function videoMetadataToMldev(apiClient, fromObject) {
|
|
13738
|
+
const toObject = {};
|
|
13739
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
13740
|
+
if (fromFps != null) {
|
|
13741
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
13742
|
+
}
|
|
13743
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
13744
|
+
if (fromEndOffset != null) {
|
|
13745
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
13746
|
+
}
|
|
13747
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
13748
|
+
if (fromStartOffset != null) {
|
|
13749
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
13750
|
+
}
|
|
13751
|
+
return toObject;
|
|
13752
|
+
}
|
|
13753
|
+
function blobToMldev(apiClient, fromObject) {
|
|
13754
|
+
const toObject = {};
|
|
13755
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13756
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13757
|
+
}
|
|
13758
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
13759
|
+
if (fromData != null) {
|
|
13760
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
13761
|
+
}
|
|
13762
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13763
|
+
if (fromMimeType != null) {
|
|
13764
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13765
|
+
}
|
|
13766
|
+
return toObject;
|
|
13767
|
+
}
|
|
13768
|
+
function fileDataToMldev(apiClient, fromObject) {
|
|
13769
|
+
const toObject = {};
|
|
13770
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13771
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13772
|
+
}
|
|
13773
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
13774
|
+
if (fromFileUri != null) {
|
|
13775
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
13776
|
+
}
|
|
13777
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13778
|
+
if (fromMimeType != null) {
|
|
13779
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13780
|
+
}
|
|
13781
|
+
return toObject;
|
|
13782
|
+
}
|
|
13783
|
+
function partToMldev(apiClient, fromObject) {
|
|
13784
|
+
const toObject = {};
|
|
13785
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
13786
|
+
'videoMetadata',
|
|
13787
|
+
]);
|
|
13788
|
+
if (fromVideoMetadata != null) {
|
|
13789
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
13790
|
+
}
|
|
13791
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
13792
|
+
if (fromThought != null) {
|
|
13793
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
13794
|
+
}
|
|
13795
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
13796
|
+
if (fromInlineData != null) {
|
|
13797
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
13798
|
+
}
|
|
13799
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
13800
|
+
if (fromFileData != null) {
|
|
13801
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
13802
|
+
}
|
|
13803
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
13804
|
+
'thoughtSignature',
|
|
13805
|
+
]);
|
|
13806
|
+
if (fromThoughtSignature != null) {
|
|
13807
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13808
|
+
}
|
|
13809
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13810
|
+
'codeExecutionResult',
|
|
13811
|
+
]);
|
|
13812
|
+
if (fromCodeExecutionResult != null) {
|
|
13813
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
13814
|
+
}
|
|
13815
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
13816
|
+
'executableCode',
|
|
13817
|
+
]);
|
|
13818
|
+
if (fromExecutableCode != null) {
|
|
13819
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13820
|
+
}
|
|
13821
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13822
|
+
if (fromFunctionCall != null) {
|
|
13823
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13824
|
+
}
|
|
13825
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13826
|
+
'functionResponse',
|
|
13827
|
+
]);
|
|
13828
|
+
if (fromFunctionResponse != null) {
|
|
13829
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
13830
|
+
}
|
|
13831
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
13832
|
+
if (fromText != null) {
|
|
13833
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
13834
|
+
}
|
|
13835
|
+
return toObject;
|
|
13836
|
+
}
|
|
13837
|
+
function contentToMldev(apiClient, fromObject) {
|
|
13838
|
+
const toObject = {};
|
|
13839
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13840
|
+
if (fromParts != null) {
|
|
13841
|
+
let transformedList = fromParts;
|
|
13842
|
+
if (Array.isArray(transformedList)) {
|
|
13843
|
+
transformedList = transformedList.map((item) => {
|
|
13844
|
+
return partToMldev(apiClient, item);
|
|
13845
|
+
});
|
|
13846
|
+
}
|
|
13847
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
13848
|
+
}
|
|
13849
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
13850
|
+
if (fromRole != null) {
|
|
13851
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
13852
|
+
}
|
|
13853
|
+
return toObject;
|
|
13854
|
+
}
|
|
13855
|
+
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
13856
|
+
const toObject = {};
|
|
13857
|
+
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
13858
|
+
if (fromBehavior != null) {
|
|
13859
|
+
setValueByPath(toObject, ['behavior'], fromBehavior);
|
|
13860
|
+
}
|
|
13861
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
13862
|
+
if (fromDescription != null) {
|
|
13863
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
13864
|
+
}
|
|
13865
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13866
|
+
if (fromName != null) {
|
|
13867
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13868
|
+
}
|
|
13869
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
13870
|
+
if (fromParameters != null) {
|
|
13871
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
13872
|
+
}
|
|
13873
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
13874
|
+
if (fromResponse != null) {
|
|
13875
|
+
setValueByPath(toObject, ['response'], fromResponse);
|
|
13876
|
+
}
|
|
13877
|
+
return toObject;
|
|
13878
|
+
}
|
|
13879
|
+
function intervalToMldev(apiClient, fromObject) {
|
|
13880
|
+
const toObject = {};
|
|
13881
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
13882
|
+
if (fromStartTime != null) {
|
|
13883
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
13884
|
+
}
|
|
13885
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
13886
|
+
if (fromEndTime != null) {
|
|
13887
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
13888
|
+
}
|
|
13889
|
+
return toObject;
|
|
13890
|
+
}
|
|
13891
|
+
function googleSearchToMldev(apiClient, fromObject) {
|
|
13892
|
+
const toObject = {};
|
|
13893
|
+
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
13894
|
+
'timeRangeFilter',
|
|
13895
|
+
]);
|
|
13896
|
+
if (fromTimeRangeFilter != null) {
|
|
13897
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
13898
|
+
}
|
|
13899
|
+
return toObject;
|
|
13900
|
+
}
|
|
13901
|
+
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
13902
|
+
const toObject = {};
|
|
13903
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
13904
|
+
if (fromMode != null) {
|
|
13905
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
13906
|
+
}
|
|
13907
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
13908
|
+
'dynamicThreshold',
|
|
13909
|
+
]);
|
|
13910
|
+
if (fromDynamicThreshold != null) {
|
|
13911
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
13912
|
+
}
|
|
13913
|
+
return toObject;
|
|
13914
|
+
}
|
|
13915
|
+
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
13916
|
+
const toObject = {};
|
|
13917
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
13918
|
+
'dynamicRetrievalConfig',
|
|
13919
|
+
]);
|
|
13920
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
13921
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
13922
|
+
}
|
|
13923
|
+
return toObject;
|
|
13924
|
+
}
|
|
13925
|
+
function urlContextToMldev() {
|
|
13926
|
+
const toObject = {};
|
|
13927
|
+
return toObject;
|
|
13928
|
+
}
|
|
13929
|
+
function toolToMldev(apiClient, fromObject) {
|
|
13930
|
+
const toObject = {};
|
|
13931
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
13932
|
+
'functionDeclarations',
|
|
13933
|
+
]);
|
|
13934
|
+
if (fromFunctionDeclarations != null) {
|
|
13935
|
+
let transformedList = fromFunctionDeclarations;
|
|
13936
|
+
if (Array.isArray(transformedList)) {
|
|
13937
|
+
transformedList = transformedList.map((item) => {
|
|
13938
|
+
return functionDeclarationToMldev(apiClient, item);
|
|
13939
|
+
});
|
|
13940
|
+
}
|
|
13941
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
13942
|
+
}
|
|
13943
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
13944
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
13945
|
+
}
|
|
13946
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
13947
|
+
if (fromGoogleSearch != null) {
|
|
13948
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
13949
|
+
}
|
|
13950
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
13951
|
+
'googleSearchRetrieval',
|
|
13952
|
+
]);
|
|
13953
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
13954
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
13955
|
+
}
|
|
13956
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
13957
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
13958
|
+
}
|
|
13959
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
13960
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
13961
|
+
}
|
|
13962
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
13963
|
+
if (fromUrlContext != null) {
|
|
13964
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
13965
|
+
}
|
|
13966
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
13967
|
+
'codeExecution',
|
|
13968
|
+
]);
|
|
13969
|
+
if (fromCodeExecution != null) {
|
|
13970
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
13971
|
+
}
|
|
13972
|
+
return toObject;
|
|
13973
|
+
}
|
|
13974
|
+
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
13975
|
+
const toObject = {};
|
|
13976
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
13977
|
+
if (fromHandle != null) {
|
|
13978
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
13979
|
+
}
|
|
13980
|
+
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
13981
|
+
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
13982
|
+
}
|
|
13983
|
+
return toObject;
|
|
13984
|
+
}
|
|
13985
|
+
function audioTranscriptionConfigToMldev() {
|
|
13986
|
+
const toObject = {};
|
|
13987
|
+
return toObject;
|
|
13988
|
+
}
|
|
13989
|
+
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
13990
|
+
const toObject = {};
|
|
13991
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
13992
|
+
if (fromDisabled != null) {
|
|
13993
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
13994
|
+
}
|
|
13995
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
13996
|
+
'startOfSpeechSensitivity',
|
|
13997
|
+
]);
|
|
13998
|
+
if (fromStartOfSpeechSensitivity != null) {
|
|
13999
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
14000
|
+
}
|
|
14001
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
14002
|
+
'endOfSpeechSensitivity',
|
|
14003
|
+
]);
|
|
14004
|
+
if (fromEndOfSpeechSensitivity != null) {
|
|
14005
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
14006
|
+
}
|
|
14007
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
14008
|
+
'prefixPaddingMs',
|
|
14009
|
+
]);
|
|
14010
|
+
if (fromPrefixPaddingMs != null) {
|
|
14011
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
14012
|
+
}
|
|
14013
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
14014
|
+
'silenceDurationMs',
|
|
14015
|
+
]);
|
|
14016
|
+
if (fromSilenceDurationMs != null) {
|
|
14017
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
14018
|
+
}
|
|
14019
|
+
return toObject;
|
|
14020
|
+
}
|
|
14021
|
+
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
14022
|
+
const toObject = {};
|
|
14023
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
14024
|
+
'automaticActivityDetection',
|
|
14025
|
+
]);
|
|
14026
|
+
if (fromAutomaticActivityDetection != null) {
|
|
14027
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
14028
|
+
}
|
|
14029
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
14030
|
+
'activityHandling',
|
|
14031
|
+
]);
|
|
14032
|
+
if (fromActivityHandling != null) {
|
|
14033
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
14034
|
+
}
|
|
14035
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
14036
|
+
if (fromTurnCoverage != null) {
|
|
14037
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
14038
|
+
}
|
|
14039
|
+
return toObject;
|
|
14040
|
+
}
|
|
14041
|
+
function slidingWindowToMldev(apiClient, fromObject) {
|
|
14042
|
+
const toObject = {};
|
|
14043
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
14044
|
+
if (fromTargetTokens != null) {
|
|
14045
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
14046
|
+
}
|
|
14047
|
+
return toObject;
|
|
14048
|
+
}
|
|
14049
|
+
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
14050
|
+
const toObject = {};
|
|
14051
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
14052
|
+
'triggerTokens',
|
|
14053
|
+
]);
|
|
14054
|
+
if (fromTriggerTokens != null) {
|
|
14055
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
14056
|
+
}
|
|
14057
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
14058
|
+
'slidingWindow',
|
|
14059
|
+
]);
|
|
14060
|
+
if (fromSlidingWindow != null) {
|
|
14061
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
14062
|
+
}
|
|
14063
|
+
return toObject;
|
|
14064
|
+
}
|
|
14065
|
+
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
14066
|
+
const toObject = {};
|
|
14067
|
+
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
14068
|
+
'proactiveAudio',
|
|
14069
|
+
]);
|
|
14070
|
+
if (fromProactiveAudio != null) {
|
|
14071
|
+
setValueByPath(toObject, ['proactiveAudio'], fromProactiveAudio);
|
|
14072
|
+
}
|
|
14073
|
+
return toObject;
|
|
14074
|
+
}
|
|
14075
|
+
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14076
|
+
const toObject = {};
|
|
14077
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
14078
|
+
'generationConfig',
|
|
14079
|
+
]);
|
|
14080
|
+
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
14081
|
+
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
14082
|
+
}
|
|
14083
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
14084
|
+
'responseModalities',
|
|
14085
|
+
]);
|
|
14086
|
+
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
14087
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
14088
|
+
}
|
|
14089
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
14090
|
+
if (parentObject !== undefined && fromTemperature != null) {
|
|
14091
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
14092
|
+
}
|
|
14093
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
14094
|
+
if (parentObject !== undefined && fromTopP != null) {
|
|
14095
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
14096
|
+
}
|
|
14097
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
14098
|
+
if (parentObject !== undefined && fromTopK != null) {
|
|
14099
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
14100
|
+
}
|
|
14101
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
14102
|
+
'maxOutputTokens',
|
|
14103
|
+
]);
|
|
14104
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
14105
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
14106
|
+
}
|
|
14107
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14108
|
+
'mediaResolution',
|
|
14109
|
+
]);
|
|
14110
|
+
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
14111
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
14112
|
+
}
|
|
14113
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
14114
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
14115
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
14116
|
+
}
|
|
14117
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
14118
|
+
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
14119
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
14120
|
+
}
|
|
14121
|
+
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
14122
|
+
'enableAffectiveDialog',
|
|
14123
|
+
]);
|
|
14124
|
+
if (parentObject !== undefined && fromEnableAffectiveDialog != null) {
|
|
14125
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'enableAffectiveDialog'], fromEnableAffectiveDialog);
|
|
14126
|
+
}
|
|
14127
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
14128
|
+
'systemInstruction',
|
|
14129
|
+
]);
|
|
14130
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
14131
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
14132
|
+
}
|
|
14133
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
14134
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
14135
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
14136
|
+
if (Array.isArray(transformedList)) {
|
|
14137
|
+
transformedList = transformedList.map((item) => {
|
|
14138
|
+
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
14139
|
+
});
|
|
14140
|
+
}
|
|
14141
|
+
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
14142
|
+
}
|
|
14143
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
14144
|
+
'sessionResumption',
|
|
14145
|
+
]);
|
|
14146
|
+
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
14147
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
14148
|
+
}
|
|
14149
|
+
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
14150
|
+
'inputAudioTranscription',
|
|
14151
|
+
]);
|
|
14152
|
+
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
14153
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14154
|
+
}
|
|
14155
|
+
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
14156
|
+
'outputAudioTranscription',
|
|
14157
|
+
]);
|
|
14158
|
+
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
14159
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14160
|
+
}
|
|
14161
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
14162
|
+
'realtimeInputConfig',
|
|
14163
|
+
]);
|
|
14164
|
+
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
14165
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
14166
|
+
}
|
|
14167
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
14168
|
+
'contextWindowCompression',
|
|
14169
|
+
]);
|
|
14170
|
+
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
14171
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
14172
|
+
}
|
|
14173
|
+
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
14174
|
+
if (parentObject !== undefined && fromProactivity != null) {
|
|
14175
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
14176
|
+
}
|
|
14177
|
+
return toObject;
|
|
14178
|
+
}
|
|
14179
|
+
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
14180
|
+
const toObject = {};
|
|
14181
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
14182
|
+
if (fromModel != null) {
|
|
14183
|
+
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
14184
|
+
}
|
|
14185
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14186
|
+
if (fromConfig != null) {
|
|
14187
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
14188
|
+
}
|
|
14189
|
+
return toObject;
|
|
14190
|
+
}
|
|
14191
|
+
function createAuthTokenConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14192
|
+
const toObject = {};
|
|
14193
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
14194
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
14195
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
14196
|
+
}
|
|
14197
|
+
const fromNewSessionExpireTime = getValueByPath(fromObject, [
|
|
14198
|
+
'newSessionExpireTime',
|
|
14199
|
+
]);
|
|
14200
|
+
if (parentObject !== undefined && fromNewSessionExpireTime != null) {
|
|
14201
|
+
setValueByPath(parentObject, ['newSessionExpireTime'], fromNewSessionExpireTime);
|
|
14202
|
+
}
|
|
14203
|
+
const fromUses = getValueByPath(fromObject, ['uses']);
|
|
14204
|
+
if (parentObject !== undefined && fromUses != null) {
|
|
14205
|
+
setValueByPath(parentObject, ['uses'], fromUses);
|
|
14206
|
+
}
|
|
14207
|
+
const fromLiveConnectConstraints = getValueByPath(fromObject, [
|
|
14208
|
+
'liveConnectConstraints',
|
|
14209
|
+
]);
|
|
14210
|
+
if (parentObject !== undefined && fromLiveConnectConstraints != null) {
|
|
14211
|
+
setValueByPath(parentObject, ['bidiGenerateContentSetup'], liveConnectConstraintsToMldev(apiClient, fromLiveConnectConstraints));
|
|
14212
|
+
}
|
|
14213
|
+
const fromLockAdditionalFields = getValueByPath(fromObject, [
|
|
14214
|
+
'lockAdditionalFields',
|
|
14215
|
+
]);
|
|
14216
|
+
if (parentObject !== undefined && fromLockAdditionalFields != null) {
|
|
14217
|
+
setValueByPath(parentObject, ['fieldMask'], fromLockAdditionalFields);
|
|
14218
|
+
}
|
|
14219
|
+
return toObject;
|
|
14220
|
+
}
|
|
14221
|
+
function createAuthTokenParametersToMldev(apiClient, fromObject) {
|
|
14222
|
+
const toObject = {};
|
|
14223
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14224
|
+
if (fromConfig != null) {
|
|
14225
|
+
setValueByPath(toObject, ['config'], createAuthTokenConfigToMldev(apiClient, fromConfig, toObject));
|
|
14226
|
+
}
|
|
14227
|
+
return toObject;
|
|
14228
|
+
}
|
|
14229
|
+
function authTokenFromMldev(apiClient, fromObject) {
|
|
14230
|
+
const toObject = {};
|
|
14231
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14232
|
+
if (fromName != null) {
|
|
14233
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14234
|
+
}
|
|
14235
|
+
return toObject;
|
|
14236
|
+
}
|
|
14237
|
+
|
|
14238
|
+
/**
|
|
14239
|
+
* @license
|
|
14240
|
+
* Copyright 2025 Google LLC
|
|
14241
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14242
|
+
*/
|
|
14243
|
+
/**
|
|
14244
|
+
* Returns a comma-separated list of field masks from a given object.
|
|
14245
|
+
*
|
|
14246
|
+
* @param setup The object to extract field masks from.
|
|
14247
|
+
* @return A comma-separated list of field masks.
|
|
14248
|
+
*/
|
|
14249
|
+
function getFieldMasks(setup) {
|
|
14250
|
+
const fields = [];
|
|
14251
|
+
for (const key in setup) {
|
|
14252
|
+
if (Object.prototype.hasOwnProperty.call(setup, key)) {
|
|
14253
|
+
const value = setup[key];
|
|
14254
|
+
// 2nd layer, recursively get field masks see TODO(b/418290100)
|
|
14255
|
+
if (typeof value === 'object' &&
|
|
14256
|
+
value != null &&
|
|
14257
|
+
Object.keys(value).length > 0) {
|
|
14258
|
+
const field = Object.keys(value).map((kk) => `${key}.${kk}`);
|
|
14259
|
+
fields.push(...field);
|
|
14260
|
+
}
|
|
14261
|
+
else {
|
|
14262
|
+
fields.push(key); // 1st layer
|
|
14263
|
+
}
|
|
14264
|
+
}
|
|
14265
|
+
}
|
|
14266
|
+
return fields.join(',');
|
|
14267
|
+
}
|
|
14268
|
+
/**
|
|
14269
|
+
* Converts bidiGenerateContentSetup.
|
|
14270
|
+
* @param requestDict - The request dictionary.
|
|
14271
|
+
* @param config - The configuration object.
|
|
14272
|
+
* @return - The modified request dictionary.
|
|
14273
|
+
*/
|
|
14274
|
+
function convertBidiSetupToTokenSetup(requestDict, config) {
|
|
14275
|
+
// Convert bidiGenerateContentSetup from bidiGenerateContentSetup.setup.
|
|
14276
|
+
let setupForMaskGeneration = null;
|
|
14277
|
+
const bidiGenerateContentSetupValue = requestDict['bidiGenerateContentSetup'];
|
|
14278
|
+
if (typeof bidiGenerateContentSetupValue === 'object' &&
|
|
14279
|
+
bidiGenerateContentSetupValue !== null &&
|
|
14280
|
+
'setup' in bidiGenerateContentSetupValue) {
|
|
14281
|
+
// Now we know bidiGenerateContentSetupValue is an object and has a 'setup'
|
|
14282
|
+
// property.
|
|
14283
|
+
const innerSetup = bidiGenerateContentSetupValue
|
|
14284
|
+
.setup;
|
|
14285
|
+
if (typeof innerSetup === 'object' && innerSetup !== null) {
|
|
14286
|
+
// Valid inner setup found.
|
|
14287
|
+
requestDict['bidiGenerateContentSetup'] = innerSetup;
|
|
14288
|
+
setupForMaskGeneration = innerSetup;
|
|
14289
|
+
}
|
|
14290
|
+
else {
|
|
14291
|
+
// `bidiGenerateContentSetupValue.setup` is not a valid object; treat as
|
|
14292
|
+
// if bidiGenerateContentSetup is invalid.
|
|
14293
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14294
|
+
}
|
|
14295
|
+
}
|
|
14296
|
+
else if (bidiGenerateContentSetupValue !== undefined) {
|
|
14297
|
+
// `bidiGenerateContentSetup` exists but not in the expected
|
|
14298
|
+
// shape {setup: {...}}; treat as invalid.
|
|
14299
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14300
|
+
}
|
|
14301
|
+
const preExistingFieldMask = requestDict['fieldMask'];
|
|
14302
|
+
// Handle mask generation setup.
|
|
14303
|
+
if (setupForMaskGeneration) {
|
|
14304
|
+
const generatedMaskFromBidi = getFieldMasks(setupForMaskGeneration);
|
|
14305
|
+
if (Array.isArray(config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14306
|
+
(config === null || config === void 0 ? void 0 : config.lockAdditionalFields.length) === 0) {
|
|
14307
|
+
// Case 1: lockAdditionalFields is an empty array. Lock only fields from
|
|
14308
|
+
// bidi setup.
|
|
14309
|
+
if (generatedMaskFromBidi) {
|
|
14310
|
+
// Only assign if mask is not empty
|
|
14311
|
+
requestDict['fieldMask'] = generatedMaskFromBidi;
|
|
14312
|
+
}
|
|
14313
|
+
else {
|
|
14314
|
+
delete requestDict['fieldMask']; // If mask is empty, effectively no
|
|
14315
|
+
// specific fields locked by bidi
|
|
14316
|
+
}
|
|
14317
|
+
}
|
|
14318
|
+
else if ((config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14319
|
+
config.lockAdditionalFields.length > 0 &&
|
|
14320
|
+
preExistingFieldMask !== null &&
|
|
14321
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14322
|
+
preExistingFieldMask.length > 0) {
|
|
14323
|
+
// Case 2: Lock fields from bidi setup + additional fields
|
|
14324
|
+
// (preExistingFieldMask).
|
|
14325
|
+
const generationConfigFields = [
|
|
14326
|
+
'temperature',
|
|
14327
|
+
'topK',
|
|
14328
|
+
'topP',
|
|
14329
|
+
'maxOutputTokens',
|
|
14330
|
+
'responseModalities',
|
|
14331
|
+
'seed',
|
|
14332
|
+
'speechConfig',
|
|
14333
|
+
];
|
|
14334
|
+
let mappedFieldsFromPreExisting = [];
|
|
14335
|
+
if (preExistingFieldMask.length > 0) {
|
|
14336
|
+
mappedFieldsFromPreExisting = preExistingFieldMask.map((field) => {
|
|
14337
|
+
if (generationConfigFields.includes(field)) {
|
|
14338
|
+
return `generationConfig.${field}`;
|
|
14339
|
+
}
|
|
14340
|
+
return field; // Keep original field name if not in
|
|
14341
|
+
// generationConfigFields
|
|
14342
|
+
});
|
|
14343
|
+
}
|
|
14344
|
+
const finalMaskParts = [];
|
|
14345
|
+
if (generatedMaskFromBidi) {
|
|
14346
|
+
finalMaskParts.push(generatedMaskFromBidi);
|
|
14347
|
+
}
|
|
14348
|
+
if (mappedFieldsFromPreExisting.length > 0) {
|
|
14349
|
+
finalMaskParts.push(...mappedFieldsFromPreExisting);
|
|
14350
|
+
}
|
|
14351
|
+
if (finalMaskParts.length > 0) {
|
|
14352
|
+
requestDict['fieldMask'] = finalMaskParts.join(',');
|
|
14353
|
+
}
|
|
14354
|
+
else {
|
|
14355
|
+
// If no fields from bidi and no valid additional fields from
|
|
14356
|
+
// pre-existing mask.
|
|
14357
|
+
delete requestDict['fieldMask'];
|
|
14358
|
+
}
|
|
14359
|
+
}
|
|
14360
|
+
else {
|
|
14361
|
+
// Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
|
|
14362
|
+
// defaults apply or all are mutable). This is hit if:
|
|
14363
|
+
// - `config.lockAdditionalFields` is undefined.
|
|
14364
|
+
// - `config.lockAdditionalFields` is non-empty, BUT
|
|
14365
|
+
// `preExistingFieldMask` is null, not a string, or an empty string.
|
|
14366
|
+
delete requestDict['fieldMask'];
|
|
14367
|
+
}
|
|
14368
|
+
}
|
|
14369
|
+
else {
|
|
14370
|
+
// No valid `bidiGenerateContentSetup` was found or extracted.
|
|
14371
|
+
// "Lock additional null fields if any".
|
|
14372
|
+
if (preExistingFieldMask !== null &&
|
|
14373
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14374
|
+
preExistingFieldMask.length > 0) {
|
|
14375
|
+
// If there's a pre-existing field mask, it's a string, and it's not
|
|
14376
|
+
// empty, then we should lock all fields.
|
|
14377
|
+
requestDict['fieldMask'] = preExistingFieldMask.join(',');
|
|
14378
|
+
}
|
|
14379
|
+
else {
|
|
14380
|
+
delete requestDict['fieldMask'];
|
|
14381
|
+
}
|
|
14382
|
+
}
|
|
14383
|
+
return requestDict;
|
|
14384
|
+
}
|
|
14385
|
+
class Tokens extends BaseModule {
|
|
14386
|
+
constructor(apiClient) {
|
|
14387
|
+
super();
|
|
14388
|
+
this.apiClient = apiClient;
|
|
14389
|
+
}
|
|
14390
|
+
/**
|
|
14391
|
+
* Creates an ephemeral auth token resource.
|
|
14392
|
+
*
|
|
14393
|
+
* @experimental
|
|
14394
|
+
*
|
|
14395
|
+
* @remarks
|
|
14396
|
+
* Ephermeral auth tokens is only supported in the Gemini Developer API.
|
|
14397
|
+
* It can be used for the session connection to the Live constrained API.
|
|
14398
|
+
*
|
|
14399
|
+
* @param params - The parameters for the create request.
|
|
14400
|
+
* @return The created auth token.
|
|
14401
|
+
*
|
|
14402
|
+
* @example
|
|
14403
|
+
* ```ts
|
|
14404
|
+
* // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
|
|
14405
|
+
* // when using the token in Live API sessions. Each session connection can
|
|
14406
|
+
* // use a different configuration.
|
|
14407
|
+
* const config: CreateAuthTokenConfig = {
|
|
14408
|
+
* uses: 3,
|
|
14409
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14410
|
+
* }
|
|
14411
|
+
* const token = await ai.tokens.create(config);
|
|
14412
|
+
*
|
|
14413
|
+
* // Case 2: If LiveEphemeralParameters is set, lock all fields in
|
|
14414
|
+
* // LiveConnectConfig when using the token in Live API sessions. For
|
|
14415
|
+
* // example, changing `outputAudioTranscription` in the Live API
|
|
14416
|
+
* // connection will be ignored by the API.
|
|
14417
|
+
* const config: CreateAuthTokenConfig =
|
|
14418
|
+
* uses: 3,
|
|
14419
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14420
|
+
* LiveEphemeralParameters: {
|
|
14421
|
+
* model: 'gemini-2.0-flash-001',
|
|
14422
|
+
* config: {
|
|
14423
|
+
* 'responseModalities': ['AUDIO'],
|
|
14424
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14425
|
+
* }
|
|
14426
|
+
* }
|
|
14427
|
+
* }
|
|
14428
|
+
* const token = await ai.tokens.create(config);
|
|
14429
|
+
*
|
|
14430
|
+
* // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14431
|
+
* // set, lock LiveConnectConfig with set and additional fields (e.g.
|
|
14432
|
+
* // responseModalities, systemInstruction, temperature in this example) when
|
|
14433
|
+
* // using the token in Live API sessions.
|
|
14434
|
+
* const config: CreateAuthTokenConfig =
|
|
14435
|
+
* uses: 3,
|
|
14436
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14437
|
+
* LiveEphemeralParameters: {
|
|
14438
|
+
* model: 'gemini-2.0-flash-001',
|
|
14439
|
+
* config: {
|
|
14440
|
+
* 'responseModalities': ['AUDIO'],
|
|
14441
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14442
|
+
* }
|
|
14443
|
+
* },
|
|
14444
|
+
* lockAdditionalFields: ['temperature'],
|
|
14445
|
+
* }
|
|
14446
|
+
* const token = await ai.tokens.create(config);
|
|
14447
|
+
*
|
|
14448
|
+
* // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14449
|
+
* // empty array, lock LiveConnectConfig with set fields (e.g.
|
|
14450
|
+
* // responseModalities, systemInstruction in this example) when using the
|
|
14451
|
+
* // token in Live API sessions.
|
|
14452
|
+
* const config: CreateAuthTokenConfig =
|
|
14453
|
+
* uses: 3,
|
|
14454
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14455
|
+
* LiveEphemeralParameters: {
|
|
14456
|
+
* model: 'gemini-2.0-flash-001',
|
|
14457
|
+
* config: {
|
|
14458
|
+
* 'responseModalities': ['AUDIO'],
|
|
14459
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14460
|
+
* }
|
|
14461
|
+
* },
|
|
14462
|
+
* lockAdditionalFields: [],
|
|
14463
|
+
* }
|
|
14464
|
+
* const token = await ai.tokens.create(config);
|
|
14465
|
+
* ```
|
|
14466
|
+
*/
|
|
14467
|
+
async create(params) {
|
|
14468
|
+
var _a, _b;
|
|
14469
|
+
let response;
|
|
14470
|
+
let path = '';
|
|
14471
|
+
let queryParams = {};
|
|
14472
|
+
if (this.apiClient.isVertexAI()) {
|
|
14473
|
+
throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
|
|
14474
|
+
}
|
|
14475
|
+
else {
|
|
14476
|
+
const body = createAuthTokenParametersToMldev(this.apiClient, params);
|
|
14477
|
+
path = formatMap('auth_tokens', body['_url']);
|
|
14478
|
+
queryParams = body['_query'];
|
|
14479
|
+
delete body['config'];
|
|
14480
|
+
delete body['_url'];
|
|
14481
|
+
delete body['_query'];
|
|
14482
|
+
const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
|
|
14483
|
+
response = this.apiClient
|
|
14484
|
+
.request({
|
|
14485
|
+
path: path,
|
|
14486
|
+
queryParams: queryParams,
|
|
14487
|
+
body: JSON.stringify(transformedBody),
|
|
14488
|
+
httpMethod: 'POST',
|
|
14489
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
14490
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14491
|
+
})
|
|
14492
|
+
.then((httpResponse) => {
|
|
14493
|
+
return httpResponse.json();
|
|
14494
|
+
});
|
|
14495
|
+
return response.then((apiResponse) => {
|
|
14496
|
+
const resp = authTokenFromMldev(this.apiClient, apiResponse);
|
|
14497
|
+
return resp;
|
|
14498
|
+
});
|
|
14499
|
+
}
|
|
14500
|
+
}
|
|
14501
|
+
}
|
|
14502
|
+
|
|
14503
|
+
/**
|
|
14504
|
+
* @license
|
|
14505
|
+
* Copyright 2025 Google LLC
|
|
14506
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14507
|
+
*/
|
|
14508
|
+
const GOOGLE_API_KEY_HEADER = 'x-goog-api-key';
|
|
14509
|
+
const REQUIRED_VERTEX_AI_SCOPE = 'https://www.googleapis.com/auth/cloud-platform';
|
|
14510
|
+
class NodeAuth {
|
|
14511
|
+
constructor(opts) {
|
|
14512
|
+
if (opts.apiKey !== undefined) {
|
|
14513
|
+
this.apiKey = opts.apiKey;
|
|
14514
|
+
return;
|
|
14515
|
+
}
|
|
14516
|
+
const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
|
|
14517
|
+
this.googleAuth = new GoogleAuth(vertexAuthOptions);
|
|
14518
|
+
}
|
|
14519
|
+
async addAuthHeaders(headers) {
|
|
14520
|
+
if (this.apiKey !== undefined) {
|
|
14521
|
+
if (this.apiKey.startsWith('auth_tokens/')) {
|
|
14522
|
+
throw new Error('Ephemeral tokens are only supported by the live API.');
|
|
14523
|
+
}
|
|
14524
|
+
this.addKeyHeader(headers);
|
|
14525
|
+
return;
|
|
14526
|
+
}
|
|
14527
|
+
return this.addGoogleAuthHeaders(headers);
|
|
13576
14528
|
}
|
|
13577
14529
|
addKeyHeader(headers) {
|
|
13578
14530
|
if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
|
|
@@ -14816,7 +15768,7 @@ class GoogleGenAI {
|
|
|
14816
15768
|
}
|
|
14817
15769
|
this.vertexai =
|
|
14818
15770
|
(_b = (_a = options.vertexai) !== null && _a !== void 0 ? _a : getBooleanEnv('GOOGLE_GENAI_USE_VERTEXAI')) !== null && _b !== void 0 ? _b : false;
|
|
14819
|
-
const envApiKey =
|
|
15771
|
+
const envApiKey = getApiKeyFromEnv();
|
|
14820
15772
|
const envProject = getEnv('GOOGLE_CLOUD_PROJECT');
|
|
14821
15773
|
const envLocation = getEnv('GOOGLE_CLOUD_LOCATION');
|
|
14822
15774
|
this.apiKey = (_c = options.apiKey) !== null && _c !== void 0 ? _c : envApiKey;
|
|
@@ -14877,6 +15829,7 @@ class GoogleGenAI {
|
|
|
14877
15829
|
this.caches = new Caches(this.apiClient);
|
|
14878
15830
|
this.files = new Files(this.apiClient);
|
|
14879
15831
|
this.operations = new Operations(this.apiClient);
|
|
15832
|
+
this.authTokens = new Tokens(this.apiClient);
|
|
14880
15833
|
this.tunings = new Tunings(this.apiClient);
|
|
14881
15834
|
}
|
|
14882
15835
|
}
|
|
@@ -14893,6 +15846,14 @@ function stringToBoolean(str) {
|
|
|
14893
15846
|
}
|
|
14894
15847
|
return str.toLowerCase() === 'true';
|
|
14895
15848
|
}
|
|
15849
|
+
function getApiKeyFromEnv() {
|
|
15850
|
+
const envGoogleApiKey = getEnv('GOOGLE_API_KEY');
|
|
15851
|
+
const envGeminiApiKey = getEnv('GEMINI_API_KEY');
|
|
15852
|
+
if (envGoogleApiKey && envGeminiApiKey) {
|
|
15853
|
+
console.warn('Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY.');
|
|
15854
|
+
}
|
|
15855
|
+
return envGoogleApiKey || envGeminiApiKey;
|
|
15856
|
+
}
|
|
14896
15857
|
|
|
14897
|
-
export { ActivityHandling, AdapterSize, AuthType, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
15858
|
+
export { ActivityHandling, AdapterSize, AuthType, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
14898
15859
|
//# sourceMappingURL=index.mjs.map
|