@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/dist/index.js CHANGED
@@ -211,44 +211,25 @@ function _isFunctionCallPart(origin) {
211
211
  typeof origin === 'object' &&
212
212
  'functionCall' in origin);
213
213
  }
214
- function _isUserPart(origin) {
215
- if (origin === null || origin === undefined) {
216
- return false;
217
- }
218
- if (_isFunctionCallPart(origin)) {
219
- return false;
220
- }
221
- return true;
222
- }
223
- function _areUserParts(origin) {
224
- if (origin === null ||
225
- origin === undefined ||
226
- (Array.isArray(origin) && origin.length === 0)) {
227
- return false;
228
- }
229
- return origin.every(_isUserPart);
214
+ function _isFunctionResponsePart(origin) {
215
+ return (origin !== null &&
216
+ origin !== undefined &&
217
+ typeof origin === 'object' &&
218
+ 'functionResponse' in origin);
230
219
  }
231
220
  function tContent(apiClient, origin) {
232
221
  if (origin === null || origin === undefined) {
233
222
  throw new Error('ContentUnion is required');
234
223
  }
235
224
  if (_isContent(origin)) {
236
- // @ts-expect-error: _isContent is a utility function that checks if the
225
+ // _isContent is a utility function that checks if the
237
226
  // origin is a Content.
238
227
  return origin;
239
228
  }
240
- if (_isUserPart(origin)) {
241
- return {
242
- role: 'user',
243
- parts: tParts(apiClient, origin),
244
- };
245
- }
246
- else {
247
- return {
248
- role: 'model',
249
- parts: tParts(apiClient, origin),
250
- };
251
- }
229
+ return {
230
+ role: 'user',
231
+ parts: tParts(apiClient, origin),
232
+ };
252
233
  }
253
234
  function tContentsForEmbed(apiClient, origin) {
254
235
  if (!origin) {
@@ -279,34 +260,6 @@ function tContentsForEmbed(apiClient, origin) {
279
260
  }
280
261
  return [tContent(apiClient, origin)];
281
262
  }
282
- function _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts) {
283
- if (accumulatedParts.length === 0) {
284
- return;
285
- }
286
- if (_areUserParts(accumulatedParts)) {
287
- result.push({
288
- role: 'user',
289
- parts: tParts(apiClient, accumulatedParts),
290
- });
291
- }
292
- else {
293
- result.push({
294
- role: 'model',
295
- parts: tParts(apiClient, accumulatedParts),
296
- });
297
- }
298
- accumulatedParts.length = 0; // clear the array inplace
299
- }
300
- function _handleCurrentPart(apiClient, result, accumulatedParts, currentPart) {
301
- if (_isUserPart(currentPart) === _areUserParts(accumulatedParts)) {
302
- accumulatedParts.push(currentPart);
303
- }
304
- else {
305
- _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
306
- accumulatedParts.length = 0;
307
- accumulatedParts.push(currentPart);
308
- }
309
- }
310
263
  function tContents(apiClient, origin) {
311
264
  if (origin === null ||
312
265
  origin === undefined ||
@@ -314,35 +267,35 @@ function tContents(apiClient, origin) {
314
267
  throw new Error('contents are required');
315
268
  }
316
269
  if (!Array.isArray(origin)) {
270
+ // If it's not an array, it's a single content or a single PartUnion.
271
+ if (_isFunctionCallPart(origin) || _isFunctionResponsePart(origin)) {
272
+ throw new Error('To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them');
273
+ }
317
274
  return [tContent(apiClient, origin)];
318
275
  }
319
276
  const result = [];
320
277
  const accumulatedParts = [];
321
- for (const content of origin) {
322
- if (_isContent(content)) {
323
- _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
324
- // @ts-expect-error: content is a Content here
325
- result.push(content);
326
- }
327
- else if (typeof content === 'string' ||
328
- (typeof content === 'object' && !Array.isArray(content))) {
329
- // @ts-expect-error: content is a part here
330
- _handleCurrentPart(apiClient, result, accumulatedParts, content);
331
- }
332
- else if (Array.isArray(content)) {
333
- // if there're consecutive user parts before the list,
334
- // convert to UserContent and append to result
335
- _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
336
- result.push({
337
- role: 'user',
338
- parts: tParts(apiClient, content),
339
- });
278
+ const isContentArray = _isContent(origin[0]);
279
+ for (const item of origin) {
280
+ const isContent = _isContent(item);
281
+ if (isContent != isContentArray) {
282
+ 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');
283
+ }
284
+ if (isContent) {
285
+ // `isContent` contains the result of _isContent, which is a utility
286
+ // function that checks if the item is a Content.
287
+ result.push(item);
288
+ }
289
+ else if (_isFunctionCallPart(item) || _isFunctionResponsePart(item)) {
290
+ 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');
340
291
  }
341
292
  else {
342
- throw new Error(`Unsupported content type: ${typeof content}`);
293
+ accumulatedParts.push(item);
343
294
  }
344
295
  }
345
- _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
296
+ if (!isContentArray) {
297
+ result.push({ role: 'user', parts: tParts(apiClient, accumulatedParts) });
298
+ }
346
299
  return result;
347
300
  }
348
301
  function processSchema(apiClient, schema) {
@@ -507,7 +460,7 @@ function tFileName(apiClient, fromName) {
507
460
  * Copyright 2025 Google LLC
508
461
  * SPDX-License-Identifier: Apache-2.0
509
462
  */
510
- function partToMldev$1(apiClient, fromObject) {
463
+ function partToMldev$2(apiClient, fromObject) {
511
464
  const toObject = {};
512
465
  if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
513
466
  throw new Error('videoMetadata parameter is not supported in Gemini API.');
@@ -552,13 +505,13 @@ function partToMldev$1(apiClient, fromObject) {
552
505
  }
553
506
  return toObject;
554
507
  }
555
- function contentToMldev$1(apiClient, fromObject) {
508
+ function contentToMldev$2(apiClient, fromObject) {
556
509
  const toObject = {};
557
510
  const fromParts = getValueByPath(fromObject, ['parts']);
558
511
  if (fromParts != null) {
559
512
  if (Array.isArray(fromParts)) {
560
513
  setValueByPath(toObject, ['parts'], fromParts.map((item) => {
561
- return partToMldev$1(apiClient, item);
514
+ return partToMldev$2(apiClient, item);
562
515
  }));
563
516
  }
564
517
  else {
@@ -571,7 +524,7 @@ function contentToMldev$1(apiClient, fromObject) {
571
524
  }
572
525
  return toObject;
573
526
  }
574
- function functionDeclarationToMldev$1(apiClient, fromObject) {
527
+ function functionDeclarationToMldev$2(apiClient, fromObject) {
575
528
  const toObject = {};
576
529
  if (getValueByPath(fromObject, ['response']) !== undefined) {
577
530
  throw new Error('response parameter is not supported in Gemini API.');
@@ -590,11 +543,11 @@ function functionDeclarationToMldev$1(apiClient, fromObject) {
590
543
  }
591
544
  return toObject;
592
545
  }
593
- function googleSearchToMldev$1() {
546
+ function googleSearchToMldev$2() {
594
547
  const toObject = {};
595
548
  return toObject;
596
549
  }
597
- function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
550
+ function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
598
551
  const toObject = {};
599
552
  const fromMode = getValueByPath(fromObject, ['mode']);
600
553
  if (fromMode != null) {
@@ -608,17 +561,17 @@ function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
608
561
  }
609
562
  return toObject;
610
563
  }
611
- function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
564
+ function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
612
565
  const toObject = {};
613
566
  const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
614
567
  'dynamicRetrievalConfig',
615
568
  ]);
616
569
  if (fromDynamicRetrievalConfig != null) {
617
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
570
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
618
571
  }
619
572
  return toObject;
620
573
  }
621
- function toolToMldev$1(apiClient, fromObject) {
574
+ function toolToMldev$2(apiClient, fromObject) {
622
575
  const toObject = {};
623
576
  const fromFunctionDeclarations = getValueByPath(fromObject, [
624
577
  'functionDeclarations',
@@ -626,7 +579,7 @@ function toolToMldev$1(apiClient, fromObject) {
626
579
  if (fromFunctionDeclarations != null) {
627
580
  if (Array.isArray(fromFunctionDeclarations)) {
628
581
  setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
629
- return functionDeclarationToMldev$1(apiClient, item);
582
+ return functionDeclarationToMldev$2(apiClient, item);
630
583
  }));
631
584
  }
632
585
  else {
@@ -638,13 +591,13 @@ function toolToMldev$1(apiClient, fromObject) {
638
591
  }
639
592
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
640
593
  if (fromGoogleSearch != null) {
641
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1());
594
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2());
642
595
  }
643
596
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
644
597
  'googleSearchRetrieval',
645
598
  ]);
646
599
  if (fromGoogleSearchRetrieval != null) {
647
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
600
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
648
601
  }
649
602
  const fromCodeExecution = getValueByPath(fromObject, [
650
603
  'codeExecution',
@@ -696,7 +649,7 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
696
649
  if (parentObject !== undefined && fromContents != null) {
697
650
  if (Array.isArray(fromContents)) {
698
651
  setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
699
- return contentToMldev$1(apiClient, item);
652
+ return contentToMldev$2(apiClient, item);
700
653
  })));
701
654
  }
702
655
  else {
@@ -707,13 +660,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
707
660
  'systemInstruction',
708
661
  ]);
709
662
  if (parentObject !== undefined && fromSystemInstruction != null) {
710
- setValueByPath(parentObject, ['systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
663
+ setValueByPath(parentObject, ['systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
711
664
  }
712
665
  const fromTools = getValueByPath(fromObject, ['tools']);
713
666
  if (parentObject !== undefined && fromTools != null) {
714
667
  if (Array.isArray(fromTools)) {
715
668
  setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
716
- return toolToMldev$1(apiClient, item);
669
+ return toolToMldev$2(apiClient, item);
717
670
  }));
718
671
  }
719
672
  else {
@@ -806,7 +759,7 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
806
759
  }
807
760
  return toObject;
808
761
  }
809
- function partToVertex$1(apiClient, fromObject) {
762
+ function partToVertex$2(apiClient, fromObject) {
810
763
  const toObject = {};
811
764
  const fromVideoMetadata = getValueByPath(fromObject, [
812
765
  'videoMetadata',
@@ -854,13 +807,13 @@ function partToVertex$1(apiClient, fromObject) {
854
807
  }
855
808
  return toObject;
856
809
  }
857
- function contentToVertex$1(apiClient, fromObject) {
810
+ function contentToVertex$2(apiClient, fromObject) {
858
811
  const toObject = {};
859
812
  const fromParts = getValueByPath(fromObject, ['parts']);
860
813
  if (fromParts != null) {
861
814
  if (Array.isArray(fromParts)) {
862
815
  setValueByPath(toObject, ['parts'], fromParts.map((item) => {
863
- return partToVertex$1(apiClient, item);
816
+ return partToVertex$2(apiClient, item);
864
817
  }));
865
818
  }
866
819
  else {
@@ -873,7 +826,7 @@ function contentToVertex$1(apiClient, fromObject) {
873
826
  }
874
827
  return toObject;
875
828
  }
876
- function schemaToVertex$1(apiClient, fromObject) {
829
+ function schemaToVertex$2(apiClient, fromObject) {
877
830
  const toObject = {};
878
831
  const fromExample = getValueByPath(fromObject, ['example']);
879
832
  if (fromExample != null) {
@@ -971,11 +924,11 @@ function schemaToVertex$1(apiClient, fromObject) {
971
924
  }
972
925
  return toObject;
973
926
  }
974
- function functionDeclarationToVertex$1(apiClient, fromObject) {
927
+ function functionDeclarationToVertex$2(apiClient, fromObject) {
975
928
  const toObject = {};
976
929
  const fromResponse = getValueByPath(fromObject, ['response']);
977
930
  if (fromResponse != null) {
978
- setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
931
+ setValueByPath(toObject, ['response'], schemaToVertex$2(apiClient, fromResponse));
979
932
  }
980
933
  const fromDescription = getValueByPath(fromObject, ['description']);
981
934
  if (fromDescription != null) {
@@ -991,11 +944,11 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
991
944
  }
992
945
  return toObject;
993
946
  }
994
- function googleSearchToVertex$1() {
947
+ function googleSearchToVertex$2() {
995
948
  const toObject = {};
996
949
  return toObject;
997
950
  }
998
- function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
951
+ function dynamicRetrievalConfigToVertex$2(apiClient, fromObject) {
999
952
  const toObject = {};
1000
953
  const fromMode = getValueByPath(fromObject, ['mode']);
1001
954
  if (fromMode != null) {
@@ -1009,17 +962,17 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
1009
962
  }
1010
963
  return toObject;
1011
964
  }
1012
- function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
965
+ function googleSearchRetrievalToVertex$2(apiClient, fromObject) {
1013
966
  const toObject = {};
1014
967
  const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
1015
968
  'dynamicRetrievalConfig',
1016
969
  ]);
1017
970
  if (fromDynamicRetrievalConfig != null) {
1018
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
971
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$2(apiClient, fromDynamicRetrievalConfig));
1019
972
  }
1020
973
  return toObject;
1021
974
  }
1022
- function toolToVertex$1(apiClient, fromObject) {
975
+ function toolToVertex$2(apiClient, fromObject) {
1023
976
  const toObject = {};
1024
977
  const fromFunctionDeclarations = getValueByPath(fromObject, [
1025
978
  'functionDeclarations',
@@ -1027,7 +980,7 @@ function toolToVertex$1(apiClient, fromObject) {
1027
980
  if (fromFunctionDeclarations != null) {
1028
981
  if (Array.isArray(fromFunctionDeclarations)) {
1029
982
  setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
1030
- return functionDeclarationToVertex$1(apiClient, item);
983
+ return functionDeclarationToVertex$2(apiClient, item);
1031
984
  }));
1032
985
  }
1033
986
  else {
@@ -1040,13 +993,13 @@ function toolToVertex$1(apiClient, fromObject) {
1040
993
  }
1041
994
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
1042
995
  if (fromGoogleSearch != null) {
1043
- setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
996
+ setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$2());
1044
997
  }
1045
998
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
1046
999
  'googleSearchRetrieval',
1047
1000
  ]);
1048
1001
  if (fromGoogleSearchRetrieval != null) {
1049
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
1002
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$2(apiClient, fromGoogleSearchRetrieval));
1050
1003
  }
1051
1004
  const fromCodeExecution = getValueByPath(fromObject, [
1052
1005
  'codeExecution',
@@ -1098,7 +1051,7 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1098
1051
  if (parentObject !== undefined && fromContents != null) {
1099
1052
  if (Array.isArray(fromContents)) {
1100
1053
  setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
1101
- return contentToVertex$1(apiClient, item);
1054
+ return contentToVertex$2(apiClient, item);
1102
1055
  })));
1103
1056
  }
1104
1057
  else {
@@ -1109,13 +1062,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1109
1062
  'systemInstruction',
1110
1063
  ]);
1111
1064
  if (parentObject !== undefined && fromSystemInstruction != null) {
1112
- setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
1065
+ setValueByPath(parentObject, ['systemInstruction'], contentToVertex$2(apiClient, tContent(apiClient, fromSystemInstruction)));
1113
1066
  }
1114
1067
  const fromTools = getValueByPath(fromObject, ['tools']);
1115
1068
  if (parentObject !== undefined && fromTools != null) {
1116
1069
  if (Array.isArray(fromTools)) {
1117
1070
  setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
1118
- return toolToVertex$1(apiClient, item);
1071
+ return toolToVertex$2(apiClient, item);
1119
1072
  }));
1120
1073
  }
1121
1074
  else {
@@ -1514,6 +1467,7 @@ class Pager {
1514
1467
  * SPDX-License-Identifier: Apache-2.0
1515
1468
  */
1516
1469
  // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
1470
+ /** Required. Outcome of the code execution. */
1517
1471
  exports.Outcome = void 0;
1518
1472
  (function (Outcome) {
1519
1473
  Outcome["OUTCOME_UNSPECIFIED"] = "OUTCOME_UNSPECIFIED";
@@ -1521,11 +1475,13 @@ exports.Outcome = void 0;
1521
1475
  Outcome["OUTCOME_FAILED"] = "OUTCOME_FAILED";
1522
1476
  Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
1523
1477
  })(exports.Outcome || (exports.Outcome = {}));
1478
+ /** Required. Programming language of the `code`. */
1524
1479
  exports.Language = void 0;
1525
1480
  (function (Language) {
1526
1481
  Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
1527
1482
  Language["PYTHON"] = "PYTHON";
1528
1483
  })(exports.Language || (exports.Language = {}));
1484
+ /** Optional. The type of the data. */
1529
1485
  exports.Type = void 0;
1530
1486
  (function (Type) {
1531
1487
  Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
@@ -1536,6 +1492,7 @@ exports.Type = void 0;
1536
1492
  Type["ARRAY"] = "ARRAY";
1537
1493
  Type["OBJECT"] = "OBJECT";
1538
1494
  })(exports.Type || (exports.Type = {}));
1495
+ /** Required. Harm category. */
1539
1496
  exports.HarmCategory = void 0;
1540
1497
  (function (HarmCategory) {
1541
1498
  HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
@@ -1545,12 +1502,14 @@ exports.HarmCategory = void 0;
1545
1502
  HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
1546
1503
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
1547
1504
  })(exports.HarmCategory || (exports.HarmCategory = {}));
1505
+ /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
1548
1506
  exports.HarmBlockMethod = void 0;
1549
1507
  (function (HarmBlockMethod) {
1550
1508
  HarmBlockMethod["HARM_BLOCK_METHOD_UNSPECIFIED"] = "HARM_BLOCK_METHOD_UNSPECIFIED";
1551
1509
  HarmBlockMethod["SEVERITY"] = "SEVERITY";
1552
1510
  HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
1553
1511
  })(exports.HarmBlockMethod || (exports.HarmBlockMethod = {}));
1512
+ /** Required. The harm block threshold. */
1554
1513
  exports.HarmBlockThreshold = void 0;
1555
1514
  (function (HarmBlockThreshold) {
1556
1515
  HarmBlockThreshold["HARM_BLOCK_THRESHOLD_UNSPECIFIED"] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
@@ -1560,11 +1519,16 @@ exports.HarmBlockThreshold = void 0;
1560
1519
  HarmBlockThreshold["BLOCK_NONE"] = "BLOCK_NONE";
1561
1520
  HarmBlockThreshold["OFF"] = "OFF";
1562
1521
  })(exports.HarmBlockThreshold || (exports.HarmBlockThreshold = {}));
1522
+ /** The mode of the predictor to be used in dynamic retrieval. */
1563
1523
  exports.Mode = void 0;
1564
1524
  (function (Mode) {
1565
1525
  Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1566
1526
  Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1567
1527
  })(exports.Mode || (exports.Mode = {}));
1528
+ /** Output only. The reason why the model stopped generating tokens.
1529
+
1530
+ If empty, the model has not stopped generating the tokens.
1531
+ */
1568
1532
  exports.FinishReason = void 0;
1569
1533
  (function (FinishReason) {
1570
1534
  FinishReason["FINISH_REASON_UNSPECIFIED"] = "FINISH_REASON_UNSPECIFIED";
@@ -1579,6 +1543,7 @@ exports.FinishReason = void 0;
1579
1543
  FinishReason["MALFORMED_FUNCTION_CALL"] = "MALFORMED_FUNCTION_CALL";
1580
1544
  FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
1581
1545
  })(exports.FinishReason || (exports.FinishReason = {}));
1546
+ /** Output only. Harm probability levels in the content. */
1582
1547
  exports.HarmProbability = void 0;
1583
1548
  (function (HarmProbability) {
1584
1549
  HarmProbability["HARM_PROBABILITY_UNSPECIFIED"] = "HARM_PROBABILITY_UNSPECIFIED";
@@ -1587,6 +1552,7 @@ exports.HarmProbability = void 0;
1587
1552
  HarmProbability["MEDIUM"] = "MEDIUM";
1588
1553
  HarmProbability["HIGH"] = "HIGH";
1589
1554
  })(exports.HarmProbability || (exports.HarmProbability = {}));
1555
+ /** Output only. Harm severity levels in the content. */
1590
1556
  exports.HarmSeverity = void 0;
1591
1557
  (function (HarmSeverity) {
1592
1558
  HarmSeverity["HARM_SEVERITY_UNSPECIFIED"] = "HARM_SEVERITY_UNSPECIFIED";
@@ -1595,6 +1561,7 @@ exports.HarmSeverity = void 0;
1595
1561
  HarmSeverity["HARM_SEVERITY_MEDIUM"] = "HARM_SEVERITY_MEDIUM";
1596
1562
  HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
1597
1563
  })(exports.HarmSeverity || (exports.HarmSeverity = {}));
1564
+ /** Output only. Blocked reason. */
1598
1565
  exports.BlockedReason = void 0;
1599
1566
  (function (BlockedReason) {
1600
1567
  BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
@@ -1603,6 +1570,14 @@ exports.BlockedReason = void 0;
1603
1570
  BlockedReason["BLOCKLIST"] = "BLOCKLIST";
1604
1571
  BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
1605
1572
  })(exports.BlockedReason || (exports.BlockedReason = {}));
1573
+ /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
1574
+ exports.TrafficType = void 0;
1575
+ (function (TrafficType) {
1576
+ TrafficType["TRAFFIC_TYPE_UNSPECIFIED"] = "TRAFFIC_TYPE_UNSPECIFIED";
1577
+ TrafficType["ON_DEMAND"] = "ON_DEMAND";
1578
+ TrafficType["PROVISIONED_THROUGHPUT"] = "PROVISIONED_THROUGHPUT";
1579
+ })(exports.TrafficType || (exports.TrafficType = {}));
1580
+ /** Server content modalities. */
1606
1581
  exports.Modality = void 0;
1607
1582
  (function (Modality) {
1608
1583
  Modality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
@@ -1610,17 +1585,29 @@ exports.Modality = void 0;
1610
1585
  Modality["IMAGE"] = "IMAGE";
1611
1586
  Modality["AUDIO"] = "AUDIO";
1612
1587
  })(exports.Modality || (exports.Modality = {}));
1613
- exports.State = void 0;
1614
- (function (State) {
1615
- State["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
1616
- State["ACTIVE"] = "ACTIVE";
1617
- State["ERROR"] = "ERROR";
1618
- })(exports.State || (exports.State = {}));
1588
+ /** The media resolution to use. */
1589
+ exports.MediaResolution = void 0;
1590
+ (function (MediaResolution) {
1591
+ MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1592
+ MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1593
+ MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1594
+ MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1595
+ })(exports.MediaResolution || (exports.MediaResolution = {}));
1596
+ /** Options for feature selection preference. */
1597
+ exports.FeatureSelectionPreference = void 0;
1598
+ (function (FeatureSelectionPreference) {
1599
+ FeatureSelectionPreference["FEATURE_SELECTION_PREFERENCE_UNSPECIFIED"] = "FEATURE_SELECTION_PREFERENCE_UNSPECIFIED";
1600
+ FeatureSelectionPreference["PRIORITIZE_QUALITY"] = "PRIORITIZE_QUALITY";
1601
+ FeatureSelectionPreference["BALANCED"] = "BALANCED";
1602
+ FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
1603
+ })(exports.FeatureSelectionPreference || (exports.FeatureSelectionPreference = {}));
1604
+ /** Config for the dynamic retrieval config mode. */
1619
1605
  exports.DynamicRetrievalConfigMode = void 0;
1620
1606
  (function (DynamicRetrievalConfigMode) {
1621
1607
  DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1622
1608
  DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1623
1609
  })(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
1610
+ /** Config for the function calling config mode. */
1624
1611
  exports.FunctionCallingConfigMode = void 0;
1625
1612
  (function (FunctionCallingConfigMode) {
1626
1613
  FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
@@ -1628,13 +1615,7 @@ exports.FunctionCallingConfigMode = void 0;
1628
1615
  FunctionCallingConfigMode["ANY"] = "ANY";
1629
1616
  FunctionCallingConfigMode["NONE"] = "NONE";
1630
1617
  })(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
1631
- exports.MediaResolution = void 0;
1632
- (function (MediaResolution) {
1633
- MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1634
- MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1635
- MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1636
- MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1637
- })(exports.MediaResolution || (exports.MediaResolution = {}));
1618
+ /** Enum that controls the safety filter level for objectionable content. */
1638
1619
  exports.SafetyFilterLevel = void 0;
1639
1620
  (function (SafetyFilterLevel) {
1640
1621
  SafetyFilterLevel["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE";
@@ -1642,12 +1623,14 @@ exports.SafetyFilterLevel = void 0;
1642
1623
  SafetyFilterLevel["BLOCK_ONLY_HIGH"] = "BLOCK_ONLY_HIGH";
1643
1624
  SafetyFilterLevel["BLOCK_NONE"] = "BLOCK_NONE";
1644
1625
  })(exports.SafetyFilterLevel || (exports.SafetyFilterLevel = {}));
1626
+ /** Enum that controls the generation of people. */
1645
1627
  exports.PersonGeneration = void 0;
1646
1628
  (function (PersonGeneration) {
1647
1629
  PersonGeneration["DONT_ALLOW"] = "DONT_ALLOW";
1648
1630
  PersonGeneration["ALLOW_ADULT"] = "ALLOW_ADULT";
1649
1631
  PersonGeneration["ALLOW_ALL"] = "ALLOW_ALL";
1650
1632
  })(exports.PersonGeneration || (exports.PersonGeneration = {}));
1633
+ /** Enum that specifies the language of the text in the prompt. */
1651
1634
  exports.ImagePromptLanguage = void 0;
1652
1635
  (function (ImagePromptLanguage) {
1653
1636
  ImagePromptLanguage["auto"] = "auto";
@@ -1656,6 +1639,7 @@ exports.ImagePromptLanguage = void 0;
1656
1639
  ImagePromptLanguage["ko"] = "ko";
1657
1640
  ImagePromptLanguage["hi"] = "hi";
1658
1641
  })(exports.ImagePromptLanguage || (exports.ImagePromptLanguage = {}));
1642
+ /** State for the lifecycle of a File. */
1659
1643
  exports.FileState = void 0;
1660
1644
  (function (FileState) {
1661
1645
  FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
@@ -1663,12 +1647,14 @@ exports.FileState = void 0;
1663
1647
  FileState["ACTIVE"] = "ACTIVE";
1664
1648
  FileState["FAILED"] = "FAILED";
1665
1649
  })(exports.FileState || (exports.FileState = {}));
1650
+ /** Source of the File. */
1666
1651
  exports.FileSource = void 0;
1667
1652
  (function (FileSource) {
1668
1653
  FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
1669
1654
  FileSource["UPLOADED"] = "UPLOADED";
1670
1655
  FileSource["GENERATED"] = "GENERATED";
1671
1656
  })(exports.FileSource || (exports.FileSource = {}));
1657
+ /** Enum representing the mask mode of a mask reference image. */
1672
1658
  exports.MaskReferenceMode = void 0;
1673
1659
  (function (MaskReferenceMode) {
1674
1660
  MaskReferenceMode["MASK_MODE_DEFAULT"] = "MASK_MODE_DEFAULT";
@@ -1677,6 +1663,7 @@ exports.MaskReferenceMode = void 0;
1677
1663
  MaskReferenceMode["MASK_MODE_FOREGROUND"] = "MASK_MODE_FOREGROUND";
1678
1664
  MaskReferenceMode["MASK_MODE_SEMANTIC"] = "MASK_MODE_SEMANTIC";
1679
1665
  })(exports.MaskReferenceMode || (exports.MaskReferenceMode = {}));
1666
+ /** Enum representing the control type of a control reference image. */
1680
1667
  exports.ControlReferenceType = void 0;
1681
1668
  (function (ControlReferenceType) {
1682
1669
  ControlReferenceType["CONTROL_TYPE_DEFAULT"] = "CONTROL_TYPE_DEFAULT";
@@ -1684,6 +1671,7 @@ exports.ControlReferenceType = void 0;
1684
1671
  ControlReferenceType["CONTROL_TYPE_SCRIBBLE"] = "CONTROL_TYPE_SCRIBBLE";
1685
1672
  ControlReferenceType["CONTROL_TYPE_FACE_MESH"] = "CONTROL_TYPE_FACE_MESH";
1686
1673
  })(exports.ControlReferenceType || (exports.ControlReferenceType = {}));
1674
+ /** Enum representing the subject type of a subject reference image. */
1687
1675
  exports.SubjectReferenceType = void 0;
1688
1676
  (function (SubjectReferenceType) {
1689
1677
  SubjectReferenceType["SUBJECT_TYPE_DEFAULT"] = "SUBJECT_TYPE_DEFAULT";
@@ -1691,6 +1679,7 @@ exports.SubjectReferenceType = void 0;
1691
1679
  SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
1692
1680
  SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
1693
1681
  })(exports.SubjectReferenceType || (exports.SubjectReferenceType = {}));
1682
+ /** Server content modalities. */
1694
1683
  exports.MediaModality = void 0;
1695
1684
  (function (MediaModality) {
1696
1685
  MediaModality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
@@ -1700,6 +1689,34 @@ exports.MediaModality = void 0;
1700
1689
  MediaModality["AUDIO"] = "AUDIO";
1701
1690
  MediaModality["DOCUMENT"] = "DOCUMENT";
1702
1691
  })(exports.MediaModality || (exports.MediaModality = {}));
1692
+ /** Start of speech sensitivity. */
1693
+ exports.StartSensitivity = void 0;
1694
+ (function (StartSensitivity) {
1695
+ StartSensitivity["START_SENSITIVITY_UNSPECIFIED"] = "START_SENSITIVITY_UNSPECIFIED";
1696
+ StartSensitivity["START_SENSITIVITY_HIGH"] = "START_SENSITIVITY_HIGH";
1697
+ StartSensitivity["START_SENSITIVITY_LOW"] = "START_SENSITIVITY_LOW";
1698
+ })(exports.StartSensitivity || (exports.StartSensitivity = {}));
1699
+ /** End of speech sensitivity. */
1700
+ exports.EndSensitivity = void 0;
1701
+ (function (EndSensitivity) {
1702
+ EndSensitivity["END_SENSITIVITY_UNSPECIFIED"] = "END_SENSITIVITY_UNSPECIFIED";
1703
+ EndSensitivity["END_SENSITIVITY_HIGH"] = "END_SENSITIVITY_HIGH";
1704
+ EndSensitivity["END_SENSITIVITY_LOW"] = "END_SENSITIVITY_LOW";
1705
+ })(exports.EndSensitivity || (exports.EndSensitivity = {}));
1706
+ /** The different ways of handling user activity. */
1707
+ exports.ActivityHandling = void 0;
1708
+ (function (ActivityHandling) {
1709
+ ActivityHandling["ACTIVITY_HANDLING_UNSPECIFIED"] = "ACTIVITY_HANDLING_UNSPECIFIED";
1710
+ ActivityHandling["START_OF_ACTIVITY_INTERRUPTS"] = "START_OF_ACTIVITY_INTERRUPTS";
1711
+ ActivityHandling["NO_INTERRUPTION"] = "NO_INTERRUPTION";
1712
+ })(exports.ActivityHandling || (exports.ActivityHandling = {}));
1713
+ /** Options about which input is included in the user's turn. */
1714
+ exports.TurnCoverage = void 0;
1715
+ (function (TurnCoverage) {
1716
+ TurnCoverage["TURN_COVERAGE_UNSPECIFIED"] = "TURN_COVERAGE_UNSPECIFIED";
1717
+ TurnCoverage["TURN_INCLUDES_ONLY_ACTIVITY"] = "TURN_INCLUDES_ONLY_ACTIVITY";
1718
+ TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
1719
+ })(exports.TurnCoverage || (exports.TurnCoverage = {}));
1703
1720
  /** A function response. */
1704
1721
  class FunctionResponse {
1705
1722
  }
@@ -1746,7 +1763,7 @@ function createPartFromFunctionResponse(id, name, response) {
1746
1763
  };
1747
1764
  }
1748
1765
  /**
1749
- * Creates a `Part` object from a `base64` `string`.
1766
+ * Creates a `Part` object from a `base64` encoded `string`.
1750
1767
  */
1751
1768
  function createPartFromBase64(data, mimeType) {
1752
1769
  return {
@@ -2134,8 +2151,8 @@ class Caches extends BaseModule {
2134
2151
  *
2135
2152
  * @remarks
2136
2153
  * Context caching is only supported for specific models. See [Gemini
2137
- * Developer API reference] (https://ai.google.dev/gemini-api/docs/caching?lang=node/context-cac)
2138
- * and [Vertex AI reference] (https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
2154
+ * Developer API reference](https://ai.google.dev/gemini-api/docs/caching?lang=node/context-cac)
2155
+ * and [Vertex AI reference](https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
2139
2156
  * for more information.
2140
2157
  *
2141
2158
  * @param params - The parameters for the create request.
@@ -2825,9 +2842,10 @@ class Chat {
2825
2842
  * SPDX-License-Identifier: Apache-2.0
2826
2843
  */
2827
2844
  const CONTENT_TYPE_HEADER = 'Content-Type';
2845
+ const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
2828
2846
  const USER_AGENT_HEADER = 'User-Agent';
2829
2847
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
2830
- const SDK_VERSION = '0.7.0'; // x-release-please-version
2848
+ const SDK_VERSION = '0.9.0'; // x-release-please-version
2831
2849
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
2832
2850
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
2833
2851
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -2967,11 +2985,9 @@ class ApiClient {
2967
2985
  throw new Error('HTTP options are not correctly set.');
2968
2986
  }
2969
2987
  }
2970
- constructUrl(path, httpOptions) {
2988
+ constructUrl(path, httpOptions, prependProjectLocation) {
2971
2989
  const urlElement = [this.getRequestUrlInternal(httpOptions)];
2972
- if (this.clientOptions.vertexai &&
2973
- !this.clientOptions.apiKey &&
2974
- !path.startsWith('projects/')) {
2990
+ if (prependProjectLocation) {
2975
2991
  urlElement.push(this.getBaseResourcePath());
2976
2992
  }
2977
2993
  if (path !== '') {
@@ -2980,12 +2996,34 @@ class ApiClient {
2980
2996
  const url = new URL(`${urlElement.join('/')}`);
2981
2997
  return url;
2982
2998
  }
2999
+ shouldPrependVertexProjectPath(request) {
3000
+ if (this.clientOptions.apiKey) {
3001
+ return false;
3002
+ }
3003
+ if (!this.clientOptions.vertexai) {
3004
+ return false;
3005
+ }
3006
+ if (request.path.startsWith('projects/')) {
3007
+ // Assume the path already starts with
3008
+ // `projects/<project>/location/<location>`.
3009
+ return false;
3010
+ }
3011
+ if (request.httpMethod === 'GET' &&
3012
+ request.path.startsWith('publishers/google/models')) {
3013
+ // These paths are used by Vertex's models.get and models.list
3014
+ // calls. For base models Vertex does not accept a project/location
3015
+ // prefix (for tuned model the prefix is required).
3016
+ return false;
3017
+ }
3018
+ return true;
3019
+ }
2983
3020
  async request(request) {
2984
3021
  let patchedHttpOptions = this.clientOptions.httpOptions;
2985
3022
  if (request.httpOptions) {
2986
3023
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
2987
3024
  }
2988
- const url = this.constructUrl(request.path, patchedHttpOptions);
3025
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
3026
+ const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
2989
3027
  if (request.queryParams) {
2990
3028
  for (const [key, value] of Object.entries(request.queryParams)) {
2991
3029
  url.searchParams.append(key, String(value));
@@ -3027,7 +3065,8 @@ class ApiClient {
3027
3065
  if (request.httpOptions) {
3028
3066
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
3029
3067
  }
3030
- const url = this.constructUrl(request.path, patchedHttpOptions);
3068
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
3069
+ const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
3031
3070
  if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
3032
3071
  url.searchParams.set('alt', 'sse');
3033
3072
  }
@@ -3100,8 +3139,12 @@ class ApiClient {
3100
3139
  while (match) {
3101
3140
  const processedChunkString = match[1];
3102
3141
  try {
3103
- const chunkData = JSON.parse(processedChunkString);
3104
- yield yield __await(chunkData);
3142
+ const partialResponse = new Response(processedChunkString, {
3143
+ headers: response === null || response === void 0 ? void 0 : response.headers,
3144
+ status: response === null || response === void 0 ? void 0 : response.status,
3145
+ statusText: response === null || response === void 0 ? void 0 : response.statusText,
3146
+ });
3147
+ yield yield __await(new HttpResponse(partialResponse));
3105
3148
  buffer = buffer.slice(match[0].length);
3106
3149
  match = buffer.match(responseLineRE);
3107
3150
  }
@@ -3135,6 +3178,11 @@ class ApiClient {
3135
3178
  for (const [key, value] of Object.entries(httpOptions.headers)) {
3136
3179
  headers.append(key, value);
3137
3180
  }
3181
+ // Append a timeout header if it is set, note that the timeout option is
3182
+ // in milliseconds but the header is in seconds.
3183
+ if (httpOptions.timeout && httpOptions.timeout > 0) {
3184
+ headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
3185
+ }
3138
3186
  }
3139
3187
  await this.clientOptions.auth.addAuthHeaders(headers);
3140
3188
  return headers;
@@ -3582,12 +3630,8 @@ function listFilesResponseFromMldev(apiClient, fromObject) {
3582
3630
  }
3583
3631
  return toObject;
3584
3632
  }
3585
- function createFileResponseFromMldev(apiClient, fromObject) {
3633
+ function createFileResponseFromMldev() {
3586
3634
  const toObject = {};
3587
- const fromHttpHeaders = getValueByPath(fromObject, ['httpHeaders']);
3588
- if (fromHttpHeaders != null) {
3589
- setValueByPath(toObject, ['httpHeaders'], fromHttpHeaders);
3590
- }
3591
3635
  return toObject;
3592
3636
  }
3593
3637
  function deleteFileResponseFromMldev() {
@@ -3649,7 +3693,9 @@ class Files extends BaseModule {
3649
3693
  * This section can contain multiple paragraphs and code examples.
3650
3694
  *
3651
3695
  * @param params - Optional parameters specified in the
3652
- * `common.UploadFileParameters` interface.
3696
+ * `types.UploadFileParameters` interface.
3697
+ * @see {@link types.UploadFileParameters#config} for the optional
3698
+ * config in the parameters.
3653
3699
  * @return A promise that resolves to a `types.File` object.
3654
3700
  * @throws An error if called on a Vertex AI client.
3655
3701
  * @throws An error if the `mimeType` is not provided and can not be inferred,
@@ -3737,8 +3783,8 @@ class Files extends BaseModule {
3737
3783
  .then((httpResponse) => {
3738
3784
  return httpResponse.json();
3739
3785
  });
3740
- return response.then((apiResponse) => {
3741
- const resp = createFileResponseFromMldev(this.apiClient, apiResponse);
3786
+ return response.then(() => {
3787
+ const resp = createFileResponseFromMldev();
3742
3788
  const typedResp = new CreateFileResponse();
3743
3789
  Object.assign(typedResp, resp);
3744
3790
  return typedResp;
@@ -3846,7 +3892,7 @@ class Files extends BaseModule {
3846
3892
  * Copyright 2025 Google LLC
3847
3893
  * SPDX-License-Identifier: Apache-2.0
3848
3894
  */
3849
- function partToMldev(apiClient, fromObject) {
3895
+ function partToMldev$1(apiClient, fromObject) {
3850
3896
  const toObject = {};
3851
3897
  if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
3852
3898
  throw new Error('videoMetadata parameter is not supported in Gemini API.');
@@ -3891,13 +3937,61 @@ function partToMldev(apiClient, fromObject) {
3891
3937
  }
3892
3938
  return toObject;
3893
3939
  }
3894
- function contentToMldev(apiClient, fromObject) {
3940
+ function partToVertex$1(apiClient, fromObject) {
3941
+ const toObject = {};
3942
+ const fromVideoMetadata = getValueByPath(fromObject, [
3943
+ 'videoMetadata',
3944
+ ]);
3945
+ if (fromVideoMetadata != null) {
3946
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
3947
+ }
3948
+ const fromThought = getValueByPath(fromObject, ['thought']);
3949
+ if (fromThought != null) {
3950
+ setValueByPath(toObject, ['thought'], fromThought);
3951
+ }
3952
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
3953
+ 'codeExecutionResult',
3954
+ ]);
3955
+ if (fromCodeExecutionResult != null) {
3956
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
3957
+ }
3958
+ const fromExecutableCode = getValueByPath(fromObject, [
3959
+ 'executableCode',
3960
+ ]);
3961
+ if (fromExecutableCode != null) {
3962
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
3963
+ }
3964
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
3965
+ if (fromFileData != null) {
3966
+ setValueByPath(toObject, ['fileData'], fromFileData);
3967
+ }
3968
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
3969
+ if (fromFunctionCall != null) {
3970
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
3971
+ }
3972
+ const fromFunctionResponse = getValueByPath(fromObject, [
3973
+ 'functionResponse',
3974
+ ]);
3975
+ if (fromFunctionResponse != null) {
3976
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
3977
+ }
3978
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
3979
+ if (fromInlineData != null) {
3980
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
3981
+ }
3982
+ const fromText = getValueByPath(fromObject, ['text']);
3983
+ if (fromText != null) {
3984
+ setValueByPath(toObject, ['text'], fromText);
3985
+ }
3986
+ return toObject;
3987
+ }
3988
+ function contentToMldev$1(apiClient, fromObject) {
3895
3989
  const toObject = {};
3896
3990
  const fromParts = getValueByPath(fromObject, ['parts']);
3897
3991
  if (fromParts != null) {
3898
3992
  if (Array.isArray(fromParts)) {
3899
3993
  setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3900
- return partToMldev(apiClient, item);
3994
+ return partToMldev$1(apiClient, item);
3901
3995
  }));
3902
3996
  }
3903
3997
  else {
@@ -3910,28 +4004,58 @@ function contentToMldev(apiClient, fromObject) {
3910
4004
  }
3911
4005
  return toObject;
3912
4006
  }
3913
- function schemaToMldev(apiClient, fromObject) {
4007
+ function contentToVertex$1(apiClient, fromObject) {
3914
4008
  const toObject = {};
3915
- if (getValueByPath(fromObject, ['example']) !== undefined) {
3916
- throw new Error('example parameter is not supported in Gemini API.');
4009
+ const fromParts = getValueByPath(fromObject, ['parts']);
4010
+ if (fromParts != null) {
4011
+ if (Array.isArray(fromParts)) {
4012
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4013
+ return partToVertex$1(apiClient, item);
4014
+ }));
4015
+ }
4016
+ else {
4017
+ setValueByPath(toObject, ['parts'], fromParts);
4018
+ }
3917
4019
  }
3918
- if (getValueByPath(fromObject, ['pattern']) !== undefined) {
3919
- throw new Error('pattern parameter is not supported in Gemini API.');
4020
+ const fromRole = getValueByPath(fromObject, ['role']);
4021
+ if (fromRole != null) {
4022
+ setValueByPath(toObject, ['role'], fromRole);
3920
4023
  }
3921
- if (getValueByPath(fromObject, ['default']) !== undefined) {
3922
- throw new Error('default parameter is not supported in Gemini API.');
4024
+ return toObject;
4025
+ }
4026
+ function schemaToVertex$1(apiClient, fromObject) {
4027
+ const toObject = {};
4028
+ const fromExample = getValueByPath(fromObject, ['example']);
4029
+ if (fromExample != null) {
4030
+ setValueByPath(toObject, ['example'], fromExample);
3923
4031
  }
3924
- if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
3925
- throw new Error('maxLength parameter is not supported in Gemini API.');
4032
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
4033
+ if (fromPattern != null) {
4034
+ setValueByPath(toObject, ['pattern'], fromPattern);
3926
4035
  }
3927
- if (getValueByPath(fromObject, ['minLength']) !== undefined) {
3928
- throw new Error('minLength parameter is not supported in Gemini API.');
4036
+ const fromDefault = getValueByPath(fromObject, ['default']);
4037
+ if (fromDefault != null) {
4038
+ setValueByPath(toObject, ['default'], fromDefault);
3929
4039
  }
3930
- if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
3931
- throw new Error('minProperties parameter is not supported in Gemini API.');
4040
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
4041
+ if (fromMaxLength != null) {
4042
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
3932
4043
  }
3933
- if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
3934
- throw new Error('maxProperties parameter is not supported in Gemini API.');
4044
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
4045
+ if (fromMinLength != null) {
4046
+ setValueByPath(toObject, ['minLength'], fromMinLength);
4047
+ }
4048
+ const fromMinProperties = getValueByPath(fromObject, [
4049
+ 'minProperties',
4050
+ ]);
4051
+ if (fromMinProperties != null) {
4052
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
4053
+ }
4054
+ const fromMaxProperties = getValueByPath(fromObject, [
4055
+ 'maxProperties',
4056
+ ]);
4057
+ if (fromMaxProperties != null) {
4058
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
3935
4059
  }
3936
4060
  const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
3937
4061
  if (fromAnyOf != null) {
@@ -3997,25 +4121,30 @@ function schemaToMldev(apiClient, fromObject) {
3997
4121
  }
3998
4122
  return toObject;
3999
4123
  }
4000
- function safetySettingToMldev(apiClient, fromObject) {
4124
+ function functionDeclarationToMldev$1(apiClient, fromObject) {
4001
4125
  const toObject = {};
4002
- if (getValueByPath(fromObject, ['method']) !== undefined) {
4003
- throw new Error('method parameter is not supported in Gemini API.');
4126
+ if (getValueByPath(fromObject, ['response']) !== undefined) {
4127
+ throw new Error('response parameter is not supported in Gemini API.');
4004
4128
  }
4005
- const fromCategory = getValueByPath(fromObject, ['category']);
4006
- if (fromCategory != null) {
4007
- setValueByPath(toObject, ['category'], fromCategory);
4129
+ const fromDescription = getValueByPath(fromObject, ['description']);
4130
+ if (fromDescription != null) {
4131
+ setValueByPath(toObject, ['description'], fromDescription);
4008
4132
  }
4009
- const fromThreshold = getValueByPath(fromObject, ['threshold']);
4010
- if (fromThreshold != null) {
4011
- setValueByPath(toObject, ['threshold'], fromThreshold);
4133
+ const fromName = getValueByPath(fromObject, ['name']);
4134
+ if (fromName != null) {
4135
+ setValueByPath(toObject, ['name'], fromName);
4136
+ }
4137
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
4138
+ if (fromParameters != null) {
4139
+ setValueByPath(toObject, ['parameters'], fromParameters);
4012
4140
  }
4013
4141
  return toObject;
4014
4142
  }
4015
- function functionDeclarationToMldev(apiClient, fromObject) {
4143
+ function functionDeclarationToVertex$1(apiClient, fromObject) {
4016
4144
  const toObject = {};
4017
- if (getValueByPath(fromObject, ['response']) !== undefined) {
4018
- throw new Error('response parameter is not supported in Gemini API.');
4145
+ const fromResponse = getValueByPath(fromObject, ['response']);
4146
+ if (fromResponse != null) {
4147
+ setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
4019
4148
  }
4020
4149
  const fromDescription = getValueByPath(fromObject, ['description']);
4021
4150
  if (fromDescription != null) {
@@ -4031,11 +4160,15 @@ function functionDeclarationToMldev(apiClient, fromObject) {
4031
4160
  }
4032
4161
  return toObject;
4033
4162
  }
4034
- function googleSearchToMldev() {
4163
+ function googleSearchToMldev$1() {
4035
4164
  const toObject = {};
4036
4165
  return toObject;
4037
4166
  }
4038
- function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
4167
+ function googleSearchToVertex$1() {
4168
+ const toObject = {};
4169
+ return toObject;
4170
+ }
4171
+ function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
4039
4172
  const toObject = {};
4040
4173
  const fromMode = getValueByPath(fromObject, ['mode']);
4041
4174
  if (fromMode != null) {
@@ -4049,14 +4182,1378 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
4049
4182
  }
4050
4183
  return toObject;
4051
4184
  }
4052
- function googleSearchRetrievalToMldev(apiClient, fromObject) {
4185
+ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
4053
4186
  const toObject = {};
4054
- const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
4055
- 'dynamicRetrievalConfig',
4056
- ]);
4057
- if (fromDynamicRetrievalConfig != null) {
4058
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
4059
- }
4187
+ const fromMode = getValueByPath(fromObject, ['mode']);
4188
+ if (fromMode != null) {
4189
+ setValueByPath(toObject, ['mode'], fromMode);
4190
+ }
4191
+ const fromDynamicThreshold = getValueByPath(fromObject, [
4192
+ 'dynamicThreshold',
4193
+ ]);
4194
+ if (fromDynamicThreshold != null) {
4195
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
4196
+ }
4197
+ return toObject;
4198
+ }
4199
+ function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
4200
+ const toObject = {};
4201
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
4202
+ 'dynamicRetrievalConfig',
4203
+ ]);
4204
+ if (fromDynamicRetrievalConfig != null) {
4205
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
4206
+ }
4207
+ return toObject;
4208
+ }
4209
+ function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
4210
+ const toObject = {};
4211
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
4212
+ 'dynamicRetrievalConfig',
4213
+ ]);
4214
+ if (fromDynamicRetrievalConfig != null) {
4215
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
4216
+ }
4217
+ return toObject;
4218
+ }
4219
+ function toolToMldev$1(apiClient, fromObject) {
4220
+ const toObject = {};
4221
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
4222
+ 'functionDeclarations',
4223
+ ]);
4224
+ if (fromFunctionDeclarations != null) {
4225
+ if (Array.isArray(fromFunctionDeclarations)) {
4226
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4227
+ return functionDeclarationToMldev$1(apiClient, item);
4228
+ }));
4229
+ }
4230
+ else {
4231
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4232
+ }
4233
+ }
4234
+ if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4235
+ throw new Error('retrieval parameter is not supported in Gemini API.');
4236
+ }
4237
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4238
+ if (fromGoogleSearch != null) {
4239
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1());
4240
+ }
4241
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4242
+ 'googleSearchRetrieval',
4243
+ ]);
4244
+ if (fromGoogleSearchRetrieval != null) {
4245
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
4246
+ }
4247
+ const fromCodeExecution = getValueByPath(fromObject, [
4248
+ 'codeExecution',
4249
+ ]);
4250
+ if (fromCodeExecution != null) {
4251
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4252
+ }
4253
+ return toObject;
4254
+ }
4255
+ function toolToVertex$1(apiClient, fromObject) {
4256
+ const toObject = {};
4257
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
4258
+ 'functionDeclarations',
4259
+ ]);
4260
+ if (fromFunctionDeclarations != null) {
4261
+ if (Array.isArray(fromFunctionDeclarations)) {
4262
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4263
+ return functionDeclarationToVertex$1(apiClient, item);
4264
+ }));
4265
+ }
4266
+ else {
4267
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4268
+ }
4269
+ }
4270
+ const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
4271
+ if (fromRetrieval != null) {
4272
+ setValueByPath(toObject, ['retrieval'], fromRetrieval);
4273
+ }
4274
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4275
+ if (fromGoogleSearch != null) {
4276
+ setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
4277
+ }
4278
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4279
+ 'googleSearchRetrieval',
4280
+ ]);
4281
+ if (fromGoogleSearchRetrieval != null) {
4282
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
4283
+ }
4284
+ const fromCodeExecution = getValueByPath(fromObject, [
4285
+ 'codeExecution',
4286
+ ]);
4287
+ if (fromCodeExecution != null) {
4288
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4289
+ }
4290
+ return toObject;
4291
+ }
4292
+ function sessionResumptionConfigToMldev(apiClient, fromObject) {
4293
+ const toObject = {};
4294
+ const fromHandle = getValueByPath(fromObject, ['handle']);
4295
+ if (fromHandle != null) {
4296
+ setValueByPath(toObject, ['handle'], fromHandle);
4297
+ }
4298
+ if (getValueByPath(fromObject, ['transparent']) !== undefined) {
4299
+ throw new Error('transparent parameter is not supported in Gemini API.');
4300
+ }
4301
+ return toObject;
4302
+ }
4303
+ function sessionResumptionConfigToVertex(apiClient, fromObject) {
4304
+ const toObject = {};
4305
+ const fromHandle = getValueByPath(fromObject, ['handle']);
4306
+ if (fromHandle != null) {
4307
+ setValueByPath(toObject, ['handle'], fromHandle);
4308
+ }
4309
+ const fromTransparent = getValueByPath(fromObject, ['transparent']);
4310
+ if (fromTransparent != null) {
4311
+ setValueByPath(toObject, ['transparent'], fromTransparent);
4312
+ }
4313
+ return toObject;
4314
+ }
4315
+ function audioTranscriptionConfigToMldev() {
4316
+ const toObject = {};
4317
+ return toObject;
4318
+ }
4319
+ function audioTranscriptionConfigToVertex() {
4320
+ const toObject = {};
4321
+ return toObject;
4322
+ }
4323
+ function automaticActivityDetectionToMldev(apiClient, fromObject) {
4324
+ const toObject = {};
4325
+ const fromDisabled = getValueByPath(fromObject, ['disabled']);
4326
+ if (fromDisabled != null) {
4327
+ setValueByPath(toObject, ['disabled'], fromDisabled);
4328
+ }
4329
+ const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
4330
+ 'startOfSpeechSensitivity',
4331
+ ]);
4332
+ if (fromStartOfSpeechSensitivity != null) {
4333
+ setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
4334
+ }
4335
+ const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
4336
+ 'endOfSpeechSensitivity',
4337
+ ]);
4338
+ if (fromEndOfSpeechSensitivity != null) {
4339
+ setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
4340
+ }
4341
+ const fromPrefixPaddingMs = getValueByPath(fromObject, [
4342
+ 'prefixPaddingMs',
4343
+ ]);
4344
+ if (fromPrefixPaddingMs != null) {
4345
+ setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
4346
+ }
4347
+ const fromSilenceDurationMs = getValueByPath(fromObject, [
4348
+ 'silenceDurationMs',
4349
+ ]);
4350
+ if (fromSilenceDurationMs != null) {
4351
+ setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
4352
+ }
4353
+ return toObject;
4354
+ }
4355
+ function automaticActivityDetectionToVertex(apiClient, fromObject) {
4356
+ const toObject = {};
4357
+ const fromDisabled = getValueByPath(fromObject, ['disabled']);
4358
+ if (fromDisabled != null) {
4359
+ setValueByPath(toObject, ['disabled'], fromDisabled);
4360
+ }
4361
+ const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
4362
+ 'startOfSpeechSensitivity',
4363
+ ]);
4364
+ if (fromStartOfSpeechSensitivity != null) {
4365
+ setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
4366
+ }
4367
+ const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
4368
+ 'endOfSpeechSensitivity',
4369
+ ]);
4370
+ if (fromEndOfSpeechSensitivity != null) {
4371
+ setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
4372
+ }
4373
+ const fromPrefixPaddingMs = getValueByPath(fromObject, [
4374
+ 'prefixPaddingMs',
4375
+ ]);
4376
+ if (fromPrefixPaddingMs != null) {
4377
+ setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
4378
+ }
4379
+ const fromSilenceDurationMs = getValueByPath(fromObject, [
4380
+ 'silenceDurationMs',
4381
+ ]);
4382
+ if (fromSilenceDurationMs != null) {
4383
+ setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
4384
+ }
4385
+ return toObject;
4386
+ }
4387
+ function realtimeInputConfigToMldev(apiClient, fromObject) {
4388
+ const toObject = {};
4389
+ const fromAutomaticActivityDetection = getValueByPath(fromObject, [
4390
+ 'automaticActivityDetection',
4391
+ ]);
4392
+ if (fromAutomaticActivityDetection != null) {
4393
+ setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
4394
+ }
4395
+ const fromActivityHandling = getValueByPath(fromObject, [
4396
+ 'activityHandling',
4397
+ ]);
4398
+ if (fromActivityHandling != null) {
4399
+ setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
4400
+ }
4401
+ const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
4402
+ if (fromTurnCoverage != null) {
4403
+ setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
4404
+ }
4405
+ return toObject;
4406
+ }
4407
+ function realtimeInputConfigToVertex(apiClient, fromObject) {
4408
+ const toObject = {};
4409
+ const fromAutomaticActivityDetection = getValueByPath(fromObject, [
4410
+ 'automaticActivityDetection',
4411
+ ]);
4412
+ if (fromAutomaticActivityDetection != null) {
4413
+ setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToVertex(apiClient, fromAutomaticActivityDetection));
4414
+ }
4415
+ const fromActivityHandling = getValueByPath(fromObject, [
4416
+ 'activityHandling',
4417
+ ]);
4418
+ if (fromActivityHandling != null) {
4419
+ setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
4420
+ }
4421
+ const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
4422
+ if (fromTurnCoverage != null) {
4423
+ setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
4424
+ }
4425
+ return toObject;
4426
+ }
4427
+ function slidingWindowToMldev(apiClient, fromObject) {
4428
+ const toObject = {};
4429
+ const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
4430
+ if (fromTargetTokens != null) {
4431
+ setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
4432
+ }
4433
+ return toObject;
4434
+ }
4435
+ function slidingWindowToVertex(apiClient, fromObject) {
4436
+ const toObject = {};
4437
+ const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
4438
+ if (fromTargetTokens != null) {
4439
+ setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
4440
+ }
4441
+ return toObject;
4442
+ }
4443
+ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
4444
+ const toObject = {};
4445
+ const fromTriggerTokens = getValueByPath(fromObject, [
4446
+ 'triggerTokens',
4447
+ ]);
4448
+ if (fromTriggerTokens != null) {
4449
+ setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
4450
+ }
4451
+ const fromSlidingWindow = getValueByPath(fromObject, [
4452
+ 'slidingWindow',
4453
+ ]);
4454
+ if (fromSlidingWindow != null) {
4455
+ setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
4456
+ }
4457
+ return toObject;
4458
+ }
4459
+ function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
4460
+ const toObject = {};
4461
+ const fromTriggerTokens = getValueByPath(fromObject, [
4462
+ 'triggerTokens',
4463
+ ]);
4464
+ if (fromTriggerTokens != null) {
4465
+ setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
4466
+ }
4467
+ const fromSlidingWindow = getValueByPath(fromObject, [
4468
+ 'slidingWindow',
4469
+ ]);
4470
+ if (fromSlidingWindow != null) {
4471
+ setValueByPath(toObject, ['slidingWindow'], slidingWindowToVertex(apiClient, fromSlidingWindow));
4472
+ }
4473
+ return toObject;
4474
+ }
4475
+ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
4476
+ const toObject = {};
4477
+ const fromGenerationConfig = getValueByPath(fromObject, [
4478
+ 'generationConfig',
4479
+ ]);
4480
+ if (parentObject !== undefined && fromGenerationConfig != null) {
4481
+ setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
4482
+ }
4483
+ const fromResponseModalities = getValueByPath(fromObject, [
4484
+ 'responseModalities',
4485
+ ]);
4486
+ if (parentObject !== undefined && fromResponseModalities != null) {
4487
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
4488
+ }
4489
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
4490
+ if (parentObject !== undefined && fromTemperature != null) {
4491
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
4492
+ }
4493
+ const fromTopP = getValueByPath(fromObject, ['topP']);
4494
+ if (parentObject !== undefined && fromTopP != null) {
4495
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
4496
+ }
4497
+ const fromTopK = getValueByPath(fromObject, ['topK']);
4498
+ if (parentObject !== undefined && fromTopK != null) {
4499
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
4500
+ }
4501
+ const fromMaxOutputTokens = getValueByPath(fromObject, [
4502
+ 'maxOutputTokens',
4503
+ ]);
4504
+ if (parentObject !== undefined && fromMaxOutputTokens != null) {
4505
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
4506
+ }
4507
+ const fromMediaResolution = getValueByPath(fromObject, [
4508
+ 'mediaResolution',
4509
+ ]);
4510
+ if (parentObject !== undefined && fromMediaResolution != null) {
4511
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
4512
+ }
4513
+ const fromSeed = getValueByPath(fromObject, ['seed']);
4514
+ if (parentObject !== undefined && fromSeed != null) {
4515
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
4516
+ }
4517
+ const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
4518
+ if (parentObject !== undefined && fromSpeechConfig != null) {
4519
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], fromSpeechConfig);
4520
+ }
4521
+ const fromSystemInstruction = getValueByPath(fromObject, [
4522
+ 'systemInstruction',
4523
+ ]);
4524
+ if (parentObject !== undefined && fromSystemInstruction != null) {
4525
+ setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
4526
+ }
4527
+ const fromTools = getValueByPath(fromObject, ['tools']);
4528
+ if (parentObject !== undefined && fromTools != null) {
4529
+ if (Array.isArray(fromTools)) {
4530
+ setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4531
+ return toolToMldev$1(apiClient, tTool(apiClient, item));
4532
+ })));
4533
+ }
4534
+ else {
4535
+ setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
4536
+ }
4537
+ }
4538
+ const fromSessionResumption = getValueByPath(fromObject, [
4539
+ 'sessionResumption',
4540
+ ]);
4541
+ if (parentObject !== undefined && fromSessionResumption != null) {
4542
+ setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
4543
+ }
4544
+ if (getValueByPath(fromObject, ['inputAudioTranscription']) !== undefined) {
4545
+ throw new Error('inputAudioTranscription parameter is not supported in Gemini API.');
4546
+ }
4547
+ const fromOutputAudioTranscription = getValueByPath(fromObject, [
4548
+ 'outputAudioTranscription',
4549
+ ]);
4550
+ if (parentObject !== undefined && fromOutputAudioTranscription != null) {
4551
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
4552
+ }
4553
+ const fromRealtimeInputConfig = getValueByPath(fromObject, [
4554
+ 'realtimeInputConfig',
4555
+ ]);
4556
+ if (parentObject !== undefined && fromRealtimeInputConfig != null) {
4557
+ setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
4558
+ }
4559
+ const fromContextWindowCompression = getValueByPath(fromObject, [
4560
+ 'contextWindowCompression',
4561
+ ]);
4562
+ if (parentObject !== undefined && fromContextWindowCompression != null) {
4563
+ setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
4564
+ }
4565
+ return toObject;
4566
+ }
4567
+ function liveConnectConfigToVertex(apiClient, fromObject, parentObject) {
4568
+ const toObject = {};
4569
+ const fromGenerationConfig = getValueByPath(fromObject, [
4570
+ 'generationConfig',
4571
+ ]);
4572
+ if (parentObject !== undefined && fromGenerationConfig != null) {
4573
+ setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
4574
+ }
4575
+ const fromResponseModalities = getValueByPath(fromObject, [
4576
+ 'responseModalities',
4577
+ ]);
4578
+ if (parentObject !== undefined && fromResponseModalities != null) {
4579
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
4580
+ }
4581
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
4582
+ if (parentObject !== undefined && fromTemperature != null) {
4583
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
4584
+ }
4585
+ const fromTopP = getValueByPath(fromObject, ['topP']);
4586
+ if (parentObject !== undefined && fromTopP != null) {
4587
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
4588
+ }
4589
+ const fromTopK = getValueByPath(fromObject, ['topK']);
4590
+ if (parentObject !== undefined && fromTopK != null) {
4591
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
4592
+ }
4593
+ const fromMaxOutputTokens = getValueByPath(fromObject, [
4594
+ 'maxOutputTokens',
4595
+ ]);
4596
+ if (parentObject !== undefined && fromMaxOutputTokens != null) {
4597
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
4598
+ }
4599
+ const fromMediaResolution = getValueByPath(fromObject, [
4600
+ 'mediaResolution',
4601
+ ]);
4602
+ if (parentObject !== undefined && fromMediaResolution != null) {
4603
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
4604
+ }
4605
+ const fromSeed = getValueByPath(fromObject, ['seed']);
4606
+ if (parentObject !== undefined && fromSeed != null) {
4607
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
4608
+ }
4609
+ const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
4610
+ if (parentObject !== undefined && fromSpeechConfig != null) {
4611
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], fromSpeechConfig);
4612
+ }
4613
+ const fromSystemInstruction = getValueByPath(fromObject, [
4614
+ 'systemInstruction',
4615
+ ]);
4616
+ if (parentObject !== undefined && fromSystemInstruction != null) {
4617
+ setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
4618
+ }
4619
+ const fromTools = getValueByPath(fromObject, ['tools']);
4620
+ if (parentObject !== undefined && fromTools != null) {
4621
+ if (Array.isArray(fromTools)) {
4622
+ setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4623
+ return toolToVertex$1(apiClient, tTool(apiClient, item));
4624
+ })));
4625
+ }
4626
+ else {
4627
+ setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
4628
+ }
4629
+ }
4630
+ const fromSessionResumption = getValueByPath(fromObject, [
4631
+ 'sessionResumption',
4632
+ ]);
4633
+ if (parentObject !== undefined && fromSessionResumption != null) {
4634
+ setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToVertex(apiClient, fromSessionResumption));
4635
+ }
4636
+ const fromInputAudioTranscription = getValueByPath(fromObject, [
4637
+ 'inputAudioTranscription',
4638
+ ]);
4639
+ if (parentObject !== undefined && fromInputAudioTranscription != null) {
4640
+ setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToVertex());
4641
+ }
4642
+ const fromOutputAudioTranscription = getValueByPath(fromObject, [
4643
+ 'outputAudioTranscription',
4644
+ ]);
4645
+ if (parentObject !== undefined && fromOutputAudioTranscription != null) {
4646
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToVertex());
4647
+ }
4648
+ const fromRealtimeInputConfig = getValueByPath(fromObject, [
4649
+ 'realtimeInputConfig',
4650
+ ]);
4651
+ if (parentObject !== undefined && fromRealtimeInputConfig != null) {
4652
+ setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToVertex(apiClient, fromRealtimeInputConfig));
4653
+ }
4654
+ const fromContextWindowCompression = getValueByPath(fromObject, [
4655
+ 'contextWindowCompression',
4656
+ ]);
4657
+ if (parentObject !== undefined && fromContextWindowCompression != null) {
4658
+ setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToVertex(apiClient, fromContextWindowCompression));
4659
+ }
4660
+ return toObject;
4661
+ }
4662
+ function liveConnectParametersToMldev(apiClient, fromObject) {
4663
+ const toObject = {};
4664
+ const fromModel = getValueByPath(fromObject, ['model']);
4665
+ if (fromModel != null) {
4666
+ setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
4667
+ }
4668
+ const fromConfig = getValueByPath(fromObject, ['config']);
4669
+ if (fromConfig != null) {
4670
+ setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
4671
+ }
4672
+ return toObject;
4673
+ }
4674
+ function liveConnectParametersToVertex(apiClient, fromObject) {
4675
+ const toObject = {};
4676
+ const fromModel = getValueByPath(fromObject, ['model']);
4677
+ if (fromModel != null) {
4678
+ setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
4679
+ }
4680
+ const fromConfig = getValueByPath(fromObject, ['config']);
4681
+ if (fromConfig != null) {
4682
+ setValueByPath(toObject, ['config'], liveConnectConfigToVertex(apiClient, fromConfig, toObject));
4683
+ }
4684
+ return toObject;
4685
+ }
4686
+ function liveServerSetupCompleteFromMldev() {
4687
+ const toObject = {};
4688
+ return toObject;
4689
+ }
4690
+ function liveServerSetupCompleteFromVertex() {
4691
+ const toObject = {};
4692
+ return toObject;
4693
+ }
4694
+ function partFromMldev$1(apiClient, fromObject) {
4695
+ const toObject = {};
4696
+ const fromThought = getValueByPath(fromObject, ['thought']);
4697
+ if (fromThought != null) {
4698
+ setValueByPath(toObject, ['thought'], fromThought);
4699
+ }
4700
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
4701
+ 'codeExecutionResult',
4702
+ ]);
4703
+ if (fromCodeExecutionResult != null) {
4704
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
4705
+ }
4706
+ const fromExecutableCode = getValueByPath(fromObject, [
4707
+ 'executableCode',
4708
+ ]);
4709
+ if (fromExecutableCode != null) {
4710
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4711
+ }
4712
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
4713
+ if (fromFileData != null) {
4714
+ setValueByPath(toObject, ['fileData'], fromFileData);
4715
+ }
4716
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4717
+ if (fromFunctionCall != null) {
4718
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4719
+ }
4720
+ const fromFunctionResponse = getValueByPath(fromObject, [
4721
+ 'functionResponse',
4722
+ ]);
4723
+ if (fromFunctionResponse != null) {
4724
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4725
+ }
4726
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4727
+ if (fromInlineData != null) {
4728
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
4729
+ }
4730
+ const fromText = getValueByPath(fromObject, ['text']);
4731
+ if (fromText != null) {
4732
+ setValueByPath(toObject, ['text'], fromText);
4733
+ }
4734
+ return toObject;
4735
+ }
4736
+ function partFromVertex$1(apiClient, fromObject) {
4737
+ const toObject = {};
4738
+ const fromVideoMetadata = getValueByPath(fromObject, [
4739
+ 'videoMetadata',
4740
+ ]);
4741
+ if (fromVideoMetadata != null) {
4742
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4743
+ }
4744
+ const fromThought = getValueByPath(fromObject, ['thought']);
4745
+ if (fromThought != null) {
4746
+ setValueByPath(toObject, ['thought'], fromThought);
4747
+ }
4748
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
4749
+ 'codeExecutionResult',
4750
+ ]);
4751
+ if (fromCodeExecutionResult != null) {
4752
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
4753
+ }
4754
+ const fromExecutableCode = getValueByPath(fromObject, [
4755
+ 'executableCode',
4756
+ ]);
4757
+ if (fromExecutableCode != null) {
4758
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4759
+ }
4760
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
4761
+ if (fromFileData != null) {
4762
+ setValueByPath(toObject, ['fileData'], fromFileData);
4763
+ }
4764
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4765
+ if (fromFunctionCall != null) {
4766
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4767
+ }
4768
+ const fromFunctionResponse = getValueByPath(fromObject, [
4769
+ 'functionResponse',
4770
+ ]);
4771
+ if (fromFunctionResponse != null) {
4772
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4773
+ }
4774
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4775
+ if (fromInlineData != null) {
4776
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
4777
+ }
4778
+ const fromText = getValueByPath(fromObject, ['text']);
4779
+ if (fromText != null) {
4780
+ setValueByPath(toObject, ['text'], fromText);
4781
+ }
4782
+ return toObject;
4783
+ }
4784
+ function contentFromMldev$1(apiClient, fromObject) {
4785
+ const toObject = {};
4786
+ const fromParts = getValueByPath(fromObject, ['parts']);
4787
+ if (fromParts != null) {
4788
+ if (Array.isArray(fromParts)) {
4789
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4790
+ return partFromMldev$1(apiClient, item);
4791
+ }));
4792
+ }
4793
+ else {
4794
+ setValueByPath(toObject, ['parts'], fromParts);
4795
+ }
4796
+ }
4797
+ const fromRole = getValueByPath(fromObject, ['role']);
4798
+ if (fromRole != null) {
4799
+ setValueByPath(toObject, ['role'], fromRole);
4800
+ }
4801
+ return toObject;
4802
+ }
4803
+ function contentFromVertex$1(apiClient, fromObject) {
4804
+ const toObject = {};
4805
+ const fromParts = getValueByPath(fromObject, ['parts']);
4806
+ if (fromParts != null) {
4807
+ if (Array.isArray(fromParts)) {
4808
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4809
+ return partFromVertex$1(apiClient, item);
4810
+ }));
4811
+ }
4812
+ else {
4813
+ setValueByPath(toObject, ['parts'], fromParts);
4814
+ }
4815
+ }
4816
+ const fromRole = getValueByPath(fromObject, ['role']);
4817
+ if (fromRole != null) {
4818
+ setValueByPath(toObject, ['role'], fromRole);
4819
+ }
4820
+ return toObject;
4821
+ }
4822
+ function transcriptionFromMldev(apiClient, fromObject) {
4823
+ const toObject = {};
4824
+ const fromText = getValueByPath(fromObject, ['text']);
4825
+ if (fromText != null) {
4826
+ setValueByPath(toObject, ['text'], fromText);
4827
+ }
4828
+ const fromFinished = getValueByPath(fromObject, ['finished']);
4829
+ if (fromFinished != null) {
4830
+ setValueByPath(toObject, ['finished'], fromFinished);
4831
+ }
4832
+ return toObject;
4833
+ }
4834
+ function transcriptionFromVertex(apiClient, fromObject) {
4835
+ const toObject = {};
4836
+ const fromText = getValueByPath(fromObject, ['text']);
4837
+ if (fromText != null) {
4838
+ setValueByPath(toObject, ['text'], fromText);
4839
+ }
4840
+ const fromFinished = getValueByPath(fromObject, ['finished']);
4841
+ if (fromFinished != null) {
4842
+ setValueByPath(toObject, ['finished'], fromFinished);
4843
+ }
4844
+ return toObject;
4845
+ }
4846
+ function liveServerContentFromMldev(apiClient, fromObject) {
4847
+ const toObject = {};
4848
+ const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
4849
+ if (fromModelTurn != null) {
4850
+ setValueByPath(toObject, ['modelTurn'], contentFromMldev$1(apiClient, fromModelTurn));
4851
+ }
4852
+ const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
4853
+ if (fromTurnComplete != null) {
4854
+ setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
4855
+ }
4856
+ const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
4857
+ if (fromInterrupted != null) {
4858
+ setValueByPath(toObject, ['interrupted'], fromInterrupted);
4859
+ }
4860
+ const fromGenerationComplete = getValueByPath(fromObject, [
4861
+ 'generationComplete',
4862
+ ]);
4863
+ if (fromGenerationComplete != null) {
4864
+ setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
4865
+ }
4866
+ const fromInputTranscription = getValueByPath(fromObject, [
4867
+ 'inputTranscription',
4868
+ ]);
4869
+ if (fromInputTranscription != null) {
4870
+ setValueByPath(toObject, ['inputTranscription'], transcriptionFromMldev(apiClient, fromInputTranscription));
4871
+ }
4872
+ const fromOutputTranscription = getValueByPath(fromObject, [
4873
+ 'outputTranscription',
4874
+ ]);
4875
+ if (fromOutputTranscription != null) {
4876
+ setValueByPath(toObject, ['outputTranscription'], transcriptionFromMldev(apiClient, fromOutputTranscription));
4877
+ }
4878
+ return toObject;
4879
+ }
4880
+ function liveServerContentFromVertex(apiClient, fromObject) {
4881
+ const toObject = {};
4882
+ const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
4883
+ if (fromModelTurn != null) {
4884
+ setValueByPath(toObject, ['modelTurn'], contentFromVertex$1(apiClient, fromModelTurn));
4885
+ }
4886
+ const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
4887
+ if (fromTurnComplete != null) {
4888
+ setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
4889
+ }
4890
+ const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
4891
+ if (fromInterrupted != null) {
4892
+ setValueByPath(toObject, ['interrupted'], fromInterrupted);
4893
+ }
4894
+ const fromGenerationComplete = getValueByPath(fromObject, [
4895
+ 'generationComplete',
4896
+ ]);
4897
+ if (fromGenerationComplete != null) {
4898
+ setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
4899
+ }
4900
+ const fromInputTranscription = getValueByPath(fromObject, [
4901
+ 'inputTranscription',
4902
+ ]);
4903
+ if (fromInputTranscription != null) {
4904
+ setValueByPath(toObject, ['inputTranscription'], transcriptionFromVertex(apiClient, fromInputTranscription));
4905
+ }
4906
+ const fromOutputTranscription = getValueByPath(fromObject, [
4907
+ 'outputTranscription',
4908
+ ]);
4909
+ if (fromOutputTranscription != null) {
4910
+ setValueByPath(toObject, ['outputTranscription'], transcriptionFromVertex(apiClient, fromOutputTranscription));
4911
+ }
4912
+ return toObject;
4913
+ }
4914
+ function functionCallFromMldev(apiClient, fromObject) {
4915
+ const toObject = {};
4916
+ const fromId = getValueByPath(fromObject, ['id']);
4917
+ if (fromId != null) {
4918
+ setValueByPath(toObject, ['id'], fromId);
4919
+ }
4920
+ const fromArgs = getValueByPath(fromObject, ['args']);
4921
+ if (fromArgs != null) {
4922
+ setValueByPath(toObject, ['args'], fromArgs);
4923
+ }
4924
+ const fromName = getValueByPath(fromObject, ['name']);
4925
+ if (fromName != null) {
4926
+ setValueByPath(toObject, ['name'], fromName);
4927
+ }
4928
+ return toObject;
4929
+ }
4930
+ function functionCallFromVertex(apiClient, fromObject) {
4931
+ const toObject = {};
4932
+ const fromArgs = getValueByPath(fromObject, ['args']);
4933
+ if (fromArgs != null) {
4934
+ setValueByPath(toObject, ['args'], fromArgs);
4935
+ }
4936
+ const fromName = getValueByPath(fromObject, ['name']);
4937
+ if (fromName != null) {
4938
+ setValueByPath(toObject, ['name'], fromName);
4939
+ }
4940
+ return toObject;
4941
+ }
4942
+ function liveServerToolCallFromMldev(apiClient, fromObject) {
4943
+ const toObject = {};
4944
+ const fromFunctionCalls = getValueByPath(fromObject, [
4945
+ 'functionCalls',
4946
+ ]);
4947
+ if (fromFunctionCalls != null) {
4948
+ if (Array.isArray(fromFunctionCalls)) {
4949
+ setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4950
+ return functionCallFromMldev(apiClient, item);
4951
+ }));
4952
+ }
4953
+ else {
4954
+ setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4955
+ }
4956
+ }
4957
+ return toObject;
4958
+ }
4959
+ function liveServerToolCallFromVertex(apiClient, fromObject) {
4960
+ const toObject = {};
4961
+ const fromFunctionCalls = getValueByPath(fromObject, [
4962
+ 'functionCalls',
4963
+ ]);
4964
+ if (fromFunctionCalls != null) {
4965
+ if (Array.isArray(fromFunctionCalls)) {
4966
+ setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4967
+ return functionCallFromVertex(apiClient, item);
4968
+ }));
4969
+ }
4970
+ else {
4971
+ setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4972
+ }
4973
+ }
4974
+ return toObject;
4975
+ }
4976
+ function liveServerToolCallCancellationFromMldev(apiClient, fromObject) {
4977
+ const toObject = {};
4978
+ const fromIds = getValueByPath(fromObject, ['ids']);
4979
+ if (fromIds != null) {
4980
+ setValueByPath(toObject, ['ids'], fromIds);
4981
+ }
4982
+ return toObject;
4983
+ }
4984
+ function liveServerToolCallCancellationFromVertex(apiClient, fromObject) {
4985
+ const toObject = {};
4986
+ const fromIds = getValueByPath(fromObject, ['ids']);
4987
+ if (fromIds != null) {
4988
+ setValueByPath(toObject, ['ids'], fromIds);
4989
+ }
4990
+ return toObject;
4991
+ }
4992
+ function modalityTokenCountFromMldev(apiClient, fromObject) {
4993
+ const toObject = {};
4994
+ const fromModality = getValueByPath(fromObject, ['modality']);
4995
+ if (fromModality != null) {
4996
+ setValueByPath(toObject, ['modality'], fromModality);
4997
+ }
4998
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
4999
+ if (fromTokenCount != null) {
5000
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
5001
+ }
5002
+ return toObject;
5003
+ }
5004
+ function modalityTokenCountFromVertex(apiClient, fromObject) {
5005
+ const toObject = {};
5006
+ const fromModality = getValueByPath(fromObject, ['modality']);
5007
+ if (fromModality != null) {
5008
+ setValueByPath(toObject, ['modality'], fromModality);
5009
+ }
5010
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
5011
+ if (fromTokenCount != null) {
5012
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
5013
+ }
5014
+ return toObject;
5015
+ }
5016
+ function usageMetadataFromMldev(apiClient, fromObject) {
5017
+ const toObject = {};
5018
+ const fromPromptTokenCount = getValueByPath(fromObject, [
5019
+ 'promptTokenCount',
5020
+ ]);
5021
+ if (fromPromptTokenCount != null) {
5022
+ setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
5023
+ }
5024
+ const fromCachedContentTokenCount = getValueByPath(fromObject, [
5025
+ 'cachedContentTokenCount',
5026
+ ]);
5027
+ if (fromCachedContentTokenCount != null) {
5028
+ setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
5029
+ }
5030
+ const fromResponseTokenCount = getValueByPath(fromObject, [
5031
+ 'responseTokenCount',
5032
+ ]);
5033
+ if (fromResponseTokenCount != null) {
5034
+ setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
5035
+ }
5036
+ const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
5037
+ 'toolUsePromptTokenCount',
5038
+ ]);
5039
+ if (fromToolUsePromptTokenCount != null) {
5040
+ setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
5041
+ }
5042
+ const fromThoughtsTokenCount = getValueByPath(fromObject, [
5043
+ 'thoughtsTokenCount',
5044
+ ]);
5045
+ if (fromThoughtsTokenCount != null) {
5046
+ setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
5047
+ }
5048
+ const fromTotalTokenCount = getValueByPath(fromObject, [
5049
+ 'totalTokenCount',
5050
+ ]);
5051
+ if (fromTotalTokenCount != null) {
5052
+ setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
5053
+ }
5054
+ const fromPromptTokensDetails = getValueByPath(fromObject, [
5055
+ 'promptTokensDetails',
5056
+ ]);
5057
+ if (fromPromptTokensDetails != null) {
5058
+ if (Array.isArray(fromPromptTokensDetails)) {
5059
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
5060
+ return modalityTokenCountFromMldev(apiClient, item);
5061
+ }));
5062
+ }
5063
+ else {
5064
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
5065
+ }
5066
+ }
5067
+ const fromCacheTokensDetails = getValueByPath(fromObject, [
5068
+ 'cacheTokensDetails',
5069
+ ]);
5070
+ if (fromCacheTokensDetails != null) {
5071
+ if (Array.isArray(fromCacheTokensDetails)) {
5072
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
5073
+ return modalityTokenCountFromMldev(apiClient, item);
5074
+ }));
5075
+ }
5076
+ else {
5077
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
5078
+ }
5079
+ }
5080
+ const fromResponseTokensDetails = getValueByPath(fromObject, [
5081
+ 'responseTokensDetails',
5082
+ ]);
5083
+ if (fromResponseTokensDetails != null) {
5084
+ if (Array.isArray(fromResponseTokensDetails)) {
5085
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
5086
+ return modalityTokenCountFromMldev(apiClient, item);
5087
+ }));
5088
+ }
5089
+ else {
5090
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
5091
+ }
5092
+ }
5093
+ const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
5094
+ 'toolUsePromptTokensDetails',
5095
+ ]);
5096
+ if (fromToolUsePromptTokensDetails != null) {
5097
+ if (Array.isArray(fromToolUsePromptTokensDetails)) {
5098
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
5099
+ return modalityTokenCountFromMldev(apiClient, item);
5100
+ }));
5101
+ }
5102
+ else {
5103
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
5104
+ }
5105
+ }
5106
+ return toObject;
5107
+ }
5108
+ function usageMetadataFromVertex(apiClient, fromObject) {
5109
+ const toObject = {};
5110
+ const fromPromptTokenCount = getValueByPath(fromObject, [
5111
+ 'promptTokenCount',
5112
+ ]);
5113
+ if (fromPromptTokenCount != null) {
5114
+ setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
5115
+ }
5116
+ const fromCachedContentTokenCount = getValueByPath(fromObject, [
5117
+ 'cachedContentTokenCount',
5118
+ ]);
5119
+ if (fromCachedContentTokenCount != null) {
5120
+ setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
5121
+ }
5122
+ const fromResponseTokenCount = getValueByPath(fromObject, [
5123
+ 'candidatesTokenCount',
5124
+ ]);
5125
+ if (fromResponseTokenCount != null) {
5126
+ setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
5127
+ }
5128
+ const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
5129
+ 'toolUsePromptTokenCount',
5130
+ ]);
5131
+ if (fromToolUsePromptTokenCount != null) {
5132
+ setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
5133
+ }
5134
+ const fromThoughtsTokenCount = getValueByPath(fromObject, [
5135
+ 'thoughtsTokenCount',
5136
+ ]);
5137
+ if (fromThoughtsTokenCount != null) {
5138
+ setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
5139
+ }
5140
+ const fromTotalTokenCount = getValueByPath(fromObject, [
5141
+ 'totalTokenCount',
5142
+ ]);
5143
+ if (fromTotalTokenCount != null) {
5144
+ setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
5145
+ }
5146
+ const fromPromptTokensDetails = getValueByPath(fromObject, [
5147
+ 'promptTokensDetails',
5148
+ ]);
5149
+ if (fromPromptTokensDetails != null) {
5150
+ if (Array.isArray(fromPromptTokensDetails)) {
5151
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
5152
+ return modalityTokenCountFromVertex(apiClient, item);
5153
+ }));
5154
+ }
5155
+ else {
5156
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
5157
+ }
5158
+ }
5159
+ const fromCacheTokensDetails = getValueByPath(fromObject, [
5160
+ 'cacheTokensDetails',
5161
+ ]);
5162
+ if (fromCacheTokensDetails != null) {
5163
+ if (Array.isArray(fromCacheTokensDetails)) {
5164
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
5165
+ return modalityTokenCountFromVertex(apiClient, item);
5166
+ }));
5167
+ }
5168
+ else {
5169
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
5170
+ }
5171
+ }
5172
+ const fromResponseTokensDetails = getValueByPath(fromObject, [
5173
+ 'candidatesTokensDetails',
5174
+ ]);
5175
+ if (fromResponseTokensDetails != null) {
5176
+ if (Array.isArray(fromResponseTokensDetails)) {
5177
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
5178
+ return modalityTokenCountFromVertex(apiClient, item);
5179
+ }));
5180
+ }
5181
+ else {
5182
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
5183
+ }
5184
+ }
5185
+ const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
5186
+ 'toolUsePromptTokensDetails',
5187
+ ]);
5188
+ if (fromToolUsePromptTokensDetails != null) {
5189
+ if (Array.isArray(fromToolUsePromptTokensDetails)) {
5190
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
5191
+ return modalityTokenCountFromVertex(apiClient, item);
5192
+ }));
5193
+ }
5194
+ else {
5195
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
5196
+ }
5197
+ }
5198
+ const fromTrafficType = getValueByPath(fromObject, ['trafficType']);
5199
+ if (fromTrafficType != null) {
5200
+ setValueByPath(toObject, ['trafficType'], fromTrafficType);
5201
+ }
5202
+ return toObject;
5203
+ }
5204
+ function liveServerGoAwayFromMldev(apiClient, fromObject) {
5205
+ const toObject = {};
5206
+ const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
5207
+ if (fromTimeLeft != null) {
5208
+ setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
5209
+ }
5210
+ return toObject;
5211
+ }
5212
+ function liveServerGoAwayFromVertex(apiClient, fromObject) {
5213
+ const toObject = {};
5214
+ const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
5215
+ if (fromTimeLeft != null) {
5216
+ setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
5217
+ }
5218
+ return toObject;
5219
+ }
5220
+ function liveServerSessionResumptionUpdateFromMldev(apiClient, fromObject) {
5221
+ const toObject = {};
5222
+ const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
5223
+ if (fromNewHandle != null) {
5224
+ setValueByPath(toObject, ['newHandle'], fromNewHandle);
5225
+ }
5226
+ const fromResumable = getValueByPath(fromObject, ['resumable']);
5227
+ if (fromResumable != null) {
5228
+ setValueByPath(toObject, ['resumable'], fromResumable);
5229
+ }
5230
+ const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
5231
+ 'lastConsumedClientMessageIndex',
5232
+ ]);
5233
+ if (fromLastConsumedClientMessageIndex != null) {
5234
+ setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
5235
+ }
5236
+ return toObject;
5237
+ }
5238
+ function liveServerSessionResumptionUpdateFromVertex(apiClient, fromObject) {
5239
+ const toObject = {};
5240
+ const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
5241
+ if (fromNewHandle != null) {
5242
+ setValueByPath(toObject, ['newHandle'], fromNewHandle);
5243
+ }
5244
+ const fromResumable = getValueByPath(fromObject, ['resumable']);
5245
+ if (fromResumable != null) {
5246
+ setValueByPath(toObject, ['resumable'], fromResumable);
5247
+ }
5248
+ const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
5249
+ 'lastConsumedClientMessageIndex',
5250
+ ]);
5251
+ if (fromLastConsumedClientMessageIndex != null) {
5252
+ setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
5253
+ }
5254
+ return toObject;
5255
+ }
5256
+ function liveServerMessageFromMldev(apiClient, fromObject) {
5257
+ const toObject = {};
5258
+ const fromSetupComplete = getValueByPath(fromObject, [
5259
+ 'setupComplete',
5260
+ ]);
5261
+ if (fromSetupComplete != null) {
5262
+ setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromMldev());
5263
+ }
5264
+ const fromServerContent = getValueByPath(fromObject, [
5265
+ 'serverContent',
5266
+ ]);
5267
+ if (fromServerContent != null) {
5268
+ setValueByPath(toObject, ['serverContent'], liveServerContentFromMldev(apiClient, fromServerContent));
5269
+ }
5270
+ const fromToolCall = getValueByPath(fromObject, ['toolCall']);
5271
+ if (fromToolCall != null) {
5272
+ setValueByPath(toObject, ['toolCall'], liveServerToolCallFromMldev(apiClient, fromToolCall));
5273
+ }
5274
+ const fromToolCallCancellation = getValueByPath(fromObject, [
5275
+ 'toolCallCancellation',
5276
+ ]);
5277
+ if (fromToolCallCancellation != null) {
5278
+ setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromMldev(apiClient, fromToolCallCancellation));
5279
+ }
5280
+ const fromUsageMetadata = getValueByPath(fromObject, [
5281
+ 'usageMetadata',
5282
+ ]);
5283
+ if (fromUsageMetadata != null) {
5284
+ setValueByPath(toObject, ['usageMetadata'], usageMetadataFromMldev(apiClient, fromUsageMetadata));
5285
+ }
5286
+ const fromGoAway = getValueByPath(fromObject, ['goAway']);
5287
+ if (fromGoAway != null) {
5288
+ setValueByPath(toObject, ['goAway'], liveServerGoAwayFromMldev(apiClient, fromGoAway));
5289
+ }
5290
+ const fromSessionResumptionUpdate = getValueByPath(fromObject, [
5291
+ 'sessionResumptionUpdate',
5292
+ ]);
5293
+ if (fromSessionResumptionUpdate != null) {
5294
+ setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromMldev(apiClient, fromSessionResumptionUpdate));
5295
+ }
5296
+ return toObject;
5297
+ }
5298
+ function liveServerMessageFromVertex(apiClient, fromObject) {
5299
+ const toObject = {};
5300
+ const fromSetupComplete = getValueByPath(fromObject, [
5301
+ 'setupComplete',
5302
+ ]);
5303
+ if (fromSetupComplete != null) {
5304
+ setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex());
5305
+ }
5306
+ const fromServerContent = getValueByPath(fromObject, [
5307
+ 'serverContent',
5308
+ ]);
5309
+ if (fromServerContent != null) {
5310
+ setValueByPath(toObject, ['serverContent'], liveServerContentFromVertex(apiClient, fromServerContent));
5311
+ }
5312
+ const fromToolCall = getValueByPath(fromObject, ['toolCall']);
5313
+ if (fromToolCall != null) {
5314
+ setValueByPath(toObject, ['toolCall'], liveServerToolCallFromVertex(apiClient, fromToolCall));
5315
+ }
5316
+ const fromToolCallCancellation = getValueByPath(fromObject, [
5317
+ 'toolCallCancellation',
5318
+ ]);
5319
+ if (fromToolCallCancellation != null) {
5320
+ setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromVertex(apiClient, fromToolCallCancellation));
5321
+ }
5322
+ const fromUsageMetadata = getValueByPath(fromObject, [
5323
+ 'usageMetadata',
5324
+ ]);
5325
+ if (fromUsageMetadata != null) {
5326
+ setValueByPath(toObject, ['usageMetadata'], usageMetadataFromVertex(apiClient, fromUsageMetadata));
5327
+ }
5328
+ const fromGoAway = getValueByPath(fromObject, ['goAway']);
5329
+ if (fromGoAway != null) {
5330
+ setValueByPath(toObject, ['goAway'], liveServerGoAwayFromVertex(apiClient, fromGoAway));
5331
+ }
5332
+ const fromSessionResumptionUpdate = getValueByPath(fromObject, [
5333
+ 'sessionResumptionUpdate',
5334
+ ]);
5335
+ if (fromSessionResumptionUpdate != null) {
5336
+ setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromVertex(apiClient, fromSessionResumptionUpdate));
5337
+ }
5338
+ return toObject;
5339
+ }
5340
+
5341
+ /**
5342
+ * @license
5343
+ * Copyright 2025 Google LLC
5344
+ * SPDX-License-Identifier: Apache-2.0
5345
+ */
5346
+ function partToMldev(apiClient, fromObject) {
5347
+ const toObject = {};
5348
+ if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
5349
+ throw new Error('videoMetadata parameter is not supported in Gemini API.');
5350
+ }
5351
+ const fromThought = getValueByPath(fromObject, ['thought']);
5352
+ if (fromThought != null) {
5353
+ setValueByPath(toObject, ['thought'], fromThought);
5354
+ }
5355
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
5356
+ 'codeExecutionResult',
5357
+ ]);
5358
+ if (fromCodeExecutionResult != null) {
5359
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
5360
+ }
5361
+ const fromExecutableCode = getValueByPath(fromObject, [
5362
+ 'executableCode',
5363
+ ]);
5364
+ if (fromExecutableCode != null) {
5365
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5366
+ }
5367
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5368
+ if (fromFileData != null) {
5369
+ setValueByPath(toObject, ['fileData'], fromFileData);
5370
+ }
5371
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5372
+ if (fromFunctionCall != null) {
5373
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5374
+ }
5375
+ const fromFunctionResponse = getValueByPath(fromObject, [
5376
+ 'functionResponse',
5377
+ ]);
5378
+ if (fromFunctionResponse != null) {
5379
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
5380
+ }
5381
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5382
+ if (fromInlineData != null) {
5383
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
5384
+ }
5385
+ const fromText = getValueByPath(fromObject, ['text']);
5386
+ if (fromText != null) {
5387
+ setValueByPath(toObject, ['text'], fromText);
5388
+ }
5389
+ return toObject;
5390
+ }
5391
+ function contentToMldev(apiClient, fromObject) {
5392
+ const toObject = {};
5393
+ const fromParts = getValueByPath(fromObject, ['parts']);
5394
+ if (fromParts != null) {
5395
+ if (Array.isArray(fromParts)) {
5396
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
5397
+ return partToMldev(apiClient, item);
5398
+ }));
5399
+ }
5400
+ else {
5401
+ setValueByPath(toObject, ['parts'], fromParts);
5402
+ }
5403
+ }
5404
+ const fromRole = getValueByPath(fromObject, ['role']);
5405
+ if (fromRole != null) {
5406
+ setValueByPath(toObject, ['role'], fromRole);
5407
+ }
5408
+ return toObject;
5409
+ }
5410
+ function schemaToMldev(apiClient, fromObject) {
5411
+ const toObject = {};
5412
+ if (getValueByPath(fromObject, ['example']) !== undefined) {
5413
+ throw new Error('example parameter is not supported in Gemini API.');
5414
+ }
5415
+ if (getValueByPath(fromObject, ['pattern']) !== undefined) {
5416
+ throw new Error('pattern parameter is not supported in Gemini API.');
5417
+ }
5418
+ if (getValueByPath(fromObject, ['default']) !== undefined) {
5419
+ throw new Error('default parameter is not supported in Gemini API.');
5420
+ }
5421
+ if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
5422
+ throw new Error('maxLength parameter is not supported in Gemini API.');
5423
+ }
5424
+ if (getValueByPath(fromObject, ['minLength']) !== undefined) {
5425
+ throw new Error('minLength parameter is not supported in Gemini API.');
5426
+ }
5427
+ if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
5428
+ throw new Error('minProperties parameter is not supported in Gemini API.');
5429
+ }
5430
+ if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
5431
+ throw new Error('maxProperties parameter is not supported in Gemini API.');
5432
+ }
5433
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
5434
+ if (fromAnyOf != null) {
5435
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
5436
+ }
5437
+ const fromDescription = getValueByPath(fromObject, ['description']);
5438
+ if (fromDescription != null) {
5439
+ setValueByPath(toObject, ['description'], fromDescription);
5440
+ }
5441
+ const fromEnum = getValueByPath(fromObject, ['enum']);
5442
+ if (fromEnum != null) {
5443
+ setValueByPath(toObject, ['enum'], fromEnum);
5444
+ }
5445
+ const fromFormat = getValueByPath(fromObject, ['format']);
5446
+ if (fromFormat != null) {
5447
+ setValueByPath(toObject, ['format'], fromFormat);
5448
+ }
5449
+ const fromItems = getValueByPath(fromObject, ['items']);
5450
+ if (fromItems != null) {
5451
+ setValueByPath(toObject, ['items'], fromItems);
5452
+ }
5453
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
5454
+ if (fromMaxItems != null) {
5455
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
5456
+ }
5457
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
5458
+ if (fromMaximum != null) {
5459
+ setValueByPath(toObject, ['maximum'], fromMaximum);
5460
+ }
5461
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
5462
+ if (fromMinItems != null) {
5463
+ setValueByPath(toObject, ['minItems'], fromMinItems);
5464
+ }
5465
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
5466
+ if (fromMinimum != null) {
5467
+ setValueByPath(toObject, ['minimum'], fromMinimum);
5468
+ }
5469
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
5470
+ if (fromNullable != null) {
5471
+ setValueByPath(toObject, ['nullable'], fromNullable);
5472
+ }
5473
+ const fromProperties = getValueByPath(fromObject, ['properties']);
5474
+ if (fromProperties != null) {
5475
+ setValueByPath(toObject, ['properties'], fromProperties);
5476
+ }
5477
+ const fromPropertyOrdering = getValueByPath(fromObject, [
5478
+ 'propertyOrdering',
5479
+ ]);
5480
+ if (fromPropertyOrdering != null) {
5481
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
5482
+ }
5483
+ const fromRequired = getValueByPath(fromObject, ['required']);
5484
+ if (fromRequired != null) {
5485
+ setValueByPath(toObject, ['required'], fromRequired);
5486
+ }
5487
+ const fromTitle = getValueByPath(fromObject, ['title']);
5488
+ if (fromTitle != null) {
5489
+ setValueByPath(toObject, ['title'], fromTitle);
5490
+ }
5491
+ const fromType = getValueByPath(fromObject, ['type']);
5492
+ if (fromType != null) {
5493
+ setValueByPath(toObject, ['type'], fromType);
5494
+ }
5495
+ return toObject;
5496
+ }
5497
+ function safetySettingToMldev(apiClient, fromObject) {
5498
+ const toObject = {};
5499
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
5500
+ throw new Error('method parameter is not supported in Gemini API.');
5501
+ }
5502
+ const fromCategory = getValueByPath(fromObject, ['category']);
5503
+ if (fromCategory != null) {
5504
+ setValueByPath(toObject, ['category'], fromCategory);
5505
+ }
5506
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
5507
+ if (fromThreshold != null) {
5508
+ setValueByPath(toObject, ['threshold'], fromThreshold);
5509
+ }
5510
+ return toObject;
5511
+ }
5512
+ function functionDeclarationToMldev(apiClient, fromObject) {
5513
+ const toObject = {};
5514
+ if (getValueByPath(fromObject, ['response']) !== undefined) {
5515
+ throw new Error('response parameter is not supported in Gemini API.');
5516
+ }
5517
+ const fromDescription = getValueByPath(fromObject, ['description']);
5518
+ if (fromDescription != null) {
5519
+ setValueByPath(toObject, ['description'], fromDescription);
5520
+ }
5521
+ const fromName = getValueByPath(fromObject, ['name']);
5522
+ if (fromName != null) {
5523
+ setValueByPath(toObject, ['name'], fromName);
5524
+ }
5525
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
5526
+ if (fromParameters != null) {
5527
+ setValueByPath(toObject, ['parameters'], fromParameters);
5528
+ }
5529
+ return toObject;
5530
+ }
5531
+ function googleSearchToMldev() {
5532
+ const toObject = {};
5533
+ return toObject;
5534
+ }
5535
+ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
5536
+ const toObject = {};
5537
+ const fromMode = getValueByPath(fromObject, ['mode']);
5538
+ if (fromMode != null) {
5539
+ setValueByPath(toObject, ['mode'], fromMode);
5540
+ }
5541
+ const fromDynamicThreshold = getValueByPath(fromObject, [
5542
+ 'dynamicThreshold',
5543
+ ]);
5544
+ if (fromDynamicThreshold != null) {
5545
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
5546
+ }
5547
+ return toObject;
5548
+ }
5549
+ function googleSearchRetrievalToMldev(apiClient, fromObject) {
5550
+ const toObject = {};
5551
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
5552
+ 'dynamicRetrievalConfig',
5553
+ ]);
5554
+ if (fromDynamicRetrievalConfig != null) {
5555
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
5556
+ }
4060
5557
  return toObject;
