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