@google/genai 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/genai.d.ts +141 -24
- package/dist/index.cjs +1080 -174
- package/dist/index.mjs +1080 -175
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +1040 -138
- package/dist/node/index.mjs +1040 -139
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +141 -24
- package/dist/web/index.mjs +1080 -175
- 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',
|
|
@@ -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
|
]);
|
|
@@ -4888,7 +4898,7 @@ class Files extends BaseModule {
|
|
|
4888
4898
|
* Copyright 2025 Google LLC
|
|
4889
4899
|
* SPDX-License-Identifier: Apache-2.0
|
|
4890
4900
|
*/
|
|
4891
|
-
function prebuiltVoiceConfigToMldev$
|
|
4901
|
+
function prebuiltVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4892
4902
|
const toObject = {};
|
|
4893
4903
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
4894
4904
|
if (fromVoiceName != null) {
|
|
@@ -4904,13 +4914,13 @@ function prebuiltVoiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
4904
4914
|
}
|
|
4905
4915
|
return toObject;
|
|
4906
4916
|
}
|
|
4907
|
-
function voiceConfigToMldev$
|
|
4917
|
+
function voiceConfigToMldev$2(apiClient, fromObject) {
|
|
4908
4918
|
const toObject = {};
|
|
4909
4919
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
4910
4920
|
'prebuiltVoiceConfig',
|
|
4911
4921
|
]);
|
|
4912
4922
|
if (fromPrebuiltVoiceConfig != null) {
|
|
4913
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$
|
|
4923
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$2(apiClient, fromPrebuiltVoiceConfig));
|
|
4914
4924
|
}
|
|
4915
4925
|
return toObject;
|
|
4916
4926
|
}
|
|
@@ -4924,7 +4934,7 @@ function voiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
4924
4934
|
}
|
|
4925
4935
|
return toObject;
|
|
4926
4936
|
}
|
|
4927
|
-
function speakerVoiceConfigToMldev$
|
|
4937
|
+
function speakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4928
4938
|
const toObject = {};
|
|
4929
4939
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
4930
4940
|
if (fromSpeaker != null) {
|
|
@@ -4932,11 +4942,11 @@ function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
4932
4942
|
}
|
|
4933
4943
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
4934
4944
|
if (fromVoiceConfig != null) {
|
|
4935
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
4945
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
4936
4946
|
}
|
|
4937
4947
|
return toObject;
|
|
4938
4948
|
}
|
|
4939
|
-
function multiSpeakerVoiceConfigToMldev$
|
|
4949
|
+
function multiSpeakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4940
4950
|
const toObject = {};
|
|
4941
4951
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
4942
4952
|
'speakerVoiceConfigs',
|
|
@@ -4945,24 +4955,24 @@ function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
4945
4955
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
4946
4956
|
if (Array.isArray(transformedList)) {
|
|
4947
4957
|
transformedList = transformedList.map((item) => {
|
|
4948
|
-
return speakerVoiceConfigToMldev$
|
|
4958
|
+
return speakerVoiceConfigToMldev$2(apiClient, item);
|
|
4949
4959
|
});
|
|
4950
4960
|
}
|
|
4951
4961
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
4952
4962
|
}
|
|
4953
4963
|
return toObject;
|
|
4954
4964
|
}
|
|
4955
|
-
function speechConfigToMldev$
|
|
4965
|
+
function speechConfigToMldev$2(apiClient, fromObject) {
|
|
4956
4966
|
const toObject = {};
|
|
4957
4967
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
4958
4968
|
if (fromVoiceConfig != null) {
|
|
4959
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
4969
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
4960
4970
|
}
|
|
4961
4971
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
4962
4972
|
'multiSpeakerVoiceConfig',
|
|
4963
4973
|
]);
|
|
4964
4974
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
4965
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$
|
|
4975
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$2(apiClient, fromMultiSpeakerVoiceConfig));
|
|
4966
4976
|
}
|
|
4967
4977
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
4968
4978
|
if (fromLanguageCode != null) {
|
|
@@ -4985,7 +4995,7 @@ function speechConfigToVertex$1(apiClient, fromObject) {
|
|
|
4985
4995
|
}
|
|
4986
4996
|
return toObject;
|
|
4987
4997
|
}
|
|
4988
|
-
function videoMetadataToMldev$
|
|
4998
|
+
function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
4989
4999
|
const toObject = {};
|
|
4990
5000
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
4991
5001
|
if (fromFps != null) {
|
|
@@ -5017,7 +5027,7 @@ function videoMetadataToVertex$1(apiClient, fromObject) {
|
|
|
5017
5027
|
}
|
|
5018
5028
|
return toObject;
|
|
5019
5029
|
}
|
|
5020
|
-
function blobToMldev$
|
|
5030
|
+
function blobToMldev$2(apiClient, fromObject) {
|
|
5021
5031
|
const toObject = {};
|
|
5022
5032
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5023
5033
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5048,7 +5058,7 @@ function blobToVertex$1(apiClient, fromObject) {
|
|
|
5048
5058
|
}
|
|
5049
5059
|
return toObject;
|
|
5050
5060
|
}
|
|
5051
|
-
function fileDataToMldev$
|
|
5061
|
+
function fileDataToMldev$2(apiClient, fromObject) {
|
|
5052
5062
|
const toObject = {};
|
|
5053
5063
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5054
5064
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5079,13 +5089,13 @@ function fileDataToVertex$1(apiClient, fromObject) {
|
|
|
5079
5089
|
}
|
|
5080
5090
|
return toObject;
|
|
5081
5091
|
}
|
|
5082
|
-
function partToMldev$
|
|
5092
|
+
function partToMldev$2(apiClient, fromObject) {
|
|
5083
5093
|
const toObject = {};
|
|
5084
5094
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
5085
5095
|
'videoMetadata',
|
|
5086
5096
|
]);
|
|
5087
5097
|
if (fromVideoMetadata != null) {
|
|
5088
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
5098
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$2(apiClient, fromVideoMetadata));
|
|
5089
5099
|
}
|
|
5090
5100
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
5091
5101
|
if (fromThought != null) {
|
|
@@ -5093,11 +5103,17 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
5093
5103
|
}
|
|
5094
5104
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5095
5105
|
if (fromInlineData != null) {
|
|
5096
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
5106
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
5097
5107
|
}
|
|
5098
5108
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
5099
5109
|
if (fromFileData != null) {
|
|
5100
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
5110
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
|
|
5111
|
+
}
|
|
5112
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5113
|
+
'thoughtSignature',
|
|
5114
|
+
]);
|
|
5115
|
+
if (fromThoughtSignature != null) {
|
|
5116
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5101
5117
|
}
|
|
5102
5118
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5103
5119
|
'codeExecutionResult',
|
|
@@ -5147,6 +5163,12 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5147
5163
|
if (fromFileData != null) {
|
|
5148
5164
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
|
|
5149
5165
|
}
|
|
5166
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5167
|
+
'thoughtSignature',
|
|
5168
|
+
]);
|
|
5169
|
+
if (fromThoughtSignature != null) {
|
|
5170
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5171
|
+
}
|
|
5150
5172
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5151
5173
|
'codeExecutionResult',
|
|
5152
5174
|
]);
|
|
@@ -5175,14 +5197,14 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5175
5197
|
}
|
|
5176
5198
|
return toObject;
|
|
5177
5199
|
}
|
|
5178
|
-
function contentToMldev$
|
|
5200
|
+
function contentToMldev$2(apiClient, fromObject) {
|
|
5179
5201
|
const toObject = {};
|
|
5180
5202
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5181
5203
|
if (fromParts != null) {
|
|
5182
5204
|
let transformedList = fromParts;
|
|
5183
5205
|
if (Array.isArray(transformedList)) {
|
|
5184
5206
|
transformedList = transformedList.map((item) => {
|
|
5185
|
-
return partToMldev$
|
|
5207
|
+
return partToMldev$2(apiClient, item);
|
|
5186
5208
|
});
|
|
5187
5209
|
}
|
|
5188
5210
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5211,7 +5233,7 @@ function contentToVertex$1(apiClient, fromObject) {
|
|
|
5211
5233
|
}
|
|
5212
5234
|
return toObject;
|
|
5213
5235
|
}
|
|
5214
|
-
function functionDeclarationToMldev$
|
|
5236
|
+
function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
5215
5237
|
const toObject = {};
|
|
5216
5238
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
5217
5239
|
if (fromBehavior != null) {
|
|
@@ -5258,7 +5280,7 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
|
5258
5280
|
}
|
|
5259
5281
|
return toObject;
|
|
5260
5282
|
}
|
|
5261
|
-
function intervalToMldev$
|
|
5283
|
+
function intervalToMldev$2(apiClient, fromObject) {
|
|
5262
5284
|
const toObject = {};
|
|
5263
5285
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
5264
5286
|
if (fromStartTime != null) {
|
|
@@ -5282,13 +5304,13 @@ function intervalToVertex$1(apiClient, fromObject) {
|
|
|
5282
5304
|
}
|
|
5283
5305
|
return toObject;
|
|
5284
5306
|
}
|
|
5285
|
-
function googleSearchToMldev$
|
|
5307
|
+
function googleSearchToMldev$2(apiClient, fromObject) {
|
|
5286
5308
|
const toObject = {};
|
|
5287
5309
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
5288
5310
|
'timeRangeFilter',
|
|
5289
5311
|
]);
|
|
5290
5312
|
if (fromTimeRangeFilter != null) {
|
|
5291
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
5313
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(apiClient, fromTimeRangeFilter));
|
|
5292
5314
|
}
|
|
5293
5315
|
return toObject;
|
|
5294
5316
|
}
|
|
@@ -5302,7 +5324,7 @@ function googleSearchToVertex$1(apiClient, fromObject) {
|
|
|
5302
5324
|
}
|
|
5303
5325
|
return toObject;
|
|
5304
5326
|
}
|
|
5305
|
-
function dynamicRetrievalConfigToMldev$
|
|
5327
|
+
function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
5306
5328
|
const toObject = {};
|
|
5307
5329
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5308
5330
|
if (fromMode != null) {
|
|
@@ -5330,13 +5352,13 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
|
5330
5352
|
}
|
|
5331
5353
|
return toObject;
|
|
5332
5354
|
}
|
|
5333
|
-
function googleSearchRetrievalToMldev$
|
|
5355
|
+
function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
|
|
5334
5356
|
const toObject = {};
|
|
5335
5357
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
5336
5358
|
'dynamicRetrievalConfig',
|
|
5337
5359
|
]);
|
|
5338
5360
|
if (fromDynamicRetrievalConfig != null) {
|
|
5339
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
5361
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
|
|
5340
5362
|
}
|
|
5341
5363
|
return toObject;
|
|
5342
5364
|
}
|
|
@@ -5402,11 +5424,11 @@ function googleMapsToVertex$1(apiClient, fromObject) {
|
|
|
5402
5424
|
}
|
|
5403
5425
|
return toObject;
|
|
5404
5426
|
}
|
|
5405
|
-
function urlContextToMldev$
|
|
5427
|
+
function urlContextToMldev$2() {
|
|
5406
5428
|
const toObject = {};
|
|
5407
5429
|
return toObject;
|
|
5408
5430
|
}
|
|
5409
|
-
function toolToMldev$
|
|
5431
|
+
function toolToMldev$2(apiClient, fromObject) {
|
|
5410
5432
|
const toObject = {};
|
|
5411
5433
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5412
5434
|
'functionDeclarations',
|
|
@@ -5415,7 +5437,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5415
5437
|
let transformedList = fromFunctionDeclarations;
|
|
5416
5438
|
if (Array.isArray(transformedList)) {
|
|
5417
5439
|
transformedList = transformedList.map((item) => {
|
|
5418
|
-
return functionDeclarationToMldev$
|
|
5440
|
+
return functionDeclarationToMldev$2(apiClient, item);
|
|
5419
5441
|
});
|
|
5420
5442
|
}
|
|
5421
5443
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -5425,13 +5447,13 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5425
5447
|
}
|
|
5426
5448
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5427
5449
|
if (fromGoogleSearch != null) {
|
|
5428
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
5450
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(apiClient, fromGoogleSearch));
|
|
5429
5451
|
}
|
|
5430
5452
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5431
5453
|
'googleSearchRetrieval',
|
|
5432
5454
|
]);
|
|
5433
5455
|
if (fromGoogleSearchRetrieval != null) {
|
|
5434
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
5456
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
|
|
5435
5457
|
}
|
|
5436
5458
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5437
5459
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -5441,7 +5463,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5441
5463
|
}
|
|
5442
5464
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5443
5465
|
if (fromUrlContext != null) {
|
|
5444
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
5466
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
|
|
5445
5467
|
}
|
|
5446
5468
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5447
5469
|
'codeExecution',
|
|
@@ -5500,7 +5522,7 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
5500
5522
|
}
|
|
5501
5523
|
return toObject;
|
|
5502
5524
|
}
|
|
5503
|
-
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
5525
|
+
function sessionResumptionConfigToMldev$1(apiClient, fromObject) {
|
|
5504
5526
|
const toObject = {};
|
|
5505
5527
|
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
5506
5528
|
if (fromHandle != null) {
|
|
@@ -5523,7 +5545,7 @@ function sessionResumptionConfigToVertex(apiClient, fromObject) {
|
|
|
5523
5545
|
}
|
|
5524
5546
|
return toObject;
|
|
5525
5547
|
}
|
|
5526
|
-
function audioTranscriptionConfigToMldev() {
|
|
5548
|
+
function audioTranscriptionConfigToMldev$1() {
|
|
5527
5549
|
const toObject = {};
|
|
5528
5550
|
return toObject;
|
|
5529
5551
|
}
|
|
@@ -5531,7 +5553,7 @@ function audioTranscriptionConfigToVertex() {
|
|
|
5531
5553
|
const toObject = {};
|
|
5532
5554
|
return toObject;
|
|
5533
5555
|
}
|
|
5534
|
-
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
5556
|
+
function automaticActivityDetectionToMldev$1(apiClient, fromObject) {
|
|
5535
5557
|
const toObject = {};
|
|
5536
5558
|
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
5537
5559
|
if (fromDisabled != null) {
|
|
@@ -5595,13 +5617,13 @@ function automaticActivityDetectionToVertex(apiClient, fromObject) {
|
|
|
5595
5617
|
}
|
|
5596
5618
|
return toObject;
|
|
5597
5619
|
}
|
|
5598
|
-
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
5620
|
+
function realtimeInputConfigToMldev$1(apiClient, fromObject) {
|
|
5599
5621
|
const toObject = {};
|
|
5600
5622
|
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
5601
5623
|
'automaticActivityDetection',
|
|
5602
5624
|
]);
|
|
5603
5625
|
if (fromAutomaticActivityDetection != null) {
|
|
5604
|
-
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
5626
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev$1(apiClient, fromAutomaticActivityDetection));
|
|
5605
5627
|
}
|
|
5606
5628
|
const fromActivityHandling = getValueByPath(fromObject, [
|
|
5607
5629
|
'activityHandling',
|
|
@@ -5635,7 +5657,7 @@ function realtimeInputConfigToVertex(apiClient, fromObject) {
|
|
|
5635
5657
|
}
|
|
5636
5658
|
return toObject;
|
|
5637
5659
|
}
|
|
5638
|
-
function slidingWindowToMldev(apiClient, fromObject) {
|
|
5660
|
+
function slidingWindowToMldev$1(apiClient, fromObject) {
|
|
5639
5661
|
const toObject = {};
|
|
5640
5662
|
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
5641
5663
|
if (fromTargetTokens != null) {
|
|
@@ -5651,7 +5673,7 @@ function slidingWindowToVertex(apiClient, fromObject) {
|
|
|
5651
5673
|
}
|
|
5652
5674
|
return toObject;
|
|
5653
5675
|
}
|
|
5654
|
-
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
5676
|
+
function contextWindowCompressionConfigToMldev$1(apiClient, fromObject) {
|
|
5655
5677
|
const toObject = {};
|
|
5656
5678
|
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
5657
5679
|
'triggerTokens',
|
|
@@ -5663,7 +5685,7 @@ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
|
5663
5685
|
'slidingWindow',
|
|
5664
5686
|
]);
|
|
5665
5687
|
if (fromSlidingWindow != null) {
|
|
5666
|
-
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
5688
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev$1(apiClient, fromSlidingWindow));
|
|
5667
5689
|
}
|
|
5668
5690
|
return toObject;
|
|
5669
5691
|
}
|
|
@@ -5683,7 +5705,7 @@ function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
|
|
|
5683
5705
|
}
|
|
5684
5706
|
return toObject;
|
|
5685
5707
|
}
|
|
5686
|
-
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
5708
|
+
function proactivityConfigToMldev$1(apiClient, fromObject) {
|
|
5687
5709
|
const toObject = {};
|
|
5688
5710
|
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
5689
5711
|
'proactiveAudio',
|
|
@@ -5703,7 +5725,7 @@ function proactivityConfigToVertex(apiClient, fromObject) {
|
|
|
5703
5725
|
}
|
|
5704
5726
|
return toObject;
|
|
5705
5727
|
}
|
|
5706
|
-
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
5728
|
+
function liveConnectConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
5707
5729
|
const toObject = {};
|
|
5708
5730
|
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
5709
5731
|
'generationConfig',
|
|
@@ -5747,7 +5769,7 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5747
5769
|
}
|
|
5748
5770
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
5749
5771
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
5750
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$
|
|
5772
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$2(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
5751
5773
|
}
|
|
5752
5774
|
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
5753
5775
|
'enableAffectiveDialog',
|
|
@@ -5759,14 +5781,14 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5759
5781
|
'systemInstruction',
|
|
5760
5782
|
]);
|
|
5761
5783
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
5762
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$
|
|
5784
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
5763
5785
|
}
|
|
5764
5786
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5765
5787
|
if (parentObject !== undefined && fromTools != null) {
|
|
5766
5788
|
let transformedList = tTools(apiClient, fromTools);
|
|
5767
5789
|
if (Array.isArray(transformedList)) {
|
|
5768
5790
|
transformedList = transformedList.map((item) => {
|
|
5769
|
-
return toolToMldev$
|
|
5791
|
+
return toolToMldev$2(apiClient, tTool(apiClient, item));
|
|
5770
5792
|
});
|
|
5771
5793
|
}
|
|
5772
5794
|
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
@@ -5775,35 +5797,35 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5775
5797
|
'sessionResumption',
|
|
5776
5798
|
]);
|
|
5777
5799
|
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
5778
|
-
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
5800
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev$1(apiClient, fromSessionResumption));
|
|
5779
5801
|
}
|
|
5780
5802
|
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
5781
5803
|
'inputAudioTranscription',
|
|
5782
5804
|
]);
|
|
5783
5805
|
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
5784
|
-
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
5806
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
5785
5807
|
}
|
|
5786
5808
|
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
5787
5809
|
'outputAudioTranscription',
|
|
5788
5810
|
]);
|
|
5789
5811
|
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
5790
|
-
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
5812
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
5791
5813
|
}
|
|
5792
5814
|
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
5793
5815
|
'realtimeInputConfig',
|
|
5794
5816
|
]);
|
|
5795
5817
|
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
5796
|
-
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
5818
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev$1(apiClient, fromRealtimeInputConfig));
|
|
5797
5819
|
}
|
|
5798
5820
|
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
5799
5821
|
'contextWindowCompression',
|
|
5800
5822
|
]);
|
|
5801
5823
|
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
5802
|
-
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
5824
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev$1(apiClient, fromContextWindowCompression));
|
|
5803
5825
|
}
|
|
5804
5826
|
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
5805
5827
|
if (parentObject !== undefined && fromProactivity != null) {
|
|
5806
|
-
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
5828
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev$1(apiClient, fromProactivity));
|
|
5807
5829
|
}
|
|
5808
5830
|
return toObject;
|
|
5809
5831
|
}
|
|
@@ -5919,7 +5941,7 @@ function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
|
5919
5941
|
}
|
|
5920
5942
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5921
5943
|
if (fromConfig != null) {
|
|
5922
|
-
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
5944
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev$1(apiClient, fromConfig, toObject));
|
|
5923
5945
|
}
|
|
5924
5946
|
return toObject;
|
|
5925
5947
|
}
|
|
@@ -6274,6 +6296,12 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
6274
6296
|
if (fromFileData != null) {
|
|
6275
6297
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
|
|
6276
6298
|
}
|
|
6299
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6300
|
+
'thoughtSignature',
|
|
6301
|
+
]);
|
|
6302
|
+
if (fromThoughtSignature != null) {
|
|
6303
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6304
|
+
}
|
|
6277
6305
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6278
6306
|
'codeExecutionResult',
|
|
6279
6307
|
]);
|
|
@@ -6322,6 +6350,12 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
6322
6350
|
if (fromFileData != null) {
|
|
6323
6351
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
|
|
6324
6352
|
}
|
|
6353
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6354
|
+
'thoughtSignature',
|
|
6355
|
+
]);
|
|
6356
|
+
if (fromThoughtSignature != null) {
|
|
6357
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6358
|
+
}
|
|
6325
6359
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6326
6360
|
'codeExecutionResult',
|
|
6327
6361
|
]);
|
|
@@ -7112,7 +7146,7 @@ function liveMusicServerMessageFromMldev(apiClient, fromObject) {
|
|
|
7112
7146
|
* Copyright 2025 Google LLC
|
|
7113
7147
|
* SPDX-License-Identifier: Apache-2.0
|
|
7114
7148
|
*/
|
|
7115
|
-
function videoMetadataToMldev(apiClient, fromObject) {
|
|
7149
|
+
function videoMetadataToMldev$1(apiClient, fromObject) {
|
|
7116
7150
|
const toObject = {};
|
|
7117
7151
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
7118
7152
|
if (fromFps != null) {
|
|
@@ -7128,7 +7162,7 @@ function videoMetadataToMldev(apiClient, fromObject) {
|
|
|
7128
7162
|
}
|
|
7129
7163
|
return toObject;
|
|
7130
7164
|
}
|
|
7131
|
-
function blobToMldev(apiClient, fromObject) {
|
|
7165
|
+
function blobToMldev$1(apiClient, fromObject) {
|
|
7132
7166
|
const toObject = {};
|
|
7133
7167
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7134
7168
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7143,7 +7177,7 @@ function blobToMldev(apiClient, fromObject) {
|
|
|
7143
7177
|
}
|
|
7144
7178
|
return toObject;
|
|
7145
7179
|
}
|
|
7146
|
-
function fileDataToMldev(apiClient, fromObject) {
|
|
7180
|
+
function fileDataToMldev$1(apiClient, fromObject) {
|
|
7147
7181
|
const toObject = {};
|
|
7148
7182
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7149
7183
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7158,13 +7192,13 @@ function fileDataToMldev(apiClient, fromObject) {
|
|
|
7158
7192
|
}
|
|
7159
7193
|
return toObject;
|
|
7160
7194
|
}
|
|
7161
|
-
function partToMldev(apiClient, fromObject) {
|
|
7195
|
+
function partToMldev$1(apiClient, fromObject) {
|
|
7162
7196
|
const toObject = {};
|
|
7163
7197
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
7164
7198
|
'videoMetadata',
|
|
7165
7199
|
]);
|
|
7166
7200
|
if (fromVideoMetadata != null) {
|
|
7167
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
7201
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$1(apiClient, fromVideoMetadata));
|
|
7168
7202
|
}
|
|
7169
7203
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
7170
7204
|
if (fromThought != null) {
|
|
@@ -7172,11 +7206,17 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7172
7206
|
}
|
|
7173
7207
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7174
7208
|
if (fromInlineData != null) {
|
|
7175
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
7209
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
7176
7210
|
}
|
|
7177
7211
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
7178
7212
|
if (fromFileData != null) {
|
|
7179
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
7213
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
|
|
7214
|
+
}
|
|
7215
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
7216
|
+
'thoughtSignature',
|
|
7217
|
+
]);
|
|
7218
|
+
if (fromThoughtSignature != null) {
|
|
7219
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7180
7220
|
}
|
|
7181
7221
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7182
7222
|
'codeExecutionResult',
|
|
@@ -7206,14 +7246,14 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7206
7246
|
}
|
|
7207
7247
|
return toObject;
|
|
7208
7248
|
}
|
|
7209
|
-
function contentToMldev(apiClient, fromObject) {
|
|
7249
|
+
function contentToMldev$1(apiClient, fromObject) {
|
|
7210
7250
|
const toObject = {};
|
|
7211
7251
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7212
7252
|
if (fromParts != null) {
|
|
7213
7253
|
let transformedList = fromParts;
|
|
7214
7254
|
if (Array.isArray(transformedList)) {
|
|
7215
7255
|
transformedList = transformedList.map((item) => {
|
|
7216
|
-
return partToMldev(apiClient, item);
|
|
7256
|
+
return partToMldev$1(apiClient, item);
|
|
7217
7257
|
});
|
|
7218
7258
|
}
|
|
7219
7259
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -7337,7 +7377,7 @@ function safetySettingToMldev(apiClient, fromObject) {
|
|
|
7337
7377
|
}
|
|
7338
7378
|
return toObject;
|
|
7339
7379
|
}
|
|
7340
|
-
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
7380
|
+
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
7341
7381
|
const toObject = {};
|
|
7342
7382
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
7343
7383
|
if (fromBehavior != null) {
|
|
@@ -7361,7 +7401,7 @@ function functionDeclarationToMldev(apiClient, fromObject) {
|
|
|
7361
7401
|
}
|
|
7362
7402
|
return toObject;
|
|
7363
7403
|
}
|
|
7364
|
-
function intervalToMldev(apiClient, fromObject) {
|
|
7404
|
+
function intervalToMldev$1(apiClient, fromObject) {
|
|
7365
7405
|
const toObject = {};
|
|
7366
7406
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
7367
7407
|
if (fromStartTime != null) {
|
|
@@ -7373,17 +7413,17 @@ function intervalToMldev(apiClient, fromObject) {
|
|
|
7373
7413
|
}
|
|
7374
7414
|
return toObject;
|
|
7375
7415
|
}
|
|
7376
|
-
function googleSearchToMldev(apiClient, fromObject) {
|
|
7416
|
+
function googleSearchToMldev$1(apiClient, fromObject) {
|
|
7377
7417
|
const toObject = {};
|
|
7378
7418
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
7379
7419
|
'timeRangeFilter',
|
|
7380
7420
|
]);
|
|
7381
7421
|
if (fromTimeRangeFilter != null) {
|
|
7382
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
7422
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(apiClient, fromTimeRangeFilter));
|
|
7383
7423
|
}
|
|
7384
7424
|
return toObject;
|
|
7385
7425
|
}
|
|
7386
|
-
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
7426
|
+
function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
7387
7427
|
const toObject = {};
|
|
7388
7428
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
7389
7429
|
if (fromMode != null) {
|
|
@@ -7397,21 +7437,21 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
|
7397
7437
|
}
|
|
7398
7438
|
return toObject;
|
|
7399
7439
|
}
|
|
7400
|
-
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
7440
|
+
function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
7401
7441
|
const toObject = {};
|
|
7402
7442
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
7403
7443
|
'dynamicRetrievalConfig',
|
|
7404
7444
|
]);
|
|
7405
7445
|
if (fromDynamicRetrievalConfig != null) {
|
|
7406
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
7446
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
|
|
7407
7447
|
}
|
|
7408
7448
|
return toObject;
|
|
7409
7449
|
}
|
|
7410
|
-
function urlContextToMldev() {
|
|
7450
|
+
function urlContextToMldev$1() {
|
|
7411
7451
|
const toObject = {};
|
|
7412
7452
|
return toObject;
|
|
7413
7453
|
}
|
|
7414
|
-
function toolToMldev(apiClient, fromObject) {
|
|
7454
|
+
function toolToMldev$1(apiClient, fromObject) {
|
|
7415
7455
|
const toObject = {};
|
|
7416
7456
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7417
7457
|
'functionDeclarations',
|
|
@@ -7420,7 +7460,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7420
7460
|
let transformedList = fromFunctionDeclarations;
|
|
7421
7461
|
if (Array.isArray(transformedList)) {
|
|
7422
7462
|
transformedList = transformedList.map((item) => {
|
|
7423
|
-
return functionDeclarationToMldev(apiClient, item);
|
|
7463
|
+
return functionDeclarationToMldev$1(apiClient, item);
|
|
7424
7464
|
});
|
|
7425
7465
|
}
|
|
7426
7466
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -7430,13 +7470,13 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7430
7470
|
}
|
|
7431
7471
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
7432
7472
|
if (fromGoogleSearch != null) {
|
|
7433
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
7473
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(apiClient, fromGoogleSearch));
|
|
7434
7474
|
}
|
|
7435
7475
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7436
7476
|
'googleSearchRetrieval',
|
|
7437
7477
|
]);
|
|
7438
7478
|
if (fromGoogleSearchRetrieval != null) {
|
|
7439
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
7479
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
|
|
7440
7480
|
}
|
|
7441
7481
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
7442
7482
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -7446,7 +7486,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7446
7486
|
}
|
|
7447
7487
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
7448
7488
|
if (fromUrlContext != null) {
|
|
7449
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
7489
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
|
|
7450
7490
|
}
|
|
7451
7491
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
7452
7492
|
'codeExecution',
|
|
@@ -7510,7 +7550,7 @@ function toolConfigToMldev(apiClient, fromObject) {
|
|
|
7510
7550
|
}
|
|
7511
7551
|
return toObject;
|
|
7512
7552
|
}
|
|
7513
|
-
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
7553
|
+
function prebuiltVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7514
7554
|
const toObject = {};
|
|
7515
7555
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
7516
7556
|
if (fromVoiceName != null) {
|
|
@@ -7518,17 +7558,17 @@ function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7518
7558
|
}
|
|
7519
7559
|
return toObject;
|
|
7520
7560
|
}
|
|
7521
|
-
function voiceConfigToMldev(apiClient, fromObject) {
|
|
7561
|
+
function voiceConfigToMldev$1(apiClient, fromObject) {
|
|
7522
7562
|
const toObject = {};
|
|
7523
7563
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
7524
7564
|
'prebuiltVoiceConfig',
|
|
7525
7565
|
]);
|
|
7526
7566
|
if (fromPrebuiltVoiceConfig != null) {
|
|
7527
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
7567
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$1(apiClient, fromPrebuiltVoiceConfig));
|
|
7528
7568
|
}
|
|
7529
7569
|
return toObject;
|
|
7530
7570
|
}
|
|
7531
|
-
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
7571
|
+
function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7532
7572
|
const toObject = {};
|
|
7533
7573
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
7534
7574
|
if (fromSpeaker != null) {
|
|
@@ -7536,11 +7576,11 @@ function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7536
7576
|
}
|
|
7537
7577
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7538
7578
|
if (fromVoiceConfig != null) {
|
|
7539
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
7579
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
7540
7580
|
}
|
|
7541
7581
|
return toObject;
|
|
7542
7582
|
}
|
|
7543
|
-
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
7583
|
+
function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7544
7584
|
const toObject = {};
|
|
7545
7585
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
7546
7586
|
'speakerVoiceConfigs',
|
|
@@ -7549,24 +7589,24 @@ function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7549
7589
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
7550
7590
|
if (Array.isArray(transformedList)) {
|
|
7551
7591
|
transformedList = transformedList.map((item) => {
|
|
7552
|
-
return speakerVoiceConfigToMldev(apiClient, item);
|
|
7592
|
+
return speakerVoiceConfigToMldev$1(apiClient, item);
|
|
7553
7593
|
});
|
|
7554
7594
|
}
|
|
7555
7595
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
7556
7596
|
}
|
|
7557
7597
|
return toObject;
|
|
7558
7598
|
}
|
|
7559
|
-
function speechConfigToMldev(apiClient, fromObject) {
|
|
7599
|
+
function speechConfigToMldev$1(apiClient, fromObject) {
|
|
7560
7600
|
const toObject = {};
|
|
7561
7601
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7562
7602
|
if (fromVoiceConfig != null) {
|
|
7563
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
7603
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
7564
7604
|
}
|
|
7565
7605
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
7566
7606
|
'multiSpeakerVoiceConfig',
|
|
7567
7607
|
]);
|
|
7568
7608
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
7569
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
7609
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$1(apiClient, fromMultiSpeakerVoiceConfig));
|
|
7570
7610
|
}
|
|
7571
7611
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
7572
7612
|
if (fromLanguageCode != null) {
|
|
@@ -7596,7 +7636,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7596
7636
|
'systemInstruction',
|
|
7597
7637
|
]);
|
|
7598
7638
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
7599
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
7639
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
7600
7640
|
}
|
|
7601
7641
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
7602
7642
|
if (fromTemperature != null) {
|
|
@@ -7689,7 +7729,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7689
7729
|
let transformedList = tTools(apiClient, fromTools);
|
|
7690
7730
|
if (Array.isArray(transformedList)) {
|
|
7691
7731
|
transformedList = transformedList.map((item) => {
|
|
7692
|
-
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
7732
|
+
return toolToMldev$1(apiClient, tTool(apiClient, item));
|
|
7693
7733
|
});
|
|
7694
7734
|
}
|
|
7695
7735
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -7721,7 +7761,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7721
7761
|
}
|
|
7722
7762
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
7723
7763
|
if (fromSpeechConfig != null) {
|
|
7724
|
-
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
7764
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$1(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
7725
7765
|
}
|
|
7726
7766
|
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
7727
7767
|
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
@@ -7745,7 +7785,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
|
|
|
7745
7785
|
let transformedList = tContents(apiClient, fromContents);
|
|
7746
7786
|
if (Array.isArray(transformedList)) {
|
|
7747
7787
|
transformedList = transformedList.map((item) => {
|
|
7748
|
-
return contentToMldev(apiClient, item);
|
|
7788
|
+
return contentToMldev$1(apiClient, item);
|
|
7749
7789
|
});
|
|
7750
7790
|
}
|
|
7751
7791
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -7997,7 +8037,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
|
|
|
7997
8037
|
let transformedList = tContents(apiClient, fromContents);
|
|
7998
8038
|
if (Array.isArray(transformedList)) {
|
|
7999
8039
|
transformedList = transformedList.map((item) => {
|
|
8000
|
-
return contentToMldev(apiClient, item);
|
|
8040
|
+
return contentToMldev$1(apiClient, item);
|
|
8001
8041
|
});
|
|
8002
8042
|
}
|
|
8003
8043
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8164,6 +8204,12 @@ function partToVertex(apiClient, fromObject) {
|
|
|
8164
8204
|
if (fromFileData != null) {
|
|
8165
8205
|
setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
|
|
8166
8206
|
}
|
|
8207
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
8208
|
+
'thoughtSignature',
|
|
8209
|
+
]);
|
|
8210
|
+
if (fromThoughtSignature != null) {
|
|
8211
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8212
|
+
}
|
|
8167
8213
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8168
8214
|
'codeExecutionResult',
|
|
8169
8215
|
]);
|
|
@@ -9501,6 +9547,12 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
9501
9547
|
if (fromFileData != null) {
|
|
9502
9548
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
|
|
9503
9549
|
}
|
|
9550
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
9551
|
+
'thoughtSignature',
|
|
9552
|
+
]);
|
|
9553
|
+
if (fromThoughtSignature != null) {
|
|
9554
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9555
|
+
}
|
|
9504
9556
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9505
9557
|
'codeExecutionResult',
|
|
9506
9558
|
]);
|
|
@@ -10019,6 +10071,12 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
10019
10071
|
if (fromFileData != null) {
|
|
10020
10072
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
|
|
10021
10073
|
}
|
|
10074
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
10075
|
+
'thoughtSignature',
|
|
10076
|
+
]);
|
|
10077
|
+
if (fromThoughtSignature != null) {
|
|
10078
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10079
|
+
}
|
|
10022
10080
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10023
10081
|
'codeExecutionResult',
|
|
10024
10082
|
]);
|
|
@@ -10561,7 +10619,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10561
10619
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10562
10620
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10563
10621
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10564
|
-
const SDK_VERSION = '1.
|
|
10622
|
+
const SDK_VERSION = '1.3.0'; // x-release-please-version
|
|
10565
10623
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10566
10624
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10567
10625
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11113,11 +11171,9 @@ function hasNonMcpTools(params) {
|
|
|
11113
11171
|
}
|
|
11114
11172
|
// Returns true if the object is a MCP CallableTool, otherwise false.
|
|
11115
11173
|
function isMcpCallableTool(object) {
|
|
11116
|
-
// TODO: b/418266406 - Add a more robust check for the MCP CallableTool.
|
|
11117
11174
|
return (object !== null &&
|
|
11118
11175
|
typeof object === 'object' &&
|
|
11119
|
-
|
|
11120
|
-
'callTool' in object);
|
|
11176
|
+
object instanceof McpCallableTool);
|
|
11121
11177
|
}
|
|
11122
11178
|
// List all tools from the MCP client.
|
|
11123
11179
|
function listAllTools(mcpClient, maxTools = 100) {
|
|
@@ -11597,7 +11653,14 @@ class Live {
|
|
|
11597
11653
|
}
|
|
11598
11654
|
else {
|
|
11599
11655
|
const apiKey = this.apiClient.getApiKey();
|
|
11600
|
-
|
|
11656
|
+
let method = 'BidiGenerateContent';
|
|
11657
|
+
let keyName = 'key';
|
|
11658
|
+
if (apiKey === null || apiKey === void 0 ? void 0 : apiKey.startsWith('auth_tokens/')) {
|
|
11659
|
+
console.warn('Warning: Ephemeral token support is experimental and may change in future versions.');
|
|
11660
|
+
method = 'BidiGenerateContentConstrained';
|
|
11661
|
+
keyName = 'access_token';
|
|
11662
|
+
}
|
|
11663
|
+
url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.${method}?${keyName}=${apiKey}`;
|
|
11601
11664
|
}
|
|
11602
11665
|
let onopenResolve = () => { };
|
|
11603
11666
|
const onopenPromise = new Promise((resolve) => {
|
|
@@ -11703,7 +11766,7 @@ class Session {
|
|
|
11703
11766
|
contents = contents.map((item) => contentToVertex(apiClient, item));
|
|
11704
11767
|
}
|
|
11705
11768
|
else {
|
|
11706
|
-
contents = contents.map((item) => contentToMldev(apiClient, item));
|
|
11769
|
+
contents = contents.map((item) => contentToMldev$1(apiClient, item));
|
|
11707
11770
|
}
|
|
11708
11771
|
}
|
|
11709
11772
|
catch (_a) {
|
|
@@ -12001,7 +12064,6 @@ class Models extends BaseModule {
|
|
|
12001
12064
|
if (!hasMcpClientTools(params) || shouldDisableAfc(params.config)) {
|
|
12002
12065
|
return await this.generateContentInternal(transformedParams);
|
|
12003
12066
|
}
|
|
12004
|
-
// TODO: b/418266406 - Improve the check for CallableTools and Tools.
|
|
12005
12067
|
if (hasNonMcpTools(params)) {
|
|
12006
12068
|
throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
|
|
12007
12069
|
}
|
|
@@ -13556,19 +13618,857 @@ class Operations extends BaseModule {
|
|
|
13556
13618
|
* Copyright 2025 Google LLC
|
|
13557
13619
|
* SPDX-License-Identifier: Apache-2.0
|
|
13558
13620
|
*/
|
|
13559
|
-
|
|
13560
|
-
const
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
|
|
13565
|
-
|
|
13621
|
+
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
13622
|
+
const toObject = {};
|
|
13623
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
13624
|
+
if (fromVoiceName != null) {
|
|
13625
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
13626
|
+
}
|
|
13627
|
+
return toObject;
|
|
13628
|
+
}
|
|
13629
|
+
function voiceConfigToMldev(apiClient, fromObject) {
|
|
13630
|
+
const toObject = {};
|
|
13631
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
13632
|
+
'prebuiltVoiceConfig',
|
|
13633
|
+
]);
|
|
13634
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
13635
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
13636
|
+
}
|
|
13637
|
+
return toObject;
|
|
13638
|
+
}
|
|
13639
|
+
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13640
|
+
const toObject = {};
|
|
13641
|
+
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
13642
|
+
if (fromSpeaker != null) {
|
|
13643
|
+
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
13644
|
+
}
|
|
13645
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13646
|
+
if (fromVoiceConfig != null) {
|
|
13647
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13648
|
+
}
|
|
13649
|
+
return toObject;
|
|
13650
|
+
}
|
|
13651
|
+
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13652
|
+
const toObject = {};
|
|
13653
|
+
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
13654
|
+
'speakerVoiceConfigs',
|
|
13655
|
+
]);
|
|
13656
|
+
if (fromSpeakerVoiceConfigs != null) {
|
|
13657
|
+
let transformedList = fromSpeakerVoiceConfigs;
|
|
13658
|
+
if (Array.isArray(transformedList)) {
|
|
13659
|
+
transformedList = transformedList.map((item) => {
|
|
13660
|
+
return speakerVoiceConfigToMldev(apiClient, item);
|
|
13661
|
+
});
|
|
13566
13662
|
}
|
|
13567
|
-
|
|
13568
|
-
this.googleAuth = new GoogleAuth(vertexAuthOptions);
|
|
13663
|
+
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
13569
13664
|
}
|
|
13570
|
-
|
|
13571
|
-
|
|
13665
|
+
return toObject;
|
|
13666
|
+
}
|
|
13667
|
+
function speechConfigToMldev(apiClient, fromObject) {
|
|
13668
|
+
const toObject = {};
|
|
13669
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13670
|
+
if (fromVoiceConfig != null) {
|
|
13671
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13672
|
+
}
|
|
13673
|
+
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
13674
|
+
'multiSpeakerVoiceConfig',
|
|
13675
|
+
]);
|
|
13676
|
+
if (fromMultiSpeakerVoiceConfig != null) {
|
|
13677
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
13678
|
+
}
|
|
13679
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
13680
|
+
if (fromLanguageCode != null) {
|
|
13681
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
13682
|
+
}
|
|
13683
|
+
return toObject;
|
|
13684
|
+
}
|
|
13685
|
+
function videoMetadataToMldev(apiClient, fromObject) {
|
|
13686
|
+
const toObject = {};
|
|
13687
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
13688
|
+
if (fromFps != null) {
|
|
13689
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
13690
|
+
}
|
|
13691
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
13692
|
+
if (fromEndOffset != null) {
|
|
13693
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
13694
|
+
}
|
|
13695
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
13696
|
+
if (fromStartOffset != null) {
|
|
13697
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
13698
|
+
}
|
|
13699
|
+
return toObject;
|
|
13700
|
+
}
|
|
13701
|
+
function blobToMldev(apiClient, fromObject) {
|
|
13702
|
+
const toObject = {};
|
|
13703
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13704
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13705
|
+
}
|
|
13706
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
13707
|
+
if (fromData != null) {
|
|
13708
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
13709
|
+
}
|
|
13710
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13711
|
+
if (fromMimeType != null) {
|
|
13712
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13713
|
+
}
|
|
13714
|
+
return toObject;
|
|
13715
|
+
}
|
|
13716
|
+
function fileDataToMldev(apiClient, fromObject) {
|
|
13717
|
+
const toObject = {};
|
|
13718
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13719
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13720
|
+
}
|
|
13721
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
13722
|
+
if (fromFileUri != null) {
|
|
13723
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
13724
|
+
}
|
|
13725
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13726
|
+
if (fromMimeType != null) {
|
|
13727
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13728
|
+
}
|
|
13729
|
+
return toObject;
|
|
13730
|
+
}
|
|
13731
|
+
function partToMldev(apiClient, fromObject) {
|
|
13732
|
+
const toObject = {};
|
|
13733
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
13734
|
+
'videoMetadata',
|
|
13735
|
+
]);
|
|
13736
|
+
if (fromVideoMetadata != null) {
|
|
13737
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
13738
|
+
}
|
|
13739
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
13740
|
+
if (fromThought != null) {
|
|
13741
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
13742
|
+
}
|
|
13743
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
13744
|
+
if (fromInlineData != null) {
|
|
13745
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
13746
|
+
}
|
|
13747
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
13748
|
+
if (fromFileData != null) {
|
|
13749
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
13750
|
+
}
|
|
13751
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
13752
|
+
'thoughtSignature',
|
|
13753
|
+
]);
|
|
13754
|
+
if (fromThoughtSignature != null) {
|
|
13755
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13756
|
+
}
|
|
13757
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13758
|
+
'codeExecutionResult',
|
|
13759
|
+
]);
|
|
13760
|
+
if (fromCodeExecutionResult != null) {
|
|
13761
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
13762
|
+
}
|
|
13763
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
13764
|
+
'executableCode',
|
|
13765
|
+
]);
|
|
13766
|
+
if (fromExecutableCode != null) {
|
|
13767
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13768
|
+
}
|
|
13769
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13770
|
+
if (fromFunctionCall != null) {
|
|
13771
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13772
|
+
}
|
|
13773
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13774
|
+
'functionResponse',
|
|
13775
|
+
]);
|
|
13776
|
+
if (fromFunctionResponse != null) {
|
|
13777
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
13778
|
+
}
|
|
13779
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
13780
|
+
if (fromText != null) {
|
|
13781
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
13782
|
+
}
|
|
13783
|
+
return toObject;
|
|
13784
|
+
}
|
|
13785
|
+
function contentToMldev(apiClient, fromObject) {
|
|
13786
|
+
const toObject = {};
|
|
13787
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13788
|
+
if (fromParts != null) {
|
|
13789
|
+
let transformedList = fromParts;
|
|
13790
|
+
if (Array.isArray(transformedList)) {
|
|
13791
|
+
transformedList = transformedList.map((item) => {
|
|
13792
|
+
return partToMldev(apiClient, item);
|
|
13793
|
+
});
|
|
13794
|
+
}
|
|
13795
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
13796
|
+
}
|
|
13797
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
13798
|
+
if (fromRole != null) {
|
|
13799
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
13800
|
+
}
|
|
13801
|
+
return toObject;
|
|
13802
|
+
}
|
|
13803
|
+
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
13804
|
+
const toObject = {};
|
|
13805
|
+
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
13806
|
+
if (fromBehavior != null) {
|
|
13807
|
+
setValueByPath(toObject, ['behavior'], fromBehavior);
|
|
13808
|
+
}
|
|
13809
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
13810
|
+
if (fromDescription != null) {
|
|
13811
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
13812
|
+
}
|
|
13813
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13814
|
+
if (fromName != null) {
|
|
13815
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13816
|
+
}
|
|
13817
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
13818
|
+
if (fromParameters != null) {
|
|
13819
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
13820
|
+
}
|
|
13821
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
13822
|
+
if (fromResponse != null) {
|
|
13823
|
+
setValueByPath(toObject, ['response'], fromResponse);
|
|
13824
|
+
}
|
|
13825
|
+
return toObject;
|
|
13826
|
+
}
|
|
13827
|
+
function intervalToMldev(apiClient, fromObject) {
|
|
13828
|
+
const toObject = {};
|
|
13829
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
13830
|
+
if (fromStartTime != null) {
|
|
13831
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
13832
|
+
}
|
|
13833
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
13834
|
+
if (fromEndTime != null) {
|
|
13835
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
13836
|
+
}
|
|
13837
|
+
return toObject;
|
|
13838
|
+
}
|
|
13839
|
+
function googleSearchToMldev(apiClient, fromObject) {
|
|
13840
|
+
const toObject = {};
|
|
13841
|
+
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
13842
|
+
'timeRangeFilter',
|
|
13843
|
+
]);
|
|
13844
|
+
if (fromTimeRangeFilter != null) {
|
|
13845
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
13846
|
+
}
|
|
13847
|
+
return toObject;
|
|
13848
|
+
}
|
|
13849
|
+
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
13850
|
+
const toObject = {};
|
|
13851
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
13852
|
+
if (fromMode != null) {
|
|
13853
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
13854
|
+
}
|
|
13855
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
13856
|
+
'dynamicThreshold',
|
|
13857
|
+
]);
|
|
13858
|
+
if (fromDynamicThreshold != null) {
|
|
13859
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
13860
|
+
}
|
|
13861
|
+
return toObject;
|
|
13862
|
+
}
|
|
13863
|
+
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
13864
|
+
const toObject = {};
|
|
13865
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
13866
|
+
'dynamicRetrievalConfig',
|
|
13867
|
+
]);
|
|
13868
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
13869
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
13870
|
+
}
|
|
13871
|
+
return toObject;
|
|
13872
|
+
}
|
|
13873
|
+
function urlContextToMldev() {
|
|
13874
|
+
const toObject = {};
|
|
13875
|
+
return toObject;
|
|
13876
|
+
}
|
|
13877
|
+
function toolToMldev(apiClient, fromObject) {
|
|
13878
|
+
const toObject = {};
|
|
13879
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
13880
|
+
'functionDeclarations',
|
|
13881
|
+
]);
|
|
13882
|
+
if (fromFunctionDeclarations != null) {
|
|
13883
|
+
let transformedList = fromFunctionDeclarations;
|
|
13884
|
+
if (Array.isArray(transformedList)) {
|
|
13885
|
+
transformedList = transformedList.map((item) => {
|
|
13886
|
+
return functionDeclarationToMldev(apiClient, item);
|
|
13887
|
+
});
|
|
13888
|
+
}
|
|
13889
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
13890
|
+
}
|
|
13891
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
13892
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
13893
|
+
}
|
|
13894
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
13895
|
+
if (fromGoogleSearch != null) {
|
|
13896
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
13897
|
+
}
|
|
13898
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
13899
|
+
'googleSearchRetrieval',
|
|
13900
|
+
]);
|
|
13901
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
13902
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
13903
|
+
}
|
|
13904
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
13905
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
13906
|
+
}
|
|
13907
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
13908
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
13909
|
+
}
|
|
13910
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
13911
|
+
if (fromUrlContext != null) {
|
|
13912
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
13913
|
+
}
|
|
13914
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
13915
|
+
'codeExecution',
|
|
13916
|
+
]);
|
|
13917
|
+
if (fromCodeExecution != null) {
|
|
13918
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
13919
|
+
}
|
|
13920
|
+
return toObject;
|
|
13921
|
+
}
|
|
13922
|
+
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
13923
|
+
const toObject = {};
|
|
13924
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
13925
|
+
if (fromHandle != null) {
|
|
13926
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
13927
|
+
}
|
|
13928
|
+
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
13929
|
+
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
13930
|
+
}
|
|
13931
|
+
return toObject;
|
|
13932
|
+
}
|
|
13933
|
+
function audioTranscriptionConfigToMldev() {
|
|
13934
|
+
const toObject = {};
|
|
13935
|
+
return toObject;
|
|
13936
|
+
}
|
|
13937
|
+
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
13938
|
+
const toObject = {};
|
|
13939
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
13940
|
+
if (fromDisabled != null) {
|
|
13941
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
13942
|
+
}
|
|
13943
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
13944
|
+
'startOfSpeechSensitivity',
|
|
13945
|
+
]);
|
|
13946
|
+
if (fromStartOfSpeechSensitivity != null) {
|
|
13947
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
13948
|
+
}
|
|
13949
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
13950
|
+
'endOfSpeechSensitivity',
|
|
13951
|
+
]);
|
|
13952
|
+
if (fromEndOfSpeechSensitivity != null) {
|
|
13953
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
13954
|
+
}
|
|
13955
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
13956
|
+
'prefixPaddingMs',
|
|
13957
|
+
]);
|
|
13958
|
+
if (fromPrefixPaddingMs != null) {
|
|
13959
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
13960
|
+
}
|
|
13961
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
13962
|
+
'silenceDurationMs',
|
|
13963
|
+
]);
|
|
13964
|
+
if (fromSilenceDurationMs != null) {
|
|
13965
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
13966
|
+
}
|
|
13967
|
+
return toObject;
|
|
13968
|
+
}
|
|
13969
|
+
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
13970
|
+
const toObject = {};
|
|
13971
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
13972
|
+
'automaticActivityDetection',
|
|
13973
|
+
]);
|
|
13974
|
+
if (fromAutomaticActivityDetection != null) {
|
|
13975
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
13976
|
+
}
|
|
13977
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
13978
|
+
'activityHandling',
|
|
13979
|
+
]);
|
|
13980
|
+
if (fromActivityHandling != null) {
|
|
13981
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
13982
|
+
}
|
|
13983
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
13984
|
+
if (fromTurnCoverage != null) {
|
|
13985
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
13986
|
+
}
|
|
13987
|
+
return toObject;
|
|
13988
|
+
}
|
|
13989
|
+
function slidingWindowToMldev(apiClient, fromObject) {
|
|
13990
|
+
const toObject = {};
|
|
13991
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
13992
|
+
if (fromTargetTokens != null) {
|
|
13993
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
13994
|
+
}
|
|
13995
|
+
return toObject;
|
|
13996
|
+
}
|
|
13997
|
+
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
13998
|
+
const toObject = {};
|
|
13999
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
14000
|
+
'triggerTokens',
|
|
14001
|
+
]);
|
|
14002
|
+
if (fromTriggerTokens != null) {
|
|
14003
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
14004
|
+
}
|
|
14005
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
14006
|
+
'slidingWindow',
|
|
14007
|
+
]);
|
|
14008
|
+
if (fromSlidingWindow != null) {
|
|
14009
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
14010
|
+
}
|
|
14011
|
+
return toObject;
|
|
14012
|
+
}
|
|
14013
|
+
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
14014
|
+
const toObject = {};
|
|
14015
|
+
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
14016
|
+
'proactiveAudio',
|
|
14017
|
+
]);
|
|
14018
|
+
if (fromProactiveAudio != null) {
|
|
14019
|
+
setValueByPath(toObject, ['proactiveAudio'], fromProactiveAudio);
|
|
14020
|
+
}
|
|
14021
|
+
return toObject;
|
|
14022
|
+
}
|
|
14023
|
+
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14024
|
+
const toObject = {};
|
|
14025
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
14026
|
+
'generationConfig',
|
|
14027
|
+
]);
|
|
14028
|
+
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
14029
|
+
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
14030
|
+
}
|
|
14031
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
14032
|
+
'responseModalities',
|
|
14033
|
+
]);
|
|
14034
|
+
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
14035
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
14036
|
+
}
|
|
14037
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
14038
|
+
if (parentObject !== undefined && fromTemperature != null) {
|
|
14039
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
14040
|
+
}
|
|
14041
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
14042
|
+
if (parentObject !== undefined && fromTopP != null) {
|
|
14043
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
14044
|
+
}
|
|
14045
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
14046
|
+
if (parentObject !== undefined && fromTopK != null) {
|
|
14047
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
14048
|
+
}
|
|
14049
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
14050
|
+
'maxOutputTokens',
|
|
14051
|
+
]);
|
|
14052
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
14053
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
14054
|
+
}
|
|
14055
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14056
|
+
'mediaResolution',
|
|
14057
|
+
]);
|
|
14058
|
+
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
14059
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
14060
|
+
}
|
|
14061
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
14062
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
14063
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
14064
|
+
}
|
|
14065
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
14066
|
+
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
14067
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
14068
|
+
}
|
|
14069
|
+
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
14070
|
+
'enableAffectiveDialog',
|
|
14071
|
+
]);
|
|
14072
|
+
if (parentObject !== undefined && fromEnableAffectiveDialog != null) {
|
|
14073
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'enableAffectiveDialog'], fromEnableAffectiveDialog);
|
|
14074
|
+
}
|
|
14075
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
14076
|
+
'systemInstruction',
|
|
14077
|
+
]);
|
|
14078
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
14079
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
14080
|
+
}
|
|
14081
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
14082
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
14083
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
14084
|
+
if (Array.isArray(transformedList)) {
|
|
14085
|
+
transformedList = transformedList.map((item) => {
|
|
14086
|
+
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
14087
|
+
});
|
|
14088
|
+
}
|
|
14089
|
+
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
14090
|
+
}
|
|
14091
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
14092
|
+
'sessionResumption',
|
|
14093
|
+
]);
|
|
14094
|
+
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
14095
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
14096
|
+
}
|
|
14097
|
+
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
14098
|
+
'inputAudioTranscription',
|
|
14099
|
+
]);
|
|
14100
|
+
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
14101
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14102
|
+
}
|
|
14103
|
+
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
14104
|
+
'outputAudioTranscription',
|
|
14105
|
+
]);
|
|
14106
|
+
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
14107
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14108
|
+
}
|
|
14109
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
14110
|
+
'realtimeInputConfig',
|
|
14111
|
+
]);
|
|
14112
|
+
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
14113
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
14114
|
+
}
|
|
14115
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
14116
|
+
'contextWindowCompression',
|
|
14117
|
+
]);
|
|
14118
|
+
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
14119
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
14120
|
+
}
|
|
14121
|
+
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
14122
|
+
if (parentObject !== undefined && fromProactivity != null) {
|
|
14123
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
14124
|
+
}
|
|
14125
|
+
return toObject;
|
|
14126
|
+
}
|
|
14127
|
+
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
14128
|
+
const toObject = {};
|
|
14129
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
14130
|
+
if (fromModel != null) {
|
|
14131
|
+
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
14132
|
+
}
|
|
14133
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14134
|
+
if (fromConfig != null) {
|
|
14135
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
14136
|
+
}
|
|
14137
|
+
return toObject;
|
|
14138
|
+
}
|
|
14139
|
+
function createAuthTokenConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14140
|
+
const toObject = {};
|
|
14141
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
14142
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
14143
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
14144
|
+
}
|
|
14145
|
+
const fromNewSessionExpireTime = getValueByPath(fromObject, [
|
|
14146
|
+
'newSessionExpireTime',
|
|
14147
|
+
]);
|
|
14148
|
+
if (parentObject !== undefined && fromNewSessionExpireTime != null) {
|
|
14149
|
+
setValueByPath(parentObject, ['newSessionExpireTime'], fromNewSessionExpireTime);
|
|
14150
|
+
}
|
|
14151
|
+
const fromUses = getValueByPath(fromObject, ['uses']);
|
|
14152
|
+
if (parentObject !== undefined && fromUses != null) {
|
|
14153
|
+
setValueByPath(parentObject, ['uses'], fromUses);
|
|
14154
|
+
}
|
|
14155
|
+
const fromLiveConnectConstraints = getValueByPath(fromObject, [
|
|
14156
|
+
'liveConnectConstraints',
|
|
14157
|
+
]);
|
|
14158
|
+
if (parentObject !== undefined && fromLiveConnectConstraints != null) {
|
|
14159
|
+
setValueByPath(parentObject, ['bidiGenerateContentSetup'], liveConnectConstraintsToMldev(apiClient, fromLiveConnectConstraints));
|
|
14160
|
+
}
|
|
14161
|
+
const fromLockAdditionalFields = getValueByPath(fromObject, [
|
|
14162
|
+
'lockAdditionalFields',
|
|
14163
|
+
]);
|
|
14164
|
+
if (parentObject !== undefined && fromLockAdditionalFields != null) {
|
|
14165
|
+
setValueByPath(parentObject, ['fieldMask'], fromLockAdditionalFields);
|
|
14166
|
+
}
|
|
14167
|
+
return toObject;
|
|
14168
|
+
}
|
|
14169
|
+
function createAuthTokenParametersToMldev(apiClient, fromObject) {
|
|
14170
|
+
const toObject = {};
|
|
14171
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14172
|
+
if (fromConfig != null) {
|
|
14173
|
+
setValueByPath(toObject, ['config'], createAuthTokenConfigToMldev(apiClient, fromConfig, toObject));
|
|
14174
|
+
}
|
|
14175
|
+
return toObject;
|
|
14176
|
+
}
|
|
14177
|
+
function authTokenFromMldev(apiClient, fromObject) {
|
|
14178
|
+
const toObject = {};
|
|
14179
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14180
|
+
if (fromName != null) {
|
|
14181
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14182
|
+
}
|
|
14183
|
+
return toObject;
|
|
14184
|
+
}
|
|
14185
|
+
|
|
14186
|
+
/**
|
|
14187
|
+
* @license
|
|
14188
|
+
* Copyright 2025 Google LLC
|
|
14189
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14190
|
+
*/
|
|
14191
|
+
/**
|
|
14192
|
+
* Returns a comma-separated list of field masks from a given object.
|
|
14193
|
+
*
|
|
14194
|
+
* @param setup The object to extract field masks from.
|
|
14195
|
+
* @return A comma-separated list of field masks.
|
|
14196
|
+
*/
|
|
14197
|
+
function getFieldMasks(setup) {
|
|
14198
|
+
const fields = [];
|
|
14199
|
+
for (const key in setup) {
|
|
14200
|
+
if (Object.prototype.hasOwnProperty.call(setup, key)) {
|
|
14201
|
+
const value = setup[key];
|
|
14202
|
+
// 2nd layer, recursively get field masks see TODO(b/418290100)
|
|
14203
|
+
if (typeof value === 'object' &&
|
|
14204
|
+
value != null &&
|
|
14205
|
+
Object.keys(value).length > 0) {
|
|
14206
|
+
const field = Object.keys(value).map((kk) => `${key}.${kk}`);
|
|
14207
|
+
fields.push(...field);
|
|
14208
|
+
}
|
|
14209
|
+
else {
|
|
14210
|
+
fields.push(key); // 1st layer
|
|
14211
|
+
}
|
|
14212
|
+
}
|
|
14213
|
+
}
|
|
14214
|
+
return fields.join(',');
|
|
14215
|
+
}
|
|
14216
|
+
/**
|
|
14217
|
+
* Converts bidiGenerateContentSetup.
|
|
14218
|
+
* @param requestDict - The request dictionary.
|
|
14219
|
+
* @param config - The configuration object.
|
|
14220
|
+
* @return - The modified request dictionary.
|
|
14221
|
+
*/
|
|
14222
|
+
function convertBidiSetupToTokenSetup(requestDict, config) {
|
|
14223
|
+
// Convert bidiGenerateContentSetup from bidiGenerateContentSetup.setup.
|
|
14224
|
+
let setupForMaskGeneration = null;
|
|
14225
|
+
const bidiGenerateContentSetupValue = requestDict['bidiGenerateContentSetup'];
|
|
14226
|
+
if (typeof bidiGenerateContentSetupValue === 'object' &&
|
|
14227
|
+
bidiGenerateContentSetupValue !== null &&
|
|
14228
|
+
'setup' in bidiGenerateContentSetupValue) {
|
|
14229
|
+
// Now we know bidiGenerateContentSetupValue is an object and has a 'setup'
|
|
14230
|
+
// property.
|
|
14231
|
+
const innerSetup = bidiGenerateContentSetupValue
|
|
14232
|
+
.setup;
|
|
14233
|
+
if (typeof innerSetup === 'object' && innerSetup !== null) {
|
|
14234
|
+
// Valid inner setup found.
|
|
14235
|
+
requestDict['bidiGenerateContentSetup'] = innerSetup;
|
|
14236
|
+
setupForMaskGeneration = innerSetup;
|
|
14237
|
+
}
|
|
14238
|
+
else {
|
|
14239
|
+
// `bidiGenerateContentSetupValue.setup` is not a valid object; treat as
|
|
14240
|
+
// if bidiGenerateContentSetup is invalid.
|
|
14241
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14242
|
+
}
|
|
14243
|
+
}
|
|
14244
|
+
else if (bidiGenerateContentSetupValue !== undefined) {
|
|
14245
|
+
// `bidiGenerateContentSetup` exists but not in the expected
|
|
14246
|
+
// shape {setup: {...}}; treat as invalid.
|
|
14247
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14248
|
+
}
|
|
14249
|
+
const preExistingFieldMask = requestDict['fieldMask'];
|
|
14250
|
+
// Handle mask generation setup.
|
|
14251
|
+
if (setupForMaskGeneration) {
|
|
14252
|
+
const generatedMaskFromBidi = getFieldMasks(setupForMaskGeneration);
|
|
14253
|
+
if (Array.isArray(config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14254
|
+
(config === null || config === void 0 ? void 0 : config.lockAdditionalFields.length) === 0) {
|
|
14255
|
+
// Case 1: lockAdditionalFields is an empty array. Lock only fields from
|
|
14256
|
+
// bidi setup.
|
|
14257
|
+
if (generatedMaskFromBidi) {
|
|
14258
|
+
// Only assign if mask is not empty
|
|
14259
|
+
requestDict['fieldMask'] = generatedMaskFromBidi;
|
|
14260
|
+
}
|
|
14261
|
+
else {
|
|
14262
|
+
delete requestDict['fieldMask']; // If mask is empty, effectively no
|
|
14263
|
+
// specific fields locked by bidi
|
|
14264
|
+
}
|
|
14265
|
+
}
|
|
14266
|
+
else if ((config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14267
|
+
config.lockAdditionalFields.length > 0 &&
|
|
14268
|
+
preExistingFieldMask !== null &&
|
|
14269
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14270
|
+
preExistingFieldMask.length > 0) {
|
|
14271
|
+
// Case 2: Lock fields from bidi setup + additional fields
|
|
14272
|
+
// (preExistingFieldMask).
|
|
14273
|
+
const generationConfigFields = [
|
|
14274
|
+
'temperature',
|
|
14275
|
+
'topK',
|
|
14276
|
+
'topP',
|
|
14277
|
+
'maxOutputTokens',
|
|
14278
|
+
'responseModalities',
|
|
14279
|
+
'seed',
|
|
14280
|
+
'speechConfig',
|
|
14281
|
+
];
|
|
14282
|
+
let mappedFieldsFromPreExisting = [];
|
|
14283
|
+
if (preExistingFieldMask.length > 0) {
|
|
14284
|
+
mappedFieldsFromPreExisting = preExistingFieldMask.map((field) => {
|
|
14285
|
+
if (generationConfigFields.includes(field)) {
|
|
14286
|
+
return `generationConfig.${field}`;
|
|
14287
|
+
}
|
|
14288
|
+
return field; // Keep original field name if not in
|
|
14289
|
+
// generationConfigFields
|
|
14290
|
+
});
|
|
14291
|
+
}
|
|
14292
|
+
const finalMaskParts = [];
|
|
14293
|
+
if (generatedMaskFromBidi) {
|
|
14294
|
+
finalMaskParts.push(generatedMaskFromBidi);
|
|
14295
|
+
}
|
|
14296
|
+
if (mappedFieldsFromPreExisting.length > 0) {
|
|
14297
|
+
finalMaskParts.push(...mappedFieldsFromPreExisting);
|
|
14298
|
+
}
|
|
14299
|
+
if (finalMaskParts.length > 0) {
|
|
14300
|
+
requestDict['fieldMask'] = finalMaskParts.join(',');
|
|
14301
|
+
}
|
|
14302
|
+
else {
|
|
14303
|
+
// If no fields from bidi and no valid additional fields from
|
|
14304
|
+
// pre-existing mask.
|
|
14305
|
+
delete requestDict['fieldMask'];
|
|
14306
|
+
}
|
|
14307
|
+
}
|
|
14308
|
+
else {
|
|
14309
|
+
// Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
|
|
14310
|
+
// defaults apply or all are mutable). This is hit if:
|
|
14311
|
+
// - `config.lockAdditionalFields` is undefined.
|
|
14312
|
+
// - `config.lockAdditionalFields` is non-empty, BUT
|
|
14313
|
+
// `preExistingFieldMask` is null, not a string, or an empty string.
|
|
14314
|
+
delete requestDict['fieldMask'];
|
|
14315
|
+
}
|
|
14316
|
+
}
|
|
14317
|
+
else {
|
|
14318
|
+
// No valid `bidiGenerateContentSetup` was found or extracted.
|
|
14319
|
+
// "Lock additional null fields if any".
|
|
14320
|
+
if (preExistingFieldMask !== null &&
|
|
14321
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14322
|
+
preExistingFieldMask.length > 0) {
|
|
14323
|
+
// If there's a pre-existing field mask, it's a string, and it's not
|
|
14324
|
+
// empty, then we should lock all fields.
|
|
14325
|
+
requestDict['fieldMask'] = preExistingFieldMask.join(',');
|
|
14326
|
+
}
|
|
14327
|
+
else {
|
|
14328
|
+
delete requestDict['fieldMask'];
|
|
14329
|
+
}
|
|
14330
|
+
}
|
|
14331
|
+
return requestDict;
|
|
14332
|
+
}
|
|
14333
|
+
class Tokens extends BaseModule {
|
|
14334
|
+
constructor(apiClient) {
|
|
14335
|
+
super();
|
|
14336
|
+
this.apiClient = apiClient;
|
|
14337
|
+
}
|
|
14338
|
+
/**
|
|
14339
|
+
* Creates an ephemeral auth token resource.
|
|
14340
|
+
*
|
|
14341
|
+
* @experimental
|
|
14342
|
+
*
|
|
14343
|
+
* @remarks
|
|
14344
|
+
* Ephermeral auth tokens is only supported in the Gemini Developer API.
|
|
14345
|
+
* It can be used for the session connection to the Live constrained API.
|
|
14346
|
+
*
|
|
14347
|
+
* @param params - The parameters for the create request.
|
|
14348
|
+
* @return The created auth token.
|
|
14349
|
+
*
|
|
14350
|
+
* @example
|
|
14351
|
+
* ```ts
|
|
14352
|
+
* // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
|
|
14353
|
+
* // when using the token in Live API sessions. Each session connection can
|
|
14354
|
+
* // use a different configuration.
|
|
14355
|
+
* const config: CreateAuthTokenConfig = {
|
|
14356
|
+
* uses: 3,
|
|
14357
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14358
|
+
* }
|
|
14359
|
+
* const token = await ai.tokens.create(config);
|
|
14360
|
+
*
|
|
14361
|
+
* // Case 2: If LiveEphemeralParameters is set, lock all fields in
|
|
14362
|
+
* // LiveConnectConfig when using the token in Live API sessions. For
|
|
14363
|
+
* // example, changing `outputAudioTranscription` in the Live API
|
|
14364
|
+
* // connection will be ignored by the API.
|
|
14365
|
+
* const config: CreateAuthTokenConfig =
|
|
14366
|
+
* uses: 3,
|
|
14367
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14368
|
+
* LiveEphemeralParameters: {
|
|
14369
|
+
* model: 'gemini-2.0-flash-001',
|
|
14370
|
+
* config: {
|
|
14371
|
+
* 'responseModalities': ['AUDIO'],
|
|
14372
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14373
|
+
* }
|
|
14374
|
+
* }
|
|
14375
|
+
* }
|
|
14376
|
+
* const token = await ai.tokens.create(config);
|
|
14377
|
+
*
|
|
14378
|
+
* // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14379
|
+
* // set, lock LiveConnectConfig with set and additional fields (e.g.
|
|
14380
|
+
* // responseModalities, systemInstruction, temperature in this example) when
|
|
14381
|
+
* // using the token in Live API sessions.
|
|
14382
|
+
* const config: CreateAuthTokenConfig =
|
|
14383
|
+
* uses: 3,
|
|
14384
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14385
|
+
* LiveEphemeralParameters: {
|
|
14386
|
+
* model: 'gemini-2.0-flash-001',
|
|
14387
|
+
* config: {
|
|
14388
|
+
* 'responseModalities': ['AUDIO'],
|
|
14389
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14390
|
+
* }
|
|
14391
|
+
* },
|
|
14392
|
+
* lockAdditionalFields: ['temperature'],
|
|
14393
|
+
* }
|
|
14394
|
+
* const token = await ai.tokens.create(config);
|
|
14395
|
+
*
|
|
14396
|
+
* // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14397
|
+
* // empty array, lock LiveConnectConfig with set fields (e.g.
|
|
14398
|
+
* // responseModalities, systemInstruction in this example) when using the
|
|
14399
|
+
* // token in Live API sessions.
|
|
14400
|
+
* const config: CreateAuthTokenConfig =
|
|
14401
|
+
* uses: 3,
|
|
14402
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14403
|
+
* LiveEphemeralParameters: {
|
|
14404
|
+
* model: 'gemini-2.0-flash-001',
|
|
14405
|
+
* config: {
|
|
14406
|
+
* 'responseModalities': ['AUDIO'],
|
|
14407
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14408
|
+
* }
|
|
14409
|
+
* },
|
|
14410
|
+
* lockAdditionalFields: [],
|
|
14411
|
+
* }
|
|
14412
|
+
* const token = await ai.tokens.create(config);
|
|
14413
|
+
* ```
|
|
14414
|
+
*/
|
|
14415
|
+
async create(params) {
|
|
14416
|
+
var _a, _b;
|
|
14417
|
+
let response;
|
|
14418
|
+
let path = '';
|
|
14419
|
+
let queryParams = {};
|
|
14420
|
+
if (this.apiClient.isVertexAI()) {
|
|
14421
|
+
throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
|
|
14422
|
+
}
|
|
14423
|
+
else {
|
|
14424
|
+
const body = createAuthTokenParametersToMldev(this.apiClient, params);
|
|
14425
|
+
path = formatMap('auth_tokens', body['_url']);
|
|
14426
|
+
queryParams = body['_query'];
|
|
14427
|
+
delete body['config'];
|
|
14428
|
+
delete body['_url'];
|
|
14429
|
+
delete body['_query'];
|
|
14430
|
+
const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
|
|
14431
|
+
response = this.apiClient
|
|
14432
|
+
.request({
|
|
14433
|
+
path: path,
|
|
14434
|
+
queryParams: queryParams,
|
|
14435
|
+
body: JSON.stringify(transformedBody),
|
|
14436
|
+
httpMethod: 'POST',
|
|
14437
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
14438
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14439
|
+
})
|
|
14440
|
+
.then((httpResponse) => {
|
|
14441
|
+
return httpResponse.json();
|
|
14442
|
+
});
|
|
14443
|
+
return response.then((apiResponse) => {
|
|
14444
|
+
const resp = authTokenFromMldev(this.apiClient, apiResponse);
|
|
14445
|
+
return resp;
|
|
14446
|
+
});
|
|
14447
|
+
}
|
|
14448
|
+
}
|
|
14449
|
+
}
|
|
14450
|
+
|
|
14451
|
+
/**
|
|
14452
|
+
* @license
|
|
14453
|
+
* Copyright 2025 Google LLC
|
|
14454
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14455
|
+
*/
|
|
14456
|
+
const GOOGLE_API_KEY_HEADER = 'x-goog-api-key';
|
|
14457
|
+
const REQUIRED_VERTEX_AI_SCOPE = 'https://www.googleapis.com/auth/cloud-platform';
|
|
14458
|
+
class NodeAuth {
|
|
14459
|
+
constructor(opts) {
|
|
14460
|
+
if (opts.apiKey !== undefined) {
|
|
14461
|
+
this.apiKey = opts.apiKey;
|
|
14462
|
+
return;
|
|
14463
|
+
}
|
|
14464
|
+
const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
|
|
14465
|
+
this.googleAuth = new GoogleAuth(vertexAuthOptions);
|
|
14466
|
+
}
|
|
14467
|
+
async addAuthHeaders(headers) {
|
|
14468
|
+
if (this.apiKey !== undefined) {
|
|
14469
|
+
if (this.apiKey.startsWith('auth_tokens/')) {
|
|
14470
|
+
throw new Error('Ephemeral tokens are only supported by the live API.');
|
|
14471
|
+
}
|
|
13572
14472
|
this.addKeyHeader(headers);
|
|
13573
14473
|
return;
|
|
13574
14474
|
}
|
|
@@ -14877,6 +15777,7 @@ class GoogleGenAI {
|
|
|
14877
15777
|
this.caches = new Caches(this.apiClient);
|
|
14878
15778
|
this.files = new Files(this.apiClient);
|
|
14879
15779
|
this.operations = new Operations(this.apiClient);
|
|
15780
|
+
this.authTokens = new Tokens(this.apiClient);
|
|
14880
15781
|
this.tunings = new Tunings(this.apiClient);
|
|
14881
15782
|
}
|
|
14882
15783
|
}
|
|
@@ -14894,5 +15795,5 @@ function stringToBoolean(str) {
|
|
|
14894
15795
|
return str.toLowerCase() === 'true';
|
|
14895
15796
|
}
|
|
14896
15797
|
|
|
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 };
|
|
15798
|
+
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
15799
|
//# sourceMappingURL=index.mjs.map
|