4061
5558
  }
4062
5559
  function toolToMldev(apiClient, fromObject) {
@@ -4143,6 +5640,10 @@ function speechConfigToMldev(apiClient, fromObject) {
4143
5640
  if (fromVoiceConfig != null) {
4144
5641
  setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
4145
5642
  }
5643
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
5644
+ if (fromLanguageCode != null) {
5645
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
5646
+ }
4146
5647
  return toObject;
4147
5648
  }
4148
5649
  function thinkingConfigToMldev(apiClient, fromObject) {
@@ -4153,6 +5654,12 @@ function thinkingConfigToMldev(apiClient, fromObject) {
4153
5654
  if (fromIncludeThoughts != null) {
4154
5655
  setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
4155
5656
  }
5657
+ const fromThinkingBudget = getValueByPath(fromObject, [
5658
+ 'thinkingBudget',
5659
+ ]);
5660
+ if (fromThinkingBudget != null) {
5661
+ setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
5662
+ }
4156
5663
  return toObject;
4157
5664
  }
4158
5665
  function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
@@ -4234,6 +5741,9 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
4234
5741
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
4235
5742
  throw new Error('routingConfig parameter is not supported in Gemini API.');
4236
5743
  }
5744
+ if (getValueByPath(fromObject, ['modelSelectionConfig']) !== undefined) {
5745
+ throw new Error('modelSelectionConfig parameter is not supported in Gemini API.');
5746
+ }
4237
5747
  const fromSafetySettings = getValueByPath(fromObject, [
4238
5748
  'safetySettings',
4239
5749
  ]);
@@ -4456,6 +5966,18 @@ function generateImagesParametersToMldev(apiClient, fromObject) {
4456
5966
  }
4457
5967
  return toObject;
4458
5968
  }
