@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.
@@ -235,44 +235,25 @@ function _isFunctionCallPart(origin) {
235
235
  typeof origin === 'object' &&
236
236
  'functionCall' in origin);
237
237
  }
238
- function _isUserPart(origin) {
239
- if (origin === null || origin === undefined) {
240
- return false;
241
- }
242
- if (_isFunctionCallPart(origin)) {
243
- return false;
244
- }
245
- return true;
246
- }
247
- function _areUserParts(origin) {
248
- if (origin === null ||
249
- origin === undefined ||
250
- (Array.isArray(origin) && origin.length === 0)) {
251
- return false;
252
- }
253
- return origin.every(_isUserPart);
238
+ function _isFunctionResponsePart(origin) {
239
+ return (origin !== null &&
240
+ origin !== undefined &&
241
+ typeof origin === 'object' &&
242
+ 'functionResponse' in origin);
254
243
  }
255
244
  function tContent(apiClient, origin) {
256
245
  if (origin === null || origin === undefined) {
257
246
  throw new Error('ContentUnion is required');
258
247
  }
259
248
  if (_isContent(origin)) {
260
- // @ts-expect-error: _isContent is a utility function that checks if the
249
+ // _isContent is a utility function that checks if the
261
250
  // origin is a Content.
262
251
  return origin;
263
252
  }
264
- if (_isUserPart(origin)) {
265
- return {
266
- role: 'user',
267
- parts: tParts(apiClient, origin),
268
- };
269
- }
270
- else {
271
- return {
272
- role: 'model',
273
- parts: tParts(apiClient, origin),
274
- };
275
- }
253
+ return {
254
+ role: 'user',
255
+ parts: tParts(apiClient, origin),
256
+ };
276
257
  }
277
258
  function tContentsForEmbed(apiClient, origin) {
278
259
  if (!origin) {
@@ -303,34 +284,6 @@ function tContentsForEmbed(apiClient, origin) {
303
284
  }
304
285
  return [tContent(apiClient, origin)];
305
286
  }
306
- function _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts) {
307
- if (accumulatedParts.length === 0) {
308
- return;
309
- }
310
- if (_areUserParts(accumulatedParts)) {
311
- result.push({
312
- role: 'user',
313
- parts: tParts(apiClient, accumulatedParts),
314
- });
315
- }
316
- else {
317
- result.push({
318
- role: 'model',
319
- parts: tParts(apiClient, accumulatedParts),
320
- });
321
- }
322
- accumulatedParts.length = 0; // clear the array inplace
323
- }
324
- function _handleCurrentPart(apiClient, result, accumulatedParts, currentPart) {
325
- if (_isUserPart(currentPart) === _areUserParts(accumulatedParts)) {
326
- accumulatedParts.push(currentPart);
327
- }
328
- else {
329
- _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
330
- accumulatedParts.length = 0;
331
- accumulatedParts.push(currentPart);
332
- }
333
- }
334
287
  function tContents(apiClient, origin) {
335
288
  if (origin === null ||
336
289
  origin === undefined ||
@@ -338,35 +291,35 @@ function tContents(apiClient, origin) {
338
291
  throw new Error('contents are required');
339
292
  }
340
293
  if (!Array.isArray(origin)) {
294
+ // If it's not an array, it's a single content or a single PartUnion.
295
+ if (_isFunctionCallPart(origin) || _isFunctionResponsePart(origin)) {
296
+ throw new Error('To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them');
297
+ }
341
298
  return [tContent(apiClient, origin)];
342
299
  }
343
300
  const result = [];
344
301
  const accumulatedParts = [];
345
- for (const content of origin) {
346
- if (_isContent(content)) {
347
- _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
348
- // @ts-expect-error: content is a Content here
349
- result.push(content);
350
- }
351
- else if (typeof content === 'string' ||
352
- (typeof content === 'object' && !Array.isArray(content))) {
353
- // @ts-expect-error: content is a part here
354
- _handleCurrentPart(apiClient, result, accumulatedParts, content);
355
- }
356
- else if (Array.isArray(content)) {
357
- // if there're consecutive user parts before the list,
358
- // convert to UserContent and append to result
359
- _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
360
- result.push({
361
- role: 'user',
362
- parts: tParts(apiClient, content),
363
- });
302
+ const isContentArray = _isContent(origin[0]);
303
+ for (const item of origin) {
304
+ const isContent = _isContent(item);
305
+ if (isContent != isContentArray) {
306
+ 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');
307
+ }
308
+ if (isContent) {
309
+ // `isContent` contains the result of _isContent, which is a utility
310
+ // function that checks if the item is a Content.
311
+ result.push(item);
312
+ }
313
+ else if (_isFunctionCallPart(item) || _isFunctionResponsePart(item)) {
314
+ 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');
364
315
  }
365
316
  else {
366
- throw new Error(`Unsupported content type: ${typeof content}`);
317
+ accumulatedParts.push(item);
367
318
  }
368
319
  }
369
- _appendAccumulatedPartsAsContent(apiClient, result, accumulatedParts);
320
+ if (!isContentArray) {
321
+ result.push({ role: 'user', parts: tParts(apiClient, accumulatedParts) });
322
+ }
370
323
  return result;
371
324
  }
372
325
  function processSchema(apiClient, schema) {
@@ -531,7 +484,7 @@ function tFileName(apiClient, fromName) {
531
484
  * Copyright 2025 Google LLC
532
485
  * SPDX-License-Identifier: Apache-2.0
533
486
  */
534
- function partToMldev$1(apiClient, fromObject) {
487
+ function partToMldev$2(apiClient, fromObject) {
535
488
  const toObject = {};
536
489
  if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
537
490
  throw new Error('videoMetadata parameter is not supported in Gemini API.');
@@ -576,13 +529,13 @@ function partToMldev$1(apiClient, fromObject) {
576
529
  }
577
530
  return toObject;
578
531
  }
579
- function contentToMldev$1(apiClient, fromObject) {
532
+ function contentToMldev$2(apiClient, fromObject) {
580
533
  const toObject = {};
581
534
  const fromParts = getValueByPath(fromObject, ['parts']);
582
535
  if (fromParts != null) {
583
536
  if (Array.isArray(fromParts)) {
584
537
  setValueByPath(toObject, ['parts'], fromParts.map((item) => {
585
- return partToMldev$1(apiClient, item);
538
+ return partToMldev$2(apiClient, item);
586
539
  }));
587
540
  }
588
541
  else {
@@ -595,7 +548,7 @@ function contentToMldev$1(apiClient, fromObject) {
595
548
  }
596
549
  return toObject;
597
550
  }
598
- function functionDeclarationToMldev$1(apiClient, fromObject) {
551
+ function functionDeclarationToMldev$2(apiClient, fromObject) {
599
552
  const toObject = {};
600
553
  if (getValueByPath(fromObject, ['response']) !== undefined) {
601
554
  throw new Error('response parameter is not supported in Gemini API.');
@@ -614,11 +567,11 @@ function functionDeclarationToMldev$1(apiClient, fromObject) {
614
567
  }
615
568
  return toObject;
616
569
  }
617
- function googleSearchToMldev$1() {
570
+ function googleSearchToMldev$2() {
618
571
  const toObject = {};
619
572
  return toObject;
620
573
  }
621
- function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
574
+ function dynamicRetrievalConfigToMldev$2(apiClient, fromObject) {
622
575
  const toObject = {};
623
576
  const fromMode = getValueByPath(fromObject, ['mode']);
624
577
  if (fromMode != null) {
@@ -632,17 +585,17 @@ function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
632
585
  }
633
586
  return toObject;
634
587
  }
635
- function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
588
+ function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
636
589
  const toObject = {};
637
590
  const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
638
591
  'dynamicRetrievalConfig',
639
592
  ]);
640
593
  if (fromDynamicRetrievalConfig != null) {
641
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
594
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$2(apiClient, fromDynamicRetrievalConfig));
642
595
  }
643
596
  return toObject;
644
597
  }
645
- function toolToMldev$1(apiClient, fromObject) {
598
+ function toolToMldev$2(apiClient, fromObject) {
646
599
  const toObject = {};
647
600
  const fromFunctionDeclarations = getValueByPath(fromObject, [
648
601
  'functionDeclarations',
@@ -650,7 +603,7 @@ function toolToMldev$1(apiClient, fromObject) {
650
603
  if (fromFunctionDeclarations != null) {
651
604
  if (Array.isArray(fromFunctionDeclarations)) {
652
605
  setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
653
- return functionDeclarationToMldev$1(apiClient, item);
606
+ return functionDeclarationToMldev$2(apiClient, item);
654
607
  }));
655
608
  }
656
609
  else {
@@ -662,13 +615,13 @@ function toolToMldev$1(apiClient, fromObject) {
662
615
  }
663
616
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
664
617
  if (fromGoogleSearch != null) {
665
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1());
618
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2());
666
619
  }
667
620
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
668
621
  'googleSearchRetrieval',
669
622
  ]);
670
623
  if (fromGoogleSearchRetrieval != null) {
671
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
624
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$2(apiClient, fromGoogleSearchRetrieval));
672
625
  }
673
626
  const fromCodeExecution = getValueByPath(fromObject, [
674
627
  'codeExecution',
@@ -720,7 +673,7 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
720
673
  if (parentObject !== undefined && fromContents != null) {
721
674
  if (Array.isArray(fromContents)) {
722
675
  setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
723
- return contentToMldev$1(apiClient, item);
676
+ return contentToMldev$2(apiClient, item);
724
677
  })));
725
678
  }
726
679
  else {
@@ -731,13 +684,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
731
684
  'systemInstruction',
732
685
  ]);
733
686
  if (parentObject !== undefined && fromSystemInstruction != null) {
734
- setValueByPath(parentObject, ['systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
687
+ setValueByPath(parentObject, ['systemInstruction'], contentToMldev$2(apiClient, tContent(apiClient, fromSystemInstruction)));
735
688
  }
736
689
  const fromTools = getValueByPath(fromObject, ['tools']);
737
690
  if (parentObject !== undefined && fromTools != null) {
738
691
  if (Array.isArray(fromTools)) {
739
692
  setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
740
- return toolToMldev$1(apiClient, item);
693
+ return toolToMldev$2(apiClient, item);
741
694
  }));
742
695
  }
743
696
  else {
@@ -830,7 +783,7 @@ function listCachedContentsParametersToMldev(apiClient, fromObject) {
830
783
  }
831
784
  return toObject;
832
785
  }
833
- function partToVertex$1(apiClient, fromObject) {
786
+ function partToVertex$2(apiClient, fromObject) {
834
787
  const toObject = {};
835
788
  const fromVideoMetadata = getValueByPath(fromObject, [
836
789
  'videoMetadata',
@@ -878,13 +831,13 @@ function partToVertex$1(apiClient, fromObject) {
878
831
  }
879
832
  return toObject;
880
833
  }
881
- function contentToVertex$1(apiClient, fromObject) {
834
+ function contentToVertex$2(apiClient, fromObject) {
882
835
  const toObject = {};
883
836
  const fromParts = getValueByPath(fromObject, ['parts']);
884
837
  if (fromParts != null) {
885
838
  if (Array.isArray(fromParts)) {
886
839
  setValueByPath(toObject, ['parts'], fromParts.map((item) => {
887
- return partToVertex$1(apiClient, item);
840
+ return partToVertex$2(apiClient, item);
888
841
  }));
889
842
  }
890
843
  else {
@@ -897,7 +850,7 @@ function contentToVertex$1(apiClient, fromObject) {
897
850
  }
898
851
  return toObject;
899
852
  }
900
- function schemaToVertex$1(apiClient, fromObject) {
853
+ function schemaToVertex$2(apiClient, fromObject) {
901
854
  const toObject = {};
902
855
  const fromExample = getValueByPath(fromObject, ['example']);
903
856
  if (fromExample != null) {
@@ -995,11 +948,11 @@ function schemaToVertex$1(apiClient, fromObject) {
995
948
  }
996
949
  return toObject;
997
950
  }
998
- function functionDeclarationToVertex$1(apiClient, fromObject) {
951
+ function functionDeclarationToVertex$2(apiClient, fromObject) {
999
952
  const toObject = {};
1000
953
  const fromResponse = getValueByPath(fromObject, ['response']);
1001
954
  if (fromResponse != null) {
1002
- setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
955
+ setValueByPath(toObject, ['response'], schemaToVertex$2(apiClient, fromResponse));
1003
956
  }
1004
957
  const fromDescription = getValueByPath(fromObject, ['description']);
1005
958
  if (fromDescription != null) {
@@ -1015,11 +968,11 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
1015
968
  }
1016
969
  return toObject;
1017
970
  }
1018
- function googleSearchToVertex$1() {
971
+ function googleSearchToVertex$2() {
1019
972
  const toObject = {};
1020
973
  return toObject;
1021
974
  }
1022
- function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
975
+ function dynamicRetrievalConfigToVertex$2(apiClient, fromObject) {
1023
976
  const toObject = {};
1024
977
  const fromMode = getValueByPath(fromObject, ['mode']);
1025
978
  if (fromMode != null) {
@@ -1033,17 +986,17 @@ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
1033
986
  }
1034
987
  return toObject;
1035
988
  }
1036
- function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
989
+ function googleSearchRetrievalToVertex$2(apiClient, fromObject) {
1037
990
  const toObject = {};
1038
991
  const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
1039
992
  'dynamicRetrievalConfig',
1040
993
  ]);
1041
994
  if (fromDynamicRetrievalConfig != null) {
1042
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
995
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$2(apiClient, fromDynamicRetrievalConfig));
1043
996
  }
1044
997
  return toObject;
1045
998
  }
1046
- function toolToVertex$1(apiClient, fromObject) {
999
+ function toolToVertex$2(apiClient, fromObject) {
1047
1000
  const toObject = {};
1048
1001
  const fromFunctionDeclarations = getValueByPath(fromObject, [
1049
1002
  'functionDeclarations',
@@ -1051,7 +1004,7 @@ function toolToVertex$1(apiClient, fromObject) {
1051
1004
  if (fromFunctionDeclarations != null) {
1052
1005
  if (Array.isArray(fromFunctionDeclarations)) {
1053
1006
  setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
1054
- return functionDeclarationToVertex$1(apiClient, item);
1007
+ return functionDeclarationToVertex$2(apiClient, item);
1055
1008
  }));
1056
1009
  }
1057
1010
  else {
@@ -1064,13 +1017,13 @@ function toolToVertex$1(apiClient, fromObject) {
1064
1017
  }
1065
1018
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
1066
1019
  if (fromGoogleSearch != null) {
1067
- setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
1020
+ setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$2());
1068
1021
  }
1069
1022
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
1070
1023
  'googleSearchRetrieval',
1071
1024
  ]);
1072
1025
  if (fromGoogleSearchRetrieval != null) {
1073
- setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
1026
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$2(apiClient, fromGoogleSearchRetrieval));
1074
1027
  }
1075
1028
  const fromCodeExecution = getValueByPath(fromObject, [
1076
1029
  'codeExecution',
@@ -1122,7 +1075,7 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1122
1075
  if (parentObject !== undefined && fromContents != null) {
1123
1076
  if (Array.isArray(fromContents)) {
1124
1077
  setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
1125
- return contentToVertex$1(apiClient, item);
1078
+ return contentToVertex$2(apiClient, item);
1126
1079
  })));
1127
1080
  }
1128
1081
  else {
@@ -1133,13 +1086,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1133
1086
  'systemInstruction',
1134
1087
  ]);
1135
1088
  if (parentObject !== undefined && fromSystemInstruction != null) {
1136
- setValueByPath(parentObject, ['systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
1089
+ setValueByPath(parentObject, ['systemInstruction'], contentToVertex$2(apiClient, tContent(apiClient, fromSystemInstruction)));
1137
1090
  }
1138
1091
  const fromTools = getValueByPath(fromObject, ['tools']);
1139
1092
  if (parentObject !== undefined && fromTools != null) {
1140
1093
  if (Array.isArray(fromTools)) {
1141
1094
  setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
1142
- return toolToVertex$1(apiClient, item);
1095
+ return toolToVertex$2(apiClient, item);
1143
1096
  }));
1144
1097
  }
1145
1098
  else {
@@ -1538,6 +1491,7 @@ class Pager {
1538
1491
  * SPDX-License-Identifier: Apache-2.0
1539
1492
  */
1540
1493
  // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
1494
+ /** Required. Outcome of the code execution. */
1541
1495
  exports.Outcome = void 0;
1542
1496
  (function (Outcome) {
1543
1497
  Outcome["OUTCOME_UNSPECIFIED"] = "OUTCOME_UNSPECIFIED";
@@ -1545,11 +1499,13 @@ exports.Outcome = void 0;
1545
1499
  Outcome["OUTCOME_FAILED"] = "OUTCOME_FAILED";
1546
1500
  Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
1547
1501
  })(exports.Outcome || (exports.Outcome = {}));
1502
+ /** Required. Programming language of the `code`. */
1548
1503
  exports.Language = void 0;
1549
1504
  (function (Language) {
1550
1505
  Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
1551
1506
  Language["PYTHON"] = "PYTHON";
1552
1507
  })(exports.Language || (exports.Language = {}));
1508
+ /** Optional. The type of the data. */
1553
1509
  exports.Type = void 0;
1554
1510
  (function (Type) {
1555
1511
  Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
@@ -1560,6 +1516,7 @@ exports.Type = void 0;
1560
1516
  Type["ARRAY"] = "ARRAY";
1561
1517
  Type["OBJECT"] = "OBJECT";
1562
1518
  })(exports.Type || (exports.Type = {}));
1519
+ /** Required. Harm category. */
1563
1520
  exports.HarmCategory = void 0;
1564
1521
  (function (HarmCategory) {
1565
1522
  HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
@@ -1569,12 +1526,14 @@ exports.HarmCategory = void 0;
1569
1526
  HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
1570
1527
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
1571
1528
  })(exports.HarmCategory || (exports.HarmCategory = {}));
1529
+ /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
1572
1530
  exports.HarmBlockMethod = void 0;
1573
1531
  (function (HarmBlockMethod) {
1574
1532
  HarmBlockMethod["HARM_BLOCK_METHOD_UNSPECIFIED"] = "HARM_BLOCK_METHOD_UNSPECIFIED";
1575
1533
  HarmBlockMethod["SEVERITY"] = "SEVERITY";
1576
1534
  HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
1577
1535
  })(exports.HarmBlockMethod || (exports.HarmBlockMethod = {}));
1536
+ /** Required. The harm block threshold. */
1578
1537
  exports.HarmBlockThreshold = void 0;
1579
1538
  (function (HarmBlockThreshold) {
1580
1539
  HarmBlockThreshold["HARM_BLOCK_THRESHOLD_UNSPECIFIED"] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
@@ -1584,11 +1543,16 @@ exports.HarmBlockThreshold = void 0;
1584
1543
  HarmBlockThreshold["BLOCK_NONE"] = "BLOCK_NONE";
1585
1544
  HarmBlockThreshold["OFF"] = "OFF";
1586
1545
  })(exports.HarmBlockThreshold || (exports.HarmBlockThreshold = {}));
1546
+ /** The mode of the predictor to be used in dynamic retrieval. */
1587
1547
  exports.Mode = void 0;
1588
1548
  (function (Mode) {
1589
1549
  Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1590
1550
  Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1591
1551
  })(exports.Mode || (exports.Mode = {}));
1552
+ /** Output only. The reason why the model stopped generating tokens.
1553
+
1554
+ If empty, the model has not stopped generating the tokens.
1555
+ */
1592
1556
  exports.FinishReason = void 0;
1593
1557
  (function (FinishReason) {
1594
1558
  FinishReason["FINISH_REASON_UNSPECIFIED"] = "FINISH_REASON_UNSPECIFIED";
@@ -1603,6 +1567,7 @@ exports.FinishReason = void 0;
1603
1567
  FinishReason["MALFORMED_FUNCTION_CALL"] = "MALFORMED_FUNCTION_CALL";
1604
1568
  FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
1605
1569
  })(exports.FinishReason || (exports.FinishReason = {}));
1570
+ /** Output only. Harm probability levels in the content. */
1606
1571
  exports.HarmProbability = void 0;
1607
1572
  (function (HarmProbability) {
1608
1573
  HarmProbability["HARM_PROBABILITY_UNSPECIFIED"] = "HARM_PROBABILITY_UNSPECIFIED";
@@ -1611,6 +1576,7 @@ exports.HarmProbability = void 0;
1611
1576
  HarmProbability["MEDIUM"] = "MEDIUM";
1612
1577
  HarmProbability["HIGH"] = "HIGH";
1613
1578
  })(exports.HarmProbability || (exports.HarmProbability = {}));
1579
+ /** Output only. Harm severity levels in the content. */
1614
1580
  exports.HarmSeverity = void 0;
1615
1581
  (function (HarmSeverity) {
1616
1582
  HarmSeverity["HARM_SEVERITY_UNSPECIFIED"] = "HARM_SEVERITY_UNSPECIFIED";
@@ -1619,6 +1585,7 @@ exports.HarmSeverity = void 0;
1619
1585
  HarmSeverity["HARM_SEVERITY_MEDIUM"] = "HARM_SEVERITY_MEDIUM";
1620
1586
  HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
1621
1587
  })(exports.HarmSeverity || (exports.HarmSeverity = {}));
1588
+ /** Output only. Blocked reason. */
1622
1589
  exports.BlockedReason = void 0;
1623
1590
  (function (BlockedReason) {
1624
1591
  BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
@@ -1627,6 +1594,14 @@ exports.BlockedReason = void 0;
1627
1594
  BlockedReason["BLOCKLIST"] = "BLOCKLIST";
1628
1595
  BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
1629
1596
  })(exports.BlockedReason || (exports.BlockedReason = {}));
1597
+ /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
1598
+ exports.TrafficType = void 0;
1599
+ (function (TrafficType) {
1600
+ TrafficType["TRAFFIC_TYPE_UNSPECIFIED"] = "TRAFFIC_TYPE_UNSPECIFIED";
1601
+ TrafficType["ON_DEMAND"] = "ON_DEMAND";
1602
+ TrafficType["PROVISIONED_THROUGHPUT"] = "PROVISIONED_THROUGHPUT";
1603
+ })(exports.TrafficType || (exports.TrafficType = {}));
1604
+ /** Server content modalities. */
1630
1605
  exports.Modality = void 0;
1631
1606
  (function (Modality) {
1632
1607
  Modality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
@@ -1634,17 +1609,29 @@ exports.Modality = void 0;
1634
1609
  Modality["IMAGE"] = "IMAGE";
1635
1610
  Modality["AUDIO"] = "AUDIO";
1636
1611
  })(exports.Modality || (exports.Modality = {}));
1637
- exports.State = void 0;
1638
- (function (State) {
1639
- State["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
1640
- State["ACTIVE"] = "ACTIVE";
1641
- State["ERROR"] = "ERROR";
1642
- })(exports.State || (exports.State = {}));
1612
+ /** The media resolution to use. */
1613
+ exports.MediaResolution = void 0;
1614
+ (function (MediaResolution) {
1615
+ MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1616
+ MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1617
+ MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1618
+ MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1619
+ })(exports.MediaResolution || (exports.MediaResolution = {}));
1620
+ /** Options for feature selection preference. */
1621
+ exports.FeatureSelectionPreference = void 0;
1622
+ (function (FeatureSelectionPreference) {
1623
+ FeatureSelectionPreference["FEATURE_SELECTION_PREFERENCE_UNSPECIFIED"] = "FEATURE_SELECTION_PREFERENCE_UNSPECIFIED";
1624
+ FeatureSelectionPreference["PRIORITIZE_QUALITY"] = "PRIORITIZE_QUALITY";
1625
+ FeatureSelectionPreference["BALANCED"] = "BALANCED";
1626
+ FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
1627
+ })(exports.FeatureSelectionPreference || (exports.FeatureSelectionPreference = {}));
1628
+ /** Config for the dynamic retrieval config mode. */
1643
1629
  exports.DynamicRetrievalConfigMode = void 0;
1644
1630
  (function (DynamicRetrievalConfigMode) {
1645
1631
  DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1646
1632
  DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1647
1633
  })(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
1634
+ /** Config for the function calling config mode. */
1648
1635
  exports.FunctionCallingConfigMode = void 0;
1649
1636
  (function (FunctionCallingConfigMode) {
1650
1637
  FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
@@ -1652,13 +1639,7 @@ exports.FunctionCallingConfigMode = void 0;
1652
1639
  FunctionCallingConfigMode["ANY"] = "ANY";
1653
1640
  FunctionCallingConfigMode["NONE"] = "NONE";
1654
1641
  })(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
1655
- exports.MediaResolution = void 0;
1656
- (function (MediaResolution) {
1657
- MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1658
- MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1659
- MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1660
- MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1661
- })(exports.MediaResolution || (exports.MediaResolution = {}));
1642
+ /** Enum that controls the safety filter level for objectionable content. */
1662
1643
  exports.SafetyFilterLevel = void 0;
1663
1644
  (function (SafetyFilterLevel) {
1664
1645
  SafetyFilterLevel["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE";
@@ -1666,12 +1647,14 @@ exports.SafetyFilterLevel = void 0;
1666
1647
  SafetyFilterLevel["BLOCK_ONLY_HIGH"] = "BLOCK_ONLY_HIGH";
1667
1648
  SafetyFilterLevel["BLOCK_NONE"] = "BLOCK_NONE";
1668
1649
  })(exports.SafetyFilterLevel || (exports.SafetyFilterLevel = {}));
1650
+ /** Enum that controls the generation of people. */
1669
1651
  exports.PersonGeneration = void 0;
1670
1652
  (function (PersonGeneration) {
1671
1653
  PersonGeneration["DONT_ALLOW"] = "DONT_ALLOW";
1672
1654
  PersonGeneration["ALLOW_ADULT"] = "ALLOW_ADULT";
1673
1655
  PersonGeneration["ALLOW_ALL"] = "ALLOW_ALL";
1674
1656
  })(exports.PersonGeneration || (exports.PersonGeneration = {}));
1657
+ /** Enum that specifies the language of the text in the prompt. */
1675
1658
  exports.ImagePromptLanguage = void 0;
1676
1659
  (function (ImagePromptLanguage) {
1677
1660
  ImagePromptLanguage["auto"] = "auto";
@@ -1680,6 +1663,7 @@ exports.ImagePromptLanguage = void 0;
1680
1663
  ImagePromptLanguage["ko"] = "ko";
1681
1664
  ImagePromptLanguage["hi"] = "hi";
1682
1665
  })(exports.ImagePromptLanguage || (exports.ImagePromptLanguage = {}));
1666
+ /** State for the lifecycle of a File. */
1683
1667
  exports.FileState = void 0;
1684
1668
  (function (FileState) {
1685
1669
  FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
@@ -1687,12 +1671,14 @@ exports.FileState = void 0;
1687
1671
  FileState["ACTIVE"] = "ACTIVE";
1688
1672
  FileState["FAILED"] = "FAILED";
1689
1673
  })(exports.FileState || (exports.FileState = {}));
1674
+ /** Source of the File. */
1690
1675
  exports.FileSource = void 0;
1691
1676
  (function (FileSource) {
1692
1677
  FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
1693
1678
  FileSource["UPLOADED"] = "UPLOADED";
1694
1679
  FileSource["GENERATED"] = "GENERATED";
1695
1680
  })(exports.FileSource || (exports.FileSource = {}));
1681
+ /** Enum representing the mask mode of a mask reference image. */
1696
1682
  exports.MaskReferenceMode = void 0;
1697
1683
  (function (MaskReferenceMode) {
1698
1684
  MaskReferenceMode["MASK_MODE_DEFAULT"] = "MASK_MODE_DEFAULT";
@@ -1701,6 +1687,7 @@ exports.MaskReferenceMode = void 0;
1701
1687
  MaskReferenceMode["MASK_MODE_FOREGROUND"] = "MASK_MODE_FOREGROUND";
1702
1688
  MaskReferenceMode["MASK_MODE_SEMANTIC"] = "MASK_MODE_SEMANTIC";
1703
1689
  })(exports.MaskReferenceMode || (exports.MaskReferenceMode = {}));
1690
+ /** Enum representing the control type of a control reference image. */
1704
1691
  exports.ControlReferenceType = void 0;
1705
1692
  (function (ControlReferenceType) {
1706
1693
  ControlReferenceType["CONTROL_TYPE_DEFAULT"] = "CONTROL_TYPE_DEFAULT";
@@ -1708,6 +1695,7 @@ exports.ControlReferenceType = void 0;
1708
1695
  ControlReferenceType["CONTROL_TYPE_SCRIBBLE"] = "CONTROL_TYPE_SCRIBBLE";
1709
1696
  ControlReferenceType["CONTROL_TYPE_FACE_MESH"] = "CONTROL_TYPE_FACE_MESH";
1710
1697
  })(exports.ControlReferenceType || (exports.ControlReferenceType = {}));
1698
+ /** Enum representing the subject type of a subject reference image. */
1711
1699
  exports.SubjectReferenceType = void 0;
1712
1700
  (function (SubjectReferenceType) {
1713
1701
  SubjectReferenceType["SUBJECT_TYPE_DEFAULT"] = "SUBJECT_TYPE_DEFAULT";
@@ -1715,6 +1703,7 @@ exports.SubjectReferenceType = void 0;
1715
1703
  SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
1716
1704
  SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
1717
1705
  })(exports.SubjectReferenceType || (exports.SubjectReferenceType = {}));
1706
+ /** Server content modalities. */
1718
1707
  exports.MediaModality = void 0;
1719
1708
  (function (MediaModality) {
1720
1709
  MediaModality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
@@ -1724,6 +1713,34 @@ exports.MediaModality = void 0;
1724
1713
  MediaModality["AUDIO"] = "AUDIO";
1725
1714
  MediaModality["DOCUMENT"] = "DOCUMENT";
1726
1715
  })(exports.MediaModality || (exports.MediaModality = {}));
1716
+ /** Start of speech sensitivity. */
1717
+ exports.StartSensitivity = void 0;
1718
+ (function (StartSensitivity) {
1719
+ StartSensitivity["START_SENSITIVITY_UNSPECIFIED"] = "START_SENSITIVITY_UNSPECIFIED";
1720
+ StartSensitivity["START_SENSITIVITY_HIGH"] = "START_SENSITIVITY_HIGH";
1721
+ StartSensitivity["START_SENSITIVITY_LOW"] = "START_SENSITIVITY_LOW";
1722
+ })(exports.StartSensitivity || (exports.StartSensitivity = {}));
1723
+ /** End of speech sensitivity. */
1724
+ exports.EndSensitivity = void 0;
1725
+ (function (EndSensitivity) {
1726
+ EndSensitivity["END_SENSITIVITY_UNSPECIFIED"] = "END_SENSITIVITY_UNSPECIFIED";
1727
+ EndSensitivity["END_SENSITIVITY_HIGH"] = "END_SENSITIVITY_HIGH";
1728
+ EndSensitivity["END_SENSITIVITY_LOW"] = "END_SENSITIVITY_LOW";
1729
+ })(exports.EndSensitivity || (exports.EndSensitivity = {}));
1730
+ /** The different ways of handling user activity. */
1731
+ exports.ActivityHandling = void 0;
1732
+ (function (ActivityHandling) {
1733
+ ActivityHandling["ACTIVITY_HANDLING_UNSPECIFIED"] = "ACTIVITY_HANDLING_UNSPECIFIED";
1734
+ ActivityHandling["START_OF_ACTIVITY_INTERRUPTS"] = "START_OF_ACTIVITY_INTERRUPTS";
1735
+ ActivityHandling["NO_INTERRUPTION"] = "NO_INTERRUPTION";
1736
+ })(exports.ActivityHandling || (exports.ActivityHandling = {}));
1737
+ /** Options about which input is included in the user's turn. */
1738
+ exports.TurnCoverage = void 0;
1739
+ (function (TurnCoverage) {
1740
+ TurnCoverage["TURN_COVERAGE_UNSPECIFIED"] = "TURN_COVERAGE_UNSPECIFIED";
1741
+ TurnCoverage["TURN_INCLUDES_ONLY_ACTIVITY"] = "TURN_INCLUDES_ONLY_ACTIVITY";
1742
+ TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
1743
+ })(exports.TurnCoverage || (exports.TurnCoverage = {}));
1727
1744
  /** A function response. */
1728
1745
  class FunctionResponse {
1729
1746
  }
@@ -1770,7 +1787,7 @@ function createPartFromFunctionResponse(id, name, response) {
1770
1787
  };
1771
1788
  }
1772
1789
  /**
1773
- * Creates a `Part` object from a `base64` `string`.
1790
+ * Creates a `Part` object from a `base64` encoded `string`.
1774
1791
  */
1775
1792
  function createPartFromBase64(data, mimeType) {
1776
1793
  return {
@@ -2158,8 +2175,8 @@ class Caches extends BaseModule {
2158
2175
  *
2159
2176
  * @remarks
2160
2177
  * Context caching is only supported for specific models. See [Gemini
2161
- * Developer API reference] (https://ai.google.dev/gemini-api/docs/caching?lang=node/context-cac)
2162
- * and [Vertex AI reference] (https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
2178
+ * Developer API reference](https://ai.google.dev/gemini-api/docs/caching?lang=node/context-cac)
2179
+ * and [Vertex AI reference](https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
2163
2180
  * for more information.
2164
2181
  *
2165
2182
  * @param params - The parameters for the create request.
@@ -3085,12 +3102,8 @@ function listFilesResponseFromMldev(apiClient, fromObject) {
3085
3102
  }
3086
3103
  return toObject;
3087
3104
  }
3088
- function createFileResponseFromMldev(apiClient, fromObject) {
3105
+ function createFileResponseFromMldev() {
3089
3106
  const toObject = {};
3090
- const fromHttpHeaders = getValueByPath(fromObject, ['httpHeaders']);
3091
- if (fromHttpHeaders != null) {
3092
- setValueByPath(toObject, ['httpHeaders'], fromHttpHeaders);
3093
- }
3094
3107
  return toObject;
3095
3108
  }
3096
3109
  function deleteFileResponseFromMldev() {
@@ -3152,7 +3165,9 @@ class Files extends BaseModule {
3152
3165
  * This section can contain multiple paragraphs and code examples.
3153
3166
  *
3154
3167
  * @param params - Optional parameters specified in the
3155
- * `common.UploadFileParameters` interface.
3168
+ * `types.UploadFileParameters` interface.
3169
+ * @see {@link types.UploadFileParameters#config} for the optional
3170
+ * config in the parameters.
3156
3171
  * @return A promise that resolves to a `types.File` object.
3157
3172
  * @throws An error if called on a Vertex AI client.
3158
3173
  * @throws An error if the `mimeType` is not provided and can not be inferred,
@@ -3240,8 +3255,8 @@ class Files extends BaseModule {
3240
3255
  .then((httpResponse) => {
3241
3256
  return httpResponse.json();
3242
3257
  });
3243
- return response.then((apiResponse) => {
3244
- const resp = createFileResponseFromMldev(this.apiClient, apiResponse);
3258
+ return response.then(() => {
3259
+ const resp = createFileResponseFromMldev();
3245
3260
  const typedResp = new CreateFileResponse();
3246
3261
  Object.assign(typedResp, resp);
3247
3262
  return typedResp;
@@ -3349,7 +3364,7 @@ class Files extends BaseModule {
3349
3364
  * Copyright 2025 Google LLC
3350
3365
  * SPDX-License-Identifier: Apache-2.0
3351
3366
  */
3352
- function partToMldev(apiClient, fromObject) {
3367
+ function partToMldev$1(apiClient, fromObject) {
3353
3368
  const toObject = {};
3354
3369
  if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
3355
3370
  throw new Error('videoMetadata parameter is not supported in Gemini API.');
@@ -3394,13 +3409,61 @@ function partToMldev(apiClient, fromObject) {
3394
3409
  }
3395
3410
  return toObject;
3396
3411
  }
3397
- function contentToMldev(apiClient, fromObject) {
3412
+ function partToVertex$1(apiClient, fromObject) {
3413
+ const toObject = {};
3414
+ const fromVideoMetadata = getValueByPath(fromObject, [
3415
+ 'videoMetadata',
3416
+ ]);
3417
+ if (fromVideoMetadata != null) {
3418
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
3419
+ }
3420
+ const fromThought = getValueByPath(fromObject, ['thought']);
3421
+ if (fromThought != null) {
3422
+ setValueByPath(toObject, ['thought'], fromThought);
3423
+ }
3424
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
3425
+ 'codeExecutionResult',
3426
+ ]);
3427
+ if (fromCodeExecutionResult != null) {
3428
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
3429
+ }
3430
+ const fromExecutableCode = getValueByPath(fromObject, [
3431
+ 'executableCode',
3432
+ ]);
3433
+ if (fromExecutableCode != null) {
3434
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
3435
+ }
3436
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
3437
+ if (fromFileData != null) {
3438
+ setValueByPath(toObject, ['fileData'], fromFileData);
3439
+ }
3440
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
3441
+ if (fromFunctionCall != null) {
3442
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
3443
+ }
3444
+ const fromFunctionResponse = getValueByPath(fromObject, [
3445
+ 'functionResponse',
3446
+ ]);
3447
+ if (fromFunctionResponse != null) {
3448
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
3449
+ }
3450
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
3451
+ if (fromInlineData != null) {
3452
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
3453
+ }
3454
+ const fromText = getValueByPath(fromObject, ['text']);
3455
+ if (fromText != null) {
3456
+ setValueByPath(toObject, ['text'], fromText);
3457
+ }
3458
+ return toObject;
3459
+ }
3460
+ function contentToMldev$1(apiClient, fromObject) {
3398
3461
  const toObject = {};
3399
3462
  const fromParts = getValueByPath(fromObject, ['parts']);
3400
3463
  if (fromParts != null) {
3401
3464
  if (Array.isArray(fromParts)) {
3402
3465
  setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3403
- return partToMldev(apiClient, item);
3466
+ return partToMldev$1(apiClient, item);
3404
3467
  }));
3405
3468
  }
3406
3469
  else {
@@ -3413,28 +3476,58 @@ function contentToMldev(apiClient, fromObject) {
3413
3476
  }
3414
3477
  return toObject;
3415
3478
  }
3416
- function schemaToMldev(apiClient, fromObject) {
3479
+ function contentToVertex$1(apiClient, fromObject) {
3417
3480
  const toObject = {};
3418
- if (getValueByPath(fromObject, ['example']) !== undefined) {
3419
- throw new Error('example parameter is not supported in Gemini API.');
3481
+ const fromParts = getValueByPath(fromObject, ['parts']);
3482
+ if (fromParts != null) {
3483
+ if (Array.isArray(fromParts)) {
3484
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3485
+ return partToVertex$1(apiClient, item);
3486
+ }));
3487
+ }
3488
+ else {
3489
+ setValueByPath(toObject, ['parts'], fromParts);
3490
+ }
3420
3491
  }
3421
- if (getValueByPath(fromObject, ['pattern']) !== undefined) {
3422
- throw new Error('pattern parameter is not supported in Gemini API.');
3492
+ const fromRole = getValueByPath(fromObject, ['role']);
3493
+ if (fromRole != null) {
3494
+ setValueByPath(toObject, ['role'], fromRole);
3423
3495
  }
3424
- if (getValueByPath(fromObject, ['default']) !== undefined) {
3425
- throw new Error('default parameter is not supported in Gemini API.');
3496
+ return toObject;
3497
+ }
3498
+ function schemaToVertex$1(apiClient, fromObject) {
3499
+ const toObject = {};
3500
+ const fromExample = getValueByPath(fromObject, ['example']);
3501
+ if (fromExample != null) {
3502
+ setValueByPath(toObject, ['example'], fromExample);
3426
3503
  }
3427
- if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
3428
- throw new Error('maxLength parameter is not supported in Gemini API.');
3504
+ const fromPattern = getValueByPath(fromObject, ['pattern']);
3505
+ if (fromPattern != null) {
3506
+ setValueByPath(toObject, ['pattern'], fromPattern);
3429
3507
  }
3430
- if (getValueByPath(fromObject, ['minLength']) !== undefined) {
3431
- throw new Error('minLength parameter is not supported in Gemini API.');
3508
+ const fromDefault = getValueByPath(fromObject, ['default']);
3509
+ if (fromDefault != null) {
3510
+ setValueByPath(toObject, ['default'], fromDefault);
3432
3511
  }
3433
- if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
3434
- throw new Error('minProperties parameter is not supported in Gemini API.');
3512
+ const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
3513
+ if (fromMaxLength != null) {
3514
+ setValueByPath(toObject, ['maxLength'], fromMaxLength);
3435
3515
  }
3436
- if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
3437
- throw new Error('maxProperties parameter is not supported in Gemini API.');
3516
+ const fromMinLength = getValueByPath(fromObject, ['minLength']);
3517
+ if (fromMinLength != null) {
3518
+ setValueByPath(toObject, ['minLength'], fromMinLength);
3519
+ }
3520
+ const fromMinProperties = getValueByPath(fromObject, [
3521
+ 'minProperties',
3522
+ ]);
3523
+ if (fromMinProperties != null) {
3524
+ setValueByPath(toObject, ['minProperties'], fromMinProperties);
3525
+ }
3526
+ const fromMaxProperties = getValueByPath(fromObject, [
3527
+ 'maxProperties',
3528
+ ]);
3529
+ if (fromMaxProperties != null) {
3530
+ setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
3438
3531
  }
3439
3532
  const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
3440
3533
  if (fromAnyOf != null) {
@@ -3500,25 +3593,30 @@ function schemaToMldev(apiClient, fromObject) {
3500
3593
  }
3501
3594
  return toObject;
3502
3595
  }
3503
- function safetySettingToMldev(apiClient, fromObject) {
3596
+ function functionDeclarationToMldev$1(apiClient, fromObject) {
3504
3597
  const toObject = {};
3505
- if (getValueByPath(fromObject, ['method']) !== undefined) {
3506
- throw new Error('method parameter is not supported in Gemini API.');
3598
+ if (getValueByPath(fromObject, ['response']) !== undefined) {
3599
+ throw new Error('response parameter is not supported in Gemini API.');
3507
3600
  }
3508
- const fromCategory = getValueByPath(fromObject, ['category']);
3509
- if (fromCategory != null) {
3510
- setValueByPath(toObject, ['category'], fromCategory);
3601
+ const fromDescription = getValueByPath(fromObject, ['description']);
3602
+ if (fromDescription != null) {
3603
+ setValueByPath(toObject, ['description'], fromDescription);
3511
3604
  }
3512
- const fromThreshold = getValueByPath(fromObject, ['threshold']);
3513
- if (fromThreshold != null) {
3514
- setValueByPath(toObject, ['threshold'], fromThreshold);
3605
+ const fromName = getValueByPath(fromObject, ['name']);
3606
+ if (fromName != null) {
3607
+ setValueByPath(toObject, ['name'], fromName);
3608
+ }
3609
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
3610
+ if (fromParameters != null) {
3611
+ setValueByPath(toObject, ['parameters'], fromParameters);
3515
3612
  }
3516
3613
  return toObject;
3517
3614
  }
3518
- function functionDeclarationToMldev(apiClient, fromObject) {
3615
+ function functionDeclarationToVertex$1(apiClient, fromObject) {
3519
3616
  const toObject = {};
3520
- if (getValueByPath(fromObject, ['response']) !== undefined) {
3521
- throw new Error('response parameter is not supported in Gemini API.');
3617
+ const fromResponse = getValueByPath(fromObject, ['response']);
3618
+ if (fromResponse != null) {
3619
+ setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
3522
3620
  }
3523
3621
  const fromDescription = getValueByPath(fromObject, ['description']);
3524
3622
  if (fromDescription != null) {
@@ -3534,11 +3632,15 @@ function functionDeclarationToMldev(apiClient, fromObject) {
3534
3632
  }
3535
3633
  return toObject;
3536
3634
  }
3537
- function googleSearchToMldev() {
3635
+ function googleSearchToMldev$1() {
3538
3636
  const toObject = {};
3539
3637
  return toObject;
3540
3638
  }
3541
- function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
3639
+ function googleSearchToVertex$1() {
3640
+ const toObject = {};
3641
+ return toObject;
3642
+ }
3643
+ function dynamicRetrievalConfigToMldev$1(apiClient, fromObject) {
3542
3644
  const toObject = {};
3543
3645
  const fromMode = getValueByPath(fromObject, ['mode']);
3544
3646
  if (fromMode != null) {
@@ -3552,13 +3654,1377 @@ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
3552
3654
  }
3553
3655
  return toObject;
3554
3656
  }
3555
- function googleSearchRetrievalToMldev(apiClient, fromObject) {
3657
+ function dynamicRetrievalConfigToVertex$1(apiClient, fromObject) {
3658
+ const toObject = {};
3659
+ const fromMode = getValueByPath(fromObject, ['mode']);
3660
+ if (fromMode != null) {
3661
+ setValueByPath(toObject, ['mode'], fromMode);
3662
+ }
3663
+ const fromDynamicThreshold = getValueByPath(fromObject, [
3664
+ 'dynamicThreshold',
3665
+ ]);
3666
+ if (fromDynamicThreshold != null) {
3667
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
3668
+ }
3669
+ return toObject;
3670
+ }
3671
+ function googleSearchRetrievalToMldev$1(apiClient, fromObject) {
3556
3672
  const toObject = {};
3557
3673
  const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
3558
3674
  'dynamicRetrievalConfig',
3559
3675
  ]);
3560
3676
  if (fromDynamicRetrievalConfig != null) {
3561
- setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
3677
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$1(apiClient, fromDynamicRetrievalConfig));
3678
+ }
3679
+ return toObject;
3680
+ }
3681
+ function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
3682
+ const toObject = {};
3683
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
3684
+ 'dynamicRetrievalConfig',
3685
+ ]);
3686
+ if (fromDynamicRetrievalConfig != null) {
3687
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToVertex$1(apiClient, fromDynamicRetrievalConfig));
3688
+ }
3689
+ return toObject;
3690
+ }
3691
+ function toolToMldev$1(apiClient, fromObject) {
3692
+ const toObject = {};
3693
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
3694
+ 'functionDeclarations',
3695
+ ]);
3696
+ if (fromFunctionDeclarations != null) {
3697
+ if (Array.isArray(fromFunctionDeclarations)) {
3698
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
3699
+ return functionDeclarationToMldev$1(apiClient, item);
3700
+ }));
3701
+ }
3702
+ else {
3703
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
3704
+ }
3705
+ }
3706
+ if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
3707
+ throw new Error('retrieval parameter is not supported in Gemini API.');
3708
+ }
3709
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
3710
+ if (fromGoogleSearch != null) {
3711
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1());
3712
+ }
3713
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
3714
+ 'googleSearchRetrieval',
3715
+ ]);
3716
+ if (fromGoogleSearchRetrieval != null) {
3717
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$1(apiClient, fromGoogleSearchRetrieval));
3718
+ }
3719
+ const fromCodeExecution = getValueByPath(fromObject, [
3720
+ 'codeExecution',
3721
+ ]);
3722
+ if (fromCodeExecution != null) {
3723
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
3724
+ }
3725
+ return toObject;
3726
+ }
3727
+ function toolToVertex$1(apiClient, fromObject) {
3728
+ const toObject = {};
3729
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
3730
+ 'functionDeclarations',
3731
+ ]);
3732
+ if (fromFunctionDeclarations != null) {
3733
+ if (Array.isArray(fromFunctionDeclarations)) {
3734
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
3735
+ return functionDeclarationToVertex$1(apiClient, item);
3736
+ }));
3737
+ }
3738
+ else {
3739
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
3740
+ }
3741
+ }
3742
+ const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
3743
+ if (fromRetrieval != null) {
3744
+ setValueByPath(toObject, ['retrieval'], fromRetrieval);
3745
+ }
3746
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
3747
+ if (fromGoogleSearch != null) {
3748
+ setValueByPath(toObject, ['googleSearch'], googleSearchToVertex$1());
3749
+ }
3750
+ const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
3751
+ 'googleSearchRetrieval',
3752
+ ]);
3753
+ if (fromGoogleSearchRetrieval != null) {
3754
+ setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToVertex$1(apiClient, fromGoogleSearchRetrieval));
3755
+ }
3756
+ const fromCodeExecution = getValueByPath(fromObject, [
3757
+ 'codeExecution',
3758
+ ]);
3759
+ if (fromCodeExecution != null) {
3760
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
3761
+ }
3762
+ return toObject;
3763
+ }
3764
+ function sessionResumptionConfigToMldev(apiClient, fromObject) {
3765
+ const toObject = {};
3766
+ const fromHandle = getValueByPath(fromObject, ['handle']);
3767
+ if (fromHandle != null) {
3768
+ setValueByPath(toObject, ['handle'], fromHandle);
3769
+ }
3770
+ if (getValueByPath(fromObject, ['transparent']) !== undefined) {
3771
+ throw new Error('transparent parameter is not supported in Gemini API.');
3772
+ }
3773
+ return toObject;
3774
+ }
3775
+ function sessionResumptionConfigToVertex(apiClient, fromObject) {
3776
+ const toObject = {};
3777
+ const fromHandle = getValueByPath(fromObject, ['handle']);
3778
+ if (fromHandle != null) {
3779
+ setValueByPath(toObject, ['handle'], fromHandle);
3780
+ }
3781
+ const fromTransparent = getValueByPath(fromObject, ['transparent']);
3782
+ if (fromTransparent != null) {
3783
+ setValueByPath(toObject, ['transparent'], fromTransparent);
3784
+ }
3785
+ return toObject;
3786
+ }
3787
+ function audioTranscriptionConfigToMldev() {
3788
+ const toObject = {};
3789
+ return toObject;
3790
+ }
3791
+ function audioTranscriptionConfigToVertex() {
3792
+ const toObject = {};
3793
+ return toObject;
3794
+ }
3795
+ function automaticActivityDetectionToMldev(apiClient, fromObject) {
3796
+ const toObject = {};
3797
+ const fromDisabled = getValueByPath(fromObject, ['disabled']);
3798
+ if (fromDisabled != null) {
3799
+ setValueByPath(toObject, ['disabled'], fromDisabled);
3800
+ }
3801
+ const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
3802
+ 'startOfSpeechSensitivity',
3803
+ ]);
3804
+ if (fromStartOfSpeechSensitivity != null) {
3805
+ setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
3806
+ }
3807
+ const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
3808
+ 'endOfSpeechSensitivity',
3809
+ ]);
3810
+ if (fromEndOfSpeechSensitivity != null) {
3811
+ setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
3812
+ }
3813
+ const fromPrefixPaddingMs = getValueByPath(fromObject, [
3814
+ 'prefixPaddingMs',
3815
+ ]);
3816
+ if (fromPrefixPaddingMs != null) {
3817
+ setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
3818
+ }
3819
+ const fromSilenceDurationMs = getValueByPath(fromObject, [
3820
+ 'silenceDurationMs',
3821
+ ]);
3822
+ if (fromSilenceDurationMs != null) {
3823
+ setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
3824
+ }
3825
+ return toObject;
3826
+ }
3827
+ function automaticActivityDetectionToVertex(apiClient, fromObject) {
3828
+ const toObject = {};
3829
+ const fromDisabled = getValueByPath(fromObject, ['disabled']);
3830
+ if (fromDisabled != null) {
3831
+ setValueByPath(toObject, ['disabled'], fromDisabled);
3832
+ }
3833
+ const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
3834
+ 'startOfSpeechSensitivity',
3835
+ ]);
3836
+ if (fromStartOfSpeechSensitivity != null) {
3837
+ setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
3838
+ }
3839
+ const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
3840
+ 'endOfSpeechSensitivity',
3841
+ ]);
3842
+ if (fromEndOfSpeechSensitivity != null) {
3843
+ setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
3844
+ }
3845
+ const fromPrefixPaddingMs = getValueByPath(fromObject, [
3846
+ 'prefixPaddingMs',
3847
+ ]);
3848
+ if (fromPrefixPaddingMs != null) {
3849
+ setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
3850
+ }
3851
+ const fromSilenceDurationMs = getValueByPath(fromObject, [
3852
+ 'silenceDurationMs',
3853
+ ]);
3854
+ if (fromSilenceDurationMs != null) {
3855
+ setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
3856
+ }
3857
+ return toObject;
3858
+ }
3859
+ function realtimeInputConfigToMldev(apiClient, fromObject) {
3860
+ const toObject = {};
3861
+ const fromAutomaticActivityDetection = getValueByPath(fromObject, [
3862
+ 'automaticActivityDetection',
3863
+ ]);
3864
+ if (fromAutomaticActivityDetection != null) {
3865
+ setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(apiClient, fromAutomaticActivityDetection));
3866
+ }
3867
+ const fromActivityHandling = getValueByPath(fromObject, [
3868
+ 'activityHandling',
3869
+ ]);
3870
+ if (fromActivityHandling != null) {
3871
+ setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
3872
+ }
3873
+ const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
3874
+ if (fromTurnCoverage != null) {
3875
+ setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
3876
+ }
3877
+ return toObject;
3878
+ }
3879
+ function realtimeInputConfigToVertex(apiClient, fromObject) {
3880
+ const toObject = {};
3881
+ const fromAutomaticActivityDetection = getValueByPath(fromObject, [
3882
+ 'automaticActivityDetection',
3883
+ ]);
3884
+ if (fromAutomaticActivityDetection != null) {
3885
+ setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToVertex(apiClient, fromAutomaticActivityDetection));
3886
+ }
3887
+ const fromActivityHandling = getValueByPath(fromObject, [
3888
+ 'activityHandling',
3889
+ ]);
3890
+ if (fromActivityHandling != null) {
3891
+ setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
3892
+ }
3893
+ const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
3894
+ if (fromTurnCoverage != null) {
3895
+ setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
3896
+ }
3897
+ return toObject;
3898
+ }
3899
+ function slidingWindowToMldev(apiClient, fromObject) {
3900
+ const toObject = {};
3901
+ const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
3902
+ if (fromTargetTokens != null) {
3903
+ setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
3904
+ }
3905
+ return toObject;
3906
+ }
3907
+ function slidingWindowToVertex(apiClient, fromObject) {
3908
+ const toObject = {};
3909
+ const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
3910
+ if (fromTargetTokens != null) {
3911
+ setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
3912
+ }
3913
+ return toObject;
3914
+ }
3915
+ function contextWindowCompressionConfigToMldev(apiClient, fromObject) {
3916
+ const toObject = {};
3917
+ const fromTriggerTokens = getValueByPath(fromObject, [
3918
+ 'triggerTokens',
3919
+ ]);
3920
+ if (fromTriggerTokens != null) {
3921
+ setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
3922
+ }
3923
+ const fromSlidingWindow = getValueByPath(fromObject, [
3924
+ 'slidingWindow',
3925
+ ]);
3926
+ if (fromSlidingWindow != null) {
3927
+ setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(apiClient, fromSlidingWindow));
3928
+ }
3929
+ return toObject;
3930
+ }
3931
+ function contextWindowCompressionConfigToVertex(apiClient, fromObject) {
3932
+ const toObject = {};
3933
+ const fromTriggerTokens = getValueByPath(fromObject, [
3934
+ 'triggerTokens',
3935
+ ]);
3936
+ if (fromTriggerTokens != null) {
3937
+ setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
3938
+ }
3939
+ const fromSlidingWindow = getValueByPath(fromObject, [
3940
+ 'slidingWindow',
3941
+ ]);
3942
+ if (fromSlidingWindow != null) {
3943
+ setValueByPath(toObject, ['slidingWindow'], slidingWindowToVertex(apiClient, fromSlidingWindow));
3944
+ }
3945
+ return toObject;
3946
+ }
3947
+ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
3948
+ const toObject = {};
3949
+ const fromGenerationConfig = getValueByPath(fromObject, [
3950
+ 'generationConfig',
3951
+ ]);
3952
+ if (parentObject !== undefined && fromGenerationConfig != null) {
3953
+ setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
3954
+ }
3955
+ const fromResponseModalities = getValueByPath(fromObject, [
3956
+ 'responseModalities',
3957
+ ]);
3958
+ if (parentObject !== undefined && fromResponseModalities != null) {
3959
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
3960
+ }
3961
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
3962
+ if (parentObject !== undefined && fromTemperature != null) {
3963
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
3964
+ }
3965
+ const fromTopP = getValueByPath(fromObject, ['topP']);
3966
+ if (parentObject !== undefined && fromTopP != null) {
3967
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
3968
+ }
3969
+ const fromTopK = getValueByPath(fromObject, ['topK']);
3970
+ if (parentObject !== undefined && fromTopK != null) {
3971
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
3972
+ }
3973
+ const fromMaxOutputTokens = getValueByPath(fromObject, [
3974
+ 'maxOutputTokens',
3975
+ ]);
3976
+ if (parentObject !== undefined && fromMaxOutputTokens != null) {
3977
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
3978
+ }
3979
+ const fromMediaResolution = getValueByPath(fromObject, [
3980
+ 'mediaResolution',
3981
+ ]);
3982
+ if (parentObject !== undefined && fromMediaResolution != null) {
3983
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
3984
+ }
3985
+ const fromSeed = getValueByPath(fromObject, ['seed']);
3986
+ if (parentObject !== undefined && fromSeed != null) {
3987
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
3988
+ }
3989
+ const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
3990
+ if (parentObject !== undefined && fromSpeechConfig != null) {
3991
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], fromSpeechConfig);
3992
+ }
3993
+ const fromSystemInstruction = getValueByPath(fromObject, [
3994
+ 'systemInstruction',
3995
+ ]);
3996
+ if (parentObject !== undefined && fromSystemInstruction != null) {
3997
+ setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToMldev$1(apiClient, tContent(apiClient, fromSystemInstruction)));
3998
+ }
3999
+ const fromTools = getValueByPath(fromObject, ['tools']);
4000
+ if (parentObject !== undefined && fromTools != null) {
4001
+ if (Array.isArray(fromTools)) {
4002
+ setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4003
+ return toolToMldev$1(apiClient, tTool(apiClient, item));
4004
+ })));
4005
+ }
4006
+ else {
4007
+ setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
4008
+ }
4009
+ }
4010
+ const fromSessionResumption = getValueByPath(fromObject, [
4011
+ 'sessionResumption',
4012
+ ]);
4013
+ if (parentObject !== undefined && fromSessionResumption != null) {
4014
+ setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToMldev(apiClient, fromSessionResumption));
4015
+ }
4016
+ if (getValueByPath(fromObject, ['inputAudioTranscription']) !== undefined) {
4017
+ throw new Error('inputAudioTranscription parameter is not supported in Gemini API.');
4018
+ }
4019
+ const fromOutputAudioTranscription = getValueByPath(fromObject, [
4020
+ 'outputAudioTranscription',
4021
+ ]);
4022
+ if (parentObject !== undefined && fromOutputAudioTranscription != null) {
4023
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToMldev());
4024
+ }
4025
+ const fromRealtimeInputConfig = getValueByPath(fromObject, [
4026
+ 'realtimeInputConfig',
4027
+ ]);
4028
+ if (parentObject !== undefined && fromRealtimeInputConfig != null) {
4029
+ setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToMldev(apiClient, fromRealtimeInputConfig));
4030
+ }
4031
+ const fromContextWindowCompression = getValueByPath(fromObject, [
4032
+ 'contextWindowCompression',
4033
+ ]);
4034
+ if (parentObject !== undefined && fromContextWindowCompression != null) {
4035
+ setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToMldev(apiClient, fromContextWindowCompression));
4036
+ }
4037
+ return toObject;
4038
+ }
4039
+ function liveConnectConfigToVertex(apiClient, fromObject, parentObject) {
4040
+ const toObject = {};
4041
+ const fromGenerationConfig = getValueByPath(fromObject, [
4042
+ 'generationConfig',
4043
+ ]);
4044
+ if (parentObject !== undefined && fromGenerationConfig != null) {
4045
+ setValueByPath(parentObject, ['setup', 'generationConfig'], fromGenerationConfig);
4046
+ }
4047
+ const fromResponseModalities = getValueByPath(fromObject, [
4048
+ 'responseModalities',
4049
+ ]);
4050
+ if (parentObject !== undefined && fromResponseModalities != null) {
4051
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'responseModalities'], fromResponseModalities);
4052
+ }
4053
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
4054
+ if (parentObject !== undefined && fromTemperature != null) {
4055
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'temperature'], fromTemperature);
4056
+ }
4057
+ const fromTopP = getValueByPath(fromObject, ['topP']);
4058
+ if (parentObject !== undefined && fromTopP != null) {
4059
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topP'], fromTopP);
4060
+ }
4061
+ const fromTopK = getValueByPath(fromObject, ['topK']);
4062
+ if (parentObject !== undefined && fromTopK != null) {
4063
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'topK'], fromTopK);
4064
+ }
4065
+ const fromMaxOutputTokens = getValueByPath(fromObject, [
4066
+ 'maxOutputTokens',
4067
+ ]);
4068
+ if (parentObject !== undefined && fromMaxOutputTokens != null) {
4069
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'maxOutputTokens'], fromMaxOutputTokens);
4070
+ }
4071
+ const fromMediaResolution = getValueByPath(fromObject, [
4072
+ 'mediaResolution',
4073
+ ]);
4074
+ if (parentObject !== undefined && fromMediaResolution != null) {
4075
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'mediaResolution'], fromMediaResolution);
4076
+ }
4077
+ const fromSeed = getValueByPath(fromObject, ['seed']);
4078
+ if (parentObject !== undefined && fromSeed != null) {
4079
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'seed'], fromSeed);
4080
+ }
4081
+ const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
4082
+ if (parentObject !== undefined && fromSpeechConfig != null) {
4083
+ setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], fromSpeechConfig);
4084
+ }
4085
+ const fromSystemInstruction = getValueByPath(fromObject, [
4086
+ 'systemInstruction',
4087
+ ]);
4088
+ if (parentObject !== undefined && fromSystemInstruction != null) {
4089
+ setValueByPath(parentObject, ['setup', 'systemInstruction'], contentToVertex$1(apiClient, tContent(apiClient, fromSystemInstruction)));
4090
+ }
4091
+ const fromTools = getValueByPath(fromObject, ['tools']);
4092
+ if (parentObject !== undefined && fromTools != null) {
4093
+ if (Array.isArray(fromTools)) {
4094
+ setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4095
+ return toolToVertex$1(apiClient, tTool(apiClient, item));
4096
+ })));
4097
+ }
4098
+ else {
4099
+ setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
4100
+ }
4101
+ }
4102
+ const fromSessionResumption = getValueByPath(fromObject, [
4103
+ 'sessionResumption',
4104
+ ]);
4105
+ if (parentObject !== undefined && fromSessionResumption != null) {
4106
+ setValueByPath(parentObject, ['setup', 'sessionResumption'], sessionResumptionConfigToVertex(apiClient, fromSessionResumption));
4107
+ }
4108
+ const fromInputAudioTranscription = getValueByPath(fromObject, [
4109
+ 'inputAudioTranscription',
4110
+ ]);
4111
+ if (parentObject !== undefined && fromInputAudioTranscription != null) {
4112
+ setValueByPath(parentObject, ['setup', 'inputAudioTranscription'], audioTranscriptionConfigToVertex());
4113
+ }
4114
+ const fromOutputAudioTranscription = getValueByPath(fromObject, [
4115
+ 'outputAudioTranscription',
4116
+ ]);
4117
+ if (parentObject !== undefined && fromOutputAudioTranscription != null) {
4118
+ setValueByPath(parentObject, ['setup', 'outputAudioTranscription'], audioTranscriptionConfigToVertex());
4119
+ }
4120
+ const fromRealtimeInputConfig = getValueByPath(fromObject, [
4121
+ 'realtimeInputConfig',
4122
+ ]);
4123
+ if (parentObject !== undefined && fromRealtimeInputConfig != null) {
4124
+ setValueByPath(parentObject, ['setup', 'realtimeInputConfig'], realtimeInputConfigToVertex(apiClient, fromRealtimeInputConfig));
4125
+ }
4126
+ const fromContextWindowCompression = getValueByPath(fromObject, [
4127
+ 'contextWindowCompression',
4128
+ ]);
4129
+ if (parentObject !== undefined && fromContextWindowCompression != null) {
4130
+ setValueByPath(parentObject, ['setup', 'contextWindowCompression'], contextWindowCompressionConfigToVertex(apiClient, fromContextWindowCompression));
4131
+ }
4132
+ return toObject;
4133
+ }
4134
+ function liveConnectParametersToMldev(apiClient, fromObject) {
4135
+ const toObject = {};
4136
+ const fromModel = getValueByPath(fromObject, ['model']);
4137
+ if (fromModel != null) {
4138
+ setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
4139
+ }
4140
+ const fromConfig = getValueByPath(fromObject, ['config']);
4141
+ if (fromConfig != null) {
4142
+ setValueByPath(toObject, ['config'], liveConnectConfigToMldev(apiClient, fromConfig, toObject));
4143
+ }
4144
+ return toObject;
4145
+ }
4146
+ function liveConnectParametersToVertex(apiClient, fromObject) {
4147
+ const toObject = {};
4148
+ const fromModel = getValueByPath(fromObject, ['model']);
4149
+ if (fromModel != null) {
4150
+ setValueByPath(toObject, ['setup', 'model'], tModel(apiClient, fromModel));
4151
+ }
4152
+ const fromConfig = getValueByPath(fromObject, ['config']);
4153
+ if (fromConfig != null) {
4154
+ setValueByPath(toObject, ['config'], liveConnectConfigToVertex(apiClient, fromConfig, toObject));
4155
+ }
4156
+ return toObject;
4157
+ }
4158
+ function liveServerSetupCompleteFromMldev() {
4159
+ const toObject = {};
4160
+ return toObject;
4161
+ }
4162
+ function liveServerSetupCompleteFromVertex() {
4163
+ const toObject = {};
4164
+ return toObject;
4165
+ }
4166
+ function partFromMldev$1(apiClient, fromObject) {
4167
+ const toObject = {};
4168
+ const fromThought = getValueByPath(fromObject, ['thought']);
4169
+ if (fromThought != null) {
4170
+ setValueByPath(toObject, ['thought'], fromThought);
4171
+ }
4172
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
4173
+ 'codeExecutionResult',
4174
+ ]);
4175
+ if (fromCodeExecutionResult != null) {
4176
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
4177
+ }
4178
+ const fromExecutableCode = getValueByPath(fromObject, [
4179
+ 'executableCode',
4180
+ ]);
4181
+ if (fromExecutableCode != null) {
4182
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4183
+ }
4184
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
4185
+ if (fromFileData != null) {
4186
+ setValueByPath(toObject, ['fileData'], fromFileData);
4187
+ }
4188
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4189
+ if (fromFunctionCall != null) {
4190
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4191
+ }
4192
+ const fromFunctionResponse = getValueByPath(fromObject, [
4193
+ 'functionResponse',
4194
+ ]);
4195
+ if (fromFunctionResponse != null) {
4196
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4197
+ }
4198
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4199
+ if (fromInlineData != null) {
4200
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
4201
+ }
4202
+ const fromText = getValueByPath(fromObject, ['text']);
4203
+ if (fromText != null) {
4204
+ setValueByPath(toObject, ['text'], fromText);
4205
+ }
4206
+ return toObject;
4207
+ }
4208
+ function partFromVertex$1(apiClient, fromObject) {
4209
+ const toObject = {};
4210
+ const fromVideoMetadata = getValueByPath(fromObject, [
4211
+ 'videoMetadata',
4212
+ ]);
4213
+ if (fromVideoMetadata != null) {
4214
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4215
+ }
4216
+ const fromThought = getValueByPath(fromObject, ['thought']);
4217
+ if (fromThought != null) {
4218
+ setValueByPath(toObject, ['thought'], fromThought);
4219
+ }
4220
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
4221
+ 'codeExecutionResult',
4222
+ ]);
4223
+ if (fromCodeExecutionResult != null) {
4224
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
4225
+ }
4226
+ const fromExecutableCode = getValueByPath(fromObject, [
4227
+ 'executableCode',
4228
+ ]);
4229
+ if (fromExecutableCode != null) {
4230
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4231
+ }
4232
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
4233
+ if (fromFileData != null) {
4234
+ setValueByPath(toObject, ['fileData'], fromFileData);
4235
+ }
4236
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4237
+ if (fromFunctionCall != null) {
4238
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4239
+ }
4240
+ const fromFunctionResponse = getValueByPath(fromObject, [
4241
+ 'functionResponse',
4242
+ ]);
4243
+ if (fromFunctionResponse != null) {
4244
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4245
+ }
4246
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4247
+ if (fromInlineData != null) {
4248
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
4249
+ }
4250
+ const fromText = getValueByPath(fromObject, ['text']);
4251
+ if (fromText != null) {
4252
+ setValueByPath(toObject, ['text'], fromText);
4253
+ }
4254
+ return toObject;
4255
+ }
4256
+ function contentFromMldev$1(apiClient, fromObject) {
4257
+ const toObject = {};
4258
+ const fromParts = getValueByPath(fromObject, ['parts']);
4259
+ if (fromParts != null) {
4260
+ if (Array.isArray(fromParts)) {
4261
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4262
+ return partFromMldev$1(apiClient, item);
4263
+ }));
4264
+ }
4265
+ else {
4266
+ setValueByPath(toObject, ['parts'], fromParts);
4267
+ }
4268
+ }
4269
+ const fromRole = getValueByPath(fromObject, ['role']);
4270
+ if (fromRole != null) {
4271
+ setValueByPath(toObject, ['role'], fromRole);
4272
+ }
4273
+ return toObject;
4274
+ }
4275
+ function contentFromVertex$1(apiClient, fromObject) {
4276
+ const toObject = {};
4277
+ const fromParts = getValueByPath(fromObject, ['parts']);
4278
+ if (fromParts != null) {
4279
+ if (Array.isArray(fromParts)) {
4280
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4281
+ return partFromVertex$1(apiClient, item);
4282
+ }));
4283
+ }
4284
+ else {
4285
+ setValueByPath(toObject, ['parts'], fromParts);
4286
+ }
4287
+ }
4288
+ const fromRole = getValueByPath(fromObject, ['role']);
4289
+ if (fromRole != null) {
4290
+ setValueByPath(toObject, ['role'], fromRole);
4291
+ }
4292
+ return toObject;
4293
+ }
4294
+ function transcriptionFromMldev(apiClient, fromObject) {
4295
+ const toObject = {};
4296
+ const fromText = getValueByPath(fromObject, ['text']);
4297
+ if (fromText != null) {
4298
+ setValueByPath(toObject, ['text'], fromText);
4299
+ }
4300
+ const fromFinished = getValueByPath(fromObject, ['finished']);
4301
+ if (fromFinished != null) {
4302
+ setValueByPath(toObject, ['finished'], fromFinished);
4303
+ }
4304
+ return toObject;
4305
+ }
4306
+ function transcriptionFromVertex(apiClient, fromObject) {
4307
+ const toObject = {};
4308
+ const fromText = getValueByPath(fromObject, ['text']);
4309
+ if (fromText != null) {
4310
+ setValueByPath(toObject, ['text'], fromText);
4311
+ }
4312
+ const fromFinished = getValueByPath(fromObject, ['finished']);
4313
+ if (fromFinished != null) {
4314
+ setValueByPath(toObject, ['finished'], fromFinished);
4315
+ }
4316
+ return toObject;
4317
+ }
4318
+ function liveServerContentFromMldev(apiClient, fromObject) {
4319
+ const toObject = {};
4320
+ const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
4321
+ if (fromModelTurn != null) {
4322
+ setValueByPath(toObject, ['modelTurn'], contentFromMldev$1(apiClient, fromModelTurn));
4323
+ }
4324
+ const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
4325
+ if (fromTurnComplete != null) {
4326
+ setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
4327
+ }
4328
+ const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
4329
+ if (fromInterrupted != null) {
4330
+ setValueByPath(toObject, ['interrupted'], fromInterrupted);
4331
+ }
4332
+ const fromGenerationComplete = getValueByPath(fromObject, [
4333
+ 'generationComplete',
4334
+ ]);
4335
+ if (fromGenerationComplete != null) {
4336
+ setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
4337
+ }
4338
+ const fromInputTranscription = getValueByPath(fromObject, [
4339
+ 'inputTranscription',
4340
+ ]);
4341
+ if (fromInputTranscription != null) {
4342
+ setValueByPath(toObject, ['inputTranscription'], transcriptionFromMldev(apiClient, fromInputTranscription));
4343
+ }
4344
+ const fromOutputTranscription = getValueByPath(fromObject, [
4345
+ 'outputTranscription',
4346
+ ]);
4347
+ if (fromOutputTranscription != null) {
4348
+ setValueByPath(toObject, ['outputTranscription'], transcriptionFromMldev(apiClient, fromOutputTranscription));
4349
+ }
4350
+ return toObject;
4351
+ }
4352
+ function liveServerContentFromVertex(apiClient, fromObject) {
4353
+ const toObject = {};
4354
+ const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
4355
+ if (fromModelTurn != null) {
4356
+ setValueByPath(toObject, ['modelTurn'], contentFromVertex$1(apiClient, fromModelTurn));
4357
+ }
4358
+ const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
4359
+ if (fromTurnComplete != null) {
4360
+ setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
4361
+ }
4362
+ const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
4363
+ if (fromInterrupted != null) {
4364
+ setValueByPath(toObject, ['interrupted'], fromInterrupted);
4365
+ }
4366
+ const fromGenerationComplete = getValueByPath(fromObject, [
4367
+ 'generationComplete',
4368
+ ]);
4369
+ if (fromGenerationComplete != null) {
4370
+ setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
4371
+ }
4372
+ const fromInputTranscription = getValueByPath(fromObject, [
4373
+ 'inputTranscription',
4374
+ ]);
4375
+ if (fromInputTranscription != null) {
4376
+ setValueByPath(toObject, ['inputTranscription'], transcriptionFromVertex(apiClient, fromInputTranscription));
4377
+ }
4378
+ const fromOutputTranscription = getValueByPath(fromObject, [
4379
+ 'outputTranscription',
4380
+ ]);
4381
+ if (fromOutputTranscription != null) {
4382
+ setValueByPath(toObject, ['outputTranscription'], transcriptionFromVertex(apiClient, fromOutputTranscription));
4383
+ }
4384
+ return toObject;
4385
+ }
4386
+ function functionCallFromMldev(apiClient, fromObject) {
4387
+ const toObject = {};
4388
+ const fromId = getValueByPath(fromObject, ['id']);
4389
+ if (fromId != null) {
4390
+ setValueByPath(toObject, ['id'], fromId);
4391
+ }
4392
+ const fromArgs = getValueByPath(fromObject, ['args']);
4393
+ if (fromArgs != null) {
4394
+ setValueByPath(toObject, ['args'], fromArgs);
4395
+ }
4396
+ const fromName = getValueByPath(fromObject, ['name']);
4397
+ if (fromName != null) {
4398
+ setValueByPath(toObject, ['name'], fromName);
4399
+ }
4400
+ return toObject;
4401
+ }
4402
+ function functionCallFromVertex(apiClient, fromObject) {
4403
+ const toObject = {};
4404
+ const fromArgs = getValueByPath(fromObject, ['args']);
4405
+ if (fromArgs != null) {
4406
+ setValueByPath(toObject, ['args'], fromArgs);
4407
+ }
4408
+ const fromName = getValueByPath(fromObject, ['name']);
4409
+ if (fromName != null) {
4410
+ setValueByPath(toObject, ['name'], fromName);
4411
+ }
4412
+ return toObject;
4413
+ }
4414
+ function liveServerToolCallFromMldev(apiClient, fromObject) {
4415
+ const toObject = {};
4416
+ const fromFunctionCalls = getValueByPath(fromObject, [
4417
+ 'functionCalls',
4418
+ ]);
4419
+ if (fromFunctionCalls != null) {
4420
+ if (Array.isArray(fromFunctionCalls)) {
4421
+ setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4422
+ return functionCallFromMldev(apiClient, item);
4423
+ }));
4424
+ }
4425
+ else {
4426
+ setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4427
+ }
4428
+ }
4429
+ return toObject;
4430
+ }
4431
+ function liveServerToolCallFromVertex(apiClient, fromObject) {
4432
+ const toObject = {};
4433
+ const fromFunctionCalls = getValueByPath(fromObject, [
4434
+ 'functionCalls',
4435
+ ]);
4436
+ if (fromFunctionCalls != null) {
4437
+ if (Array.isArray(fromFunctionCalls)) {
4438
+ setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4439
+ return functionCallFromVertex(apiClient, item);
4440
+ }));
4441
+ }
4442
+ else {
4443
+ setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4444
+ }
4445
+ }
4446
+ return toObject;
4447
+ }
4448
+ function liveServerToolCallCancellationFromMldev(apiClient, fromObject) {
4449
+ const toObject = {};
4450
+ const fromIds = getValueByPath(fromObject, ['ids']);
4451
+ if (fromIds != null) {
4452
+ setValueByPath(toObject, ['ids'], fromIds);
4453
+ }
4454
+ return toObject;
4455
+ }
4456
+ function liveServerToolCallCancellationFromVertex(apiClient, fromObject) {
4457
+ const toObject = {};
4458
+ const fromIds = getValueByPath(fromObject, ['ids']);
4459
+ if (fromIds != null) {
4460
+ setValueByPath(toObject, ['ids'], fromIds);
4461
+ }
4462
+ return toObject;
4463
+ }
4464
+ function modalityTokenCountFromMldev(apiClient, fromObject) {
4465
+ const toObject = {};
4466
+ const fromModality = getValueByPath(fromObject, ['modality']);
4467
+ if (fromModality != null) {
4468
+ setValueByPath(toObject, ['modality'], fromModality);
4469
+ }
4470
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
4471
+ if (fromTokenCount != null) {
4472
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
4473
+ }
4474
+ return toObject;
4475
+ }
4476
+ function modalityTokenCountFromVertex(apiClient, fromObject) {
4477
+ const toObject = {};
4478
+ const fromModality = getValueByPath(fromObject, ['modality']);
4479
+ if (fromModality != null) {
4480
+ setValueByPath(toObject, ['modality'], fromModality);
4481
+ }
4482
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
4483
+ if (fromTokenCount != null) {
4484
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
4485
+ }
4486
+ return toObject;
4487
+ }
4488
+ function usageMetadataFromMldev(apiClient, fromObject) {
4489
+ const toObject = {};
4490
+ const fromPromptTokenCount = getValueByPath(fromObject, [
4491
+ 'promptTokenCount',
4492
+ ]);
4493
+ if (fromPromptTokenCount != null) {
4494
+ setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
4495
+ }
4496
+ const fromCachedContentTokenCount = getValueByPath(fromObject, [
4497
+ 'cachedContentTokenCount',
4498
+ ]);
4499
+ if (fromCachedContentTokenCount != null) {
4500
+ setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
4501
+ }
4502
+ const fromResponseTokenCount = getValueByPath(fromObject, [
4503
+ 'responseTokenCount',
4504
+ ]);
4505
+ if (fromResponseTokenCount != null) {
4506
+ setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
4507
+ }
4508
+ const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
4509
+ 'toolUsePromptTokenCount',
4510
+ ]);
4511
+ if (fromToolUsePromptTokenCount != null) {
4512
+ setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
4513
+ }
4514
+ const fromThoughtsTokenCount = getValueByPath(fromObject, [
4515
+ 'thoughtsTokenCount',
4516
+ ]);
4517
+ if (fromThoughtsTokenCount != null) {
4518
+ setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
4519
+ }
4520
+ const fromTotalTokenCount = getValueByPath(fromObject, [
4521
+ 'totalTokenCount',
4522
+ ]);
4523
+ if (fromTotalTokenCount != null) {
4524
+ setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
4525
+ }
4526
+ const fromPromptTokensDetails = getValueByPath(fromObject, [
4527
+ 'promptTokensDetails',
4528
+ ]);
4529
+ if (fromPromptTokensDetails != null) {
4530
+ if (Array.isArray(fromPromptTokensDetails)) {
4531
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
4532
+ return modalityTokenCountFromMldev(apiClient, item);
4533
+ }));
4534
+ }
4535
+ else {
4536
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
4537
+ }
4538
+ }
4539
+ const fromCacheTokensDetails = getValueByPath(fromObject, [
4540
+ 'cacheTokensDetails',
4541
+ ]);
4542
+ if (fromCacheTokensDetails != null) {
4543
+ if (Array.isArray(fromCacheTokensDetails)) {
4544
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
4545
+ return modalityTokenCountFromMldev(apiClient, item);
4546
+ }));
4547
+ }
4548
+ else {
4549
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
4550
+ }
4551
+ }
4552
+ const fromResponseTokensDetails = getValueByPath(fromObject, [
4553
+ 'responseTokensDetails',
4554
+ ]);
4555
+ if (fromResponseTokensDetails != null) {
4556
+ if (Array.isArray(fromResponseTokensDetails)) {
4557
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
4558
+ return modalityTokenCountFromMldev(apiClient, item);
4559
+ }));
4560
+ }
4561
+ else {
4562
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
4563
+ }
4564
+ }
4565
+ const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
4566
+ 'toolUsePromptTokensDetails',
4567
+ ]);
4568
+ if (fromToolUsePromptTokensDetails != null) {
4569
+ if (Array.isArray(fromToolUsePromptTokensDetails)) {
4570
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
4571
+ return modalityTokenCountFromMldev(apiClient, item);
4572
+ }));
4573
+ }
4574
+ else {
4575
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
4576
+ }
4577
+ }
4578
+ return toObject;
4579
+ }
4580
+ function usageMetadataFromVertex(apiClient, fromObject) {
4581
+ const toObject = {};
4582
+ const fromPromptTokenCount = getValueByPath(fromObject, [
4583
+ 'promptTokenCount',
4584
+ ]);
4585
+ if (fromPromptTokenCount != null) {
4586
+ setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
4587
+ }
4588
+ const fromCachedContentTokenCount = getValueByPath(fromObject, [
4589
+ 'cachedContentTokenCount',
4590
+ ]);
4591
+ if (fromCachedContentTokenCount != null) {
4592
+ setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
4593
+ }
4594
+ const fromResponseTokenCount = getValueByPath(fromObject, [
4595
+ 'candidatesTokenCount',
4596
+ ]);
4597
+ if (fromResponseTokenCount != null) {
4598
+ setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
4599
+ }
4600
+ const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
4601
+ 'toolUsePromptTokenCount',
4602
+ ]);
4603
+ if (fromToolUsePromptTokenCount != null) {
4604
+ setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
4605
+ }
4606
+ const fromThoughtsTokenCount = getValueByPath(fromObject, [
4607
+ 'thoughtsTokenCount',
4608
+ ]);
4609
+ if (fromThoughtsTokenCount != null) {
4610
+ setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
4611
+ }
4612
+ const fromTotalTokenCount = getValueByPath(fromObject, [
4613
+ 'totalTokenCount',
4614
+ ]);
4615
+ if (fromTotalTokenCount != null) {
4616
+ setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
4617
+ }
4618
+ const fromPromptTokensDetails = getValueByPath(fromObject, [
4619
+ 'promptTokensDetails',
4620
+ ]);
4621
+ if (fromPromptTokensDetails != null) {
4622
+ if (Array.isArray(fromPromptTokensDetails)) {
4623
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
4624
+ return modalityTokenCountFromVertex(apiClient, item);
4625
+ }));
4626
+ }
4627
+ else {
4628
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
4629
+ }
4630
+ }
4631
+ const fromCacheTokensDetails = getValueByPath(fromObject, [
4632
+ 'cacheTokensDetails',
4633
+ ]);
4634
+ if (fromCacheTokensDetails != null) {
4635
+ if (Array.isArray(fromCacheTokensDetails)) {
4636
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
4637
+ return modalityTokenCountFromVertex(apiClient, item);
4638
+ }));
4639
+ }
4640
+ else {
4641
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
4642
+ }
4643
+ }
4644
+ const fromResponseTokensDetails = getValueByPath(fromObject, [
4645
+ 'candidatesTokensDetails',
4646
+ ]);
4647
+ if (fromResponseTokensDetails != null) {
4648
+ if (Array.isArray(fromResponseTokensDetails)) {
4649
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
4650
+ return modalityTokenCountFromVertex(apiClient, item);
4651
+ }));
4652
+ }
4653
+ else {
4654
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
4655
+ }
4656
+ }
4657
+ const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
4658
+ 'toolUsePromptTokensDetails',
4659
+ ]);
4660
+ if (fromToolUsePromptTokensDetails != null) {
4661
+ if (Array.isArray(fromToolUsePromptTokensDetails)) {
4662
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
4663
+ return modalityTokenCountFromVertex(apiClient, item);
4664
+ }));
4665
+ }
4666
+ else {
4667
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
4668
+ }
4669
+ }
4670
+ const fromTrafficType = getValueByPath(fromObject, ['trafficType']);
4671
+ if (fromTrafficType != null) {
4672
+ setValueByPath(toObject, ['trafficType'], fromTrafficType);
4673
+ }
4674
+ return toObject;
4675
+ }
4676
+ function liveServerGoAwayFromMldev(apiClient, fromObject) {
4677
+ const toObject = {};
4678
+ const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
4679
+ if (fromTimeLeft != null) {
4680
+ setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
4681
+ }
4682
+ return toObject;
4683
+ }
4684
+ function liveServerGoAwayFromVertex(apiClient, fromObject) {
4685
+ const toObject = {};
4686
+ const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
4687
+ if (fromTimeLeft != null) {
4688
+ setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
4689
+ }
4690
+ return toObject;
4691
+ }
4692
+ function liveServerSessionResumptionUpdateFromMldev(apiClient, fromObject) {
4693
+ const toObject = {};
4694
+ const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
4695
+ if (fromNewHandle != null) {
4696
+ setValueByPath(toObject, ['newHandle'], fromNewHandle);
4697
+ }
4698
+ const fromResumable = getValueByPath(fromObject, ['resumable']);
4699
+ if (fromResumable != null) {
4700
+ setValueByPath(toObject, ['resumable'], fromResumable);
4701
+ }
4702
+ const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
4703
+ 'lastConsumedClientMessageIndex',
4704
+ ]);
4705
+ if (fromLastConsumedClientMessageIndex != null) {
4706
+ setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
4707
+ }
4708
+ return toObject;
4709
+ }
4710
+ function liveServerSessionResumptionUpdateFromVertex(apiClient, fromObject) {
4711
+ const toObject = {};
4712
+ const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
4713
+ if (fromNewHandle != null) {
4714
+ setValueByPath(toObject, ['newHandle'], fromNewHandle);
4715
+ }
4716
+ const fromResumable = getValueByPath(fromObject, ['resumable']);
4717
+ if (fromResumable != null) {
4718
+ setValueByPath(toObject, ['resumable'], fromResumable);
4719
+ }
4720
+ const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
4721
+ 'lastConsumedClientMessageIndex',
4722
+ ]);
4723
+ if (fromLastConsumedClientMessageIndex != null) {
4724
+ setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
4725
+ }
4726
+ return toObject;
4727
+ }
4728
+ function liveServerMessageFromMldev(apiClient, fromObject) {
4729
+ const toObject = {};
4730
+ const fromSetupComplete = getValueByPath(fromObject, [
4731
+ 'setupComplete',
4732
+ ]);
4733
+ if (fromSetupComplete != null) {
4734
+ setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromMldev());
4735
+ }
4736
+ const fromServerContent = getValueByPath(fromObject, [
4737
+ 'serverContent',
4738
+ ]);
4739
+ if (fromServerContent != null) {
4740
+ setValueByPath(toObject, ['serverContent'], liveServerContentFromMldev(apiClient, fromServerContent));
4741
+ }
4742
+ const fromToolCall = getValueByPath(fromObject, ['toolCall']);
4743
+ if (fromToolCall != null) {
4744
+ setValueByPath(toObject, ['toolCall'], liveServerToolCallFromMldev(apiClient, fromToolCall));
4745
+ }
4746
+ const fromToolCallCancellation = getValueByPath(fromObject, [
4747
+ 'toolCallCancellation',
4748
+ ]);
4749
+ if (fromToolCallCancellation != null) {
4750
+ setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromMldev(apiClient, fromToolCallCancellation));
4751
+ }
4752
+ const fromUsageMetadata = getValueByPath(fromObject, [
4753
+ 'usageMetadata',
4754
+ ]);
4755
+ if (fromUsageMetadata != null) {
4756
+ setValueByPath(toObject, ['usageMetadata'], usageMetadataFromMldev(apiClient, fromUsageMetadata));
4757
+ }
4758
+ const fromGoAway = getValueByPath(fromObject, ['goAway']);
4759
+ if (fromGoAway != null) {
4760
+ setValueByPath(toObject, ['goAway'], liveServerGoAwayFromMldev(apiClient, fromGoAway));
4761
+ }
4762
+ const fromSessionResumptionUpdate = getValueByPath(fromObject, [
4763
+ 'sessionResumptionUpdate',
4764
+ ]);
4765
+ if (fromSessionResumptionUpdate != null) {
4766
+ setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromMldev(apiClient, fromSessionResumptionUpdate));
4767
+ }
4768
+ return toObject;
4769
+ }
4770
+ function liveServerMessageFromVertex(apiClient, fromObject) {
4771
+ const toObject = {};
4772
+ const fromSetupComplete = getValueByPath(fromObject, [
4773
+ 'setupComplete',
4774
+ ]);
4775
+ if (fromSetupComplete != null) {
4776
+ setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex());
4777
+ }
4778
+ const fromServerContent = getValueByPath(fromObject, [
4779
+ 'serverContent',
4780
+ ]);
4781
+ if (fromServerContent != null) {
4782
+ setValueByPath(toObject, ['serverContent'], liveServerContentFromVertex(apiClient, fromServerContent));
4783
+ }
4784
+ const fromToolCall = getValueByPath(fromObject, ['toolCall']);
4785
+ if (fromToolCall != null) {
4786
+ setValueByPath(toObject, ['toolCall'], liveServerToolCallFromVertex(apiClient, fromToolCall));
4787
+ }
4788
+ const fromToolCallCancellation = getValueByPath(fromObject, [
4789
+ 'toolCallCancellation',
4790
+ ]);
4791
+ if (fromToolCallCancellation != null) {
4792
+ setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromVertex(apiClient, fromToolCallCancellation));
4793
+ }
4794
+ const fromUsageMetadata = getValueByPath(fromObject, [
4795
+ 'usageMetadata',
4796
+ ]);
4797
+ if (fromUsageMetadata != null) {
4798
+ setValueByPath(toObject, ['usageMetadata'], usageMetadataFromVertex(apiClient, fromUsageMetadata));
4799
+ }
4800
+ const fromGoAway = getValueByPath(fromObject, ['goAway']);
4801
+ if (fromGoAway != null) {
4802
+ setValueByPath(toObject, ['goAway'], liveServerGoAwayFromVertex(apiClient, fromGoAway));
4803
+ }
4804
+ const fromSessionResumptionUpdate = getValueByPath(fromObject, [
4805
+ 'sessionResumptionUpdate',
4806
+ ]);
4807
+ if (fromSessionResumptionUpdate != null) {
4808
+ setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromVertex(apiClient, fromSessionResumptionUpdate));
4809
+ }
4810
+ return toObject;
4811
+ }
4812
+
4813
+ /**
4814
+ * @license
4815
+ * Copyright 2025 Google LLC
4816
+ * SPDX-License-Identifier: Apache-2.0
4817
+ */
4818
+ function partToMldev(apiClient, fromObject) {
4819
+ const toObject = {};
4820
+ if (getValueByPath(fromObject, ['videoMetadata']) !== undefined) {
4821
+ throw new Error('videoMetadata parameter is not supported in Gemini API.');
4822
+ }
4823
+ const fromThought = getValueByPath(fromObject, ['thought']);
4824
+ if (fromThought != null) {
4825
+ setValueByPath(toObject, ['thought'], fromThought);
4826
+ }
4827
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
4828
+ 'codeExecutionResult',
4829
+ ]);
4830
+ if (fromCodeExecutionResult != null) {
4831
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
4832
+ }
4833
+ const fromExecutableCode = getValueByPath(fromObject, [
4834
+ 'executableCode',
4835
+ ]);
4836
+ if (fromExecutableCode != null) {
4837
+ setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4838
+ }
4839
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
4840
+ if (fromFileData != null) {
4841
+ setValueByPath(toObject, ['fileData'], fromFileData);
4842
+ }
4843
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4844
+ if (fromFunctionCall != null) {
4845
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
4846
+ }
4847
+ const fromFunctionResponse = getValueByPath(fromObject, [
4848
+ 'functionResponse',
4849
+ ]);
4850
+ if (fromFunctionResponse != null) {
4851
+ setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4852
+ }
4853
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4854
+ if (fromInlineData != null) {
4855
+ setValueByPath(toObject, ['inlineData'], fromInlineData);
4856
+ }
4857
+ const fromText = getValueByPath(fromObject, ['text']);
4858
+ if (fromText != null) {
4859
+ setValueByPath(toObject, ['text'], fromText);
4860
+ }
4861
+ return toObject;
4862
+ }
4863
+ function contentToMldev(apiClient, fromObject) {
4864
+ const toObject = {};
4865
+ const fromParts = getValueByPath(fromObject, ['parts']);
4866
+ if (fromParts != null) {
4867
+ if (Array.isArray(fromParts)) {
4868
+ setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4869
+ return partToMldev(apiClient, item);
4870
+ }));
4871
+ }
4872
+ else {
4873
+ setValueByPath(toObject, ['parts'], fromParts);
4874
+ }
4875
+ }
4876
+ const fromRole = getValueByPath(fromObject, ['role']);
4877
+ if (fromRole != null) {
4878
+ setValueByPath(toObject, ['role'], fromRole);
4879
+ }
4880
+ return toObject;
4881
+ }
4882
+ function schemaToMldev(apiClient, fromObject) {
4883
+ const toObject = {};
4884
+ if (getValueByPath(fromObject, ['example']) !== undefined) {
4885
+ throw new Error('example parameter is not supported in Gemini API.');
4886
+ }
4887
+ if (getValueByPath(fromObject, ['pattern']) !== undefined) {
4888
+ throw new Error('pattern parameter is not supported in Gemini API.');
4889
+ }
4890
+ if (getValueByPath(fromObject, ['default']) !== undefined) {
4891
+ throw new Error('default parameter is not supported in Gemini API.');
4892
+ }
4893
+ if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
4894
+ throw new Error('maxLength parameter is not supported in Gemini API.');
4895
+ }
4896
+ if (getValueByPath(fromObject, ['minLength']) !== undefined) {
4897
+ throw new Error('minLength parameter is not supported in Gemini API.');
4898
+ }
4899
+ if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
4900
+ throw new Error('minProperties parameter is not supported in Gemini API.');
4901
+ }
4902
+ if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
4903
+ throw new Error('maxProperties parameter is not supported in Gemini API.');
4904
+ }
4905
+ const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
4906
+ if (fromAnyOf != null) {
4907
+ setValueByPath(toObject, ['anyOf'], fromAnyOf);
4908
+ }
4909
+ const fromDescription = getValueByPath(fromObject, ['description']);
4910
+ if (fromDescription != null) {
4911
+ setValueByPath(toObject, ['description'], fromDescription);
4912
+ }
4913
+ const fromEnum = getValueByPath(fromObject, ['enum']);
4914
+ if (fromEnum != null) {
4915
+ setValueByPath(toObject, ['enum'], fromEnum);
4916
+ }
4917
+ const fromFormat = getValueByPath(fromObject, ['format']);
4918
+ if (fromFormat != null) {
4919
+ setValueByPath(toObject, ['format'], fromFormat);
4920
+ }
4921
+ const fromItems = getValueByPath(fromObject, ['items']);
4922
+ if (fromItems != null) {
4923
+ setValueByPath(toObject, ['items'], fromItems);
4924
+ }
4925
+ const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
4926
+ if (fromMaxItems != null) {
4927
+ setValueByPath(toObject, ['maxItems'], fromMaxItems);
4928
+ }
4929
+ const fromMaximum = getValueByPath(fromObject, ['maximum']);
4930
+ if (fromMaximum != null) {
4931
+ setValueByPath(toObject, ['maximum'], fromMaximum);
4932
+ }
4933
+ const fromMinItems = getValueByPath(fromObject, ['minItems']);
4934
+ if (fromMinItems != null) {
4935
+ setValueByPath(toObject, ['minItems'], fromMinItems);
4936
+ }
4937
+ const fromMinimum = getValueByPath(fromObject, ['minimum']);
4938
+ if (fromMinimum != null) {
4939
+ setValueByPath(toObject, ['minimum'], fromMinimum);
4940
+ }
4941
+ const fromNullable = getValueByPath(fromObject, ['nullable']);
4942
+ if (fromNullable != null) {
4943
+ setValueByPath(toObject, ['nullable'], fromNullable);
4944
+ }
4945
+ const fromProperties = getValueByPath(fromObject, ['properties']);
4946
+ if (fromProperties != null) {
4947
+ setValueByPath(toObject, ['properties'], fromProperties);
4948
+ }
4949
+ const fromPropertyOrdering = getValueByPath(fromObject, [
4950
+ 'propertyOrdering',
4951
+ ]);
4952
+ if (fromPropertyOrdering != null) {
4953
+ setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
4954
+ }
4955
+ const fromRequired = getValueByPath(fromObject, ['required']);
4956
+ if (fromRequired != null) {
4957
+ setValueByPath(toObject, ['required'], fromRequired);
4958
+ }
4959
+ const fromTitle = getValueByPath(fromObject, ['title']);
4960
+ if (fromTitle != null) {
4961
+ setValueByPath(toObject, ['title'], fromTitle);
4962
+ }
4963
+ const fromType = getValueByPath(fromObject, ['type']);
4964
+ if (fromType != null) {
4965
+ setValueByPath(toObject, ['type'], fromType);
4966
+ }
4967
+ return toObject;
4968
+ }
4969
+ function safetySettingToMldev(apiClient, fromObject) {
4970
+ const toObject = {};
4971
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
4972
+ throw new Error('method parameter is not supported in Gemini API.');
4973
+ }
4974
+ const fromCategory = getValueByPath(fromObject, ['category']);
4975
+ if (fromCategory != null) {
4976
+ setValueByPath(toObject, ['category'], fromCategory);
4977
+ }
4978
+ const fromThreshold = getValueByPath(fromObject, ['threshold']);
4979
+ if (fromThreshold != null) {
4980
+ setValueByPath(toObject, ['threshold'], fromThreshold);
4981
+ }
4982
+ return toObject;
4983
+ }
4984
+ function functionDeclarationToMldev(apiClient, fromObject) {
4985
+ const toObject = {};
4986
+ if (getValueByPath(fromObject, ['response']) !== undefined) {
4987
+ throw new Error('response parameter is not supported in Gemini API.');
4988
+ }
4989
+ const fromDescription = getValueByPath(fromObject, ['description']);
4990
+ if (fromDescription != null) {
4991
+ setValueByPath(toObject, ['description'], fromDescription);
4992
+ }
4993
+ const fromName = getValueByPath(fromObject, ['name']);
4994
+ if (fromName != null) {
4995
+ setValueByPath(toObject, ['name'], fromName);
4996
+ }
4997
+ const fromParameters = getValueByPath(fromObject, ['parameters']);
4998
+ if (fromParameters != null) {
4999
+ setValueByPath(toObject, ['parameters'], fromParameters);
5000
+ }
5001
+ return toObject;
5002
+ }
5003
+ function googleSearchToMldev() {
5004
+ const toObject = {};
5005
+ return toObject;
5006
+ }
5007
+ function dynamicRetrievalConfigToMldev(apiClient, fromObject) {
5008
+ const toObject = {};
5009
+ const fromMode = getValueByPath(fromObject, ['mode']);
5010
+ if (fromMode != null) {
5011
+ setValueByPath(toObject, ['mode'], fromMode);
5012
+ }
5013
+ const fromDynamicThreshold = getValueByPath(fromObject, [
5014
+ 'dynamicThreshold',
5015
+ ]);
5016
+ if (fromDynamicThreshold != null) {
5017
+ setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
5018
+ }
5019
+ return toObject;
5020
+ }
5021
+ function googleSearchRetrievalToMldev(apiClient, fromObject) {
5022
+ const toObject = {};
5023
+ const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
5024
+ 'dynamicRetrievalConfig',
5025
+ ]);
5026
+ if (fromDynamicRetrievalConfig != null) {
5027
+ setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev(apiClient, fromDynamicRetrievalConfig));
3562
5028
  }
