@google/genai 0.7.0 → 0.9.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 +9 -34
- package/dist/genai.d.ts +530 -57
- package/dist/index.js +1984 -483
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1985 -484
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +2028 -526
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +530 -57
- package/dist/web/index.mjs +2024 -523
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +530 -57
- package/package.json +6 -2
package/dist/web/index.mjs
CHANGED
|
@@ -209,44 +209,25 @@ function _isFunctionCallPart(origin) {
|
|
|
209
209
|
typeof origin === 'object' &&
|
|
210
210
|
'functionCall' in origin);
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
221
|
-
function _areUserParts(origin) {
|
|
222
|
-
if (origin === null ||
|
|
223
|
-
origin === undefined ||
|
|
224
|
-
(Array.isArray(origin) && origin.length === 0)) {
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
return origin.every(_isUserPart);
|
|
212
|
+
function _isFunctionResponsePart(origin) {
|
|
213
|
+
return (origin !== null &&
|
|
214
|
+
origin !== undefined &&
|
|
215
|
+
typeof origin === 'object' &&
|
|
216
|
+
'functionResponse' in origin);
|
|
228
217
|
}
|
|
229
218
|
function tContent(apiClient, origin) {
|
|
230
219
|
if (origin === null || origin === undefined) {
|
|
231
220
|
throw new Error('ContentUnion is required');
|
|
232
221
|
}
|
|
233
222
|
if (_isContent(origin)) {
|
|
234
|
-
//
|
|
223
|
+
// _isContent is a utility function that checks if the
|
|
235
224
|
// origin is a Content.
|
|
236
225
|
return origin;
|
|
237
226
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
return {
|
|
246
|
-
role: 'model',
|
|
247
|
-
parts: tParts(apiClient, origin),
|
|
248
|
-
};
|
|
249
|
-
}
|
|
227
|
+
return {
|
|
228
|
+
role: 'user',
|
|
229
|
+
parts: tParts(apiClient, origin),
|
|
230
|
+
};
|
|
250
231
|
}
|
|
251
232
|
function tContentsForEmbed(apiClient, origin) {
|
|
252
233
|
if (!origin) {
|
|
@@ -277,34 +258,6 @@ function tContentsForEmbed(apiClient, origin) {
|
|
|
277
258
|
}
|
|
278
259
|
return [tContent(apiClient, origin)];
|
|
279
260
|
}
|
|
280
|
-
function _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts) {
|
|
281
|
-
if (accumulatedParts.length === 0) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
if (_areUserParts(accumulatedParts)) {
|
|
285
|
-
result.push({
|
|
286
|
-
role: 'user',
|
|
287
|
-
parts: tParts(apiClient, accumulatedParts),
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
result.push({
|
|
292
|
-
role: 'model',
|
|
293
|
-
parts: tParts(apiClient, accumulatedParts),
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
accumulatedParts.length = 0; // clear the array inplace
|
|
297
|
-
}
|
|
298
|
-
function _handleCurrentPart(apiClient, result, accumulatedParts, currentPart) {
|
|
299
|
-
if (_isUserPart(currentPart) === _areUserParts(accumulatedParts)) {
|
|
300
|
-
accumulatedParts.push(currentPart);
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
_appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
|
|
304
|
-
accumulatedParts.length = 0;
|
|
305
|
-
accumulatedParts.push(currentPart);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
261
|
function tContents(apiClient, origin) {
|
|
309
262
|
if (origin === null ||
|
|
310
263
|
origin === undefined ||
|
|
@@ -312,35 +265,35 @@ function tContents(apiClient, origin) {
|
|
|
312
265
|
throw new Error('contents are required');
|
|
313
266
|
}
|
|
314
267
|
if (!Array.isArray(origin)) {
|
|
268
|
+
// If it's not an array, it's a single content or a single PartUnion.
|
|
269
|
+
if (_isFunctionCallPart(origin) || _isFunctionResponsePart(origin)) {
|
|
270
|
+
throw new Error('To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them');
|
|
271
|
+
}
|
|
315
272
|
return [tContent(apiClient, origin)];
|
|
316
273
|
}
|
|
317
274
|
const result = [];
|
|
318
275
|
const accumulatedParts = [];
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
//
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
else if (
|
|
331
|
-
|
|
332
|
-
// convert to UserContent and append to result
|
|
333
|
-
_appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
|
|
334
|
-
result.push({
|
|
335
|
-
role: 'user',
|
|
336
|
-
parts: tParts(apiClient, content),
|
|
337
|
-
});
|
|
276
|
+
const isContentArray = _isContent(origin[0]);
|
|
277
|
+
for (const item of origin) {
|
|
278
|
+
const isContent = _isContent(item);
|
|
279
|
+
if (isContent != isContentArray) {
|
|
280
|
+
throw new Error('Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them');
|
|
281
|
+
}
|
|
282
|
+
if (isContent) {
|
|
283
|
+
// `isContent` contains the result of _isContent, which is a utility
|
|
284
|
+
// function that checks if the item is a Content.
|
|
285
|
+
result.push(item);
|
|
286
|
+
}
|
|
287
|
+
else if (_isFunctionCallPart(item) || _isFunctionResponsePart(item)) {
|
|
288
|
+
throw new Error('To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them');
|
|
338
289
|
}
|
|
339
290
|
else {
|
|
340
|
-
|
|
291
|
+
accumulatedParts.push(item);
|
|
341
292
|
}
|
|
342
293
|
}
|
|
343
|
-
|
|
294
|
+
if (!isContentArray) {
|
|
295
|
+
result.push({ role: 'user', parts: tParts(apiClient, accumulatedParts) });
|
|
296
|
+
}
|
|
344
297
|
return result;
|
|
345
298
|
}
|
|
346
299
|
function processSchema(apiClient, schema) {
|
|
@@ -505,7 +458,7 @@ function tFileName(apiClient, fromName) {
|
|
|
505
458
|
* Copyright 2025 Google LLC
|
|
506
459
|
* SPDX-License-Identifier: Apache-2.0
|
|
507
460
|
*/
|
|
508
|
-
function partToMldev$
|
|
461
|
+
function partToMldev$2(apiClient, fromObject) {
|
|
509
462
|
const toObject = {};
|
|
510
463
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
511
464
|
throw new Error('videoMetadata parameter is not supported in Gemini API.');
|
|
@@ -550,13 +503,13 @@ function partToMldev$1(apiClient, fromObject) {
|
|
|
550
503
|
}
|
|
551
504
|
return toObject;
|
|
552
505
|
}
|
|
553
|
-
function contentToMldev$
|
|
506
|
+
function contentToMldev$2(apiClient, fromObject) {
|
|
554
507
|
const toObject = {};
|
|
555
508
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
556
509
|
if (fromParts != null) {
|
|
557
510
|
if (Array.isArray(fromParts)) {
|
|
558
511
|
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
559
|
-
return partToMldev$
|
|
512
|
+
return partToMldev$2(apiClient, item);
|
|
560
513
|
}));
|
|
561
514
|
}
|
|
562
515
|
else {
|
|
@@ -569,7 +522,7 @@ function contentToMldev$1(apiClient, fromObject) {
|
|
|
569
522
|
}
|
|
570
523
|
return toObject;
|
|
571
524
|
}
|
|
572
|
-
function functionDeclarationToMldev$
|
|
525
|
+
function functionDeclarationToMldev$2(apiClient, fromObject) {
|
|
573
526
|
const toObject = {};
|
|
574
527
|
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
575
528
|
throw new Error('response parameter is not supported in Gemini API.');
|
|
@@ -588,11 +541,11 @@ function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
|
588
541
|
}
|
|
589
542
|
return toObject;
|
|
590
543
|
}
|
|
591
|
-
function googleSearchToMldev$
|
|
544
|
+
function googleSearchToMldev$2() {
|
|
592
545
|
const toObject = {};
|
|
593
546
|
return toObject;
|
|
594
547
|
}
|
|
595
|
-
function dynamicRetrievalConfigToMldev$
|
|
548
|
+
function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
|
|
596
549
|
const toObject = {};
|
|
597
550
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
598
551
|
if (fromMode != null) {
|
|
@@ -606,17 +559,17 @@ function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
|
606
559
|
}
|
|
607
560
|
return toObject;
|
|
608
561
|
}
|
|
609
|
-
function googleSearchRetrievalToMldev$
|
|
562
|
+
function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
|
|
610
563
|
const toObject = {};
|
|
611
564
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
612
565
|
'dynamicRetrievalConfig',
|
|
613
566
|
]);
|
|
614
567
|
if (fromDynamicRetrievalConfig != null) {
|
|
615
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$
|
|
568
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
|
|
616
569
|
}
|
|
617
570
|
return toObject;
|
|
618
571
|
}
|
|
619
|
-
function toolToMldev$
|
|
572
|
+
function toolToMldev$2(apiClient, fromObject) {
|
|
620
573
|
const toObject = {};
|
|
621
574
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
622
575
|
'functionDeclarations',
|
|
@@ -624,7 +577,7 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
624
577
|
if (fromFunctionDeclarations != null) {
|
|
625
578
|
if (Array.isArray(fromFunctionDeclarations)) {
|
|
626
579
|
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
627
|
-
return functionDeclarationToMldev$
|
|
580
|
+
return functionDeclarationToMldev$2(apiClient, item);
|
|
628
581
|
}));
|
|
629
582
|
}
|
|
630
583
|
else {
|
|
@@ -636,13 +589,13 @@ function toolToMldev$1(apiClient, fromObject) {
|
|
|
636
589
|
}
|
|
637
590
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
638
591
|
if (fromGoogleSearch != null) {
|
|
639
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$
|
|
592
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2());
|
|
640
593
|
}
|
|
641
594
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
642
595
|
'googleSearchRetrieval',
|
|
643
596
|
]);
|
|
644
597
|
if (fromGoogleSearchRetrieval != null) {
|
|
645
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$
|
|
598
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
|
|
646
599
|
}
|
|
647
600
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
648
601
|
'codeExecution',
|
|
@@ -694,7 +647,7 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
694
647
|
if (parentObject !== undefined && fromContents != null) {
|
|
695
648
|
if (Array.isArray(fromContents)) {
|
|
696
649
|
setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
697
|
-
return contentToMldev$
|
|
650
|
+
return contentToMldev$2(apiClient, item);
|
|
698
651
|
})));
|
|
699
652
|
}
|
|
700
653
|
else {
|
|
@@ -705,13 +658,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
705
658
|
'systemInstruction',
|
|
706
659
|
]);
|
|
707
660
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
708
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$
|
|
661
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
709
662
|
}
|
|
710
663
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
711
664
|
if (parentObject !== undefined && fromTools != null) {
|
|
712
665
|
if (Array.isArray(fromTools)) {
|
|
713
666
|
setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
|
|
714
|
-
return toolToMldev$
|
|
667
|
+
return toolToMldev$2(apiClient, item);
|
|
715
668
|
}));
|
|
716
669
|
}
|
|
717
670
|
else {
|
|
@@ -804,7 +757,7 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
|
|
|
804
757
|
}
|
|
805
758
|
return toObject;
|
|
806
759
|
}
|
|
807
|
-
function partToVertex$
|
|
760
|
+
function partToVertex$2(apiClient, fromObject) {
|
|
808
761
|
const toObject = {};
|
|
809
762
|
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
810
763
|
'videoMetadata',
|
|
@@ -852,13 +805,13 @@ function partToVertex$1(apiClient, fromObject) {
|
|
|
852
805
|
}
|
|
853
806
|
return toObject;
|
|
854
807
|
}
|
|
855
|
-
function contentToVertex$
|
|
808
|
+
function contentToVertex$2(apiClient, fromObject) {
|
|
856
809
|
const toObject = {};
|
|
857
810
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
858
811
|
if (fromParts != null) {
|
|
859
812
|
if (Array.isArray(fromParts)) {
|
|
860
813
|
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
861
|
-
return partToVertex$
|
|
814
|
+
return partToVertex$2(apiClient, item);
|
|
862
815
|
}));
|
|
863
816
|
}
|
|
864
817
|
else {
|
|
@@ -871,7 +824,7 @@ function contentToVertex$1(apiClient, fromObject) {
|
|
|
871
824
|
}
|
|
872
825
|
return toObject;
|
|
873
826
|
}
|
|
874
|
-
function schemaToVertex$
|
|
827
|
+
function schemaToVertex$2(apiClient, fromObject) {
|
|
875
828
|
const toObject = {};
|
|
876
829
|
const fromExample = getValueByPath(fromObject, ['example']);
|
|
877
830
|
if (fromExample != null) {
|
|
@@ -969,11 +922,11 @@ function schemaToVertex$1(apiClient, fromObject) {
|
|
|
969
922
|
}
|
|
970
923
|
return toObject;
|
|
971
924
|
}
|
|
972
|
-
function functionDeclarationToVertex$
|
|
925
|
+
function functionDeclarationToVertex$2(apiClient, fromObject) {
|
|
973
926
|
const toObject = {};
|
|
974
927
|
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
975
928
|
if (fromResponse != null) {
|
|
976
|
-
setValueByPath(toObject, ['response'], schemaToVertex$
|
|
929
|
+
setValueByPath(toObject, ['response'], schemaToVertex$2(apiClient, fromResponse));
|
|
977
930
|
}
|
|
978
931
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
979
932
|
if (fromDescription != null) {
|
|
@@ -989,11 +942,11 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
|
989
942
|
}
|
|
990
943
|
return toObject;
|
|
991
944
|
}
|
|
992
|
-
function googleSearchToVertex$
|
|
945
|
+
function googleSearchToVertex$2() {
|
|
993
946
|
const toObject = {};
|
|
994
947
|
return toObject;
|
|
995
948
|
}
|
|
996
|
-
function dynamicRetrievalConfigToVertex$
|
|
949
|
+
function dynamicRetrievalConfigToVertex$2(apiClient, fromObject) {
|
|
997
950
|
const toObject = {};
|
|
998
951
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
999
952
|
if (fromMode != null) {
|
|
@@ -1007,17 +960,17 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
|
1007
960
|
}
|
|
1008
961
|
return toObject;
|
|
1009
962
|
}
|
|
1010
|
-
function googleSearchRetrievalToVertex$
|
|
963
|
+
function googleSearchRetrievalToVertex$2(apiClient, fromObject) {
|
|
1011
964
|
const toObject = {};
|
|
1012
965
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
1013
966
|
'dynamicRetrievalConfig',
|
|
1014
967
|
]);
|
|
1015
968
|
if (fromDynamicRetrievalConfig != null) {
|
|
1016
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$
|
|
969
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$2(apiClient, fromDynamicRetrievalConfig));
|
|
1017
970
|
}
|
|
1018
971
|
return toObject;
|
|
1019
972
|
}
|
|
1020
|
-
function toolToVertex$
|
|
973
|
+
function toolToVertex$2(apiClient, fromObject) {
|
|
1021
974
|
const toObject = {};
|
|
1022
975
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
1023
976
|
'functionDeclarations',
|
|
@@ -1025,7 +978,7 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
1025
978
|
if (fromFunctionDeclarations != null) {
|
|
1026
979
|
if (Array.isArray(fromFunctionDeclarations)) {
|
|
1027
980
|
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
1028
|
-
return functionDeclarationToVertex$
|
|
981
|
+
return functionDeclarationToVertex$2(apiClient, item);
|
|
1029
982
|
}));
|
|
1030
983
|
}
|
|
1031
984
|
else {
|
|
@@ -1038,13 +991,13 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
1038
991
|
}
|
|
1039
992
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
1040
993
|
if (fromGoogleSearch != null) {
|
|
1041
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$
|
|
994
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$2());
|
|
1042
995
|
}
|
|
1043
996
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
1044
997
|
'googleSearchRetrieval',
|
|
1045
998
|
]);
|
|
1046
999
|
if (fromGoogleSearchRetrieval != null) {
|
|
1047
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$
|
|
1000
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$2(apiClient, fromGoogleSearchRetrieval));
|
|
1048
1001
|
}
|
|
1049
1002
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
1050
1003
|
'codeExecution',
|
|
@@ -1096,7 +1049,7 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
|
|
|
1096
1049
|
if (parentObject !== undefined && fromContents != null) {
|
|
1097
1050
|
if (Array.isArray(fromContents)) {
|
|
1098
1051
|
setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
|
|
1099
|
-
return contentToVertex$
|
|
1052
|
+
return contentToVertex$2(apiClient, item);
|
|
1100
1053
|
})));
|
|
1101
1054
|
}
|
|
1102
1055
|
else {
|
|
@@ -1107,13 +1060,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
|
|
|
1107
1060
|
'systemInstruction',
|
|
1108
1061
|
]);
|
|
1109
1062
|
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
1110
|
-
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$
|
|
1063
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToVertex$2(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
1111
1064
|
}
|
|
1112
1065
|
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
1113
1066
|
if (parentObject !== undefined && fromTools != null) {
|
|
1114
1067
|
if (Array.isArray(fromTools)) {
|
|
1115
1068
|
setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
|
|
1116
|
-
return toolToVertex$
|
|
1069
|
+
return toolToVertex$2(apiClient, item);
|
|
1117
1070
|
}));
|
|
1118
1071
|
}
|
|
1119
1072
|
else {
|
|
@@ -1512,6 +1465,7 @@ class Pager {
|
|
|
1512
1465
|
* SPDX-License-Identifier: Apache-2.0
|
|
1513
1466
|
*/
|
|
1514
1467
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
1468
|
+
/** Required. Outcome of the code execution. */
|
|
1515
1469
|
var Outcome;
|
|
1516
1470
|
(function (Outcome) {
|
|
1517
1471
|
Outcome["OUTCOME_UNSPECIFIED"] = "OUTCOME_UNSPECIFIED";
|
|
@@ -1519,11 +1473,13 @@ var Outcome;
|
|
|
1519
1473
|
Outcome["OUTCOME_FAILED"] = "OUTCOME_FAILED";
|
|
1520
1474
|
Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
|
|
1521
1475
|
})(Outcome || (Outcome = {}));
|
|
1476
|
+
/** Required. Programming language of the `code`. */
|
|
1522
1477
|
var Language;
|
|
1523
1478
|
(function (Language) {
|
|
1524
1479
|
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
1525
1480
|
Language["PYTHON"] = "PYTHON";
|
|
1526
1481
|
})(Language || (Language = {}));
|
|
1482
|
+
/** Optional. The type of the data. */
|
|
1527
1483
|
var Type;
|
|
1528
1484
|
(function (Type) {
|
|
1529
1485
|
Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
|
|
@@ -1534,6 +1490,7 @@ var Type;
|
|
|
1534
1490
|
Type["ARRAY"] = "ARRAY";
|
|
1535
1491
|
Type["OBJECT"] = "OBJECT";
|
|
1536
1492
|
})(Type || (Type = {}));
|
|
1493
|
+
/** Required. Harm category. */
|
|
1537
1494
|
var HarmCategory;
|
|
1538
1495
|
(function (HarmCategory) {
|
|
1539
1496
|
HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
|
|
@@ -1543,12 +1500,14 @@ var HarmCategory;
|
|
|
1543
1500
|
HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
|
|
1544
1501
|
HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
1545
1502
|
})(HarmCategory || (HarmCategory = {}));
|
|
1503
|
+
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
1546
1504
|
var HarmBlockMethod;
|
|
1547
1505
|
(function (HarmBlockMethod) {
|
|
1548
1506
|
HarmBlockMethod["HARM_BLOCK_METHOD_UNSPECIFIED"] = "HARM_BLOCK_METHOD_UNSPECIFIED";
|
|
1549
1507
|
HarmBlockMethod["SEVERITY"] = "SEVERITY";
|
|
1550
1508
|
HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
|
|
1551
1509
|
})(HarmBlockMethod || (HarmBlockMethod = {}));
|
|
1510
|
+
/** Required. The harm block threshold. */
|
|
1552
1511
|
var HarmBlockThreshold;
|
|
1553
1512
|
(function (HarmBlockThreshold) {
|
|
1554
1513
|
HarmBlockThreshold["HARM_BLOCK_THRESHOLD_UNSPECIFIED"] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
|
|
@@ -1558,11 +1517,16 @@ var HarmBlockThreshold;
|
|
|
1558
1517
|
HarmBlockThreshold["BLOCK_NONE"] = "BLOCK_NONE";
|
|
1559
1518
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
1560
1519
|
})(HarmBlockThreshold || (HarmBlockThreshold = {}));
|
|
1520
|
+
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
1561
1521
|
var Mode;
|
|
1562
1522
|
(function (Mode) {
|
|
1563
1523
|
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1564
1524
|
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1565
1525
|
})(Mode || (Mode = {}));
|
|
1526
|
+
/** Output only. The reason why the model stopped generating tokens.
|
|
1527
|
+
|
|
1528
|
+
If empty, the model has not stopped generating the tokens.
|
|
1529
|
+
*/
|
|
1566
1530
|
var FinishReason;
|
|
1567
1531
|
(function (FinishReason) {
|
|
1568
1532
|
FinishReason["FINISH_REASON_UNSPECIFIED"] = "FINISH_REASON_UNSPECIFIED";
|
|
@@ -1577,6 +1541,7 @@ var FinishReason;
|
|
|
1577
1541
|
FinishReason["MALFORMED_FUNCTION_CALL"] = "MALFORMED_FUNCTION_CALL";
|
|
1578
1542
|
FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
1579
1543
|
})(FinishReason || (FinishReason = {}));
|
|
1544
|
+
/** Output only. Harm probability levels in the content. */
|
|
1580
1545
|
var HarmProbability;
|
|
1581
1546
|
(function (HarmProbability) {
|
|
1582
1547
|
HarmProbability["HARM_PROBABILITY_UNSPECIFIED"] = "HARM_PROBABILITY_UNSPECIFIED";
|
|
@@ -1585,6 +1550,7 @@ var HarmProbability;
|
|
|
1585
1550
|
HarmProbability["MEDIUM"] = "MEDIUM";
|
|
1586
1551
|
HarmProbability["HIGH"] = "HIGH";
|
|
1587
1552
|
})(HarmProbability || (HarmProbability = {}));
|
|
1553
|
+
/** Output only. Harm severity levels in the content. */
|
|
1588
1554
|
var HarmSeverity;
|
|
1589
1555
|
(function (HarmSeverity) {
|
|
1590
1556
|
HarmSeverity["HARM_SEVERITY_UNSPECIFIED"] = "HARM_SEVERITY_UNSPECIFIED";
|
|
@@ -1593,6 +1559,7 @@ var HarmSeverity;
|
|
|
1593
1559
|
HarmSeverity["HARM_SEVERITY_MEDIUM"] = "HARM_SEVERITY_MEDIUM";
|
|
1594
1560
|
HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
|
|
1595
1561
|
})(HarmSeverity || (HarmSeverity = {}));
|
|
1562
|
+
/** Output only. Blocked reason. */
|
|
1596
1563
|
var BlockedReason;
|
|
1597
1564
|
(function (BlockedReason) {
|
|
1598
1565
|
BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
|
|
@@ -1601,6 +1568,14 @@ var BlockedReason;
|
|
|
1601
1568
|
BlockedReason["BLOCKLIST"] = "BLOCKLIST";
|
|
1602
1569
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
1603
1570
|
})(BlockedReason || (BlockedReason = {}));
|
|
1571
|
+
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
1572
|
+
var TrafficType;
|
|
1573
|
+
(function (TrafficType) {
|
|
1574
|
+
TrafficType["TRAFFIC_TYPE_UNSPECIFIED"] = "TRAFFIC_TYPE_UNSPECIFIED";
|
|
1575
|
+
TrafficType["ON_DEMAND"] = "ON_DEMAND";
|
|
1576
|
+
TrafficType["PROVISIONED_THROUGHPUT"] = "PROVISIONED_THROUGHPUT";
|
|
1577
|
+
})(TrafficType || (TrafficType = {}));
|
|
1578
|
+
/** Server content modalities. */
|
|
1604
1579
|
var Modality;
|
|
1605
1580
|
(function (Modality) {
|
|
1606
1581
|
Modality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
|
|
@@ -1608,17 +1583,29 @@ var Modality;
|
|
|
1608
1583
|
Modality["IMAGE"] = "IMAGE";
|
|
1609
1584
|
Modality["AUDIO"] = "AUDIO";
|
|
1610
1585
|
})(Modality || (Modality = {}));
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1586
|
+
/** The media resolution to use. */
|
|
1587
|
+
var MediaResolution;
|
|
1588
|
+
(function (MediaResolution) {
|
|
1589
|
+
MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
|
|
1590
|
+
MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
|
|
1591
|
+
MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
|
|
1592
|
+
MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1593
|
+
})(MediaResolution || (MediaResolution = {}));
|
|
1594
|
+
/** Options for feature selection preference. */
|
|
1595
|
+
var FeatureSelectionPreference;
|
|
1596
|
+
(function (FeatureSelectionPreference) {
|
|
1597
|
+
FeatureSelectionPreference["FEATURE_SELECTION_PREFERENCE_UNSPECIFIED"] = "FEATURE_SELECTION_PREFERENCE_UNSPECIFIED";
|
|
1598
|
+
FeatureSelectionPreference["PRIORITIZE_QUALITY"] = "PRIORITIZE_QUALITY";
|
|
1599
|
+
FeatureSelectionPreference["BALANCED"] = "BALANCED";
|
|
1600
|
+
FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
|
|
1601
|
+
})(FeatureSelectionPreference || (FeatureSelectionPreference = {}));
|
|
1602
|
+
/** Config for the dynamic retrieval config mode. */
|
|
1617
1603
|
var DynamicRetrievalConfigMode;
|
|
1618
1604
|
(function (DynamicRetrievalConfigMode) {
|
|
1619
1605
|
DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1620
1606
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1621
1607
|
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
1608
|
+
/** Config for the function calling config mode. */
|
|
1622
1609
|
var FunctionCallingConfigMode;
|
|
1623
1610
|
(function (FunctionCallingConfigMode) {
|
|
1624
1611
|
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
@@ -1626,13 +1613,7 @@ var FunctionCallingConfigMode;
|
|
|
1626
1613
|
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
1627
1614
|
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
1628
1615
|
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
1629
|
-
|
|
1630
|
-
(function (MediaResolution) {
|
|
1631
|
-
MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
|
|
1632
|
-
MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
|
|
1633
|
-
MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
|
|
1634
|
-
MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1635
|
-
})(MediaResolution || (MediaResolution = {}));
|
|
1616
|
+
/** Enum that controls the safety filter level for objectionable content. */
|
|
1636
1617
|
var SafetyFilterLevel;
|
|
1637
1618
|
(function (SafetyFilterLevel) {
|
|
1638
1619
|
SafetyFilterLevel["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE";
|
|
@@ -1640,12 +1621,14 @@ var SafetyFilterLevel;
|
|
|
1640
1621
|
SafetyFilterLevel["BLOCK_ONLY_HIGH"] = "BLOCK_ONLY_HIGH";
|
|
1641
1622
|
SafetyFilterLevel["BLOCK_NONE"] = "BLOCK_NONE";
|
|
1642
1623
|
})(SafetyFilterLevel || (SafetyFilterLevel = {}));
|
|
1624
|
+
/** Enum that controls the generation of people. */
|
|
1643
1625
|
var PersonGeneration;
|
|
1644
1626
|
(function (PersonGeneration) {
|
|
1645
1627
|
PersonGeneration["DONT_ALLOW"] = "DONT_ALLOW";
|
|
1646
1628
|
PersonGeneration["ALLOW_ADULT"] = "ALLOW_ADULT";
|
|
1647
1629
|
PersonGeneration["ALLOW_ALL"] = "ALLOW_ALL";
|
|
1648
1630
|
})(PersonGeneration || (PersonGeneration = {}));
|
|
1631
|
+
/** Enum that specifies the language of the text in the prompt. */
|
|
1649
1632
|
var ImagePromptLanguage;
|
|
1650
1633
|
(function (ImagePromptLanguage) {
|
|
1651
1634
|
ImagePromptLanguage["auto"] = "auto";
|
|
@@ -1654,6 +1637,7 @@ var ImagePromptLanguage;
|
|
|
1654
1637
|
ImagePromptLanguage["ko"] = "ko";
|
|
1655
1638
|
ImagePromptLanguage["hi"] = "hi";
|
|
1656
1639
|
})(ImagePromptLanguage || (ImagePromptLanguage = {}));
|
|
1640
|
+
/** State for the lifecycle of a File. */
|
|
1657
1641
|
var FileState;
|
|
1658
1642
|
(function (FileState) {
|
|
1659
1643
|
FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
@@ -1661,12 +1645,14 @@ var FileState;
|
|
|
1661
1645
|
FileState["ACTIVE"] = "ACTIVE";
|
|
1662
1646
|
FileState["FAILED"] = "FAILED";
|
|
1663
1647
|
})(FileState || (FileState = {}));
|
|
1648
|
+
/** Source of the File. */
|
|
1664
1649
|
var FileSource;
|
|
1665
1650
|
(function (FileSource) {
|
|
1666
1651
|
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1667
1652
|
FileSource["UPLOADED"] = "UPLOADED";
|
|
1668
1653
|
FileSource["GENERATED"] = "GENERATED";
|
|
1669
1654
|
})(FileSource || (FileSource = {}));
|
|
1655
|
+
/** Enum representing the mask mode of a mask reference image. */
|
|
1670
1656
|
var MaskReferenceMode;
|
|
1671
1657
|
(function (MaskReferenceMode) {
|
|
1672
1658
|
MaskReferenceMode["MASK_MODE_DEFAULT"] = "MASK_MODE_DEFAULT";
|
|
@@ -1675,6 +1661,7 @@ var MaskReferenceMode;
|
|
|
1675
1661
|
MaskReferenceMode["MASK_MODE_FOREGROUND"] = "MASK_MODE_FOREGROUND";
|
|
1676
1662
|
MaskReferenceMode["MASK_MODE_SEMANTIC"] = "MASK_MODE_SEMANTIC";
|
|
1677
1663
|
})(MaskReferenceMode || (MaskReferenceMode = {}));
|
|
1664
|
+
/** Enum representing the control type of a control reference image. */
|
|
1678
1665
|
var ControlReferenceType;
|
|
1679
1666
|
(function (ControlReferenceType) {
|
|
1680
1667
|
ControlReferenceType["CONTROL_TYPE_DEFAULT"] = "CONTROL_TYPE_DEFAULT";
|
|
@@ -1682,6 +1669,7 @@ var ControlReferenceType;
|
|
|
1682
1669
|
ControlReferenceType["CONTROL_TYPE_SCRIBBLE"] = "CONTROL_TYPE_SCRIBBLE";
|
|
1683
1670
|
ControlReferenceType["CONTROL_TYPE_FACE_MESH"] = "CONTROL_TYPE_FACE_MESH";
|
|
1684
1671
|
})(ControlReferenceType || (ControlReferenceType = {}));
|
|
1672
|
+
/** Enum representing the subject type of a subject reference image. */
|
|
1685
1673
|
var SubjectReferenceType;
|
|
1686
1674
|
(function (SubjectReferenceType) {
|
|
1687
1675
|
SubjectReferenceType["SUBJECT_TYPE_DEFAULT"] = "SUBJECT_TYPE_DEFAULT";
|
|
@@ -1689,6 +1677,7 @@ var SubjectReferenceType;
|
|
|
1689
1677
|
SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
|
|
1690
1678
|
SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
|
|
1691
1679
|
})(SubjectReferenceType || (SubjectReferenceType = {}));
|
|
1680
|
+
/** Server content modalities. */
|
|
1692
1681
|
var MediaModality;
|
|
1693
1682
|
(function (MediaModality) {
|
|
1694
1683
|
MediaModality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
|
|
@@ -1698,6 +1687,34 @@ var MediaModality;
|
|
|
1698
1687
|
MediaModality["AUDIO"] = "AUDIO";
|
|
1699
1688
|
MediaModality["DOCUMENT"] = "DOCUMENT";
|
|
1700
1689
|
})(MediaModality || (MediaModality = {}));
|
|
1690
|
+
/** Start of speech sensitivity. */
|
|
1691
|
+
var StartSensitivity;
|
|
1692
|
+
(function (StartSensitivity) {
|
|
1693
|
+
StartSensitivity["START_SENSITIVITY_UNSPECIFIED"] = "START_SENSITIVITY_UNSPECIFIED";
|
|
1694
|
+
StartSensitivity["START_SENSITIVITY_HIGH"] = "START_SENSITIVITY_HIGH";
|
|
1695
|
+
StartSensitivity["START_SENSITIVITY_LOW"] = "START_SENSITIVITY_LOW";
|
|
1696
|
+
})(StartSensitivity || (StartSensitivity = {}));
|
|
1697
|
+
/** End of speech sensitivity. */
|
|
1698
|
+
var EndSensitivity;
|
|
1699
|
+
(function (EndSensitivity) {
|
|
1700
|
+
EndSensitivity["END_SENSITIVITY_UNSPECIFIED"] = "END_SENSITIVITY_UNSPECIFIED";
|
|
1701
|
+
EndSensitivity["END_SENSITIVITY_HIGH"] = "END_SENSITIVITY_HIGH";
|
|
1702
|
+
EndSensitivity["END_SENSITIVITY_LOW"] = "END_SENSITIVITY_LOW";
|
|
1703
|
+
})(EndSensitivity || (EndSensitivity = {}));
|
|
1704
|
+
/** The different ways of handling user activity. */
|
|
1705
|
+
var ActivityHandling;
|
|
1706
|
+
(function (ActivityHandling) {
|
|
1707
|
+
ActivityHandling["ACTIVITY_HANDLING_UNSPECIFIED"] = "ACTIVITY_HANDLING_UNSPECIFIED";
|
|
1708
|
+
ActivityHandling["START_OF_ACTIVITY_INTERRUPTS"] = "START_OF_ACTIVITY_INTERRUPTS";
|
|
1709
|
+
ActivityHandling["NO_INTERRUPTION"] = "NO_INTERRUPTION";
|
|
1710
|
+
})(ActivityHandling || (ActivityHandling = {}));
|
|
1711
|
+
/** Options about which input is included in the user's turn. */
|
|
1712
|
+
var TurnCoverage;
|
|
1713
|
+
(function (TurnCoverage) {
|
|
1714
|
+
TurnCoverage["TURN_COVERAGE_UNSPECIFIED"] = "TURN_COVERAGE_UNSPECIFIED";
|
|
1715
|
+
TurnCoverage["TURN_INCLUDES_ONLY_ACTIVITY"] = "TURN_INCLUDES_ONLY_ACTIVITY";
|
|
1716
|
+
TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
|
|
1717
|
+
})(TurnCoverage || (TurnCoverage = {}));
|
|
1701
1718
|
/** A function response. */
|
|
1702
1719
|
class FunctionResponse {
|
|
1703
1720
|
}
|
|
@@ -1744,7 +1761,7 @@ function createPartFromFunctionResponse(id, name, response) {
|
|
|
1744
1761
|
};
|
|
1745
1762
|
}
|
|
1746
1763
|
/**
|
|
1747
|
-
* Creates a `Part` object from a `base64` `string`.
|
|
1764
|
+
* Creates a `Part` object from a `base64` encoded `string`.
|
|
1748
1765
|
*/
|
|
1749
1766
|
function createPartFromBase64(data, mimeType) {
|
|
1750
1767
|
return {
|
|
@@ -2132,8 +2149,8 @@ class Caches extends BaseModule {
|
|
|
2132
2149
|
*
|
|
2133
2150
|
* @remarks
|
|
2134
2151
|
* Context caching is only supported for specific models. See [Gemini
|
|
2135
|
-
* Developer API reference]
|
|
2136
|
-
* and [Vertex AI reference]
|
|
2152
|
+
* Developer API reference](https://ai.google.dev/gemini-api/docs/caching?lang=node/context-cac)
|
|
2153
|
+
* and [Vertex AI reference](https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
|
|
2137
2154
|
* for more information.
|
|
2138
2155
|
*
|
|
2139
2156
|
* @param params - The parameters for the create request.
|
|
@@ -3059,12 +3076,8 @@ function listFilesResponseFromMldev(apiClient, fromObject) {
|
|
|
3059
3076
|
}
|
|
3060
3077
|
return toObject;
|
|
3061
3078
|
}
|
|
3062
|
-
function createFileResponseFromMldev(
|
|
3079
|
+
function createFileResponseFromMldev() {
|
|
3063
3080
|
const toObject = {};
|
|
3064
|
-
const fromHttpHeaders = getValueByPath(fromObject, ['httpHeaders']);
|
|
3065
|
-
if (fromHttpHeaders != null) {
|
|
3066
|
-
setValueByPath(toObject, ['httpHeaders'], fromHttpHeaders);
|
|
3067
|
-
}
|
|
3068
3081
|
return toObject;
|
|
3069
3082
|
}
|
|
3070
3083
|
function deleteFileResponseFromMldev() {
|
|
@@ -3126,7 +3139,9 @@ class Files extends BaseModule {
|
|
|
3126
3139
|
* This section can contain multiple paragraphs and code examples.
|
|
3127
3140
|
*
|
|
3128
3141
|
* @param params - Optional parameters specified in the
|
|
3129
|
-
* `
|
|
3142
|
+
* `types.UploadFileParameters` interface.
|
|
3143
|
+
* @see {@link types.UploadFileParameters#config} for the optional
|
|
3144
|
+
* config in the parameters.
|
|
3130
3145
|
* @return A promise that resolves to a `types.File` object.
|
|
3131
3146
|
* @throws An error if called on a Vertex AI client.
|
|
3132
3147
|
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
@@ -3214,8 +3229,8 @@ class Files extends BaseModule {
|
|
|
3214
3229
|
.then((httpResponse) => {
|
|
3215
3230
|
return httpResponse.json();
|
|
3216
3231
|
});
|
|
3217
|
-
return response.then((
|
|
3218
|
-
const resp = createFileResponseFromMldev(
|
|
3232
|
+
return response.then(() => {
|
|
3233
|
+
const resp = createFileResponseFromMldev();
|
|
3219
3234
|
const typedResp = new CreateFileResponse();
|
|
3220
3235
|
Object.assign(typedResp, resp);
|
|
3221
3236
|
return typedResp;
|
|
@@ -3323,7 +3338,7 @@ class Files extends BaseModule {
|
|
|
3323
3338
|
* Copyright 2025 Google LLC
|
|
3324
3339
|
* SPDX-License-Identifier: Apache-2.0
|
|
3325
3340
|
*/
|
|
3326
|
-
function partToMldev(apiClient, fromObject) {
|
|
3341
|
+
function partToMldev$1(apiClient, fromObject) {
|
|
3327
3342
|
const toObject = {};
|
|
3328
3343
|
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
3329
3344
|
throw new Error('videoMetadata parameter is not supported in Gemini API.');
|
|
@@ -3368,13 +3383,61 @@ function partToMldev(apiClient, fromObject) {
|
|
|
3368
3383
|
}
|
|
3369
3384
|
return toObject;
|
|
3370
3385
|
}
|
|
3371
|
-
function
|
|
3386
|
+
function partToVertex$1(apiClient, fromObject) {
|
|
3387
|
+
const toObject = {};
|
|
3388
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
3389
|
+
'videoMetadata',
|
|
3390
|
+
]);
|
|
3391
|
+
if (fromVideoMetadata != null) {
|
|
3392
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
3393
|
+
}
|
|
3394
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
3395
|
+
if (fromThought != null) {
|
|
3396
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
3397
|
+
}
|
|
3398
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3399
|
+
'codeExecutionResult',
|
|
3400
|
+
]);
|
|
3401
|
+
if (fromCodeExecutionResult != null) {
|
|
3402
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
3403
|
+
}
|
|
3404
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
3405
|
+
'executableCode',
|
|
3406
|
+
]);
|
|
3407
|
+
if (fromExecutableCode != null) {
|
|
3408
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
3409
|
+
}
|
|
3410
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
3411
|
+
if (fromFileData != null) {
|
|
3412
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
3413
|
+
}
|
|
3414
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3415
|
+
if (fromFunctionCall != null) {
|
|
3416
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3417
|
+
}
|
|
3418
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
3419
|
+
'functionResponse',
|
|
3420
|
+
]);
|
|
3421
|
+
if (fromFunctionResponse != null) {
|
|
3422
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
3423
|
+
}
|
|
3424
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3425
|
+
if (fromInlineData != null) {
|
|
3426
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
3427
|
+
}
|
|
3428
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
3429
|
+
if (fromText != null) {
|
|
3430
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
3431
|
+
}
|
|
3432
|
+
return toObject;
|
|
3433
|
+
}
|
|
3434
|
+
function contentToMldev$1(apiClient, fromObject) {
|
|
3372
3435
|
const toObject = {};
|
|
3373
3436
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
3374
3437
|
if (fromParts != null) {
|
|
3375
3438
|
if (Array.isArray(fromParts)) {
|
|
3376
3439
|
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
3377
|
-
return partToMldev(apiClient, item);
|
|
3440
|
+
return partToMldev$1(apiClient, item);
|
|
3378
3441
|
}));
|
|
3379
3442
|
}
|
|
3380
3443
|
else {
|
|
@@ -3387,28 +3450,58 @@ function contentToMldev(apiClient, fromObject) {
|
|
|
3387
3450
|
}
|
|
3388
3451
|
return toObject;
|
|
3389
3452
|
}
|
|
3390
|
-
function
|
|
3453
|
+
function contentToVertex$1(apiClient, fromObject) {
|
|
3391
3454
|
const toObject = {};
|
|
3392
|
-
|
|
3393
|
-
|
|
3455
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
3456
|
+
if (fromParts != null) {
|
|
3457
|
+
if (Array.isArray(fromParts)) {
|
|
3458
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
3459
|
+
return partToVertex$1(apiClient, item);
|
|
3460
|
+
}));
|
|
3461
|
+
}
|
|
3462
|
+
else {
|
|
3463
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
3464
|
+
}
|
|
3394
3465
|
}
|
|
3395
|
-
|
|
3396
|
-
|
|
3466
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
3467
|
+
if (fromRole != null) {
|
|
3468
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
3397
3469
|
}
|
|
3398
|
-
|
|
3399
|
-
|
|
3470
|
+
return toObject;
|
|
3471
|
+
}
|
|
3472
|
+
function schemaToVertex$1(apiClient, fromObject) {
|
|
3473
|
+
const toObject = {};
|
|
3474
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
3475
|
+
if (fromExample != null) {
|
|
3476
|
+
setValueByPath(toObject, ['example'], fromExample);
|
|
3400
3477
|
}
|
|
3401
|
-
|
|
3402
|
-
|
|
3478
|
+
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
3479
|
+
if (fromPattern != null) {
|
|
3480
|
+
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
3403
3481
|
}
|
|
3404
|
-
|
|
3405
|
-
|
|
3482
|
+
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
3483
|
+
if (fromDefault != null) {
|
|
3484
|
+
setValueByPath(toObject, ['default'], fromDefault);
|
|
3406
3485
|
}
|
|
3407
|
-
|
|
3408
|
-
|
|
3486
|
+
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
3487
|
+
if (fromMaxLength != null) {
|
|
3488
|
+
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
3409
3489
|
}
|
|
3410
|
-
|
|
3411
|
-
|
|
3490
|
+
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
3491
|
+
if (fromMinLength != null) {
|
|
3492
|
+
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
3493
|
+
}
|
|
3494
|
+
const fromMinProperties = getValueByPath(fromObject, [
|
|
3495
|
+
'minProperties',
|
|
3496
|
+
]);
|
|
3497
|
+
if (fromMinProperties != null) {
|
|
3498
|
+
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
3499
|
+
}
|
|
3500
|
+
const fromMaxProperties = getValueByPath(fromObject, [
|
|
3501
|
+
'maxProperties',
|
|
3502
|
+
]);
|
|
3503
|
+
if (fromMaxProperties != null) {
|
|
3504
|
+
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
3412
3505
|
}
|
|
3413
3506
|
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
3414
3507
|
if (fromAnyOf != null) {
|
|
@@ -3474,25 +3567,30 @@ function schemaToMldev(apiClient, fromObject) {
|
|
|
3474
3567
|
}
|
|
3475
3568
|
return toObject;
|
|
3476
3569
|
}
|
|
3477
|
-
function
|
|
3570
|
+
function functionDeclarationToMldev$1(apiClient, fromObject) {
|
|
3478
3571
|
const toObject = {};
|
|
3479
|
-
if (getValueByPath(fromObject, ['
|
|
3480
|
-
throw new Error('
|
|
3572
|
+
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
3573
|
+
throw new Error('response parameter is not supported in Gemini API.');
|
|
3481
3574
|
}
|
|
3482
|
-
const
|
|
3483
|
-
if (
|
|
3484
|
-
setValueByPath(toObject, ['
|
|
3575
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
3576
|
+
if (fromDescription != null) {
|
|
3577
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
3485
3578
|
}
|
|
3486
|
-
const
|
|
3487
|
-
if (
|
|
3488
|
-
setValueByPath(toObject, ['
|
|
3579
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3580
|
+
if (fromName != null) {
|
|
3581
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3582
|
+
}
|
|
3583
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
3584
|
+
if (fromParameters != null) {
|
|
3585
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
3489
3586
|
}
|
|
3490
3587
|
return toObject;
|
|
3491
3588
|
}
|
|
3492
|
-
function
|
|
3589
|
+
function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
3493
3590
|
const toObject = {};
|
|
3494
|
-
|
|
3495
|
-
|
|
3591
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
3592
|
+
if (fromResponse != null) {
|
|
3593
|
+
setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
|
|
3496
3594
|
}
|
|
3497
3595
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
3498
3596
|
if (fromDescription != null) {
|
|
@@ -3508,11 +3606,15 @@ function functionDeclarationToMldev(apiClient, fromObject) {
|
|
|
3508
3606
|
}
|
|
3509
3607
|
return toObject;
|
|
3510
3608
|
}
|
|
3511
|
-
function googleSearchToMldev() {
|
|
3609
|
+
function googleSearchToMldev$1() {
|
|
3512
3610
|
const toObject = {};
|
|
3513
3611
|
return toObject;
|
|
3514
3612
|
}
|
|
3515
|
-
function
|
|
3613
|
+
function googleSearchToVertex$1() {
|
|
3614
|
+
const toObject = {};
|
|
3615
|
+
return toObject;
|
|
3616
|
+
}
|
|
3617
|
+
function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
|
|
3516
3618
|
const toObject = {};
|
|
3517
3619
|
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3518
3620
|
if (fromMode != null) {
|
|
@@ -3526,13 +3628,1377 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
|
3526
3628
|
}
|
|
3527
3629
|
return toObject;
|
|
3528
3630
|
}
|
|
3529
|
-
function
|
|
3631
|
+
function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
|
|
3632
|
+
const toObject = {};
|
|
3633
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3634
|
+
if (fromMode != null) {
|
|
3635
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3636
|
+
}
|
|
3637
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
3638
|
+
'dynamicThreshold',
|
|
3639
|
+
]);
|
|
3640
|
+
if (fromDynamicThreshold != null) {
|
|
3641
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
3642
|
+
}
|
|
3643
|
+
return toObject;
|
|
3644
|
+
}
|
|
3645
|
+
function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
|
|
3530
3646
|
const toObject = {};
|
|
3531
3647
|
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
3532
3648
|
'dynamicRetrievalConfig',
|
|
3533
3649
|
]);
|
|
3534
3650
|
if (fromDynamicRetrievalConfig != null) {
|
|
3535
|
-
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
3651
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
|
|
3652
|
+
}
|
|
3653
|
+
return toObject;
|
|
3654
|
+
}
|
|
3655
|
+
function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
|
|
3656
|
+
const toObject = {};
|
|
3657
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
3658
|
+
'dynamicRetrievalConfig',
|
|
3659
|
+
]);
|
|
3660
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
3661
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
|
|
3662
|
+
}
|
|
3663
|
+
return toObject;
|
|
3664
|
+
}
|
|
3665
|
+
function toolToMldev$1(apiClient, fromObject) {
|
|
3666
|
+
const toObject = {};
|
|
3667
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
3668
|
+
'functionDeclarations',
|
|
3669
|
+
]);
|
|
3670
|
+
if (fromFunctionDeclarations != null) {
|
|
3671
|
+
if (Array.isArray(fromFunctionDeclarations)) {
|
|
3672
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
3673
|
+
return functionDeclarationToMldev$1(apiClient, item);
|
|
3674
|
+
}));
|
|
3675
|
+
}
|
|
3676
|
+
else {
|
|
3677
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
3681
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
3682
|
+
}
|
|
3683
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
3684
|
+
if (fromGoogleSearch != null) {
|
|
3685
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1());
|
|
3686
|
+
}
|
|
3687
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
3688
|
+
'googleSearchRetrieval',
|
|
3689
|
+
]);
|
|
3690
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
3691
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
|
|
3692
|
+
}
|
|
3693
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3694
|
+
'codeExecution',
|
|
3695
|
+
]);
|
|
3696
|
+
if (fromCodeExecution != null) {
|
|
3697
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
3698
|
+
}
|
|
3699
|
+
return toObject;
|
|
3700
|
+
}
|
|
3701
|
+
function toolToVertex$1(apiClient, fromObject) {
|
|
3702
|
+
const toObject = {};
|
|
3703
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
3704
|
+
'functionDeclarations',
|
|
3705
|
+
]);
|
|
3706
|
+
if (fromFunctionDeclarations != null) {
|
|
3707
|
+
if (Array.isArray(fromFunctionDeclarations)) {
|
|
3708
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
|
|
3709
|
+
return functionDeclarationToVertex$1(apiClient, item);
|
|
3710
|
+
}));
|
|
3711
|
+
}
|
|
3712
|
+
else {
|
|
3713
|
+
setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
3717
|
+
if (fromRetrieval != null) {
|
|
3718
|
+
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
3719
|
+
}
|
|
3720
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
3721
|
+
if (fromGoogleSearch != null) {
|
|
3722
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
|
|
3723
|
+
}
|
|
3724
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
3725
|
+
'googleSearchRetrieval',
|
|
3726
|
+
]);
|
|
3727
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
3728
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
|
|
3729
|
+
}
|
|
3730
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3731
|
+
'codeExecution',
|
|
3732
|
+
]);
|
|
3733
|
+
if (fromCodeExecution != null) {
|
|
3734
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
3735
|
+
}
|
|
3736
|
+
return toObject;
|
|
3737
|
+
}
|
|
3738
|
+
function sessionResumptionConfigToMldev(apiClient, fromObject) {
|
|
3739
|
+
const toObject = {};
|
|
3740
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
3741
|
+
if (fromHandle != null) {
|
|
3742
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
3743
|
+
}
|
|
3744
|
+
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
3745
|
+
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
3746
|
+
}
|
|
3747
|
+
return toObject;
|
|
3748
|
+
}
|
|
3749
|
+
function sessionResumptionConfigToVertex(apiClient, fromObject) {
|
|
3750
|
+
const toObject = {};
|
|
3751
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
3752
|
+
if (fromHandle != null) {
|
|
3753
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
3754
|
+
}
|
|
3755
|
+
const fromTransparent = getValueByPath(fromObject, ['transparent']);
|
|
3756
|
+
if (fromTransparent != null) {
|
|
3757
|
+
setValueByPath(toObject, ['transparent'], fromTransparent);
|
|
3758
|
+
}
|
|
3759
|
+
return toObject;
|
|
3760
|
+
}
|
|
3761
|
+
function audioTranscriptionConfigToMldev() {
|
|
3762
|
+
const toObject = {};
|
|
3763
|
+
return toObject;
|
|
3764
|
+
}
|
|
3765
|
+
function audioTranscriptionConfigToVertex() {
|
|
3766
|
+
const toObject = {};
|
|
3767
|
+
return toObject;
|
|
3768
|
+
}
|
|
3769
|
+
function automaticActivityDetectionToMldev(apiClient, fromObject) {
|
|
3770
|
+
const toObject = {};
|
|
3771
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
3772
|
+
if (fromDisabled != null) {
|
|
3773
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
3774
|
+
}
|
|
3775
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
3776
|
+
'startOfSpeechSensitivity',
|
|
3777
|
+
]);
|
|
3778
|
+
if (fromStartOfSpeechSensitivity != null) {
|
|
3779
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
3780
|
+
}
|
|
3781
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
3782
|
+
'endOfSpeechSensitivity',
|
|
3783
|
+
]);
|
|
3784
|
+
if (fromEndOfSpeechSensitivity != null) {
|
|
3785
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
3786
|
+
}
|
|
3787
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
3788
|
+
'prefixPaddingMs',
|
|
3789
|
+
]);
|
|
3790
|
+
if (fromPrefixPaddingMs != null) {
|
|
3791
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
3792
|
+
}
|
|
3793
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
3794
|
+
'silenceDurationMs',
|
|
3795
|
+
]);
|
|
3796
|
+
if (fromSilenceDurationMs != null) {
|
|
3797
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
3798
|
+
}
|
|
3799
|
+
return toObject;
|
|
3800
|
+
}
|
|
3801
|
+
function automaticActivityDetectionToVertex(apiClient, fromObject) {
|
|
3802
|
+
const toObject = {};
|
|
3803
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
3804
|
+
if (fromDisabled != null) {
|
|
3805
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
3806
|
+
}
|
|
3807
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
3808
|
+
'startOfSpeechSensitivity',
|
|
3809
|
+
]);
|
|
3810
|
+
if (fromStartOfSpeechSensitivity != null) {
|
|
3811
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
3812
|
+
}
|
|
3813
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
3814
|
+
'endOfSpeechSensitivity',
|
|
3815
|
+
]);
|
|
3816
|
+
if (fromEndOfSpeechSensitivity != null) {
|
|
3817
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
3818
|
+
}
|
|
3819
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
3820
|
+
'prefixPaddingMs',
|
|
3821
|
+
]);
|
|
3822
|
+
if (fromPrefixPaddingMs != null) {
|
|
3823
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
3824
|
+
}
|
|
3825
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
3826
|
+
'silenceDurationMs',
|
|
3827
|
+
]);
|
|
3828
|
+
if (fromSilenceDurationMs != null) {
|
|
3829
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
3830
|
+
}
|
|
3831
|
+
return toObject;
|
|
3832
|
+
}
|
|
3833
|
+
function realtimeInputConfigToMldev(apiClient, fromObject) {
|
|
3834
|
+
const toObject = {};
|
|
3835
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
3836
|
+
'automaticActivityDetection',
|
|
3837
|
+
]);
|
|
3838
|
+
if (fromAutomaticActivityDetection != null) {
|
|
3839
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
|
|
3840
|
+
}
|
|
3841
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
3842
|
+
'activityHandling',
|
|
3843
|
+
]);
|
|
3844
|
+
if (fromActivityHandling != null) {
|
|
3845
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
3846
|
+
}
|
|
3847
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
3848
|
+
if (fromTurnCoverage != null) {
|
|
3849
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
3850
|
+
}
|
|
3851
|
+
return toObject;
|
|
3852
|
+
}
|
|
3853
|
+
function realtimeInputConfigToVertex(apiClient, fromObject) {
|
|
3854
|
+
const toObject = {};
|
|
3855
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
3856
|
+
'automaticActivityDetection',
|
|
3857
|
+
]);
|
|
3858
|
+
if (fromAutomaticActivityDetection != null) {
|
|
3859
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToVertex(apiClient, fromAutomaticActivityDetection));
|
|
3860
|
+
}
|
|
3861
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
3862
|
+
'activityHandling',
|
|
3863
|
+
]);
|
|
3864
|
+
if (fromActivityHandling != null) {
|
|
3865
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
3866
|
+
}
|
|
3867
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
3868
|
+
if (fromTurnCoverage != null) {
|
|
3869
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
3870
|
+
}
|
|
3871
|
+
return toObject;
|
|
3872
|
+
}
|
|
3873
|
+
function slidingWindowToMldev(apiClient, fromObject) {
|
|
3874
|
+
const toObject = {};
|
|
3875
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
3876
|
+
if (fromTargetTokens != null) {
|
|
3877
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
3878
|
+
}
|
|
3879
|
+
return toObject;
|
|
3880
|
+
}
|
|
3881
|
+
function slidingWindowToVertex(apiClient, fromObject) {
|
|
3882
|
+
const toObject = {};
|
|
3883
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
3884
|
+
if (fromTargetTokens != null) {
|
|
3885
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
3886
|
+
}
|
|
3887
|
+
return toObject;
|
|
3888
|
+
}
|
|
3889
|
+
function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
|
|
3890
|
+
const toObject = {};
|
|
3891
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
3892
|
+
'triggerTokens',
|
|
3893
|
+
]);
|
|
3894
|
+
if (fromTriggerTokens != null) {
|
|
3895
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
3896
|
+
}
|
|
3897
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
3898
|
+
'slidingWindow',
|
|
3899
|
+
]);
|
|
3900
|
+
if (fromSlidingWindow != null) {
|
|
3901
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
|
|
3902
|
+
}
|
|
3903
|
+
return toObject;
|
|
3904
|
+
}
|
|
3905
|
+
function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
|
|
3906
|
+
const toObject = {};
|
|
3907
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
3908
|
+
'triggerTokens',
|
|
3909
|
+
]);
|
|
3910
|
+
if (fromTriggerTokens != null) {
|
|
3911
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
3912
|
+
}
|
|
3913
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
3914
|
+
'slidingWindow',
|
|
3915
|
+
]);
|
|
3916
|
+
if (fromSlidingWindow != null) {
|
|
3917
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToVertex(apiClient, fromSlidingWindow));
|
|
3918
|
+
}
|
|
3919
|
+
return toObject;
|
|
3920
|
+
}
|
|
3921
|
+
function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
|
|
3922
|
+
const toObject = {};
|
|
3923
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
3924
|
+
'generationConfig',
|
|
3925
|
+
]);
|
|
3926
|
+
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
3927
|
+
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
3928
|
+
}
|
|
3929
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
3930
|
+
'responseModalities',
|
|
3931
|
+
]);
|
|
3932
|
+
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
3933
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
3934
|
+
}
|
|
3935
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
3936
|
+
if (parentObject !== undefined && fromTemperature != null) {
|
|
3937
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
3938
|
+
}
|
|
3939
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
3940
|
+
if (parentObject !== undefined && fromTopP != null) {
|
|
3941
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
3942
|
+
}
|
|
3943
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
3944
|
+
if (parentObject !== undefined && fromTopK != null) {
|
|
3945
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
3946
|
+
}
|
|
3947
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
3948
|
+
'maxOutputTokens',
|
|
3949
|
+
]);
|
|
3950
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
3951
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
3952
|
+
}
|
|
3953
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
3954
|
+
'mediaResolution',
|
|
3955
|
+
]);
|
|
3956
|
+
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
3957
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
3958
|
+
}
|
|
3959
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
3960
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
3961
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
3962
|
+
}
|
|
3963
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
3964
|
+
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
3965
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], fromSpeechConfig);
|
|
3966
|
+
}
|
|
3967
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
3968
|
+
'systemInstruction',
|
|
3969
|
+
]);
|
|
3970
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
3971
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
3972
|
+
}
|
|
3973
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
3974
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
3975
|
+
if (Array.isArray(fromTools)) {
|
|
3976
|
+
setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
|
|
3977
|
+
return toolToMldev$1(apiClient, tTool(apiClient, item));
|
|
3978
|
+
})));
|
|
3979
|
+
}
|
|
3980
|
+
else {
|
|
3981
|
+
setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
3985
|
+
'sessionResumption',
|
|
3986
|
+
]);
|
|
3987
|
+
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
3988
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
|
|
3989
|
+
}
|
|
3990
|
+
if (getValueByPath(fromObject, ['inputAudioTranscription']) !== undefined) {
|
|
3991
|
+
throw new Error('inputAudioTranscription parameter is not supported in Gemini API.');
|
|
3992
|
+
}
|
|
3993
|
+
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
3994
|
+
'outputAudioTranscription',
|
|
3995
|
+
]);
|
|
3996
|
+
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
3997
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
|
|
3998
|
+
}
|
|
3999
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
4000
|
+
'realtimeInputConfig',
|
|
4001
|
+
]);
|
|
4002
|
+
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
4003
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
|
|
4004
|
+
}
|
|
4005
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
4006
|
+
'contextWindowCompression',
|
|
4007
|
+
]);
|
|
4008
|
+
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
4009
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
|
|
4010
|
+
}
|
|
4011
|
+
return toObject;
|
|
4012
|
+
}
|
|
4013
|
+
function liveConnectConfigToVertex(apiClient, fromObject, parentObject) {
|
|
4014
|
+
const toObject = {};
|
|
4015
|
+
const fromGenerationConfig = getValueByPath(fromObject, [
|
|
4016
|
+
'generationConfig',
|
|
4017
|
+
]);
|
|
4018
|
+
if (parentObject !== undefined && fromGenerationConfig != null) {
|
|
4019
|
+
setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
|
|
4020
|
+
}
|
|
4021
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
4022
|
+
'responseModalities',
|
|
4023
|
+
]);
|
|
4024
|
+
if (parentObject !== undefined && fromResponseModalities != null) {
|
|
4025
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
|
|
4026
|
+
}
|
|
4027
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
4028
|
+
if (parentObject !== undefined && fromTemperature != null) {
|
|
4029
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
|
|
4030
|
+
}
|
|
4031
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
4032
|
+
if (parentObject !== undefined && fromTopP != null) {
|
|
4033
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
|
|
4034
|
+
}
|
|
4035
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
4036
|
+
if (parentObject !== undefined && fromTopK != null) {
|
|
4037
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
|
|
4038
|
+
}
|
|
4039
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
4040
|
+
'maxOutputTokens',
|
|
4041
|
+
]);
|
|
4042
|
+
if (parentObject !== undefined && fromMaxOutputTokens != null) {
|
|
4043
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
|
|
4044
|
+
}
|
|
4045
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
4046
|
+
'mediaResolution',
|
|
4047
|
+
]);
|
|
4048
|
+
if (parentObject !== undefined && fromMediaResolution != null) {
|
|
4049
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
|
|
4050
|
+
}
|
|
4051
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
4052
|
+
if (parentObject !== undefined && fromSeed != null) {
|
|
4053
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
|
|
4054
|
+
}
|
|
4055
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
4056
|
+
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
4057
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], fromSpeechConfig);
|
|
4058
|
+
}
|
|
4059
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
4060
|
+
'systemInstruction',
|
|
4061
|
+
]);
|
|
4062
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
4063
|
+
setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
|
|
4064
|
+
}
|
|
4065
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
4066
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
4067
|
+
if (Array.isArray(fromTools)) {
|
|
4068
|
+
setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
|
|
4069
|
+
return toolToVertex$1(apiClient, tTool(apiClient, item));
|
|
4070
|
+
})));
|
|
4071
|
+
}
|
|
4072
|
+
else {
|
|
4073
|
+
setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
4077
|
+
'sessionResumption',
|
|
4078
|
+
]);
|
|
4079
|
+
if (parentObject !== undefined && fromSessionResumption != null) {
|
|
4080
|
+
setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToVertex(apiClient, fromSessionResumption));
|
|
4081
|
+
}
|
|
4082
|
+
const fromInputAudioTranscription = getValueByPath(fromObject, [
|
|
4083
|
+
'inputAudioTranscription',
|
|
4084
|
+
]);
|
|
4085
|
+
if (parentObject !== undefined && fromInputAudioTranscription != null) {
|
|
4086
|
+
setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToVertex());
|
|
4087
|
+
}
|
|
4088
|
+
const fromOutputAudioTranscription = getValueByPath(fromObject, [
|
|
4089
|
+
'outputAudioTranscription',
|
|
4090
|
+
]);
|
|
4091
|
+
if (parentObject !== undefined && fromOutputAudioTranscription != null) {
|
|
4092
|
+
setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToVertex());
|
|
4093
|
+
}
|
|
4094
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
4095
|
+
'realtimeInputConfig',
|
|
4096
|
+
]);
|
|
4097
|
+
if (parentObject !== undefined && fromRealtimeInputConfig != null) {
|
|
4098
|
+
setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToVertex(apiClient, fromRealtimeInputConfig));
|
|
4099
|
+
}
|
|
4100
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
4101
|
+
'contextWindowCompression',
|
|
4102
|
+
]);
|
|
4103
|
+
if (parentObject !== undefined && fromContextWindowCompression != null) {
|
|
4104
|
+
setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToVertex(apiClient, fromContextWindowCompression));
|
|
4105
|
+
}
|
|
4106
|
+
return toObject;
|
|
4107
|
+
}
|
|
4108
|
+
function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
4109
|
+
const toObject = {};
|
|
4110
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
4111
|
+
if (fromModel != null) {
|
|
4112
|
+
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
4113
|
+
}
|
|
4114
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4115
|
+
if (fromConfig != null) {
|
|
4116
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
|
|
4117
|
+
}
|
|
4118
|
+
return toObject;
|
|
4119
|
+
}
|
|
4120
|
+
function liveConnectParametersToVertex(apiClient, fromObject) {
|
|
4121
|
+
const toObject = {};
|
|
4122
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
4123
|
+
if (fromModel != null) {
|
|
4124
|
+
setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
|
|
4125
|
+
}
|
|
4126
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4127
|
+
if (fromConfig != null) {
|
|
4128
|
+
setValueByPath(toObject, ['config'], liveConnectConfigToVertex(apiClient, fromConfig, toObject));
|
|
4129
|
+
}
|
|
4130
|
+
return toObject;
|
|
4131
|
+
}
|
|
4132
|
+
function liveServerSetupCompleteFromMldev() {
|
|
4133
|
+
const toObject = {};
|
|
4134
|
+
return toObject;
|
|
4135
|
+
}
|
|
4136
|
+
function liveServerSetupCompleteFromVertex() {
|
|
4137
|
+
const toObject = {};
|
|
4138
|
+
return toObject;
|
|
4139
|
+
}
|
|
4140
|
+
function partFromMldev$1(apiClient, fromObject) {
|
|
4141
|
+
const toObject = {};
|
|
4142
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4143
|
+
if (fromThought != null) {
|
|
4144
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
4145
|
+
}
|
|
4146
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4147
|
+
'codeExecutionResult',
|
|
4148
|
+
]);
|
|
4149
|
+
if (fromCodeExecutionResult != null) {
|
|
4150
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
4151
|
+
}
|
|
4152
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
4153
|
+
'executableCode',
|
|
4154
|
+
]);
|
|
4155
|
+
if (fromExecutableCode != null) {
|
|
4156
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4157
|
+
}
|
|
4158
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
4159
|
+
if (fromFileData != null) {
|
|
4160
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
4161
|
+
}
|
|
4162
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4163
|
+
if (fromFunctionCall != null) {
|
|
4164
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4165
|
+
}
|
|
4166
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4167
|
+
'functionResponse',
|
|
4168
|
+
]);
|
|
4169
|
+
if (fromFunctionResponse != null) {
|
|
4170
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4171
|
+
}
|
|
4172
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4173
|
+
if (fromInlineData != null) {
|
|
4174
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4175
|
+
}
|
|
4176
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
4177
|
+
if (fromText != null) {
|
|
4178
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
4179
|
+
}
|
|
4180
|
+
return toObject;
|
|
4181
|
+
}
|
|
4182
|
+
function partFromVertex$1(apiClient, fromObject) {
|
|
4183
|
+
const toObject = {};
|
|
4184
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
4185
|
+
'videoMetadata',
|
|
4186
|
+
]);
|
|
4187
|
+
if (fromVideoMetadata != null) {
|
|
4188
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
4189
|
+
}
|
|
4190
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4191
|
+
if (fromThought != null) {
|
|
4192
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
4193
|
+
}
|
|
4194
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4195
|
+
'codeExecutionResult',
|
|
4196
|
+
]);
|
|
4197
|
+
if (fromCodeExecutionResult != null) {
|
|
4198
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
4199
|
+
}
|
|
4200
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
4201
|
+
'executableCode',
|
|
4202
|
+
]);
|
|
4203
|
+
if (fromExecutableCode != null) {
|
|
4204
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4205
|
+
}
|
|
4206
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
4207
|
+
if (fromFileData != null) {
|
|
4208
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
4209
|
+
}
|
|
4210
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4211
|
+
if (fromFunctionCall != null) {
|
|
4212
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4213
|
+
}
|
|
4214
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4215
|
+
'functionResponse',
|
|
4216
|
+
]);
|
|
4217
|
+
if (fromFunctionResponse != null) {
|
|
4218
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4219
|
+
}
|
|
4220
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4221
|
+
if (fromInlineData != null) {
|
|
4222
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4223
|
+
}
|
|
4224
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
4225
|
+
if (fromText != null) {
|
|
4226
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
4227
|
+
}
|
|
4228
|
+
return toObject;
|
|
4229
|
+
}
|
|
4230
|
+
function contentFromMldev$1(apiClient, fromObject) {
|
|
4231
|
+
const toObject = {};
|
|
4232
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4233
|
+
if (fromParts != null) {
|
|
4234
|
+
if (Array.isArray(fromParts)) {
|
|
4235
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
4236
|
+
return partFromMldev$1(apiClient, item);
|
|
4237
|
+
}));
|
|
4238
|
+
}
|
|
4239
|
+
else {
|
|
4240
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4244
|
+
if (fromRole != null) {
|
|
4245
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
4246
|
+
}
|
|
4247
|
+
return toObject;
|
|
4248
|
+
}
|
|
4249
|
+
function contentFromVertex$1(apiClient, fromObject) {
|
|
4250
|
+
const toObject = {};
|
|
4251
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4252
|
+
if (fromParts != null) {
|
|
4253
|
+
if (Array.isArray(fromParts)) {
|
|
4254
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
4255
|
+
return partFromVertex$1(apiClient, item);
|
|
4256
|
+
}));
|
|
4257
|
+
}
|
|
4258
|
+
else {
|
|
4259
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4263
|
+
if (fromRole != null) {
|
|
4264
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
4265
|
+
}
|
|
4266
|
+
return toObject;
|
|
4267
|
+
}
|
|
4268
|
+
function transcriptionFromMldev(apiClient, fromObject) {
|
|
4269
|
+
const toObject = {};
|
|
4270
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
4271
|
+
if (fromText != null) {
|
|
4272
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
4273
|
+
}
|
|
4274
|
+
const fromFinished = getValueByPath(fromObject, ['finished']);
|
|
4275
|
+
if (fromFinished != null) {
|
|
4276
|
+
setValueByPath(toObject, ['finished'], fromFinished);
|
|
4277
|
+
}
|
|
4278
|
+
return toObject;
|
|
4279
|
+
}
|
|
4280
|
+
function transcriptionFromVertex(apiClient, fromObject) {
|
|
4281
|
+
const toObject = {};
|
|
4282
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
4283
|
+
if (fromText != null) {
|
|
4284
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
4285
|
+
}
|
|
4286
|
+
const fromFinished = getValueByPath(fromObject, ['finished']);
|
|
4287
|
+
if (fromFinished != null) {
|
|
4288
|
+
setValueByPath(toObject, ['finished'], fromFinished);
|
|
4289
|
+
}
|
|
4290
|
+
return toObject;
|
|
4291
|
+
}
|
|
4292
|
+
function liveServerContentFromMldev(apiClient, fromObject) {
|
|
4293
|
+
const toObject = {};
|
|
4294
|
+
const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
|
|
4295
|
+
if (fromModelTurn != null) {
|
|
4296
|
+
setValueByPath(toObject, ['modelTurn'], contentFromMldev$1(apiClient, fromModelTurn));
|
|
4297
|
+
}
|
|
4298
|
+
const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
|
|
4299
|
+
if (fromTurnComplete != null) {
|
|
4300
|
+
setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
|
|
4301
|
+
}
|
|
4302
|
+
const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
|
|
4303
|
+
if (fromInterrupted != null) {
|
|
4304
|
+
setValueByPath(toObject, ['interrupted'], fromInterrupted);
|
|
4305
|
+
}
|
|
4306
|
+
const fromGenerationComplete = getValueByPath(fromObject, [
|
|
4307
|
+
'generationComplete',
|
|
4308
|
+
]);
|
|
4309
|
+
if (fromGenerationComplete != null) {
|
|
4310
|
+
setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
|
|
4311
|
+
}
|
|
4312
|
+
const fromInputTranscription = getValueByPath(fromObject, [
|
|
4313
|
+
'inputTranscription',
|
|
4314
|
+
]);
|
|
4315
|
+
if (fromInputTranscription != null) {
|
|
4316
|
+
setValueByPath(toObject, ['inputTranscription'], transcriptionFromMldev(apiClient, fromInputTranscription));
|
|
4317
|
+
}
|
|
4318
|
+
const fromOutputTranscription = getValueByPath(fromObject, [
|
|
4319
|
+
'outputTranscription',
|
|
4320
|
+
]);
|
|
4321
|
+
if (fromOutputTranscription != null) {
|
|
4322
|
+
setValueByPath(toObject, ['outputTranscription'], transcriptionFromMldev(apiClient, fromOutputTranscription));
|
|
4323
|
+
}
|
|
4324
|
+
return toObject;
|
|
4325
|
+
}
|
|
4326
|
+
function liveServerContentFromVertex(apiClient, fromObject) {
|
|
4327
|
+
const toObject = {};
|
|
4328
|
+
const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
|
|
4329
|
+
if (fromModelTurn != null) {
|
|
4330
|
+
setValueByPath(toObject, ['modelTurn'], contentFromVertex$1(apiClient, fromModelTurn));
|
|
4331
|
+
}
|
|
4332
|
+
const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
|
|
4333
|
+
if (fromTurnComplete != null) {
|
|
4334
|
+
setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
|
|
4335
|
+
}
|
|
4336
|
+
const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
|
|
4337
|
+
if (fromInterrupted != null) {
|
|
4338
|
+
setValueByPath(toObject, ['interrupted'], fromInterrupted);
|
|
4339
|
+
}
|
|
4340
|
+
const fromGenerationComplete = getValueByPath(fromObject, [
|
|
4341
|
+
'generationComplete',
|
|
4342
|
+
]);
|
|
4343
|
+
if (fromGenerationComplete != null) {
|
|
4344
|
+
setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
|
|
4345
|
+
}
|
|
4346
|
+
const fromInputTranscription = getValueByPath(fromObject, [
|
|
4347
|
+
'inputTranscription',
|
|
4348
|
+
]);
|
|
4349
|
+
if (fromInputTranscription != null) {
|
|
4350
|
+
setValueByPath(toObject, ['inputTranscription'], transcriptionFromVertex(apiClient, fromInputTranscription));
|
|
4351
|
+
}
|
|
4352
|
+
const fromOutputTranscription = getValueByPath(fromObject, [
|
|
4353
|
+
'outputTranscription',
|
|
4354
|
+
]);
|
|
4355
|
+
if (fromOutputTranscription != null) {
|
|
4356
|
+
setValueByPath(toObject, ['outputTranscription'], transcriptionFromVertex(apiClient, fromOutputTranscription));
|
|
4357
|
+
}
|
|
4358
|
+
return toObject;
|
|
4359
|
+
}
|
|
4360
|
+
function functionCallFromMldev(apiClient, fromObject) {
|
|
4361
|
+
const toObject = {};
|
|
4362
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
4363
|
+
if (fromId != null) {
|
|
4364
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
4365
|
+
}
|
|
4366
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
4367
|
+
if (fromArgs != null) {
|
|
4368
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
4369
|
+
}
|
|
4370
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
4371
|
+
if (fromName != null) {
|
|
4372
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
4373
|
+
}
|
|
4374
|
+
return toObject;
|
|
4375
|
+
}
|
|
4376
|
+
function functionCallFromVertex(apiClient, fromObject) {
|
|
4377
|
+
const toObject = {};
|
|
4378
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
4379
|
+
if (fromArgs != null) {
|
|
4380
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
4381
|
+
}
|
|
4382
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
4383
|
+
if (fromName != null) {
|
|
4384
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
4385
|
+
}
|
|
4386
|
+
return toObject;
|
|
4387
|
+
}
|
|
4388
|
+
function liveServerToolCallFromMldev(apiClient, fromObject) {
|
|
4389
|
+
const toObject = {};
|
|
4390
|
+
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
4391
|
+
'functionCalls',
|
|
4392
|
+
]);
|
|
4393
|
+
if (fromFunctionCalls != null) {
|
|
4394
|
+
if (Array.isArray(fromFunctionCalls)) {
|
|
4395
|
+
setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
|
|
4396
|
+
return functionCallFromMldev(apiClient, item);
|
|
4397
|
+
}));
|
|
4398
|
+
}
|
|
4399
|
+
else {
|
|
4400
|
+
setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
return toObject;
|
|
4404
|
+
}
|
|
4405
|
+
function liveServerToolCallFromVertex(apiClient, fromObject) {
|
|
4406
|
+
const toObject = {};
|
|
4407
|
+
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
4408
|
+
'functionCalls',
|
|
4409
|
+
]);
|
|
4410
|
+
if (fromFunctionCalls != null) {
|
|
4411
|
+
if (Array.isArray(fromFunctionCalls)) {
|
|
4412
|
+
setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
|
|
4413
|
+
return functionCallFromVertex(apiClient, item);
|
|
4414
|
+
}));
|
|
4415
|
+
}
|
|
4416
|
+
else {
|
|
4417
|
+
setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
return toObject;
|
|
4421
|
+
}
|
|
4422
|
+
function liveServerToolCallCancellationFromMldev(apiClient, fromObject) {
|
|
4423
|
+
const toObject = {};
|
|
4424
|
+
const fromIds = getValueByPath(fromObject, ['ids']);
|
|
4425
|
+
if (fromIds != null) {
|
|
4426
|
+
setValueByPath(toObject, ['ids'], fromIds);
|
|
4427
|
+
}
|
|
4428
|
+
return toObject;
|
|
4429
|
+
}
|
|
4430
|
+
function liveServerToolCallCancellationFromVertex(apiClient, fromObject) {
|
|
4431
|
+
const toObject = {};
|
|
4432
|
+
const fromIds = getValueByPath(fromObject, ['ids']);
|
|
4433
|
+
if (fromIds != null) {
|
|
4434
|
+
setValueByPath(toObject, ['ids'], fromIds);
|
|
4435
|
+
}
|
|
4436
|
+
return toObject;
|
|
4437
|
+
}
|
|
4438
|
+
function modalityTokenCountFromMldev(apiClient, fromObject) {
|
|
4439
|
+
const toObject = {};
|
|
4440
|
+
const fromModality = getValueByPath(fromObject, ['modality']);
|
|
4441
|
+
if (fromModality != null) {
|
|
4442
|
+
setValueByPath(toObject, ['modality'], fromModality);
|
|
4443
|
+
}
|
|
4444
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
4445
|
+
if (fromTokenCount != null) {
|
|
4446
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
4447
|
+
}
|
|
4448
|
+
return toObject;
|
|
4449
|
+
}
|
|
4450
|
+
function modalityTokenCountFromVertex(apiClient, fromObject) {
|
|
4451
|
+
const toObject = {};
|
|
4452
|
+
const fromModality = getValueByPath(fromObject, ['modality']);
|
|
4453
|
+
if (fromModality != null) {
|
|
4454
|
+
setValueByPath(toObject, ['modality'], fromModality);
|
|
4455
|
+
}
|
|
4456
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
4457
|
+
if (fromTokenCount != null) {
|
|
4458
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
4459
|
+
}
|
|
4460
|
+
return toObject;
|
|
4461
|
+
}
|
|
4462
|
+
function usageMetadataFromMldev(apiClient, fromObject) {
|
|
4463
|
+
const toObject = {};
|
|
4464
|
+
const fromPromptTokenCount = getValueByPath(fromObject, [
|
|
4465
|
+
'promptTokenCount',
|
|
4466
|
+
]);
|
|
4467
|
+
if (fromPromptTokenCount != null) {
|
|
4468
|
+
setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
|
|
4469
|
+
}
|
|
4470
|
+
const fromCachedContentTokenCount = getValueByPath(fromObject, [
|
|
4471
|
+
'cachedContentTokenCount',
|
|
4472
|
+
]);
|
|
4473
|
+
if (fromCachedContentTokenCount != null) {
|
|
4474
|
+
setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
|
|
4475
|
+
}
|
|
4476
|
+
const fromResponseTokenCount = getValueByPath(fromObject, [
|
|
4477
|
+
'responseTokenCount',
|
|
4478
|
+
]);
|
|
4479
|
+
if (fromResponseTokenCount != null) {
|
|
4480
|
+
setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
|
|
4481
|
+
}
|
|
4482
|
+
const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
|
|
4483
|
+
'toolUsePromptTokenCount',
|
|
4484
|
+
]);
|
|
4485
|
+
if (fromToolUsePromptTokenCount != null) {
|
|
4486
|
+
setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
|
|
4487
|
+
}
|
|
4488
|
+
const fromThoughtsTokenCount = getValueByPath(fromObject, [
|
|
4489
|
+
'thoughtsTokenCount',
|
|
4490
|
+
]);
|
|
4491
|
+
if (fromThoughtsTokenCount != null) {
|
|
4492
|
+
setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
|
|
4493
|
+
}
|
|
4494
|
+
const fromTotalTokenCount = getValueByPath(fromObject, [
|
|
4495
|
+
'totalTokenCount',
|
|
4496
|
+
]);
|
|
4497
|
+
if (fromTotalTokenCount != null) {
|
|
4498
|
+
setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
|
|
4499
|
+
}
|
|
4500
|
+
const fromPromptTokensDetails = getValueByPath(fromObject, [
|
|
4501
|
+
'promptTokensDetails',
|
|
4502
|
+
]);
|
|
4503
|
+
if (fromPromptTokensDetails != null) {
|
|
4504
|
+
if (Array.isArray(fromPromptTokensDetails)) {
|
|
4505
|
+
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
|
|
4506
|
+
return modalityTokenCountFromMldev(apiClient, item);
|
|
4507
|
+
}));
|
|
4508
|
+
}
|
|
4509
|
+
else {
|
|
4510
|
+
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
|
|
4511
|
+
}
|
|
4512
|
+
}
|
|
4513
|
+
const fromCacheTokensDetails = getValueByPath(fromObject, [
|
|
4514
|
+
'cacheTokensDetails',
|
|
4515
|
+
]);
|
|
4516
|
+
if (fromCacheTokensDetails != null) {
|
|
4517
|
+
if (Array.isArray(fromCacheTokensDetails)) {
|
|
4518
|
+
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
|
|
4519
|
+
return modalityTokenCountFromMldev(apiClient, item);
|
|
4520
|
+
}));
|
|
4521
|
+
}
|
|
4522
|
+
else {
|
|
4523
|
+
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
|
|
4524
|
+
}
|
|
4525
|
+
}
|
|
4526
|
+
const fromResponseTokensDetails = getValueByPath(fromObject, [
|
|
4527
|
+
'responseTokensDetails',
|
|
4528
|
+
]);
|
|
4529
|
+
if (fromResponseTokensDetails != null) {
|
|
4530
|
+
if (Array.isArray(fromResponseTokensDetails)) {
|
|
4531
|
+
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
|
|
4532
|
+
return modalityTokenCountFromMldev(apiClient, item);
|
|
4533
|
+
}));
|
|
4534
|
+
}
|
|
4535
|
+
else {
|
|
4536
|
+
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
|
|
4537
|
+
}
|
|
4538
|
+
}
|
|
4539
|
+
const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
|
|
4540
|
+
'toolUsePromptTokensDetails',
|
|
4541
|
+
]);
|
|
4542
|
+
if (fromToolUsePromptTokensDetails != null) {
|
|
4543
|
+
if (Array.isArray(fromToolUsePromptTokensDetails)) {
|
|
4544
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
|
|
4545
|
+
return modalityTokenCountFromMldev(apiClient, item);
|
|
4546
|
+
}));
|
|
4547
|
+
}
|
|
4548
|
+
else {
|
|
4549
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
|
|
4550
|
+
}
|
|
4551
|
+
}
|
|
4552
|
+
return toObject;
|
|
4553
|
+
}
|
|
4554
|
+
function usageMetadataFromVertex(apiClient, fromObject) {
|
|
4555
|
+
const toObject = {};
|
|
4556
|
+
const fromPromptTokenCount = getValueByPath(fromObject, [
|
|
4557
|
+
'promptTokenCount',
|
|
4558
|
+
]);
|
|
4559
|
+
if (fromPromptTokenCount != null) {
|
|
4560
|
+
setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
|
|
4561
|
+
}
|
|
4562
|
+
const fromCachedContentTokenCount = getValueByPath(fromObject, [
|
|
4563
|
+
'cachedContentTokenCount',
|
|
4564
|
+
]);
|
|
4565
|
+
if (fromCachedContentTokenCount != null) {
|
|
4566
|
+
setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
|
|
4567
|
+
}
|
|
4568
|
+
const fromResponseTokenCount = getValueByPath(fromObject, [
|
|
4569
|
+
'candidatesTokenCount',
|
|
4570
|
+
]);
|
|
4571
|
+
if (fromResponseTokenCount != null) {
|
|
4572
|
+
setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
|
|
4573
|
+
}
|
|
4574
|
+
const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
|
|
4575
|
+
'toolUsePromptTokenCount',
|
|
4576
|
+
]);
|
|
4577
|
+
if (fromToolUsePromptTokenCount != null) {
|
|
4578
|
+
setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
|
|
4579
|
+
}
|
|
4580
|
+
const fromThoughtsTokenCount = getValueByPath(fromObject, [
|
|
4581
|
+
'thoughtsTokenCount',
|
|
4582
|
+
]);
|
|
4583
|
+
if (fromThoughtsTokenCount != null) {
|
|
4584
|
+
setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
|
|
4585
|
+
}
|
|
4586
|
+
const fromTotalTokenCount = getValueByPath(fromObject, [
|
|
4587
|
+
'totalTokenCount',
|
|
4588
|
+
]);
|
|
4589
|
+
if (fromTotalTokenCount != null) {
|
|
4590
|
+
setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
|
|
4591
|
+
}
|
|
4592
|
+
const fromPromptTokensDetails = getValueByPath(fromObject, [
|
|
4593
|
+
'promptTokensDetails',
|
|
4594
|
+
]);
|
|
4595
|
+
if (fromPromptTokensDetails != null) {
|
|
4596
|
+
if (Array.isArray(fromPromptTokensDetails)) {
|
|
4597
|
+
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
|
|
4598
|
+
return modalityTokenCountFromVertex(apiClient, item);
|
|
4599
|
+
}));
|
|
4600
|
+
}
|
|
4601
|
+
else {
|
|
4602
|
+
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
const fromCacheTokensDetails = getValueByPath(fromObject, [
|
|
4606
|
+
'cacheTokensDetails',
|
|
4607
|
+
]);
|
|
4608
|
+
if (fromCacheTokensDetails != null) {
|
|
4609
|
+
if (Array.isArray(fromCacheTokensDetails)) {
|
|
4610
|
+
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
|
|
4611
|
+
return modalityTokenCountFromVertex(apiClient, item);
|
|
4612
|
+
}));
|
|
4613
|
+
}
|
|
4614
|
+
else {
|
|
4615
|
+
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
const fromResponseTokensDetails = getValueByPath(fromObject, [
|
|
4619
|
+
'candidatesTokensDetails',
|
|
4620
|
+
]);
|
|
4621
|
+
if (fromResponseTokensDetails != null) {
|
|
4622
|
+
if (Array.isArray(fromResponseTokensDetails)) {
|
|
4623
|
+
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
|
|
4624
|
+
return modalityTokenCountFromVertex(apiClient, item);
|
|
4625
|
+
}));
|
|
4626
|
+
}
|
|
4627
|
+
else {
|
|
4628
|
+
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
|
|
4629
|
+
}
|
|
4630
|
+
}
|
|
4631
|
+
const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
|
|
4632
|
+
'toolUsePromptTokensDetails',
|
|
4633
|
+
]);
|
|
4634
|
+
if (fromToolUsePromptTokensDetails != null) {
|
|
4635
|
+
if (Array.isArray(fromToolUsePromptTokensDetails)) {
|
|
4636
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
|
|
4637
|
+
return modalityTokenCountFromVertex(apiClient, item);
|
|
4638
|
+
}));
|
|
4639
|
+
}
|
|
4640
|
+
else {
|
|
4641
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
const fromTrafficType = getValueByPath(fromObject, ['trafficType']);
|
|
4645
|
+
if (fromTrafficType != null) {
|
|
4646
|
+
setValueByPath(toObject, ['trafficType'], fromTrafficType);
|
|
4647
|
+
}
|
|
4648
|
+
return toObject;
|
|
4649
|
+
}
|
|
4650
|
+
function liveServerGoAwayFromMldev(apiClient, fromObject) {
|
|
4651
|
+
const toObject = {};
|
|
4652
|
+
const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
|
|
4653
|
+
if (fromTimeLeft != null) {
|
|
4654
|
+
setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
|
|
4655
|
+
}
|
|
4656
|
+
return toObject;
|
|
4657
|
+
}
|
|
4658
|
+
function liveServerGoAwayFromVertex(apiClient, fromObject) {
|
|
4659
|
+
const toObject = {};
|
|
4660
|
+
const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
|
|
4661
|
+
if (fromTimeLeft != null) {
|
|
4662
|
+
setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
|
|
4663
|
+
}
|
|
4664
|
+
return toObject;
|
|
4665
|
+
}
|
|
4666
|
+
function liveServerSessionResumptionUpdateFromMldev(apiClient, fromObject) {
|
|
4667
|
+
const toObject = {};
|
|
4668
|
+
const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
|
|
4669
|
+
if (fromNewHandle != null) {
|
|
4670
|
+
setValueByPath(toObject, ['newHandle'], fromNewHandle);
|
|
4671
|
+
}
|
|
4672
|
+
const fromResumable = getValueByPath(fromObject, ['resumable']);
|
|
4673
|
+
if (fromResumable != null) {
|
|
4674
|
+
setValueByPath(toObject, ['resumable'], fromResumable);
|
|
4675
|
+
}
|
|
4676
|
+
const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
|
|
4677
|
+
'lastConsumedClientMessageIndex',
|
|
4678
|
+
]);
|
|
4679
|
+
if (fromLastConsumedClientMessageIndex != null) {
|
|
4680
|
+
setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
|
|
4681
|
+
}
|
|
4682
|
+
return toObject;
|
|
4683
|
+
}
|
|
4684
|
+
function liveServerSessionResumptionUpdateFromVertex(apiClient, fromObject) {
|
|
4685
|
+
const toObject = {};
|
|
4686
|
+
const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
|
|
4687
|
+
if (fromNewHandle != null) {
|
|
4688
|
+
setValueByPath(toObject, ['newHandle'], fromNewHandle);
|
|
4689
|
+
}
|
|
4690
|
+
const fromResumable = getValueByPath(fromObject, ['resumable']);
|
|
4691
|
+
if (fromResumable != null) {
|
|
4692
|
+
setValueByPath(toObject, ['resumable'], fromResumable);
|
|
4693
|
+
}
|
|
4694
|
+
const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
|
|
4695
|
+
'lastConsumedClientMessageIndex',
|
|
4696
|
+
]);
|
|
4697
|
+
if (fromLastConsumedClientMessageIndex != null) {
|
|
4698
|
+
setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
|
|
4699
|
+
}
|
|
4700
|
+
return toObject;
|
|
4701
|
+
}
|
|
4702
|
+
function liveServerMessageFromMldev(apiClient, fromObject) {
|
|
4703
|
+
const toObject = {};
|
|
4704
|
+
const fromSetupComplete = getValueByPath(fromObject, [
|
|
4705
|
+
'setupComplete',
|
|
4706
|
+
]);
|
|
4707
|
+
if (fromSetupComplete != null) {
|
|
4708
|
+
setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromMldev());
|
|
4709
|
+
}
|
|
4710
|
+
const fromServerContent = getValueByPath(fromObject, [
|
|
4711
|
+
'serverContent',
|
|
4712
|
+
]);
|
|
4713
|
+
if (fromServerContent != null) {
|
|
4714
|
+
setValueByPath(toObject, ['serverContent'], liveServerContentFromMldev(apiClient, fromServerContent));
|
|
4715
|
+
}
|
|
4716
|
+
const fromToolCall = getValueByPath(fromObject, ['toolCall']);
|
|
4717
|
+
if (fromToolCall != null) {
|
|
4718
|
+
setValueByPath(toObject, ['toolCall'], liveServerToolCallFromMldev(apiClient, fromToolCall));
|
|
4719
|
+
}
|
|
4720
|
+
const fromToolCallCancellation = getValueByPath(fromObject, [
|
|
4721
|
+
'toolCallCancellation',
|
|
4722
|
+
]);
|
|
4723
|
+
if (fromToolCallCancellation != null) {
|
|
4724
|
+
setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromMldev(apiClient, fromToolCallCancellation));
|
|
4725
|
+
}
|
|
4726
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
4727
|
+
'usageMetadata',
|
|
4728
|
+
]);
|
|
4729
|
+
if (fromUsageMetadata != null) {
|
|
4730
|
+
setValueByPath(toObject, ['usageMetadata'], usageMetadataFromMldev(apiClient, fromUsageMetadata));
|
|
4731
|
+
}
|
|
4732
|
+
const fromGoAway = getValueByPath(fromObject, ['goAway']);
|
|
4733
|
+
if (fromGoAway != null) {
|
|
4734
|
+
setValueByPath(toObject, ['goAway'], liveServerGoAwayFromMldev(apiClient, fromGoAway));
|
|
4735
|
+
}
|
|
4736
|
+
const fromSessionResumptionUpdate = getValueByPath(fromObject, [
|
|
4737
|
+
'sessionResumptionUpdate',
|
|
4738
|
+
]);
|
|
4739
|
+
if (fromSessionResumptionUpdate != null) {
|
|
4740
|
+
setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromMldev(apiClient, fromSessionResumptionUpdate));
|
|
4741
|
+
}
|
|
4742
|
+
return toObject;
|
|
4743
|
+
}
|
|
4744
|
+
function liveServerMessageFromVertex(apiClient, fromObject) {
|
|
4745
|
+
const toObject = {};
|
|
4746
|
+
const fromSetupComplete = getValueByPath(fromObject, [
|
|
4747
|
+
'setupComplete',
|
|
4748
|
+
]);
|
|
4749
|
+
if (fromSetupComplete != null) {
|
|
4750
|
+
setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex());
|
|
4751
|
+
}
|
|
4752
|
+
const fromServerContent = getValueByPath(fromObject, [
|
|
4753
|
+
'serverContent',
|
|
4754
|
+
]);
|
|
4755
|
+
if (fromServerContent != null) {
|
|
4756
|
+
setValueByPath(toObject, ['serverContent'], liveServerContentFromVertex(apiClient, fromServerContent));
|
|
4757
|
+
}
|
|
4758
|
+
const fromToolCall = getValueByPath(fromObject, ['toolCall']);
|
|
4759
|
+
if (fromToolCall != null) {
|
|
4760
|
+
setValueByPath(toObject, ['toolCall'], liveServerToolCallFromVertex(apiClient, fromToolCall));
|
|
4761
|
+
}
|
|
4762
|
+
const fromToolCallCancellation = getValueByPath(fromObject, [
|
|
4763
|
+
'toolCallCancellation',
|
|
4764
|
+
]);
|
|
4765
|
+
if (fromToolCallCancellation != null) {
|
|
4766
|
+
setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromVertex(apiClient, fromToolCallCancellation));
|
|
4767
|
+
}
|
|
4768
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
4769
|
+
'usageMetadata',
|
|
4770
|
+
]);
|
|
4771
|
+
if (fromUsageMetadata != null) {
|
|
4772
|
+
setValueByPath(toObject, ['usageMetadata'], usageMetadataFromVertex(apiClient, fromUsageMetadata));
|
|
4773
|
+
}
|
|
4774
|
+
const fromGoAway = getValueByPath(fromObject, ['goAway']);
|
|
4775
|
+
if (fromGoAway != null) {
|
|
4776
|
+
setValueByPath(toObject, ['goAway'], liveServerGoAwayFromVertex(apiClient, fromGoAway));
|
|
4777
|
+
}
|
|
4778
|
+
const fromSessionResumptionUpdate = getValueByPath(fromObject, [
|
|
4779
|
+
'sessionResumptionUpdate',
|
|
4780
|
+
]);
|
|
4781
|
+
if (fromSessionResumptionUpdate != null) {
|
|
4782
|
+
setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromVertex(apiClient, fromSessionResumptionUpdate));
|
|
4783
|
+
}
|
|
4784
|
+
return toObject;
|
|
4785
|
+
}
|
|
4786
|
+
|
|
4787
|
+
/**
|
|
4788
|
+
* @license
|
|
4789
|
+
* Copyright 2025 Google LLC
|
|
4790
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4791
|
+
*/
|
|
4792
|
+
function partToMldev(apiClient, fromObject) {
|
|
4793
|
+
const toObject = {};
|
|
4794
|
+
if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
|
|
4795
|
+
throw new Error('videoMetadata parameter is not supported in Gemini API.');
|
|
4796
|
+
}
|
|
4797
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4798
|
+
if (fromThought != null) {
|
|
4799
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
4800
|
+
}
|
|
4801
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4802
|
+
'codeExecutionResult',
|
|
4803
|
+
]);
|
|
4804
|
+
if (fromCodeExecutionResult != null) {
|
|
4805
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
4806
|
+
}
|
|
4807
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
4808
|
+
'executableCode',
|
|
4809
|
+
]);
|
|
4810
|
+
if (fromExecutableCode != null) {
|
|
4811
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4812
|
+
}
|
|
4813
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
4814
|
+
if (fromFileData != null) {
|
|
4815
|
+
setValueByPath(toObject, ['fileData'], fromFileData);
|
|
4816
|
+
}
|
|
4817
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4818
|
+
if (fromFunctionCall != null) {
|
|
4819
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
4820
|
+
}
|
|
4821
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4822
|
+
'functionResponse',
|
|
4823
|
+
]);
|
|
4824
|
+
if (fromFunctionResponse != null) {
|
|
4825
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4826
|
+
}
|
|
4827
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4828
|
+
if (fromInlineData != null) {
|
|
4829
|
+
setValueByPath(toObject, ['inlineData'], fromInlineData);
|
|
4830
|
+
}
|
|
4831
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
4832
|
+
if (fromText != null) {
|
|
4833
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
4834
|
+
}
|
|
4835
|
+
return toObject;
|
|
4836
|
+
}
|
|
4837
|
+
function contentToMldev(apiClient, fromObject) {
|
|
4838
|
+
const toObject = {};
|
|
4839
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
4840
|
+
if (fromParts != null) {
|
|
4841
|
+
if (Array.isArray(fromParts)) {
|
|
4842
|
+
setValueByPath(toObject, ['parts'], fromParts.map((item) => {
|
|
4843
|
+
return partToMldev(apiClient, item);
|
|
4844
|
+
}));
|
|
4845
|
+
}
|
|
4846
|
+
else {
|
|
4847
|
+
setValueByPath(toObject, ['parts'], fromParts);
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
4850
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
4851
|
+
if (fromRole != null) {
|
|
4852
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
4853
|
+
}
|
|
4854
|
+
return toObject;
|
|
4855
|
+
}
|
|
4856
|
+
function schemaToMldev(apiClient, fromObject) {
|
|
4857
|
+
const toObject = {};
|
|
4858
|
+
if (getValueByPath(fromObject, ['example']) !== undefined) {
|
|
4859
|
+
throw new Error('example parameter is not supported in Gemini API.');
|
|
4860
|
+
}
|
|
4861
|
+
if (getValueByPath(fromObject, ['pattern']) !== undefined) {
|
|
4862
|
+
throw new Error('pattern parameter is not supported in Gemini API.');
|
|
4863
|
+
}
|
|
4864
|
+
if (getValueByPath(fromObject, ['default']) !== undefined) {
|
|
4865
|
+
throw new Error('default parameter is not supported in Gemini API.');
|
|
4866
|
+
}
|
|
4867
|
+
if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
|
|
4868
|
+
throw new Error('maxLength parameter is not supported in Gemini API.');
|
|
4869
|
+
}
|
|
4870
|
+
if (getValueByPath(fromObject, ['minLength']) !== undefined) {
|
|
4871
|
+
throw new Error('minLength parameter is not supported in Gemini API.');
|
|
4872
|
+
}
|
|
4873
|
+
if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
|
|
4874
|
+
throw new Error('minProperties parameter is not supported in Gemini API.');
|
|
4875
|
+
}
|
|
4876
|
+
if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
|
|
4877
|
+
throw new Error('maxProperties parameter is not supported in Gemini API.');
|
|
4878
|
+
}
|
|
4879
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
4880
|
+
if (fromAnyOf != null) {
|
|
4881
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
4882
|
+
}
|
|
4883
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
4884
|
+
if (fromDescription != null) {
|
|
4885
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
4886
|
+
}
|
|
4887
|
+
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
4888
|
+
if (fromEnum != null) {
|
|
4889
|
+
setValueByPath(toObject, ['enum'], fromEnum);
|
|
4890
|
+
}
|
|
4891
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
4892
|
+
if (fromFormat != null) {
|
|
4893
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
4894
|
+
}
|
|
4895
|
+
const fromItems = getValueByPath(fromObject, ['items']);
|
|
4896
|
+
if (fromItems != null) {
|
|
4897
|
+
setValueByPath(toObject, ['items'], fromItems);
|
|
4898
|
+
}
|
|
4899
|
+
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
4900
|
+
if (fromMaxItems != null) {
|
|
4901
|
+
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
4902
|
+
}
|
|
4903
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
4904
|
+
if (fromMaximum != null) {
|
|
4905
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
4906
|
+
}
|
|
4907
|
+
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
4908
|
+
if (fromMinItems != null) {
|
|
4909
|
+
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
4910
|
+
}
|
|
4911
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
4912
|
+
if (fromMinimum != null) {
|
|
4913
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
4914
|
+
}
|
|
4915
|
+
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
4916
|
+
if (fromNullable != null) {
|
|
4917
|
+
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
4918
|
+
}
|
|
4919
|
+
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
4920
|
+
if (fromProperties != null) {
|
|
4921
|
+
setValueByPath(toObject, ['properties'], fromProperties);
|
|
4922
|
+
}
|
|
4923
|
+
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
4924
|
+
'propertyOrdering',
|
|
4925
|
+
]);
|
|
4926
|
+
if (fromPropertyOrdering != null) {
|
|
4927
|
+
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
4928
|
+
}
|
|
4929
|
+
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
4930
|
+
if (fromRequired != null) {
|
|
4931
|
+
setValueByPath(toObject, ['required'], fromRequired);
|
|
4932
|
+
}
|
|
4933
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
4934
|
+
if (fromTitle != null) {
|
|
4935
|
+
setValueByPath(toObject, ['title'], fromTitle);
|
|
4936
|
+
}
|
|
4937
|
+
const fromType = getValueByPath(fromObject, ['type']);
|
|
4938
|
+
if (fromType != null) {
|
|
4939
|
+
setValueByPath(toObject, ['type'], fromType);
|
|
4940
|
+
}
|
|
4941
|
+
return toObject;
|
|
4942
|
+
}
|
|
4943
|
+
function safetySettingToMldev(apiClient, fromObject) {
|
|
4944
|
+
const toObject = {};
|
|
4945
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
4946
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
4947
|
+
}
|
|
4948
|
+
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
4949
|
+
if (fromCategory != null) {
|
|
4950
|
+
setValueByPath(toObject, ['category'], fromCategory);
|
|
4951
|
+
}
|
|
4952
|
+
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
4953
|
+
if (fromThreshold != null) {
|
|
4954
|
+
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
4955
|
+
}
|
|
4956
|
+
return toObject;
|
|
4957
|
+
}
|
|
4958
|
+
function functionDeclarationToMldev(apiClient, fromObject) {
|
|
4959
|
+
const toObject = {};
|
|
4960
|
+
if (getValueByPath(fromObject, ['response']) !== undefined) {
|
|
4961
|
+
throw new Error('response parameter is not supported in Gemini API.');
|
|
4962
|
+
}
|
|
4963
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
4964
|
+
if (fromDescription != null) {
|
|
4965
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
4966
|
+
}
|
|
4967
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
4968
|
+
if (fromName != null) {
|
|
4969
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
4970
|
+
}
|
|
4971
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
4972
|
+
if (fromParameters != null) {
|
|
4973
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
4974
|
+
}
|
|
4975
|
+
return toObject;
|
|
4976
|
+
}
|
|
4977
|
+
function googleSearchToMldev() {
|
|
4978
|
+
const toObject = {};
|
|
4979
|
+
return toObject;
|
|
4980
|
+
}
|
|
4981
|
+
function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
|
|
4982
|
+
const toObject = {};
|
|
4983
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
4984
|
+
if (fromMode != null) {
|
|
4985
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
4986
|
+
}
|
|
4987
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
4988
|
+
'dynamicThreshold',
|
|
4989
|
+
]);
|
|
4990
|
+
if (fromDynamicThreshold != null) {
|
|
4991
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
4992
|
+
}
|
|
4993
|
+
return toObject;
|
|
4994
|
+
}
|
|
4995
|
+
function googleSearchRetrievalToMldev(apiClient, fromObject) {
|
|
4996
|
+
const toObject = {};
|
|
4997
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
4998
|
+
'dynamicRetrievalConfig',
|
|
4999
|
+
]);
|
|
5000
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
5001
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
|
|
3536
5002
|
}
|
|
3537
5003
|
return toObject;
|
|
3538
5004
|
}
|
|
@@ -3620,6 +5086,10 @@ function speechConfigToMldev(apiClient, fromObject) {
|
|
|
3620
5086
|
if (fromVoiceConfig != null) {
|
|
3621
5087
|
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
|
|
3622
5088
|
}
|
|
5089
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
5090
|
+
if (fromLanguageCode != null) {
|
|
5091
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
5092
|
+
}
|
|
3623
5093
|
return toObject;
|
|
3624
5094
|
}
|
|
3625
5095
|
function thinkingConfigToMldev(apiClient, fromObject) {
|
|
@@ -3630,6 +5100,12 @@ function thinkingConfigToMldev(apiClient, fromObject) {
|
|
|
3630
5100
|
if (fromIncludeThoughts != null) {
|
|
3631
5101
|
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3632
5102
|
}
|
|
5103
|
+
const fromThinkingBudget = getValueByPath(fromObject, [
|
|
5104
|
+
'thinkingBudget',
|
|
5105
|
+
]);
|
|
5106
|
+
if (fromThinkingBudget != null) {
|
|
5107
|
+
setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
|
|
5108
|
+
}
|
|
3633
5109
|
return toObject;
|
|
3634
5110
|
}
|
|
3635
5111
|
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
@@ -3711,6 +5187,9 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
3711
5187
|
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
3712
5188
|
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
3713
5189
|
}
|
|
5190
|
+
if (getValueByPath(fromObject, ['modelSelectionConfig']) !== undefined) {
|
|
5191
|
+
throw new Error('modelSelectionConfig parameter is not supported in Gemini API.');
|
|
5192
|
+
}
|
|
3714
5193
|
const fromSafetySettings = getValueByPath(fromObject, [
|
|
3715
5194
|
'safetySettings',
|
|
3716
5195
|
]);
|
|
@@ -3933,6 +5412,18 @@ function generateImagesParametersToMldev(apiClient, fromObject) {
|
|
|
3933
5412
|
}
|
|
3934
5413
|
return toObject;
|
|
3935
5414
|
}
|
|
5415
|
+
function getModelParametersToMldev(apiClient, fromObject) {
|
|
5416
|
+
const toObject = {};
|
|
5417
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
5418
|
+
if (fromModel != null) {
|
|
5419
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
5420
|
+
}
|
|
5421
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5422
|
+
if (fromConfig != null) {
|
|
5423
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
5424
|
+
}
|
|
5425
|
+
return toObject;
|
|
5426
|
+
}
|
|
3936
5427
|
function countTokensConfigToMldev(apiClient, fromObject) {
|
|
3937
5428
|
const toObject = {};
|
|
3938
5429
|
if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
|
|
@@ -4219,6 +5710,16 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
4219
5710
|
}
|
|
4220
5711
|
return toObject;
|
|
4221
5712
|
}
|
|
5713
|
+
function modelSelectionConfigToVertex(apiClient, fromObject) {
|
|
5714
|
+
const toObject = {};
|
|
5715
|
+
const fromFeatureSelectionPreference = getValueByPath(fromObject, [
|
|
5716
|
+
'featureSelectionPreference',
|
|
5717
|
+
]);
|
|
5718
|
+
if (fromFeatureSelectionPreference != null) {
|
|
5719
|
+
setValueByPath(toObject, ['featureSelectionPreference'], fromFeatureSelectionPreference);
|
|
5720
|
+
}
|
|
5721
|
+
return toObject;
|
|
5722
|
+
}
|
|
4222
5723
|
function safetySettingToVertex(apiClient, fromObject) {
|
|
4223
5724
|
const toObject = {};
|
|
4224
5725
|
const fromMethod = getValueByPath(fromObject, ['method']);
|
|
@@ -4368,6 +5869,10 @@ function speechConfigToVertex(apiClient, fromObject) {
|
|
|
4368
5869
|
if (fromVoiceConfig != null) {
|
|
4369
5870
|
setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(apiClient, fromVoiceConfig));
|
|
4370
5871
|
}
|
|
5872
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
5873
|
+
if (fromLanguageCode != null) {
|
|
5874
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
5875
|
+
}
|
|
4371
5876
|
return toObject;
|
|
4372
5877
|
}
|
|
4373
5878
|
function thinkingConfigToVertex(apiClient, fromObject) {
|
|
@@ -4378,6 +5883,12 @@ function thinkingConfigToVertex(apiClient, fromObject) {
|
|
|
4378
5883
|
if (fromIncludeThoughts != null) {
|
|
4379
5884
|
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
4380
5885
|
}
|
|
5886
|
+
const fromThinkingBudget = getValueByPath(fromObject, [
|
|
5887
|
+
'thinkingBudget',
|
|
5888
|
+
]);
|
|
5889
|
+
if (fromThinkingBudget != null) {
|
|
5890
|
+
setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
|
|
5891
|
+
}
|
|
4381
5892
|
return toObject;
|
|
4382
5893
|
}
|
|
4383
5894
|
function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
@@ -4462,6 +5973,12 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
4462
5973
|
if (fromRoutingConfig != null) {
|
|
4463
5974
|
setValueByPath(toObject, ['routingConfig'], fromRoutingConfig);
|
|
4464
5975
|
}
|
|
5976
|
+
const fromModelSelectionConfig = getValueByPath(fromObject, [
|
|
5977
|
+
'modelSelectionConfig',
|
|
5978
|
+
]);
|
|
5979
|
+
if (fromModelSelectionConfig != null) {
|
|
5980
|
+
setValueByPath(toObject, ['modelConfig'], modelSelectionConfigToVertex(apiClient, fromModelSelectionConfig));
|
|
5981
|
+
}
|
|
4465
5982
|
const fromSafetySettings = getValueByPath(fromObject, [
|
|
4466
5983
|
'safetySettings',
|
|
4467
5984
|
]);
|
|
@@ -4695,6 +6212,18 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
|
4695
6212
|
}
|
|
4696
6213
|
return toObject;
|
|
4697
6214
|
}
|
|
6215
|
+
function getModelParametersToVertex(apiClient, fromObject) {
|
|
6216
|
+
const toObject = {};
|
|
6217
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
6218
|
+
if (fromModel != null) {
|
|
6219
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
6220
|
+
}
|
|
6221
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6222
|
+
if (fromConfig != null) {
|
|
6223
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
6224
|
+
}
|
|
6225
|
+
return toObject;
|
|
6226
|
+
}
|
|
4698
6227
|
function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
|
|
4699
6228
|
const toObject = {};
|
|
4700
6229
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
@@ -5118,6 +6647,64 @@ function generateImagesResponseFromMldev(apiClient, fromObject) {
|
|
|
5118
6647
|
}
|
|
5119
6648
|
return toObject;
|
|
5120
6649
|
}
|
|
6650
|
+
function tunedModelInfoFromMldev(apiClient, fromObject) {
|
|
6651
|
+
const toObject = {};
|
|
6652
|
+
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
6653
|
+
if (fromBaseModel != null) {
|
|
6654
|
+
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
6655
|
+
}
|
|
6656
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
6657
|
+
if (fromCreateTime != null) {
|
|
6658
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
6659
|
+
}
|
|
6660
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
6661
|
+
if (fromUpdateTime != null) {
|
|
6662
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
6663
|
+
}
|
|
6664
|
+
return toObject;
|
|
6665
|
+
}
|
|
6666
|
+
function modelFromMldev(apiClient, fromObject) {
|
|
6667
|
+
const toObject = {};
|
|
6668
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
6669
|
+
if (fromName != null) {
|
|
6670
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
6671
|
+
}
|
|
6672
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
6673
|
+
if (fromDisplayName != null) {
|
|
6674
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
6675
|
+
}
|
|
6676
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
6677
|
+
if (fromDescription != null) {
|
|
6678
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
6679
|
+
}
|
|
6680
|
+
const fromVersion = getValueByPath(fromObject, ['version']);
|
|
6681
|
+
if (fromVersion != null) {
|
|
6682
|
+
setValueByPath(toObject, ['version'], fromVersion);
|
|
6683
|
+
}
|
|
6684
|
+
const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
|
|
6685
|
+
if (fromTunedModelInfo != null) {
|
|
6686
|
+
setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromMldev(apiClient, fromTunedModelInfo));
|
|
6687
|
+
}
|
|
6688
|
+
const fromInputTokenLimit = getValueByPath(fromObject, [
|
|
6689
|
+
'inputTokenLimit',
|
|
6690
|
+
]);
|
|
6691
|
+
if (fromInputTokenLimit != null) {
|
|
6692
|
+
setValueByPath(toObject, ['inputTokenLimit'], fromInputTokenLimit);
|
|
6693
|
+
}
|
|
6694
|
+
const fromOutputTokenLimit = getValueByPath(fromObject, [
|
|
6695
|
+
'outputTokenLimit',
|
|
6696
|
+
]);
|
|
6697
|
+
if (fromOutputTokenLimit != null) {
|
|
6698
|
+
setValueByPath(toObject, ['outputTokenLimit'], fromOutputTokenLimit);
|
|
6699
|
+
}
|
|
6700
|
+
const fromSupportedActions = getValueByPath(fromObject, [
|
|
6701
|
+
'supportedGenerationMethods',
|
|
6702
|
+
]);
|
|
6703
|
+
if (fromSupportedActions != null) {
|
|
6704
|
+
setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
|
|
6705
|
+
}
|
|
6706
|
+
return toObject;
|
|
6707
|
+
}
|
|
5121
6708
|
function countTokensResponseFromMldev(apiClient, fromObject) {
|
|
5122
6709
|
const toObject = {};
|
|
5123
6710
|
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
@@ -5206,16 +6793,12 @@ function generateVideosOperationFromMldev$1(apiClient, fromObject) {
|
|
|
5206
6793
|
if (fromError != null) {
|
|
5207
6794
|
setValueByPath(toObject, ['error'], fromError);
|
|
5208
6795
|
}
|
|
5209
|
-
const fromResponse = getValueByPath(fromObject, [
|
|
5210
|
-
if (fromResponse != null) {
|
|
5211
|
-
setValueByPath(toObject, ['response'], fromResponse);
|
|
5212
|
-
}
|
|
5213
|
-
const fromResult = getValueByPath(fromObject, [
|
|
6796
|
+
const fromResponse = getValueByPath(fromObject, [
|
|
5214
6797
|
'response',
|
|
5215
6798
|
'generateVideoResponse',
|
|
5216
6799
|
]);
|
|
5217
|
-
if (
|
|
5218
|
-
setValueByPath(toObject, ['
|
|
6800
|
+
if (fromResponse != null) {
|
|
6801
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(apiClient, fromResponse));
|
|
5219
6802
|
}
|
|
5220
6803
|
return toObject;
|
|
5221
6804
|
}
|
|
@@ -5516,371 +7099,176 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
|
5516
7099
|
setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
|
|
5517
7100
|
}
|
|
5518
7101
|
}
|
|
5519
|
-
const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
|
|
5520
|
-
'positivePromptSafetyAttributes',
|
|
5521
|
-
]);
|
|
5522
|
-
if (fromPositivePromptSafetyAttributes != null) {
|
|
5523
|
-
setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromVertex(apiClient, fromPositivePromptSafetyAttributes));
|
|
5524
|
-
}
|
|
5525
|
-
return toObject;
|
|
5526
|
-
}
|
|
5527
|
-
function countTokensResponseFromVertex(apiClient, fromObject) {
|
|
5528
|
-
const toObject = {};
|
|
5529
|
-
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
5530
|
-
if (fromTotalTokens != null) {
|
|
5531
|
-
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
5532
|
-
}
|
|
5533
|
-
return toObject;
|
|
5534
|
-
}
|
|
5535
|
-
function computeTokensResponseFromVertex(apiClient, fromObject) {
|
|
5536
|
-
const toObject = {};
|
|
5537
|
-
const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
|
|
5538
|
-
if (fromTokensInfo != null) {
|
|
5539
|
-
setValueByPath(toObject, ['tokensInfo'], fromTokensInfo);
|
|
5540
|
-
}
|
|
5541
|
-
return toObject;
|
|
5542
|
-
}
|
|
5543
|
-
function videoFromVertex$1(apiClient, fromObject) {
|
|
5544
|
-
const toObject = {};
|
|
5545
|
-
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
5546
|
-
if (fromUri != null) {
|
|
5547
|
-
setValueByPath(toObject, ['uri'], fromUri);
|
|
5548
|
-
}
|
|
5549
|
-
const fromVideoBytes = getValueByPath(fromObject, [
|
|
5550
|
-
'bytesBase64Encoded',
|
|
5551
|
-
]);
|
|
5552
|
-
if (fromVideoBytes != null) {
|
|
5553
|
-
setValueByPath(toObject, ['videoBytes'], tBytes(apiClient, fromVideoBytes));
|
|
5554
|
-
}
|
|
5555
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
5556
|
-
if (fromMimeType != null) {
|
|
5557
|
-
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
5558
|
-
}
|
|
5559
|
-
return toObject;
|
|
5560
|
-
}
|
|
5561
|
-
function generatedVideoFromVertex$1(apiClient, fromObject) {
|
|
5562
|
-
const toObject = {};
|
|
5563
|
-
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
5564
|
-
if (fromVideo != null) {
|
|
5565
|
-
setValueByPath(toObject, ['video'], videoFromVertex$1(apiClient, fromVideo));
|
|
5566
|
-
}
|
|
5567
|
-
return toObject;
|
|
5568
|
-
}
|
|
5569
|
-
function generateVideosResponseFromVertex$1(apiClient, fromObject) {
|
|
5570
|
-
const toObject = {};
|
|
5571
|
-
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
5572
|
-
if (fromGeneratedVideos != null) {
|
|
5573
|
-
if (Array.isArray(fromGeneratedVideos)) {
|
|
5574
|
-
setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
|
|
5575
|
-
return generatedVideoFromVertex$1(apiClient, item);
|
|
5576
|
-
}));
|
|
5577
|
-
}
|
|
5578
|
-
else {
|
|
5579
|
-
setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
|
|
5580
|
-
}
|
|
5581
|
-
}
|
|
5582
|
-
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
5583
|
-
'raiMediaFilteredCount',
|
|
5584
|
-
]);
|
|
5585
|
-
if (fromRaiMediaFilteredCount != null) {
|
|
5586
|
-
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
5587
|
-
}
|
|
5588
|
-
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
5589
|
-
'raiMediaFilteredReasons',
|
|
5590
|
-
]);
|
|
5591
|
-
if (fromRaiMediaFilteredReasons != null) {
|
|
5592
|
-
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
5593
|
-
}
|
|
5594
|
-
return toObject;
|
|
5595
|
-
}
|
|
5596
|
-
function generateVideosOperationFromVertex$1(apiClient, fromObject) {
|
|
5597
|
-
const toObject = {};
|
|
5598
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
5599
|
-
if (fromName != null) {
|
|
5600
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
5601
|
-
}
|
|
5602
|
-
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
5603
|
-
if (fromMetadata != null) {
|
|
5604
|
-
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
5605
|
-
}
|
|
5606
|
-
const fromDone = getValueByPath(fromObject, ['done']);
|
|
5607
|
-
if (fromDone != null) {
|
|
5608
|
-
setValueByPath(toObject, ['done'], fromDone);
|
|
5609
|
-
}
|
|
5610
|
-
const fromError = getValueByPath(fromObject, ['error']);
|
|
5611
|
-
if (fromError != null) {
|
|
5612
|
-
setValueByPath(toObject, ['error'], fromError);
|
|
5613
|
-
}
|
|
5614
|
-
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
5615
|
-
if (fromResponse != null) {
|
|
5616
|
-
setValueByPath(toObject, ['response'], fromResponse);
|
|
5617
|
-
}
|
|
5618
|
-
const fromResult = getValueByPath(fromObject, ['response']);
|
|
5619
|
-
if (fromResult != null) {
|
|
5620
|
-
setValueByPath(toObject, ['result'], generateVideosResponseFromVertex$1(apiClient, fromResult));
|
|
5621
|
-
}
|
|
5622
|
-
return toObject;
|
|
5623
|
-
}
|
|
5624
|
-
|
|
5625
|
-
/**
|
|
5626
|
-
* @license
|
|
5627
|
-
* Copyright 2025 Google LLC
|
|
5628
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5629
|
-
*/
|
|
5630
|
-
/**
|
|
5631
|
-
* Converters for live client.
|
|
5632
|
-
*/
|
|
5633
|
-
function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
5634
|
-
const toObject = {};
|
|
5635
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5636
|
-
if (fromConfig !== undefined && fromConfig !== null) {
|
|
5637
|
-
setValueByPath(toObject, ['setup'], liveConnectConfigToMldev(apiClient, fromConfig));
|
|
5638
|
-
}
|
|
5639
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
5640
|
-
if (fromModel !== undefined) {
|
|
5641
|
-
setValueByPath(toObject, ['setup', 'model'], fromModel);
|
|
5642
|
-
}
|
|
5643
|
-
return toObject;
|
|
5644
|
-
}
|
|
5645
|
-
function liveConnectParametersToVertex(apiClient, fromObject) {
|
|
5646
|
-
const toObject = {};
|
|
5647
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5648
|
-
if (fromConfig !== undefined && fromConfig !== null) {
|
|
5649
|
-
setValueByPath(toObject, ['setup'], liveConnectConfigToVertex(apiClient, fromConfig));
|
|
5650
|
-
}
|
|
5651
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
5652
|
-
if (fromModel !== undefined) {
|
|
5653
|
-
setValueByPath(toObject, ['setup', 'model'], fromModel);
|
|
5654
|
-
}
|
|
5655
|
-
return toObject;
|
|
5656
|
-
}
|
|
5657
|
-
function liveServerMessageFromMldev(apiClient, fromObject) {
|
|
5658
|
-
const toObject = {};
|
|
5659
|
-
const fromSetupComplete = getValueByPath(fromObject, [
|
|
5660
|
-
'setupComplete',
|
|
5661
|
-
]);
|
|
5662
|
-
if (fromSetupComplete !== undefined) {
|
|
5663
|
-
setValueByPath(toObject, ['setupComplete'], fromSetupComplete);
|
|
5664
|
-
}
|
|
5665
|
-
const fromServerContent = getValueByPath(fromObject, [
|
|
5666
|
-
'serverContent',
|
|
5667
|
-
]);
|
|
5668
|
-
if (fromServerContent !== undefined && fromServerContent !== null) {
|
|
5669
|
-
setValueByPath(toObject, ['serverContent'], liveServerContentFromMldev(apiClient, fromServerContent));
|
|
5670
|
-
}
|
|
5671
|
-
const fromToolCall = getValueByPath(fromObject, ['toolCall']);
|
|
5672
|
-
if (fromToolCall !== undefined && fromToolCall !== null) {
|
|
5673
|
-
setValueByPath(toObject, ['toolCall'], liveServerToolCallFromMldev(apiClient, fromToolCall));
|
|
5674
|
-
}
|
|
5675
|
-
const fromToolCallCancellation = getValueByPath(fromObject, [
|
|
5676
|
-
'toolCallCancellation',
|
|
7102
|
+
const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
|
|
7103
|
+
'positivePromptSafetyAttributes',
|
|
5677
7104
|
]);
|
|
5678
|
-
if (
|
|
5679
|
-
|
|
5680
|
-
setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromMldev(apiClient, fromToolCallCancellation));
|
|
7105
|
+
if (fromPositivePromptSafetyAttributes != null) {
|
|
7106
|
+
setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromVertex(apiClient, fromPositivePromptSafetyAttributes));
|
|
5681
7107
|
}
|
|
5682
7108
|
return toObject;
|
|
5683
7109
|
}
|
|
5684
|
-
function
|
|
7110
|
+
function endpointFromVertex(apiClient, fromObject) {
|
|
5685
7111
|
const toObject = {};
|
|
5686
|
-
const
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
if (fromSetupComplete !== undefined) {
|
|
5690
|
-
setValueByPath(toObject, ['setupComplete'], fromSetupComplete);
|
|
5691
|
-
}
|
|
5692
|
-
const fromServerContent = getValueByPath(fromObject, [
|
|
5693
|
-
'serverContent',
|
|
5694
|
-
]);
|
|
5695
|
-
if (fromServerContent !== undefined && fromServerContent !== null) {
|
|
5696
|
-
setValueByPath(toObject, ['serverContent'], liveServerContentFromVertex(apiClient, fromServerContent));
|
|
5697
|
-
}
|
|
5698
|
-
const fromToolCall = getValueByPath(fromObject, ['toolCall']);
|
|
5699
|
-
if (fromToolCall !== undefined && fromToolCall !== null) {
|
|
5700
|
-
setValueByPath(toObject, ['toolCall'], liveServerToolCallFromVertex(apiClient, fromToolCall));
|
|
7112
|
+
const fromName = getValueByPath(fromObject, ['endpoint']);
|
|
7113
|
+
if (fromName != null) {
|
|
7114
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5701
7115
|
}
|
|
5702
|
-
const
|
|
5703
|
-
'
|
|
7116
|
+
const fromDeployedModelId = getValueByPath(fromObject, [
|
|
7117
|
+
'deployedModelId',
|
|
5704
7118
|
]);
|
|
5705
|
-
if (
|
|
5706
|
-
|
|
5707
|
-
setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromVertex(apiClient, fromToolCallCancellation));
|
|
7119
|
+
if (fromDeployedModelId != null) {
|
|
7120
|
+
setValueByPath(toObject, ['deployedModelId'], fromDeployedModelId);
|
|
5708
7121
|
}
|
|
5709
7122
|
return toObject;
|
|
5710
7123
|
}
|
|
5711
|
-
function
|
|
7124
|
+
function tunedModelInfoFromVertex(apiClient, fromObject) {
|
|
5712
7125
|
const toObject = {};
|
|
5713
|
-
const
|
|
5714
|
-
'
|
|
5715
|
-
|
|
5716
|
-
if (fromGenerationConfig !== undefined) {
|
|
5717
|
-
setValueByPath(toObject, ['generationConfig'], fromGenerationConfig);
|
|
5718
|
-
}
|
|
5719
|
-
const fromResponseModalities = getValueByPath(fromObject, [
|
|
5720
|
-
'responseModalities',
|
|
7126
|
+
const fromBaseModel = getValueByPath(fromObject, [
|
|
7127
|
+
'labels',
|
|
7128
|
+
'google-vertex-llm-tuning-base-model-id',
|
|
5721
7129
|
]);
|
|
5722
|
-
if (
|
|
5723
|
-
setValueByPath(toObject, ['
|
|
5724
|
-
}
|
|
5725
|
-
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
5726
|
-
if (fromSpeechConfig !== undefined) {
|
|
5727
|
-
setValueByPath(toObject, ['generationConfig', 'speechConfig'], fromSpeechConfig);
|
|
7130
|
+
if (fromBaseModel != null) {
|
|
7131
|
+
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
5728
7132
|
}
|
|
5729
|
-
const
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
if (fromSystemInstruction !== undefined && fromSystemInstruction !== null) {
|
|
5733
|
-
setValueByPath(toObject, ['systemInstruction'], contentToMldev(apiClient, fromSystemInstruction));
|
|
7133
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
7134
|
+
if (fromCreateTime != null) {
|
|
7135
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
5734
7136
|
}
|
|
5735
|
-
const
|
|
5736
|
-
if (
|
|
5737
|
-
|
|
5738
|
-
Array.isArray(fromTools)) {
|
|
5739
|
-
setValueByPath(toObject, ['tools'], fromTools.map((item) => {
|
|
5740
|
-
return toolToMldev(apiClient, item);
|
|
5741
|
-
}));
|
|
7137
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
7138
|
+
if (fromUpdateTime != null) {
|
|
7139
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
5742
7140
|
}
|
|
5743
7141
|
return toObject;
|
|
5744
7142
|
}
|
|
5745
|
-
function
|
|
7143
|
+
function modelFromVertex(apiClient, fromObject) {
|
|
5746
7144
|
const toObject = {};
|
|
5747
|
-
const
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
if (fromGenerationConfig !== undefined) {
|
|
5751
|
-
setValueByPath(toObject, ['generationConfig'], fromGenerationConfig);
|
|
7145
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7146
|
+
if (fromName != null) {
|
|
7147
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5752
7148
|
}
|
|
5753
|
-
const
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
if (fromResponseModalities !== undefined) {
|
|
5757
|
-
setValueByPath(toObject, ['generationConfig', 'responseModalities'], fromResponseModalities);
|
|
7149
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7150
|
+
if (fromDisplayName != null) {
|
|
7151
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
5758
7152
|
}
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
setValueByPath(toObject, ['
|
|
7153
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
7154
|
+
if (fromDescription != null) {
|
|
7155
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
5762
7156
|
}
|
|
5763
|
-
const
|
|
5764
|
-
if (
|
|
5765
|
-
setValueByPath(toObject, ['
|
|
7157
|
+
const fromVersion = getValueByPath(fromObject, ['versionId']);
|
|
7158
|
+
if (fromVersion != null) {
|
|
7159
|
+
setValueByPath(toObject, ['version'], fromVersion);
|
|
5766
7160
|
}
|
|
5767
|
-
const
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
7161
|
+
const fromEndpoints = getValueByPath(fromObject, ['deployedModels']);
|
|
7162
|
+
if (fromEndpoints != null) {
|
|
7163
|
+
if (Array.isArray(fromEndpoints)) {
|
|
7164
|
+
setValueByPath(toObject, ['endpoints'], fromEndpoints.map((item) => {
|
|
7165
|
+
return endpointFromVertex(apiClient, item);
|
|
7166
|
+
}));
|
|
7167
|
+
}
|
|
7168
|
+
else {
|
|
7169
|
+
setValueByPath(toObject, ['endpoints'], fromEndpoints);
|
|
7170
|
+
}
|
|
5772
7171
|
}
|
|
5773
|
-
const
|
|
5774
|
-
if (
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
7172
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
7173
|
+
if (fromLabels != null) {
|
|
7174
|
+
setValueByPath(toObject, ['labels'], fromLabels);
|
|
7175
|
+
}
|
|
7176
|
+
const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
|
|
7177
|
+
if (fromTunedModelInfo != null) {
|
|
7178
|
+
setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(apiClient, fromTunedModelInfo));
|
|
5780
7179
|
}
|
|
5781
7180
|
return toObject;
|
|
5782
7181
|
}
|
|
5783
|
-
function
|
|
7182
|
+
function countTokensResponseFromVertex(apiClient, fromObject) {
|
|
5784
7183
|
const toObject = {};
|
|
5785
|
-
const
|
|
5786
|
-
if (
|
|
5787
|
-
setValueByPath(toObject, ['
|
|
5788
|
-
}
|
|
5789
|
-
const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
|
|
5790
|
-
if (fromTurnComplete !== undefined) {
|
|
5791
|
-
setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
|
|
5792
|
-
}
|
|
5793
|
-
const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
|
|
5794
|
-
if (fromInterrupted !== undefined) {
|
|
5795
|
-
setValueByPath(toObject, ['interrupted'], fromInterrupted);
|
|
7184
|
+
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
7185
|
+
if (fromTotalTokens != null) {
|
|
7186
|
+
setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
|
|
5796
7187
|
}
|
|
5797
7188
|
return toObject;
|
|
5798
7189
|
}
|
|
5799
|
-
function
|
|
7190
|
+
function computeTokensResponseFromVertex(apiClient, fromObject) {
|
|
5800
7191
|
const toObject = {};
|
|
5801
|
-
const
|
|
5802
|
-
if (
|
|
5803
|
-
setValueByPath(toObject, ['
|
|
5804
|
-
}
|
|
5805
|
-
const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
|
|
5806
|
-
if (fromTurnComplete !== undefined) {
|
|
5807
|
-
setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
|
|
5808
|
-
}
|
|
5809
|
-
const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
|
|
5810
|
-
if (fromInterrupted !== undefined) {
|
|
5811
|
-
setValueByPath(toObject, ['interrupted'], fromInterrupted);
|
|
7192
|
+
const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
|
|
7193
|
+
if (fromTokensInfo != null) {
|
|
7194
|
+
setValueByPath(toObject, ['tokensInfo'], fromTokensInfo);
|
|
5812
7195
|
}
|
|
5813
7196
|
return toObject;
|
|
5814
7197
|
}
|
|
5815
|
-
function
|
|
7198
|
+
function videoFromVertex$1(apiClient, fromObject) {
|
|
5816
7199
|
const toObject = {};
|
|
5817
|
-
const
|
|
5818
|
-
if (
|
|
5819
|
-
setValueByPath(toObject, ['
|
|
7200
|
+
const fromUri = getValueByPath(fromObject, ['gcsUri']);
|
|
7201
|
+
if (fromUri != null) {
|
|
7202
|
+
setValueByPath(toObject, ['uri'], fromUri);
|
|
5820
7203
|
}
|
|
5821
|
-
const
|
|
5822
|
-
|
|
5823
|
-
|
|
7204
|
+
const fromVideoBytes = getValueByPath(fromObject, [
|
|
7205
|
+
'bytesBase64Encoded',
|
|
7206
|
+
]);
|
|
7207
|
+
if (fromVideoBytes != null) {
|
|
7208
|
+
setValueByPath(toObject, ['videoBytes'], tBytes(apiClient, fromVideoBytes));
|
|
5824
7209
|
}
|
|
5825
|
-
const
|
|
5826
|
-
if (
|
|
5827
|
-
setValueByPath(toObject, ['
|
|
7210
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7211
|
+
if (fromMimeType != null) {
|
|
7212
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
5828
7213
|
}
|
|
5829
7214
|
return toObject;
|
|
5830
7215
|
}
|
|
5831
|
-
function
|
|
7216
|
+
function generatedVideoFromVertex$1(apiClient, fromObject) {
|
|
5832
7217
|
const toObject = {};
|
|
5833
|
-
const
|
|
5834
|
-
if (
|
|
5835
|
-
setValueByPath(toObject, ['
|
|
5836
|
-
}
|
|
5837
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
5838
|
-
if (fromName !== undefined) {
|
|
5839
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
7218
|
+
const fromVideo = getValueByPath(fromObject, ['_self']);
|
|
7219
|
+
if (fromVideo != null) {
|
|
7220
|
+
setValueByPath(toObject, ['video'], videoFromVertex$1(apiClient, fromVideo));
|
|
5840
7221
|
}
|
|
5841
7222
|
return toObject;
|
|
5842
7223
|
}
|
|
5843
|
-
function
|
|
7224
|
+
function generateVideosResponseFromVertex$1(apiClient, fromObject) {
|
|
5844
7225
|
const toObject = {};
|
|
5845
|
-
const
|
|
5846
|
-
|
|
7226
|
+
const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
|
|
7227
|
+
if (fromGeneratedVideos != null) {
|
|
7228
|
+
if (Array.isArray(fromGeneratedVideos)) {
|
|
7229
|
+
setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
|
|
7230
|
+
return generatedVideoFromVertex$1(apiClient, item);
|
|
7231
|
+
}));
|
|
7232
|
+
}
|
|
7233
|
+
else {
|
|
7234
|
+
setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
|
|
7235
|
+
}
|
|
7236
|
+
}
|
|
7237
|
+
const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
|
|
7238
|
+
'raiMediaFilteredCount',
|
|
5847
7239
|
]);
|
|
5848
|
-
if (
|
|
5849
|
-
|
|
5850
|
-
Array.isArray(fromFunctionCalls)) {
|
|
5851
|
-
setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
|
|
5852
|
-
return functionCallFromMldev(apiClient, item);
|
|
5853
|
-
}));
|
|
7240
|
+
if (fromRaiMediaFilteredCount != null) {
|
|
7241
|
+
setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
|
|
5854
7242
|
}
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
function liveServerToolCallFromVertex(apiClient, fromObject) {
|
|
5858
|
-
const toObject = {};
|
|
5859
|
-
const fromFunctionCalls = getValueByPath(fromObject, [
|
|
5860
|
-
'functionCalls',
|
|
7243
|
+
const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
|
|
7244
|
+
'raiMediaFilteredReasons',
|
|
5861
7245
|
]);
|
|
5862
|
-
if (
|
|
5863
|
-
|
|
5864
|
-
Array.isArray(fromFunctionCalls)) {
|
|
5865
|
-
setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
|
|
5866
|
-
return functionCallFromVertex(apiClient, item);
|
|
5867
|
-
}));
|
|
7246
|
+
if (fromRaiMediaFilteredReasons != null) {
|
|
7247
|
+
setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
|
|
5868
7248
|
}
|
|
5869
7249
|
return toObject;
|
|
5870
7250
|
}
|
|
5871
|
-
function
|
|
7251
|
+
function generateVideosOperationFromVertex$1(apiClient, fromObject) {
|
|
5872
7252
|
const toObject = {};
|
|
5873
|
-
const
|
|
5874
|
-
if (
|
|
5875
|
-
setValueByPath(toObject, ['
|
|
7253
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7254
|
+
if (fromName != null) {
|
|
7255
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5876
7256
|
}
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
const
|
|
5882
|
-
if (
|
|
5883
|
-
setValueByPath(toObject, ['
|
|
7257
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
7258
|
+
if (fromMetadata != null) {
|
|
7259
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
7260
|
+
}
|
|
7261
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
7262
|
+
if (fromDone != null) {
|
|
7263
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
7264
|
+
}
|
|
7265
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
7266
|
+
if (fromError != null) {
|
|
7267
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
7268
|
+
}
|
|
7269
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
7270
|
+
if (fromResponse != null) {
|
|
7271
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(apiClient, fromResponse));
|
|
5884
7272
|
}
|
|
5885
7273
|
return toObject;
|
|
5886
7274
|
}
|
|
@@ -5940,17 +7328,20 @@ class Live {
|
|
|
5940
7328
|
@experimental
|
|
5941
7329
|
|
|
5942
7330
|
@remarks
|
|
5943
|
-
If using the Gemini API, Live is currently only supported behind API
|
|
5944
|
-
version `v1alpha`. Ensure that the API version is set to `v1alpha` when
|
|
5945
|
-
initializing the SDK if relying on the Gemini API.
|
|
5946
7331
|
|
|
5947
7332
|
@param params - The parameters for establishing a connection to the model.
|
|
5948
7333
|
@return A live session.
|
|
5949
7334
|
|
|
5950
7335
|
@example
|
|
5951
7336
|
```ts
|
|
7337
|
+
let model: string;
|
|
7338
|
+
if (GOOGLE_GENAI_USE_VERTEXAI) {
|
|
7339
|
+
model = 'gemini-2.0-flash-live-preview-04-09';
|
|
7340
|
+
} else {
|
|
7341
|
+
model = 'gemini-2.0-flash-live-001';
|
|
7342
|
+
}
|
|
5952
7343
|
const session = await ai.live.connect({
|
|
5953
|
-
model:
|
|
7344
|
+
model: model,
|
|
5954
7345
|
config: {
|
|
5955
7346
|
responseModalities: [Modality.AUDIO],
|
|
5956
7347
|
},
|
|
@@ -5972,7 +7363,7 @@ class Live {
|
|
|
5972
7363
|
```
|
|
5973
7364
|
*/
|
|
5974
7365
|
async connect(params) {
|
|
5975
|
-
var _a, _b;
|
|
7366
|
+
var _a, _b, _c, _d;
|
|
5976
7367
|
const websocketBaseUrl = this.apiClient.getWebsocketBaseUrl();
|
|
5977
7368
|
const apiVersion = this.apiClient.getApiVersion();
|
|
5978
7369
|
let url;
|
|
@@ -6019,6 +7410,20 @@ class Live {
|
|
|
6019
7410
|
`projects/${project}/locations/${location}/` + transformedModel;
|
|
6020
7411
|
}
|
|
6021
7412
|
let clientMessage = {};
|
|
7413
|
+
if (this.apiClient.isVertexAI() &&
|
|
7414
|
+
((_c = params.config) === null || _c === void 0 ? void 0 : _c.responseModalities) === undefined) {
|
|
7415
|
+
// Set default to AUDIO to align with MLDev API.
|
|
7416
|
+
if (params.config === undefined) {
|
|
7417
|
+
params.config = { responseModalities: [Modality.AUDIO] };
|
|
7418
|
+
}
|
|
7419
|
+
else {
|
|
7420
|
+
params.config.responseModalities = [Modality.AUDIO];
|
|
7421
|
+
}
|
|
7422
|
+
}
|
|
7423
|
+
if ((_d = params.config) === null || _d === void 0 ? void 0 : _d.generationConfig) {
|
|
7424
|
+
// Raise deprecation warning for generationConfig.
|
|
7425
|
+
console.warn('Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).');
|
|
7426
|
+
}
|
|
6022
7427
|
const liveConnectParameters = {
|
|
6023
7428
|
model: transformedModel,
|
|
6024
7429
|
config: params.config,
|
|
@@ -6030,6 +7435,7 @@ class Live {
|
|
|
6030
7435
|
else {
|
|
6031
7436
|
clientMessage = liveConnectParametersToMldev(this.apiClient, liveConnectParameters);
|
|
6032
7437
|
}
|
|
7438
|
+
delete clientMessage['config'];
|
|
6033
7439
|
conn.send(JSON.stringify(clientMessage));
|
|
6034
7440
|
return new Session(conn, this.apiClient);
|
|
6035
7441
|
}
|
|
@@ -6076,7 +7482,13 @@ class Session {
|
|
|
6076
7482
|
throw new Error(`Failed to convert realtime input "media", type: '${typeof params.media}'`);
|
|
6077
7483
|
}
|
|
6078
7484
|
// LiveClientRealtimeInput
|
|
6079
|
-
clientMessage = {
|
|
7485
|
+
clientMessage = {
|
|
7486
|
+
realtimeInput: {
|
|
7487
|
+
mediaChunks: [params.media],
|
|
7488
|
+
activityStart: params.activityStart,
|
|
7489
|
+
activityEnd: params.activityEnd,
|
|
7490
|
+
},
|
|
7491
|
+
};
|
|
6080
7492
|
return clientMessage;
|
|
6081
7493
|
}
|
|
6082
7494
|
tLiveClienttToolResponse(apiClient, params) {
|
|
@@ -6220,8 +7632,14 @@ class Session {
|
|
|
6220
7632
|
|
|
6221
7633
|
@example
|
|
6222
7634
|
```ts
|
|
7635
|
+
let model: string;
|
|
7636
|
+
if (GOOGLE_GENAI_USE_VERTEXAI) {
|
|
7637
|
+
model = 'gemini-2.0-flash-live-preview-04-09';
|
|
7638
|
+
} else {
|
|
7639
|
+
model = 'gemini-2.0-flash-live-001';
|
|
7640
|
+
}
|
|
6223
7641
|
const session = await ai.live.connect({
|
|
6224
|
-
model:
|
|
7642
|
+
model: model,
|
|
6225
7643
|
config: {
|
|
6226
7644
|
responseModalities: [Modality.AUDIO],
|
|
6227
7645
|
}
|
|
@@ -6487,7 +7905,7 @@ class Models extends BaseModule {
|
|
|
6487
7905
|
_c = apiResponse_1_1.value;
|
|
6488
7906
|
_d = false;
|
|
6489
7907
|
const chunk = _c;
|
|
6490
|
-
const resp = generateContentResponseFromVertex(apiClient, chunk);
|
|
7908
|
+
const resp = generateContentResponseFromVertex(apiClient, (yield __await(chunk.json())));
|
|
6491
7909
|
const typedResp = new GenerateContentResponse();
|
|
6492
7910
|
Object.assign(typedResp, resp);
|
|
6493
7911
|
yield yield __await(typedResp);
|
|
@@ -6526,7 +7944,7 @@ class Models extends BaseModule {
|
|
|
6526
7944
|
_c = apiResponse_2_1.value;
|
|
6527
7945
|
_d = false;
|
|
6528
7946
|
const chunk = _c;
|
|
6529
|
-
const resp = generateContentResponseFromMldev(apiClient, chunk);
|
|
7947
|
+
const resp = generateContentResponseFromMldev(apiClient, (yield __await(chunk.json())));
|
|
6530
7948
|
const typedResp = new GenerateContentResponse();
|
|
6531
7949
|
Object.assign(typedResp, resp);
|
|
6532
7950
|
yield yield __await(typedResp);
|
|
@@ -6695,6 +8113,66 @@ class Models extends BaseModule {
|
|
|
6695
8113
|
});
|
|
6696
8114
|
}
|
|
6697
8115
|
}
|
|
8116
|
+
/**
|
|
8117
|
+
* Fetches information about a model by name.
|
|
8118
|
+
*
|
|
8119
|
+
* @example
|
|
8120
|
+
* ```ts
|
|
8121
|
+
* const modelInfo = await ai.models.get({model: 'gemini-2.0-flash'});
|
|
8122
|
+
* ```
|
|
8123
|
+
*/
|
|
8124
|
+
async get(params) {
|
|
8125
|
+
var _a, _b;
|
|
8126
|
+
let response;
|
|
8127
|
+
let path = '';
|
|
8128
|
+
let queryParams = {};
|
|
8129
|
+
if (this.apiClient.isVertexAI()) {
|
|
8130
|
+
const body = getModelParametersToVertex(this.apiClient, params);
|
|
8131
|
+
path = formatMap('{name}', body['_url']);
|
|
8132
|
+
queryParams = body['_query'];
|
|
8133
|
+
delete body['config'];
|
|
8134
|
+
delete body['_url'];
|
|
8135
|
+
delete body['_query'];
|
|
8136
|
+
response = this.apiClient
|
|
8137
|
+
.request({
|
|
8138
|
+
path: path,
|
|
8139
|
+
queryParams: queryParams,
|
|
8140
|
+
body: JSON.stringify(body),
|
|
8141
|
+
httpMethod: 'GET',
|
|
8142
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8143
|
+
})
|
|
8144
|
+
.then((httpResponse) => {
|
|
8145
|
+
return httpResponse.json();
|
|
8146
|
+
});
|
|
8147
|
+
return response.then((apiResponse) => {
|
|
8148
|
+
const resp = modelFromVertex(this.apiClient, apiResponse);
|
|
8149
|
+
return resp;
|
|
8150
|
+
});
|
|
8151
|
+
}
|
|
8152
|
+
else {
|
|
8153
|
+
const body = getModelParametersToMldev(this.apiClient, params);
|
|
8154
|
+
path = formatMap('{name}', body['_url']);
|
|
8155
|
+
queryParams = body['_query'];
|
|
8156
|
+
delete body['config'];
|
|
8157
|
+
delete body['_url'];
|
|
8158
|
+
delete body['_query'];
|
|
8159
|
+
response = this.apiClient
|
|
8160
|
+
.request({
|
|
8161
|
+
path: path,
|
|
8162
|
+
queryParams: queryParams,
|
|
8163
|
+
body: JSON.stringify(body),
|
|
8164
|
+
httpMethod: 'GET',
|
|
8165
|
+
httpOptions: (_b = params.config) === null || _b === void 0 ? void 0 : _b.httpOptions,
|
|
8166
|
+
})
|
|
8167
|
+
.then((httpResponse) => {
|
|
8168
|
+
return httpResponse.json();
|
|
8169
|
+
});
|
|
8170
|
+
return response.then((apiResponse) => {
|
|
8171
|
+
const resp = modelFromMldev(this.apiClient, apiResponse);
|
|
8172
|
+
return resp;
|
|
8173
|
+
});
|
|
8174
|
+
}
|
|
8175
|
+
}
|
|
6698
8176
|
/**
|
|
6699
8177
|
* Counts the number of tokens in the given contents. Multimodal input is
|
|
6700
8178
|
* supported for Gemini models.
|
|
@@ -6836,10 +8314,10 @@ class Models extends BaseModule {
|
|
|
6836
8314
|
*
|
|
6837
8315
|
* while (!operation.done) {
|
|
6838
8316
|
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
6839
|
-
* operation = await ai.operations.
|
|
8317
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
6840
8318
|
* }
|
|
6841
8319
|
*
|
|
6842
|
-
* console.log(operation.
|
|
8320
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
6843
8321
|
* ```
|
|
6844
8322
|
*/
|
|
6845
8323
|
async generateVideos(params) {
|
|
@@ -7021,16 +8499,12 @@ function generateVideosOperationFromMldev(apiClient, fromObject) {
|
|
|
7021
8499
|
if (fromError != null) {
|
|
7022
8500
|
setValueByPath(toObject, ['error'], fromError);
|
|
7023
8501
|
}
|
|
7024
|
-
const fromResponse = getValueByPath(fromObject, [
|
|
7025
|
-
if (fromResponse != null) {
|
|
7026
|
-
setValueByPath(toObject, ['response'], fromResponse);
|
|
7027
|
-
}
|
|
7028
|
-
const fromResult = getValueByPath(fromObject, [
|
|
8502
|
+
const fromResponse = getValueByPath(fromObject, [
|
|
7029
8503
|
'response',
|
|
7030
8504
|
'generateVideoResponse',
|
|
7031
8505
|
]);
|
|
7032
|
-
if (
|
|
7033
|
-
setValueByPath(toObject, ['
|
|
8506
|
+
if (fromResponse != null) {
|
|
8507
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev(apiClient, fromResponse));
|
|
7034
8508
|
}
|
|
7035
8509
|
return toObject;
|
|
7036
8510
|
}
|
|
@@ -7107,11 +8581,7 @@ function generateVideosOperationFromVertex(apiClient, fromObject) {
|
|
|
7107
8581
|
}
|
|
7108
8582
|
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
7109
8583
|
if (fromResponse != null) {
|
|
7110
|
-
setValueByPath(toObject, ['response'], fromResponse);
|
|
7111
|
-
}
|
|
7112
|
-
const fromResult = getValueByPath(fromObject, ['response']);
|
|
7113
|
-
if (fromResult != null) {
|
|
7114
|
-
setValueByPath(toObject, ['result'], generateVideosResponseFromVertex(apiClient, fromResult));
|
|
8584
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex(apiClient, fromResponse));
|
|
7115
8585
|
}
|
|
7116
8586
|
return toObject;
|
|
7117
8587
|
}
|
|
@@ -7129,10 +8599,10 @@ class Operations extends BaseModule {
|
|
|
7129
8599
|
/**
|
|
7130
8600
|
* Gets the status of a long-running operation.
|
|
7131
8601
|
*
|
|
7132
|
-
* @param
|
|
8602
|
+
* @param parameters The parameters for the get operation request.
|
|
7133
8603
|
* @return The updated Operation object, with the latest status or result.
|
|
7134
8604
|
*/
|
|
7135
|
-
async
|
|
8605
|
+
async getVideosOperation(parameters) {
|
|
7136
8606
|
const operation = parameters.operation;
|
|
7137
8607
|
const config = parameters.config;
|
|
7138
8608
|
if (operation.name === undefined || operation.name === '') {
|
|
@@ -7140,7 +8610,7 @@ class Operations extends BaseModule {
|
|
|
7140
8610
|
}
|
|
7141
8611
|
if (this.apiClient.isVertexAI()) {
|
|
7142
8612
|
const resourceName = operation.name.split('/operations/')[0];
|
|
7143
|
-
|
|
8613
|
+
let httpOptions = undefined;
|
|
7144
8614
|
if (config && 'httpOptions' in config) {
|
|
7145
8615
|
httpOptions = config.httpOptions;
|
|
7146
8616
|
}
|
|
@@ -7249,9 +8719,10 @@ class Operations extends BaseModule {
|
|
|
7249
8719
|
* SPDX-License-Identifier: Apache-2.0
|
|
7250
8720
|
*/
|
|
7251
8721
|
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
8722
|
+
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7252
8723
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7253
8724
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7254
|
-
const SDK_VERSION = '0.
|
|
8725
|
+
const SDK_VERSION = '0.9.0'; // x-release-please-version
|
|
7255
8726
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7256
8727
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7257
8728
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -7391,11 +8862,9 @@ class ApiClient {
|
|
|
7391
8862
|
throw new Error('HTTP options are not correctly set.');
|
|
7392
8863
|
}
|
|
7393
8864
|
}
|
|
7394
|
-
constructUrl(path, httpOptions) {
|
|
8865
|
+
constructUrl(path, httpOptions, prependProjectLocation) {
|
|
7395
8866
|
const urlElement = [this.getRequestUrlInternal(httpOptions)];
|
|
7396
|
-
if (
|
|
7397
|
-
!this.clientOptions.apiKey &&
|
|
7398
|
-
!path.startsWith('projects/')) {
|
|
8867
|
+
if (prependProjectLocation) {
|
|
7399
8868
|
urlElement.push(this.getBaseResourcePath());
|
|
7400
8869
|
}
|
|
7401
8870
|
if (path !== '') {
|
|
@@ -7404,12 +8873,34 @@ class ApiClient {
|
|
|
7404
8873
|
const url = new URL(`${urlElement.join('/')}`);
|
|
7405
8874
|
return url;
|
|
7406
8875
|
}
|
|
8876
|
+
shouldPrependVertexProjectPath(request) {
|
|
8877
|
+
if (this.clientOptions.apiKey) {
|
|
8878
|
+
return false;
|
|
8879
|
+
}
|
|
8880
|
+
if (!this.clientOptions.vertexai) {
|
|
8881
|
+
return false;
|
|
8882
|
+
}
|
|
8883
|
+
if (request.path.startsWith('projects/')) {
|
|
8884
|
+
// Assume the path already starts with
|
|
8885
|
+
// `projects/<project>/location/<location>`.
|
|
8886
|
+
return false;
|
|
8887
|
+
}
|
|
8888
|
+
if (request.httpMethod === 'GET' &&
|
|
8889
|
+
request.path.startsWith('publishers/google/models')) {
|
|
8890
|
+
// These paths are used by Vertex's models.get and models.list
|
|
8891
|
+
// calls. For base models Vertex does not accept a project/location
|
|
8892
|
+
// prefix (for tuned model the prefix is required).
|
|
8893
|
+
return false;
|
|
8894
|
+
}
|
|
8895
|
+
return true;
|
|
8896
|
+
}
|
|
7407
8897
|
async request(request) {
|
|
7408
8898
|
let patchedHttpOptions = this.clientOptions.httpOptions;
|
|
7409
8899
|
if (request.httpOptions) {
|
|
7410
8900
|
patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
|
|
7411
8901
|
}
|
|
7412
|
-
const
|
|
8902
|
+
const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
|
|
8903
|
+
const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
|
|
7413
8904
|
if (request.queryParams) {
|
|
7414
8905
|
for (const [key, value] of Object.entries(request.queryParams)) {
|
|
7415
8906
|
url.searchParams.append(key, String(value));
|
|
@@ -7451,7 +8942,8 @@ class ApiClient {
|
|
|
7451
8942
|
if (request.httpOptions) {
|
|
7452
8943
|
patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
|
|
7453
8944
|
}
|
|
7454
|
-
const
|
|
8945
|
+
const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
|
|
8946
|
+
const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
|
|
7455
8947
|
if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
|
|
7456
8948
|
url.searchParams.set('alt', 'sse');
|
|
7457
8949
|
}
|
|
@@ -7524,8 +9016,12 @@ class ApiClient {
|
|
|
7524
9016
|
while (match) {
|
|
7525
9017
|
const processedChunkString = match[1];
|
|
7526
9018
|
try {
|
|
7527
|
-
const
|
|
7528
|
-
|
|
9019
|
+
const partialResponse = new Response(processedChunkString, {
|
|
9020
|
+
headers: response === null || response === void 0 ? void 0 : response.headers,
|
|
9021
|
+
status: response === null || response === void 0 ? void 0 : response.status,
|
|
9022
|
+
statusText: response === null || response === void 0 ? void 0 : response.statusText,
|
|
9023
|
+
});
|
|
9024
|
+
yield yield __await(new HttpResponse(partialResponse));
|
|
7529
9025
|
buffer = buffer.slice(match[0].length);
|
|
7530
9026
|
match = buffer.match(responseLineRE);
|
|
7531
9027
|
}
|
|
@@ -7559,6 +9055,11 @@ class ApiClient {
|
|
|
7559
9055
|
for (const [key, value] of Object.entries(httpOptions.headers)) {
|
|
7560
9056
|
headers.append(key, value);
|
|
7561
9057
|
}
|
|
9058
|
+
// Append a timeout header if it is set, note that the timeout option is
|
|
9059
|
+
// in milliseconds but the header is in seconds.
|
|
9060
|
+
if (httpOptions.timeout && httpOptions.timeout > 0) {
|
|
9061
|
+
headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
|
|
9062
|
+
}
|
|
7562
9063
|
}
|
|
7563
9064
|
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
7564
9065
|
return headers;
|
|
@@ -7868,5 +9369,5 @@ class GoogleGenAI {
|
|
|
7868
9369
|
}
|
|
7869
9370
|
}
|
|
7870
9371
|
|
|
7871
|
-
export { BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DynamicRetrievalConfigMode, EmbedContentResponse, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session,
|
|
9372
|
+
export { ActivityHandling, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DynamicRetrievalConfigMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session, StartSensitivity, SubjectReferenceType, TrafficType, TurnCoverage, Type, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent };
|
|
7872
9373
|
//# sourceMappingURL=index.mjs.map
|