@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/index.cjs
CHANGED
|
@@ -164,7 +164,6 @@ function getValueByPath(data, keys) {
|
|
|
164
164
|
* Copyright 2025 Google LLC
|
|
165
165
|
* SPDX-License-Identifier: Apache-2.0
|
|
166
166
|
*/
|
|
167
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
168
167
|
/** Required. Outcome of the code execution. */
|
|
169
168
|
exports.Outcome = void 0;
|
|
170
169
|
(function (Outcome) {
|
|
@@ -400,6 +399,10 @@ exports.FinishReason = void 0;
|
|
|
400
399
|
* Token generation stopped because generated images have safety violations.
|
|
401
400
|
*/
|
|
402
401
|
FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
402
|
+
/**
|
|
403
|
+
* The tool call generated by the model is invalid.
|
|
404
|
+
*/
|
|
405
|
+
FinishReason["UNEXPECTED_TOOL_CALL"] = "UNEXPECTED_TOOL_CALL";
|
|
403
406
|
})(exports.FinishReason || (exports.FinishReason = {}));
|
|
404
407
|
/** Output only. Harm probability levels in the content. */
|
|
405
408
|
exports.HarmProbability = void 0;
|
|
@@ -1393,7 +1396,6 @@ class ReplayResponse {
|
|
|
1393
1396
|
*/
|
|
1394
1397
|
class RawReferenceImage {
|
|
1395
1398
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1396
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1397
1399
|
toReferenceImageAPI() {
|
|
1398
1400
|
const referenceImageAPI = {
|
|
1399
1401
|
referenceType: 'REFERENCE_TYPE_RAW',
|
|
@@ -1415,7 +1417,6 @@ class RawReferenceImage {
|
|
|
1415
1417
|
*/
|
|
1416
1418
|
class MaskReferenceImage {
|
|
1417
1419
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1418
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1419
1420
|
toReferenceImageAPI() {
|
|
1420
1421
|
const referenceImageAPI = {
|
|
1421
1422
|
referenceType: 'REFERENCE_TYPE_MASK',
|
|
@@ -1438,7 +1439,6 @@ class MaskReferenceImage {
|
|
|
1438
1439
|
*/
|
|
1439
1440
|
class ControlReferenceImage {
|
|
1440
1441
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1441
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1442
1442
|
toReferenceImageAPI() {
|
|
1443
1443
|
const referenceImageAPI = {
|
|
1444
1444
|
referenceType: 'REFERENCE_TYPE_CONTROL',
|
|
@@ -1459,7 +1459,6 @@ class ControlReferenceImage {
|
|
|
1459
1459
|
*/
|
|
1460
1460
|
class StyleReferenceImage {
|
|
1461
1461
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1462
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1463
1462
|
toReferenceImageAPI() {
|
|
1464
1463
|
const referenceImageAPI = {
|
|
1465
1464
|
referenceType: 'REFERENCE_TYPE_STYLE',
|
|
@@ -1480,7 +1479,6 @@ class StyleReferenceImage {
|
|
|
1480
1479
|
*/
|
|
1481
1480
|
class SubjectReferenceImage {
|
|
1482
1481
|
/* Internal method to convert to ReferenceImageAPIInternal. */
|
|
1483
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1484
1482
|
toReferenceImageAPI() {
|
|
1485
1483
|
const referenceImageAPI = {
|
|
1486
1484
|
referenceType: 'REFERENCE_TYPE_SUBJECT',
|
|
@@ -2395,7 +2393,7 @@ function filterToJsonSchema(schema) {
|
|
|
2395
2393
|
* Copyright 2025 Google LLC
|
|
2396
2394
|
* SPDX-License-Identifier: Apache-2.0
|
|
2397
2395
|
*/
|
|
2398
|
-
function videoMetadataToMldev$
|
|
2396
|
+
function videoMetadataToMldev$3(apiClient, fromObject) {
|
|
2399
2397
|
const toObject = {};
|
|
2400
2398
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
2401
2399
|
if (fromFps != null) {
|
|
@@ -2411,7 +2409,7 @@ function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
|
2411
2409
|
}
|
|
2412
2410
|
return toObject;
|
|
2413
2411
|
}
|
|
2414
|
-
function blobToMldev$
|
|
2412
|
+
function blobToMldev$3(apiClient, fromObject) {
|
|
2415
2413
|
const toObject = {};
|
|
2416
2414
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2417
2415
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2426,7 +2424,7 @@ function blobToMldev$2(apiClient, fromObject) {
|
|
|
2426
2424
|
}
|
|
2427
2425
|
return toObject;
|
|
2428
2426
|
}
|
|
2429
|
-
function fileDataToMldev$
|
|
2427
|
+
function fileDataToMldev$3(apiClient, fromObject) {
|
|
2430
2428
|
const toObject = {};
|
|
2431
2429
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2432
2430
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2441,13 +2439,13 @@ function fileDataToMldev$2(apiClient, fromObject) {
|
|
|
2441
2439
|
}
|
|
2442
2440
|
return toObject;
|
|
2443
2441
|
}
|
|
2444
|
-
function partToMldev$
|
|
2442
|
+
function partToMldev$3(apiClient, fromObject) {
|
|
2445
2443
|
const toObject = {};
|
|
2446
2444
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
2447
2445
|
'videoMetadata',
|
|
2448
2446
|
]);
|
|
2449
2447
|
if (fromVideoMetadata != null) {
|
|
2450
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
2448
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$3(apiClient, fromVideoMetadata));
|
|
2451
2449
|
}
|
|
2452
2450
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
2453
2451
|
if (fromThought != null) {
|
|
@@ -2455,11 +2453,17 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2455
2453
|
}
|
|
2456
2454
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
2457
2455
|
if (fromInlineData != null) {
|
|
2458
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
2456
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$3(apiClient, fromInlineData));
|
|
2459
2457
|
}
|
|
2460
2458
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
2461
2459
|
if (fromFileData != null) {
|
|
2462
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
2460
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$3(apiClient, fromFileData));
|
|
2461
|
+
}
|
|
2462
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2463
|
+
'thoughtSignature',
|
|
2464
|
+
]);
|
|
2465
|
+
if (fromThoughtSignature != null) {
|
|
2466
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2463
2467
|
}
|
|
2464
2468
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2465
2469
|
'codeExecutionResult',
|
|
@@ -2489,14 +2493,14 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2489
2493
|
}
|
|
2490
2494
|
return toObject;
|
|
2491
2495
|
}
|
|
2492
|
-
function contentToMldev$
|
|
2496
|
+
function contentToMldev$3(apiClient, fromObject) {
|
|
2493
2497
|
const toObject = {};
|
|
2494
2498
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2495
2499
|
if (fromParts != null) {
|
|
2496
2500
|
let transformedList = fromParts;
|
|
2497
2501
|
if (Array.isArray(transformedList)) {
|
|
2498
2502
|
transformedList = transformedList.map((item) => {
|
|
2499
|
-
return partToMldev$
|
|
2503
|
+
return partToMldev$3(apiClient, item);
|
|
2500
2504
|
});
|
|
2501
2505
|
}
|
|
2502
2506
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -2507,7 +2511,7 @@ function contentToMldev$2(apiClient, fromObject) {
|
|
|
2507
2511
|
}
|
|
2508
2512
|
return toObject;
|
|
2509
2513
|
}
|
|
2510
|
-
function functionDeclarationToMldev$
|
|
2514
|
+
function functionDeclarationToMldev$3(apiClient, fromObject) {
|
|
2511
2515
|
const toObject = {};
|
|
2512
2516
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
2513
2517
|
if (fromBehavior != null) {
|
|
@@ -2531,7 +2535,7 @@ function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
|
2531
2535
|
}
|
|
2532
2536
|
return toObject;
|
|
2533
2537
|
}
|
|
2534
|
-
function intervalToMldev$
|
|
2538
|
+
function intervalToMldev$3(apiClient, fromObject) {
|
|
2535
2539
|
const toObject = {};
|
|
2536
2540
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
2537
2541
|
if (fromStartTime != null) {
|
|
@@ -2543,17 +2547,17 @@ function intervalToMldev$2(apiClient, fromObject) {
|
|
|
2543
2547
|
}
|
|
2544
2548
|
return toObject;
|
|
2545
2549
|
}
|
|
2546
|
-
function googleSearchToMldev$
|
|
2550
|
+
function googleSearchToMldev$3(apiClient, fromObject) {
|
|
2547
2551
|
const toObject = {};
|
|
2548
2552
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
2549
2553
|
'timeRangeFilter',
|
|
2550
2554
|
]);
|
|
2551
2555
|
if (fromTimeRangeFilter != null) {
|
|
2552
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
2556
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(apiClient, fromTimeRangeFilter));
|
|
2553
2557
|
}
|
|
2554
2558
|
return toObject;
|
|
2555
2559
|
}
|
|
2556
|
-
function dynamicRetrievalConfigToMldev$
|
|
2560
|
+
function dynamicRetrievalConfigToMldev$3(apiClient, fromObject) {
|
|
2557
2561
|
const toObject = {};
|
|
2558
2562
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2559
2563
|
if (fromMode != null) {
|
|
@@ -2567,21 +2571,21 @@ function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
|
2567
2571
|
}
|
|
2568
2572
|
return toObject;
|
|
2569
2573
|
}
|
|
2570
|
-
function googleSearchRetrievalToMldev$
|
|
2574
|
+
function googleSearchRetrievalToMldev$3(apiClient, fromObject) {
|
|
2571
2575
|
const toObject = {};
|
|
2572
2576
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
2573
2577
|
'dynamicRetrievalConfig',
|
|
2574
2578
|
]);
|
|
2575
2579
|
if (fromDynamicRetrievalConfig != null) {
|
|
2576
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
2580
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$3(apiClient, fromDynamicRetrievalConfig));
|
|
2577
2581
|
}
|
|
2578
2582
|
return toObject;
|
|
2579
2583
|
}
|
|
2580
|
-
function urlContextToMldev$
|
|
2584
|
+
function urlContextToMldev$3() {
|
|
2581
2585
|
const toObject = {};
|
|
2582
2586
|
return toObject;
|
|
2583
2587
|
}
|
|
2584
|
-
function toolToMldev$
|
|
2588
|
+
function toolToMldev$3(apiClient, fromObject) {
|
|
2585
2589
|
const toObject = {};
|
|
2586
2590
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
2587
2591
|
'functionDeclarations',
|
|
@@ -2590,7 +2594,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2590
2594
|
let transformedList = fromFunctionDeclarations;
|
|
2591
2595
|
if (Array.isArray(transformedList)) {
|
|
2592
2596
|
transformedList = transformedList.map((item) => {
|
|
2593
|
-
return functionDeclarationToMldev$
|
|
2597
|
+
return functionDeclarationToMldev$3(apiClient, item);
|
|
2594
2598
|
});
|
|
2595
2599
|
}
|
|
2596
2600
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -2600,13 +2604,13 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2600
2604
|
}
|
|
2601
2605
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
2602
2606
|
if (fromGoogleSearch != null) {
|
|
2603
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
2607
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(apiClient, fromGoogleSearch));
|
|
2604
2608
|
}
|
|
2605
2609
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
2606
2610
|
'googleSearchRetrieval',
|
|
2607
2611
|
]);
|
|
2608
2612
|
if (fromGoogleSearchRetrieval != null) {
|
|
2609
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
2613
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$3(apiClient, fromGoogleSearchRetrieval));
|
|
2610
2614
|
}
|
|
2611
2615
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
2612
2616
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -2616,7 +2620,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2616
2620
|
}
|
|
2617
2621
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
2618
2622
|
if (fromUrlContext != null) {
|
|
2619
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
2623
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
|
|
2620
2624
|
}
|
|
2621
2625
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
2622
2626
|
'codeExecution',
|
|
@@ -2699,7 +2703,7 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2699
2703
|
let transformedList = tContents(apiClient, fromContents);
|
|
2700
2704
|
if (Array.isArray(transformedList)) {
|
|
2701
2705
|
transformedList = transformedList.map((item) => {
|
|
2702
|
-
return contentToMldev$
|
|
2706
|
+
return contentToMldev$3(apiClient, item);
|
|
2703
2707
|
});
|
|
2704
2708
|
}
|
|
2705
2709
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -2708,14 +2712,14 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2708
2712
|
'systemInstruction',
|
|
2709
2713
|
]);
|
|
2710
2714
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
2711
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$
|
|
2715
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$3(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
2712
2716
|
}
|
|
2713
2717
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
2714
2718
|
if (parentObject !== undefined && fromTools != null) {
|
|
2715
2719
|
let transformedList = fromTools;
|
|
2716
2720
|
if (Array.isArray(transformedList)) {
|
|
2717
2721
|
transformedList = transformedList.map((item) => {
|
|
2718
|
-
return toolToMldev$
|
|
2722
|
+
return toolToMldev$3(apiClient, item);
|
|
2719
2723
|
});
|
|
2720
2724
|
}
|
|
2721
2725
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -2877,6 +2881,12 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
2877
2881
|
if (fromFileData != null) {
|
|
2878
2882
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$2(apiClient, fromFileData));
|
|
2879
2883
|
}
|
|
2884
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2885
|
+
'thoughtSignature',
|
|
2886
|
+
]);
|
|
2887
|
+
if (fromThoughtSignature != null) {
|
|
2888
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2889
|
+
}
|
|
2880
2890
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2881
2891
|
'codeExecutionResult',
|
|
2882
2892
|
]);
|
|
@@ -4338,7 +4348,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
4338
4348
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
4339
4349
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
4340
4350
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
4341
|
-
const SDK_VERSION = '1.
|
|
4351
|
+
const SDK_VERSION = '1.3.0'; // x-release-please-version
|
|
4342
4352
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
4343
4353
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
4344
4354
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -5502,7 +5512,7 @@ class Files extends BaseModule {
|
|
|
5502
5512
|
* Copyright 2025 Google LLC
|
|
5503
5513
|
* SPDX-License-Identifier: Apache-2.0
|
|
5504
5514
|
*/
|
|
5505
|
-
function prebuiltVoiceConfigToMldev$
|
|
5515
|
+
function prebuiltVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
5506
5516
|
const toObject = {};
|
|
5507
5517
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
5508
5518
|
if (fromVoiceName != null) {
|
|
@@ -5518,13 +5528,13 @@ function prebuiltVoiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
5518
5528
|
}
|
|
5519
5529
|
return toObject;
|
|
5520
5530
|
}
|
|
5521
|
-
function voiceConfigToMldev$
|
|
5531
|
+
function voiceConfigToMldev$2(apiClient, fromObject) {
|
|
5522
5532
|
const toObject = {};
|
|
5523
5533
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
5524
5534
|
'prebuiltVoiceConfig',
|
|
5525
5535
|
]);
|
|
5526
5536
|
if (fromPrebuiltVoiceConfig != null) {
|
|
5527
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$
|
|
5537
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$2(apiClient, fromPrebuiltVoiceConfig));
|
|
5528
5538
|
}
|
|
5529
5539
|
return toObject;
|
|
5530
5540
|
}
|
|
@@ -5538,7 +5548,7 @@ function voiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
5538
5548
|
}
|
|
5539
5549
|
return toObject;
|
|
5540
5550
|
}
|
|
5541
|
-
function speakerVoiceConfigToMldev$
|
|
5551
|
+
function speakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
5542
5552
|
const toObject = {};
|
|
5543
5553
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
5544
5554
|
if (fromSpeaker != null) {
|
|
@@ -5546,11 +5556,11 @@ function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
5546
5556
|
}
|
|
5547
5557
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
5548
5558
|
if (fromVoiceConfig != null) {
|
|
5549
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
5559
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
5550
5560
|
}
|
|
5551
5561
|
return toObject;
|
|
5552
5562
|
}
|
|
5553
|
-
function multiSpeakerVoiceConfigToMldev$
|
|
5563
|
+
function multiSpeakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
5554
5564
|
const toObject = {};
|
|
5555
5565
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
5556
5566
|
'speakerVoiceConfigs',
|
|
@@ -5559,24 +5569,24 @@ function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
5559
5569
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
5560
5570
|
if (Array.isArray(transformedList)) {
|
|
5561
5571
|
transformedList = transformedList.map((item) => {
|
|
5562
|
-
return speakerVoiceConfigToMldev$
|
|
5572
|
+
return speakerVoiceConfigToMldev$2(apiClient, item);
|
|
5563
5573
|
});
|
|
5564
5574
|
}
|
|
5565
5575
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
5566
5576
|
}
|
|
5567
5577
|
return toObject;
|
|
5568
5578
|
}
|
|
5569
|
-
function speechConfigToMldev$
|
|
5579
|
+
function speechConfigToMldev$2(apiClient, fromObject) {
|
|
5570
5580
|
const toObject = {};
|
|
5571
5581
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
5572
5582
|
if (fromVoiceConfig != null) {
|
|
5573
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
5583
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
5574
5584
|
}
|
|
5575
5585
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
5576
5586
|
'multiSpeakerVoiceConfig',
|
|
5577
5587
|
]);
|
|
5578
5588
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
5579
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$
|
|
5589
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$2(apiClient, fromMultiSpeakerVoiceConfig));
|
|
5580
5590
|
}
|
|
5581
5591
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
5582
5592
|
if (fromLanguageCode != null) {
|
|
@@ -5599,7 +5609,7 @@ function speechConfigToVertex$1(apiClient, fromObject) {
|
|
|
5599
5609
|
}
|
|
5600
5610
|
return toObject;
|
|
5601
5611
|
}
|
|
5602
|
-
function videoMetadataToMldev$
|
|
5612
|
+
function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
5603
5613
|
const toObject = {};
|
|
5604
5614
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
5605
5615
|
if (fromFps != null) {
|
|
@@ -5631,7 +5641,7 @@ function videoMetadataToVertex$1(apiClient, fromObject) {
|
|
|
5631
5641
|
}
|
|
5632
5642
|
return toObject;
|
|
5633
5643
|
}
|
|
5634
|
-
function blobToMldev$
|
|
5644
|
+
function blobToMldev$2(apiClient, fromObject) {
|
|
5635
5645
|
const toObject = {};
|
|
5636
5646
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5637
5647
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5662,7 +5672,7 @@ function blobToVertex$1(apiClient, fromObject) {
|
|
|
5662
5672
|
}
|
|
5663
5673
|
return toObject;
|
|
5664
5674
|
}
|
|
5665
|
-
function fileDataToMldev$
|
|
5675
|
+
function fileDataToMldev$2(apiClient, fromObject) {
|
|
5666
5676
|
const toObject = {};
|
|
5667
5677
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5668
5678
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5693,13 +5703,13 @@ function fileDataToVertex$1(apiClient, fromObject) {
|
|
|
5693
5703
|
}
|
|
5694
5704
|
return toObject;
|
|
5695
5705
|
}
|
|
5696
|
-
function partToMldev$
|
|
5706
|
+
function partToMldev$2(apiClient, fromObject) {
|
|
5697
5707
|
const toObject = {};
|
|
5698
5708
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
5699
5709
|
'videoMetadata',
|
|
5700
5710
|
]);
|
|
5701
5711
|
if (fromVideoMetadata != null) {
|
|
5702
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
5712
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$2(apiClient, fromVideoMetadata));
|
|
5703
5713
|
}
|
|
5704
5714
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
5705
5715
|
if (fromThought != null) {
|
|
@@ -5707,11 +5717,17 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
5707
5717
|
}
|
|
5708
5718
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5709
5719
|
if (fromInlineData != null) {
|
|
5710
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
5720
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
5711
5721
|
}
|
|
5712
5722
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
5713
5723
|
if (fromFileData != null) {
|
|
5714
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
5724
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
|
|
5725
|
+
}
|
|
5726
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5727
|
+
'thoughtSignature',
|
|
5728
|
+
]);
|
|
5729
|
+
if (fromThoughtSignature != null) {
|
|
5730
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5715
5731
|
}
|
|
5716
5732
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5717
5733
|
'codeExecutionResult',
|
|
@@ -5761,6 +5777,12 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5761
5777
|
if (fromFileData != null) {
|
|
5762
5778
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
|
|
5763
5779
|
}
|
|
5780
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5781
|
+
'thoughtSignature',
|
|
5782
|
+
]);
|
|
5783
|
+
if (fromThoughtSignature != null) {
|
|
5784
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5785
|
+
}
|
|
5764
5786
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5765
5787
|
'codeExecutionResult',
|
|
5766
5788
|
]);
|
|
@@ -5789,14 +5811,14 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5789
5811
|
}
|
|
5790
5812
|
return toObject;
|
|
5791
5813
|
}
|
|
5792
|
-
function contentToMldev$
|
|
5814
|
+
function contentToMldev$2(apiClient, fromObject) {
|
|
5793
5815
|
const toObject = {};
|
|
5794
5816
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5795
5817
|
if (fromParts != null) {
|
|
5796
5818
|
let transformedList = fromParts;
|
|
5797
5819
|
if (Array.isArray(transformedList)) {
|
|
5798
5820
|
transformedList = transformedList.map((item) => {
|
|
5799
|
-
return partToMldev$
|
|
5821
|
+
return partToMldev$2(apiClient, item);
|
|
5800
5822
|
});
|
|
5801
5823
|
}
|
|
5802
5824
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5825,7 +5847,7 @@ function contentToVertex$1(apiClient, fromObject) {
|
|
|
5825
5847
|
}
|
|
5826
5848
|
return toObject;
|
|
5827
5849
|
}
|
|
5828
|
-
function functionDeclarationToMldev$
|
|
5850
|
+
function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
5829
5851
|
const toObject = {};
|
|
5830
5852
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
5831
5853
|
if (fromBehavior != null) {
|
|
@@ -5872,7 +5894,7 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
|
5872
5894
|
}
|
|
5873
5895
|
return toObject;
|
|
5874
5896
|
}
|
|
5875
|
-
function intervalToMldev$
|
|
5897
|
+
function intervalToMldev$2(apiClient, fromObject) {
|
|
5876
5898
|
const toObject = {};
|
|
5877
5899
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
5878
5900
|
if (fromStartTime != null) {
|
|
@@ -5896,13 +5918,13 @@ function intervalToVertex$1(apiClient, fromObject) {
|
|
|
5896
5918
|
}
|
|
5897
5919
|
return toObject;
|
|
5898
5920
|
}
|
|
5899
|
-
function googleSearchToMldev$
|
|
5921
|
+
function googleSearchToMldev$2(apiClient, fromObject) {
|
|
5900
5922
|
const toObject = {};
|
|
5901
5923
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
5902
5924
|
'timeRangeFilter',
|
|
5903
5925
|
]);
|
|
5904
5926
|
if (fromTimeRangeFilter != null) {
|
|
5905
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
5927
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(apiClient, fromTimeRangeFilter));
|
|
5906
5928
|
}
|
|
5907
5929
|
return toObject;
|
|
5908
5930
|
}
|
|
@@ -5916,7 +5938,7 @@ function googleSearchToVertex$1(apiClient, fromObject) {
|
|
|
5916
5938
|
}
|
|
5917
5939
|
return toObject;
|
|
5918
5940
|
}
|
|
5919
|
-
function dynamicRetrievalConfigToMldev$
|
|
5941
|
+
function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
5920
5942
|
const toObject = {};
|
|
5921
5943
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5922
5944
|
if (fromMode != null) {
|
|
@@ -5944,13 +5966,13 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
|
5944
5966
|
}
|
|
5945
5967
|
return toObject;
|
|
5946
5968
|
}
|
|
5947
|
-
function googleSearchRetrievalToMldev$
|
|
5969
|
+
function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
|
|
5948
5970
|
const toObject = {};
|
|
5949
5971
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
5950
5972
|
'dynamicRetrievalConfig',
|
|
5951
5973
|
]);
|
|
5952
5974
|
if (fromDynamicRetrievalConfig != null) {
|
|
5953
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
5975
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
|
|
5954
5976
|
}
|
|
5955
5977
|
return toObject;
|
|
5956
5978
|
}
|
|
@@ -6016,11 +6038,11 @@ function googleMapsToVertex$1(apiClient, fromObject) {
|
|
|
6016
6038
|
}
|
|
6017
6039
|
return toObject;
|
|
6018
6040
|
}
|
|
6019
|
-
function urlContextToMldev$
|
|
6041
|
+
function urlContextToMldev$2() {
|
|
6020
6042
|
const toObject = {};
|
|
6021
6043
|
return toObject;
|
|
6022
6044
|
}
|
|
6023
|
-
function toolToMldev$
|
|
6045
|
+
function toolToMldev$2(apiClient, fromObject) {
|
|
6024
6046
|
const toObject = {};
|
|
6025
6047
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
6026
6048
|
'functionDeclarations',
|
|
@@ -6029,7 +6051,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
6029
6051
|
let transformedList = fromFunctionDeclarations;
|
|
6030
6052
|
if (Array.isArray(transformedList)) {
|
|
6031
6053
|
transformedList = transformedList.map((item) => {
|
|
6032
|
-
return functionDeclarationToMldev$
|
|
6054
|
+
return functionDeclarationToMldev$2(apiClient, item);
|
|
6033
6055
|
});
|
|
6034
6056
|
}
|
|
6035
6057
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -6039,13 +6061,13 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
6039
6061
|
}
|
|
6040
6062
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
6041
6063
|
if (fromGoogleSearch != null) {
|
|
6042
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
6064
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(apiClient, fromGoogleSearch));
|
|
6043
6065
|
}
|
|
6044
6066
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
6045
6067
|
'googleSearchRetrieval',
|
|
6046
6068
|
]);
|
|
6047
6069
|
if (fromGoogleSearchRetrieval != null) {
|
|
6048
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
6070
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
|
|
6049
6071
|
}
|
|
6050
6072
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
6051
6073
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -6055,7 +6077,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
6055
6077
|
}
|
|
6056
6078
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
6057
6079
|
if (fromUrlContext != null) {
|
|
6058
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
6080
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
|
|
6059
6081
|
}
|
|
6060
6082
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
6061
6083
|
'codeExecution',
|
|
@@ -6114,7 +6136,7 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
6114
6136
|
}
|
|
6115
6137
|
return toObject;
|
|
6116
6138
|
}
|
|
6117
|
-
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
6139
|
+
function sessionResumptionConfigToMldev$1(apiClient, fromObject) {
|
|
6118
6140
|
const toObject = {};
|
|
6119
6141
|
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
6120
6142
|
if (fromHandle != null) {
|
|
@@ -6137,7 +6159,7 @@ function sessionResumptionConfigToVertex(apiClient, fromObject) {
|
|
|
6137
6159
|
}
|
|
6138
6160
|
return toObject;
|
|
6139
6161
|
}
|
|
6140
|
-
function audioTranscriptionConfigToMldev() {
|
|
6162
|
+
function audioTranscriptionConfigToMldev$1() {
|
|
6141
6163
|
const toObject = {};
|
|
6142
6164
|
return toObject;
|
|
6143
6165
|
}
|
|
@@ -6145,7 +6167,7 @@ function audioTranscriptionConfigToVertex() {
|
|
|
6145
6167
|
const toObject = {};
|
|
6146
6168
|
return toObject;
|
|
6147
6169
|
}
|
|
6148
|
-
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
6170
|
+
function automaticActivityDetectionToMldev$1(apiClient, fromObject) {
|
|
6149
6171
|
const toObject = {};
|
|
6150
6172
|
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
6151
6173
|
if (fromDisabled != null) {
|
|
@@ -6209,13 +6231,13 @@ function automaticActivityDetectionToVertex(apiClient, fromObject) {
|
|
|
6209
6231
|
}
|
|
6210
6232
|
return toObject;
|
|
6211
6233
|
}
|
|
6212
|
-
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
6234
|
+
function realtimeInputConfigToMldev$1(apiClient, fromObject) {
|
|
6213
6235
|
const toObject = {};
|
|
6214
6236
|
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
6215
6237
|
'automaticActivityDetection',
|
|
6216
6238
|
]);
|
|
6217
6239
|
if (fromAutomaticActivityDetection != null) {
|
|
6218
|
-
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
6240
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev$1(apiClient, fromAutomaticActivityDetection));
|
|
6219
6241
|
}
|
|
6220
6242
|
const fromActivityHandling = getValueByPath(fromObject, [
|
|
6221
6243
|
'activityHandling',
|
|
@@ -6249,7 +6271,7 @@ function realtimeInputConfigToVertex(apiClient, fromObject) {
|
|
|
6249
6271
|
}
|
|
6250
6272
|
return toObject;
|
|
6251
6273
|
}
|
|
6252
|
-
function slidingWindowToMldev(apiClient, fromObject) {
|
|
6274
|
+
function slidingWindowToMldev$1(apiClient, fromObject) {
|
|
6253
6275
|
const toObject = {};
|
|
6254
6276
|
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
6255
6277
|
if (fromTargetTokens != null) {
|
|
@@ -6265,7 +6287,7 @@ function slidingWindowToVertex(apiClient, fromObject) {
|
|
|
6265
6287
|
}
|
|
6266
6288
|
return toObject;
|
|
6267
6289
|
}
|
|
6268
|
-
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
6290
|
+
function contextWindowCompressionConfigToMldev$1(apiClient, fromObject) {
|
|
6269
6291
|
const toObject = {};
|
|
6270
6292
|
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
6271
6293
|
'triggerTokens',
|
|
@@ -6277,7 +6299,7 @@ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
|
6277
6299
|
'slidingWindow',
|
|
6278
6300
|
]);
|
|
6279
6301
|
if (fromSlidingWindow != null) {
|
|
6280
|
-
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
6302
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev$1(apiClient, fromSlidingWindow));
|
|
6281
6303
|
}
|
|
6282
6304
|
return toObject;
|
|
6283
6305
|
}
|
|
@@ -6297,7 +6319,7 @@ function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
|
|
|
6297
6319
|
}
|
|
6298
6320
|
return toObject;
|
|
6299
6321
|
}
|
|
6300
|
-
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
6322
|
+
function proactivityConfigToMldev$1(apiClient, fromObject) {
|
|
6301
6323
|
const toObject = {};
|
|
6302
6324
|
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
6303
6325
|
'proactiveAudio',
|
|
@@ -6317,7 +6339,7 @@ function proactivityConfigToVertex(apiClient, fromObject) {
|
|
|
6317
6339
|
}
|
|
6318
6340
|
return toObject;
|
|
6319
6341
|
}
|
|
6320
|
-
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
6342
|
+
function liveConnectConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
6321
6343
|
const toObject = {};
|
|
6322
6344
|
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
6323
6345
|
'generationConfig',
|
|
@@ -6361,7 +6383,7 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
6361
6383
|
}
|
|
6362
6384
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
6363
6385
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
6364
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$
|
|
6386
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$2(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
6365
6387
|
}
|
|
6366
6388
|
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
6367
6389
|
'enableAffectiveDialog',
|
|
@@ -6373,14 +6395,14 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
6373
6395
|
'systemInstruction',
|
|
6374
6396
|
]);
|
|
6375
6397
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
6376
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$
|
|
6398
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
6377
6399
|
}
|
|
6378
6400
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
6379
6401
|
if (parentObject !== undefined && fromTools != null) {
|
|
6380
6402
|
let transformedList = tTools(apiClient, fromTools);
|
|
6381
6403
|
if (Array.isArray(transformedList)) {
|
|
6382
6404
|
transformedList = transformedList.map((item) => {
|
|
6383
|
-
return toolToMldev$
|
|
6405
|
+
return toolToMldev$2(apiClient, tTool(apiClient, item));
|
|
6384
6406
|
});
|
|
6385
6407
|
}
|
|
6386
6408
|
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
@@ -6389,35 +6411,35 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
6389
6411
|
'sessionResumption',
|
|
6390
6412
|
]);
|
|
6391
6413
|
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
6392
|
-
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
6414
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev$1(apiClient, fromSessionResumption));
|
|
6393
6415
|
}
|
|
6394
6416
|
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
6395
6417
|
'inputAudioTranscription',
|
|
6396
6418
|
]);
|
|
6397
6419
|
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
6398
|
-
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
6420
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
6399
6421
|
}
|
|
6400
6422
|
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
6401
6423
|
'outputAudioTranscription',
|
|
6402
6424
|
]);
|
|
6403
6425
|
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
6404
|
-
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
6426
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
6405
6427
|
}
|
|
6406
6428
|
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
6407
6429
|
'realtimeInputConfig',
|
|
6408
6430
|
]);
|
|
6409
6431
|
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
6410
|
-
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
6432
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev$1(apiClient, fromRealtimeInputConfig));
|
|
6411
6433
|
}
|
|
6412
6434
|
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
6413
6435
|
'contextWindowCompression',
|
|
6414
6436
|
]);
|
|
6415
6437
|
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
6416
|
-
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
6438
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev$1(apiClient, fromContextWindowCompression));
|
|
6417
6439
|
}
|
|
6418
6440
|
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
6419
6441
|
if (parentObject !== undefined && fromProactivity != null) {
|
|
6420
|
-
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
6442
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev$1(apiClient, fromProactivity));
|
|
6421
6443
|
}
|
|
6422
6444
|
return toObject;
|
|
6423
6445
|
}
|
|
@@ -6533,7 +6555,7 @@ function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
|
6533
6555
|
}
|
|
6534
6556
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6535
6557
|
if (fromConfig != null) {
|
|
6536
|
-
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
6558
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev$1(apiClient, fromConfig, toObject));
|
|
6537
6559
|
}
|
|
6538
6560
|
return toObject;
|
|
6539
6561
|
}
|
|
@@ -6888,6 +6910,12 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
6888
6910
|
if (fromFileData != null) {
|
|
6889
6911
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
|
|
6890
6912
|
}
|
|
6913
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6914
|
+
'thoughtSignature',
|
|
6915
|
+
]);
|
|
6916
|
+
if (fromThoughtSignature != null) {
|
|
6917
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6918
|
+
}
|
|
6891
6919
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6892
6920
|
'codeExecutionResult',
|
|
6893
6921
|
]);
|
|
@@ -6936,6 +6964,12 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
6936
6964
|
if (fromFileData != null) {
|
|
6937
6965
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
|
|
6938
6966
|
}
|
|
6967
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6968
|
+
'thoughtSignature',
|
|
6969
|
+
]);
|
|
6970
|
+
if (fromThoughtSignature != null) {
|
|
6971
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6972
|
+
}
|
|
6939
6973
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6940
6974
|
'codeExecutionResult',
|
|
6941
6975
|
]);
|
|
@@ -7726,7 +7760,7 @@ function liveMusicServerMessageFromMldev(apiClient, fromObject) {
|
|
|
7726
7760
|
* Copyright 2025 Google LLC
|
|
7727
7761
|
* SPDX-License-Identifier: Apache-2.0
|
|
7728
7762
|
*/
|
|
7729
|
-
function videoMetadataToMldev(apiClient, fromObject) {
|
|
7763
|
+
function videoMetadataToMldev$1(apiClient, fromObject) {
|
|
7730
7764
|
const toObject = {};
|
|
7731
7765
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
7732
7766
|
if (fromFps != null) {
|
|
@@ -7742,7 +7776,7 @@ function videoMetadataToMldev(apiClient, fromObject) {
|
|
|
7742
7776
|
}
|
|
7743
7777
|
return toObject;
|
|
7744
7778
|
}
|
|
7745
|
-
function blobToMldev(apiClient, fromObject) {
|
|
7779
|
+
function blobToMldev$1(apiClient, fromObject) {
|
|
7746
7780
|
const toObject = {};
|
|
7747
7781
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7748
7782
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7757,7 +7791,7 @@ function blobToMldev(apiClient, fromObject) {
|
|
|
7757
7791
|
}
|
|
7758
7792
|
return toObject;
|
|
7759
7793
|
}
|
|
7760
|
-
function fileDataToMldev(apiClient, fromObject) {
|
|
7794
|
+
function fileDataToMldev$1(apiClient, fromObject) {
|
|
7761
7795
|
const toObject = {};
|
|
7762
7796
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7763
7797
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7772,13 +7806,13 @@ function fileDataToMldev(apiClient, fromObject) {
|
|
|
7772
7806
|
}
|
|
7773
7807
|
return toObject;
|
|
7774
7808
|
}
|
|
7775
|
-
function partToMldev(apiClient, fromObject) {
|
|
7809
|
+
function partToMldev$1(apiClient, fromObject) {
|
|
7776
7810
|
const toObject = {};
|
|
7777
7811
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
7778
7812
|
'videoMetadata',
|
|
7779
7813
|
]);
|
|
7780
7814
|
if (fromVideoMetadata != null) {
|
|
7781
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
7815
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$1(apiClient, fromVideoMetadata));
|
|
7782
7816
|
}
|
|
7783
7817
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
7784
7818
|
if (fromThought != null) {
|
|
@@ -7786,11 +7820,17 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7786
7820
|
}
|
|
7787
7821
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7788
7822
|
if (fromInlineData != null) {
|
|
7789
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
7823
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
7790
7824
|
}
|
|
7791
7825
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
7792
7826
|
if (fromFileData != null) {
|
|
7793
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
7827
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
|
|
7828
|
+
}
|
|
7829
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
7830
|
+
'thoughtSignature',
|
|
7831
|
+
]);
|
|
7832
|
+
if (fromThoughtSignature != null) {
|
|
7833
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7794
7834
|
}
|
|
7795
7835
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7796
7836
|
'codeExecutionResult',
|
|
@@ -7820,14 +7860,14 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7820
7860
|
}
|
|
7821
7861
|
return toObject;
|
|
7822
7862
|
}
|
|
7823
|
-
function contentToMldev(apiClient, fromObject) {
|
|
7863
|
+
function contentToMldev$1(apiClient, fromObject) {
|
|
7824
7864
|
const toObject = {};
|
|
7825
7865
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7826
7866
|
if (fromParts != null) {
|
|
7827
7867
|
let transformedList = fromParts;
|
|
7828
7868
|
if (Array.isArray(transformedList)) {
|
|
7829
7869
|
transformedList = transformedList.map((item) => {
|
|
7830
|
-
return partToMldev(apiClient, item);
|
|
7870
|
+
return partToMldev$1(apiClient, item);
|
|
7831
7871
|
});
|
|
7832
7872
|
}
|
|
7833
7873
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -7951,7 +7991,7 @@ function safetySettingToMldev(apiClient, fromObject) {
|
|
|
7951
7991
|
}
|
|
7952
7992
|
return toObject;
|
|
7953
7993
|
}
|
|
7954
|
-
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
7994
|
+
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
7955
7995
|
const toObject = {};
|
|
7956
7996
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
7957
7997
|
if (fromBehavior != null) {
|
|
@@ -7975,7 +8015,7 @@ function functionDeclarationToMldev(apiClient, fromObject) {
|
|
|
7975
8015
|
}
|
|
7976
8016
|
return toObject;
|
|
7977
8017
|
}
|
|
7978
|
-
function intervalToMldev(apiClient, fromObject) {
|
|
8018
|
+
function intervalToMldev$1(apiClient, fromObject) {
|
|
7979
8019
|
const toObject = {};
|
|
7980
8020
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
7981
8021
|
if (fromStartTime != null) {
|
|
@@ -7987,17 +8027,17 @@ function intervalToMldev(apiClient, fromObject) {
|
|
|
7987
8027
|
}
|
|
7988
8028
|
return toObject;
|
|
7989
8029
|
}
|
|
7990
|
-
function googleSearchToMldev(apiClient, fromObject) {
|
|
8030
|
+
function googleSearchToMldev$1(apiClient, fromObject) {
|
|
7991
8031
|
const toObject = {};
|
|
7992
8032
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
7993
8033
|
'timeRangeFilter',
|
|
7994
8034
|
]);
|
|
7995
8035
|
if (fromTimeRangeFilter != null) {
|
|
7996
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
8036
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(apiClient, fromTimeRangeFilter));
|
|
7997
8037
|
}
|
|
7998
8038
|
return toObject;
|
|
7999
8039
|
}
|
|
8000
|
-
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
8040
|
+
function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
8001
8041
|
const toObject = {};
|
|
8002
8042
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
8003
8043
|
if (fromMode != null) {
|
|
@@ -8011,21 +8051,21 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
|
8011
8051
|
}
|
|
8012
8052
|
return toObject;
|
|
8013
8053
|
}
|
|
8014
|
-
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
8054
|
+
function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
8015
8055
|
const toObject = {};
|
|
8016
8056
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
8017
8057
|
'dynamicRetrievalConfig',
|
|
8018
8058
|
]);
|
|
8019
8059
|
if (fromDynamicRetrievalConfig != null) {
|
|
8020
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
8060
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
|
|
8021
8061
|
}
|
|
8022
8062
|
return toObject;
|
|
8023
8063
|
}
|
|
8024
|
-
function urlContextToMldev() {
|
|
8064
|
+
function urlContextToMldev$1() {
|
|
8025
8065
|
const toObject = {};
|
|
8026
8066
|
return toObject;
|
|
8027
8067
|
}
|
|
8028
|
-
function toolToMldev(apiClient, fromObject) {
|
|
8068
|
+
function toolToMldev$1(apiClient, fromObject) {
|
|
8029
8069
|
const toObject = {};
|
|
8030
8070
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
8031
8071
|
'functionDeclarations',
|
|
@@ -8034,7 +8074,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
8034
8074
|
let transformedList = fromFunctionDeclarations;
|
|
8035
8075
|
if (Array.isArray(transformedList)) {
|
|
8036
8076
|
transformedList = transformedList.map((item) => {
|
|
8037
|
-
return functionDeclarationToMldev(apiClient, item);
|
|
8077
|
+
return functionDeclarationToMldev$1(apiClient, item);
|
|
8038
8078
|
});
|
|
8039
8079
|
}
|
|
8040
8080
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -8044,13 +8084,13 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
8044
8084
|
}
|
|
8045
8085
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
8046
8086
|
if (fromGoogleSearch != null) {
|
|
8047
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
8087
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(apiClient, fromGoogleSearch));
|
|
8048
8088
|
}
|
|
8049
8089
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
8050
8090
|
'googleSearchRetrieval',
|
|
8051
8091
|
]);
|
|
8052
8092
|
if (fromGoogleSearchRetrieval != null) {
|
|
8053
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
8093
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
|
|
8054
8094
|
}
|
|
8055
8095
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
8056
8096
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -8060,7 +8100,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
8060
8100
|
}
|
|
8061
8101
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
8062
8102
|
if (fromUrlContext != null) {
|
|
8063
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
8103
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
|
|
8064
8104
|
}
|
|
8065
8105
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8066
8106
|
'codeExecution',
|
|
@@ -8124,7 +8164,7 @@ function toolConfigToMldev(apiClient, fromObject) {
|
|
|
8124
8164
|
}
|
|
8125
8165
|
return toObject;
|
|
8126
8166
|
}
|
|
8127
|
-
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
8167
|
+
function prebuiltVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
8128
8168
|
const toObject = {};
|
|
8129
8169
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
8130
8170
|
if (fromVoiceName != null) {
|
|
@@ -8132,17 +8172,17 @@ function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
8132
8172
|
}
|
|
8133
8173
|
return toObject;
|
|
8134
8174
|
}
|
|
8135
|
-
function voiceConfigToMldev(apiClient, fromObject) {
|
|
8175
|
+
function voiceConfigToMldev$1(apiClient, fromObject) {
|
|
8136
8176
|
const toObject = {};
|
|
8137
8177
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
8138
8178
|
'prebuiltVoiceConfig',
|
|
8139
8179
|
]);
|
|
8140
8180
|
if (fromPrebuiltVoiceConfig != null) {
|
|
8141
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
8181
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$1(apiClient, fromPrebuiltVoiceConfig));
|
|
8142
8182
|
}
|
|
8143
8183
|
return toObject;
|
|
8144
8184
|
}
|
|
8145
|
-
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
8185
|
+
function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
8146
8186
|
const toObject = {};
|
|
8147
8187
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
8148
8188
|
if (fromSpeaker != null) {
|
|
@@ -8150,11 +8190,11 @@ function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
8150
8190
|
}
|
|
8151
8191
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
8152
8192
|
if (fromVoiceConfig != null) {
|
|
8153
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
8193
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
8154
8194
|
}
|
|
8155
8195
|
return toObject;
|
|
8156
8196
|
}
|
|
8157
|
-
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
8197
|
+
function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
8158
8198
|
const toObject = {};
|
|
8159
8199
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
8160
8200
|
'speakerVoiceConfigs',
|
|
@@ -8163,24 +8203,24 @@ function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
8163
8203
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
8164
8204
|
if (Array.isArray(transformedList)) {
|
|
8165
8205
|
transformedList = transformedList.map((item) => {
|
|
8166
|
-
return speakerVoiceConfigToMldev(apiClient, item);
|
|
8206
|
+
return speakerVoiceConfigToMldev$1(apiClient, item);
|
|
8167
8207
|
});
|
|
8168
8208
|
}
|
|
8169
8209
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
8170
8210
|
}
|
|
8171
8211
|
return toObject;
|
|
8172
8212
|
}
|
|
8173
|
-
function speechConfigToMldev(apiClient, fromObject) {
|
|
8213
|
+
function speechConfigToMldev$1(apiClient, fromObject) {
|
|
8174
8214
|
const toObject = {};
|
|
8175
8215
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
8176
8216
|
if (fromVoiceConfig != null) {
|
|
8177
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
8217
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
8178
8218
|
}
|
|
8179
8219
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
8180
8220
|
'multiSpeakerVoiceConfig',
|
|
8181
8221
|
]);
|
|
8182
8222
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
8183
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
8223
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$1(apiClient, fromMultiSpeakerVoiceConfig));
|
|
8184
8224
|
}
|
|
8185
8225
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
8186
8226
|
if (fromLanguageCode != null) {
|
|
@@ -8210,7 +8250,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8210
8250
|
'systemInstruction',
|
|
8211
8251
|
]);
|
|
8212
8252
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
8213
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
8253
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
8214
8254
|
}
|
|
8215
8255
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
8216
8256
|
if (fromTemperature != null) {
|
|
@@ -8303,7 +8343,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8303
8343
|
let transformedList = tTools(apiClient, fromTools);
|
|
8304
8344
|
if (Array.isArray(transformedList)) {
|
|
8305
8345
|
transformedList = transformedList.map((item) => {
|
|
8306
|
-
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
8346
|
+
return toolToMldev$1(apiClient, tTool(apiClient, item));
|
|
8307
8347
|
});
|
|
8308
8348
|
}
|
|
8309
8349
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -8335,7 +8375,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8335
8375
|
}
|
|
8336
8376
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
8337
8377
|
if (fromSpeechConfig != null) {
|
|
8338
|
-
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
8378
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$1(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
8339
8379
|
}
|
|
8340
8380
|
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
8341
8381
|
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
@@ -8359,7 +8399,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
|
|
|
8359
8399
|
let transformedList = tContents(apiClient, fromContents);
|
|
8360
8400
|
if (Array.isArray(transformedList)) {
|
|
8361
8401
|
transformedList = transformedList.map((item) => {
|
|
8362
|
-
return contentToMldev(apiClient, item);
|
|
8402
|
+
return contentToMldev$1(apiClient, item);
|
|
8363
8403
|
});
|
|
8364
8404
|
}
|
|
8365
8405
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8611,7 +8651,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
|
|
|
8611
8651
|
let transformedList = tContents(apiClient, fromContents);
|
|
8612
8652
|
if (Array.isArray(transformedList)) {
|
|
8613
8653
|
transformedList = transformedList.map((item) => {
|
|
8614
|
-
return contentToMldev(apiClient, item);
|
|
8654
|
+
return contentToMldev$1(apiClient, item);
|
|
8615
8655
|
});
|
|
8616
8656
|
}
|
|
8617
8657
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8778,6 +8818,12 @@ function partToVertex(apiClient, fromObject) {
|
|
|
8778
8818
|
if (fromFileData != null) {
|
|
8779
8819
|
setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
|
|
8780
8820
|
}
|
|
8821
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
8822
|
+
'thoughtSignature',
|
|
8823
|
+
]);
|
|
8824
|
+
if (fromThoughtSignature != null) {
|
|
8825
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8826
|
+
}
|
|
8781
8827
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8782
8828
|
'codeExecutionResult',
|
|
8783
8829
|
]);
|
|
@@ -10115,6 +10161,12 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
10115
10161
|
if (fromFileData != null) {
|
|
10116
10162
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
|
|
10117
10163
|
}
|
|
10164
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
10165
|
+
'thoughtSignature',
|
|
10166
|
+
]);
|
|
10167
|
+
if (fromThoughtSignature != null) {
|
|
10168
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10169
|
+
}
|
|
10118
10170
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10119
10171
|
'codeExecutionResult',
|
|
10120
10172
|
]);
|
|
@@ -10633,6 +10685,12 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
10633
10685
|
if (fromFileData != null) {
|
|
10634
10686
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
|
|
10635
10687
|
}
|
|
10688
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
10689
|
+
'thoughtSignature',
|
|
10690
|
+
]);
|
|
10691
|
+
if (fromThoughtSignature != null) {
|
|
10692
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10693
|
+
}
|
|
10636
10694
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10637
10695
|
'codeExecutionResult',
|
|
10638
10696
|
]);
|
|
@@ -11205,11 +11263,9 @@ function hasNonMcpTools(params) {
|
|
|
11205
11263
|
}
|
|
11206
11264
|
// Returns true if the object is a MCP CallableTool, otherwise false.
|
|
11207
11265
|
function isMcpCallableTool(object) {
|
|
11208
|
-
// TODO: b/418266406 - Add a more robust check for the MCP CallableTool.
|
|
11209
11266
|
return (object !== null &&
|
|
11210
11267
|
typeof object === 'object' &&
|
|
11211
|
-
|
|
11212
|
-
'callTool' in object);
|
|
11268
|
+
object instanceof McpCallableTool);
|
|
11213
11269
|
}
|
|
11214
11270
|
// List all tools from the MCP client.
|
|
11215
11271
|
function listAllTools(mcpClient, maxTools = 100) {
|
|
@@ -11689,7 +11745,14 @@ class Live {
|
|
|
11689
11745
|
}
|
|
11690
11746
|
else {
|
|
11691
11747
|
const apiKey = this.apiClient.getApiKey();
|
|
11692
|
-
|
|
11748
|
+
let method = 'BidiGenerateContent';
|
|
11749
|
+
let keyName = 'key';
|
|
11750
|
+
if (apiKey === null || apiKey === void 0 ? void 0 : apiKey.startsWith('auth_tokens/')) {
|
|
11751
|
+
console.warn('Warning: Ephemeral token support is experimental and may change in future versions.');
|
|
11752
|
+
method = 'BidiGenerateContentConstrained';
|
|
11753
|
+
keyName = 'access_token';
|
|
11754
|
+
}
|
|
11755
|
+
url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.${method}?${keyName}=${apiKey}`;
|
|
11693
11756
|
}
|
|
11694
11757
|
let onopenResolve = () => { };
|
|
11695
11758
|
const onopenPromise = new Promise((resolve) => {
|
|
@@ -11795,7 +11858,7 @@ class Session {
|
|
|
11795
11858
|
contents = contents.map((item) => contentToVertex(apiClient, item));
|
|
11796
11859
|
}
|
|
11797
11860
|
else {
|
|
11798
|
-
contents = contents.map((item) => contentToMldev(apiClient, item));
|
|
11861
|
+
contents = contents.map((item) => contentToMldev$1(apiClient, item));
|
|
11799
11862
|
}
|
|
11800
11863
|
}
|
|
11801
11864
|
catch (_a) {
|
|
@@ -12093,7 +12156,6 @@ class Models extends BaseModule {
|
|
|
12093
12156
|
if (!hasMcpClientTools(params) || shouldDisableAfc(params.config)) {
|
|
12094
12157
|
return await this.generateContentInternal(transformedParams);
|
|
12095
12158
|
}
|
|
12096
|
-
// TODO: b/418266406 - Improve the check for CallableTools and Tools.
|
|
12097
12159
|
if (hasNonMcpTools(params)) {
|
|
12098
12160
|
throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
|
|
12099
12161
|
}
|
|
@@ -13648,75 +13710,910 @@ class Operations extends BaseModule {
|
|
|
13648
13710
|
* Copyright 2025 Google LLC
|
|
13649
13711
|
* SPDX-License-Identifier: Apache-2.0
|
|
13650
13712
|
*/
|
|
13651
|
-
function
|
|
13652
|
-
const toObject = {};
|
|
13653
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
13654
|
-
if (fromName != null) {
|
|
13655
|
-
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
13656
|
-
}
|
|
13657
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
13658
|
-
if (fromConfig != null) {
|
|
13659
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
13660
|
-
}
|
|
13661
|
-
return toObject;
|
|
13662
|
-
}
|
|
13663
|
-
function listTuningJobsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
13713
|
+
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
13664
13714
|
const toObject = {};
|
|
13665
|
-
const
|
|
13666
|
-
if (
|
|
13667
|
-
setValueByPath(
|
|
13668
|
-
}
|
|
13669
|
-
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
13670
|
-
if (parentObject !== undefined && fromPageToken != null) {
|
|
13671
|
-
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
13672
|
-
}
|
|
13673
|
-
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
13674
|
-
if (parentObject !== undefined && fromFilter != null) {
|
|
13675
|
-
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
13715
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
13716
|
+
if (fromVoiceName != null) {
|
|
13717
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
13676
13718
|
}
|
|
13677
13719
|
return toObject;
|
|
13678
13720
|
}
|
|
13679
|
-
function
|
|
13721
|
+
function voiceConfigToMldev(apiClient, fromObject) {
|
|
13680
13722
|
const toObject = {};
|
|
13681
|
-
const
|
|
13682
|
-
|
|
13683
|
-
|
|
13723
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
13724
|
+
'prebuiltVoiceConfig',
|
|
13725
|
+
]);
|
|
13726
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
13727
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
13684
13728
|
}
|
|
13685
13729
|
return toObject;
|
|
13686
13730
|
}
|
|
13687
|
-
function
|
|
13731
|
+
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13688
13732
|
const toObject = {};
|
|
13689
|
-
const
|
|
13690
|
-
if (
|
|
13691
|
-
setValueByPath(toObject, ['
|
|
13733
|
+
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
13734
|
+
if (fromSpeaker != null) {
|
|
13735
|
+
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
13692
13736
|
}
|
|
13693
|
-
const
|
|
13694
|
-
if (
|
|
13695
|
-
setValueByPath(toObject, ['
|
|
13737
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13738
|
+
if (fromVoiceConfig != null) {
|
|
13739
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13696
13740
|
}
|
|
13697
13741
|
return toObject;
|
|
13698
13742
|
}
|
|
13699
|
-
function
|
|
13743
|
+
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13700
13744
|
const toObject = {};
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
let transformedList = fromExamples;
|
|
13745
|
+
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
13746
|
+
'speakerVoiceConfigs',
|
|
13747
|
+
]);
|
|
13748
|
+
if (fromSpeakerVoiceConfigs != null) {
|
|
13749
|
+
let transformedList = fromSpeakerVoiceConfigs;
|
|
13707
13750
|
if (Array.isArray(transformedList)) {
|
|
13708
13751
|
transformedList = transformedList.map((item) => {
|
|
13709
|
-
return
|
|
13752
|
+
return speakerVoiceConfigToMldev(apiClient, item);
|
|
13710
13753
|
});
|
|
13711
13754
|
}
|
|
13712
|
-
setValueByPath(toObject, ['
|
|
13755
|
+
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
13713
13756
|
}
|
|
13714
13757
|
return toObject;
|
|
13715
13758
|
}
|
|
13716
|
-
function
|
|
13759
|
+
function speechConfigToMldev(apiClient, fromObject) {
|
|
13717
13760
|
const toObject = {};
|
|
13718
|
-
|
|
13719
|
-
|
|
13761
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13762
|
+
if (fromVoiceConfig != null) {
|
|
13763
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13764
|
+
}
|
|
13765
|
+
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
13766
|
+
'multiSpeakerVoiceConfig',
|
|
13767
|
+
]);
|
|
13768
|
+
if (fromMultiSpeakerVoiceConfig != null) {
|
|
13769
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
13770
|
+
}
|
|
13771
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
13772
|
+
if (fromLanguageCode != null) {
|
|
13773
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
13774
|
+
}
|
|
13775
|
+
return toObject;
|
|
13776
|
+
}
|
|
13777
|
+
function videoMetadataToMldev(apiClient, fromObject) {
|
|
13778
|
+
const toObject = {};
|
|
13779
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
13780
|
+
if (fromFps != null) {
|
|
13781
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
13782
|
+
}
|
|
13783
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
13784
|
+
if (fromEndOffset != null) {
|
|
13785
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
13786
|
+
}
|
|
13787
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
13788
|
+
if (fromStartOffset != null) {
|
|
13789
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
13790
|
+
}
|
|
13791
|
+
return toObject;
|
|
13792
|
+
}
|
|
13793
|
+
function blobToMldev(apiClient, fromObject) {
|
|
13794
|
+
const toObject = {};
|
|
13795
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13796
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13797
|
+
}
|
|
13798
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
13799
|
+
if (fromData != null) {
|
|
13800
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
13801
|
+
}
|
|
13802
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13803
|
+
if (fromMimeType != null) {
|
|
13804
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13805
|
+
}
|
|
13806
|
+
return toObject;
|
|
13807
|
+
}
|
|
13808
|
+
function fileDataToMldev(apiClient, fromObject) {
|
|
13809
|
+
const toObject = {};
|
|
13810
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13811
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13812
|
+
}
|
|
13813
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
13814
|
+
if (fromFileUri != null) {
|
|
13815
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
13816
|
+
}
|
|
13817
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13818
|
+
if (fromMimeType != null) {
|
|
13819
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13820
|
+
}
|
|
13821
|
+
return toObject;
|
|
13822
|
+
}
|
|
13823
|
+
function partToMldev(apiClient, fromObject) {
|
|
13824
|
+
const toObject = {};
|
|
13825
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
13826
|
+
'videoMetadata',
|
|
13827
|
+
]);
|
|
13828
|
+
if (fromVideoMetadata != null) {
|
|
13829
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
13830
|
+
}
|
|
13831
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
13832
|
+
if (fromThought != null) {
|
|
13833
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
13834
|
+
}
|
|
13835
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
13836
|
+
if (fromInlineData != null) {
|
|
13837
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
13838
|
+
}
|
|
13839
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
13840
|
+
if (fromFileData != null) {
|
|
13841
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
13842
|
+
}
|
|
13843
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
13844
|
+
'thoughtSignature',
|
|
13845
|
+
]);
|
|
13846
|
+
if (fromThoughtSignature != null) {
|
|
13847
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13848
|
+
}
|
|
13849
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13850
|
+
'codeExecutionResult',
|
|
13851
|
+
]);
|
|
13852
|
+
if (fromCodeExecutionResult != null) {
|
|
13853
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
13854
|
+
}
|
|
13855
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
13856
|
+
'executableCode',
|
|
13857
|
+
]);
|
|
13858
|
+
if (fromExecutableCode != null) {
|
|
13859
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13860
|
+
}
|
|
13861
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13862
|
+
if (fromFunctionCall != null) {
|
|
13863
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13864
|
+
}
|
|
13865
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13866
|
+
'functionResponse',
|
|
13867
|
+
]);
|
|
13868
|
+
if (fromFunctionResponse != null) {
|
|
13869
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
13870
|
+
}
|
|
13871
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
13872
|
+
if (fromText != null) {
|
|
13873
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
13874
|
+
}
|
|
13875
|
+
return toObject;
|
|
13876
|
+
}
|
|
13877
|
+
function contentToMldev(apiClient, fromObject) {
|
|
13878
|
+
const toObject = {};
|
|
13879
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13880
|
+
if (fromParts != null) {
|
|
13881
|
+
let transformedList = fromParts;
|
|
13882
|
+
if (Array.isArray(transformedList)) {
|
|
13883
|
+
transformedList = transformedList.map((item) => {
|
|
13884
|
+
return partToMldev(apiClient, item);
|
|
13885
|
+
});
|
|
13886
|
+
}
|
|
13887
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
13888
|
+
}
|
|
13889
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
13890
|
+
if (fromRole != null) {
|
|
13891
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
13892
|
+
}
|
|
13893
|
+
return toObject;
|
|
13894
|
+
}
|
|
13895
|
+
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
13896
|
+
const toObject = {};
|
|
13897
|
+
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
13898
|
+
if (fromBehavior != null) {
|
|
13899
|
+
setValueByPath(toObject, ['behavior'], fromBehavior);
|
|
13900
|
+
}
|
|
13901
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
13902
|
+
if (fromDescription != null) {
|
|
13903
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
13904
|
+
}
|
|
13905
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13906
|
+
if (fromName != null) {
|
|
13907
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13908
|
+
}
|
|
13909
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
13910
|
+
if (fromParameters != null) {
|
|
13911
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
13912
|
+
}
|
|
13913
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
13914
|
+
if (fromResponse != null) {
|
|
13915
|
+
setValueByPath(toObject, ['response'], fromResponse);
|
|
13916
|
+
}
|
|
13917
|
+
return toObject;
|
|
13918
|
+
}
|
|
13919
|
+
function intervalToMldev(apiClient, fromObject) {
|
|
13920
|
+
const toObject = {};
|
|
13921
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
13922
|
+
if (fromStartTime != null) {
|
|
13923
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
13924
|
+
}
|
|
13925
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
13926
|
+
if (fromEndTime != null) {
|
|
13927
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
13928
|
+
}
|
|
13929
|
+
return toObject;
|
|
13930
|
+
}
|
|
13931
|
+
function googleSearchToMldev(apiClient, fromObject) {
|
|
13932
|
+
const toObject = {};
|
|
13933
|
+
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
13934
|
+
'timeRangeFilter',
|
|
13935
|
+
]);
|
|
13936
|
+
if (fromTimeRangeFilter != null) {
|
|
13937
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
13938
|
+
}
|
|
13939
|
+
return toObject;
|
|
13940
|
+
}
|
|
13941
|
+
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
13942
|
+
const toObject = {};
|
|
13943
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
13944
|
+
if (fromMode != null) {
|
|
13945
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
13946
|
+
}
|
|
13947
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
13948
|
+
'dynamicThreshold',
|
|
13949
|
+
]);
|
|
13950
|
+
if (fromDynamicThreshold != null) {
|
|
13951
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
13952
|
+
}
|
|
13953
|
+
return toObject;
|
|
13954
|
+
}
|
|
13955
|
+
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
13956
|
+
const toObject = {};
|
|
13957
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
13958
|
+
'dynamicRetrievalConfig',
|
|
13959
|
+
]);
|
|
13960
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
13961
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
13962
|
+
}
|
|
13963
|
+
return toObject;
|
|
13964
|
+
}
|
|
13965
|
+
function urlContextToMldev() {
|
|
13966
|
+
const toObject = {};
|
|
13967
|
+
return toObject;
|
|
13968
|
+
}
|
|
13969
|
+
function toolToMldev(apiClient, fromObject) {
|
|
13970
|
+
const toObject = {};
|
|
13971
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
13972
|
+
'functionDeclarations',
|
|
13973
|
+
]);
|
|
13974
|
+
if (fromFunctionDeclarations != null) {
|
|
13975
|
+
let transformedList = fromFunctionDeclarations;
|
|
13976
|
+
if (Array.isArray(transformedList)) {
|
|
13977
|
+
transformedList = transformedList.map((item) => {
|
|
13978
|
+
return functionDeclarationToMldev(apiClient, item);
|
|
13979
|
+
});
|
|
13980
|
+
}
|
|
13981
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
13982
|
+
}
|
|
13983
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
13984
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
13985
|
+
}
|
|
13986
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
13987
|
+
if (fromGoogleSearch != null) {
|
|
13988
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
13989
|
+
}
|
|
13990
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
13991
|
+
'googleSearchRetrieval',
|
|
13992
|
+
]);
|
|
13993
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
13994
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
13995
|
+
}
|
|
13996
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
13997
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
13998
|
+
}
|
|
13999
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
14000
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
14001
|
+
}
|
|
14002
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
14003
|
+
if (fromUrlContext != null) {
|
|
14004
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
14005
|
+
}
|
|
14006
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
14007
|
+
'codeExecution',
|
|
14008
|
+
]);
|
|
14009
|
+
if (fromCodeExecution != null) {
|
|
14010
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
14011
|
+
}
|
|
14012
|
+
return toObject;
|
|
14013
|
+
}
|
|
14014
|
+
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
14015
|
+
const toObject = {};
|
|
14016
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
14017
|
+
if (fromHandle != null) {
|
|
14018
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
14019
|
+
}
|
|
14020
|
+
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
14021
|
+
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
14022
|
+
}
|
|
14023
|
+
return toObject;
|
|
14024
|
+
}
|
|
14025
|
+
function audioTranscriptionConfigToMldev() {
|
|
14026
|
+
const toObject = {};
|
|
14027
|
+
return toObject;
|
|
14028
|
+
}
|
|
14029
|
+
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
14030
|
+
const toObject = {};
|
|
14031
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
14032
|
+
if (fromDisabled != null) {
|
|
14033
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
14034
|
+
}
|
|
14035
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
14036
|
+
'startOfSpeechSensitivity',
|
|
14037
|
+
]);
|
|
14038
|
+
if (fromStartOfSpeechSensitivity != null) {
|
|
14039
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
14040
|
+
}
|
|
14041
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
14042
|
+
'endOfSpeechSensitivity',
|
|
14043
|
+
]);
|
|
14044
|
+
if (fromEndOfSpeechSensitivity != null) {
|
|
14045
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
14046
|
+
}
|
|
14047
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
14048
|
+
'prefixPaddingMs',
|
|
14049
|
+
]);
|
|
14050
|
+
if (fromPrefixPaddingMs != null) {
|
|
14051
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
14052
|
+
}
|
|
14053
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
14054
|
+
'silenceDurationMs',
|
|
14055
|
+
]);
|
|
14056
|
+
if (fromSilenceDurationMs != null) {
|
|
14057
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
14058
|
+
}
|
|
14059
|
+
return toObject;
|
|
14060
|
+
}
|
|
14061
|
+
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
14062
|
+
const toObject = {};
|
|
14063
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
14064
|
+
'automaticActivityDetection',
|
|
14065
|
+
]);
|
|
14066
|
+
if (fromAutomaticActivityDetection != null) {
|
|
14067
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
14068
|
+
}
|
|
14069
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
14070
|
+
'activityHandling',
|
|
14071
|
+
]);
|
|
14072
|
+
if (fromActivityHandling != null) {
|
|
14073
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
14074
|
+
}
|
|
14075
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
14076
|
+
if (fromTurnCoverage != null) {
|
|
14077
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
14078
|
+
}
|
|
14079
|
+
return toObject;
|
|
14080
|
+
}
|
|
14081
|
+
function slidingWindowToMldev(apiClient, fromObject) {
|
|
14082
|
+
const toObject = {};
|
|
14083
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
14084
|
+
if (fromTargetTokens != null) {
|
|
14085
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
14086
|
+
}
|
|
14087
|
+
return toObject;
|
|
14088
|
+
}
|
|
14089
|
+
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
14090
|
+
const toObject = {};
|
|
14091
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
14092
|
+
'triggerTokens',
|
|
14093
|
+
]);
|
|
14094
|
+
if (fromTriggerTokens != null) {
|
|
14095
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
14096
|
+
}
|
|
14097
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
14098
|
+
'slidingWindow',
|
|
14099
|
+
]);
|
|
14100
|
+
if (fromSlidingWindow != null) {
|
|
14101
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
14102
|
+
}
|
|
14103
|
+
return toObject;
|
|
14104
|
+
}
|
|
14105
|
+
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
14106
|
+
const toObject = {};
|
|
14107
|
+
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
14108
|
+
'proactiveAudio',
|
|
14109
|
+
]);
|
|
14110
|
+
if (fromProactiveAudio != null) {
|
|
14111
|
+
setValueByPath(toObject, ['proactiveAudio'], fromProactiveAudio);
|
|
14112
|
+
}
|
|
14113
|
+
return toObject;
|
|
14114
|
+
}
|
|
14115
|
+
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14116
|
+
const toObject = {};
|
|
14117
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
14118
|
+
'generationConfig',
|
|
14119
|
+
]);
|
|
14120
|
+
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
14121
|
+
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
14122
|
+
}
|
|
14123
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
14124
|
+
'responseModalities',
|
|
14125
|
+
]);
|
|
14126
|
+
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
14127
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
14128
|
+
}
|
|
14129
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
14130
|
+
if (parentObject !== undefined && fromTemperature != null) {
|
|
14131
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
14132
|
+
}
|
|
14133
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
14134
|
+
if (parentObject !== undefined && fromTopP != null) {
|
|
14135
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
14136
|
+
}
|
|
14137
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
14138
|
+
if (parentObject !== undefined && fromTopK != null) {
|
|
14139
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
14140
|
+
}
|
|
14141
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
14142
|
+
'maxOutputTokens',
|
|
14143
|
+
]);
|
|
14144
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
14145
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
14146
|
+
}
|
|
14147
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14148
|
+
'mediaResolution',
|
|
14149
|
+
]);
|
|
14150
|
+
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
14151
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
14152
|
+
}
|
|
14153
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
14154
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
14155
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
14156
|
+
}
|
|
14157
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
14158
|
+
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
14159
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
14160
|
+
}
|
|
14161
|
+
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
14162
|
+
'enableAffectiveDialog',
|
|
14163
|
+
]);
|
|
14164
|
+
if (parentObject !== undefined && fromEnableAffectiveDialog != null) {
|
|
14165
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'enableAffectiveDialog'], fromEnableAffectiveDialog);
|
|
14166
|
+
}
|
|
14167
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
14168
|
+
'systemInstruction',
|
|
14169
|
+
]);
|
|
14170
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
14171
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
14172
|
+
}
|
|
14173
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
14174
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
14175
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
14176
|
+
if (Array.isArray(transformedList)) {
|
|
14177
|
+
transformedList = transformedList.map((item) => {
|
|
14178
|
+
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
14179
|
+
});
|
|
14180
|
+
}
|
|
14181
|
+
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
14182
|
+
}
|
|
14183
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
14184
|
+
'sessionResumption',
|
|
14185
|
+
]);
|
|
14186
|
+
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
14187
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
14188
|
+
}
|
|
14189
|
+
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
14190
|
+
'inputAudioTranscription',
|
|
14191
|
+
]);
|
|
14192
|
+
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
14193
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14194
|
+
}
|
|
14195
|
+
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
14196
|
+
'outputAudioTranscription',
|
|
14197
|
+
]);
|
|
14198
|
+
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
14199
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14200
|
+
}
|
|
14201
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
14202
|
+
'realtimeInputConfig',
|
|
14203
|
+
]);
|
|
14204
|
+
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
14205
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
14206
|
+
}
|
|
14207
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
14208
|
+
'contextWindowCompression',
|
|
14209
|
+
]);
|
|
14210
|
+
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
14211
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
14212
|
+
}
|
|
14213
|
+
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
14214
|
+
if (parentObject !== undefined && fromProactivity != null) {
|
|
14215
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
14216
|
+
}
|
|
14217
|
+
return toObject;
|
|
14218
|
+
}
|
|
14219
|
+
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
14220
|
+
const toObject = {};
|
|
14221
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
14222
|
+
if (fromModel != null) {
|
|
14223
|
+
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
14224
|
+
}
|
|
14225
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14226
|
+
if (fromConfig != null) {
|
|
14227
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
14228
|
+
}
|
|
14229
|
+
return toObject;
|
|
14230
|
+
}
|
|
14231
|
+
function createAuthTokenConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14232
|
+
const toObject = {};
|
|
14233
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
14234
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
14235
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
14236
|
+
}
|
|
14237
|
+
const fromNewSessionExpireTime = getValueByPath(fromObject, [
|
|
14238
|
+
'newSessionExpireTime',
|
|
14239
|
+
]);
|
|
14240
|
+
if (parentObject !== undefined && fromNewSessionExpireTime != null) {
|
|
14241
|
+
setValueByPath(parentObject, ['newSessionExpireTime'], fromNewSessionExpireTime);
|
|
14242
|
+
}
|
|
14243
|
+
const fromUses = getValueByPath(fromObject, ['uses']);
|
|
14244
|
+
if (parentObject !== undefined && fromUses != null) {
|
|
14245
|
+
setValueByPath(parentObject, ['uses'], fromUses);
|
|
14246
|
+
}
|
|
14247
|
+
const fromLiveConnectConstraints = getValueByPath(fromObject, [
|
|
14248
|
+
'liveConnectConstraints',
|
|
14249
|
+
]);
|
|
14250
|
+
if (parentObject !== undefined && fromLiveConnectConstraints != null) {
|
|
14251
|
+
setValueByPath(parentObject, ['bidiGenerateContentSetup'], liveConnectConstraintsToMldev(apiClient, fromLiveConnectConstraints));
|
|
14252
|
+
}
|
|
14253
|
+
const fromLockAdditionalFields = getValueByPath(fromObject, [
|
|
14254
|
+
'lockAdditionalFields',
|
|
14255
|
+
]);
|
|
14256
|
+
if (parentObject !== undefined && fromLockAdditionalFields != null) {
|
|
14257
|
+
setValueByPath(parentObject, ['fieldMask'], fromLockAdditionalFields);
|
|
14258
|
+
}
|
|
14259
|
+
return toObject;
|
|
14260
|
+
}
|
|
14261
|
+
function createAuthTokenParametersToMldev(apiClient, fromObject) {
|
|
14262
|
+
const toObject = {};
|
|
14263
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14264
|
+
if (fromConfig != null) {
|
|
14265
|
+
setValueByPath(toObject, ['config'], createAuthTokenConfigToMldev(apiClient, fromConfig, toObject));
|
|
14266
|
+
}
|
|
14267
|
+
return toObject;
|
|
14268
|
+
}
|
|
14269
|
+
function authTokenFromMldev(apiClient, fromObject) {
|
|
14270
|
+
const toObject = {};
|
|
14271
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14272
|
+
if (fromName != null) {
|
|
14273
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14274
|
+
}
|
|
14275
|
+
return toObject;
|
|
14276
|
+
}
|
|
14277
|
+
|
|
14278
|
+
/**
|
|
14279
|
+
* @license
|
|
14280
|
+
* Copyright 2025 Google LLC
|
|
14281
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14282
|
+
*/
|
|
14283
|
+
/**
|
|
14284
|
+
* Returns a comma-separated list of field masks from a given object.
|
|
14285
|
+
*
|
|
14286
|
+
* @param setup The object to extract field masks from.
|
|
14287
|
+
* @return A comma-separated list of field masks.
|
|
14288
|
+
*/
|
|
14289
|
+
function getFieldMasks(setup) {
|
|
14290
|
+
const fields = [];
|
|
14291
|
+
for (const key in setup) {
|
|
14292
|
+
if (Object.prototype.hasOwnProperty.call(setup, key)) {
|
|
14293
|
+
const value = setup[key];
|
|
14294
|
+
// 2nd layer, recursively get field masks see TODO(b/418290100)
|
|
14295
|
+
if (typeof value === 'object' &&
|
|
14296
|
+
value != null &&
|
|
14297
|
+
Object.keys(value).length > 0) {
|
|
14298
|
+
const field = Object.keys(value).map((kk) => `${key}.${kk}`);
|
|
14299
|
+
fields.push(...field);
|
|
14300
|
+
}
|
|
14301
|
+
else {
|
|
14302
|
+
fields.push(key); // 1st layer
|
|
14303
|
+
}
|
|
14304
|
+
}
|
|
14305
|
+
}
|
|
14306
|
+
return fields.join(',');
|
|
14307
|
+
}
|
|
14308
|
+
/**
|
|
14309
|
+
* Converts bidiGenerateContentSetup.
|
|
14310
|
+
* @param requestDict - The request dictionary.
|
|
14311
|
+
* @param config - The configuration object.
|
|
14312
|
+
* @return - The modified request dictionary.
|
|
14313
|
+
*/
|
|
14314
|
+
function convertBidiSetupToTokenSetup(requestDict, config) {
|
|
14315
|
+
// Convert bidiGenerateContentSetup from bidiGenerateContentSetup.setup.
|
|
14316
|
+
let setupForMaskGeneration = null;
|
|
14317
|
+
const bidiGenerateContentSetupValue = requestDict['bidiGenerateContentSetup'];
|
|
14318
|
+
if (typeof bidiGenerateContentSetupValue === 'object' &&
|
|
14319
|
+
bidiGenerateContentSetupValue !== null &&
|
|
14320
|
+
'setup' in bidiGenerateContentSetupValue) {
|
|
14321
|
+
// Now we know bidiGenerateContentSetupValue is an object and has a 'setup'
|
|
14322
|
+
// property.
|
|
14323
|
+
const innerSetup = bidiGenerateContentSetupValue
|
|
14324
|
+
.setup;
|
|
14325
|
+
if (typeof innerSetup === 'object' && innerSetup !== null) {
|
|
14326
|
+
// Valid inner setup found.
|
|
14327
|
+
requestDict['bidiGenerateContentSetup'] = innerSetup;
|
|
14328
|
+
setupForMaskGeneration = innerSetup;
|
|
14329
|
+
}
|
|
14330
|
+
else {
|
|
14331
|
+
// `bidiGenerateContentSetupValue.setup` is not a valid object; treat as
|
|
14332
|
+
// if bidiGenerateContentSetup is invalid.
|
|
14333
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14334
|
+
}
|
|
14335
|
+
}
|
|
14336
|
+
else if (bidiGenerateContentSetupValue !== undefined) {
|
|
14337
|
+
// `bidiGenerateContentSetup` exists but not in the expected
|
|
14338
|
+
// shape {setup: {...}}; treat as invalid.
|
|
14339
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14340
|
+
}
|
|
14341
|
+
const preExistingFieldMask = requestDict['fieldMask'];
|
|
14342
|
+
// Handle mask generation setup.
|
|
14343
|
+
if (setupForMaskGeneration) {
|
|
14344
|
+
const generatedMaskFromBidi = getFieldMasks(setupForMaskGeneration);
|
|
14345
|
+
if (Array.isArray(config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14346
|
+
(config === null || config === void 0 ? void 0 : config.lockAdditionalFields.length) === 0) {
|
|
14347
|
+
// Case 1: lockAdditionalFields is an empty array. Lock only fields from
|
|
14348
|
+
// bidi setup.
|
|
14349
|
+
if (generatedMaskFromBidi) {
|
|
14350
|
+
// Only assign if mask is not empty
|
|
14351
|
+
requestDict['fieldMask'] = generatedMaskFromBidi;
|
|
14352
|
+
}
|
|
14353
|
+
else {
|
|
14354
|
+
delete requestDict['fieldMask']; // If mask is empty, effectively no
|
|
14355
|
+
// specific fields locked by bidi
|
|
14356
|
+
}
|
|
14357
|
+
}
|
|
14358
|
+
else if ((config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14359
|
+
config.lockAdditionalFields.length > 0 &&
|
|
14360
|
+
preExistingFieldMask !== null &&
|
|
14361
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14362
|
+
preExistingFieldMask.length > 0) {
|
|
14363
|
+
// Case 2: Lock fields from bidi setup + additional fields
|
|
14364
|
+
// (preExistingFieldMask).
|
|
14365
|
+
const generationConfigFields = [
|
|
14366
|
+
'temperature',
|
|
14367
|
+
'topK',
|
|
14368
|
+
'topP',
|
|
14369
|
+
'maxOutputTokens',
|
|
14370
|
+
'responseModalities',
|
|
14371
|
+
'seed',
|
|
14372
|
+
'speechConfig',
|
|
14373
|
+
];
|
|
14374
|
+
let mappedFieldsFromPreExisting = [];
|
|
14375
|
+
if (preExistingFieldMask.length > 0) {
|
|
14376
|
+
mappedFieldsFromPreExisting = preExistingFieldMask.map((field) => {
|
|
14377
|
+
if (generationConfigFields.includes(field)) {
|
|
14378
|
+
return `generationConfig.${field}`;
|
|
14379
|
+
}
|
|
14380
|
+
return field; // Keep original field name if not in
|
|
14381
|
+
// generationConfigFields
|
|
14382
|
+
});
|
|
14383
|
+
}
|
|
14384
|
+
const finalMaskParts = [];
|
|
14385
|
+
if (generatedMaskFromBidi) {
|
|
14386
|
+
finalMaskParts.push(generatedMaskFromBidi);
|
|
14387
|
+
}
|
|
14388
|
+
if (mappedFieldsFromPreExisting.length > 0) {
|
|
14389
|
+
finalMaskParts.push(...mappedFieldsFromPreExisting);
|
|
14390
|
+
}
|
|
14391
|
+
if (finalMaskParts.length > 0) {
|
|
14392
|
+
requestDict['fieldMask'] = finalMaskParts.join(',');
|
|
14393
|
+
}
|
|
14394
|
+
else {
|
|
14395
|
+
// If no fields from bidi and no valid additional fields from
|
|
14396
|
+
// pre-existing mask.
|
|
14397
|
+
delete requestDict['fieldMask'];
|
|
14398
|
+
}
|
|
14399
|
+
}
|
|
14400
|
+
else {
|
|
14401
|
+
// Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
|
|
14402
|
+
// defaults apply or all are mutable). This is hit if:
|
|
14403
|
+
// - `config.lockAdditionalFields` is undefined.
|
|
14404
|
+
// - `config.lockAdditionalFields` is non-empty, BUT
|
|
14405
|
+
// `preExistingFieldMask` is null, not a string, or an empty string.
|
|
14406
|
+
delete requestDict['fieldMask'];
|
|
14407
|
+
}
|
|
14408
|
+
}
|
|
14409
|
+
else {
|
|
14410
|
+
// No valid `bidiGenerateContentSetup` was found or extracted.
|
|
14411
|
+
// "Lock additional null fields if any".
|
|
14412
|
+
if (preExistingFieldMask !== null &&
|
|
14413
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14414
|
+
preExistingFieldMask.length > 0) {
|
|
14415
|
+
// If there's a pre-existing field mask, it's a string, and it's not
|
|
14416
|
+
// empty, then we should lock all fields.
|
|
14417
|
+
requestDict['fieldMask'] = preExistingFieldMask.join(',');
|
|
14418
|
+
}
|
|
14419
|
+
else {
|
|
14420
|
+
delete requestDict['fieldMask'];
|
|
14421
|
+
}
|
|
14422
|
+
}
|
|
14423
|
+
return requestDict;
|
|
14424
|
+
}
|
|
14425
|
+
class Tokens extends BaseModule {
|
|
14426
|
+
constructor(apiClient) {
|
|
14427
|
+
super();
|
|
14428
|
+
this.apiClient = apiClient;
|
|
14429
|
+
}
|
|
14430
|
+
/**
|
|
14431
|
+
* Creates an ephemeral auth token resource.
|
|
14432
|
+
*
|
|
14433
|
+
* @experimental
|
|
14434
|
+
*
|
|
14435
|
+
* @remarks
|
|
14436
|
+
* Ephermeral auth tokens is only supported in the Gemini Developer API.
|
|
14437
|
+
* It can be used for the session connection to the Live constrained API.
|
|
14438
|
+
*
|
|
14439
|
+
* @param params - The parameters for the create request.
|
|
14440
|
+
* @return The created auth token.
|
|
14441
|
+
*
|
|
14442
|
+
* @example
|
|
14443
|
+
* ```ts
|
|
14444
|
+
* // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
|
|
14445
|
+
* // when using the token in Live API sessions. Each session connection can
|
|
14446
|
+
* // use a different configuration.
|
|
14447
|
+
* const config: CreateAuthTokenConfig = {
|
|
14448
|
+
* uses: 3,
|
|
14449
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14450
|
+
* }
|
|
14451
|
+
* const token = await ai.tokens.create(config);
|
|
14452
|
+
*
|
|
14453
|
+
* // Case 2: If LiveEphemeralParameters is set, lock all fields in
|
|
14454
|
+
* // LiveConnectConfig when using the token in Live API sessions. For
|
|
14455
|
+
* // example, changing `outputAudioTranscription` in the Live API
|
|
14456
|
+
* // connection will be ignored by the API.
|
|
14457
|
+
* const config: CreateAuthTokenConfig =
|
|
14458
|
+
* uses: 3,
|
|
14459
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14460
|
+
* LiveEphemeralParameters: {
|
|
14461
|
+
* model: 'gemini-2.0-flash-001',
|
|
14462
|
+
* config: {
|
|
14463
|
+
* 'responseModalities': ['AUDIO'],
|
|
14464
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14465
|
+
* }
|
|
14466
|
+
* }
|
|
14467
|
+
* }
|
|
14468
|
+
* const token = await ai.tokens.create(config);
|
|
14469
|
+
*
|
|
14470
|
+
* // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14471
|
+
* // set, lock LiveConnectConfig with set and additional fields (e.g.
|
|
14472
|
+
* // responseModalities, systemInstruction, temperature in this example) when
|
|
14473
|
+
* // using the token in Live API sessions.
|
|
14474
|
+
* const config: CreateAuthTokenConfig =
|
|
14475
|
+
* uses: 3,
|
|
14476
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14477
|
+
* LiveEphemeralParameters: {
|
|
14478
|
+
* model: 'gemini-2.0-flash-001',
|
|
14479
|
+
* config: {
|
|
14480
|
+
* 'responseModalities': ['AUDIO'],
|
|
14481
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14482
|
+
* }
|
|
14483
|
+
* },
|
|
14484
|
+
* lockAdditionalFields: ['temperature'],
|
|
14485
|
+
* }
|
|
14486
|
+
* const token = await ai.tokens.create(config);
|
|
14487
|
+
*
|
|
14488
|
+
* // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14489
|
+
* // empty array, lock LiveConnectConfig with set fields (e.g.
|
|
14490
|
+
* // responseModalities, systemInstruction in this example) when using the
|
|
14491
|
+
* // token in Live API sessions.
|
|
14492
|
+
* const config: CreateAuthTokenConfig =
|
|
14493
|
+
* uses: 3,
|
|
14494
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14495
|
+
* LiveEphemeralParameters: {
|
|
14496
|
+
* model: 'gemini-2.0-flash-001',
|
|
14497
|
+
* config: {
|
|
14498
|
+
* 'responseModalities': ['AUDIO'],
|
|
14499
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14500
|
+
* }
|
|
14501
|
+
* },
|
|
14502
|
+
* lockAdditionalFields: [],
|
|
14503
|
+
* }
|
|
14504
|
+
* const token = await ai.tokens.create(config);
|
|
14505
|
+
* ```
|
|
14506
|
+
*/
|
|
14507
|
+
async create(params) {
|
|
14508
|
+
var _a, _b;
|
|
14509
|
+
let response;
|
|
14510
|
+
let path = '';
|
|
14511
|
+
let queryParams = {};
|
|
14512
|
+
if (this.apiClient.isVertexAI()) {
|
|
14513
|
+
throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
|
|
14514
|
+
}
|
|
14515
|
+
else {
|
|
14516
|
+
const body = createAuthTokenParametersToMldev(this.apiClient, params);
|
|
14517
|
+
path = formatMap('auth_tokens', body['_url']);
|
|
14518
|
+
queryParams = body['_query'];
|
|
14519
|
+
delete body['config'];
|
|
14520
|
+
delete body['_url'];
|
|
14521
|
+
delete body['_query'];
|
|
14522
|
+
const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
|
|
14523
|
+
response = this.apiClient
|
|
14524
|
+
.request({
|
|
14525
|
+
path: path,
|
|
14526
|
+
queryParams: queryParams,
|
|
14527
|
+
body: JSON.stringify(transformedBody),
|
|
14528
|
+
httpMethod: 'POST',
|
|
14529
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
14530
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14531
|
+
})
|
|
14532
|
+
.then((httpResponse) => {
|
|
14533
|
+
return httpResponse.json();
|
|
14534
|
+
});
|
|
14535
|
+
return response.then((apiResponse) => {
|
|
14536
|
+
const resp = authTokenFromMldev(this.apiClient, apiResponse);
|
|
14537
|
+
return resp;
|
|
14538
|
+
});
|
|
14539
|
+
}
|
|
14540
|
+
}
|
|
14541
|
+
}
|
|
14542
|
+
|
|
14543
|
+
/**
|
|
14544
|
+
* @license
|
|
14545
|
+
* Copyright 2025 Google LLC
|
|
14546
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14547
|
+
*/
|
|
14548
|
+
function getTuningJobParametersToMldev(apiClient, fromObject) {
|
|
14549
|
+
const toObject = {};
|
|
14550
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14551
|
+
if (fromName != null) {
|
|
14552
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
14553
|
+
}
|
|
14554
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14555
|
+
if (fromConfig != null) {
|
|
14556
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
14557
|
+
}
|
|
14558
|
+
return toObject;
|
|
14559
|
+
}
|
|
14560
|
+
function listTuningJobsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14561
|
+
const toObject = {};
|
|
14562
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14563
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
14564
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
14565
|
+
}
|
|
14566
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
14567
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
14568
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
14569
|
+
}
|
|
14570
|
+
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
14571
|
+
if (parentObject !== undefined && fromFilter != null) {
|
|
14572
|
+
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
14573
|
+
}
|
|
14574
|
+
return toObject;
|
|
14575
|
+
}
|
|
14576
|
+
function listTuningJobsParametersToMldev(apiClient, fromObject) {
|
|
14577
|
+
const toObject = {};
|
|
14578
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14579
|
+
if (fromConfig != null) {
|
|
14580
|
+
setValueByPath(toObject, ['config'], listTuningJobsConfigToMldev(apiClient, fromConfig, toObject));
|
|
14581
|
+
}
|
|
14582
|
+
return toObject;
|
|
14583
|
+
}
|
|
14584
|
+
function tuningExampleToMldev(apiClient, fromObject) {
|
|
14585
|
+
const toObject = {};
|
|
14586
|
+
const fromTextInput = getValueByPath(fromObject, ['textInput']);
|
|
14587
|
+
if (fromTextInput != null) {
|
|
14588
|
+
setValueByPath(toObject, ['textInput'], fromTextInput);
|
|
14589
|
+
}
|
|
14590
|
+
const fromOutput = getValueByPath(fromObject, ['output']);
|
|
14591
|
+
if (fromOutput != null) {
|
|
14592
|
+
setValueByPath(toObject, ['output'], fromOutput);
|
|
14593
|
+
}
|
|
14594
|
+
return toObject;
|
|
14595
|
+
}
|
|
14596
|
+
function tuningDatasetToMldev(apiClient, fromObject) {
|
|
14597
|
+
const toObject = {};
|
|
14598
|
+
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
14599
|
+
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
14600
|
+
}
|
|
14601
|
+
const fromExamples = getValueByPath(fromObject, ['examples']);
|
|
14602
|
+
if (fromExamples != null) {
|
|
14603
|
+
let transformedList = fromExamples;
|
|
14604
|
+
if (Array.isArray(transformedList)) {
|
|
14605
|
+
transformedList = transformedList.map((item) => {
|
|
14606
|
+
return tuningExampleToMldev(apiClient, item);
|
|
14607
|
+
});
|
|
14608
|
+
}
|
|
14609
|
+
setValueByPath(toObject, ['examples', 'examples'], transformedList);
|
|
14610
|
+
}
|
|
14611
|
+
return toObject;
|
|
14612
|
+
}
|
|
14613
|
+
function createTuningJobConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14614
|
+
const toObject = {};
|
|
14615
|
+
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
14616
|
+
throw new Error('validationDataset parameter is not supported in Gemini API.');
|
|
13720
14617
|
}
|
|
13721
14618
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
13722
14619
|
'tunedModelDisplayName',
|
|
@@ -14440,6 +15337,13 @@ class WebAuth {
|
|
|
14440
15337
|
if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
|
|
14441
15338
|
return;
|
|
14442
15339
|
}
|
|
15340
|
+
if (this.apiKey.startsWith('auth_tokens/')) {
|
|
15341
|
+
throw new Error('Ephemeral tokens are only supported by the live API.');
|
|
15342
|
+
}
|
|
15343
|
+
// Check if API key is empty or null
|
|
15344
|
+
if (!this.apiKey) {
|
|
15345
|
+
throw new Error('API key is missing. Please provide a valid API key.');
|
|
15346
|
+
}
|
|
14443
15347
|
headers.append(GOOGLE_API_KEY_HEADER, this.apiKey);
|
|
14444
15348
|
}
|
|
14445
15349
|
}
|
|
@@ -14507,6 +15411,7 @@ class GoogleGenAI {
|
|
|
14507
15411
|
this.caches = new Caches(this.apiClient);
|
|
14508
15412
|
this.files = new Files(this.apiClient);
|
|
14509
15413
|
this.operations = new Operations(this.apiClient);
|
|
15414
|
+
this.authTokens = new Tokens(this.apiClient);
|
|
14510
15415
|
this.tunings = new Tunings(this.apiClient);
|
|
14511
15416
|
}
|
|
14512
15417
|
}
|
|
@@ -14550,6 +15455,7 @@ exports.ReplayResponse = ReplayResponse;
|
|
|
14550
15455
|
exports.Session = Session;
|
|
14551
15456
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
14552
15457
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
15458
|
+
exports.Tokens = Tokens;
|
|
14553
15459
|
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
14554
15460
|
exports.createModelContent = createModelContent;
|
|
14555
15461
|
exports.createPartFromBase64 = createPartFromBase64;
|