3563
5029
  return toObject;
3564
5030
  }
@@ -3646,6 +5112,10 @@ function speechConfigToMldev(apiClient, fromObject) {
3646
5112
  if (fromVoiceConfig != null) {
3647
5113
  setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev(apiClient, fromVoiceConfig));
3648
5114
  }
5115
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
5116
+ if (fromLanguageCode != null) {
5117
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
5118
+ }
3649
5119
  return toObject;
3650
5120
  }
3651
5121
  function thinkingConfigToMldev(apiClient, fromObject) {
@@ -3656,6 +5126,12 @@ function thinkingConfigToMldev(apiClient, fromObject) {
3656
5126
  if (fromIncludeThoughts != null) {
3657
5127
  setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
3658
5128
  }
5129
+ const fromThinkingBudget = getValueByPath(fromObject, [
5130
+ 'thinkingBudget',
5131
+ ]);
5132
+ if (fromThinkingBudget != null) {
5133
+ setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
5134
+ }
3659
5135
  return toObject;
3660
5136
  }
3661
5137
  function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
@@ -3737,6 +5213,9 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
3737
5213
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
3738
5214
  throw new Error('routingConfig parameter is not supported in Gemini API.');
3739
5215
  }
5216
+ if (getValueByPath(fromObject, ['modelSelectionConfig']) !== undefined) {
5217
+ throw new Error('modelSelectionConfig parameter is not supported in Gemini API.');
5218
+ }
3740
5219
  const fromSafetySettings = getValueByPath(fromObject, [
3741
5220
  'safetySettings',
3742
5221
  ]);
