@google/genai 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -1
- package/dist/genai.d.ts +141 -24
- package/dist/index.cjs +1115 -157
- package/dist/index.mjs +1115 -158
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +1120 -158
- package/dist/node/index.mjs +1120 -159
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +141 -24
- package/dist/web/index.mjs +1115 -158
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +141 -24
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -162,7 +162,6 @@ function getValueByPath(data, keys) {
|
|
|
162
162
|
* Copyright 2025 Google LLC
|
|
163
163
|
* SPDX-License-Identifier: Apache-2.0
|
|
164
164
|
*/
|
|
165
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
166
165
|
/** Required. Outcome of the code execution. */
|
|
167
166
|
var Outcome;
|
|
168
167
|
(function (Outcome) {
|
|
@@ -398,6 +397,10 @@ var FinishReason;
|
|
|
398
397
|
* Token generation stopped because generated images have safety violations.
|
|
399
398
|
*/
|
|
400
399
|
FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
400
|
+
/**
|
|
401
|
+
* The tool call generated by the model is invalid.
|
|
402
|
+
*/
|
|
403
|
+
FinishReason["UNEXPECTED_TOOL_CALL"] = "UNEXPECTED_TOOL_CALL";
|
|
401
404
|
})(FinishReason || (FinishReason = {}));
|
|
402
405
|
/** Output only. Harm probability levels in the content. */
|
|
403
406
|
var HarmProbability;
|
|
@@ -1391,7 +1394,6 @@ class ReplayResponse {
|
|
|
1391
1394
|
*/
|
|
1392
1395
|
class RawReferenceImage {
|
|
1393
1396
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1394
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1395
1397
|
toReferenceImageAPI() {
|
|
1396
1398
|
const referenceImageAPI = {
|
|
1397
1399
|
referenceType: 'REFERENCE_TYPE_RAW',
|
|
@@ -1413,7 +1415,6 @@ class RawReferenceImage {
|
|
|
1413
1415
|
*/
|
|
1414
1416
|
class MaskReferenceImage {
|
|
1415
1417
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1416
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1417
1418
|
toReferenceImageAPI() {
|
|
1418
1419
|
const referenceImageAPI = {
|
|
1419
1420
|
referenceType: 'REFERENCE_TYPE_MASK',
|
|
@@ -1436,7 +1437,6 @@ class MaskReferenceImage {
|
|
|
1436
1437
|
*/
|
|
1437
1438
|
class ControlReferenceImage {
|
|
1438
1439
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1439
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1440
1440
|
toReferenceImageAPI() {
|
|
1441
1441
|
const referenceImageAPI = {
|
|
1442
1442
|
referenceType: 'REFERENCE_TYPE_CONTROL',
|
|
@@ -1457,7 +1457,6 @@ class ControlReferenceImage {
|
|
|
1457
1457
|
*/
|
|
1458
1458
|
class StyleReferenceImage {
|
|
1459
1459
|
/** Internal method to convert to ReferenceImageAPIInternal. */
|
|
1460
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1461
1460
|
toReferenceImageAPI() {
|
|
1462
1461
|
const referenceImageAPI = {
|
|
1463
1462
|
referenceType: 'REFERENCE_TYPE_STYLE',
|
|
@@ -1478,7 +1477,6 @@ class StyleReferenceImage {
|
|
|
1478
1477
|
*/
|
|
1479
1478
|
class SubjectReferenceImage {
|
|
1480
1479
|
/* Internal method to convert to ReferenceImageAPIInternal. */
|
|
1481
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1482
1480
|
toReferenceImageAPI() {
|
|
1483
1481
|
const referenceImageAPI = {
|
|
1484
1482
|
referenceType: 'REFERENCE_TYPE_SUBJECT',
|
|
@@ -1925,16 +1923,16 @@ function flattenTypeArrayToAnyOf(typeList, resultingSchema) {
|
|
|
1925
1923
|
}
|
|
1926
1924
|
const listWithoutNull = typeList.filter((type) => type !== 'null');
|
|
1927
1925
|
if (listWithoutNull.length === 1) {
|
|
1928
|
-
resultingSchema['type'] = Object.
|
|
1929
|
-
?
|
|
1926
|
+
resultingSchema['type'] = Object.values(Type).includes(listWithoutNull[0].toUpperCase())
|
|
1927
|
+
? listWithoutNull[0].toUpperCase()
|
|
1930
1928
|
: Type.TYPE_UNSPECIFIED;
|
|
1931
1929
|
}
|
|
1932
1930
|
else {
|
|
1933
1931
|
resultingSchema['anyOf'] = [];
|
|
1934
1932
|
for (const i of listWithoutNull) {
|
|
1935
1933
|
resultingSchema['anyOf'].push({
|
|
1936
|
-
'type': Object.
|
|
1937
|
-
?
|
|
1934
|
+
'type': Object.values(Type).includes(i.toUpperCase())
|
|
1935
|
+
? i.toUpperCase()
|
|
1938
1936
|
: Type.TYPE_UNSPECIFIED,
|
|
1939
1937
|
});
|
|
1940
1938
|
}
|
|
@@ -2018,7 +2016,7 @@ function processJsonSchema(_jsonSchema) {
|
|
|
2018
2016
|
// beginning of this function.
|
|
2019
2017
|
continue;
|
|
2020
2018
|
}
|
|
2021
|
-
genAISchema['type'] = Object.
|
|
2019
|
+
genAISchema['type'] = Object.values(Type).includes(fieldValue.toUpperCase())
|
|
2022
2020
|
? fieldValue.toUpperCase()
|
|
2023
2021
|
: Type.TYPE_UNSPECIFIED;
|
|
2024
2022
|
}
|
|
@@ -2377,7 +2375,7 @@ function filterToJsonSchema(schema) {
|
|
|
2377
2375
|
}
|
|
2378
2376
|
else if (fieldName === 'type') {
|
|
2379
2377
|
const typeValue = fieldValue.toUpperCase();
|
|
2380
|
-
filteredSchema[fieldName] = Object.
|
|
2378
|
+
filteredSchema[fieldName] = Object.values(Type).includes(typeValue)
|
|
2381
2379
|
? typeValue
|
|
2382
2380
|
: Type.TYPE_UNSPECIFIED;
|
|
2383
2381
|
}
|
|
@@ -2393,7 +2391,7 @@ function filterToJsonSchema(schema) {
|
|
|
2393
2391
|
* Copyright 2025 Google LLC
|
|
2394
2392
|
* SPDX-License-Identifier: Apache-2.0
|
|
2395
2393
|
*/
|
|
2396
|
-
function videoMetadataToMldev$
|
|
2394
|
+
function videoMetadataToMldev$3(apiClient, fromObject) {
|
|
2397
2395
|
const toObject = {};
|
|
2398
2396
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
2399
2397
|
if (fromFps != null) {
|
|
@@ -2409,7 +2407,7 @@ function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
|
2409
2407
|
}
|
|
2410
2408
|
return toObject;
|
|
2411
2409
|
}
|
|
2412
|
-
function blobToMldev$
|
|
2410
|
+
function blobToMldev$3(apiClient, fromObject) {
|
|
2413
2411
|
const toObject = {};
|
|
2414
2412
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2415
2413
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2424,7 +2422,7 @@ function blobToMldev$2(apiClient, fromObject) {
|
|
|
2424
2422
|
}
|
|
2425
2423
|
return toObject;
|
|
2426
2424
|
}
|
|
2427
|
-
function fileDataToMldev$
|
|
2425
|
+
function fileDataToMldev$3(apiClient, fromObject) {
|
|
2428
2426
|
const toObject = {};
|
|
2429
2427
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2430
2428
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -2439,13 +2437,13 @@ function fileDataToMldev$2(apiClient, fromObject) {
|
|
|
2439
2437
|
}
|
|
2440
2438
|
return toObject;
|
|
2441
2439
|
}
|
|
2442
|
-
function partToMldev$
|
|
2440
|
+
function partToMldev$3(apiClient, fromObject) {
|
|
2443
2441
|
const toObject = {};
|
|
2444
2442
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
2445
2443
|
'videoMetadata',
|
|
2446
2444
|
]);
|
|
2447
2445
|
if (fromVideoMetadata != null) {
|
|
2448
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
2446
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$3(apiClient, fromVideoMetadata));
|
|
2449
2447
|
}
|
|
2450
2448
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
2451
2449
|
if (fromThought != null) {
|
|
@@ -2453,11 +2451,17 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2453
2451
|
}
|
|
2454
2452
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
2455
2453
|
if (fromInlineData != null) {
|
|
2456
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
2454
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$3(apiClient, fromInlineData));
|
|
2457
2455
|
}
|
|
2458
2456
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
2459
2457
|
if (fromFileData != null) {
|
|
2460
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
2458
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$3(apiClient, fromFileData));
|
|
2459
|
+
}
|
|
2460
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2461
|
+
'thoughtSignature',
|
|
2462
|
+
]);
|
|
2463
|
+
if (fromThoughtSignature != null) {
|
|
2464
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2461
2465
|
}
|
|
2462
2466
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2463
2467
|
'codeExecutionResult',
|
|
@@ -2487,14 +2491,14 @@ function partToMldev$2(apiClient, fromObject) {
|
|
|
2487
2491
|
}
|
|
2488
2492
|
return toObject;
|
|
2489
2493
|
}
|
|
2490
|
-
function contentToMldev$
|
|
2494
|
+
function contentToMldev$3(apiClient, fromObject) {
|
|
2491
2495
|
const toObject = {};
|
|
2492
2496
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2493
2497
|
if (fromParts != null) {
|
|
2494
2498
|
let transformedList = fromParts;
|
|
2495
2499
|
if (Array.isArray(transformedList)) {
|
|
2496
2500
|
transformedList = transformedList.map((item) => {
|
|
2497
|
-
return partToMldev$
|
|
2501
|
+
return partToMldev$3(apiClient, item);
|
|
2498
2502
|
});
|
|
2499
2503
|
}
|
|
2500
2504
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -2505,7 +2509,7 @@ function contentToMldev$2(apiClient, fromObject) {
|
|
|
2505
2509
|
}
|
|
2506
2510
|
return toObject;
|
|
2507
2511
|
}
|
|
2508
|
-
function functionDeclarationToMldev$
|
|
2512
|
+
function functionDeclarationToMldev$3(apiClient, fromObject) {
|
|
2509
2513
|
const toObject = {};
|
|
2510
2514
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
2511
2515
|
if (fromBehavior != null) {
|
|
@@ -2529,7 +2533,7 @@ function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
|
2529
2533
|
}
|
|
2530
2534
|
return toObject;
|
|
2531
2535
|
}
|
|
2532
|
-
function intervalToMldev$
|
|
2536
|
+
function intervalToMldev$3(apiClient, fromObject) {
|
|
2533
2537
|
const toObject = {};
|
|
2534
2538
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
2535
2539
|
if (fromStartTime != null) {
|
|
@@ -2541,17 +2545,17 @@ function intervalToMldev$2(apiClient, fromObject) {
|
|
|
2541
2545
|
}
|
|
2542
2546
|
return toObject;
|
|
2543
2547
|
}
|
|
2544
|
-
function googleSearchToMldev$
|
|
2548
|
+
function googleSearchToMldev$3(apiClient, fromObject) {
|
|
2545
2549
|
const toObject = {};
|
|
2546
2550
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
2547
2551
|
'timeRangeFilter',
|
|
2548
2552
|
]);
|
|
2549
2553
|
if (fromTimeRangeFilter != null) {
|
|
2550
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
2554
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(apiClient, fromTimeRangeFilter));
|
|
2551
2555
|
}
|
|
2552
2556
|
return toObject;
|
|
2553
2557
|
}
|
|
2554
|
-
function dynamicRetrievalConfigToMldev$
|
|
2558
|
+
function dynamicRetrievalConfigToMldev$3(apiClient, fromObject) {
|
|
2555
2559
|
const toObject = {};
|
|
2556
2560
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2557
2561
|
if (fromMode != null) {
|
|
@@ -2565,21 +2569,21 @@ function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
|
2565
2569
|
}
|
|
2566
2570
|
return toObject;
|
|
2567
2571
|
}
|
|
2568
|
-
function googleSearchRetrievalToMldev$
|
|
2572
|
+
function googleSearchRetrievalToMldev$3(apiClient, fromObject) {
|
|
2569
2573
|
const toObject = {};
|
|
2570
2574
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
2571
2575
|
'dynamicRetrievalConfig',
|
|
2572
2576
|
]);
|
|
2573
2577
|
if (fromDynamicRetrievalConfig != null) {
|
|
2574
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
2578
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$3(apiClient, fromDynamicRetrievalConfig));
|
|
2575
2579
|
}
|
|
2576
2580
|
return toObject;
|
|
2577
2581
|
}
|
|
2578
|
-
function urlContextToMldev$
|
|
2582
|
+
function urlContextToMldev$3() {
|
|
2579
2583
|
const toObject = {};
|
|
2580
2584
|
return toObject;
|
|
2581
2585
|
}
|
|
2582
|
-
function toolToMldev$
|
|
2586
|
+
function toolToMldev$3(apiClient, fromObject) {
|
|
2583
2587
|
const toObject = {};
|
|
2584
2588
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
2585
2589
|
'functionDeclarations',
|
|
@@ -2588,7 +2592,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2588
2592
|
let transformedList = fromFunctionDeclarations;
|
|
2589
2593
|
if (Array.isArray(transformedList)) {
|
|
2590
2594
|
transformedList = transformedList.map((item) => {
|
|
2591
|
-
return functionDeclarationToMldev$
|
|
2595
|
+
return functionDeclarationToMldev$3(apiClient, item);
|
|
2592
2596
|
});
|
|
2593
2597
|
}
|
|
2594
2598
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -2598,13 +2602,13 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2598
2602
|
}
|
|
2599
2603
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
2600
2604
|
if (fromGoogleSearch != null) {
|
|
2601
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
2605
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(apiClient, fromGoogleSearch));
|
|
2602
2606
|
}
|
|
2603
2607
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
2604
2608
|
'googleSearchRetrieval',
|
|
2605
2609
|
]);
|
|
2606
2610
|
if (fromGoogleSearchRetrieval != null) {
|
|
2607
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
2611
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$3(apiClient, fromGoogleSearchRetrieval));
|
|
2608
2612
|
}
|
|
2609
2613
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
2610
2614
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -2614,7 +2618,7 @@ function toolToMldev$2(apiClient, fromObject) {
|
|
|
2614
2618
|
}
|
|
2615
2619
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
2616
2620
|
if (fromUrlContext != null) {
|
|
2617
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
2621
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
|
|
2618
2622
|
}
|
|
2619
2623
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
2620
2624
|
'codeExecution',
|
|
@@ -2697,7 +2701,7 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2697
2701
|
let transformedList = tContents(apiClient, fromContents);
|
|
2698
2702
|
if (Array.isArray(transformedList)) {
|
|
2699
2703
|
transformedList = transformedList.map((item) => {
|
|
2700
|
-
return contentToMldev$
|
|
2704
|
+
return contentToMldev$3(apiClient, item);
|
|
2701
2705
|
});
|
|
2702
2706
|
}
|
|
2703
2707
|
setValueByPath(parentObject, ['contents'], transformedList);
|
|
@@ -2706,14 +2710,14 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
2706
2710
|
'systemInstruction',
|
|
2707
2711
|
]);
|
|
2708
2712
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
2709
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$
|
|
2713
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$3(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
2710
2714
|
}
|
|
2711
2715
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
2712
2716
|
if (parentObject !== undefined && fromTools != null) {
|
|
2713
2717
|
let transformedList = fromTools;
|
|
2714
2718
|
if (Array.isArray(transformedList)) {
|
|
2715
2719
|
transformedList = transformedList.map((item) => {
|
|
2716
|
-
return toolToMldev$
|
|
2720
|
+
return toolToMldev$3(apiClient, item);
|
|
2717
2721
|
});
|
|
2718
2722
|
}
|
|
2719
2723
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -2875,6 +2879,12 @@ function partToVertex$2(apiClient, fromObject) {
|
|
|
2875
2879
|
if (fromFileData != null) {
|
|
2876
2880
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$2(apiClient, fromFileData));
|
|
2877
2881
|
}
|
|
2882
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2883
|
+
'thoughtSignature',
|
|
2884
|
+
]);
|
|
2885
|
+
if (fromThoughtSignature != null) {
|
|
2886
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2887
|
+
}
|
|
2878
2888
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2879
2889
|
'codeExecutionResult',
|
|
2880
2890
|
]);
|
|
@@ -3042,6 +3052,10 @@ function googleMapsToVertex$2(apiClient, fromObject) {
|
|
|
3042
3052
|
}
|
|
3043
3053
|
return toObject;
|
|
3044
3054
|
}
|
|
3055
|
+
function urlContextToVertex$2() {
|
|
3056
|
+
const toObject = {};
|
|
3057
|
+
return toObject;
|
|
3058
|
+
}
|
|
3045
3059
|
function toolToVertex$2(apiClient, fromObject) {
|
|
3046
3060
|
const toObject = {};
|
|
3047
3061
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -3080,8 +3094,9 @@ function toolToVertex$2(apiClient, fromObject) {
|
|
|
3080
3094
|
if (fromGoogleMaps != null) {
|
|
3081
3095
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$2(apiClient, fromGoogleMaps));
|
|
3082
3096
|
}
|
|
3083
|
-
|
|
3084
|
-
|
|
3097
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
3098
|
+
if (fromUrlContext != null) {
|
|
3099
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
|
|
3085
3100
|
}
|
|
3086
3101
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3087
3102
|
'codeExecution',
|
|
@@ -4336,7 +4351,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
4336
4351
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
4337
4352
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
4338
4353
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
4339
|
-
const SDK_VERSION = '1.
|
|
4354
|
+
const SDK_VERSION = '1.4.0'; // x-release-please-version
|
|
4340
4355
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
4341
4356
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
4342
4357
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -5500,7 +5515,7 @@ class Files extends BaseModule {
|
|
|
5500
5515
|
* Copyright 2025 Google LLC
|
|
5501
5516
|
* SPDX-License-Identifier: Apache-2.0
|
|
5502
5517
|
*/
|
|
5503
|
-
function prebuiltVoiceConfigToMldev$
|
|
5518
|
+
function prebuiltVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
5504
5519
|
const toObject = {};
|
|
5505
5520
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
5506
5521
|
if (fromVoiceName != null) {
|
|
@@ -5516,13 +5531,13 @@ function prebuiltVoiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
5516
5531
|
}
|
|
5517
5532
|
return toObject;
|
|
5518
5533
|
}
|
|
5519
|
-
function voiceConfigToMldev$
|
|
5534
|
+
function voiceConfigToMldev$2(apiClient, fromObject) {
|
|
5520
5535
|
const toObject = {};
|
|
5521
5536
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
5522
5537
|
'prebuiltVoiceConfig',
|
|
5523
5538
|
]);
|
|
5524
5539
|
if (fromPrebuiltVoiceConfig != null) {
|
|
5525
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$
|
|
5540
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$2(apiClient, fromPrebuiltVoiceConfig));
|
|
5526
5541
|
}
|
|
5527
5542
|
return toObject;
|
|
5528
5543
|
}
|
|
@@ -5536,7 +5551,7 @@ function voiceConfigToVertex$1(apiClient, fromObject) {
|
|
|
5536
5551
|
}
|
|
5537
5552
|
return toObject;
|
|
5538
5553
|
}
|
|
5539
|
-
function speakerVoiceConfigToMldev$
|
|
5554
|
+
function speakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
5540
5555
|
const toObject = {};
|
|
5541
5556
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
5542
5557
|
if (fromSpeaker != null) {
|
|
@@ -5544,11 +5559,11 @@ function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
5544
5559
|
}
|
|
5545
5560
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
5546
5561
|
if (fromVoiceConfig != null) {
|
|
5547
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
5562
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
5548
5563
|
}
|
|
5549
5564
|
return toObject;
|
|
5550
5565
|
}
|
|
5551
|
-
function multiSpeakerVoiceConfigToMldev$
|
|
5566
|
+
function multiSpeakerVoiceConfigToMldev$2(apiClient, fromObject) {
|
|
5552
5567
|
const toObject = {};
|
|
5553
5568
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
5554
5569
|
'speakerVoiceConfigs',
|
|
@@ -5557,24 +5572,24 @@ function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
|
5557
5572
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
5558
5573
|
if (Array.isArray(transformedList)) {
|
|
5559
5574
|
transformedList = transformedList.map((item) => {
|
|
5560
|
-
return speakerVoiceConfigToMldev$
|
|
5575
|
+
return speakerVoiceConfigToMldev$2(apiClient, item);
|
|
5561
5576
|
});
|
|
5562
5577
|
}
|
|
5563
5578
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
5564
5579
|
}
|
|
5565
5580
|
return toObject;
|
|
5566
5581
|
}
|
|
5567
|
-
function speechConfigToMldev$
|
|
5582
|
+
function speechConfigToMldev$2(apiClient, fromObject) {
|
|
5568
5583
|
const toObject = {};
|
|
5569
5584
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
5570
5585
|
if (fromVoiceConfig != null) {
|
|
5571
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$
|
|
5586
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$2(apiClient, fromVoiceConfig));
|
|
5572
5587
|
}
|
|
5573
5588
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
5574
5589
|
'multiSpeakerVoiceConfig',
|
|
5575
5590
|
]);
|
|
5576
5591
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
5577
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$
|
|
5592
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$2(apiClient, fromMultiSpeakerVoiceConfig));
|
|
5578
5593
|
}
|
|
5579
5594
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
5580
5595
|
if (fromLanguageCode != null) {
|
|
@@ -5597,7 +5612,7 @@ function speechConfigToVertex$1(apiClient, fromObject) {
|
|
|
5597
5612
|
}
|
|
5598
5613
|
return toObject;
|
|
5599
5614
|
}
|
|
5600
|
-
function videoMetadataToMldev$
|
|
5615
|
+
function videoMetadataToMldev$2(apiClient, fromObject) {
|
|
5601
5616
|
const toObject = {};
|
|
5602
5617
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
5603
5618
|
if (fromFps != null) {
|
|
@@ -5629,7 +5644,7 @@ function videoMetadataToVertex$1(apiClient, fromObject) {
|
|
|
5629
5644
|
}
|
|
5630
5645
|
return toObject;
|
|
5631
5646
|
}
|
|
5632
|
-
function blobToMldev$
|
|
5647
|
+
function blobToMldev$2(apiClient, fromObject) {
|
|
5633
5648
|
const toObject = {};
|
|
5634
5649
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5635
5650
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5660,7 +5675,7 @@ function blobToVertex$1(apiClient, fromObject) {
|
|
|
5660
5675
|
}
|
|
5661
5676
|
return toObject;
|
|
5662
5677
|
}
|
|
5663
|
-
function fileDataToMldev$
|
|
5678
|
+
function fileDataToMldev$2(apiClient, fromObject) {
|
|
5664
5679
|
const toObject = {};
|
|
5665
5680
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5666
5681
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -5691,13 +5706,13 @@ function fileDataToVertex$1(apiClient, fromObject) {
|
|
|
5691
5706
|
}
|
|
5692
5707
|
return toObject;
|
|
5693
5708
|
}
|
|
5694
|
-
function partToMldev$
|
|
5709
|
+
function partToMldev$2(apiClient, fromObject) {
|
|
5695
5710
|
const toObject = {};
|
|
5696
5711
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
5697
5712
|
'videoMetadata',
|
|
5698
5713
|
]);
|
|
5699
5714
|
if (fromVideoMetadata != null) {
|
|
5700
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$
|
|
5715
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$2(apiClient, fromVideoMetadata));
|
|
5701
5716
|
}
|
|
5702
5717
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
5703
5718
|
if (fromThought != null) {
|
|
@@ -5705,11 +5720,17 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
5705
5720
|
}
|
|
5706
5721
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5707
5722
|
if (fromInlineData != null) {
|
|
5708
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$
|
|
5723
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(apiClient, fromInlineData));
|
|
5709
5724
|
}
|
|
5710
5725
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
5711
5726
|
if (fromFileData != null) {
|
|
5712
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$
|
|
5727
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$2(apiClient, fromFileData));
|
|
5728
|
+
}
|
|
5729
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5730
|
+
'thoughtSignature',
|
|
5731
|
+
]);
|
|
5732
|
+
if (fromThoughtSignature != null) {
|
|
5733
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5713
5734
|
}
|
|
5714
5735
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5715
5736
|
'codeExecutionResult',
|
|
@@ -5759,6 +5780,12 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5759
5780
|
if (fromFileData != null) {
|
|
5760
5781
|
setValueByPath(toObject, ['fileData'], fileDataToVertex$1(apiClient, fromFileData));
|
|
5761
5782
|
}
|
|
5783
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5784
|
+
'thoughtSignature',
|
|
5785
|
+
]);
|
|
5786
|
+
if (fromThoughtSignature != null) {
|
|
5787
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5788
|
+
}
|
|
5762
5789
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5763
5790
|
'codeExecutionResult',
|
|
5764
5791
|
]);
|
|
@@ -5787,14 +5814,14 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
5787
5814
|
}
|
|
5788
5815
|
return toObject;
|
|
5789
5816
|
}
|
|
5790
|
-
function contentToMldev$
|
|
5817
|
+
function contentToMldev$2(apiClient, fromObject) {
|
|
5791
5818
|
const toObject = {};
|
|
5792
5819
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
5793
5820
|
if (fromParts != null) {
|
|
5794
5821
|
let transformedList = fromParts;
|
|
5795
5822
|
if (Array.isArray(transformedList)) {
|
|
5796
5823
|
transformedList = transformedList.map((item) => {
|
|
5797
|
-
return partToMldev$
|
|
5824
|
+
return partToMldev$2(apiClient, item);
|
|
5798
5825
|
});
|
|
5799
5826
|
}
|
|
5800
5827
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -5823,7 +5850,7 @@ function contentToVertex$1(apiClient, fromObject) {
|
|
|
5823
5850
|
}
|
|
5824
5851
|
return toObject;
|
|
5825
5852
|
}
|
|
5826
|
-
function functionDeclarationToMldev$
|
|
5853
|
+
function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
5827
5854
|
const toObject = {};
|
|
5828
5855
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
5829
5856
|
if (fromBehavior != null) {
|
|
@@ -5870,7 +5897,7 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
|
5870
5897
|
}
|
|
5871
5898
|
return toObject;
|
|
5872
5899
|
}
|
|
5873
|
-
function intervalToMldev$
|
|
5900
|
+
function intervalToMldev$2(apiClient, fromObject) {
|
|
5874
5901
|
const toObject = {};
|
|
5875
5902
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
5876
5903
|
if (fromStartTime != null) {
|
|
@@ -5894,13 +5921,13 @@ function intervalToVertex$1(apiClient, fromObject) {
|
|
|
5894
5921
|
}
|
|
5895
5922
|
return toObject;
|
|
5896
5923
|
}
|
|
5897
|
-
function googleSearchToMldev$
|
|
5924
|
+
function googleSearchToMldev$2(apiClient, fromObject) {
|
|
5898
5925
|
const toObject = {};
|
|
5899
5926
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
5900
5927
|
'timeRangeFilter',
|
|
5901
5928
|
]);
|
|
5902
5929
|
if (fromTimeRangeFilter != null) {
|
|
5903
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$
|
|
5930
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(apiClient, fromTimeRangeFilter));
|
|
5904
5931
|
}
|
|
5905
5932
|
return toObject;
|
|
5906
5933
|
}
|
|
@@ -5914,7 +5941,7 @@ function googleSearchToVertex$1(apiClient, fromObject) {
|
|
|
5914
5941
|
}
|
|
5915
5942
|
return toObject;
|
|
5916
5943
|
}
|
|
5917
|
-
function dynamicRetrievalConfigToMldev$
|
|
5944
|
+
function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
5918
5945
|
const toObject = {};
|
|
5919
5946
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5920
5947
|
if (fromMode != null) {
|
|
@@ -5942,13 +5969,13 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
|
5942
5969
|
}
|
|
5943
5970
|
return toObject;
|
|
5944
5971
|
}
|
|
5945
|
-
function googleSearchRetrievalToMldev$
|
|
5972
|
+
function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
|
|
5946
5973
|
const toObject = {};
|
|
5947
5974
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
5948
5975
|
'dynamicRetrievalConfig',
|
|
5949
5976
|
]);
|
|
5950
5977
|
if (fromDynamicRetrievalConfig != null) {
|
|
5951
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
5978
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
|
|
5952
5979
|
}
|
|
5953
5980
|
return toObject;
|
|
5954
5981
|
}
|
|
@@ -6014,11 +6041,15 @@ function googleMapsToVertex$1(apiClient, fromObject) {
|
|
|
6014
6041
|
}
|
|
6015
6042
|
return toObject;
|
|
6016
6043
|
}
|
|
6017
|
-
function urlContextToMldev$
|
|
6044
|
+
function urlContextToMldev$2() {
|
|
6018
6045
|
const toObject = {};
|
|
6019
6046
|
return toObject;
|
|
6020
6047
|
}
|
|
6021
|
-
function
|
|
6048
|
+
function urlContextToVertex$1() {
|
|
6049
|
+
const toObject = {};
|
|
6050
|
+
return toObject;
|
|
6051
|
+
}
|
|
6052
|
+
function toolToMldev$2(apiClient, fromObject) {
|
|
6022
6053
|
const toObject = {};
|
|
6023
6054
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
6024
6055
|
'functionDeclarations',
|
|
@@ -6027,7 +6058,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
6027
6058
|
let transformedList = fromFunctionDeclarations;
|
|
6028
6059
|
if (Array.isArray(transformedList)) {
|
|
6029
6060
|
transformedList = transformedList.map((item) => {
|
|
6030
|
-
return functionDeclarationToMldev$
|
|
6061
|
+
return functionDeclarationToMldev$2(apiClient, item);
|
|
6031
6062
|
});
|
|
6032
6063
|
}
|
|
6033
6064
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -6037,13 +6068,13 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
6037
6068
|
}
|
|
6038
6069
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
6039
6070
|
if (fromGoogleSearch != null) {
|
|
6040
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
6071
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(apiClient, fromGoogleSearch));
|
|
6041
6072
|
}
|
|
6042
6073
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
6043
6074
|
'googleSearchRetrieval',
|
|
6044
6075
|
]);
|
|
6045
6076
|
if (fromGoogleSearchRetrieval != null) {
|
|
6046
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
6077
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
|
|
6047
6078
|
}
|
|
6048
6079
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
6049
6080
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -6053,7 +6084,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
6053
6084
|
}
|
|
6054
6085
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
6055
6086
|
if (fromUrlContext != null) {
|
|
6056
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev$
|
|
6087
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
|
|
6057
6088
|
}
|
|
6058
6089
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
6059
6090
|
'codeExecution',
|
|
@@ -6101,8 +6132,9 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
6101
6132
|
if (fromGoogleMaps != null) {
|
|
6102
6133
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$1(apiClient, fromGoogleMaps));
|
|
6103
6134
|
}
|
|
6104
|
-
|
|
6105
|
-
|
|
6135
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
6136
|
+
if (fromUrlContext != null) {
|
|
6137
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
|
|
6106
6138
|
}
|
|
6107
6139
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
6108
6140
|
'codeExecution',
|
|
@@ -6112,7 +6144,7 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
6112
6144
|
}
|
|
6113
6145
|
return toObject;
|
|
6114
6146
|
}
|
|
6115
|
-
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
6147
|
+
function sessionResumptionConfigToMldev$1(apiClient, fromObject) {
|
|
6116
6148
|
const toObject = {};
|
|
6117
6149
|
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
6118
6150
|
if (fromHandle != null) {
|
|
@@ -6135,7 +6167,7 @@ function sessionResumptionConfigToVertex(apiClient, fromObject) {
|
|
|
6135
6167
|
}
|
|
6136
6168
|
return toObject;
|
|
6137
6169
|
}
|
|
6138
|
-
function audioTranscriptionConfigToMldev() {
|
|
6170
|
+
function audioTranscriptionConfigToMldev$1() {
|
|
6139
6171
|
const toObject = {};
|
|
6140
6172
|
return toObject;
|
|
6141
6173
|
}
|
|
@@ -6143,7 +6175,7 @@ function audioTranscriptionConfigToVertex() {
|
|
|
6143
6175
|
const toObject = {};
|
|
6144
6176
|
return toObject;
|
|
6145
6177
|
}
|
|
6146
|
-
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
6178
|
+
function automaticActivityDetectionToMldev$1(apiClient, fromObject) {
|
|
6147
6179
|
const toObject = {};
|
|
6148
6180
|
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
6149
6181
|
if (fromDisabled != null) {
|
|
@@ -6207,13 +6239,13 @@ function automaticActivityDetectionToVertex(apiClient, fromObject) {
|
|
|
6207
6239
|
}
|
|
6208
6240
|
return toObject;
|
|
6209
6241
|
}
|
|
6210
|
-
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
6242
|
+
function realtimeInputConfigToMldev$1(apiClient, fromObject) {
|
|
6211
6243
|
const toObject = {};
|
|
6212
6244
|
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
6213
6245
|
'automaticActivityDetection',
|
|
6214
6246
|
]);
|
|
6215
6247
|
if (fromAutomaticActivityDetection != null) {
|
|
6216
|
-
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
6248
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev$1(apiClient, fromAutomaticActivityDetection));
|
|
6217
6249
|
}
|
|
6218
6250
|
const fromActivityHandling = getValueByPath(fromObject, [
|
|
6219
6251
|
'activityHandling',
|
|
@@ -6247,7 +6279,7 @@ function realtimeInputConfigToVertex(apiClient, fromObject) {
|
|
|
6247
6279
|
}
|
|
6248
6280
|
return toObject;
|
|
6249
6281
|
}
|
|
6250
|
-
function slidingWindowToMldev(apiClient, fromObject) {
|
|
6282
|
+
function slidingWindowToMldev$1(apiClient, fromObject) {
|
|
6251
6283
|
const toObject = {};
|
|
6252
6284
|
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
6253
6285
|
if (fromTargetTokens != null) {
|
|
@@ -6263,7 +6295,7 @@ function slidingWindowToVertex(apiClient, fromObject) {
|
|
|
6263
6295
|
}
|
|
6264
6296
|
return toObject;
|
|
6265
6297
|
}
|
|
6266
|
-
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
6298
|
+
function contextWindowCompressionConfigToMldev$1(apiClient, fromObject) {
|
|
6267
6299
|
const toObject = {};
|
|
6268
6300
|
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
6269
6301
|
'triggerTokens',
|
|
@@ -6275,7 +6307,7 @@ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
|
6275
6307
|
'slidingWindow',
|
|
6276
6308
|
]);
|
|
6277
6309
|
if (fromSlidingWindow != null) {
|
|
6278
|
-
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
6310
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev$1(apiClient, fromSlidingWindow));
|
|
6279
6311
|
}
|
|
6280
6312
|
return toObject;
|
|
6281
6313
|
}
|
|
@@ -6295,7 +6327,7 @@ function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
|
|
|
6295
6327
|
}
|
|
6296
6328
|
return toObject;
|
|
6297
6329
|
}
|
|
6298
|
-
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
6330
|
+
function proactivityConfigToMldev$1(apiClient, fromObject) {
|
|
6299
6331
|
const toObject = {};
|
|
6300
6332
|
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
6301
6333
|
'proactiveAudio',
|
|
@@ -6315,7 +6347,7 @@ function proactivityConfigToVertex(apiClient, fromObject) {
|
|
|
6315
6347
|
}
|
|
6316
6348
|
return toObject;
|
|
6317
6349
|
}
|
|
6318
|
-
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
6350
|
+
function liveConnectConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
6319
6351
|
const toObject = {};
|
|
6320
6352
|
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
6321
6353
|
'generationConfig',
|
|
@@ -6359,7 +6391,7 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
6359
6391
|
}
|
|
6360
6392
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
6361
6393
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
6362
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$
|
|
6394
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev$2(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
6363
6395
|
}
|
|
6364
6396
|
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
6365
6397
|
'enableAffectiveDialog',
|
|
@@ -6371,14 +6403,14 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
6371
6403
|
'systemInstruction',
|
|
6372
6404
|
]);
|
|
6373
6405
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
6374
|
-
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$
|
|
6406
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
6375
6407
|
}
|
|
6376
6408
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
6377
6409
|
if (parentObject !== undefined && fromTools != null) {
|
|
6378
6410
|
let transformedList = tTools(apiClient, fromTools);
|
|
6379
6411
|
if (Array.isArray(transformedList)) {
|
|
6380
6412
|
transformedList = transformedList.map((item) => {
|
|
6381
|
-
return toolToMldev$
|
|
6413
|
+
return toolToMldev$2(apiClient, tTool(apiClient, item));
|
|
6382
6414
|
});
|
|
6383
6415
|
}
|
|
6384
6416
|
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
@@ -6387,35 +6419,35 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
6387
6419
|
'sessionResumption',
|
|
6388
6420
|
]);
|
|
6389
6421
|
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
6390
|
-
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
6422
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev$1(apiClient, fromSessionResumption));
|
|
6391
6423
|
}
|
|
6392
6424
|
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
6393
6425
|
'inputAudioTranscription',
|
|
6394
6426
|
]);
|
|
6395
6427
|
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
6396
|
-
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
6428
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
6397
6429
|
}
|
|
6398
6430
|
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
6399
6431
|
'outputAudioTranscription',
|
|
6400
6432
|
]);
|
|
6401
6433
|
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
6402
|
-
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
6434
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev$1());
|
|
6403
6435
|
}
|
|
6404
6436
|
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
6405
6437
|
'realtimeInputConfig',
|
|
6406
6438
|
]);
|
|
6407
6439
|
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
6408
|
-
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
6440
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev$1(apiClient, fromRealtimeInputConfig));
|
|
6409
6441
|
}
|
|
6410
6442
|
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
6411
6443
|
'contextWindowCompression',
|
|
6412
6444
|
]);
|
|
6413
6445
|
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
6414
|
-
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
6446
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev$1(apiClient, fromContextWindowCompression));
|
|
6415
6447
|
}
|
|
6416
6448
|
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
6417
6449
|
if (parentObject !== undefined && fromProactivity != null) {
|
|
6418
|
-
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
6450
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev$1(apiClient, fromProactivity));
|
|
6419
6451
|
}
|
|
6420
6452
|
return toObject;
|
|
6421
6453
|
}
|
|
@@ -6531,7 +6563,7 @@ function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
|
6531
6563
|
}
|
|
6532
6564
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6533
6565
|
if (fromConfig != null) {
|
|
6534
|
-
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
6566
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev$1(apiClient, fromConfig, toObject));
|
|
6535
6567
|
}
|
|
6536
6568
|
return toObject;
|
|
6537
6569
|
}
|
|
@@ -6886,6 +6918,12 @@ function partFromMldev$1(apiClient, fromObject) {
|
|
|
6886
6918
|
if (fromFileData != null) {
|
|
6887
6919
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev$1(apiClient, fromFileData));
|
|
6888
6920
|
}
|
|
6921
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6922
|
+
'thoughtSignature',
|
|
6923
|
+
]);
|
|
6924
|
+
if (fromThoughtSignature != null) {
|
|
6925
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6926
|
+
}
|
|
6889
6927
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6890
6928
|
'codeExecutionResult',
|
|
6891
6929
|
]);
|
|
@@ -6934,6 +6972,12 @@ function partFromVertex$1(apiClient, fromObject) {
|
|
|
6934
6972
|
if (fromFileData != null) {
|
|
6935
6973
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex$1(apiClient, fromFileData));
|
|
6936
6974
|
}
|
|
6975
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
6976
|
+
'thoughtSignature',
|
|
6977
|
+
]);
|
|
6978
|
+
if (fromThoughtSignature != null) {
|
|
6979
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
6980
|
+
}
|
|
6937
6981
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
6938
6982
|
'codeExecutionResult',
|
|
6939
6983
|
]);
|
|
@@ -7724,7 +7768,7 @@ function liveMusicServerMessageFromMldev(apiClient, fromObject) {
|
|
|
7724
7768
|
* Copyright 2025 Google LLC
|
|
7725
7769
|
* SPDX-License-Identifier: Apache-2.0
|
|
7726
7770
|
*/
|
|
7727
|
-
function videoMetadataToMldev(apiClient, fromObject) {
|
|
7771
|
+
function videoMetadataToMldev$1(apiClient, fromObject) {
|
|
7728
7772
|
const toObject = {};
|
|
7729
7773
|
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
7730
7774
|
if (fromFps != null) {
|
|
@@ -7740,7 +7784,7 @@ function videoMetadataToMldev(apiClient, fromObject) {
|
|
|
7740
7784
|
}
|
|
7741
7785
|
return toObject;
|
|
7742
7786
|
}
|
|
7743
|
-
function blobToMldev(apiClient, fromObject) {
|
|
7787
|
+
function blobToMldev$1(apiClient, fromObject) {
|
|
7744
7788
|
const toObject = {};
|
|
7745
7789
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7746
7790
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7755,7 +7799,7 @@ function blobToMldev(apiClient, fromObject) {
|
|
|
7755
7799
|
}
|
|
7756
7800
|
return toObject;
|
|
7757
7801
|
}
|
|
7758
|
-
function fileDataToMldev(apiClient, fromObject) {
|
|
7802
|
+
function fileDataToMldev$1(apiClient, fromObject) {
|
|
7759
7803
|
const toObject = {};
|
|
7760
7804
|
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7761
7805
|
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
@@ -7770,13 +7814,13 @@ function fileDataToMldev(apiClient, fromObject) {
|
|
|
7770
7814
|
}
|
|
7771
7815
|
return toObject;
|
|
7772
7816
|
}
|
|
7773
|
-
function partToMldev(apiClient, fromObject) {
|
|
7817
|
+
function partToMldev$1(apiClient, fromObject) {
|
|
7774
7818
|
const toObject = {};
|
|
7775
7819
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
7776
7820
|
'videoMetadata',
|
|
7777
7821
|
]);
|
|
7778
7822
|
if (fromVideoMetadata != null) {
|
|
7779
|
-
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
7823
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$1(apiClient, fromVideoMetadata));
|
|
7780
7824
|
}
|
|
7781
7825
|
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
7782
7826
|
if (fromThought != null) {
|
|
@@ -7784,11 +7828,17 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7784
7828
|
}
|
|
7785
7829
|
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7786
7830
|
if (fromInlineData != null) {
|
|
7787
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
7831
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(apiClient, fromInlineData));
|
|
7788
7832
|
}
|
|
7789
7833
|
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
7790
7834
|
if (fromFileData != null) {
|
|
7791
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
7835
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$1(apiClient, fromFileData));
|
|
7836
|
+
}
|
|
7837
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
7838
|
+
'thoughtSignature',
|
|
7839
|
+
]);
|
|
7840
|
+
if (fromThoughtSignature != null) {
|
|
7841
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7792
7842
|
}
|
|
7793
7843
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
7794
7844
|
'codeExecutionResult',
|
|
@@ -7818,14 +7868,14 @@ function partToMldev(apiClient, fromObject) {
|
|
|
7818
7868
|
}
|
|
7819
7869
|
return toObject;
|
|
7820
7870
|
}
|
|
7821
|
-
function contentToMldev(apiClient, fromObject) {
|
|
7871
|
+
function contentToMldev$1(apiClient, fromObject) {
|
|
7822
7872
|
const toObject = {};
|
|
7823
7873
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
7824
7874
|
if (fromParts != null) {
|
|
7825
7875
|
let transformedList = fromParts;
|
|
7826
7876
|
if (Array.isArray(transformedList)) {
|
|
7827
7877
|
transformedList = transformedList.map((item) => {
|
|
7828
|
-
return partToMldev(apiClient, item);
|
|
7878
|
+
return partToMldev$1(apiClient, item);
|
|
7829
7879
|
});
|
|
7830
7880
|
}
|
|
7831
7881
|
setValueByPath(toObject, ['parts'], transformedList);
|
|
@@ -7949,7 +7999,7 @@ function safetySettingToMldev(apiClient, fromObject) {
|
|
|
7949
7999
|
}
|
|
7950
8000
|
return toObject;
|
|
7951
8001
|
}
|
|
7952
|
-
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
8002
|
+
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
7953
8003
|
const toObject = {};
|
|
7954
8004
|
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
7955
8005
|
if (fromBehavior != null) {
|
|
@@ -7973,7 +8023,7 @@ function functionDeclarationToMldev(apiClient, fromObject) {
|
|
|
7973
8023
|
}
|
|
7974
8024
|
return toObject;
|
|
7975
8025
|
}
|
|
7976
|
-
function intervalToMldev(apiClient, fromObject) {
|
|
8026
|
+
function intervalToMldev$1(apiClient, fromObject) {
|
|
7977
8027
|
const toObject = {};
|
|
7978
8028
|
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
7979
8029
|
if (fromStartTime != null) {
|
|
@@ -7985,17 +8035,17 @@ function intervalToMldev(apiClient, fromObject) {
|
|
|
7985
8035
|
}
|
|
7986
8036
|
return toObject;
|
|
7987
8037
|
}
|
|
7988
|
-
function googleSearchToMldev(apiClient, fromObject) {
|
|
8038
|
+
function googleSearchToMldev$1(apiClient, fromObject) {
|
|
7989
8039
|
const toObject = {};
|
|
7990
8040
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
7991
8041
|
'timeRangeFilter',
|
|
7992
8042
|
]);
|
|
7993
8043
|
if (fromTimeRangeFilter != null) {
|
|
7994
|
-
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
8044
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(apiClient, fromTimeRangeFilter));
|
|
7995
8045
|
}
|
|
7996
8046
|
return toObject;
|
|
7997
8047
|
}
|
|
7998
|
-
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
8048
|
+
function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
7999
8049
|
const toObject = {};
|
|
8000
8050
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
8001
8051
|
if (fromMode != null) {
|
|
@@ -8009,21 +8059,21 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
|
8009
8059
|
}
|
|
8010
8060
|
return toObject;
|
|
8011
8061
|
}
|
|
8012
|
-
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
8062
|
+
function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
8013
8063
|
const toObject = {};
|
|
8014
8064
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
8015
8065
|
'dynamicRetrievalConfig',
|
|
8016
8066
|
]);
|
|
8017
8067
|
if (fromDynamicRetrievalConfig != null) {
|
|
8018
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
8068
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
|
|
8019
8069
|
}
|
|
8020
8070
|
return toObject;
|
|
8021
8071
|
}
|
|
8022
|
-
function urlContextToMldev() {
|
|
8072
|
+
function urlContextToMldev$1() {
|
|
8023
8073
|
const toObject = {};
|
|
8024
8074
|
return toObject;
|
|
8025
8075
|
}
|
|
8026
|
-
function toolToMldev(apiClient, fromObject) {
|
|
8076
|
+
function toolToMldev$1(apiClient, fromObject) {
|
|
8027
8077
|
const toObject = {};
|
|
8028
8078
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
8029
8079
|
'functionDeclarations',
|
|
@@ -8032,7 +8082,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
8032
8082
|
let transformedList = fromFunctionDeclarations;
|
|
8033
8083
|
if (Array.isArray(transformedList)) {
|
|
8034
8084
|
transformedList = transformedList.map((item) => {
|
|
8035
|
-
return functionDeclarationToMldev(apiClient, item);
|
|
8085
|
+
return functionDeclarationToMldev$1(apiClient, item);
|
|
8036
8086
|
});
|
|
8037
8087
|
}
|
|
8038
8088
|
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
@@ -8042,13 +8092,13 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
8042
8092
|
}
|
|
8043
8093
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
8044
8094
|
if (fromGoogleSearch != null) {
|
|
8045
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
8095
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(apiClient, fromGoogleSearch));
|
|
8046
8096
|
}
|
|
8047
8097
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
8048
8098
|
'googleSearchRetrieval',
|
|
8049
8099
|
]);
|
|
8050
8100
|
if (fromGoogleSearchRetrieval != null) {
|
|
8051
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
8101
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
|
|
8052
8102
|
}
|
|
8053
8103
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
8054
8104
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
@@ -8058,7 +8108,7 @@ function toolToMldev(apiClient, fromObject) {
|
|
|
8058
8108
|
}
|
|
8059
8109
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
8060
8110
|
if (fromUrlContext != null) {
|
|
8061
|
-
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
8111
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
|
|
8062
8112
|
}
|
|
8063
8113
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8064
8114
|
'codeExecution',
|
|
@@ -8122,7 +8172,7 @@ function toolConfigToMldev(apiClient, fromObject) {
|
|
|
8122
8172
|
}
|
|
8123
8173
|
return toObject;
|
|
8124
8174
|
}
|
|
8125
|
-
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
8175
|
+
function prebuiltVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
8126
8176
|
const toObject = {};
|
|
8127
8177
|
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
8128
8178
|
if (fromVoiceName != null) {
|
|
@@ -8130,17 +8180,17 @@ function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
8130
8180
|
}
|
|
8131
8181
|
return toObject;
|
|
8132
8182
|
}
|
|
8133
|
-
function voiceConfigToMldev(apiClient, fromObject) {
|
|
8183
|
+
function voiceConfigToMldev$1(apiClient, fromObject) {
|
|
8134
8184
|
const toObject = {};
|
|
8135
8185
|
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
8136
8186
|
'prebuiltVoiceConfig',
|
|
8137
8187
|
]);
|
|
8138
8188
|
if (fromPrebuiltVoiceConfig != null) {
|
|
8139
|
-
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
8189
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$1(apiClient, fromPrebuiltVoiceConfig));
|
|
8140
8190
|
}
|
|
8141
8191
|
return toObject;
|
|
8142
8192
|
}
|
|
8143
|
-
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
8193
|
+
function speakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
8144
8194
|
const toObject = {};
|
|
8145
8195
|
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
8146
8196
|
if (fromSpeaker != null) {
|
|
@@ -8148,11 +8198,11 @@ function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
8148
8198
|
}
|
|
8149
8199
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
8150
8200
|
if (fromVoiceConfig != null) {
|
|
8151
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
8201
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
8152
8202
|
}
|
|
8153
8203
|
return toObject;
|
|
8154
8204
|
}
|
|
8155
|
-
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
8205
|
+
function multiSpeakerVoiceConfigToMldev$1(apiClient, fromObject) {
|
|
8156
8206
|
const toObject = {};
|
|
8157
8207
|
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
8158
8208
|
'speakerVoiceConfigs',
|
|
@@ -8161,24 +8211,24 @@ function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
|
8161
8211
|
let transformedList = fromSpeakerVoiceConfigs;
|
|
8162
8212
|
if (Array.isArray(transformedList)) {
|
|
8163
8213
|
transformedList = transformedList.map((item) => {
|
|
8164
|
-
return speakerVoiceConfigToMldev(apiClient, item);
|
|
8214
|
+
return speakerVoiceConfigToMldev$1(apiClient, item);
|
|
8165
8215
|
});
|
|
8166
8216
|
}
|
|
8167
8217
|
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
8168
8218
|
}
|
|
8169
8219
|
return toObject;
|
|
8170
8220
|
}
|
|
8171
|
-
function speechConfigToMldev(apiClient, fromObject) {
|
|
8221
|
+
function speechConfigToMldev$1(apiClient, fromObject) {
|
|
8172
8222
|
const toObject = {};
|
|
8173
8223
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
8174
8224
|
if (fromVoiceConfig != null) {
|
|
8175
|
-
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
8225
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$1(apiClient, fromVoiceConfig));
|
|
8176
8226
|
}
|
|
8177
8227
|
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
8178
8228
|
'multiSpeakerVoiceConfig',
|
|
8179
8229
|
]);
|
|
8180
8230
|
if (fromMultiSpeakerVoiceConfig != null) {
|
|
8181
|
-
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
8231
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$1(apiClient, fromMultiSpeakerVoiceConfig));
|
|
8182
8232
|
}
|
|
8183
8233
|
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
8184
8234
|
if (fromLanguageCode != null) {
|
|
@@ -8208,7 +8258,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8208
8258
|
'systemInstruction',
|
|
8209
8259
|
]);
|
|
8210
8260
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
8211
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
8261
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
8212
8262
|
}
|
|
8213
8263
|
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
8214
8264
|
if (fromTemperature != null) {
|
|
@@ -8301,7 +8351,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8301
8351
|
let transformedList = tTools(apiClient, fromTools);
|
|
8302
8352
|
if (Array.isArray(transformedList)) {
|
|
8303
8353
|
transformedList = transformedList.map((item) => {
|
|
8304
|
-
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
8354
|
+
return toolToMldev$1(apiClient, tTool(apiClient, item));
|
|
8305
8355
|
});
|
|
8306
8356
|
}
|
|
8307
8357
|
setValueByPath(parentObject, ['tools'], transformedList);
|
|
@@ -8333,7 +8383,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8333
8383
|
}
|
|
8334
8384
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
8335
8385
|
if (fromSpeechConfig != null) {
|
|
8336
|
-
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
8386
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$1(apiClient, tSpeechConfig(apiClient, fromSpeechConfig)));
|
|
8337
8387
|
}
|
|
8338
8388
|
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
8339
8389
|
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
@@ -8357,7 +8407,7 @@ function generateContentParametersToMldev(apiClient, fromObject) {
|
|
|
8357
8407
|
let transformedList = tContents(apiClient, fromContents);
|
|
8358
8408
|
if (Array.isArray(transformedList)) {
|
|
8359
8409
|
transformedList = transformedList.map((item) => {
|
|
8360
|
-
return contentToMldev(apiClient, item);
|
|
8410
|
+
return contentToMldev$1(apiClient, item);
|
|
8361
8411
|
});
|
|
8362
8412
|
}
|
|
8363
8413
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8609,7 +8659,7 @@ function countTokensParametersToMldev(apiClient, fromObject) {
|
|
|
8609
8659
|
let transformedList = tContents(apiClient, fromContents);
|
|
8610
8660
|
if (Array.isArray(transformedList)) {
|
|
8611
8661
|
transformedList = transformedList.map((item) => {
|
|
8612
|
-
return contentToMldev(apiClient, item);
|
|
8662
|
+
return contentToMldev$1(apiClient, item);
|
|
8613
8663
|
});
|
|
8614
8664
|
}
|
|
8615
8665
|
setValueByPath(toObject, ['contents'], transformedList);
|
|
@@ -8680,8 +8730,11 @@ function generateVideosConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8680
8730
|
if (parentObject !== undefined && fromNegativePrompt != null) {
|
|
8681
8731
|
setValueByPath(parentObject, ['parameters', 'negativePrompt'], fromNegativePrompt);
|
|
8682
8732
|
}
|
|
8683
|
-
|
|
8684
|
-
|
|
8733
|
+
const fromEnhancePrompt = getValueByPath(fromObject, [
|
|
8734
|
+
'enhancePrompt',
|
|
8735
|
+
]);
|
|
8736
|
+
if (parentObject !== undefined && fromEnhancePrompt != null) {
|
|
8737
|
+
setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
|
|
8685
8738
|
}
|
|
8686
8739
|
if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
|
|
8687
8740
|
throw new Error('generateAudio parameter is not supported in Gemini API.');
|
|
@@ -8776,6 +8829,12 @@ function partToVertex(apiClient, fromObject) {
|
|
|
8776
8829
|
if (fromFileData != null) {
|
|
8777
8830
|
setValueByPath(toObject, ['fileData'], fileDataToVertex(apiClient, fromFileData));
|
|
8778
8831
|
}
|
|
8832
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
8833
|
+
'thoughtSignature',
|
|
8834
|
+
]);
|
|
8835
|
+
if (fromThoughtSignature != null) {
|
|
8836
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8837
|
+
}
|
|
8779
8838
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8780
8839
|
'codeExecutionResult',
|
|
8781
8840
|
]);
|
|
@@ -9067,6 +9126,10 @@ function googleMapsToVertex(apiClient, fromObject) {
|
|
|
9067
9126
|
}
|
|
9068
9127
|
return toObject;
|
|
9069
9128
|
}
|
|
9129
|
+
function urlContextToVertex() {
|
|
9130
|
+
const toObject = {};
|
|
9131
|
+
return toObject;
|
|
9132
|
+
}
|
|
9070
9133
|
function toolToVertex(apiClient, fromObject) {
|
|
9071
9134
|
const toObject = {};
|
|
9072
9135
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -9105,8 +9168,9 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
9105
9168
|
if (fromGoogleMaps != null) {
|
|
9106
9169
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex(apiClient, fromGoogleMaps));
|
|
9107
9170
|
}
|
|
9108
|
-
|
|
9109
|
-
|
|
9171
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
9172
|
+
if (fromUrlContext != null) {
|
|
9173
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex());
|
|
9110
9174
|
}
|
|
9111
9175
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
9112
9176
|
'codeExecution',
|
|
@@ -10113,6 +10177,12 @@ function partFromMldev(apiClient, fromObject) {
|
|
|
10113
10177
|
if (fromFileData != null) {
|
|
10114
10178
|
setValueByPath(toObject, ['fileData'], fileDataFromMldev(apiClient, fromFileData));
|
|
10115
10179
|
}
|
|
10180
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
10181
|
+
'thoughtSignature',
|
|
10182
|
+
]);
|
|
10183
|
+
if (fromThoughtSignature != null) {
|
|
10184
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10185
|
+
}
|
|
10116
10186
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10117
10187
|
'codeExecutionResult',
|
|
10118
10188
|
]);
|
|
@@ -10631,6 +10701,12 @@ function partFromVertex(apiClient, fromObject) {
|
|
|
10631
10701
|
if (fromFileData != null) {
|
|
10632
10702
|
setValueByPath(toObject, ['fileData'], fileDataFromVertex(apiClient, fromFileData));
|
|
10633
10703
|
}
|
|
10704
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
10705
|
+
'thoughtSignature',
|
|
10706
|
+
]);
|
|
10707
|
+
if (fromThoughtSignature != null) {
|
|
10708
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
10709
|
+
}
|
|
10634
10710
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
10635
10711
|
'codeExecutionResult',
|
|
10636
10712
|
]);
|
|
@@ -10685,6 +10761,34 @@ function citationMetadataFromVertex(apiClient, fromObject) {
|
|
|
10685
10761
|
}
|
|
10686
10762
|
return toObject;
|
|
10687
10763
|
}
|
|
10764
|
+
function urlMetadataFromVertex(apiClient, fromObject) {
|
|
10765
|
+
const toObject = {};
|
|
10766
|
+
const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
|
|
10767
|
+
if (fromRetrievedUrl != null) {
|
|
10768
|
+
setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
|
|
10769
|
+
}
|
|
10770
|
+
const fromUrlRetrievalStatus = getValueByPath(fromObject, [
|
|
10771
|
+
'urlRetrievalStatus',
|
|
10772
|
+
]);
|
|
10773
|
+
if (fromUrlRetrievalStatus != null) {
|
|
10774
|
+
setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
|
|
10775
|
+
}
|
|
10776
|
+
return toObject;
|
|
10777
|
+
}
|
|
10778
|
+
function urlContextMetadataFromVertex(apiClient, fromObject) {
|
|
10779
|
+
const toObject = {};
|
|
10780
|
+
const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
|
|
10781
|
+
if (fromUrlMetadata != null) {
|
|
10782
|
+
let transformedList = fromUrlMetadata;
|
|
10783
|
+
if (Array.isArray(transformedList)) {
|
|
10784
|
+
transformedList = transformedList.map((item) => {
|
|
10785
|
+
return urlMetadataFromVertex(apiClient, item);
|
|
10786
|
+
});
|
|
10787
|
+
}
|
|
10788
|
+
setValueByPath(toObject, ['urlMetadata'], transformedList);
|
|
10789
|
+
}
|
|
10790
|
+
return toObject;
|
|
10791
|
+
}
|
|
10688
10792
|
function candidateFromVertex(apiClient, fromObject) {
|
|
10689
10793
|
const toObject = {};
|
|
10690
10794
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
@@ -10707,6 +10811,12 @@ function candidateFromVertex(apiClient, fromObject) {
|
|
|
10707
10811
|
if (fromFinishReason != null) {
|
|
10708
10812
|
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
10709
10813
|
}
|
|
10814
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
10815
|
+
'urlContextMetadata',
|
|
10816
|
+
]);
|
|
10817
|
+
if (fromUrlContextMetadata != null) {
|
|
10818
|
+
setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromVertex(apiClient, fromUrlContextMetadata));
|
|
10819
|
+
}
|
|
10710
10820
|
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
10711
10821
|
if (fromAvgLogprobs != null) {
|
|
10712
10822
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
@@ -11203,11 +11313,9 @@ function hasNonMcpTools(params) {
|
|
|
11203
11313
|
}
|
|
11204
11314
|
// Returns true if the object is a MCP CallableTool, otherwise false.
|
|
11205
11315
|
function isMcpCallableTool(object) {
|
|
11206
|
-
// TODO: b/418266406 - Add a more robust check for the MCP CallableTool.
|
|
11207
11316
|
return (object !== null &&
|
|
11208
11317
|
typeof object === 'object' &&
|
|
11209
|
-
|
|
11210
|
-
'callTool' in object);
|
|
11318
|
+
object instanceof McpCallableTool);
|
|
11211
11319
|
}
|
|
11212
11320
|
// List all tools from the MCP client.
|
|
11213
11321
|
function listAllTools(mcpClient, maxTools = 100) {
|
|
@@ -11687,7 +11795,14 @@ class Live {
|
|
|
11687
11795
|
}
|
|
11688
11796
|
else {
|
|
11689
11797
|
const apiKey = this.apiClient.getApiKey();
|
|
11690
|
-
|
|
11798
|
+
let method = 'BidiGenerateContent';
|
|
11799
|
+
let keyName = 'key';
|
|
11800
|
+
if (apiKey === null || apiKey === void 0 ? void 0 : apiKey.startsWith('auth_tokens/')) {
|
|
11801
|
+
console.warn('Warning: Ephemeral token support is experimental and may change in future versions.');
|
|
11802
|
+
method = 'BidiGenerateContentConstrained';
|
|
11803
|
+
keyName = 'access_token';
|
|
11804
|
+
}
|
|
11805
|
+
url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.${method}?${keyName}=${apiKey}`;
|
|
11691
11806
|
}
|
|
11692
11807
|
let onopenResolve = () => { };
|
|
11693
11808
|
const onopenPromise = new Promise((resolve) => {
|
|
@@ -11793,7 +11908,7 @@ class Session {
|
|
|
11793
11908
|
contents = contents.map((item) => contentToVertex(apiClient, item));
|
|
11794
11909
|
}
|
|
11795
11910
|
else {
|
|
11796
|
-
contents = contents.map((item) => contentToMldev(apiClient, item));
|
|
11911
|
+
contents = contents.map((item) => contentToMldev$1(apiClient, item));
|
|
11797
11912
|
}
|
|
11798
11913
|
}
|
|
11799
11914
|
catch (_a) {
|
|
@@ -12091,7 +12206,6 @@ class Models extends BaseModule {
|
|
|
12091
12206
|
if (!hasMcpClientTools(params) || shouldDisableAfc(params.config)) {
|
|
12092
12207
|
return await this.generateContentInternal(transformedParams);
|
|
12093
12208
|
}
|
|
12094
|
-
// TODO: b/418266406 - Improve the check for CallableTools and Tools.
|
|
12095
12209
|
if (hasNonMcpTools(params)) {
|
|
12096
12210
|
throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
|
|
12097
12211
|
}
|
|
@@ -13646,27 +13760,862 @@ class Operations extends BaseModule {
|
|
|
13646
13760
|
* Copyright 2025 Google LLC
|
|
13647
13761
|
* SPDX-License-Identifier: Apache-2.0
|
|
13648
13762
|
*/
|
|
13649
|
-
function
|
|
13763
|
+
function prebuiltVoiceConfigToMldev(apiClient, fromObject) {
|
|
13650
13764
|
const toObject = {};
|
|
13651
|
-
const
|
|
13652
|
-
if (
|
|
13653
|
-
setValueByPath(toObject, ['
|
|
13654
|
-
}
|
|
13655
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
13656
|
-
if (fromConfig != null) {
|
|
13657
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
13765
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
13766
|
+
if (fromVoiceName != null) {
|
|
13767
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
13658
13768
|
}
|
|
13659
13769
|
return toObject;
|
|
13660
13770
|
}
|
|
13661
|
-
function
|
|
13771
|
+
function voiceConfigToMldev(apiClient, fromObject) {
|
|
13662
13772
|
const toObject = {};
|
|
13663
|
-
const
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
|
|
13773
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
13774
|
+
'prebuiltVoiceConfig',
|
|
13775
|
+
]);
|
|
13776
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
13777
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev(apiClient, fromPrebuiltVoiceConfig));
|
|
13778
|
+
}
|
|
13779
|
+
return toObject;
|
|
13780
|
+
}
|
|
13781
|
+
function speakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13782
|
+
const toObject = {};
|
|
13783
|
+
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
13784
|
+
if (fromSpeaker != null) {
|
|
13785
|
+
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
13786
|
+
}
|
|
13787
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13788
|
+
if (fromVoiceConfig != null) {
|
|
13789
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13790
|
+
}
|
|
13791
|
+
return toObject;
|
|
13792
|
+
}
|
|
13793
|
+
function multiSpeakerVoiceConfigToMldev(apiClient, fromObject) {
|
|
13794
|
+
const toObject = {};
|
|
13795
|
+
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
13796
|
+
'speakerVoiceConfigs',
|
|
13797
|
+
]);
|
|
13798
|
+
if (fromSpeakerVoiceConfigs != null) {
|
|
13799
|
+
let transformedList = fromSpeakerVoiceConfigs;
|
|
13800
|
+
if (Array.isArray(transformedList)) {
|
|
13801
|
+
transformedList = transformedList.map((item) => {
|
|
13802
|
+
return speakerVoiceConfigToMldev(apiClient, item);
|
|
13803
|
+
});
|
|
13804
|
+
}
|
|
13805
|
+
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
13806
|
+
}
|
|
13807
|
+
return toObject;
|
|
13808
|
+
}
|
|
13809
|
+
function speechConfigToMldev(apiClient, fromObject) {
|
|
13810
|
+
const toObject = {};
|
|
13811
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
13812
|
+
if (fromVoiceConfig != null) {
|
|
13813
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
13814
|
+
}
|
|
13815
|
+
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
13816
|
+
'multiSpeakerVoiceConfig',
|
|
13817
|
+
]);
|
|
13818
|
+
if (fromMultiSpeakerVoiceConfig != null) {
|
|
13819
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev(apiClient, fromMultiSpeakerVoiceConfig));
|
|
13820
|
+
}
|
|
13821
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
13822
|
+
if (fromLanguageCode != null) {
|
|
13823
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
13824
|
+
}
|
|
13825
|
+
return toObject;
|
|
13826
|
+
}
|
|
13827
|
+
function videoMetadataToMldev(apiClient, fromObject) {
|
|
13828
|
+
const toObject = {};
|
|
13829
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
13830
|
+
if (fromFps != null) {
|
|
13831
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
13832
|
+
}
|
|
13833
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
13834
|
+
if (fromEndOffset != null) {
|
|
13835
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
13836
|
+
}
|
|
13837
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
13838
|
+
if (fromStartOffset != null) {
|
|
13839
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
13840
|
+
}
|
|
13841
|
+
return toObject;
|
|
13842
|
+
}
|
|
13843
|
+
function blobToMldev(apiClient, fromObject) {
|
|
13844
|
+
const toObject = {};
|
|
13845
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13846
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13847
|
+
}
|
|
13848
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
13849
|
+
if (fromData != null) {
|
|
13850
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
13851
|
+
}
|
|
13852
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13853
|
+
if (fromMimeType != null) {
|
|
13854
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13855
|
+
}
|
|
13856
|
+
return toObject;
|
|
13857
|
+
}
|
|
13858
|
+
function fileDataToMldev(apiClient, fromObject) {
|
|
13859
|
+
const toObject = {};
|
|
13860
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13861
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13862
|
+
}
|
|
13863
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
13864
|
+
if (fromFileUri != null) {
|
|
13865
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
13866
|
+
}
|
|
13867
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13868
|
+
if (fromMimeType != null) {
|
|
13869
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
13870
|
+
}
|
|
13871
|
+
return toObject;
|
|
13872
|
+
}
|
|
13873
|
+
function partToMldev(apiClient, fromObject) {
|
|
13874
|
+
const toObject = {};
|
|
13875
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
13876
|
+
'videoMetadata',
|
|
13877
|
+
]);
|
|
13878
|
+
if (fromVideoMetadata != null) {
|
|
13879
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev(apiClient, fromVideoMetadata));
|
|
13880
|
+
}
|
|
13881
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
13882
|
+
if (fromThought != null) {
|
|
13883
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
13884
|
+
}
|
|
13885
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
13886
|
+
if (fromInlineData != null) {
|
|
13887
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(apiClient, fromInlineData));
|
|
13888
|
+
}
|
|
13889
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
13890
|
+
if (fromFileData != null) {
|
|
13891
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev(apiClient, fromFileData));
|
|
13892
|
+
}
|
|
13893
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
13894
|
+
'thoughtSignature',
|
|
13895
|
+
]);
|
|
13896
|
+
if (fromThoughtSignature != null) {
|
|
13897
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
13898
|
+
}
|
|
13899
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
13900
|
+
'codeExecutionResult',
|
|
13901
|
+
]);
|
|
13902
|
+
if (fromCodeExecutionResult != null) {
|
|
13903
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
13904
|
+
}
|
|
13905
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
13906
|
+
'executableCode',
|
|
13907
|
+
]);
|
|
13908
|
+
if (fromExecutableCode != null) {
|
|
13909
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
13910
|
+
}
|
|
13911
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
13912
|
+
if (fromFunctionCall != null) {
|
|
13913
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
13914
|
+
}
|
|
13915
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
13916
|
+
'functionResponse',
|
|
13917
|
+
]);
|
|
13918
|
+
if (fromFunctionResponse != null) {
|
|
13919
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
13920
|
+
}
|
|
13921
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
13922
|
+
if (fromText != null) {
|
|
13923
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
13924
|
+
}
|
|
13925
|
+
return toObject;
|
|
13926
|
+
}
|
|
13927
|
+
function contentToMldev(apiClient, fromObject) {
|
|
13928
|
+
const toObject = {};
|
|
13929
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
13930
|
+
if (fromParts != null) {
|
|
13931
|
+
let transformedList = fromParts;
|
|
13932
|
+
if (Array.isArray(transformedList)) {
|
|
13933
|
+
transformedList = transformedList.map((item) => {
|
|
13934
|
+
return partToMldev(apiClient, item);
|
|
13935
|
+
});
|
|
13936
|
+
}
|
|
13937
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
13938
|
+
}
|
|
13939
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
13940
|
+
if (fromRole != null) {
|
|
13941
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
13942
|
+
}
|
|
13943
|
+
return toObject;
|
|
13944
|
+
}
|
|
13945
|
+
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
13946
|
+
const toObject = {};
|
|
13947
|
+
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
13948
|
+
if (fromBehavior != null) {
|
|
13949
|
+
setValueByPath(toObject, ['behavior'], fromBehavior);
|
|
13950
|
+
}
|
|
13951
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
13952
|
+
if (fromDescription != null) {
|
|
13953
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
13954
|
+
}
|
|
13955
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
13956
|
+
if (fromName != null) {
|
|
13957
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
13958
|
+
}
|
|
13959
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
13960
|
+
if (fromParameters != null) {
|
|
13961
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
13962
|
+
}
|
|
13963
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
13964
|
+
if (fromResponse != null) {
|
|
13965
|
+
setValueByPath(toObject, ['response'], fromResponse);
|
|
13966
|
+
}
|
|
13967
|
+
return toObject;
|
|
13968
|
+
}
|
|
13969
|
+
function intervalToMldev(apiClient, fromObject) {
|
|
13970
|
+
const toObject = {};
|
|
13971
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
13972
|
+
if (fromStartTime != null) {
|
|
13973
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
13974
|
+
}
|
|
13975
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
13976
|
+
if (fromEndTime != null) {
|
|
13977
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
13978
|
+
}
|
|
13979
|
+
return toObject;
|
|
13980
|
+
}
|
|
13981
|
+
function googleSearchToMldev(apiClient, fromObject) {
|
|
13982
|
+
const toObject = {};
|
|
13983
|
+
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
13984
|
+
'timeRangeFilter',
|
|
13985
|
+
]);
|
|
13986
|
+
if (fromTimeRangeFilter != null) {
|
|
13987
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(apiClient, fromTimeRangeFilter));
|
|
13988
|
+
}
|
|
13989
|
+
return toObject;
|
|
13990
|
+
}
|
|
13991
|
+
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
13992
|
+
const toObject = {};
|
|
13993
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
13994
|
+
if (fromMode != null) {
|
|
13995
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
13996
|
+
}
|
|
13997
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
13998
|
+
'dynamicThreshold',
|
|
13999
|
+
]);
|
|
14000
|
+
if (fromDynamicThreshold != null) {
|
|
14001
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
14002
|
+
}
|
|
14003
|
+
return toObject;
|
|
14004
|
+
}
|
|
14005
|
+
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
14006
|
+
const toObject = {};
|
|
14007
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
14008
|
+
'dynamicRetrievalConfig',
|
|
14009
|
+
]);
|
|
14010
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
14011
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
14012
|
+
}
|
|
14013
|
+
return toObject;
|
|
14014
|
+
}
|
|
14015
|
+
function urlContextToMldev() {
|
|
14016
|
+
const toObject = {};
|
|
14017
|
+
return toObject;
|
|
14018
|
+
}
|
|
14019
|
+
function toolToMldev(apiClient, fromObject) {
|
|
14020
|
+
const toObject = {};
|
|
14021
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14022
|
+
'functionDeclarations',
|
|
14023
|
+
]);
|
|
14024
|
+
if (fromFunctionDeclarations != null) {
|
|
14025
|
+
let transformedList = fromFunctionDeclarations;
|
|
14026
|
+
if (Array.isArray(transformedList)) {
|
|
14027
|
+
transformedList = transformedList.map((item) => {
|
|
14028
|
+
return functionDeclarationToMldev(apiClient, item);
|
|
14029
|
+
});
|
|
14030
|
+
}
|
|
14031
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14032
|
+
}
|
|
14033
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
14034
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
14035
|
+
}
|
|
14036
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
14037
|
+
if (fromGoogleSearch != null) {
|
|
14038
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(apiClient, fromGoogleSearch));
|
|
14039
|
+
}
|
|
14040
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14041
|
+
'googleSearchRetrieval',
|
|
14042
|
+
]);
|
|
14043
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
14044
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev(apiClient, fromGoogleSearchRetrieval));
|
|
14045
|
+
}
|
|
14046
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
14047
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
14048
|
+
}
|
|
14049
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
14050
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
14051
|
+
}
|
|
14052
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
14053
|
+
if (fromUrlContext != null) {
|
|
14054
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
14055
|
+
}
|
|
14056
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
14057
|
+
'codeExecution',
|
|
14058
|
+
]);
|
|
14059
|
+
if (fromCodeExecution != null) {
|
|
14060
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
14061
|
+
}
|
|
14062
|
+
return toObject;
|
|
14063
|
+
}
|
|
14064
|
+
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
14065
|
+
const toObject = {};
|
|
14066
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
14067
|
+
if (fromHandle != null) {
|
|
14068
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
14069
|
+
}
|
|
14070
|
+
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
14071
|
+
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
14072
|
+
}
|
|
14073
|
+
return toObject;
|
|
14074
|
+
}
|
|
14075
|
+
function audioTranscriptionConfigToMldev() {
|
|
14076
|
+
const toObject = {};
|
|
14077
|
+
return toObject;
|
|
14078
|
+
}
|
|
14079
|
+
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
14080
|
+
const toObject = {};
|
|
14081
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
14082
|
+
if (fromDisabled != null) {
|
|
14083
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
14084
|
+
}
|
|
14085
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
14086
|
+
'startOfSpeechSensitivity',
|
|
14087
|
+
]);
|
|
14088
|
+
if (fromStartOfSpeechSensitivity != null) {
|
|
14089
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
14090
|
+
}
|
|
14091
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
14092
|
+
'endOfSpeechSensitivity',
|
|
14093
|
+
]);
|
|
14094
|
+
if (fromEndOfSpeechSensitivity != null) {
|
|
14095
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
14096
|
+
}
|
|
14097
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
14098
|
+
'prefixPaddingMs',
|
|
14099
|
+
]);
|
|
14100
|
+
if (fromPrefixPaddingMs != null) {
|
|
14101
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
14102
|
+
}
|
|
14103
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
14104
|
+
'silenceDurationMs',
|
|
14105
|
+
]);
|
|
14106
|
+
if (fromSilenceDurationMs != null) {
|
|
14107
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
14108
|
+
}
|
|
14109
|
+
return toObject;
|
|
14110
|
+
}
|
|
14111
|
+
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
14112
|
+
const toObject = {};
|
|
14113
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
14114
|
+
'automaticActivityDetection',
|
|
14115
|
+
]);
|
|
14116
|
+
if (fromAutomaticActivityDetection != null) {
|
|
14117
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
14118
|
+
}
|
|
14119
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
14120
|
+
'activityHandling',
|
|
14121
|
+
]);
|
|
14122
|
+
if (fromActivityHandling != null) {
|
|
14123
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
14124
|
+
}
|
|
14125
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
14126
|
+
if (fromTurnCoverage != null) {
|
|
14127
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
14128
|
+
}
|
|
14129
|
+
return toObject;
|
|
14130
|
+
}
|
|
14131
|
+
function slidingWindowToMldev(apiClient, fromObject) {
|
|
14132
|
+
const toObject = {};
|
|
14133
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
14134
|
+
if (fromTargetTokens != null) {
|
|
14135
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
14136
|
+
}
|
|
14137
|
+
return toObject;
|
|
14138
|
+
}
|
|
14139
|
+
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
14140
|
+
const toObject = {};
|
|
14141
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
14142
|
+
'triggerTokens',
|
|
14143
|
+
]);
|
|
14144
|
+
if (fromTriggerTokens != null) {
|
|
14145
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
14146
|
+
}
|
|
14147
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
14148
|
+
'slidingWindow',
|
|
14149
|
+
]);
|
|
14150
|
+
if (fromSlidingWindow != null) {
|
|
14151
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
14152
|
+
}
|
|
14153
|
+
return toObject;
|
|
14154
|
+
}
|
|
14155
|
+
function proactivityConfigToMldev(apiClient, fromObject) {
|
|
14156
|
+
const toObject = {};
|
|
14157
|
+
const fromProactiveAudio = getValueByPath(fromObject, [
|
|
14158
|
+
'proactiveAudio',
|
|
14159
|
+
]);
|
|
14160
|
+
if (fromProactiveAudio != null) {
|
|
14161
|
+
setValueByPath(toObject, ['proactiveAudio'], fromProactiveAudio);
|
|
14162
|
+
}
|
|
14163
|
+
return toObject;
|
|
14164
|
+
}
|
|
14165
|
+
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14166
|
+
const toObject = {};
|
|
14167
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
14168
|
+
'generationConfig',
|
|
14169
|
+
]);
|
|
14170
|
+
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
14171
|
+
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
14172
|
+
}
|
|
14173
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
14174
|
+
'responseModalities',
|
|
14175
|
+
]);
|
|
14176
|
+
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
14177
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
14178
|
+
}
|
|
14179
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
14180
|
+
if (parentObject !== undefined && fromTemperature != null) {
|
|
14181
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
14182
|
+
}
|
|
14183
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
14184
|
+
if (parentObject !== undefined && fromTopP != null) {
|
|
14185
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
14186
|
+
}
|
|
14187
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
14188
|
+
if (parentObject !== undefined && fromTopK != null) {
|
|
14189
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
14190
|
+
}
|
|
14191
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
14192
|
+
'maxOutputTokens',
|
|
14193
|
+
]);
|
|
14194
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
14195
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
14196
|
+
}
|
|
14197
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
14198
|
+
'mediaResolution',
|
|
14199
|
+
]);
|
|
14200
|
+
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
14201
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
14202
|
+
}
|
|
14203
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
14204
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
14205
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
14206
|
+
}
|
|
14207
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
14208
|
+
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
14209
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], speechConfigToMldev(apiClient, tLiveSpeechConfig(apiClient, fromSpeechConfig)));
|
|
14210
|
+
}
|
|
14211
|
+
const fromEnableAffectiveDialog = getValueByPath(fromObject, [
|
|
14212
|
+
'enableAffectiveDialog',
|
|
14213
|
+
]);
|
|
14214
|
+
if (parentObject !== undefined && fromEnableAffectiveDialog != null) {
|
|
14215
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'enableAffectiveDialog'], fromEnableAffectiveDialog);
|
|
14216
|
+
}
|
|
14217
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
14218
|
+
'systemInstruction',
|
|
14219
|
+
]);
|
|
14220
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
14221
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
14222
|
+
}
|
|
14223
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
14224
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
14225
|
+
let transformedList = tTools(apiClient, fromTools);
|
|
14226
|
+
if (Array.isArray(transformedList)) {
|
|
14227
|
+
transformedList = transformedList.map((item) => {
|
|
14228
|
+
return toolToMldev(apiClient, tTool(apiClient, item));
|
|
14229
|
+
});
|
|
14230
|
+
}
|
|
14231
|
+
setValueByPath(parentObject, ['setup', 'tools'], transformedList);
|
|
14232
|
+
}
|
|
14233
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
14234
|
+
'sessionResumption',
|
|
14235
|
+
]);
|
|
14236
|
+
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
14237
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
14238
|
+
}
|
|
14239
|
+
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
14240
|
+
'inputAudioTranscription',
|
|
14241
|
+
]);
|
|
14242
|
+
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
14243
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14244
|
+
}
|
|
14245
|
+
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
14246
|
+
'outputAudioTranscription',
|
|
14247
|
+
]);
|
|
14248
|
+
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
14249
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
14250
|
+
}
|
|
14251
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
14252
|
+
'realtimeInputConfig',
|
|
14253
|
+
]);
|
|
14254
|
+
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
14255
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
14256
|
+
}
|
|
14257
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
14258
|
+
'contextWindowCompression',
|
|
14259
|
+
]);
|
|
14260
|
+
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
14261
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
14262
|
+
}
|
|
14263
|
+
const fromProactivity = getValueByPath(fromObject, ['proactivity']);
|
|
14264
|
+
if (parentObject !== undefined && fromProactivity != null) {
|
|
14265
|
+
setValueByPath(parentObject, ['setup', 'proactivity'], proactivityConfigToMldev(apiClient, fromProactivity));
|
|
14266
|
+
}
|
|
14267
|
+
return toObject;
|
|
14268
|
+
}
|
|
14269
|
+
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
14270
|
+
const toObject = {};
|
|
14271
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
14272
|
+
if (fromModel != null) {
|
|
14273
|
+
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
14274
|
+
}
|
|
14275
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14276
|
+
if (fromConfig != null) {
|
|
14277
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
14278
|
+
}
|
|
14279
|
+
return toObject;
|
|
14280
|
+
}
|
|
14281
|
+
function createAuthTokenConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14282
|
+
const toObject = {};
|
|
14283
|
+
const fromExpireTime = getValueByPath(fromObject, ['expireTime']);
|
|
14284
|
+
if (parentObject !== undefined && fromExpireTime != null) {
|
|
14285
|
+
setValueByPath(parentObject, ['expireTime'], fromExpireTime);
|
|
14286
|
+
}
|
|
14287
|
+
const fromNewSessionExpireTime = getValueByPath(fromObject, [
|
|
14288
|
+
'newSessionExpireTime',
|
|
14289
|
+
]);
|
|
14290
|
+
if (parentObject !== undefined && fromNewSessionExpireTime != null) {
|
|
14291
|
+
setValueByPath(parentObject, ['newSessionExpireTime'], fromNewSessionExpireTime);
|
|
14292
|
+
}
|
|
14293
|
+
const fromUses = getValueByPath(fromObject, ['uses']);
|
|
14294
|
+
if (parentObject !== undefined && fromUses != null) {
|
|
14295
|
+
setValueByPath(parentObject, ['uses'], fromUses);
|
|
14296
|
+
}
|
|
14297
|
+
const fromLiveConnectConstraints = getValueByPath(fromObject, [
|
|
14298
|
+
'liveConnectConstraints',
|
|
14299
|
+
]);
|
|
14300
|
+
if (parentObject !== undefined && fromLiveConnectConstraints != null) {
|
|
14301
|
+
setValueByPath(parentObject, ['bidiGenerateContentSetup'], liveConnectConstraintsToMldev(apiClient, fromLiveConnectConstraints));
|
|
14302
|
+
}
|
|
14303
|
+
const fromLockAdditionalFields = getValueByPath(fromObject, [
|
|
14304
|
+
'lockAdditionalFields',
|
|
14305
|
+
]);
|
|
14306
|
+
if (parentObject !== undefined && fromLockAdditionalFields != null) {
|
|
14307
|
+
setValueByPath(parentObject, ['fieldMask'], fromLockAdditionalFields);
|
|
14308
|
+
}
|
|
14309
|
+
return toObject;
|
|
14310
|
+
}
|
|
14311
|
+
function createAuthTokenParametersToMldev(apiClient, fromObject) {
|
|
14312
|
+
const toObject = {};
|
|
14313
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14314
|
+
if (fromConfig != null) {
|
|
14315
|
+
setValueByPath(toObject, ['config'], createAuthTokenConfigToMldev(apiClient, fromConfig, toObject));
|
|
14316
|
+
}
|
|
14317
|
+
return toObject;
|
|
14318
|
+
}
|
|
14319
|
+
function authTokenFromMldev(apiClient, fromObject) {
|
|
14320
|
+
const toObject = {};
|
|
14321
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14322
|
+
if (fromName != null) {
|
|
14323
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
14324
|
+
}
|
|
14325
|
+
return toObject;
|
|
14326
|
+
}
|
|
14327
|
+
|
|
14328
|
+
/**
|
|
14329
|
+
* @license
|
|
14330
|
+
* Copyright 2025 Google LLC
|
|
14331
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14332
|
+
*/
|
|
14333
|
+
/**
|
|
14334
|
+
* Returns a comma-separated list of field masks from a given object.
|
|
14335
|
+
*
|
|
14336
|
+
* @param setup The object to extract field masks from.
|
|
14337
|
+
* @return A comma-separated list of field masks.
|
|
14338
|
+
*/
|
|
14339
|
+
function getFieldMasks(setup) {
|
|
14340
|
+
const fields = [];
|
|
14341
|
+
for (const key in setup) {
|
|
14342
|
+
if (Object.prototype.hasOwnProperty.call(setup, key)) {
|
|
14343
|
+
const value = setup[key];
|
|
14344
|
+
// 2nd layer, recursively get field masks see TODO(b/418290100)
|
|
14345
|
+
if (typeof value === 'object' &&
|
|
14346
|
+
value != null &&
|
|
14347
|
+
Object.keys(value).length > 0) {
|
|
14348
|
+
const field = Object.keys(value).map((kk) => `${key}.${kk}`);
|
|
14349
|
+
fields.push(...field);
|
|
14350
|
+
}
|
|
14351
|
+
else {
|
|
14352
|
+
fields.push(key); // 1st layer
|
|
14353
|
+
}
|
|
14354
|
+
}
|
|
14355
|
+
}
|
|
14356
|
+
return fields.join(',');
|
|
14357
|
+
}
|
|
14358
|
+
/**
|
|
14359
|
+
* Converts bidiGenerateContentSetup.
|
|
14360
|
+
* @param requestDict - The request dictionary.
|
|
14361
|
+
* @param config - The configuration object.
|
|
14362
|
+
* @return - The modified request dictionary.
|
|
14363
|
+
*/
|
|
14364
|
+
function convertBidiSetupToTokenSetup(requestDict, config) {
|
|
14365
|
+
// Convert bidiGenerateContentSetup from bidiGenerateContentSetup.setup.
|
|
14366
|
+
let setupForMaskGeneration = null;
|
|
14367
|
+
const bidiGenerateContentSetupValue = requestDict['bidiGenerateContentSetup'];
|
|
14368
|
+
if (typeof bidiGenerateContentSetupValue === 'object' &&
|
|
14369
|
+
bidiGenerateContentSetupValue !== null &&
|
|
14370
|
+
'setup' in bidiGenerateContentSetupValue) {
|
|
14371
|
+
// Now we know bidiGenerateContentSetupValue is an object and has a 'setup'
|
|
14372
|
+
// property.
|
|
14373
|
+
const innerSetup = bidiGenerateContentSetupValue
|
|
14374
|
+
.setup;
|
|
14375
|
+
if (typeof innerSetup === 'object' && innerSetup !== null) {
|
|
14376
|
+
// Valid inner setup found.
|
|
14377
|
+
requestDict['bidiGenerateContentSetup'] = innerSetup;
|
|
14378
|
+
setupForMaskGeneration = innerSetup;
|
|
14379
|
+
}
|
|
14380
|
+
else {
|
|
14381
|
+
// `bidiGenerateContentSetupValue.setup` is not a valid object; treat as
|
|
14382
|
+
// if bidiGenerateContentSetup is invalid.
|
|
14383
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14384
|
+
}
|
|
14385
|
+
}
|
|
14386
|
+
else if (bidiGenerateContentSetupValue !== undefined) {
|
|
14387
|
+
// `bidiGenerateContentSetup` exists but not in the expected
|
|
14388
|
+
// shape {setup: {...}}; treat as invalid.
|
|
14389
|
+
delete requestDict['bidiGenerateContentSetup'];
|
|
14390
|
+
}
|
|
14391
|
+
const preExistingFieldMask = requestDict['fieldMask'];
|
|
14392
|
+
// Handle mask generation setup.
|
|
14393
|
+
if (setupForMaskGeneration) {
|
|
14394
|
+
const generatedMaskFromBidi = getFieldMasks(setupForMaskGeneration);
|
|
14395
|
+
if (Array.isArray(config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14396
|
+
(config === null || config === void 0 ? void 0 : config.lockAdditionalFields.length) === 0) {
|
|
14397
|
+
// Case 1: lockAdditionalFields is an empty array. Lock only fields from
|
|
14398
|
+
// bidi setup.
|
|
14399
|
+
if (generatedMaskFromBidi) {
|
|
14400
|
+
// Only assign if mask is not empty
|
|
14401
|
+
requestDict['fieldMask'] = generatedMaskFromBidi;
|
|
14402
|
+
}
|
|
14403
|
+
else {
|
|
14404
|
+
delete requestDict['fieldMask']; // If mask is empty, effectively no
|
|
14405
|
+
// specific fields locked by bidi
|
|
14406
|
+
}
|
|
14407
|
+
}
|
|
14408
|
+
else if ((config === null || config === void 0 ? void 0 : config.lockAdditionalFields) &&
|
|
14409
|
+
config.lockAdditionalFields.length > 0 &&
|
|
14410
|
+
preExistingFieldMask !== null &&
|
|
14411
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14412
|
+
preExistingFieldMask.length > 0) {
|
|
14413
|
+
// Case 2: Lock fields from bidi setup + additional fields
|
|
14414
|
+
// (preExistingFieldMask).
|
|
14415
|
+
const generationConfigFields = [
|
|
14416
|
+
'temperature',
|
|
14417
|
+
'topK',
|
|
14418
|
+
'topP',
|
|
14419
|
+
'maxOutputTokens',
|
|
14420
|
+
'responseModalities',
|
|
14421
|
+
'seed',
|
|
14422
|
+
'speechConfig',
|
|
14423
|
+
];
|
|
14424
|
+
let mappedFieldsFromPreExisting = [];
|
|
14425
|
+
if (preExistingFieldMask.length > 0) {
|
|
14426
|
+
mappedFieldsFromPreExisting = preExistingFieldMask.map((field) => {
|
|
14427
|
+
if (generationConfigFields.includes(field)) {
|
|
14428
|
+
return `generationConfig.${field}`;
|
|
14429
|
+
}
|
|
14430
|
+
return field; // Keep original field name if not in
|
|
14431
|
+
// generationConfigFields
|
|
14432
|
+
});
|
|
14433
|
+
}
|
|
14434
|
+
const finalMaskParts = [];
|
|
14435
|
+
if (generatedMaskFromBidi) {
|
|
14436
|
+
finalMaskParts.push(generatedMaskFromBidi);
|
|
14437
|
+
}
|
|
14438
|
+
if (mappedFieldsFromPreExisting.length > 0) {
|
|
14439
|
+
finalMaskParts.push(...mappedFieldsFromPreExisting);
|
|
14440
|
+
}
|
|
14441
|
+
if (finalMaskParts.length > 0) {
|
|
14442
|
+
requestDict['fieldMask'] = finalMaskParts.join(',');
|
|
14443
|
+
}
|
|
14444
|
+
else {
|
|
14445
|
+
// If no fields from bidi and no valid additional fields from
|
|
14446
|
+
// pre-existing mask.
|
|
14447
|
+
delete requestDict['fieldMask'];
|
|
14448
|
+
}
|
|
14449
|
+
}
|
|
14450
|
+
else {
|
|
14451
|
+
// Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
|
|
14452
|
+
// defaults apply or all are mutable). This is hit if:
|
|
14453
|
+
// - `config.lockAdditionalFields` is undefined.
|
|
14454
|
+
// - `config.lockAdditionalFields` is non-empty, BUT
|
|
14455
|
+
// `preExistingFieldMask` is null, not a string, or an empty string.
|
|
14456
|
+
delete requestDict['fieldMask'];
|
|
14457
|
+
}
|
|
14458
|
+
}
|
|
14459
|
+
else {
|
|
14460
|
+
// No valid `bidiGenerateContentSetup` was found or extracted.
|
|
14461
|
+
// "Lock additional null fields if any".
|
|
14462
|
+
if (preExistingFieldMask !== null &&
|
|
14463
|
+
Array.isArray(preExistingFieldMask) &&
|
|
14464
|
+
preExistingFieldMask.length > 0) {
|
|
14465
|
+
// If there's a pre-existing field mask, it's a string, and it's not
|
|
14466
|
+
// empty, then we should lock all fields.
|
|
14467
|
+
requestDict['fieldMask'] = preExistingFieldMask.join(',');
|
|
14468
|
+
}
|
|
14469
|
+
else {
|
|
14470
|
+
delete requestDict['fieldMask'];
|
|
14471
|
+
}
|
|
14472
|
+
}
|
|
14473
|
+
return requestDict;
|
|
14474
|
+
}
|
|
14475
|
+
class Tokens extends BaseModule {
|
|
14476
|
+
constructor(apiClient) {
|
|
14477
|
+
super();
|
|
14478
|
+
this.apiClient = apiClient;
|
|
14479
|
+
}
|
|
14480
|
+
/**
|
|
14481
|
+
* Creates an ephemeral auth token resource.
|
|
14482
|
+
*
|
|
14483
|
+
* @experimental
|
|
14484
|
+
*
|
|
14485
|
+
* @remarks
|
|
14486
|
+
* Ephermeral auth tokens is only supported in the Gemini Developer API.
|
|
14487
|
+
* It can be used for the session connection to the Live constrained API.
|
|
14488
|
+
*
|
|
14489
|
+
* @param params - The parameters for the create request.
|
|
14490
|
+
* @return The created auth token.
|
|
14491
|
+
*
|
|
14492
|
+
* @example
|
|
14493
|
+
* ```ts
|
|
14494
|
+
* // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
|
|
14495
|
+
* // when using the token in Live API sessions. Each session connection can
|
|
14496
|
+
* // use a different configuration.
|
|
14497
|
+
* const config: CreateAuthTokenConfig = {
|
|
14498
|
+
* uses: 3,
|
|
14499
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14500
|
+
* }
|
|
14501
|
+
* const token = await ai.tokens.create(config);
|
|
14502
|
+
*
|
|
14503
|
+
* // Case 2: If LiveEphemeralParameters is set, lock all fields in
|
|
14504
|
+
* // LiveConnectConfig when using the token in Live API sessions. For
|
|
14505
|
+
* // example, changing `outputAudioTranscription` in the Live API
|
|
14506
|
+
* // connection will be ignored by the API.
|
|
14507
|
+
* const config: CreateAuthTokenConfig =
|
|
14508
|
+
* uses: 3,
|
|
14509
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14510
|
+
* LiveEphemeralParameters: {
|
|
14511
|
+
* model: 'gemini-2.0-flash-001',
|
|
14512
|
+
* config: {
|
|
14513
|
+
* 'responseModalities': ['AUDIO'],
|
|
14514
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14515
|
+
* }
|
|
14516
|
+
* }
|
|
14517
|
+
* }
|
|
14518
|
+
* const token = await ai.tokens.create(config);
|
|
14519
|
+
*
|
|
14520
|
+
* // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14521
|
+
* // set, lock LiveConnectConfig with set and additional fields (e.g.
|
|
14522
|
+
* // responseModalities, systemInstruction, temperature in this example) when
|
|
14523
|
+
* // using the token in Live API sessions.
|
|
14524
|
+
* const config: CreateAuthTokenConfig =
|
|
14525
|
+
* uses: 3,
|
|
14526
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14527
|
+
* LiveEphemeralParameters: {
|
|
14528
|
+
* model: 'gemini-2.0-flash-001',
|
|
14529
|
+
* config: {
|
|
14530
|
+
* 'responseModalities': ['AUDIO'],
|
|
14531
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14532
|
+
* }
|
|
14533
|
+
* },
|
|
14534
|
+
* lockAdditionalFields: ['temperature'],
|
|
14535
|
+
* }
|
|
14536
|
+
* const token = await ai.tokens.create(config);
|
|
14537
|
+
*
|
|
14538
|
+
* // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
|
|
14539
|
+
* // empty array, lock LiveConnectConfig with set fields (e.g.
|
|
14540
|
+
* // responseModalities, systemInstruction in this example) when using the
|
|
14541
|
+
* // token in Live API sessions.
|
|
14542
|
+
* const config: CreateAuthTokenConfig =
|
|
14543
|
+
* uses: 3,
|
|
14544
|
+
* expireTime: '2025-05-01T00:00:00Z',
|
|
14545
|
+
* LiveEphemeralParameters: {
|
|
14546
|
+
* model: 'gemini-2.0-flash-001',
|
|
14547
|
+
* config: {
|
|
14548
|
+
* 'responseModalities': ['AUDIO'],
|
|
14549
|
+
* 'systemInstruction': 'Always answer in English.',
|
|
14550
|
+
* }
|
|
14551
|
+
* },
|
|
14552
|
+
* lockAdditionalFields: [],
|
|
14553
|
+
* }
|
|
14554
|
+
* const token = await ai.tokens.create(config);
|
|
14555
|
+
* ```
|
|
14556
|
+
*/
|
|
14557
|
+
async create(params) {
|
|
14558
|
+
var _a, _b;
|
|
14559
|
+
let response;
|
|
14560
|
+
let path = '';
|
|
14561
|
+
let queryParams = {};
|
|
14562
|
+
if (this.apiClient.isVertexAI()) {
|
|
14563
|
+
throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
|
|
14564
|
+
}
|
|
14565
|
+
else {
|
|
14566
|
+
const body = createAuthTokenParametersToMldev(this.apiClient, params);
|
|
14567
|
+
path = formatMap('auth_tokens', body['_url']);
|
|
14568
|
+
queryParams = body['_query'];
|
|
14569
|
+
delete body['config'];
|
|
14570
|
+
delete body['_url'];
|
|
14571
|
+
delete body['_query'];
|
|
14572
|
+
const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
|
|
14573
|
+
response = this.apiClient
|
|
14574
|
+
.request({
|
|
14575
|
+
path: path,
|
|
14576
|
+
queryParams: queryParams,
|
|
14577
|
+
body: JSON.stringify(transformedBody),
|
|
14578
|
+
httpMethod: 'POST',
|
|
14579
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
14580
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
14581
|
+
})
|
|
14582
|
+
.then((httpResponse) => {
|
|
14583
|
+
return httpResponse.json();
|
|
14584
|
+
});
|
|
14585
|
+
return response.then((apiResponse) => {
|
|
14586
|
+
const resp = authTokenFromMldev(this.apiClient, apiResponse);
|
|
14587
|
+
return resp;
|
|
14588
|
+
});
|
|
14589
|
+
}
|
|
14590
|
+
}
|
|
14591
|
+
}
|
|
14592
|
+
|
|
14593
|
+
/**
|
|
14594
|
+
* @license
|
|
14595
|
+
* Copyright 2025 Google LLC
|
|
14596
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
14597
|
+
*/
|
|
14598
|
+
function getTuningJobParametersToMldev(apiClient, fromObject) {
|
|
14599
|
+
const toObject = {};
|
|
14600
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
14601
|
+
if (fromName != null) {
|
|
14602
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
14603
|
+
}
|
|
14604
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14605
|
+
if (fromConfig != null) {
|
|
14606
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
14607
|
+
}
|
|
14608
|
+
return toObject;
|
|
14609
|
+
}
|
|
14610
|
+
function listTuningJobsConfigToMldev(apiClient, fromObject, parentObject) {
|
|
14611
|
+
const toObject = {};
|
|
14612
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
14613
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
14614
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
14615
|
+
}
|
|
14616
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
14617
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
14618
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
13670
14619
|
}
|
|
13671
14620
|
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
13672
14621
|
if (parentObject !== undefined && fromFilter != null) {
|
|
@@ -14438,6 +15387,13 @@ class WebAuth {
|
|
|
14438
15387
|
if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
|
|
14439
15388
|
return;
|
|
14440
15389
|
}
|
|
15390
|
+
if (this.apiKey.startsWith('auth_tokens/')) {
|
|
15391
|
+
throw new Error('Ephemeral tokens are only supported by the live API.');
|
|
15392
|
+
}
|
|
15393
|
+
// Check if API key is empty or null
|
|
15394
|
+
if (!this.apiKey) {
|
|
15395
|
+
throw new Error('API key is missing. Please provide a valid API key.');
|
|
15396
|
+
}
|
|
14441
15397
|
headers.append(GOOGLE_API_KEY_HEADER, this.apiKey);
|
|
14442
15398
|
}
|
|
14443
15399
|
}
|
|
@@ -14505,9 +15461,10 @@ class GoogleGenAI {
|
|
|
14505
15461
|
this.caches = new Caches(this.apiClient);
|
|
14506
15462
|
this.files = new Files(this.apiClient);
|
|
14507
15463
|
this.operations = new Operations(this.apiClient);
|
|
15464
|
+
this.authTokens = new Tokens(this.apiClient);
|
|
14508
15465
|
this.tunings = new Tunings(this.apiClient);
|
|
14509
15466
|
}
|
|
14510
15467
|
}
|
|
14511
15468
|
|
|
14512
|
-
export { ActivityHandling, AdapterSize, AuthType, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
15469
|
+
export { ActivityHandling, AdapterSize, AuthType, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
14513
15470
|
//# sourceMappingURL=index.mjs.map
|