@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.cjs
CHANGED
|
@@ -219,7 +219,6 @@ function getValueByPath(data, keys) {
|
|
|
219
219
|
* Copyright 2025 Google LLC
|
|
220
220
|
* SPDX-License-Identifier: Apache-2.0
|
|
221
221
|
*/
|
|
222
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
223
222
|
/** Required. Outcome of the code execution. */
|
|
224
223
|
exports.Outcome = void 0;
|
|
225
224
|
(function (Outcome) {
|
|
@@ -455,6 +454,10 @@ exports.FinishReason = void 0;
|
|
|
455
454
|
* Token generation stopped because generated images have safety violations.
|
|
456
455
|
*/
|
|
457
456
|
FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
457
|
+
/**
|
|
458
|
+
* The tool call generated by the model is invalid.
|
|
459
|
+
*/
|
|
460
|
+
FinishReason["UNEXPECTED_TOOL_CALL"] = "UNEXPECTED_TOOL_CALL";
|
|
458
461
|
})(exports.FinishReason || (exports.FinishReason = {}));
|
|
459
462
|
/** Output only. Harm probability levels in the content. */
|
|
460
463
|
exports.HarmProbability = void 0;
|
|
@@ -1448,7 +1451,6 @@ class ReplayResponse {
|
|
|
1448
1451
|
*/
|
|
1449
1452
|
class RawReferenceImage {
|
|
1450
1453
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1451
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1452
1454
|
toReferenceImageAPI() {
|
|
1453
1455
|
const referenceImageAPI = {
|
|
1454
1456
|
referenceType: 'REFERENCE_TYPE_RAW',
|
|
@@ -1470,7 +1472,6 @@ class RawReferenceImage {
|
|
|
1470
1472
|
*/
|
|
1471
1473
|
class MaskReferenceImage {
|
|
1472
1474
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1473
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1474
1475
|
toReferenceImageAPI() {
|
|
1475
1476
|
const referenceImageAPI = {
|
|
1476
1477
|
referenceType: 'REFERENCE_TYPE_MASK',
|
|
@@ -1493,7 +1494,6 @@ class MaskReferenceImage {
|
|
|
1493
1494
|
*/
|
|
1494
1495
|
class ControlReferenceImage {
|
|
1495
1496
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1496
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1497
1497
|
toReferenceImageAPI() {
|
|
1498
1498
|
const referenceImageAPI = {
|
|
1499
1499
|
referenceType: 'REFERENCE_TYPE_CONTROL',
|
|
@@ -1514,7 +1514,6 @@ class ControlReferenceImage {
|
|
|
1514
1514
|
*/
|
|
1515
1515
|
class StyleReferenceImage {
|
|
1516
1516
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1517
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1518
1517
|
toReferenceImageAPI() {
|
|
1519
1518
|
const referenceImageAPI = {
|
|
1520
1519
|
referenceType: 'REFERENCE_TYPE_STYLE',
|
|
@@ -1535,7 +1534,6 @@ class StyleReferenceImage {
|
|
|
1535
1534
|
*/
|
|
1536
1535
|
class SubjectReferenceImage {
|
|
1537
1536
|
/* Internal method to convert to ReferenceImageAPIInternal. */
|
|
1538
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1539
1537
|
toReferenceImageAPI() {
|
|
1540
1538
|
const referenceImageAPI = {
|
|
1541
1539
|
referenceType: 'REFERENCE_TYPE_SUBJECT',
|
|
@@ -2450,7 +2448,7 @@ function filterToJsonSchema(schema) {
|
|
|
2450
2448
|
* Copyright 2025 Google LLC
|
|
2451
2449
|
* SPDX-License-Identifier: Apache-2.0
|
|
2452
2450
|
*/
|
|
2453
|
-
function videoMetadataToMldev$
|
|
2451
|
+
function videoMetadataToMldev$3(apiClient, fromObject) {
|
|
2454
2452
|
const toObject = {};
|
|
2455
2453
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
2456
2454
|
if (fromFps != null) {
|
|
@@ -2466,7 +2464,7 @@ function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
|
2466
2464
|
}
|
|
2467
2465
|
return toObject;
|
|
2468
2466
|
}
|
|
2469
|
-
function blobToMldev$
|
|
2467
|
+
function blobToMldev$3(apiClient, fromObject) {
|
|
2470
2468
|
const toObject = {};
|
|
2471
2469
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2472
2470
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2481,7 +2479,7 @@ function blobToMldev$2(apiClient, fromObject) {
|
|
|
2481
2479
|
}
|
|
2482
2480
|
return toObject;
|
|
2483
2481
|
}
|
|
2484
|
-
function fileDataToMldev$
|
|
2482
|
+
function fileDataToMldev$3(apiClient, fromObject) {
|
|
2485
2483
|
const toObject = {};
|
|
2486
2484
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2487
2485
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2496,13 +2494,13 @@ function fileDataToMldev$2(apiClient, fromObject) {
|
|
|
2496
2494
|
}
|
|
2497
2495
|
return toObject;
|
|
2498
2496
|
}
|
|
2499
|
-
function partToMldev$
|
|
2497
|
+
function partToMldev$3(apiClient, fromObject) {
|
|
2500
2498
|
const toObject = {};
|
|
2501
2499
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
2502
2500
|
'videoMetadata',
|
|
2503
2501
|
]);
|
|
2504
2502
|
if (fromVideoMetadata != null) {
|
|
2505
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
2503
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$3(apiClient, fromVideoMetadata));
|
|
2506
2504
|
}
|
|
2507
2505
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
2508
2506
|
if (fromThought != null) {
|
|
@@ -2510,11 +2508,17 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2510
2508
|
}
|
|
2511
2509
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
2512
2510
|
if (fromInlineData != null) {
|
|
2513
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
2511
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$3(apiClient, fromInlineData));
|
|
2514
2512
|
}
|
|
2515
2513
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
2516
2514
|
if (fromFileData != null) {
|
|
2517
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
2515
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$3(apiClient, fromFileData));
|
|
2516
|
+
}
|
|
2517
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2518
|
+
'thoughtSignature',
|
|
2519
|
+
]);
|
|
2520
|
+
if (fromThoughtSignature != null) {
|
|
2521
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2518
2522
|
}
|
|
2519
2523
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2520
2524
|
'codeExecutionResult',
|
|
@@ -2544,14 +2548,14 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2544
2548
|
}
|
|
2545
2549
|
return toObject;
|
|
2546
2550
|
}
|
|
2547
|
-
function contentToMldev$
|
|
2551
|
+
function contentToMldev$3(apiClient, fromObject) {
|
|
2548
2552
|
const toObject = {};
|
|
2549
2553
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2550
2554
|
if (fromParts != null) {
|
|
2551
2555
|
let transformedList = fromParts;
|
|
2552
2556
|
if (Array.isArray(transformedList)) {
|
|
2553
2557
|
transformedList = transformedList.map((item) => {
|
|
2554
|
-
return partToMldev$
|
|
2558
|
+
return partToMldev$3(apiClient, item);
|
|
2555
2559
|
});
|
|
2556
2560
|
}
|
|
2557
2561
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -2562,7 +2566,7 @@ function contentToMldev$2(apiClient, fromObject) {
|
|
|
2562
2566
|
}
|
|
2563
2567
|
return toObject;
|
|
2564
2568
|
}
|
|
2565
|
-
function functionDeclarationToMldev$
|
|
2569
|
+
function functionDeclarationToMldev$3(apiClient, fromObject) {
|
|
2566
2570
|
const toObject = {};
|
|
2567
2571
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
2568
2572
|
if (fromBehavior != null) {
|
|
@@ -2586,7 +2590,7 @@ function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
|
2586
2590
|
}
|
|
2587
2591
|
return toObject;
|
|
2588
2592
|
}
|
|
2589
|
-
function intervalToMldev$
|
|
2593
|
+
function intervalToMldev$3(apiClient, fromObject) {
|
|
2590
2594
|
const toObject = {};
|
|
2591
2595
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
2592
2596
|
if (fromStartTime != null) {
|
|
@@ -2598,17 +2602,17 @@ function intervalToMldev$2(apiClient, fromObject) {
|
|
|
2598
2602
|
}
|
|
2599
2603
|
return toObject;
|
|
2600
2604
|
}
|
|
2601
|
-
function googleSearchToMldev$
|
|
2605
|
+
function googleSearchToMldev$3(apiClient, fromObject) {
|
|
2602
2606
|
const toObject = {};
|
|
2603
2607
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
2604
2608
|
'timeRangeFilter',
|
|
2605
2609
|
]);
|
|
2606
2610
|
if (fromTimeRangeFilter != null) {
|
|
2607
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
2611
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(apiClient, fromTimeRangeFilter));
|
|
2608
2612
|
}
|
|
2609
2613
|
return toObject;
|
|
2610
2614
|
}
|
|
2611
|
-
function dynamicRetrievalConfigToMldev$
|
|
2615
|
+
function dynamicRetrievalConfigToMldev$3(apiClient, fromObject) {
|
|
2612
2616
|
const toObject = {};
|
|
2613
2617
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2614
2618
|
if (fromMode != null) {
|
|
@@ -2622,21 +2626,21 @@ function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
|
2622
2626
|
}
|
|
2623
2627
|
return toObject;
|
|
2624
2628
|
}
|
|
2625
|
-
function googleSearchRetrievalToMldev$
|
|
2629
|
+
function googleSearchRetrievalToMldev$3(apiClient, fromObject) {
|
|
2626
2630
|
const toObject = {};
|
|
2627
2631
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
2628
2632
|
'dynamicRetrievalConfig',
|
|
2629
2633
|
]);
|
|
2630
2634
|
if (fromDynamicRetrievalConfig != null) {
|
|
2631
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
2635
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$3(apiClient, fromDynamicRetrievalConfig));
|
|
2632
2636
|
}
|
|
2633
2637
|
return toObject;
|
|
2634
2638
|
}
|
|
2635
|
-
function urlContextToMldev$
|
|
2639
|
+
function urlContextToMldev$3() {
|
|
2636
2640
|
const toObject = {};
|
|
2637
2641
|
return toObject;
|
|
2638
2642
|
}
|
|
2639
|
-
function toolToMldev$
|
|
2643
|
+
function toolToMldev$3(apiClient, fromObject) {
|
|
2640
2644
|
const toObject = {};
|
|
2641
2645
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
2642
2646
|
'functionDeclarations',
|
|
@@ -2645,7 +2649,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2645
2649
|
let transformedList = fromFunctionDeclarations;
|
|
2646
2650
|
if (Array.isArray(transformedList)) {
|
|
2647
2651
|
transformedList = transformedList.map((item) => {
|
|
2648
|
-
return functionDeclarationToMldev$
|
|
2652
|
+
return functionDeclarationToMldev$3(apiClient, item);
|
|
2649
2653
|
});
|
|
2650
2654
|
}
|
|
2651
2655
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -2655,13 +2659,13 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2655
2659
|
}
|
|
2656
2660
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
2657
2661
|
if (fromGoogleSearch != null) {
|
|
2658
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
2662
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(apiClient, fromGoogleSearch));
|
|
2659
2663
|
}
|
|
2660
2664
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
2661
2665
|
'googleSearchRetrieval',
|
|
2662
2666
|
]);
|
|
2663
2667
|
if (fromGoogleSearchRetrieval != null) {
|
|
2664
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
2668
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$3(apiClient, fromGoogleSearchRetrieval));
|
|
2665
2669
|
}
|
|
2666
2670
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
2667
2671
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -2671,7 +2675,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2671
2675
|
}
|
|
2672
2676
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
2673
2677
|
if (fromUrlContext != null) {
|
|
2674
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
2678
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
|
|
2675
2679
|
}
|
|
2676
2680
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
2677
2681
|
'codeExecution',
|
|
@@ -2754,7 +2758,7 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2754
2758
|
let transformedList = tContents(apiClient, fromContents);
|
|
2755
2759
|
if (Array.isArray(transformedList)) {
|
|
2756
2760
|
transformedList = transformedList.map((item) => {
|
|
2757
|
-
return contentToMldev$
|
|
2761
|
+
return contentToMldev$3(apiClient, item);
|
|
2758
2762
|
});
|
|
2759
2763
|
}
|
|
2760
2764
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -2763,14 +2767,14 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2763
2767
|
'systemInstruction',
|
|
2764
2768
|
]);
|
|
2765
2769
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
2766
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$
|
|
2770
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$3(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
2767
2771
|
}
|
|
2768
2772
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
2769
2773
|
if (parentObject !== undefined && fromTools != null) {
|
|
2770
2774
|
let transformedList = fromTools;
|
|
2771
2775
|
if (Array.isArray(transformedList)) {
|
|
2772
2776
|
transformedList = transformedList.map((item) => {
|
|
2773
|
-
return toolToMldev$
|
|
2777
|
+
return toolToMldev$3(apiClient, item);
|
|
2774
2778
|
});
|
|
2775
2779
|
}
|
|
2776
2780
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -2932,6 +2936,12 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
2932
2936
|
if (fromFileData != null) {
|
|
2933
2937
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$2(apiClient, fromFileData));
|
|
2934
2938
|
}
|
|
2939
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2940
|
+
'thoughtSignature',
|
|
2941
|
+
]);
|
|
2942
|
+
if (fromThoughtSignature != null) {
|
|
2943
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2944
|
+
}
|
|
2935
2945
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2936
2946
|
'codeExecutionResult',
|
|
2937
2947
|
]);
|
|
@@ -4910,7 +4920,7 @@ class Files extends BaseModule {
|
|
|
4910
4920
|
* Copyright 2025 Google LLC
|
|
4911
4921
|
* SPDX-License-Identifier: Apache-2.0
|
|
4912
4922
|
*/
|
|
4913
|
-
function prebuiltVoiceConfigToMldev$
|
|
4923
|
+
function prebuiltVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4914
4924
|
const toObject = {};
|
|
4915
4925
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
4916
4926
|
if (fromVoiceName != null) {
|
|
@@ -4926,13 +4936,13 @@ function prebuiltVoiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
4926
4936
|
}
|
|
4927
4937
|
return toObject;
|
|
4928
4938
|
}
|
|
4929
|
-
function voiceConfigToMldev$
|
|
4939
|
+
function voiceConfigToMldev$2(apiClient, fromObject) {
|
|
4930
4940
|
const toObject = {};
|
|
4931
4941
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
4932
4942
|
'prebuiltVoiceConfig',
|
|
4933
4943
|
]);
|
|
4934
4944
|
if (fromPrebuiltVoiceConfig != null) {
|
|
4935
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$
|
|
4945
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$2(apiClient, fromPrebuiltVoiceConfig));
|
|
4936
4946
|
}
|
|
4937
4947
|
return toObject;
|
|
4938
4948
|
}
|
|
@@ -4946,7 +4956,7 @@ function voiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
4946
4956
|
}
|
|
4947
4957
|
return toObject;
|
|
4948
4958
|
}
|
|
4949
|
-
function speakerVoiceConfigToMldev$
|
|
4959
|
+
function speakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4950
4960
|
const toObject = {};
|
|
4951
4961
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
4952
4962
|
if (fromSpeaker != null) {
|
|
@@ -4954,11 +4964,11 @@ function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
4954
4964
|
}
|
|
4955
4965
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
4956
4966
|
if (fromVoiceConfig != null) {
|
|
4957
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
4967
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
4958
4968
|
}
|
|
4959
4969
|
return toObject;
|
|
4960
4970
|
}
|
|
4961
|
-
function multiSpeakerVoiceConfigToMldev$
|
|
4971
|
+
function multiSpeakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
4962
4972
|
const toObject = {};
|
|
4963
4973
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
4964
4974
|
'speakerVoiceConfigs',
|
|
@@ -4967,24 +4977,24 @@ function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
4967
4977
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
4968
4978
|
if (Array.isArray(transformedList)) {
|
|
4969
4979
|
transformedList = transformedList.map((item) => {
|
|
4970
|
-
return speakerVoiceConfigToMldev$
|
|
4980
|
+
return speakerVoiceConfigToMldev$2(apiClient, item);
|
|
4971
4981
|
});
|
|
4972
4982
|
}
|
|
4973
4983
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
4974
4984
|
}
|
|
4975
4985
|
return toObject;
|
|
4976
4986
|
}
|
|
4977
|
-
function speechConfigToMldev$
|
|
4987
|
+
function speechConfigToMldev$2(apiClient, fromObject) {
|
|
4978
4988
|
const toObject = {};
|
|
4979
4989
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
4980
4990
|
if (fromVoiceConfig != null) {
|
|
4981
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
4991
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
4982
4992
|
}
|
|
4983
4993
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
4984
4994
|
'multiSpeakerVoiceConfig',
|
|
4985
4995
|
]);
|
|
4986
4996
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
4987
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$
|
|
4997
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$2(apiClient, fromMultiSpeakerVoiceConfig));
|
|
4988
4998
|
}
|
|
4989
4999
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
4990
5000
|
if (fromLanguageCode != null) {
|
|
@@ -5007,7 +5017,7 @@ function speechConfigToVertex$1(apiClient, fromObject) {
|
|
|
5007
5017
|
}
|
|
5008
5018
|
return toObject;
|
|
5009
5019
|
}
|
|
5010
|
-
function videoMetadataToMldev$
|
|
5020
|
+
function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
5011
5021
|
const toObject = {};
|
|
5012
5022
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
5013
5023
|
if (fromFps != null) {
|
|
@@ -5039,7 +5049,7 @@ function videoMetadataToVertex$1(apiClient, fromObject) {
|
|
|
5039
5049
|
}
|
|
5040
5050
|
return toObject;
|
|
5041
5051
|
}
|
|
5042
|
-
function blobToMldev$
|
|
5052
|
+
function blobToMldev$2(apiClient, fromObject) {
|
|
5043
5053
|
const toObject = {};
|
|
5044
5054
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5045
5055
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5070,7 +5080,7 @@ function blobToVertex$1(apiClient, fromObject) {
|
|
|
5070
5080
|
}
|
|
5071
5081
|
return toObject;
|
|
5072
5082
|
}
|
|
5073
|
-
function fileDataToMldev$
|
|
5083
|
+
function fileDataToMldev$2(apiClient, fromObject) {
|
|
5074
5084
|
const toObject = {};
|
|
5075
5085
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5076
5086
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5101,13 +5111,13 @@ function fileDataToVertex$1(apiClient, fromObject) {
|
|
|
5101
5111
|
}
|
|
5102
5112
|
return toObject;
|
|
5103
5113
|
}
|
|
5104
|
-
function partToMldev$
|
|
5114
|
+
function partToMldev$2(apiClient, fromObject) {
|
|
5105
5115
|
const toObject = {};
|
|
5106
5116
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
5107
5117
|
'videoMetadata',
|
|
5108
5118
|
]);
|
|
5109
5119
|
if (fromVideoMetadata != null) {
|
|
5110
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
5120
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$2(apiClient, fromVideoMetadata));
|
|
5111
5121
|
}
|
|
5112
5122
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
5113
5123
|
if (fromThought != null) {
|
|
@@ -5115,11 +5125,17 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
5115
5125
|
}
|
|
5116
5126
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5117
5127
|
if (fromInlineData != null) {
|
|
5118
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
5128
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
5119
5129
|
}
|
|
5120
5130
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
5121
5131
|
if (fromFileData != null) {
|
|
5122
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
5132
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
|
|
5133
|
+
}
|
|
5134
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5135
|
+
'thoughtSignature',
|
|
5136
|
+
]);
|
|
5137
|
+
if (fromThoughtSignature != null) {
|
|
5138
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5123
5139
|
}
|
|
5124
5140
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5125
5141
|
'codeExecutionResult',
|
|
@@ -5169,6 +5185,12 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5169
5185
|
if (fromFileData != null) {
|
|
5170
5186
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
|
|
5171
5187
|
}
|
|
5188
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5189
|
+
'thoughtSignature',
|
|
5190
|
+
]);
|
|
5191
|
+
if (fromThoughtSignature != null) {
|
|
5192
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5193
|
+
}
|
|
5172
5194
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5173
5195
|
'codeExecutionResult',
|
|
5174
5196
|
]);
|
|
@@ -5197,14 +5219,14 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5197
5219
|
}
|
|
5198
5220
|
return toObject;
|
|
5199
5221
|
}
|
|
5200
|
-
function contentToMldev$
|
|
5222
|
+
function contentToMldev$2(apiClient, fromObject) {
|
|
5201
5223
|
const toObject = {};
|
|
5202
5224
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5203
5225
|
if (fromParts != null) {
|
|
5204
5226
|
let transformedList = fromParts;
|
|
5205
5227
|
if (Array.isArray(transformedList)) {
|
|
5206
5228
|
transformedList = transformedList.map((item) => {
|
|
5207
|
-
return partToMldev$
|
|
5229
|
+
return partToMldev$2(apiClient, item);
|
|
5208
5230
|
});
|
|
5209
5231
|
}
|
|
5210
5232
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5233,7 +5255,7 @@ function contentToVertex$1(apiClient, fromObject) {
|
|
|
5233
5255
|
}
|
|
5234
5256
|
return toObject;
|
|
5235
5257
|
}
|
|
5236
|
-
function functionDeclarationToMldev$
|
|
5258
|
+
function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
5237
5259
|
const toObject = {};
|
|
5238
5260
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
5239
5261
|
if (fromBehavior != null) {
|
|
@@ -5280,7 +5302,7 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
|
5280
5302
|
}
|
|
5281
5303
|
return toObject;
|
|
5282
5304
|
}
|
|
5283
|
-
function intervalToMldev$
|
|
5305
|
+
function intervalToMldev$2(apiClient, fromObject) {
|
|
5284
5306
|
const toObject = {};
|
|
5285
5307
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
5286
5308
|
if (fromStartTime != null) {
|
|
@@ -5304,13 +5326,13 @@ function intervalToVertex$1(apiClient, fromObject) {
|
|
|
5304
5326
|
}
|
|
5305
5327
|
return toObject;
|
|
5306
5328
|
}
|
|
5307
|
-
function googleSearchToMldev$
|
|
5329
|
+
function googleSearchToMldev$2(apiClient, fromObject) {
|
|
5308
5330
|
const toObject = {};
|
|
5309
5331
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
5310
5332
|
'timeRangeFilter',
|
|
5311
5333
|
]);
|
|
5312
5334
|
if (fromTimeRangeFilter != null) {
|
|
5313
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
5335
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(apiClient, fromTimeRangeFilter));
|
|
5314
5336
|
}
|
|
5315
5337
|
return toObject;
|
|
5316
5338
|
}
|
|
@@ -5324,7 +5346,7 @@ function googleSearchToVertex$1(apiClient, fromObject) {
|
|
|
5324
5346
|
}
|
|
5325
5347
|
return toObject;
|
|
5326
5348
|
}
|
|
5327
|
-
function dynamicRetrievalConfigToMldev$
|
|
5349
|
+
function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
5328
5350
|
const toObject = {};
|
|
5329
5351
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5330
5352
|
if (fromMode != null) {
|
|
@@ -5352,13 +5374,13 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
|
5352
5374
|
}
|
|
5353
5375
|
return toObject;
|
|
5354
5376
|
}
|
|
5355
|
-
function googleSearchRetrievalToMldev$
|
|
5377
|
+
function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
|
|
5356
5378
|
const toObject = {};
|
|
5357
5379
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
5358
5380
|
'dynamicRetrievalConfig',
|
|
5359
5381
|
]);
|
|
5360
5382
|
if (fromDynamicRetrievalConfig != null) {
|
|
5361
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
5383
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
|
|
5362
5384
|
}
|
|
5363
5385
|
return toObject;
|
|
5364
5386
|
}
|
|
@@ -5424,11 +5446,11 @@ function googleMapsToVertex$1(apiClient, fromObject) {
|
|
|
5424
5446
|
}
|
|
5425
5447
|
return toObject;
|
|
5426
5448
|
}
|
|
5427
|
-
function urlContextToMldev$
|
|
5449
|
+
function urlContextToMldev$2() {
|
|
5428
5450
|
const toObject = {};
|
|
5429
5451
|
return toObject;
|
|
5430
5452
|
}
|
|
5431
|
-
function toolToMldev$
|
|
5453
|
+
function toolToMldev$2(apiClient, fromObject) {
|
|
5432
5454
|
const toObject = {};
|
|
5433
5455
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5434
5456
|
'functionDeclarations',
|
|
@@ -5437,7 +5459,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5437
5459
|
let transformedList = fromFunctionDeclarations;
|
|
5438
5460
|
if (Array.isArray(transformedList)) {
|
|
5439
5461
|
transformedList = transformedList.map((item) => {
|
|
5440
|
-
return functionDeclarationToMldev$
|
|
5462
|
+
return functionDeclarationToMldev$2(apiClient, item);
|
|
5441
5463
|
});
|
|
5442
5464
|
}
|
|
5443
5465
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -5447,13 +5469,13 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5447
5469
|
}
|
|
5448
5470
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5449
5471
|
if (fromGoogleSearch != null) {
|
|
5450
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
5472
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(apiClient, fromGoogleSearch));
|
|
5451
5473
|
}
|
|
5452
5474
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5453
5475
|
'googleSearchRetrieval',
|
|
5454
5476
|
]);
|
|
5455
5477
|
if (fromGoogleSearchRetrieval != null) {
|
|
5456
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
5478
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
|
|
5457
5479
|
}
|
|
5458
5480
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5459
5481
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -5463,7 +5485,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
5463
5485
|
}
|
|
5464
5486
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5465
5487
|
if (fromUrlContext != null) {
|
|
5466
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
5488
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
|
|
5467
5489
|
}
|
|
5468
5490
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5469
5491
|
'codeExecution',
|
|
@@ -5522,7 +5544,7 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
5522
5544
|
}
|
|
5523
5545
|
return toObject;
|
|
5524
5546
|
}
|
|
5525
|
-
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
5547
|
+
function sessionResumptionConfigToMldev$1(apiClient, fromObject) {
|
|
5526
5548
|
const toObject = {};
|
|
5527
5549
|
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
5528
5550
|
if (fromHandle != null) {
|
|
@@ -5545,7 +5567,7 @@ function sessionResumptionConfigToVertex(apiClient, fromObject) {
|
|
|
5545
5567
|
}
|
|
5546
5568
|
return toObject;
|
|
5547
5569
|
}
|
|
5548
|
-
function audioTranscriptionConfigToMldev() {
|
|
5570
|
+
function audioTranscriptionConfigToMldev$1() {
|
|
5549
5571
|
const toObject = {};
|
|
5550
5572
|
return toObject;
|
|
5551
5573
|
}
|
|
@@ -5553,7 +5575,7 @@ function audioTranscriptionConfigToVertex() {
|
|
|
5553
5575
|
const toObject = {};
|
|
5554
5576
|
return toObject;
|
|
5555
5577
|
}
|
|
5556
|
-
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
5578
|
+
function automaticActivityDetectionToMldev$1(apiClient, fromObject) {
|
|
5557
5579
|
const toObject = {};
|
|
5558
5580
|
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
5559
5581
|
if (fromDisabled != null) {
|
|
@@ -5617,13 +5639,13 @@ function automaticActivityDetectionToVertex(apiClient, fromObject) {
|
|
|
5617
5639
|
}
|
|
5618
5640
|
return toObject;
|
|
5619
5641
|
}
|
|
5620
|
-
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
5642
|
+
function realtimeInputConfigToMldev$1(apiClient, fromObject) {
|
|
5621
5643
|
const toObject = {};
|
|
5622
5644
|
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
5623
5645
|
'automaticActivityDetection',
|
|
5624
5646
|
]);
|
|
5625
5647
|
if (fromAutomaticActivityDetection != null) {
|
|
5626
|
-
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
5648
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev$1(apiClient, fromAutomaticActivityDetection));
|
|
5627
5649
|
}
|
|
5628
5650
|
const fromActivityHandling = getValueByPath(fromObject, [
|
|
5629
5651
|
'activityHandling',
|
|
@@ -5657,7 +5679,7 @@ function realtimeInputConfigToVertex(apiClient, fromObject) {
|
|
|
5657
5679
|
}
|
|
5658
5680
|
return toObject;
|
|
5659
5681
|
}
|
|
5660
|
-
function slidingWindowToMldev(apiClient, fromObject) {
|
|
5682
|
+
function slidingWindowToMldev$1(apiClient, fromObject) {
|
|
5661
5683
|
const toObject = {};
|
|
5662
5684
|
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
5663
5685
|
if (fromTargetTokens != null) {
|
|
@@ -5673,7 +5695,7 @@ function slidingWindowToVertex(apiClient, fromObject) {
|
|
|
5673
5695
|
}
|
|
5674
5696
|
return toObject;
|
|
5675
5697
|
}
|
|
5676
|
-
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
5698
|
+
function contextWindowCompressionConfigToMldev$1(apiClient, fromObject) {
|
|
5677
5699
|
const toObject = {};
|
|
5678
5700
|
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
5679
5701
|
'triggerTokens',
|
|
@@ -5685,7 +5707,7 @@ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
|
5685
5707
|
'slidingWindow',
|
|
5686
5708
|
]);
|
|
5687
5709
|
if (fromSlidingWindow != null) {
|
|
5688
|
-
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
5710
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev$1(apiClient, fromSlidingWindow));
|
|
5689
5711
|
}
|
|
5690
5712
|
return toObject;
|
|
5691
5713
|
}
|
|
@@ -5705,7 +5727,7 @@ function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
|
|
|
5705
5727
|
}
|
|
5706
5728
|
return toObject;
|
|
5707
5729
|
}
|
|
5708
|
-
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
5730
|
+
function proactivityConfigToMldev$1(apiClient, fromObject) {
|
|
5709
5731
|
const toObject = {};
|
|
5710
5732
|
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
5711
5733
|
'proactiveAudio',
|
|
@@ -5725,7 +5747,7 @@ function proactivityConfigToVertex(apiClient, fromObject) {
|
|
|
5725
5747
|
}
|
|
5726
5748
|
return toObject;
|
|
5727
5749
|
}
|
|
5728
|
-
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
5750
|
+
function liveConnectConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
5729
5751
|
const toObject = {};
|
|
5730
5752
|
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
5731
5753
|
'generationConfig',
|
|
@@ -5769,7 +5791,7 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5769
5791
|
}
|
|
5770
5792
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
5771
5793
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
5772
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$
|
|
5794
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$2(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
5773
5795
|
}
|
|
5774
5796
|
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
5775
5797
|
'enableAffectiveDialog',
|
|
@@ -5781,14 +5803,14 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5781
5803
|
'systemInstruction',
|
|
5782
5804
|
]);
|
|
5783
5805
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
5784
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$
|
|
5806
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
5785
5807
|
}
|
|
5786
5808
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
5787
5809
|
if (parentObject !== undefined && fromTools != null) {
|
|
5788
5810
|
let transformedList = tTools(apiClient, fromTools);
|
|
5789
5811
|
if (Array.isArray(transformedList)) {
|
|
5790
5812
|
transformedList = transformedList.map((item) => {
|
|
5791
|
-
return toolToMldev$
|
|
5813
|
+
return toolToMldev$2(apiClient, tTool(apiClient, item));
|
|
5792
5814
|
});
|
|
5793
5815
|
}
|
|
5794
5816
|
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
@@ -5797,35 +5819,35 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
5797
5819
|
'sessionResumption',
|
|
5798
5820
|
]);
|
|
5799
5821
|
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
5800
|
-
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
5822
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev$1(apiClient, fromSessionResumption));
|
|
5801
5823
|
}
|
|
5802
5824
|
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
5803
5825
|
'inputAudioTranscription',
|
|
5804
5826
|
]);
|
|
5805
5827
|
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
5806
|
-
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
5828
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
5807
5829
|
}
|
|
5808
5830
|
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
5809
5831
|
'outputAudioTranscription',
|
|
5810
5832
|
]);
|
|
5811
5833
|
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
5812
|
-
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
5834
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
5813
5835
|
}
|
|
5814
5836
|
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
5815
5837
|
'realtimeInputConfig',
|
|
5816
5838
|
]);
|
|
5817
5839
|
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
5818
|
-
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
5840
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev$1(apiClient, fromRealtimeInputConfig));
|
|
5819
5841
|
}
|
|
5820
5842
|
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
5821
5843
|
'contextWindowCompression',
|
|
5822
5844
|
]);
|
|
5823
5845
|
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
5824
|
-
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
5846
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev$1(apiClient, fromContextWindowCompression));
|
|
5825
5847
|
}
|
|
5826
5848
|
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
5827
5849
|
if (parentObject !== undefined && fromProactivity != null) {
|
|
5828
|
-
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
5850
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev$1(apiClient, fromProactivity));
|
|
5829
5851
|
}
|
|
5830
5852
|
return toObject;
|
|
5831
5853
|
}
|
|
@@ -5941,7 +5963,7 @@ function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
|
5941
5963
|
}
|
|
5942
5964
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5943
5965
|
if (fromConfig != null) {
|
|
5944
|
-
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
5966
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev$1(apiClient, fromConfig, toObject));
|
|
5945
5967
|
}
|
|
5946
5968
|
return toObject;
|
|
5947
5969
|
}
|
|
@@ -6296,6 +6318,12 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
6296
6318
|
if (fromFileData != null) {
|
|
6297
6319
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
|
|
6298
6320
|
}
|
|
6321
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6322
|
+
'thoughtSignature',
|
|
6323
|
+
]);
|
|
6324
|
+
if (fromThoughtSignature != null) {
|
|
6325
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6326
|
+
}
|
|
6299
6327
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6300
6328
|
'codeExecutionResult',
|
|
6301
6329
|
]);
|
|
@@ -6344,6 +6372,12 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
6344
6372
|
if (fromFileData != null) {
|
|
6345
6373
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
|
|
6346
6374
|
}
|
|
6375
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6376
|
+
'thoughtSignature',
|
|
6377
|
+
]);
|
|
6378
|
+
if (fromThoughtSignature != null) {
|
|
6379
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6380
|
+
}
|
|
6347
6381
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6348
6382
|
'codeExecutionResult',
|
|
6349
6383
|
]);
|
|
@@ -7134,7 +7168,7 @@ function liveMusicServerMessageFromMldev(apiClient, fromObject) {
|
|
|
7134
7168
|
* Copyright 2025 Google LLC
|
|
7135
7169
|
* SPDX-License-Identifier: Apache-2.0
|
|
7136
7170
|
*/
|
|
7137
|
-
function videoMetadataToMldev(apiClient, fromObject) {
|
|
7171
|
+
function videoMetadataToMldev$1(apiClient, fromObject) {
|
|
7138
7172
|
const toObject = {};
|
|
7139
7173
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
7140
7174
|
if (fromFps != null) {
|
|
@@ -7150,7 +7184,7 @@ function videoMetadataToMldev(apiClient, fromObject) {
|
|
|
7150
7184
|
}
|
|
7151
7185
|
return toObject;
|
|
7152
7186
|
}
|
|
7153
|
-
function blobToMldev(apiClient, fromObject) {
|
|
7187
|
+
function blobToMldev$1(apiClient, fromObject) {
|
|
7154
7188
|
const toObject = {};
|
|
7155
7189
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7156
7190
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7165,7 +7199,7 @@ function blobToMldev(apiClient, fromObject) {
|
|
|
7165
7199
|
}
|
|
7166
7200
|
return toObject;
|
|
7167
7201
|
}
|
|
7168
|
-
function fileDataToMldev(apiClient, fromObject) {
|
|
7202
|
+
function fileDataToMldev$1(apiClient, fromObject) {
|
|
7169
7203
|
const toObject = {};
|
|
7170
7204
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7171
7205
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7180,13 +7214,13 @@ function fileDataToMldev(apiClient, fromObject) {
|
|
|
7180
7214
|
}
|
|
7181
7215
|
return toObject;
|
|
7182
7216
|
}
|
|
7183
|
-
function partToMldev(apiClient, fromObject) {
|
|
7217
|
+
function partToMldev$1(apiClient, fromObject) {
|
|
7184
7218
|
const toObject = {};
|
|
7185
7219
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
7186
7220
|
'videoMetadata',
|
|
7187
7221
|
]);
|
|
7188
7222
|
if (fromVideoMetadata != null) {
|
|
7189
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
7223
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$1(apiClient, fromVideoMetadata));
|
|
7190
7224
|
}
|
|
7191
7225
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
7192
7226
|
if (fromThought != null) {
|
|
@@ -7194,11 +7228,17 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7194
7228
|
}
|
|
7195
7229
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7196
7230
|
if (fromInlineData != null) {
|
|
7197
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
7231
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
7198
7232
|
}
|
|
7199
7233
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
7200
7234
|
if (fromFileData != null) {
|
|
7201
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
7235
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
|
|
7236
|
+
}
|
|
7237
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
7238
|
+
'thoughtSignature',
|
|
7239
|
+
]);
|
|
7240
|
+
if (fromThoughtSignature != null) {
|
|
7241
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7202
7242
|
}
|
|
7203
7243
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7204
7244
|
'codeExecutionResult',
|
|
@@ -7228,14 +7268,14 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7228
7268
|
}
|
|
7229
7269
|
return toObject;
|
|
7230
7270
|
}
|
|
7231
|
-
function contentToMldev(apiClient, fromObject) {
|
|
7271
|
+
function contentToMldev$1(apiClient, fromObject) {
|
|
7232
7272
|
const toObject = {};
|
|
7233
7273
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7234
7274
|
if (fromParts != null) {
|
|
7235
7275
|
let transformedList = fromParts;
|
|
7236
7276
|
if (Array.isArray(transformedList)) {
|
|
7237
7277
|
transformedList = transformedList.map((item) => {
|
|
7238
|
-
return partToMldev(apiClient, item);
|
|
7278
|
+
return partToMldev$1(apiClient, item);
|
|
7239
7279
|
});
|
|
7240
7280
|
}
|
|
7241
7281
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -7359,7 +7399,7 @@ function safetySettingToMldev(apiClient, fromObject) {
|
|
|
7359
7399
|
}
|
|
7360
7400
|
return toObject;
|
|
7361
7401
|
}
|
|
7362
|
-
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
7402
|
+
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
7363
7403
|
const toObject = {};
|
|
7364
7404
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
7365
7405
|
if (fromBehavior != null) {
|
|
@@ -7383,7 +7423,7 @@ function functionDeclarationToMldev(apiClient, fromObject) {
|
|
|
7383
7423
|
}
|
|
7384
7424
|
return toObject;
|
|
7385
7425
|
}
|
|
7386
|
-
function intervalToMldev(apiClient, fromObject) {
|
|
7426
|
+
function intervalToMldev$1(apiClient, fromObject) {
|
|
7387
7427
|
const toObject = {};
|
|
7388
7428
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
7389
7429
|
if (fromStartTime != null) {
|
|
@@ -7395,17 +7435,17 @@ function intervalToMldev(apiClient, fromObject) {
|
|
|
7395
7435
|
}
|
|
7396
7436
|
return toObject;
|
|
7397
7437
|
}
|
|
7398
|
-
function googleSearchToMldev(apiClient, fromObject) {
|
|
7438
|
+
function googleSearchToMldev$1(apiClient, fromObject) {
|
|
7399
7439
|
const toObject = {};
|
|
7400
7440
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
7401
7441
|
'timeRangeFilter',
|
|
7402
7442
|
]);
|
|
7403
7443
|
if (fromTimeRangeFilter != null) {
|
|
7404
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
7444
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(apiClient, fromTimeRangeFilter));
|
|
7405
7445
|
}
|
|
7406
7446
|
return toObject;
|
|
7407
7447
|
}
|
|
7408
|
-
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
7448
|
+
function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
7409
7449
|
const toObject = {};
|
|
7410
7450
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
7411
7451
|
if (fromMode != null) {
|
|
@@ -7419,21 +7459,21 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
|
7419
7459
|
}
|
|
7420
7460
|
return toObject;
|
|
7421
7461
|
}
|
|
7422
|
-
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
7462
|
+
function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
7423
7463
|
const toObject = {};
|
|
7424
7464
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
7425
7465
|
'dynamicRetrievalConfig',
|
|
7426
7466
|
]);
|
|
7427
7467
|
if (fromDynamicRetrievalConfig != null) {
|
|
7428
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
7468
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
|
|
7429
7469
|
}
|
|
7430
7470
|
return toObject;
|
|
7431
7471
|
}
|
|
7432
|
-
function urlContextToMldev() {
|
|
7472
|
+
function urlContextToMldev$1() {
|
|
7433
7473
|
const toObject = {};
|
|
7434
7474
|
return toObject;
|
|
7435
7475
|
}
|
|
7436
|
-
function toolToMldev(apiClient, fromObject) {
|
|
7476
|
+
function toolToMldev$1(apiClient, fromObject) {
|
|
7437
7477
|
const toObject = {};
|
|
7438
7478
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7439
7479
|
'functionDeclarations',
|
|
@@ -7442,7 +7482,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7442
7482
|
let transformedList = fromFunctionDeclarations;
|
|
7443
7483
|
if (Array.isArray(transformedList)) {
|
|
7444
7484
|
transformedList = transformedList.map((item) => {
|
|
7445
|
-
return functionDeclarationToMldev(apiClient, item);
|
|
7485
|
+
return functionDeclarationToMldev$1(apiClient, item);
|
|
7446
7486
|
});
|
|
7447
7487
|
}
|
|
7448
7488
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -7452,13 +7492,13 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7452
7492
|
}
|
|
7453
7493
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
7454
7494
|
if (fromGoogleSearch != null) {
|
|
7455
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
7495
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(apiClient, fromGoogleSearch));
|
|
7456
7496
|
}
|
|
7457
7497
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7458
7498
|
'googleSearchRetrieval',
|
|
7459
7499
|
]);
|
|
7460
7500
|
if (fromGoogleSearchRetrieval != null) {
|
|
7461
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
7501
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
|
|
7462
7502
|
}
|
|
7463
7503
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
7464
7504
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -7468,7 +7508,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
7468
7508
|
}
|
|
7469
7509
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
7470
7510
|
if (fromUrlContext != null) {
|
|
7471
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
7511
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
|
|
7472
7512
|
}
|
|
7473
7513
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
7474
7514
|
'codeExecution',
|
|
@@ -7532,7 +7572,7 @@ function toolConfigToMldev(apiClient, fromObject) {
|
|
|
7532
7572
|
}
|
|
7533
7573
|
return toObject;
|
|
7534
7574
|
}
|
|
7535
|
-
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
7575
|
+
function prebuiltVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7536
7576
|
const toObject = {};
|
|
7537
7577
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
7538
7578
|
if (fromVoiceName != null) {
|
|
@@ -7540,17 +7580,17 @@ function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7540
7580
|
}
|
|
7541
7581
|
return toObject;
|
|
7542
7582
|
}
|
|
7543
|
-
function voiceConfigToMldev(apiClient, fromObject) {
|
|
7583
|
+
function voiceConfigToMldev$1(apiClient, fromObject) {
|
|
7544
7584
|
const toObject = {};
|
|
7545
7585
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
7546
7586
|
'prebuiltVoiceConfig',
|
|
7547
7587
|
]);
|
|
7548
7588
|
if (fromPrebuiltVoiceConfig != null) {
|
|
7549
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
7589
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$1(apiClient, fromPrebuiltVoiceConfig));
|
|
7550
7590
|
}
|
|
7551
7591
|
return toObject;
|
|
7552
7592
|
}
|
|
7553
|
-
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
7593
|
+
function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7554
7594
|
const toObject = {};
|
|
7555
7595
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
7556
7596
|
if (fromSpeaker != null) {
|
|
@@ -7558,11 +7598,11 @@ function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7558
7598
|
}
|
|
7559
7599
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7560
7600
|
if (fromVoiceConfig != null) {
|
|
7561
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
7601
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
7562
7602
|
}
|
|
7563
7603
|
return toObject;
|
|
7564
7604
|
}
|
|
7565
|
-
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
7605
|
+
function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
7566
7606
|
const toObject = {};
|
|
7567
7607
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
7568
7608
|
'speakerVoiceConfigs',
|
|
@@ -7571,24 +7611,24 @@ function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
7571
7611
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
7572
7612
|
if (Array.isArray(transformedList)) {
|
|
7573
7613
|
transformedList = transformedList.map((item) => {
|
|
7574
|
-
return speakerVoiceConfigToMldev(apiClient, item);
|
|
7614
|
+
return speakerVoiceConfigToMldev$1(apiClient, item);
|
|
7575
7615
|
});
|
|
7576
7616
|
}
|
|
7577
7617
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
7578
7618
|
}
|
|
7579
7619
|
return toObject;
|
|
7580
7620
|
}
|
|
7581
|
-
function speechConfigToMldev(apiClient, fromObject) {
|
|
7621
|
+
function speechConfigToMldev$1(apiClient, fromObject) {
|
|
7582
7622
|
const toObject = {};
|
|
7583
7623
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7584
7624
|
if (fromVoiceConfig != null) {
|
|
7585
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
7625
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
7586
7626
|
}
|
|
7587
7627
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
7588
7628
|
'multiSpeakerVoiceConfig',
|
|
7589
7629
|
]);
|
|
7590
7630
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
7591
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
7631
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$1(apiClient, fromMultiSpeakerVoiceConfig));
|
|
7592
7632
|
}
|
|
7593
7633
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
7594
7634
|
if (fromLanguageCode != null) {
|
|
@@ -7618,7 +7658,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7618
7658
|
'systemInstruction',
|
|
7619
7659
|
]);
|
|
7620
7660
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
7621
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
7661
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
7622
7662
|
}
|
|
7623
7663
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
7624
7664
|
if (fromTemperature != null) {
|
|
@@ -7711,7 +7751,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7711
7751
|
let transformedList = tTools(apiClient, fromTools);
|
|
7712
7752
|
if (Array.isArray(transformedList)) {
|
|
7713
7753
|
transformedList = transformedList.map((item) => {
|
|
7714
|
-
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
7754
|
+
return toolToMldev$1(apiClient, tTool(apiClient, item));
|
|
7715
7755
|
});
|
|
7716
7756
|
}
|
|
7717
7757
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -7743,7 +7783,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7743
7783
|
}
|
|
7744
7784
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
7745
7785
|
if (fromSpeechConfig != null) {
|
|
7746
|
-
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
7786
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$1(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
7747
7787
|
}
|
|
7748
7788
|
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
7749
7789
|
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
@@ -7767,7 +7807,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
|
|
|
7767
7807
|
let transformedList = tContents(apiClient, fromContents);
|
|
7768
7808
|
if (Array.isArray(transformedList)) {
|
|
7769
7809
|
transformedList = transformedList.map((item) => {
|
|
7770
|
-
return contentToMldev(apiClient, item);
|
|
7810
|
+
return contentToMldev$1(apiClient, item);
|
|
7771
7811
|
});
|
|
7772
7812
|
}
|
|
7773
7813
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8019,7 +8059,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
|
|
|
8019
8059
|
let transformedList = tContents(apiClient, fromContents);
|
|
8020
8060
|
if (Array.isArray(transformedList)) {
|
|
8021
8061
|
transformedList = transformedList.map((item) => {
|
|
8022
|
-
return contentToMldev(apiClient, item);
|
|
8062
|
+
return contentToMldev$1(apiClient, item);
|
|
8023
8063
|
});
|
|
8024
8064
|
}
|
|
8025
8065
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8186,6 +8226,12 @@ function partToVertex(apiClient, fromObject) {
|
|
|
8186
8226
|
if (fromFileData != null) {
|
|
8187
8227
|
setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
|
|
8188
8228
|
}
|
|
8229
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
8230
|
+
'thoughtSignature',
|
|
8231
|
+
]);
|
|
8232
|
+
if (fromThoughtSignature != null) {
|
|
8233
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8234
|
+
}
|
|
8189
8235
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8190
8236
|
'codeExecutionResult',
|
|
8191
8237
|
]);
|
|
@@ -9523,6 +9569,12 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
9523
9569
|
if (fromFileData != null) {
|
|
9524
9570
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
|
|
9525
9571
|
}
|
|
9572
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
9573
|
+
'thoughtSignature',
|
|
9574
|
+
]);
|
|
9575
|
+
if (fromThoughtSignature != null) {
|
|
9576
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
9577
|
+
}
|
|
9526
9578
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
9527
9579
|
'codeExecutionResult',
|
|
9528
9580
|
]);
|
|
@@ -10041,6 +10093,12 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
10041
10093
|
if (fromFileData != null) {
|
|
10042
10094
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
|
|
10043
10095
|
}
|
|
10096
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
10097
|
+
'thoughtSignature',
|
|
10098
|
+
]);
|
|
10099
|
+
if (fromThoughtSignature != null) {
|
|
10100
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10101
|
+
}
|
|
10044
10102
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10045
10103
|
'codeExecutionResult',
|
|
10046
10104
|
]);
|
|
@@ -10583,7 +10641,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10583
10641
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10584
10642
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10585
10643
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10586
|
-
const SDK_VERSION = '1.
|
|
10644
|
+
const SDK_VERSION = '1.3.0'; // x-release-please-version
|
|
10587
10645
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10588
10646
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10589
10647
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11135,11 +11193,9 @@ function hasNonMcpTools(params) {
|
|
|
11135
11193
|
}
|
|
11136
11194
|
// Returns true if the object is a MCP CallableTool, otherwise false.
|
|
11137
11195
|
function isMcpCallableTool(object) {
|
|
11138
|
-
// TODO: b/418266406 - Add a more robust check for the MCP CallableTool.
|
|
11139
11196
|
return (object !== null &&
|
|
11140
11197
|
typeof object === 'object' &&
|
|
11141
|
-
|
|
11142
|
-
'callTool' in object);
|
|
11198
|
+
object instanceof McpCallableTool);
|
|
11143
11199
|
}
|
|
11144
11200
|
// List all tools from the MCP client.
|
|
11145
11201
|
function listAllTools(mcpClient, maxTools = 100) {
|
|
@@ -11619,7 +11675,14 @@ class Live {
|
|
|
11619
11675
|
}
|
|
11620
11676
|
else {
|
|
11621
11677
|
const apiKey = this.apiClient.getApiKey();
|
|
11622
|
-
|
|
11678
|
+
let method = 'BidiGenerateContent';
|
|
11679
|
+
let keyName = 'key';
|
|
11680
|
+
if (apiKey === null || apiKey === void 0 ? void 0 : apiKey.startsWith('auth_tokens/')) {
|
|
11681
|
+
console.warn('Warning: Ephemeral token support is experimental and may change in future versions.');
|
|
11682
|
+
method = 'BidiGenerateContentConstrained';
|
|
11683
|
+
keyName = 'access_token';
|
|
11684
|
+
}
|
|
11685
|
+
url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.${method}?${keyName}=${apiKey}`;
|
|
11623
11686
|
}
|
|
11624
11687
|
let onopenResolve = () => { };
|
|
11625
11688
|
const onopenPromise = new Promise((resolve) => {
|
|
@@ -11725,7 +11788,7 @@ class Session {
|
|
|
11725
11788
|
contents = contents.map((item) => contentToVertex(apiClient, item));
|
|
11726
11789
|
}
|
|
11727
11790
|
else {
|
|
11728
|
-
contents = contents.map((item) => contentToMldev(apiClient, item));
|
|
11791
|
+
contents = contents.map((item) => contentToMldev$1(apiClient, item));
|
|
11729
11792
|
}
|
|
11730
11793
|
}
|
|
11731
11794
|
catch (_a) {
|
|
@@ -12023,7 +12086,6 @@ class Models extends BaseModule {
|
|
|
12023
12086
|
if (!hasMcpClientTools(params) || shouldDisableAfc(params.config)) {
|
|
12024
12087
|
return await this.generateContentInternal(transformedParams);
|
|
12025
12088
|
}
|
|
12026
|
-
// TODO: b/418266406 - Improve the check for CallableTools and Tools.
|
|
12027
12089
|
if (hasNonMcpTools(params)) {
|
|
12028
12090
|
throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
|
|
12029
12091
|
}
|
|
@@ -13578,19 +13640,857 @@ class Operations extends BaseModule {
|
|
|
13578
13640
|
* Copyright 2025 Google LLC
|
|
13579
13641
|
* SPDX-License-Identifier: Apache-2.0
|
|
13580
13642
|
*/
|
|
13581
|
-
|
|
13582
|
-
const
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13643
|
+
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
13644
|
+
const toObject = {};
|
|
13645
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
13646
|
+
if (fromVoiceName != null) {
|
|
13647
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
13648
|
+
}
|
|
13649
|
+
return toObject;
|
|
13650
|
+
}
|
|
13651
|
+
function voiceConfigToMldev(apiClient, fromObject) {
|
|
13652
|
+
const toObject = {};
|
|
13653
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
13654
|
+
'prebuiltVoiceConfig',
|
|
13655
|
+
]);
|
|
13656
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
13657
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
13658
|
+
}
|
|
13659
|
+
return toObject;
|
|
13660
|
+
}
|
|
13661
|
+
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13662
|
+
const toObject = {};
|
|
13663
|
+
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
13664
|
+
if (fromSpeaker != null) {
|
|
13665
|
+
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
13666
|
+
}
|
|
13667
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13668
|
+
if (fromVoiceConfig != null) {
|
|
13669
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13670
|
+
}
|
|
13671
|
+
return toObject;
|
|
13672
|
+
}
|
|
13673
|
+
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13674
|
+
const toObject = {};
|
|
13675
|
+
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
13676
|
+
'speakerVoiceConfigs',
|
|
13677
|
+
]);
|
|
13678
|
+
if (fromSpeakerVoiceConfigs != null) {
|
|
13679
|
+
let transformedList = fromSpeakerVoiceConfigs;
|
|
13680
|
+
if (Array.isArray(transformedList)) {
|
|
13681
|
+
transformedList = transformedList.map((item) => {
|
|
13682
|
+
return speakerVoiceConfigToMldev(apiClient, item);
|
|
13683
|
+
});
|
|
13588
13684
|
}
|
|
13589
|
-
|
|
13590
|
-
this.googleAuth = new googleAuthLibrary.GoogleAuth(vertexAuthOptions);
|
|
13685
|
+
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
13591
13686
|
}
|
|
13592
|
-
|
|
13593
|
-
|
|
13687
|
+
return toObject;
|
|
13688
|
+
}
|
|
13689
|
+
function speechConfigToMldev(apiClient, fromObject) {
|
|
13690
|
+
const toObject = {};
|
|
13691
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13692
|
+
if (fromVoiceConfig != null) {
|
|
13693
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13694
|
+
}
|
|
13695
|
+
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
13696
|
+
'multiSpeakerVoiceConfig',
|
|
13697
|
+
]);
|
|
13698
|
+
if (fromMultiSpeakerVoiceConfig != null) {
|
|
13699
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
13700
|
+
}
|
|
13701
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
13702
|
+
if (fromLanguageCode != null) {
|
|
13703
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
13704
|
+
}
|
|
13705
|
+
return toObject;
|
|
13706
|
+
}
|
|
13707
|
+
function videoMetadataToMldev(apiClient, fromObject) {
|
|
13708
|
+
const toObject = {};
|
|
13709
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
13710
|
+
if (fromFps != null) {
|
|
13711
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
13712
|
+
}
|
|
13713
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
13714
|
+
if (fromEndOffset != null) {
|
|
13715
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
13716
|
+
}
|
|
13717
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
13718
|
+
if (fromStartOffset != null) {
|
|
13719
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
13720
|
+
}
|
|
13721
|
+
return toObject;
|
|
13722
|
+
}
|
|
13723
|
+
function blobToMldev(apiClient, fromObject) {
|
|
13724
|
+
const toObject = {};
|
|
13725
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13726
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13727
|
+
}
|
|
13728
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
13729
|
+
if (fromData != null) {
|
|
13730
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
13731
|
+
}
|
|
13732
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13733
|
+
if (fromMimeType != null) {
|
|
13734
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13735
|
+
}
|
|
13736
|
+
return toObject;
|
|
13737
|
+
}
|
|
13738
|
+
function fileDataToMldev(apiClient, fromObject) {
|
|
13739
|
+
const toObject = {};
|
|
13740
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13741
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13742
|
+
}
|
|
13743
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
13744
|
+
if (fromFileUri != null) {
|
|
13745
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
13746
|
+
}
|
|
13747
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13748
|
+
if (fromMimeType != null) {
|
|
13749
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13750
|
+
}
|
|
13751
|
+
return toObject;
|
|
13752
|
+
}
|
|
13753
|
+
function partToMldev(apiClient, fromObject) {
|
|
13754
|
+
const toObject = {};
|
|
13755
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
13756
|
+
'videoMetadata',
|
|
13757
|
+
]);
|
|
13758
|
+
if (fromVideoMetadata != null) {
|
|
13759
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
13760
|
+
}
|
|
13761
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
13762
|
+
if (fromThought != null) {
|
|
13763
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
13764
|
+
}
|
|
13765
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
13766
|
+
if (fromInlineData != null) {
|
|
13767
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
13768
|
+
}
|
|
13769
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
13770
|
+
if (fromFileData != null) {
|
|
13771
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
13772
|
+
}
|
|
13773
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
13774
|
+
'thoughtSignature',
|
|
13775
|
+
]);
|
|
13776
|
+
if (fromThoughtSignature != null) {
|
|
13777
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13778
|
+
}
|
|
13779
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13780
|
+
'codeExecutionResult',
|
|
13781
|
+
]);
|
|
13782
|
+
if (fromCodeExecutionResult != null) {
|
|
13783
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
13784
|
+
}
|
|
13785
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
13786
|
+
'executableCode',
|
|
13787
|
+
]);
|
|
13788
|
+
if (fromExecutableCode != null) {
|
|
13789
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13790
|
+
}
|
|
13791
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13792
|
+
if (fromFunctionCall != null) {
|
|
13793
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13794
|
+
}
|
|
13795
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13796
|
+
'functionResponse',
|
|
13797
|
+
]);
|
|
13798
|
+
if (fromFunctionResponse != null) {
|
|
13799
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
13800
|
+
}
|
|
13801
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
13802
|
+
if (fromText != null) {
|
|
13803
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
13804
|
+
}
|
|
13805
|
+
return toObject;
|
|
13806
|
+
}
|
|
13807
|
+
function contentToMldev(apiClient, fromObject) {
|
|
13808
|
+
const toObject = {};
|
|
13809
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13810
|
+
if (fromParts != null) {
|
|
13811
|
+
let transformedList = fromParts;
|
|
13812
|
+
if (Array.isArray(transformedList)) {
|
|
13813
|
+
transformedList = transformedList.map((item) => {
|
|
13814
|
+
return partToMldev(apiClient, item);
|
|
13815
|
+
});
|
|
13816
|
+
}
|
|
13817
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
13818
|
+
}
|
|
13819
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
13820
|
+
if (fromRole != null) {
|
|
13821
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
13822
|
+
}
|
|
13823
|
+
return toObject;
|
|
13824
|
+
}
|
|
13825
|
+
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
13826
|
+
const toObject = {};
|
|
13827
|
+
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
13828
|
+
if (fromBehavior != null) {
|
|
13829
|
+
setValueByPath(toObject, ['behavior'], fromBehavior);
|
|
13830
|
+
}
|
|
13831
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
13832
|
+
if (fromDescription != null) {
|
|
13833
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
13834
|
+
}
|
|
13835
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13836
|
+
if (fromName != null) {
|
|
13837
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13838
|
+
}
|
|
13839
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
13840
|
+
if (fromParameters != null) {
|
|
13841
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
13842
|
+
}
|
|
13843
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
13844
|
+
if (fromResponse != null) {
|
|
13845
|
+
setValueByPath(toObject, ['response'], fromResponse);
|
|
13846
|
+
}
|
|
13847
|
+
return toObject;
|
|
13848
|
+
}
|
|
13849
|
+
function intervalToMldev(apiClient, fromObject) {
|
|
13850
|
+
const toObject = {};
|
|
13851
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
13852
|
+
if (fromStartTime != null) {
|
|
13853
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
13854
|
+
}
|
|
13855
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
13856
|
+
if (fromEndTime != null) {
|
|
13857
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
13858
|
+
}
|
|
13859
|
+
return toObject;
|
|
13860
|
+
}
|
|
13861
|
+
function googleSearchToMldev(apiClient, fromObject) {
|
|
13862
|
+
const toObject = {};
|
|
13863
|
+
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
13864
|
+
'timeRangeFilter',
|
|
13865
|
+
]);
|
|
13866
|
+
if (fromTimeRangeFilter != null) {
|
|
13867
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
13868
|
+
}
|
|
13869
|
+
return toObject;
|
|
13870
|
+
}
|
|
13871
|
+
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
13872
|
+
const toObject = {};
|
|
13873
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
13874
|
+
if (fromMode != null) {
|
|
13875
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
13876
|
+
}
|
|
13877
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
13878
|
+
'dynamicThreshold',
|
|
13879
|
+
]);
|
|
13880
|
+
if (fromDynamicThreshold != null) {
|
|
13881
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
13882
|
+
}
|
|
13883
|
+
return toObject;
|
|
13884
|
+
}
|
|
13885
|
+
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
13886
|
+
const toObject = {};
|
|
13887
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
13888
|
+
'dynamicRetrievalConfig',
|
|
13889
|
+
]);
|
|
13890
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
13891
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
13892
|
+
}
|
|
13893
|
+
return toObject;
|
|
13894
|
+
}
|
|
13895
|
+
function urlContextToMldev() {
|
|
13896
|
+
const toObject = {};
|
|
13897
|
+
return toObject;
|
|
13898
|
+
}
|
|
13899
|
+
function toolToMldev(apiClient, fromObject) {
|
|
13900
|
+
const toObject = {};
|
|
13901
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
13902
|
+
'functionDeclarations',
|
|
13903
|
+
]);
|
|
13904
|
+
if (fromFunctionDeclarations != null) {
|
|
13905
|
+
let transformedList = fromFunctionDeclarations;
|
|
13906
|
+
if (Array.isArray(transformedList)) {
|
|
13907
|
+
transformedList = transformedList.map((item) => {
|
|
13908
|
+
return functionDeclarationToMldev(apiClient, item);
|
|
13909
|
+
});
|
|
13910
|
+
}
|
|
13911
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
13912
|
+
}
|
|
13913
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
13914
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
13915
|
+
}
|
|
13916
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
13917
|
+
if (fromGoogleSearch != null) {
|
|
13918
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
13919
|
+
}
|
|
13920
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
13921
|
+
'googleSearchRetrieval',
|
|
13922
|
+
]);
|
|
13923
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
13924
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
13925
|
+
}
|
|
13926
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
13927
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
13928
|
+
}
|
|
13929
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
13930
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
13931
|
+
}
|
|
13932
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
13933
|
+
if (fromUrlContext != null) {
|
|
13934
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
13935
|
+
}
|
|
13936
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
13937
|
+
'codeExecution',
|
|
13938
|
+
]);
|
|
13939
|
+
if (fromCodeExecution != null) {
|
|
13940
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
13941
|
+
}
|
|
13942
|
+
return toObject;
|
|
13943
|
+
}
|
|
13944
|
+
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
13945
|
+
const toObject = {};
|
|
13946
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
13947
|
+
if (fromHandle != null) {
|
|
13948
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
13949
|
+
}
|
|
13950
|
+
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
13951
|
+
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
13952
|
+
}
|
|
13953
|
+
return toObject;
|
|
13954
|
+
}
|
|
13955
|
+
function audioTranscriptionConfigToMldev() {
|
|
13956
|
+
const toObject = {};
|
|
13957
|
+
return toObject;
|
|
13958
|
+
}
|
|
13959
|
+
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
13960
|
+
const toObject = {};
|
|
13961
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
13962
|
+
if (fromDisabled != null) {
|
|
13963
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
13964
|
+
}
|
|
13965
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
13966
|
+
'startOfSpeechSensitivity',
|
|
13967
|
+
]);
|
|
13968
|
+
if (fromStartOfSpeechSensitivity != null) {
|
|
13969
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
13970
|
+
}
|
|
13971
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
13972
|
+
'endOfSpeechSensitivity',
|
|
13973
|
+
]);
|
|
13974
|
+
if (fromEndOfSpeechSensitivity != null) {
|
|
13975
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
13976
|
+
}
|
|
13977
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
13978
|
+
'prefixPaddingMs',
|
|
13979
|
+
]);
|
|
13980
|
+
if (fromPrefixPaddingMs != null) {
|
|
13981
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
13982
|
+
}
|
|
13983
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
13984
|
+
'silenceDurationMs',
|
|
13985
|
+
]);
|
|
13986
|
+
if (fromSilenceDurationMs != null) {
|
|
13987
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
13988
|
+
}
|
|
13989
|
+
return toObject;
|
|
13990
|
+
}
|
|
13991
|
+
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
13992
|
+
const toObject = {};
|
|
13993
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
13994
|
+
'automaticActivityDetection',
|
|
13995
|
+
]);
|
|
13996
|
+
if (fromAutomaticActivityDetection != null) {
|
|
13997
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
13998
|
+
}
|
|
13999
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
14000
|
+
'activityHandling',
|
|
14001
|
+
]);
|
|
14002
|
+
if (fromActivityHandling != null) {
|
|
14003
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
14004
|
+
}
|
|
14005
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
14006
|
+
if (fromTurnCoverage != null) {
|
|
14007
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
14008
|
+
}
|
|
14009
|
+
return toObject;
|
|
14010
|
+
}
|
|
14011
|
+
function slidingWindowToMldev(apiClient, fromObject) {
|
|
14012
|
+
const toObject = {};
|
|
14013
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
14014
|
+
if (fromTargetTokens != null) {
|
|
14015
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
14016
|
+
}
|
|
14017
|
+
return toObject;
|
|
14018
|
+
}
|
|
14019
|
+
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
14020
|
+
const toObject = {};
|
|
14021
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
14022
|
+
'triggerTokens',
|
|
14023
|
+
]);
|
|
14024
|
+
if (fromTriggerTokens != null) {
|
|
14025
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
14026
|
+
}
|
|
14027
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
14028
|
+
'slidingWindow',
|
|
14029
|
+
]);
|
|
14030
|
+
if (fromSlidingWindow != null) {
|
|
14031
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
14032
|
+
}
|
|
14033
|
+
return toObject;
|
|
14034
|
+
}
|
|
14035
|
+
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
14036
|
+
const toObject = {};
|
|
14037
|
+
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
14038
|
+
'proactiveAudio',
|
|
14039
|
+
]);
|
|
14040
|
+
if (fromProactiveAudio != null) {
|
|
14041
|
+
setValueByPath(toObject, ['proactiveAudio'], fromProactiveAudio);
|
|
14042
|
+
}
|
|
14043
|
+
return toObject;
|
|
14044
|
+
}
|
|
14045
|
+
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14046
|
+
const toObject = {};
|
|
14047
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
14048
|
+
'generationConfig',
|
|
14049
|
+
]);
|
|
14050
|
+
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
14051
|
+
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
14052
|
+
}
|
|
14053
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
14054
|
+
'responseModalities',
|
|
14055
|
+
]);
|
|
14056
|
+
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
14057
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
14058
|
+
}
|
|
14059
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
14060
|
+
if (parentObject !== undefined && fromTemperature != null) {
|
|
14061
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
14062
|
+
}
|
|
14063
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
14064
|
+
if (parentObject !== undefined && fromTopP != null) {
|
|
14065
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
14066
|
+
}
|
|
14067
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
14068
|
+
if (parentObject !== undefined && fromTopK != null) {
|
|
14069
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
14070
|
+
}
|
|
14071
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
14072
|
+
'maxOutputTokens',
|
|
14073
|
+
]);
|
|
14074
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
14075
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
14076
|
+
}
|
|
14077
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14078
|
+
'mediaResolution',
|
|
14079
|
+
]);
|
|
14080
|
+
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
14081
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
14082
|
+
}
|
|
14083
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
14084
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
14085
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
14086
|
+
}
|
|
14087
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
14088
|
+
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
14089
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
14090
|
+
}
|
|
14091
|
+
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
14092
|
+
'enableAffectiveDialog',
|
|
14093
|
+
]);
|
|
14094
|
+
if (parentObject !== undefined && fromEnableAffectiveDialog != null) {
|
|
14095
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'enableAffectiveDialog'], fromEnableAffectiveDialog);
|
|
14096
|
+
}
|
|
14097
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
14098
|
+
'systemInstruction',
|
|
14099
|
+
]);
|
|
14100
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
14101
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
14102
|
+
}
|
|
14103
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
14104
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
14105
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
14106
|
+
if (Array.isArray(transformedList)) {
|
|
14107
|
+
transformedList = transformedList.map((item) => {
|
|
14108
|
+
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
14109
|
+
});
|
|
14110
|
+
}
|
|
14111
|
+
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
14112
|
+
}
|
|
14113
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
14114
|
+
'sessionResumption',
|
|
14115
|
+
]);
|
|
14116
|
+
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
14117
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
14118
|
+
}
|
|
14119
|
+
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
14120
|
+
'inputAudioTranscription',
|
|
14121
|
+
]);
|
|
14122
|
+
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
14123
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14124
|
+
}
|
|
14125
|
+
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
14126
|
+
'outputAudioTranscription',
|
|
14127
|
+
]);
|
|
14128
|
+
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
14129
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14130
|
+
}
|
|
14131
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
14132
|
+
'realtimeInputConfig',
|
|
14133
|
+
]);
|
|
14134
|
+
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
14135
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
14136
|
+
}
|
|
14137
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
14138
|
+
'contextWindowCompression',
|
|
14139
|
+
]);
|
|
14140
|
+
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
14141
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
14142
|
+
}
|
|
14143
|
+
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
14144
|
+
if (parentObject !== undefined && fromProactivity != null) {
|
|
14145
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
14146
|
+
}
|
|
14147
|
+
return toObject;
|
|
14148
|
+
}
|
|
14149
|
+
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
14150
|
+
const toObject = {};
|
|
14151
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
14152
|
+
if (fromModel != null) {
|
|
14153
|
+
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
14154
|
+
}
|
|
14155
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14156
|
+
if (fromConfig != null) {
|
|
14157
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
14158
|
+
}
|
|
14159
|
+
return toObject;
|
|
14160
|
+
}
|
|
14161
|
+
function createAuthTokenConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14162
|
+
const toObject = {};
|
|
14163
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
14164
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
14165
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
14166
|
+
}
|
|
14167
|
+
const fromNewSessionExpireTime = getValueByPath(fromObject, [
|
|
14168
|
+
'newSessionExpireTime',
|
|
14169
|
+
]);
|
|
14170
|
+
if (parentObject !== undefined && fromNewSessionExpireTime != null) {
|
|
14171
|
+
setValueByPath(parentObject, ['newSessionExpireTime'], fromNewSessionExpireTime);
|
|
14172
|
+
}
|
|
14173
|
+
const fromUses = getValueByPath(fromObject, ['uses']);
|
|
14174
|
+
if (parentObject !== undefined && fromUses != null) {
|
|
14175
|
+
setValueByPath(parentObject, ['uses'], fromUses);
|
|
14176
|
+
}
|
|
14177
|
+
const fromLiveConnectConstraints = getValueByPath(fromObject, [
|
|
14178
|
+
'liveConnectConstraints',
|
|
14179
|
+
]);
|
|
14180
|
+
if (parentObject !== undefined && fromLiveConnectConstraints != null) {
|
|
14181
|
+
setValueByPath(parentObject, ['bidiGenerateContentSetup'], liveConnectConstraintsToMldev(apiClient, fromLiveConnectConstraints));
|
|
14182
|
+
}
|
|
14183
|
+
const fromLockAdditionalFields = getValueByPath(fromObject, [
|
|
14184
|
+
'lockAdditionalFields',
|
|
14185
|
+
]);
|
|
14186
|
+
if (parentObject !== undefined && fromLockAdditionalFields != null) {
|
|
14187
|
+
setValueByPath(parentObject, ['fieldMask'], fromLockAdditionalFields);
|
|
14188
|
+
}
|
|
14189
|
+
return toObject;
|
|
14190
|
+
}
|
|
14191
|
+
function createAuthTokenParametersToMldev(apiClient, fromObject) {
|
|
14192
|
+
const toObject = {};
|
|
14193
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14194
|
+
if (fromConfig != null) {
|
|
14195
|
+
setValueByPath(toObject, ['config'], createAuthTokenConfigToMldev(apiClient, fromConfig, toObject));
|
|
14196
|
+
}
|
|
14197
|
+
return toObject;
|
|
14198
|
+
}
|
|
14199
|
+
function authTokenFromMldev(apiClient, fromObject) {
|
|
14200
|
+
const toObject = {};
|
|
14201
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14202
|
+
if (fromName != null) {
|
|
14203
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14204
|
+
}
|
|
14205
|
+
return toObject;
|
|
14206
|
+
}
|
|
14207
|
+
|
|
14208
|
+
/**
|
|
14209
|
+
* @license
|
|
14210
|
+
* Copyright 2025 Google LLC
|
|
14211
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14212
|
+
*/
|
|
14213
|
+
/**
|
|
14214
|
+
* Returns a comma-separated list of field masks from a given object.
|
|
14215
|
+
*
|
|
14216
|
+
* @param setup The object to extract field masks from.
|
|
14217
|
+
* @return A comma-separated list of field masks.
|
|
14218
|
+
*/
|
|
14219
|
+
function getFieldMasks(setup) {
|
|
14220
|
+
const fields = [];
|
|
14221
|
+
for (const key in setup) {
|
|
14222
|
+
if (Object.prototype.hasOwnProperty.call(setup, key)) {
|
|
14223
|
+
const value = setup[key];
|
|
14224
|
+
// 2nd layer, recursively get field masks see TODO(b/418290100)
|
|
14225
|
+
if (typeof value === 'object' &&
|
|
14226
|
+
value != null &&
|
|
14227
|
+
Object.keys(value).length > 0) {
|
|
14228
|
+
const field = Object.keys(value).map((kk) => `${key}.${kk}`);
|
|
14229
|
+
fields.push(...field);
|
|
14230
|
+
}
|
|
14231
|
+
else {
|
|
14232
|
+
fields.push(key); // 1st layer
|
|
14233
|
+
}
|
|
14234
|
+
}
|
|
14235
|
+
}
|
|
14236
|
+
return fields.join(',');
|
|
14237
|
+
}
|
|
14238
|
+
/**
|
|
14239
|
+
* Converts bidiGenerateContentSetup.
|
|
14240
|
+
* @param requestDict - The request dictionary.
|
|
14241
|
+
* @param config - The configuration object.
|
|
14242
|
+
* @return - The modified request dictionary.
|
|
14243
|
+
*/
|
|
14244
|
+
function convertBidiSetupToTokenSetup(requestDict, config) {
|
|
14245
|
+
// Convert bidiGenerateContentSetup from bidiGenerateContentSetup.setup.
|
|
14246
|
+
let setupForMaskGeneration = null;
|
|
14247
|
+
const bidiGenerateContentSetupValue = requestDict['bidiGenerateContentSetup'];
|
|
14248
|
+
if (typeof bidiGenerateContentSetupValue === 'object' &&
|
|
14249
|
+
bidiGenerateContentSetupValue !== null &&
|
|
14250
|
+
'setup' in bidiGenerateContentSetupValue) {
|
|
14251
|
+
// Now we know bidiGenerateContentSetupValue is an object and has a 'setup'
|
|
14252
|
+
// property.
|
|
14253
|
+
const innerSetup = bidiGenerateContentSetupValue
|
|
14254
|
+
.setup;
|
|
14255
|
+
if (typeof innerSetup === 'object' && innerSetup !== null) {
|
|
14256
|
+
// Valid inner setup found.
|
|
14257
|
+
requestDict['bidiGenerateContentSetup'] = innerSetup;
|
|
14258
|
+
setupForMaskGeneration = innerSetup;
|
|
14259
|
+
}
|
|
14260
|
+
else {
|
|
14261
|
+
// `bidiGenerateContentSetupValue.setup` is not a valid object; treat as
|
|
14262
|
+
// if bidiGenerateContentSetup is invalid.
|
|
14263
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14264
|
+
}
|
|
14265
|
+
}
|
|
14266
|
+
else if (bidiGenerateContentSetupValue !== undefined) {
|
|
14267
|
+
// `bidiGenerateContentSetup` exists but not in the expected
|
|
14268
|
+
// shape {setup: {...}}; treat as invalid.
|
|
14269
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14270
|
+
}
|
|
14271
|
+
const preExistingFieldMask = requestDict['fieldMask'];
|
|
14272
|
+
// Handle mask generation setup.
|
|
14273
|
+
if (setupForMaskGeneration) {
|
|
14274
|
+
const generatedMaskFromBidi = getFieldMasks(setupForMaskGeneration);
|
|
14275
|
+
if (Array.isArray(config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14276
|
+
(config === null || config === void 0 ? void 0 : config.lockAdditionalFields.length) === 0) {
|
|
14277
|
+
// Case 1: lockAdditionalFields is an empty array. Lock only fields from
|
|
14278
|
+
// bidi setup.
|
|
14279
|
+
if (generatedMaskFromBidi) {
|
|
14280
|
+
// Only assign if mask is not empty
|
|
14281
|
+
requestDict['fieldMask'] = generatedMaskFromBidi;
|
|
14282
|
+
}
|
|
14283
|
+
else {
|
|
14284
|
+
delete requestDict['fieldMask']; // If mask is empty, effectively no
|
|
14285
|
+
// specific fields locked by bidi
|
|
14286
|
+
}
|
|
14287
|
+
}
|
|
14288
|
+
else if ((config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14289
|
+
config.lockAdditionalFields.length > 0 &&
|
|
14290
|
+
preExistingFieldMask !== null &&
|
|
14291
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14292
|
+
preExistingFieldMask.length > 0) {
|
|
14293
|
+
// Case 2: Lock fields from bidi setup + additional fields
|
|
14294
|
+
// (preExistingFieldMask).
|
|
14295
|
+
const generationConfigFields = [
|
|
14296
|
+
'temperature',
|
|
14297
|
+
'topK',
|
|
14298
|
+
'topP',
|
|
14299
|
+
'maxOutputTokens',
|
|
14300
|
+
'responseModalities',
|
|
14301
|
+
'seed',
|
|
14302
|
+
'speechConfig',
|
|
14303
|
+
];
|
|
14304
|
+
let mappedFieldsFromPreExisting = [];
|
|
14305
|
+
if (preExistingFieldMask.length > 0) {
|
|
14306
|
+
mappedFieldsFromPreExisting = preExistingFieldMask.map((field) => {
|
|
14307
|
+
if (generationConfigFields.includes(field)) {
|
|
14308
|
+
return `generationConfig.${field}`;
|
|
14309
|
+
}
|
|
14310
|
+
return field; // Keep original field name if not in
|
|
14311
|
+
// generationConfigFields
|
|
14312
|
+
});
|
|
14313
|
+
}
|
|
14314
|
+
const finalMaskParts = [];
|
|
14315
|
+
if (generatedMaskFromBidi) {
|
|
14316
|
+
finalMaskParts.push(generatedMaskFromBidi);
|
|
14317
|
+
}
|
|
14318
|
+
if (mappedFieldsFromPreExisting.length > 0) {
|
|
14319
|
+
finalMaskParts.push(...mappedFieldsFromPreExisting);
|
|
14320
|
+
}
|
|
14321
|
+
if (finalMaskParts.length > 0) {
|
|
14322
|
+
requestDict['fieldMask'] = finalMaskParts.join(',');
|
|
14323
|
+
}
|
|
14324
|
+
else {
|
|
14325
|
+
// If no fields from bidi and no valid additional fields from
|
|
14326
|
+
// pre-existing mask.
|
|
14327
|
+
delete requestDict['fieldMask'];
|
|
14328
|
+
}
|
|
14329
|
+
}
|
|
14330
|
+
else {
|
|
14331
|
+
// Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
|
|
14332
|
+
// defaults apply or all are mutable). This is hit if:
|
|
14333
|
+
// - `config.lockAdditionalFields` is undefined.
|
|
14334
|
+
// - `config.lockAdditionalFields` is non-empty, BUT
|
|
14335
|
+
// `preExistingFieldMask` is null, not a string, or an empty string.
|
|
14336
|
+
delete requestDict['fieldMask'];
|
|
14337
|
+
}
|
|
14338
|
+
}
|
|
14339
|
+
else {
|
|
14340
|
+
// No valid `bidiGenerateContentSetup` was found or extracted.
|
|
14341
|
+
// "Lock additional null fields if any".
|
|
14342
|
+
if (preExistingFieldMask !== null &&
|
|
14343
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14344
|
+
preExistingFieldMask.length > 0) {
|
|
14345
|
+
// If there's a pre-existing field mask, it's a string, and it's not
|
|
14346
|
+
// empty, then we should lock all fields.
|
|
14347
|
+
requestDict['fieldMask'] = preExistingFieldMask.join(',');
|
|
14348
|
+
}
|
|
14349
|
+
else {
|
|
14350
|
+
delete requestDict['fieldMask'];
|
|
14351
|
+
}
|
|
14352
|
+
}
|
|
14353
|
+
return requestDict;
|
|
14354
|
+
}
|
|
14355
|
+
class Tokens extends BaseModule {
|
|
14356
|
+
constructor(apiClient) {
|
|
14357
|
+
super();
|
|
14358
|
+
this.apiClient = apiClient;
|
|
14359
|
+
}
|
|
14360
|
+
/**
|
|
14361
|
+
* Creates an ephemeral auth token resource.
|
|
14362
|
+
*
|
|
14363
|
+
* @experimental
|
|
14364
|
+
*
|
|
14365
|
+
* @remarks
|
|
14366
|
+
* Ephermeral auth tokens is only supported in the Gemini Developer API.
|
|
14367
|
+
* It can be used for the session connection to the Live constrained API.
|
|
14368
|
+
*
|
|
14369
|
+
* @param params - The parameters for the create request.
|
|
14370
|
+
* @return The created auth token.
|
|
14371
|
+
*
|
|
14372
|
+
* @example
|
|
14373
|
+
* ```ts
|
|
14374
|
+
* // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
|
|
14375
|
+
* // when using the token in Live API sessions. Each session connection can
|
|
14376
|
+
* // use a different configuration.
|
|
14377
|
+
* const config: CreateAuthTokenConfig = {
|
|
14378
|
+
* uses: 3,
|
|
14379
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14380
|
+
* }
|
|
14381
|
+
* const token = await ai.tokens.create(config);
|
|
14382
|
+
*
|
|
14383
|
+
* // Case 2: If LiveEphemeralParameters is set, lock all fields in
|
|
14384
|
+
* // LiveConnectConfig when using the token in Live API sessions. For
|
|
14385
|
+
* // example, changing `outputAudioTranscription` in the Live API
|
|
14386
|
+
* // connection will be ignored by the API.
|
|
14387
|
+
* const config: CreateAuthTokenConfig =
|
|
14388
|
+
* uses: 3,
|
|
14389
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14390
|
+
* LiveEphemeralParameters: {
|
|
14391
|
+
* model: 'gemini-2.0-flash-001',
|
|
14392
|
+
* config: {
|
|
14393
|
+
* 'responseModalities': ['AUDIO'],
|
|
14394
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14395
|
+
* }
|
|
14396
|
+
* }
|
|
14397
|
+
* }
|
|
14398
|
+
* const token = await ai.tokens.create(config);
|
|
14399
|
+
*
|
|
14400
|
+
* // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14401
|
+
* // set, lock LiveConnectConfig with set and additional fields (e.g.
|
|
14402
|
+
* // responseModalities, systemInstruction, temperature in this example) when
|
|
14403
|
+
* // using the token in Live API sessions.
|
|
14404
|
+
* const config: CreateAuthTokenConfig =
|
|
14405
|
+
* uses: 3,
|
|
14406
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14407
|
+
* LiveEphemeralParameters: {
|
|
14408
|
+
* model: 'gemini-2.0-flash-001',
|
|
14409
|
+
* config: {
|
|
14410
|
+
* 'responseModalities': ['AUDIO'],
|
|
14411
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14412
|
+
* }
|
|
14413
|
+
* },
|
|
14414
|
+
* lockAdditionalFields: ['temperature'],
|
|
14415
|
+
* }
|
|
14416
|
+
* const token = await ai.tokens.create(config);
|
|
14417
|
+
*
|
|
14418
|
+
* // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14419
|
+
* // empty array, lock LiveConnectConfig with set fields (e.g.
|
|
14420
|
+
* // responseModalities, systemInstruction in this example) when using the
|
|
14421
|
+
* // token in Live API sessions.
|
|
14422
|
+
* const config: CreateAuthTokenConfig =
|
|
14423
|
+
* uses: 3,
|
|
14424
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14425
|
+
* LiveEphemeralParameters: {
|
|
14426
|
+
* model: 'gemini-2.0-flash-001',
|
|
14427
|
+
* config: {
|
|
14428
|
+
* 'responseModalities': ['AUDIO'],
|
|
14429
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14430
|
+
* }
|
|
14431
|
+
* },
|
|
14432
|
+
* lockAdditionalFields: [],
|
|
14433
|
+
* }
|
|
14434
|
+
* const token = await ai.tokens.create(config);
|
|
14435
|
+
* ```
|
|
14436
|
+
*/
|
|
14437
|
+
async create(params) {
|
|
14438
|
+
var _a, _b;
|
|
14439
|
+
let response;
|
|
14440
|
+
let path = '';
|
|
14441
|
+
let queryParams = {};
|
|
14442
|
+
if (this.apiClient.isVertexAI()) {
|
|
14443
|
+
throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
|
|
14444
|
+
}
|
|
14445
|
+
else {
|
|
14446
|
+
const body = createAuthTokenParametersToMldev(this.apiClient, params);
|
|
14447
|
+
path = formatMap('auth_tokens', body['_url']);
|
|
14448
|
+
queryParams = body['_query'];
|
|
14449
|
+
delete body['config'];
|
|
14450
|
+
delete body['_url'];
|
|
14451
|
+
delete body['_query'];
|
|
14452
|
+
const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
|
|
14453
|
+
response = this.apiClient
|
|
14454
|
+
.request({
|
|
14455
|
+
path: path,
|
|
14456
|
+
queryParams: queryParams,
|
|
14457
|
+
body: JSON.stringify(transformedBody),
|
|
14458
|
+
httpMethod: 'POST',
|
|
14459
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
14460
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14461
|
+
})
|
|
14462
|
+
.then((httpResponse) => {
|
|
14463
|
+
return httpResponse.json();
|
|
14464
|
+
});
|
|
14465
|
+
return response.then((apiResponse) => {
|
|
14466
|
+
const resp = authTokenFromMldev(this.apiClient, apiResponse);
|
|
14467
|
+
return resp;
|
|
14468
|
+
});
|
|
14469
|
+
}
|
|
14470
|
+
}
|
|
14471
|
+
}
|
|
14472
|
+
|
|
14473
|
+
/**
|
|
14474
|
+
* @license
|
|
14475
|
+
* Copyright 2025 Google LLC
|
|
14476
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14477
|
+
*/
|
|
14478
|
+
const GOOGLE_API_KEY_HEADER = 'x-goog-api-key';
|
|
14479
|
+
const REQUIRED_VERTEX_AI_SCOPE = 'https://www.googleapis.com/auth/cloud-platform';
|
|
14480
|
+
class NodeAuth {
|
|
14481
|
+
constructor(opts) {
|
|
14482
|
+
if (opts.apiKey !== undefined) {
|
|
14483
|
+
this.apiKey = opts.apiKey;
|
|
14484
|
+
return;
|
|
14485
|
+
}
|
|
14486
|
+
const vertexAuthOptions = buildGoogleAuthOptions(opts.googleAuthOptions);
|
|
14487
|
+
this.googleAuth = new googleAuthLibrary.GoogleAuth(vertexAuthOptions);
|
|
14488
|
+
}
|
|
14489
|
+
async addAuthHeaders(headers) {
|
|
14490
|
+
if (this.apiKey !== undefined) {
|
|
14491
|
+
if (this.apiKey.startsWith('auth_tokens/')) {
|
|
14492
|
+
throw new Error('Ephemeral tokens are only supported by the live API.');
|
|
14493
|
+
}
|
|
13594
14494
|
this.addKeyHeader(headers);
|
|
13595
14495
|
return;
|
|
13596
14496
|
}
|
|
@@ -14899,6 +15799,7 @@ class GoogleGenAI {
|
|
|
14899
15799
|
this.caches = new Caches(this.apiClient);
|
|
14900
15800
|
this.files = new Files(this.apiClient);
|
|
14901
15801
|
this.operations = new Operations(this.apiClient);
|
|
15802
|
+
this.authTokens = new Tokens(this.apiClient);
|
|
14902
15803
|
this.tunings = new Tunings(this.apiClient);
|
|
14903
15804
|
}
|
|
14904
15805
|
}
|
|
@@ -14955,6 +15856,7 @@ exports.ReplayResponse = ReplayResponse;
|
|
|
14955
15856
|
exports.Session = Session;
|
|
14956
15857
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
14957
15858
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
15859
|
+
exports.Tokens = Tokens;
|
|
14958
15860
|
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
14959
15861
|
exports.createModelContent = createModelContent;
|
|
14960
15862
|
exports.createPartFromBase64 = createPartFromBase64;
|