5969
+ function getModelParametersToMldev(apiClient, fromObject) {
5970
+ const toObject = {};
5971
+ const fromModel = getValueByPath(fromObject, ['model']);
5972
+ if (fromModel != null) {
5973
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
5974
+ }
5975
+ const fromConfig = getValueByPath(fromObject, ['config']);
5976
+ if (fromConfig != null) {
5977
+ setValueByPath(toObject, ['config'], fromConfig);
5978
+ }
5979
+ return toObject;
5980
+ }
4459
5981
  function countTokensConfigToMldev(apiClient, fromObject) {
4460
5982
  const toObject = {};
4461
5983
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
@@ -4742,6 +6264,16 @@ function schemaToVertex(apiClient, fromObject) {
4742
6264
  }
4743
6265
  return toObject;
4744
6266
  }
6267
+ function modelSelectionConfigToVertex(apiClient, fromObject) {
6268
+ const toObject = {};
6269
+ const fromFeatureSelectionPreference = getValueByPath(fromObject, [
6270
+ 'featureSelectionPreference',
6271
+ ]);
6272
+ if (fromFeatureSelectionPreference != null) {
6273
+ setValueByPath(toObject, ['featureSelectionPreference'], fromFeatureSelectionPreference);
6274
+ }
6275
+ return toObject;
6276
+ }
4745
6277
  function safetySettingToVertex(apiClient, fromObject) {
4746
6278
  const toObject = {};
4747
6279
  const fromMethod = getValueByPath(fromObject, ['method']);
@@ -4891,6 +6423,10 @@ function speechConfigToVertex(apiClient, fromObject) {
4891
6423
  if (fromVoiceConfig != null) {
4892
6424
  setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(apiClient, fromVoiceConfig));
4893
6425
  }
6426
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
6427
+ if (fromLanguageCode != null) {
6428
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
6429
+ }
4894
6430
  return toObject;
4895
6431
  }