@@ -3959,6 +5438,18 @@ function generateImagesParametersToMldev(apiClient, fromObject) {
3959
5438
  }
3960
5439
  return toObject;
3961
5440
  }
5441
+ function getModelParametersToMldev(apiClient, fromObject) {
5442
+ const toObject = {};
5443
+ const fromModel = getValueByPath(fromObject, ['model']);
5444
+ if (fromModel != null) {
5445
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
5446
+ }
5447
+ const fromConfig = getValueByPath(fromObject, ['config']);
5448
+ if (fromConfig != null) {
5449
+ setValueByPath(toObject, ['config'], fromConfig);
5450
+ }
5451
+ return toObject;
5452
+ }
3962
5453
  function countTokensConfigToMldev(apiClient, fromObject) {
3963
5454
  const toObject = {};
3964
5455
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
@@ -4245,6 +5736,16 @@ function schemaToVertex(apiClient, fromObject) {
4245
5736
  }
4246
5737
  return toObject;
4247
5738
  }
5739
+ function modelSelectionConfigToVertex(apiClient, fromObject) {
5740
+ const toObject = {};
5741
+ const fromFeatureSelectionPreference = getValueByPath(fromObject, [
5742
+ 'featureSelectionPreference',
5743
+ ]);
5744
+ if (fromFeatureSelectionPreference != null) {
5745
+ setValueByPath(toObject, ['featureSelectionPreference'], fromFeatureSelectionPreference);
5746
+ }
5747
+ return toObject;
5748
+ }
4248
5749
  function safetySettingToVertex(apiClient, fromObject) {
4249
5750
  const toObject = {};
4250
5751
  const fromMethod = getValueByPath(fromObject, ['method']);
@@ -4394,6 +5895,10 @@ function speechConfigToVertex(apiClient, fromObject) {
4394
5895
  if (fromVoiceConfig != null) {
4395
5896
  setValueByPath(toObject, ['voiceConfig'], voiceConfigToVertex(apiClient, fromVoiceConfig));
4396
5897
  }
5898
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
5899
+ if (fromLanguageCode != null) {
5900
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
5901
+ }
4397
5902
  return toObject;
4398
5903
  }
4399
5904
  function thinkingConfigToVertex(apiClient, fromObject) {
@@ -4404,6 +5909,12 @@ function thinkingConfigToVertex(apiClient, fromObject) {
4404
5909
  if (fromIncludeThoughts != null) {
4405
5910
  setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
4406
5911
  }
5912
+ const fromThinkingBudget = getValueByPath(fromObject, [
5913
+ 'thinkingBudget',
5914
+ ]);
5915
+ if (fromThinkingBudget != null) {
5916
+ setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
5917
+ }
4407
5918
  return toObject;
4408
5919
  }
4409
5920
  function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
@@ -4488,6 +5999,12 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
4488
5999
  if (fromRoutingConfig != null) {
4489
6000
  setValueByPath(toObject, ['routingConfig'], fromRoutingConfig);
4490
6001
  }
6002
+ const fromModelSelectionConfig = getValueByPath(fromObject, [
6003
+ 'modelSelectionConfig',
6004
+ ]);
6005
+ if (fromModelSelectionConfig != null) {
6006
+ setValueByPath(toObject, ['modelConfig'], modelSelectionConfigToVertex(apiClient, fromModelSelectionConfig));
6007
+ }
4491
6008
  const fromSafetySettings = getValueByPath(fromObject, [
4492
6009
  'safetySettings',
4493
6010
  ]);
@@ -4721,6 +6238,18 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
4721
6238
  }
4722
6239
  return toObject;
4723
6240
  }