4896
6432
  function thinkingConfigToVertex(apiClient, fromObject) {
@@ -4901,6 +6437,12 @@ function thinkingConfigToVertex(apiClient, fromObject) {
4901
6437
  if (fromIncludeThoughts != null) {
4902
6438
  setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
4903
6439
  }
6440
+ const fromThinkingBudget = getValueByPath(fromObject, [
6441
+ 'thinkingBudget',
6442
+ ]);
6443
+ if (fromThinkingBudget != null) {
6444
+ setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
6445
+ }
4904
6446
  return toObject;
4905
6447
  }
4906
6448
  function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
@@ -4985,6 +6527,12 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
4985
6527
  if (fromRoutingConfig != null) {
4986
6528
  setValueByPath(toObject, ['routingConfig'], fromRoutingConfig);
4987
6529
  }
6530
+ const fromModelSelectionConfig = getValueByPath(fromObject, [
6531
+ 'modelSelectionConfig',
6532
+ ]);
6533
+ if (fromModelSelectionConfig != null) {
6534
+ setValueByPath(toObject, ['modelConfig'], modelSelectionConfigToVertex(apiClient, fromModelSelectionConfig));
6535
+ }
4988
6536
  const fromSafetySettings = getValueByPath(fromObject, [
4989
6537
  'safetySettings',
4990
6538
  ]);
@@ -5218,6 +6766,18 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
5218
6766
  }