6241
+ function getModelParametersToVertex(apiClient, fromObject) {
6242
+ const toObject = {};
6243
+ const fromModel = getValueByPath(fromObject, ['model']);
6244
+ if (fromModel != null) {
6245
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
6246
+ }
6247
+ const fromConfig = getValueByPath(fromObject, ['config']);
6248
+ if (fromConfig != null) {
6249
+ setValueByPath(toObject, ['config'], fromConfig);
6250
+ }
6251
+ return toObject;
6252
+ }
4724
6253
  function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
4725
6254
  const toObject = {};
4726
6255
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -5144,6 +6673,64 @@ function generateImagesResponseFromMldev(apiClient, fromObject) {
5144
6673
  }
5145
6674
  return toObject;
5146
6675
  }
6676
+ function tunedModelInfoFromMldev(apiClient, fromObject) {
6677
+ const toObject = {};
6678
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
6679
+ if (fromBaseModel != null) {
6680
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
6681
+ }
6682
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
6683
+ if (fromCreateTime != null) {
6684
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
6685
+ }
6686
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
6687
+ if (fromUpdateTime != null) {
6688
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
6689
+ }
6690
+ return toObject;
6691
+ }
6692
+ function modelFromMldev(apiClient, fromObject) {
6693
+ const toObject = {};
6694
+ const fromName = getValueByPath(fromObject, ['name']);
6695
+ if (fromName != null) {
6696
+ setValueByPath(toObject, ['name'], fromName);
6697
+ }
6698
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
6699
+ if (fromDisplayName != null) {
6700
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
6701
+ }
6702
+ const fromDescription = getValueByPath(fromObject, ['description']);
6703
+ if (fromDescription != null) {
6704
+ setValueByPath(toObject, ['description'], fromDescription);
6705
+ }
6706
+ const fromVersion = getValueByPath(fromObject, ['version']);
6707
+ if (fromVersion != null) {
6708
+ setValueByPath(toObject, ['version'], fromVersion);
6709
+ }
6710
+ const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
6711
+ if (fromTunedModelInfo != null) {
6712
+ setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromMldev(apiClient, fromTunedModelInfo));
6713
+ }
6714
+ const fromInputTokenLimit = getValueByPath(fromObject, [
6715
+ 'inputTokenLimit',
6716
+ ]);
6717
+ if (fromInputTokenLimit != null) {
6718
+ setValueByPath(toObject, ['inputTokenLimit'], fromInputTokenLimit);
6719
+ }
6720
+ const fromOutputTokenLimit = getValueByPath(fromObject, [
6721
+ 'outputTokenLimit',
6722
+ ]);
6723
+ if (fromOutputTokenLimit != null) {
6724
+ setValueByPath(toObject, ['outputTokenLimit'], fromOutputTokenLimit);
6725
+ }
6726
+ const fromSupportedActions = getValueByPath(fromObject, [
6727
+ 'supportedGenerationMethods',
6728
+ ]);
6729
+ if (fromSupportedActions != null) {
6730
+ setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
6731
+ }
6732
+ return toObject;
6733
+ }
5147
6734
  function countTokensResponseFromMldev(apiClient, fromObject) {
5148
6735
  const toObject = {};
5149
6736
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -5232,16 +6819,12 @@ function generateVideosOperationFromMldev$1(apiClient, fromObject) {
5232
6819
  if (fromError != null) {
5233
6820
  setValueByPath(toObject, ['error'], fromError);
5234
6821
  }
5235
- const fromResponse = getValueByPath(fromObject, ['response']);
5236
- if (fromResponse != null) {
5237
- setValueByPath(toObject, ['response'], fromResponse);
5238
- }
5239
- const fromResult = getValueByPath(fromObject, [
6822
+ const fromResponse = getValueByPath(fromObject, [
5240
6823
  'response',
5241
6824
  'generateVideoResponse',
5242
6825
  ]);
5243
- if (fromResult != null) {
5244
- setValueByPath(toObject, ['result'], generateVideosResponseFromMldev$1(apiClient, fromResult));
6826
+ if (fromResponse != null) {
6827
+ setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(apiClient, fromResponse));
5245
6828
  }
5246
6829
  return toObject;
5247
6830
  }
@@ -5545,368 +7128,173 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
5545
7128
  const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
5546
7129
  'positivePromptSafetyAttributes',
5547
7130
  ]);
5548
- if (fromPositivePromptSafetyAttributes != null) {
5549
- setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromVertex(apiClient, fromPositivePromptSafetyAttributes));
5550
- }
5551
- return toObject;
5552
- }
5553
- function countTokensResponseFromVertex(apiClient, fromObject) {
5554
- const toObject = {};
5555
- const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
5556
- if (fromTotalTokens != null) {
5557
- setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
5558
- }
5559
- return toObject;
5560
- }
5561
- function computeTokensResponseFromVertex(apiClient, fromObject) {
5562
- const toObject = {};
5563
- const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
5564
- if (fromTokensInfo != null) {
5565
- setValueByPath(toObject, ['tokensInfo'], fromTokensInfo);
5566
- }
5567
- return toObject;
5568
- }
5569
- function videoFromVertex$1(apiClient, fromObject) {
5570
- const toObject = {};
5571
- const fromUri = getValueByPath(fromObject, ['gcsUri']);
5572
- if (fromUri != null) {
5573
- setValueByPath(toObject, ['uri'], fromUri);
5574
- }
5575
- const fromVideoBytes = getValueByPath(fromObject, [
5576
- 'bytesBase64Encoded',
5577
- ]);
5578
- if (fromVideoBytes != null) {
5579
- setValueByPath(toObject, ['videoBytes'], tBytes(apiClient, fromVideoBytes));
5580
- }
5581
- const fromMimeType = getValueByPath(fromObject, ['mimeType']);
5582
- if (fromMimeType != null) {
5583
- setValueByPath(toObject, ['mimeType'], fromMimeType);
5584
- }
5585
- return toObject;
5586
- }
5587
- function generatedVideoFromVertex$1(apiClient, fromObject) {
5588
- const toObject = {};
5589
- const fromVideo = getValueByPath(fromObject, ['_self']);
5590
- if (fromVideo != null) {
5591
- setValueByPath(toObject, ['video'], videoFromVertex$1(apiClient, fromVideo));
5592
- }
5593
- return toObject;
5594
- }
5595
- function generateVideosResponseFromVertex$1(apiClient, fromObject) {
5596
- const toObject = {};
5597
- const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
5598
- if (fromGeneratedVideos != null) {
5599
- if (Array.isArray(fromGeneratedVideos)) {
5600
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
5601
- return generatedVideoFromVertex$1(apiClient, item);
5602
- }));
5603
- }
5604
- else {
5605
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
5606
- }
5607
- }
5608
- const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
5609
- 'raiMediaFilteredCount',
5610
- ]);
5611
- if (fromRaiMediaFilteredCount != null) {
5612
- setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
5613
- }
5614
- const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
5615
- 'raiMediaFilteredReasons',
5616
- ]);
5617
- if (fromRaiMediaFilteredReasons != null) {
5618
- setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
5619
- }
5620
- return toObject;
5621
- }
5622
- function generateVideosOperationFromVertex$1(apiClient, fromObject) {
5623
- const toObject = {};
5624
- const fromName = getValueByPath(fromObject, ['name']);
5625
- if (fromName != null) {
5626
- setValueByPath(toObject, ['name'], fromName);
5627
- }
5628
- const fromMetadata = getValueByPath(fromObject, ['metadata']);
5629
- if (fromMetadata != null) {
5630
- setValueByPath(toObject, ['metadata'], fromMetadata);
5631
- }
5632
- const fromDone = getValueByPath(fromObject, ['done']);
5633
- if (fromDone != null) {
5634
- setValueByPath(toObject, ['done'], fromDone);
5635
- }
5636
- const fromError = getValueByPath(fromObject, ['error']);
5637
- if (fromError != null) {
5638
- setValueByPath(toObject, ['error'], fromError);
5639
- }
5640
- const fromResponse = getValueByPath(fromObject, ['response']);
5641
- if (fromResponse != null) {
5642
- setValueByPath(toObject, ['response'], fromResponse);
5643
- }
5644
- const fromResult = getValueByPath(fromObject, ['response']);
5645
- if (fromResult != null) {
5646
- setValueByPath(toObject, ['result'], generateVideosResponseFromVertex$1(apiClient, fromResult));
5647
- }
5648
- return toObject;
5649
- }
5650
-
5651
- /**
5652
- * @license
5653
- * Copyright 2025 Google LLC
5654
- * SPDX-License-Identifier: Apache-2.0
5655
- */
5656
- /**
5657
- * Converters for live client.
5658
- */
5659
- function liveConnectParametersToMldev(apiClient, fromObject) {
5660
- const toObject = {};
5661
- const fromConfig = getValueByPath(fromObject, ['config']);
5662
- if (fromConfig !== undefined && fromConfig !== null) {
5663
- setValueByPath(toObject, ['setup'], liveConnectConfigToMldev(apiClient, fromConfig));
5664
- }
5665
- const fromModel = getValueByPath(fromObject, ['model']);
5666
- if (fromModel !== undefined) {
5667
- setValueByPath(toObject, ['setup', 'model'], fromModel);
5668
- }
5669
- return toObject;
5670
- }
5671
- function liveConnectParametersToVertex(apiClient, fromObject) {
5672
- const toObject = {};
5673
- const fromConfig = getValueByPath(fromObject, ['config']);
5674
- if (fromConfig !== undefined && fromConfig !== null) {
5675
- setValueByPath(toObject, ['setup'], liveConnectConfigToVertex(apiClient, fromConfig));
5676
- }
5677
- const fromModel = getValueByPath(fromObject, ['model']);
5678
- if (fromModel !== undefined) {
5679
- setValueByPath(toObject, ['setup', 'model'], fromModel);
5680
- }
5681
- return toObject;
5682
- }
5683
- function liveServerMessageFromMldev(apiClient, fromObject) {
5684
- const toObject = {};
5685
- const fromSetupComplete = getValueByPath(fromObject, [
5686
- 'setupComplete',
5687
- ]);
5688
- if (fromSetupComplete !== undefined) {
5689
- setValueByPath(toObject, ['setupComplete'], fromSetupComplete);
5690
- }
5691
- const fromServerContent = getValueByPath(fromObject, [
5692
- 'serverContent',
5693
- ]);
5694
- if (fromServerContent !== undefined && fromServerContent !== null) {
5695
- setValueByPath(toObject, ['serverContent'], liveServerContentFromMldev(apiClient, fromServerContent));
5696
- }
5697
- const fromToolCall = getValueByPath(fromObject, ['toolCall']);
5698
- if (fromToolCall !== undefined && fromToolCall !== null) {
5699
- setValueByPath(toObject, ['toolCall'], liveServerToolCallFromMldev(apiClient, fromToolCall));
5700
- }
5701
- const fromToolCallCancellation = getValueByPath(fromObject, [
5702
- 'toolCallCancellation',
5703
- ]);
5704
- if (fromToolCallCancellation !== undefined &&
5705
- fromToolCallCancellation !== null) {
5706
- setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromMldev(apiClient, fromToolCallCancellation));
7131
+ if (fromPositivePromptSafetyAttributes != null) {
7132
+ setValueByPath(toObject, ['positivePromptSafetyAttributes'], safetyAttributesFromVertex(apiClient, fromPositivePromptSafetyAttributes));
5707
7133
  }
5708
7134
  return toObject;
5709
7135
  }
5710
- function liveServerMessageFromVertex(apiClient, fromObject) {
7136
+ function endpointFromVertex(apiClient, fromObject) {
5711
7137
  const toObject = {};
5712
- const fromSetupComplete = getValueByPath(fromObject, [
5713
- 'setupComplete',
5714
- ]);
5715
- if (fromSetupComplete !== undefined) {
5716
- setValueByPath(toObject, ['setupComplete'], fromSetupComplete);
5717
- }
5718
- const fromServerContent = getValueByPath(fromObject, [
5719
- 'serverContent',
5720
- ]);
5721
- if (fromServerContent !== undefined && fromServerContent !== null) {
5722
- setValueByPath(toObject, ['serverContent'], liveServerContentFromVertex(apiClient, fromServerContent));
5723
- }
5724
- const fromToolCall = getValueByPath(fromObject, ['toolCall']);
5725
- if (fromToolCall !== undefined && fromToolCall !== null) {
5726
- setValueByPath(toObject, ['toolCall'], liveServerToolCallFromVertex(apiClient, fromToolCall));
7138
+ const fromName = getValueByPath(fromObject, ['endpoint']);
7139
+ if (fromName != null) {
7140
+ setValueByPath(toObject, ['name'], fromName);
5727
7141
  }
5728
- const fromToolCallCancellation = getValueByPath(fromObject, [
5729
- 'toolCallCancellation',
7142
+ const fromDeployedModelId = getValueByPath(fromObject, [
7143
+ 'deployedModelId',
5730
7144
  ]);
5731
- if (fromToolCallCancellation !== undefined &&
5732
- fromToolCallCancellation !== null) {
5733
- setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromVertex(apiClient, fromToolCallCancellation));
7145
+ if (fromDeployedModelId != null) {
7146
+ setValueByPath(toObject, ['deployedModelId'], fromDeployedModelId);
5734
7147
  }
5735
7148
  return toObject;
5736
7149
  }
5737
- function liveConnectConfigToMldev(apiClient, fromObject) {
7150
+ function tunedModelInfoFromVertex(apiClient, fromObject) {
5738
7151
  const toObject = {};
5739
- const fromGenerationConfig = getValueByPath(fromObject, [
5740
- 'generationConfig',
5741
- ]);
5742
- if (fromGenerationConfig !== undefined) {
5743
- setValueByPath(toObject, ['generationConfig'], fromGenerationConfig);
5744
- }
5745
- const fromResponseModalities = getValueByPath(fromObject, [
5746
- 'responseModalities',
7152
+ const fromBaseModel = getValueByPath(fromObject, [
7153
+ 'labels',
7154
+ 'google-vertex-llm-tuning-base-model-id',
5747
7155
  ]);
5748
- if (fromResponseModalities !== undefined) {
5749
- setValueByPath(toObject, ['generationConfig', 'responseModalities'], fromResponseModalities);
5750
- }
5751
- const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
5752
- if (fromSpeechConfig !== undefined) {
5753
- setValueByPath(toObject, ['generationConfig', 'speechConfig'], fromSpeechConfig);
7156
+ if (fromBaseModel != null) {
7157
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
5754
7158
  }
5755
- const fromSystemInstruction = getValueByPath(fromObject, [
5756
- 'systemInstruction',
5757
- ]);
5758
- if (fromSystemInstruction !== undefined && fromSystemInstruction !== null) {
5759
- setValueByPath(toObject, ['systemInstruction'], contentToMldev(apiClient, fromSystemInstruction));
7159
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
7160
+ if (fromCreateTime != null) {
7161
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
5760
7162
  }
5761
- const fromTools = getValueByPath(fromObject, ['tools']);
5762
- if (fromTools !== undefined &&
5763
- fromTools !== null &&
5764
- Array.isArray(fromTools)) {
5765
- setValueByPath(toObject, ['tools'], fromTools.map((item) => {
5766
- return toolToMldev(apiClient, item);
5767
- }));
7163
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
7164
+ if (fromUpdateTime != null) {
7165
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
5768
7166
  }
5769
7167
  return toObject;
5770
7168
  }
5771
- function liveConnectConfigToVertex(apiClient, fromObject) {
7169
+ function modelFromVertex(apiClient, fromObject) {
5772
7170
  const toObject = {};
5773
- const fromGenerationConfig = getValueByPath(fromObject, [
5774
- 'generationConfig',
5775
- ]);
5776
- if (fromGenerationConfig !== undefined) {
5777
- setValueByPath(toObject, ['generationConfig'], fromGenerationConfig);
7171
+ const fromName = getValueByPath(fromObject, ['name']);
7172
+ if (fromName != null) {
7173
+ setValueByPath(toObject, ['name'], fromName);
5778
7174
  }
5779
- const fromResponseModalities = getValueByPath(fromObject, [
5780
- 'responseModalities',
5781
- ]);
5782
- if (fromResponseModalities !== undefined) {
5783
- setValueByPath(toObject, ['generationConfig', 'responseModalities'], fromResponseModalities);
7175
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
7176
+ if (fromDisplayName != null) {
7177
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5784
7178
  }
5785
- else {
5786
- // Set default to AUDIO to align with MLDev API.
5787
- setValueByPath(toObject, ['generationConfig', 'responseModalities'], ['AUDIO']);
7179
+ const fromDescription = getValueByPath(fromObject, ['description']);
7180
+ if (fromDescription != null) {
7181
+ setValueByPath(toObject, ['description'], fromDescription);
5788
7182
  }
5789
- const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
5790
- if (fromSpeechConfig !== undefined) {
5791
- setValueByPath(toObject, ['generationConfig', 'speechConfig'], fromSpeechConfig);
7183
+ const fromVersion = getValueByPath(fromObject, ['versionId']);
7184
+ if (fromVersion != null) {
7185
+ setValueByPath(toObject, ['version'], fromVersion);
5792
7186
  }
5793
- const fromSystemInstruction = getValueByPath(fromObject, [
5794
- 'systemInstruction',
5795
- ]);
5796
- if (fromSystemInstruction !== undefined && fromSystemInstruction !== null) {
5797
- setValueByPath(toObject, ['systemInstruction'], contentToVertex(apiClient, fromSystemInstruction));
7187
+ const fromEndpoints = getValueByPath(fromObject, ['deployedModels']);
7188
+ if (fromEndpoints != null) {
7189
+ if (Array.isArray(fromEndpoints)) {
7190
+ setValueByPath(toObject, ['endpoints'], fromEndpoints.map((item) => {
7191
+ return endpointFromVertex(apiClient, item);
7192
+ }));
7193
+ }
7194
+ else {
7195
+ setValueByPath(toObject, ['endpoints'], fromEndpoints);
7196
+ }
5798
7197
  }
5799
- const fromTools = getValueByPath(fromObject, ['tools']);
5800
- if (fromTools !== undefined &&
5801
- fromTools !== null &&
5802
- Array.isArray(fromTools)) {
5803
- setValueByPath(toObject, ['tools'], fromTools.map((item) => {
5804
- return toolToVertex(apiClient, item);
5805
- }));
7198
+ const fromLabels = getValueByPath(fromObject, ['labels']);
7199
+ if (fromLabels != null) {
7200
+ setValueByPath(toObject, ['labels'], fromLabels);
7201
+ }
7202
+ const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
7203
+ if (fromTunedModelInfo != null) {
7204
+ setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(apiClient, fromTunedModelInfo));
5806
7205
  }
5807
7206
  return toObject;
5808
7207
  }
5809
- function liveServerContentFromMldev(apiClient, fromObject) {
7208
+ function countTokensResponseFromVertex(apiClient, fromObject) {
5810
7209
  const toObject = {};
5811
- const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
5812
- if (fromModelTurn !== undefined && fromModelTurn !== null) {
5813
- setValueByPath(toObject, ['modelTurn'], contentFromMldev(apiClient, fromModelTurn));
5814
- }
5815
- const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
5816
- if (fromTurnComplete !== undefined) {
5817
- setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
5818
- }
5819
- const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
5820
- if (fromInterrupted !== undefined) {
5821
- setValueByPath(toObject, ['interrupted'], fromInterrupted);
7210
+ const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
7211
+ if (fromTotalTokens != null) {
7212
+ setValueByPath(toObject, ['totalTokens'], fromTotalTokens);
5822
7213
  }
5823
7214
  return toObject;
5824
7215
  }
5825
- function liveServerContentFromVertex(apiClient, fromObject) {
7216
+ function computeTokensResponseFromVertex(apiClient, fromObject) {
5826
7217
  const toObject = {};
5827
- const fromModelTurn = getValueByPath(fromObject, ['modelTurn']);
5828
- if (fromModelTurn !== undefined && fromModelTurn !== null) {
5829
- setValueByPath(toObject, ['modelTurn'], contentFromVertex(apiClient, fromModelTurn));
5830
- }
5831
- const fromTurnComplete = getValueByPath(fromObject, ['turnComplete']);
5832
- if (fromTurnComplete !== undefined) {
5833
- setValueByPath(toObject, ['turnComplete'], fromTurnComplete);
5834
- }
5835
- const fromInterrupted = getValueByPath(fromObject, ['interrupted']);
5836
- if (fromInterrupted !== undefined) {
5837
- setValueByPath(toObject, ['interrupted'], fromInterrupted);
7218
+ const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
7219
+ if (fromTokensInfo != null) {
7220
+ setValueByPath(toObject, ['tokensInfo'], fromTokensInfo);
5838
7221
  }
5839
7222
  return toObject;
5840
7223
  }
5841
- function functionCallFromMldev(apiClient, fromObject) {
7224
+ function videoFromVertex$1(apiClient, fromObject) {
5842
7225
  const toObject = {};
5843
- const fromId = getValueByPath(fromObject, ['id']);
5844
- if (fromId !== undefined) {
5845
- setValueByPath(toObject, ['id'], fromId);
7226
+ const fromUri = getValueByPath(fromObject, ['gcsUri']);
7227
+ if (fromUri != null) {
7228
+ setValueByPath(toObject, ['uri'], fromUri);
5846
7229
  }
5847
- const fromArgs = getValueByPath(fromObject, ['args']);
5848
- if (fromArgs !== undefined) {
5849
- setValueByPath(toObject, ['args'], fromArgs);
7230
+ const fromVideoBytes = getValueByPath(fromObject, [
7231
+ 'bytesBase64Encoded',
7232
+ ]);
7233
+ if (fromVideoBytes != null) {
7234
+ setValueByPath(toObject, ['videoBytes'], tBytes(apiClient, fromVideoBytes));
5850
7235
  }
5851
- const fromName = getValueByPath(fromObject, ['name']);
5852
- if (fromName !== undefined) {
5853
- setValueByPath(toObject, ['name'], fromName);
7236
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
7237
+ if (fromMimeType != null) {
7238
+ setValueByPath(toObject, ['mimeType'], fromMimeType);
5854
7239
  }
5855
7240
  return toObject;
5856
7241
  }
5857
- function functionCallFromVertex(apiClient, fromObject) {
7242
+ function generatedVideoFromVertex$1(apiClient, fromObject) {
5858
7243
  const toObject = {};
5859
- const fromArgs = getValueByPath(fromObject, ['args']);
5860
- if (fromArgs !== undefined) {
5861
- setValueByPath(toObject, ['args'], fromArgs);
5862
- }
5863
- const fromName = getValueByPath(fromObject, ['name']);
5864
- if (fromName !== undefined) {
5865
- setValueByPath(toObject, ['name'], fromName);
7244
+ const fromVideo = getValueByPath(fromObject, ['_self']);
7245
+ if (fromVideo != null) {
7246
+ setValueByPath(toObject, ['video'], videoFromVertex$1(apiClient, fromVideo));
5866
7247
  }
5867
7248
  return toObject;
5868
7249
  }
5869
- function liveServerToolCallFromMldev(apiClient, fromObject) {
7250
+ function generateVideosResponseFromVertex$1(apiClient, fromObject) {
5870
7251
  const toObject = {};
5871
- const fromFunctionCalls = getValueByPath(fromObject, [
5872
- 'functionCalls',
7252
+ const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
7253
+ if (fromGeneratedVideos != null) {
7254
+ if (Array.isArray(fromGeneratedVideos)) {
7255
+ setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
7256
+ return generatedVideoFromVertex$1(apiClient, item);
7257
+ }));
7258
+ }
7259
+ else {
7260
+ setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
7261
+ }
7262
+ }
7263
+ const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
7264
+ 'raiMediaFilteredCount',
5873
7265
  ]);
5874
- if (fromFunctionCalls !== undefined &&
5875
- fromFunctionCalls !== null &&
5876
- Array.isArray(fromFunctionCalls)) {
5877
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
5878
- return functionCallFromMldev(apiClient, item);
5879
- }));
7266
+ if (fromRaiMediaFilteredCount != null) {
7267
+ setValueByPath(toObject, ['raiMediaFilteredCount'], fromRaiMediaFilteredCount);
5880
7268
  }
5881
- return toObject;
5882
- }
5883
- function liveServerToolCallFromVertex(apiClient, fromObject) {
5884
- const toObject = {};
5885
- const fromFunctionCalls = getValueByPath(fromObject, [
5886
- 'functionCalls',
7269
+ const fromRaiMediaFilteredReasons = getValueByPath(fromObject, [
7270
+ 'raiMediaFilteredReasons',
5887
7271
  ]);
5888
- if (fromFunctionCalls !== undefined &&
5889
- fromFunctionCalls !== null &&
5890
- Array.isArray(fromFunctionCalls)) {
5891
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
5892
- return functionCallFromVertex(apiClient, item);
5893
- }));
7272
+ if (fromRaiMediaFilteredReasons != null) {
7273
+ setValueByPath(toObject, ['raiMediaFilteredReasons'], fromRaiMediaFilteredReasons);
5894
7274
  }
5895
7275
  return toObject;
5896
7276
  }
5897
- function liveServerToolCallCancellationFromMldev(apiClient, fromObject) {
7277
+ function generateVideosOperationFromVertex$1(apiClient, fromObject) {
5898
7278
  const toObject = {};
5899
- const fromIds = getValueByPath(fromObject, ['ids']);
5900
- if (fromIds !== undefined) {
5901
- setValueByPath(toObject, ['ids'], fromIds);
7279
+ const fromName = getValueByPath(fromObject, ['name']);
7280
+ if (fromName != null) {
7281
+ setValueByPath(toObject, ['name'], fromName);
5902
7282
  }
5903
- return toObject;
5904
- }
5905
- function liveServerToolCallCancellationFromVertex(apiClient, fromObject) {
5906
- const toObject = {};
5907
- const fromIds = getValueByPath(fromObject, ['ids']);
5908
- if (fromIds !== undefined) {
5909
- setValueByPath(toObject, ['ids'], fromIds);
7283
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
7284
+ if (fromMetadata != null) {
7285
+ setValueByPath(toObject, ['metadata'], fromMetadata);
7286
+ }
7287
+ const fromDone = getValueByPath(fromObject, ['done']);
7288
+ if (fromDone != null) {
7289
+ setValueByPath(toObject, ['done'], fromDone);
7290
+ }
7291
+ const fromError = getValueByPath(fromObject, ['error']);
7292
+ if (fromError != null) {
7293
+ setValueByPath(toObject, ['error'], fromError);
7294
+ }
7295
+ const fromResponse = getValueByPath(fromObject, ['response']);
7296
+ if (fromResponse != null) {
7297
+ setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(apiClient, fromResponse));
5910
7298
  }
5911
7299
  return toObject;
5912
7300
  }
@@ -5966,17 +7354,20 @@ class Live {
5966
7354
  @experimental
5967
7355
 
5968
7356
  @remarks
5969
- If using the Gemini API, Live is currently only supported behind API
5970
- version `v1alpha`. Ensure that the API version is set to `v1alpha` when
5971
- initializing the SDK if relying on the Gemini API.
5972
7357
 
5973
7358
  @param params - The parameters for establishing a connection to the model.
5974
7359
  @return A live session.
5975
7360
 
5976
7361
  @example
5977
7362
  ```ts
7363
+ let model: string;
7364
+ if (GOOGLE_GENAI_USE_VERTEXAI) {
7365
+ model = 'gemini-2.0-flash-live-preview-04-09';
7366
+ } else {
7367
+ model = 'gemini-2.0-flash-live-001';
7368
+ }
5978
7369
  const session = await ai.live.connect({
5979
- model: 'gemini-2.0-flash-exp',
7370
+ model: model,
5980
7371
  config: {
5981
7372
  responseModalities: [Modality.AUDIO],
5982
7373
  },
@@ -5998,7 +7389,7 @@ class Live {
5998
7389
  ```
5999
7390
  */
6000
7391
  async connect(params) {
6001
- var _a, _b;
7392
+ var _a, _b, _c, _d;
6002
7393
  const websocketBaseUrl = this.apiClient.getWebsocketBaseUrl();
6003
7394
  const apiVersion = this.apiClient.getApiVersion();
6004
7395
  let url;
@@ -6045,6 +7436,20 @@ class Live {
6045
7436
  `projects/${project}/locations/${location}/` + transformedModel;
6046
7437
  }
6047
7438
  let clientMessage = {};
7439
+ if (this.apiClient.isVertexAI() &&
7440
+ ((_c = params.config) === null || _c === void 0 ? void 0 : _c.responseModalities) === undefined) {
7441
+ // Set default to AUDIO to align with MLDev API.
7442
+ if (params.config === undefined) {
7443
+ params.config = { responseModalities: [exports.Modality.AUDIO] };
7444
+ }
7445
+ else {
7446
+ params.config.responseModalities = [exports.Modality.AUDIO];
7447
+ }
7448
+ }
7449
+ if ((_d = params.config) === null || _d === void 0 ? void 0 : _d.generationConfig) {
7450
+ // Raise deprecation warning for generationConfig.
7451
+ 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).');
7452
+ }
6048
7453
  const liveConnectParameters = {
6049
7454
  model: transformedModel,
6050
7455
  config: params.config,
@@ -6056,6 +7461,7 @@ class Live {
6056
7461
  else {
6057
7462
  clientMessage = liveConnectParametersToMldev(this.apiClient, liveConnectParameters);
6058
7463
  }
7464
+ delete clientMessage['config'];
6059
7465
  conn.send(JSON.stringify(clientMessage));
6060
7466
  return new Session(conn, this.apiClient);
6061
7467
  }
@@ -6102,7 +7508,13 @@ class Session {
6102
7508
  throw new Error(`Failed to convert realtime input "media", type: '${typeof params.media}'`);
6103
7509
  }
6104
7510
  // LiveClientRealtimeInput
6105
- clientMessage = { realtimeInput: { mediaChunks: [params.media] } };
7511
+ clientMessage = {
7512
+ realtimeInput: {
7513
+ mediaChunks: [params.media],
7514
+ activityStart: params.activityStart,
7515
+ activityEnd: params.activityEnd,
7516
+ },
7517
+ };
6106
7518
  return clientMessage;
6107
7519
  }
6108
7520
  tLiveClienttToolResponse(apiClient, params) {
@@ -6246,8 +7658,14 @@ class Session {
6246
7658
 
6247
7659
  @example
6248
7660
  ```ts
7661
+ let model: string;
7662
+ if (GOOGLE_GENAI_USE_VERTEXAI) {
7663
+ model = 'gemini-2.0-flash-live-preview-04-09';
7664
+ } else {
7665
+ model = 'gemini-2.0-flash-live-001';
7666
+ }
6249
7667
  const session = await ai.live.connect({
6250
- model: 'gemini-2.0-flash-exp',
7668
+ model: model,
6251
7669
  config: {
6252
7670
  responseModalities: [Modality.AUDIO],
6253
7671
  }
@@ -6513,7 +7931,7 @@ class Models extends BaseModule {
6513
7931
  _c = apiResponse_1_1.value;
6514
7932
  _d = false;
6515
7933
  const chunk = _c;
6516
- const resp = generateContentResponseFromVertex(apiClient, chunk);
7934
+ const resp = generateContentResponseFromVertex(apiClient, (yield __await(chunk.json())));
6517
7935
  const typedResp = new GenerateContentResponse();
6518
7936
  Object.assign(typedResp, resp);
6519
7937
  yield yield __await(typedResp);
@@ -6552,7 +7970,7 @@ class Models extends BaseModule {
6552
7970
  _c = apiResponse_2_1.value;
6553
7971
  _d = false;
6554
7972
  const chunk = _c;
6555
- const resp = generateContentResponseFromMldev(apiClient, chunk);
7973
+ const resp = generateContentResponseFromMldev(apiClient, (yield __await(chunk.json())));
6556
7974
  const typedResp = new GenerateContentResponse();
6557
7975
  Object.assign(typedResp, resp);
6558
7976
  yield yield __await(typedResp);
@@ -6721,6 +8139,66 @@ class Models extends BaseModule {
6721
8139
  });
6722
8140
  }
6723
8141
  }
8142
+ /**
8143
+ * Fetches information about a model by name.
8144
+ *
8145
+ * @example
8146
+ * ```ts
8147
+ * const modelInfo = await ai.models.get({model: 'gemini-2.0-flash'});
8148
+ * ```
8149
+ */
8150
+ async get(params) {
8151
+ var _a, _b;
8152
+ let response;
8153
+ let path = '';
8154
+ let queryParams = {};
8155
+ if (this.apiClient.isVertexAI()) {
8156
+ const body = getModelParametersToVertex(this.apiClient, params);
8157
+ path = formatMap('{name}', body['_url']);
8158
+ queryParams = body['_query'];
8159
+ delete body['config'];
8160
+ delete body['_url'];
8161
+ delete body['_query'];
8162
+ response = this.apiClient
8163
+ .request({
8164
+ path: path,
8165
+ queryParams: queryParams,
8166
+ body: JSON.stringify(body),
8167
+ httpMethod: 'GET',
8168
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
8169
+ })
8170
+ .then((httpResponse) => {
8171
+ return httpResponse.json();
8172
+ });
8173
+ return response.then((apiResponse) => {
8174
+ const resp = modelFromVertex(this.apiClient, apiResponse);
8175
+ return resp;
8176
+ });
8177
+ }
8178
+ else {
8179
+ const body = getModelParametersToMldev(this.apiClient, params);
8180
+ path = formatMap('{name}', body['_url']);
8181
+ queryParams = body['_query'];
8182
+ delete body['config'];
8183
+ delete body['_url'];
8184
+ delete body['_query'];
8185
+ response = this.apiClient
8186
+ .request({
8187
+ path: path,
8188
+ queryParams: queryParams,
8189
+ body: JSON.stringify(body),
8190
+ httpMethod: 'GET',
8191
+ httpOptions: (_b = params.config) === null || _b === void 0 ? void 0 : _b.httpOptions,
8192
+ })
8193
+ .then((httpResponse) => {
8194
+ return httpResponse.json();
8195
+ });
8196
+ return response.then((apiResponse) => {
8197
+ const resp = modelFromMldev(this.apiClient, apiResponse);
8198
+ return resp;
8199
+ });
8200
+ }
8201
+ }
6724
8202
  /**
6725
8203
  * Counts the number of tokens in the given contents. Multimodal input is
6726
8204
  * supported for Gemini models.
@@ -6862,10 +8340,10 @@ class Models extends BaseModule {
6862
8340
  *
6863
8341
  * while (!operation.done) {
6864
8342
  * await new Promise(resolve => setTimeout(resolve, 10000));
6865
- * operation = await ai.operations.get({operation: operation});
8343
+ * operation = await ai.operations.getVideosOperation({operation: operation});
6866
8344
  * }
6867
8345
  *
6868
- * console.log(operation.result?.generatedVideos?.[0]?.video?.uri);
8346
+ * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
6869
8347
  * ```
6870
8348
  */
6871
8349
  async generateVideos(params) {
@@ -7047,16 +8525,12 @@ function generateVideosOperationFromMldev(apiClient, fromObject) {
7047
8525
  if (fromError != null) {
7048
8526
  setValueByPath(toObject, ['error'], fromError);
7049
8527
  }
7050
- const fromResponse = getValueByPath(fromObject, ['response']);
7051
- if (fromResponse != null) {
7052
- setValueByPath(toObject, ['response'], fromResponse);
7053
- }
7054
- const fromResult = getValueByPath(fromObject, [
8528
+ const fromResponse = getValueByPath(fromObject, [
7055
8529
  'response',
7056
8530
  'generateVideoResponse',
7057
8531
  ]);
7058
- if (fromResult != null) {
7059
- setValueByPath(toObject, ['result'], generateVideosResponseFromMldev(apiClient, fromResult));
8532
+ if (fromResponse != null) {
8533
+ setValueByPath(toObject, ['response'], generateVideosResponseFromMldev(apiClient, fromResponse));
7060
8534
  }
7061
8535
  return toObject;
7062
8536
  }
@@ -7133,11 +8607,7 @@ function generateVideosOperationFromVertex(apiClient, fromObject) {
7133
8607
  }
7134
8608
  const fromResponse = getValueByPath(fromObject, ['response']);
7135
8609
  if (fromResponse != null) {
7136
- setValueByPath(toObject, ['response'], fromResponse);
7137
- }
7138
- const fromResult = getValueByPath(fromObject, ['response']);
7139
- if (fromResult != null) {
7140
- setValueByPath(toObject, ['result'], generateVideosResponseFromVertex(apiClient, fromResult));
8610
+ setValueByPath(toObject, ['response'], generateVideosResponseFromVertex(apiClient, fromResponse));
7141
8611
  }
7142
8612
  return toObject;
7143
8613
  }
@@ -7155,10 +8625,10 @@ class Operations extends BaseModule {
7155
8625
  /**
7156
8626
  * Gets the status of a long-running operation.
7157
8627
  *
7158
- * @param operation The Operation object returned by a previous API call.
8628
+ * @param parameters The parameters for the get operation request.
7159
8629
  * @return The updated Operation object, with the latest status or result.
7160
8630
  */
7161
- async get(parameters) {
8631
+ async getVideosOperation(parameters) {
7162
8632
  const operation = parameters.operation;
7163
8633
  const config = parameters.config;
7164
8634
  if (operation.name === undefined || operation.name === '') {
@@ -7166,7 +8636,7 @@ class Operations extends BaseModule {
7166
8636
  }
7167
8637
  if (this.apiClient.isVertexAI()) {
7168
8638
  const resourceName = operation.name.split('/operations/')[0];
7169
- var httpOptions = undefined;
8639
+ let httpOptions = undefined;
7170
8640
  if (config && 'httpOptions' in config) {
7171
8641
  httpOptions = config.httpOptions;
7172
8642
  }
@@ -7275,9 +8745,10 @@ class Operations extends BaseModule {
7275
8745
  * SPDX-License-Identifier: Apache-2.0
7276
8746
  */
7277
8747
  const CONTENT_TYPE_HEADER = 'Content-Type';
8748
+ const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
7278
8749
  const USER_AGENT_HEADER = 'User-Agent';
7279
8750
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
7280
- const SDK_VERSION = '0.7.0'; // x-release-please-version
8751
+ const SDK_VERSION = '0.9.0'; // x-release-please-version
7281
8752
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
7282
8753
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
7283
8754
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -7417,11 +8888,9 @@ class ApiClient {
7417
8888
  throw new Error('HTTP options are not correctly set.');
7418
8889
  }
7419
8890
  }
7420
- constructUrl(path, httpOptions) {
8891
+ constructUrl(path, httpOptions, prependProjectLocation) {
7421
8892
  const urlElement = [this.getRequestUrlInternal(httpOptions)];
7422
- if (this.clientOptions.vertexai &&
7423
- !this.clientOptions.apiKey &&
7424
- !path.startsWith('projects/')) {
8893
+ if (prependProjectLocation) {
7425
8894
  urlElement.push(this.getBaseResourcePath());
7426
8895
  }
7427
8896
  if (path !== '') {
@@ -7430,12 +8899,34 @@ class ApiClient {
7430
8899
  const url = new URL(`${urlElement.join('/')}`);
7431
8900
  return url;
7432
8901
  }
8902
+ shouldPrependVertexProjectPath(request) {
8903
+ if (this.clientOptions.apiKey) {
8904
+ return false;
8905
+ }
8906
+ if (!this.clientOptions.vertexai) {
8907
+ return false;
8908
+ }
8909
+ if (request.path.startsWith('projects/')) {
8910
+ // Assume the path already starts with
8911
+ // `projects/<project>/location/<location>`.
8912
+ return false;
8913
+ }
8914
+ if (request.httpMethod === 'GET' &&
8915
+ request.path.startsWith('publishers/google/models')) {
8916
+ // These paths are used by Vertex's models.get and models.list
8917
+ // calls. For base models Vertex does not accept a project/location
8918
+ // prefix (for tuned model the prefix is required).
8919
+ return false;
8920
+ }
8921
+ return true;
8922
+ }
7433
8923
  async request(request) {
7434
8924
  let patchedHttpOptions = this.clientOptions.httpOptions;
7435
8925
  if (request.httpOptions) {
7436
8926
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
7437
8927
  }
7438
- const url = this.constructUrl(request.path, patchedHttpOptions);
8928
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
8929
+ const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
7439
8930
  if (request.queryParams) {
7440
8931
  for (const [key, value] of Object.entries(request.queryParams)) {
7441
8932
  url.searchParams.append(key, String(value));
@@ -7477,7 +8968,8 @@ class ApiClient {
7477
8968
  if (request.httpOptions) {
7478
8969
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
7479
8970
  }
7480
- const url = this.constructUrl(request.path, patchedHttpOptions);
8971
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
8972
+ const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
7481
8973
  if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
7482
8974
  url.searchParams.set('alt', 'sse');
7483
8975
  }
@@ -7550,8 +9042,12 @@ class ApiClient {
7550
9042
  while (match) {
7551
9043
  const processedChunkString = match[1];
7552
9044
  try {
7553
- const chunkData = JSON.parse(processedChunkString);
7554
- yield yield __await(chunkData);
9045
+ const partialResponse = new Response(processedChunkString, {
9046
+ headers: response === null || response === void 0 ? void 0 : response.headers,
9047
+ status: response === null || response === void 0 ? void 0 : response.status,
9048
+ statusText: response === null || response === void 0 ? void 0 : response.statusText,
9049
+ });
9050
+ yield yield __await(new HttpResponse(partialResponse));
7555
9051
  buffer = buffer.slice(match[0].length);
7556
9052
  match = buffer.match(responseLineRE);
7557
9053
  }
@@ -7585,6 +9081,11 @@ class ApiClient {
7585
9081
  for (const [key, value] of Object.entries(httpOptions.headers)) {
7586
9082
  headers.append(key, value);
7587
9083
  }
9084
+ // Append a timeout header if it is set, note that the timeout option is
9085
+ // in milliseconds but the header is in seconds.
9086
+ if (httpOptions.timeout && httpOptions.timeout > 0) {
9087
+ headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
9088
+ }
7588
9089
  }
7589
9090
  await this.clientOptions.auth.addAuthHeaders(headers);
7590
9091
  return headers;
@@ -7699,7 +9200,6 @@ async function throwErrorIfNotOK(response) {
7699
9200
  * SPDX-License-Identifier: Apache-2.0
7700
9201
  */
7701
9202
  const GOOGLE_API_KEY_HEADER = 'x-goog-api-key';
7702
- const AUTHORIZATION_HEADER = 'Authorization';
7703
9203
  const REQUIRED_VERTEX_AI_SCOPE = 'https://www.googleapis.com/auth/cloud-platform';
7704
9204
  class NodeAuth {
7705
9205
  constructor(opts) {
@@ -7729,17 +9229,19 @@ class NodeAuth {
7729
9229
  headers.append(GOOGLE_API_KEY_HEADER, this.apiKey);
7730
9230
  }
7731
9231
  async addGoogleAuthHeaders(headers) {
7732
- if (headers.get(AUTHORIZATION_HEADER) !== null) {
7733
- return;
7734
- }
7735
9232
  if (this.googleAuth === undefined) {
7736
9233
  // This should never happen, addGoogleAuthHeaders should only be
7737
9234
  // called when there is no apiKey set and in these cases googleAuth
7738
9235
  // is set.
7739
9236
  throw new Error('Trying to set google-auth headers but googleAuth is unset');
7740
9237
  }
7741
- const token = await this.googleAuth.getAccessToken();
7742
- headers.append(AUTHORIZATION_HEADER, `Bearer ${token}`);
9238
+ const authHeaders = await this.googleAuth.getRequestHeaders();
9239
+ for (const key in authHeaders) {
9240
+ if (headers.get(key) !== null) {
9241
+ continue;
9242
+ }
9243
+ headers.append(key, authHeaders[key]);
9244
+ }
7743
9245
  }
7744
9246
  }
7745
9247
  function buildGoogleAuthOptions(googleAuthOptions) {