5219
6767
  return toObject;
5220
6768
  }
6769
+ function getModelParametersToVertex(apiClient, fromObject) {
6770
+ const toObject = {};
6771
+ const fromModel = getValueByPath(fromObject, ['model']);
6772
+ if (fromModel != null) {
6773
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
6774
+ }
6775
+ const fromConfig = getValueByPath(fromObject, ['config']);
6776
+ if (fromConfig != null) {
6777
+ setValueByPath(toObject, ['config'], fromConfig);
6778
+ }
6779
+ return toObject;
6780
+ }
5221
6781
  function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
5222
6782
  const toObject = {};
5223
6783
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -5641,6 +7201,64 @@ function generateImagesResponseFromMldev(apiClient, fromObject) {
5641
7201
  }
5642
7202
  return toObject;
5643
7203
  }
7204
+ function tunedModelInfoFromMldev(apiClient, fromObject) {
7205
+ const toObject = {};
7206
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
7207
+ if (fromBaseModel != null) {
7208
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
7209
+ }
7210
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
7211
+ if (fromCreateTime != null) {
7212
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
7213
+ }
7214
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
7215
+ if (fromUpdateTime != null) {
7216
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
7217
+ }
7218
+ return toObject;
7219
+ }
7220
+ function modelFromMldev(apiClient, fromObject) {
7221
+ const toObject = {};
7222
+ const fromName = getValueByPath(fromObject, ['name']);
7223
+ if (fromName != null) {
7224
+ setValueByPath(toObject, ['name'], fromName);
7225
+ }
7226
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
7227
+ if (fromDisplayName != null) {
7228
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
7229
+ }
7230
+ const fromDescription = getValueByPath(fromObject, ['description']);
7231
+ if (fromDescription != null) {
7232
+ setValueByPath(toObject, ['description'], fromDescription);
7233
+ }
7234
+ const fromVersion = getValueByPath(fromObject, ['version']);
7235
+ if (fromVersion != null) {
7236
+ setValueByPath(toObject, ['version'], fromVersion);
7237
+ }
7238
+ const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
7239
+ if (fromTunedModelInfo != null) {
7240
+ setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromMldev(apiClient, fromTunedModelInfo));
7241
+ }
7242
+ const fromInputTokenLimit = getValueByPath(fromObject, [
7243
+ 'inputTokenLimit',
7244
+ ]);
7245
+ if (fromInputTokenLimit != null) {
7246
+ setValueByPath(toObject, ['inputTokenLimit'], fromInputTokenLimit);
7247
+ }
7248
+ const fromOutputTokenLimit = getValueByPath(fromObject, [
7249
+ 'outputTokenLimit',
7250
+ ]);
7251
+ if (fromOutputTokenLimit != null) {
7252
+ setValueByPath(toObject, ['outputTokenLimit'], fromOutputTokenLimit);
7253
+ }
7254
+ const fromSupportedActions = getValueByPath(fromObject, [
7255
+ 'supportedGenerationMethods',
7256
+ ]);
7257
+ if (fromSupportedActions != null) {
7258
+ setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
7259
+ }
7260
+ return toObject;
7261
+ }
5644
7262
  function countTokensResponseFromMldev(apiClient, fromObject) {
5645
7263
  const toObject = {};
5646
7264
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -5729,16 +7347,12 @@ function generateVideosOperationFromMldev$1(apiClient, fromObject) {
5729
7347
  if (fromError != null) {
5730
7348
  setValueByPath(toObject, ['error'], fromError);
5731
7349
  }
5732
- const fromResponse = getValueByPath(fromObject, ['response']);
5733
- if (fromResponse != null) {
5734
- setValueByPath(toObject, ['response'], fromResponse);
5735
- }
5736
- const fromResult = getValueByPath(fromObject, [
7350
+ const fromResponse = getValueByPath(fromObject, [
5737
7351
  'response',
5738
7352
  'generateVideoResponse',
5739
7353
  ]);
5740
- if (fromResult != null) {
5741
- setValueByPath(toObject, ['result'], generateVideosResponseFromMldev$1(apiClient, fromResult));
7354
+ if (fromResponse != null) {
7355
+ setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(apiClient, fromResponse));
5742
7356
  }
5743
7357
  return toObject;
5744
7358
  }
@@ -6047,6 +7661,78 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
6047
7661
  }
6048
7662
  return toObject;
6049
7663
  }
7664
+ function endpointFromVertex(apiClient, fromObject) {
7665
+ const toObject = {};
7666
+ const fromName = getValueByPath(fromObject, ['endpoint']);
7667
+ if (fromName != null) {
7668
+ setValueByPath(toObject, ['name'], fromName);
7669
+ }
7670
+ const fromDeployedModelId = getValueByPath(fromObject, [
7671
+ 'deployedModelId',
7672
+ ]);
7673
+ if (fromDeployedModelId != null) {
7674
+ setValueByPath(toObject, ['deployedModelId'], fromDeployedModelId);
7675
+ }
7676
+ return toObject;
7677
+ }
7678
+ function tunedModelInfoFromVertex(apiClient, fromObject) {
7679
+ const toObject = {};
7680
+ const fromBaseModel = getValueByPath(fromObject, [
7681
+ 'labels',
7682
+ 'google-vertex-llm-tuning-base-model-id',
7683
+ ]);
7684
+ if (fromBaseModel != null) {
7685
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
7686
+ }
7687
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
7688
+ if (fromCreateTime != null) {
7689
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
7690
+ }
7691
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
7692
+ if (fromUpdateTime != null) {
7693
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
7694
+ }
7695
+ return toObject;
7696
+ }
7697
+ function modelFromVertex(apiClient, fromObject) {
7698
+ const toObject = {};
7699
+ const fromName = getValueByPath(fromObject, ['name']);
7700
+ if (fromName != null) {
7701
+ setValueByPath(toObject, ['name'], fromName);
7702
+ }
7703
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
7704
+ if (fromDisplayName != null) {
7705
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
7706
+ }
7707
+ const fromDescription = getValueByPath(fromObject, ['description']);
7708
+ if (fromDescription != null) {
7709
+ setValueByPath(toObject, ['description'], fromDescription);
7710
+ }
7711
+ const fromVersion = getValueByPath(fromObject, ['versionId']);
7712
+ if (fromVersion != null) {
7713
+ setValueByPath(toObject, ['version'], fromVersion);
7714
+ }
7715
+ const fromEndpoints = getValueByPath(fromObject, ['deployedModels']);
7716
+ if (fromEndpoints != null) {
7717
+ if (Array.isArray(fromEndpoints)) {
7718
+ setValueByPath(toObject, ['endpoints'], fromEndpoints.map((item) => {
7719
+ return endpointFromVertex(apiClient, item);
7720
+ }));
7721
+ }
7722
+ else {
7723
+ setValueByPath(toObject, ['endpoints'], fromEndpoints);
7724
+ }
7725
+ }
7726
+ const fromLabels = getValueByPath(fromObject, ['labels']);
7727
+ if (fromLabels != null) {
7728
+ setValueByPath(toObject, ['labels'], fromLabels);
7729
+ }
7730
+ const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
7731
+ if (fromTunedModelInfo != null) {
7732
+ setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(apiClient, fromTunedModelInfo));
7733
+ }
7734
+ return toObject;
7735
+ }
6050
7736
  function countTokensResponseFromVertex(apiClient, fromObject) {
6051
7737
  const toObject = {};
6052
7738
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -6136,274 +7822,7 @@ function generateVideosOperationFromVertex$1(apiClient, fromObject) {
6136
7822
  }
6137
7823
  const fromResponse = getValueByPath(fromObject, ['response']);
6138
7824
  if (fromResponse != null) {
6139
- setValueByPath(toObject, ['response'], fromResponse);
6140
- }
6141
- const fromResult = getValueByPath(fromObject, ['response']);
6142
- if (fromResult != null) {
6143
- setValueByPath(toObject, ['result'], generateVideosResponseFromVertex$1(apiClient, fromResult));
6144
- }
6145
- return toObject;
6146
- }
6147
-
6148
- /**
6149
- * @license
6150
- * Copyright 2025 Google LLC
6151
- * SPDX-License-Identifier: Apache-2.0
6152
- */
6153
- /**
6154
- * Converters for live client.
6155
- */
6156
- function liveConnectParametersToMldev(apiClient, fromObject) {
6157
- const toObject = {};
6158
- const fromConfig = getValueByPath(fromObject, ['config']);
6159
- if (fromConfig !== undefined && fromConfig !== null) {
6160
- setValueByPath(toObject, ['setup'], liveConnectConfigToMldev(apiClient, fromConfig));
6161
- }
6162
- const fromModel = getValueByPath(fromObject, ['model']);
6163
- if (fromModel !== undefined) {
6164
- setValueByPath(toObject, ['setup', 'model'], fromModel);
6165
- }
6166
- return toObject;
6167
- }
6168
- function liveConnectParametersToVertex(apiClient, fromObject) {
6169
- const toObject = {};
6170
- const fromConfig = getValueByPath(fromObject, ['config']);
6171
- if (fromConfig !== undefined && fromConfig !== null) {
6172
- setValueByPath(toObject, ['setup'], liveConnectConfigToVertex(apiClient, fromConfig));
6173
- }
6174
- const fromModel = getValueByPath(fromObject, ['model']);
6175
- if (fromModel !== undefined) {
6176
- setValueByPath(toObject, ['setup', 'model'], fromModel);
6177
- }
6178
- return toObject;
6179
- }
6180
- function liveServerMessageFromMldev(apiClient, fromObject) {
6181
- const toObject = {};
6182
- const fromSetupComplete = getValueByPath(fromObject, [
6183
- 'setupComplete',
6184
- ]);
6185
- if (fromSetupComplete !== undefined) {
6186
- setValueByPath(toObject, ['setupComplete'], fromSetupComplete);
6187
- }
6188
- const fromServerContent = getValueByPath(fromObject, [
6189
- 'serverContent',
6190
- ]);
6191
- if (fromServerContent !== undefined && fromServerContent !== null) {
6192
- setValueByPath(toObject, ['serverContent'], liveServerContentFromMldev(apiClient, fromServerContent));
6193
- }
6194
- const fromToolCall = getValueByPath(fromObject, ['toolCall']);
6195
- if (fromToolCall !== undefined && fromToolCall !== null) {
6196
- setValueByPath(toObject, ['toolCall'], liveServerToolCallFromMldev(apiClient, fromToolCall));
6197
- }
6198
- const fromToolCallCancellation = getValueByPath(fromObject, [
6199
- 'toolCallCancellation',
6200
- ]);
6201
- if (fromToolCallCancellation !== undefined &&
6202
- fromToolCallCancellation !== null) {
6203
- setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromMldev(apiClient, fromToolCallCancellation));
6204
- }
6205
- return toObject;
6206
- }
6207
- function liveServerMessageFromVertex(apiClient, fromObject) {
6208
- const toObject = {};
6209
- const fromSetupComplete = getValueByPath(fromObject, [
6210
- 'setupComplete',
6211
- ]);
6212
- if (fromSetupComplete !== undefined) {
6213
- setValueByPath(toObject, ['setupComplete'], fromSetupComplete);
6214
- }
6215
- const fromServerContent = getValueByPath(fromObject, [
6216
- 'serverContent',
6217
- ]);
6218
- if (fromServerContent !== undefined && fromServerContent !== null) {
6219
- setValueByPath(toObject, ['serverContent'], liveServerContentFromVertex(apiClient, fromServerContent));
6220
- }
6221
- const fromToolCall = getValueByPath(fromObject, ['toolCall']);
6222
- if (fromToolCall !== undefined && fromToolCall !== null) {
6223
- setValueByPath(toObject, ['toolCall'], liveServerToolCallFromVertex(apiClient, fromToolCall));
6224
- }
6225
- const fromToolCallCancellation = getValueByPath(fromObject, [
6226
- 'toolCallCancellation',
6227
- ]);
6228
- if (fromToolCallCancellation !== undefined &&
6229
- fromToolCallCancellation !== null) {
6230
- setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromVertex(apiClient, fromToolCallCancellation));
6231
- }
6232
- return toObject;
6233
- }
6234
- function liveConnectConfigToMldev(apiClient, fromObject) {
6235
- const toObject = {};
6236
- const fromGenerationConfig = getValueByPath(fromObject, [
6237
- 'generationConfig',
6238
- ]);
6239
- if (fromGenerationConfig !== undefined) {
6240
- setValueByPath(toObject, ['generationConfig'], fromGenerationConfig);
6241
- }
6242
- const fromResponseModalities = getValueByPath(fromObject, [
6243
- 'responseModalities',
6244
- ]);
6245
- if (fromResponseModalities !== undefined) {
6246
- setValueByPath(toObject, ['generationConfig', 'responseModalities'], fromResponseModalities);
6247
- }
6248
- const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
6249
- if (fromSpeechConfig !== undefined) {
6250
- setValueByPath(toObject, ['generationConfig', 'speechConfig'], fromSpeechConfig);
6251
- }
6252
- const fromSystemInstruction = getValueByPath(fromObject, [
6253
- 'systemInstruction',
6254
- ]);
6255
- if (fromSystemInstruction !== undefined && fromSystemInstruction !== null) {
6256
- setValueByPath(toObject, ['systemInstruction'], contentToMldev(apiClient, fromSystemInstruction));
6257
- }
6258
- const fromTools = getValueByPath(fromObject, ['tools']);
6259
- if (fromTools !== undefined &&
6260
- fromTools !== null &&
6261
- Array.isArray(fromTools)) {
6262
- setValueByPath(toObject, ['tools'], fromTools.map((item) => {
6263
- return toolToMldev(apiClient, item);
6264
- }));
6265
- }
6266
- return toObject;
6267
- }
6268
- function liveConnectConfigToVertex(apiClient, fromObject) {
6269
- const toObject = {};
6270
- const fromGenerationConfig = getValueByPath(fromObject, [
6271
- 'generationConfig',
6272
- ]);
6273
- if (fromGenerationConfig !== undefined) {
6274
- setValueByPath(toObject, ['generationConfig'], fromGenerationConfig);
6275
- }
6276
- const fromResponseModalities = getValueByPath(fromObject, [
6277
- 'responseModalities',
6278
- ]);
6279
- if (fromResponseModalities !== undefined) {
6280
- setValueByPath(toObject, ['generationConfig', 'responseModalities'], fromResponseModalities);
6281
- }
6282
- else {
6283
- // Set default to AUDIO to align with MLDev API.
6284
- setValueByPath(toObject, ['generationConfig', 'responseModalities'], ['AUDIO']);
6285
- }
6286
- const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
6287
- if (fromSpeechConfig !== undefined) {
6288
- setValueByPath(toObject, ['generationConfig', 'speechConfig'], fromSpeechConfig);
6289
- }
6290
- const fromSystemInstruction = getValueByPath(fromObject, [
6291
- 'systemInstruction',
6292
- ]);
6293
- if (fromSystemInstruction !== undefined && fromSystemInstruction !== null) {
6294
- setValueByPath(toObject, ['systemInstruction'], contentToVertex(apiClient, fromSystemInstruction));
6295
- }
6296
- const fromTools = getValueByPath(fromObject, ['tools']);
6297
- if (fromTools !== undefined &&
6298
- fromTools !== null &&
6299
- Array.isArray(fromTools)) {
6300
- setValueByPath(toObject, ['tools'], fromTools.map((item) => {
6301
- return toolToVertex(apiClient, item);
6302
- }));
6303
- }
6304
- return toObject;
6305
- }
6306
- function liveServerContentFromMldev(apiClient, fromObject) {
6307
- const toObject = {};
6308
- const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
6309
- if (fromModelTurn !== undefined && fromModelTurn !== null) {
6310
- setValueByPath(toObject, ['modelTurn'], contentFromMldev(apiClient, fromModelTurn));
6311
- }
6312
- const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
6313
- if (fromTurnComplete !== undefined) {
6314
- setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
6315
- }
6316
- const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
6317
- if (fromInterrupted !== undefined) {
6318
- setValueByPath(toObject, ['interrupted'], fromInterrupted);
6319
- }
6320
- return toObject;
6321
- }
6322
- function liveServerContentFromVertex(apiClient, fromObject) {
6323
- const toObject = {};
6324
- const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
6325
- if (fromModelTurn !== undefined && fromModelTurn !== null) {
6326
- setValueByPath(toObject, ['modelTurn'], contentFromVertex(apiClient, fromModelTurn));
6327
- }
6328
- const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
6329
- if (fromTurnComplete !== undefined) {
6330
- setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
6331
- }
6332
- const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
6333
- if (fromInterrupted !== undefined) {
6334
- setValueByPath(toObject, ['interrupted'], fromInterrupted);
6335
- }
6336
- return toObject;
6337
- }
6338
- function functionCallFromMldev(apiClient, fromObject) {
6339
- const toObject = {};
6340
- const fromId = getValueByPath(fromObject, ['id']);
6341
- if (fromId !== undefined) {
6342
- setValueByPath(toObject, ['id'], fromId);
6343
- }
6344
- const fromArgs = getValueByPath(fromObject, ['args']);
6345
- if (fromArgs !== undefined) {
6346
- setValueByPath(toObject, ['args'], fromArgs);
6347
- }
6348
- const fromName = getValueByPath(fromObject, ['name']);
6349
- if (fromName !== undefined) {
6350
- setValueByPath(toObject, ['name'], fromName);
6351
- }
6352
- return toObject;
6353
- }
6354
- function functionCallFromVertex(apiClient, fromObject) {
6355
- const toObject = {};
6356
- const fromArgs = getValueByPath(fromObject, ['args']);
6357
- if (fromArgs !== undefined) {
6358
- setValueByPath(toObject, ['args'], fromArgs);
6359
- }
6360
- const fromName = getValueByPath(fromObject, ['name']);
6361
- if (fromName !== undefined) {
6362
- setValueByPath(toObject, ['name'], fromName);
6363
- }
6364
- return toObject;
6365
- }
6366
- function liveServerToolCallFromMldev(apiClient, fromObject) {
6367
- const toObject = {};
6368
- const fromFunctionCalls = getValueByPath(fromObject, [
6369
- 'functionCalls',
6370
- ]);
6371
- if (fromFunctionCalls !== undefined &&
6372
- fromFunctionCalls !== null &&
6373
- Array.isArray(fromFunctionCalls)) {
6374
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
6375
- return functionCallFromMldev(apiClient, item);
6376
- }));
6377
- }
6378
- return toObject;
6379
- }
6380
- function liveServerToolCallFromVertex(apiClient, fromObject) {
6381
- const toObject = {};
6382
- const fromFunctionCalls = getValueByPath(fromObject, [
6383
- 'functionCalls',
6384
- ]);
6385
- if (fromFunctionCalls !== undefined &&
6386
- fromFunctionCalls !== null &&
6387
- Array.isArray(fromFunctionCalls)) {
6388
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
6389
- return functionCallFromVertex(apiClient, item);
6390
- }));
6391
- }
6392
- return toObject;
6393
- }
6394
- function liveServerToolCallCancellationFromMldev(apiClient, fromObject) {
6395
- const toObject = {};
6396
- const fromIds = getValueByPath(fromObject, ['ids']);
6397
- if (fromIds !== undefined) {
6398
- setValueByPath(toObject, ['ids'], fromIds);
6399
- }
6400
- return toObject;
6401
- }
6402
- function liveServerToolCallCancellationFromVertex(apiClient, fromObject) {
6403
- const toObject = {};
6404
- const fromIds = getValueByPath(fromObject, ['ids']);
6405
- if (fromIds !== undefined) {
6406
- setValueByPath(toObject, ['ids'], fromIds);
7825
+ setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(apiClient, fromResponse));
6407
7826
  }
6408
7827
  return toObject;
6409
7828
  }
@@ -6463,17 +7882,20 @@ class Live {
6463
7882
  @experimental
6464
7883
 
6465
7884
  @remarks
6466
- If using the Gemini API, Live is currently only supported behind API
6467
- version `v1alpha`. Ensure that the API version is set to `v1alpha` when
6468
- initializing the SDK if relying on the Gemini API.
6469
7885
 
6470
7886
  @param params - The parameters for establishing a connection to the model.
6471
7887
  @return A live session.
6472
7888
 
6473
7889
  @example
6474
7890
  ```ts
7891
+ let model: string;
7892
+ if (GOOGLE_GENAI_USE_VERTEXAI) {
7893
+ model = 'gemini-2.0-flash-live-preview-04-09';
7894
+ } else {
7895
+ model = 'gemini-2.0-flash-live-001';
7896
+ }
6475
7897
  const session = await ai.live.connect({
6476
- model: 'gemini-2.0-flash-exp',
7898
+ model: model,
6477
7899
  config: {
6478
7900
  responseModalities: [Modality.AUDIO],
6479
7901
  },
@@ -6495,7 +7917,7 @@ class Live {
6495
7917
  ```
6496
7918
  */
6497
7919
  async connect(params) {
6498
- var _a, _b;
7920
+ var _a, _b, _c, _d;
6499
7921
  const websocketBaseUrl = this.apiClient.getWebsocketBaseUrl();
6500
7922
  const apiVersion = this.apiClient.getApiVersion();
6501
7923
  let url;
@@ -6542,6 +7964,20 @@ class Live {
6542
7964
  `projects/${project}/locations/${location}/` + transformedModel;
6543
7965
  }
6544
7966
  let clientMessage = {};
7967
+ if (this.apiClient.isVertexAI() &&
7968
+ ((_c = params.config) === null || _c === void 0 ? void 0 : _c.responseModalities) === undefined) {
7969
+ // Set default to AUDIO to align with MLDev API.
7970
+ if (params.config === undefined) {
7971
+ params.config = { responseModalities: [exports.Modality.AUDIO] };
7972
+ }
7973
+ else {
7974
+ params.config.responseModalities = [exports.Modality.AUDIO];
7975
+ }
7976
+ }
7977
+ if ((_d = params.config) === null || _d === void 0 ? void 0 : _d.generationConfig) {
7978
+ // Raise deprecation warning for generationConfig.
7979
+ 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).');
7980
+ }
6545
7981
  const liveConnectParameters = {
6546
7982
  model: transformedModel,
6547
7983
  config: params.config,
@@ -6553,6 +7989,7 @@ class Live {
6553
7989
  else {
6554
7990
  clientMessage = liveConnectParametersToMldev(this.apiClient, liveConnectParameters);
6555
7991
  }
7992
+ delete clientMessage['config'];
6556
7993
  conn.send(JSON.stringify(clientMessage));
6557
7994
  return new Session(conn, this.apiClient);
6558
7995
  }
@@ -6599,7 +8036,13 @@ class Session {
6599
8036
  throw new Error(`Failed to convert realtime input "media", type: '${typeof params.media}'`);
6600
8037
  }
6601
8038
  // LiveClientRealtimeInput
6602
- clientMessage = { realtimeInput: { mediaChunks: [params.media] } };
8039
+ clientMessage = {
8040
+ realtimeInput: {
8041
+ mediaChunks: [params.media],
8042
+ activityStart: params.activityStart,
8043
+ activityEnd: params.activityEnd,
8044
+ },
8045
+ };
6603
8046
  return clientMessage;
6604
8047
  }
6605
8048
  tLiveClienttToolResponse(apiClient, params) {
@@ -6743,8 +8186,14 @@ class Session {
6743
8186
 
6744
8187
  @example
6745
8188
  ```ts
8189
+ let model: string;
8190
+ if (GOOGLE_GENAI_USE_VERTEXAI) {
8191
+ model = 'gemini-2.0-flash-live-preview-04-09';
8192
+ } else {
8193
+ model = 'gemini-2.0-flash-live-001';
8194
+ }
6746
8195
  const session = await ai.live.connect({
6747
- model: 'gemini-2.0-flash-exp',
8196
+ model: model,
6748
8197
  config: {
6749
8198
  responseModalities: [Modality.AUDIO],
6750
8199
  }
@@ -7010,7 +8459,7 @@ class Models extends BaseModule {
7010
8459
  _c = apiResponse_1_1.value;
7011
8460
  _d = false;
7012
8461
  const chunk = _c;
7013
- const resp = generateContentResponseFromVertex(apiClient, chunk);
8462
+ const resp = generateContentResponseFromVertex(apiClient, (yield __await(chunk.json())));
7014
8463
  const typedResp = new GenerateContentResponse();
7015
8464
  Object.assign(typedResp, resp);
7016
8465
  yield yield __await(typedResp);
@@ -7049,7 +8498,7 @@ class Models extends BaseModule {
7049
8498
  _c = apiResponse_2_1.value;
7050
8499
  _d = false;
7051
8500
  const chunk = _c;
7052
- const resp = generateContentResponseFromMldev(apiClient, chunk);
8501
+ const resp = generateContentResponseFromMldev(apiClient, (yield __await(chunk.json())));
7053
8502
  const typedResp = new GenerateContentResponse();
7054
8503
  Object.assign(typedResp, resp);
7055
8504
  yield yield __await(typedResp);
@@ -7218,6 +8667,66 @@ class Models extends BaseModule {
7218
8667
  });
7219
8668
  }
7220
8669
  }
8670
+ /**
8671
+ * Fetches information about a model by name.
8672
+ *
8673
+ * @example
8674
+ * ```ts
8675
+ * const modelInfo = await ai.models.get({model: 'gemini-2.0-flash'});
8676
+ * ```
8677
+ */
8678
+ async get(params) {
8679
+ var _a, _b;
8680
+ let response;
8681
+ let path = '';
8682
+ let queryParams = {};
8683
+ if (this.apiClient.isVertexAI()) {
8684
+ const body = getModelParametersToVertex(this.apiClient, params);
8685
+ path = formatMap('{name}', body['_url']);
8686
+ queryParams = body['_query'];
8687
+ delete body['config'];
8688
+ delete body['_url'];
8689
+ delete body['_query'];
8690
+ response = this.apiClient
8691
+ .request({
8692
+ path: path,
8693
+ queryParams: queryParams,
8694
+ body: JSON.stringify(body),
8695
+ httpMethod: 'GET',
8696
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
8697
+ })
8698
+ .then((httpResponse) => {
8699
+ return httpResponse.json();
8700
+ });
8701
+ return response.then((apiResponse) => {
8702
+ const resp = modelFromVertex(this.apiClient, apiResponse);
8703
+ return resp;
8704
+ });
8705
+ }
8706
+ else {
8707
+ const body = getModelParametersToMldev(this.apiClient, params);
8708
+ path = formatMap('{name}', body['_url']);
8709
+ queryParams = body['_query'];
8710
+ delete body['config'];
8711
+ delete body['_url'];
8712
+ delete body['_query'];
8713
+ response = this.apiClient
8714
+ .request({
8715
+ path: path,
8716
+ queryParams: queryParams,
8717
+ body: JSON.stringify(body),
8718
+ httpMethod: 'GET',
8719
+ httpOptions: (_b = params.config) === null || _b === void 0 ? void 0 : _b.httpOptions,
8720
+ })
8721
+ .then((httpResponse) => {
8722
+ return httpResponse.json();
8723
+ });
8724
+ return response.then((apiResponse) => {
8725
+ const resp = modelFromMldev(this.apiClient, apiResponse);
8726
+ return resp;
8727
+ });
8728
+ }
8729
+ }
7221
8730
  /**
7222
8731
  * Counts the number of tokens in the given contents. Multimodal input is
7223
8732
  * supported for Gemini models.
@@ -7359,10 +8868,10 @@ class Models extends BaseModule {
7359
8868
  *
7360
8869
  * while (!operation.done) {
7361
8870
  * await new Promise(resolve => setTimeout(resolve, 10000));
7362
- * operation = await ai.operations.get({operation: operation});
8871
+ * operation = await ai.operations.getVideosOperation({operation: operation});
7363
8872
  * }
7364
8873
  *
7365
- * console.log(operation.result?.generatedVideos?.[0]?.video?.uri);
8874
+ * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
7366
8875
  * ```
7367
8876
  */
7368
8877
  async generateVideos(params) {
@@ -7544,16 +9053,12 @@ function generateVideosOperationFromMldev(apiClient, fromObject) {
7544
9053
  if (fromError != null) {
7545
9054
  setValueByPath(toObject, ['error'], fromError);
7546
9055
  }
7547
- const fromResponse = getValueByPath(fromObject, ['response']);
7548
- if (fromResponse != null) {
7549
- setValueByPath(toObject, ['response'], fromResponse);
7550
- }
7551
- const fromResult = getValueByPath(fromObject, [
9056
+ const fromResponse = getValueByPath(fromObject, [
7552
9057
  'response',
7553
9058
  'generateVideoResponse',
7554
9059
  ]);
7555
- if (fromResult != null) {
7556
- setValueByPath(toObject, ['result'], generateVideosResponseFromMldev(apiClient, fromResult));
9060
+ if (fromResponse != null) {
9061
+ setValueByPath(toObject, ['response'], generateVideosResponseFromMldev(apiClient, fromResponse));
7557
9062
  }
7558
9063
  return toObject;
7559
9064
  }
@@ -7630,11 +9135,7 @@ function generateVideosOperationFromVertex(apiClient, fromObject) {
7630
9135
  }
7631
9136
  const fromResponse = getValueByPath(fromObject, ['response']);
7632
9137
  if (fromResponse != null) {
7633
- setValueByPath(toObject, ['response'], fromResponse);
7634
- }
7635
- const fromResult = getValueByPath(fromObject, ['response']);
7636
- if (fromResult != null) {
7637
- setValueByPath(toObject, ['result'], generateVideosResponseFromVertex(apiClient, fromResult));
9138
+ setValueByPath(toObject, ['response'], generateVideosResponseFromVertex(apiClient, fromResponse));
7638
9139
  }
7639
9140
  return toObject;
7640
9141
  }
@@ -7652,10 +9153,10 @@ class Operations extends BaseModule {
7652
9153
  /**
7653
9154
  * Gets the status of a long-running operation.
7654
9155
  *
7655
- * @param operation The Operation object returned by a previous API call.
9156
+ * @param parameters The parameters for the get operation request.
7656
9157
  * @return The updated Operation object, with the latest status or result.
7657
9158
  */
7658
- async get(parameters) {
9159
+ async getVideosOperation(parameters) {
7659
9160
  const operation = parameters.operation;
7660
9161
  const config = parameters.config;
7661
9162
  if (operation.name === undefined || operation.name === '') {
@@ -7663,7 +9164,7 @@ class Operations extends BaseModule {
7663
9164
  }
7664
9165
  if (this.apiClient.isVertexAI()) {
7665
9166
  const resourceName = operation.name.split('/operations/')[0];
7666
- var httpOptions = undefined;
9167
+ let httpOptions = undefined;
7667
9168
  if (config && 'httpOptions' in config) {
7668
9169
  httpOptions = config.httpOptions;
7669
9170
  }