@google/genai 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -468,6 +468,20 @@ function tCachedContentName(apiClient, name) {
468
468
  }
469
469
  return resourceName(apiClient, name, 'cachedContents');
470
470
  }
471
+ function tTuningJobStatus(apiClient, status) {
472
+ switch (status) {
473
+ case 'STATE_UNSPECIFIED':
474
+ return 'JOB_STATE_UNSPECIFIED';
475
+ case 'CREATING':
476
+ return 'JOB_STATE_RUNNING';
477
+ case 'ACTIVE':
478
+ return 'JOB_STATE_SUCCEEDED';
479
+ case 'FAILED':
480
+ return 'JOB_STATE_FAILED';
481
+ default:
482
+ return status;
483
+ }
484
+ }
471
485
  function tBytes(apiClient, fromImageBytes) {
472
486
  if (typeof fromImageBytes !== 'string') {
473
487
  throw new Error('fromImageBytes must be a string');
@@ -540,14 +554,13 @@ function contentToMldev$2(apiClient, fromObject) {
540
554
  const toObject = {};
541
555
  const fromParts = getValueByPath(fromObject, ['parts']);
542
556
  if (fromParts != null) {
543
- if (Array.isArray(fromParts)) {
544
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
557
+ let transformedList = fromParts;
558
+ if (Array.isArray(transformedList)) {
559
+ transformedList = transformedList.map((item) => {
545
560
  return partToMldev$2(apiClient, item);
546
- }));
547
- }
548
- else {
549
- setValueByPath(toObject, ['parts'], fromParts);
561
+ });
550
562
  }
563
+ setValueByPath(toObject, ['parts'], transformedList);
551
564
  }
552
565
  const fromRole = getValueByPath(fromObject, ['role']);
553
566
  if (fromRole != null) {
@@ -555,25 +568,6 @@ function contentToMldev$2(apiClient, fromObject) {
555
568
  }
556
569
  return toObject;
557
570
  }
558
- function functionDeclarationToMldev$2(apiClient, fromObject) {
559
- const toObject = {};
560
- if (getValueByPath(fromObject, ['response']) !== undefined) {
561
- throw new Error('response parameter is not supported in Gemini API.');
562
- }
563
- const fromDescription = getValueByPath(fromObject, ['description']);
564
- if (fromDescription != null) {
565
- setValueByPath(toObject, ['description'], fromDescription);
566
- }
567
- const fromName = getValueByPath(fromObject, ['name']);
568
- if (fromName != null) {
569
- setValueByPath(toObject, ['name'], fromName);
570
- }
571
- const fromParameters = getValueByPath(fromObject, ['parameters']);
572
- if (fromParameters != null) {
573
- setValueByPath(toObject, ['parameters'], fromParameters);
574
- }
575
- return toObject;
576
- }
577
571
  function googleSearchToMldev$2() {
578
572
  const toObject = {};
579
573
  return toObject;
@@ -604,19 +598,6 @@ function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
604
598
  }
605
599
  function toolToMldev$2(apiClient, fromObject) {
606
600
  const toObject = {};
607
- const fromFunctionDeclarations = getValueByPath(fromObject, [
608
- 'functionDeclarations',
609
- ]);
610
- if (fromFunctionDeclarations != null) {
611
- if (Array.isArray(fromFunctionDeclarations)) {
612
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
613
- return functionDeclarationToMldev$2(apiClient, item);
614
- }));
615
- }
616
- else {
617
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
618
- }
619
- }
620
601
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
621
602
  throw new Error('retrieval parameter is not supported in Gemini API.');
622
603
  }
@@ -636,6 +617,12 @@ function toolToMldev$2(apiClient, fromObject) {
636
617
  if (fromCodeExecution != null) {
637
618
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
638
619
  }
620
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
621
+ 'functionDeclarations',
622
+ ]);
623
+ if (fromFunctionDeclarations != null) {
624
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
625
+ }
639
626
  return toObject;
640
627
  }
641
628
  function functionCallingConfigToMldev$1(apiClient, fromObject) {
@@ -678,14 +665,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
678
665
  }
679
666
  const fromContents = getValueByPath(fromObject, ['contents']);
680
667
  if (parentObject !== undefined && fromContents != null) {
681
- if (Array.isArray(fromContents)) {
682
- setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
668
+ let transformedList = tContents(apiClient, fromContents);
669
+ if (Array.isArray(transformedList)) {
670
+ transformedList = transformedList.map((item) => {
683
671
  return contentToMldev$2(apiClient, item);
684
- })));
685
- }
686
- else {
687
- setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
672
+ });
688
673
  }
674
+ setValueByPath(parentObject, ['contents'], transformedList);
689
675
  }
690
676
  const fromSystemInstruction = getValueByPath(fromObject, [
691
677
  'systemInstruction',
@@ -695,14 +681,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
695
681
  }
696
682
  const fromTools = getValueByPath(fromObject, ['tools']);
697
683
  if (parentObject !== undefined && fromTools != null) {
698
- if (Array.isArray(fromTools)) {
699
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
684
+ let transformedList = fromTools;
685
+ if (Array.isArray(transformedList)) {
686
+ transformedList = transformedList.map((item) => {
700
687
  return toolToMldev$2(apiClient, item);
701
- }));
702
- }
703
- else {
704
- setValueByPath(parentObject, ['tools'], fromTools);
688
+ });
705
689
  }
690
+ setValueByPath(parentObject, ['tools'], transformedList);
706
691
  }
707
692
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
708
693
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -842,14 +827,13 @@ function contentToVertex$2(apiClient, fromObject) {
842
827
  const toObject = {};
843
828
  const fromParts = getValueByPath(fromObject, ['parts']);
844
829
  if (fromParts != null) {
845
- if (Array.isArray(fromParts)) {
846
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
830
+ let transformedList = fromParts;
831
+ if (Array.isArray(transformedList)) {
832
+ transformedList = transformedList.map((item) => {
847
833
  return partToVertex$2(apiClient, item);
848
- }));
849
- }
850
- else {
851
- setValueByPath(toObject, ['parts'], fromParts);
834
+ });
852
835
  }
836
+ setValueByPath(toObject, ['parts'], transformedList);
853
837
  }
854
838
  const fromRole = getValueByPath(fromObject, ['role']);
855
839
  if (fromRole != null) {
@@ -857,124 +841,6 @@ function contentToVertex$2(apiClient, fromObject) {
857
841
  }
858
842
  return toObject;
859
843
  }
860
- function schemaToVertex$2(apiClient, fromObject) {
861
- const toObject = {};
862
- const fromExample = getValueByPath(fromObject, ['example']);
863
- if (fromExample != null) {
864
- setValueByPath(toObject, ['example'], fromExample);
865
- }
866
- const fromPattern = getValueByPath(fromObject, ['pattern']);
867
- if (fromPattern != null) {
868
- setValueByPath(toObject, ['pattern'], fromPattern);
869
- }
870
- const fromDefault = getValueByPath(fromObject, ['default']);
871
- if (fromDefault != null) {
872
- setValueByPath(toObject, ['default'], fromDefault);
873
- }
874
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
875
- if (fromMaxLength != null) {
876
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
877
- }
878
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
879
- if (fromMinLength != null) {
880
- setValueByPath(toObject, ['minLength'], fromMinLength);
881
- }
882
- const fromMinProperties = getValueByPath(fromObject, [
883
- 'minProperties',
884
- ]);
885
- if (fromMinProperties != null) {
886
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
887
- }
888
- const fromMaxProperties = getValueByPath(fromObject, [
889
- 'maxProperties',
890
- ]);
891
- if (fromMaxProperties != null) {
892
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
893
- }
894
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
895
- if (fromAnyOf != null) {
896
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
897
- }
898
- const fromDescription = getValueByPath(fromObject, ['description']);
899
- if (fromDescription != null) {
900
- setValueByPath(toObject, ['description'], fromDescription);
901
- }
902
- const fromEnum = getValueByPath(fromObject, ['enum']);
903
- if (fromEnum != null) {
904
- setValueByPath(toObject, ['enum'], fromEnum);
905
- }
906
- const fromFormat = getValueByPath(fromObject, ['format']);
907
- if (fromFormat != null) {
908
- setValueByPath(toObject, ['format'], fromFormat);
909
- }
910
- const fromItems = getValueByPath(fromObject, ['items']);
911
- if (fromItems != null) {
912
- setValueByPath(toObject, ['items'], fromItems);
913
- }
914
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
915
- if (fromMaxItems != null) {
916
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
917
- }
918
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
919
- if (fromMaximum != null) {
920
- setValueByPath(toObject, ['maximum'], fromMaximum);
921
- }
922
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
923
- if (fromMinItems != null) {
924
- setValueByPath(toObject, ['minItems'], fromMinItems);
925
- }
926
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
927
- if (fromMinimum != null) {
928
- setValueByPath(toObject, ['minimum'], fromMinimum);
929
- }
930
- const fromNullable = getValueByPath(fromObject, ['nullable']);
931
- if (fromNullable != null) {
932
- setValueByPath(toObject, ['nullable'], fromNullable);
933
- }
934
- const fromProperties = getValueByPath(fromObject, ['properties']);
935
- if (fromProperties != null) {
936
- setValueByPath(toObject, ['properties'], fromProperties);
937
- }
938
- const fromPropertyOrdering = getValueByPath(fromObject, [
939
- 'propertyOrdering',
940
- ]);
941
- if (fromPropertyOrdering != null) {
942
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
943
- }
944
- const fromRequired = getValueByPath(fromObject, ['required']);
945
- if (fromRequired != null) {
946
- setValueByPath(toObject, ['required'], fromRequired);
947
- }
948
- const fromTitle = getValueByPath(fromObject, ['title']);
949
- if (fromTitle != null) {
950
- setValueByPath(toObject, ['title'], fromTitle);
951
- }
952
- const fromType = getValueByPath(fromObject, ['type']);
953
- if (fromType != null) {
954
- setValueByPath(toObject, ['type'], fromType);
955
- }
956
- return toObject;
957
- }
958
- function functionDeclarationToVertex$2(apiClient, fromObject) {
959
- const toObject = {};
960
- const fromResponse = getValueByPath(fromObject, ['response']);
961
- if (fromResponse != null) {
962
- setValueByPath(toObject, ['response'], schemaToVertex$2(apiClient, fromResponse));
963
- }
964
- const fromDescription = getValueByPath(fromObject, ['description']);
965
- if (fromDescription != null) {
966
- setValueByPath(toObject, ['description'], fromDescription);
967
- }
968
- const fromName = getValueByPath(fromObject, ['name']);
969
- if (fromName != null) {
970
- setValueByPath(toObject, ['name'], fromName);
971
- }
972
- const fromParameters = getValueByPath(fromObject, ['parameters']);
973
- if (fromParameters != null) {
974
- setValueByPath(toObject, ['parameters'], fromParameters);
975
- }
976
- return toObject;
977
- }
978
844
  function googleSearchToVertex$2() {
979
845
  const toObject = {};
980
846
  return toObject;
@@ -1005,19 +871,6 @@ function googleSearchRetrievalToVertex$2(apiClient, fromObject) {
1005
871
  }
1006
872
  function toolToVertex$2(apiClient, fromObject) {
1007
873
  const toObject = {};
1008
- const fromFunctionDeclarations = getValueByPath(fromObject, [
1009
- 'functionDeclarations',
1010
- ]);
1011
- if (fromFunctionDeclarations != null) {
1012
- if (Array.isArray(fromFunctionDeclarations)) {
1013
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
1014
- return functionDeclarationToVertex$2(apiClient, item);
1015
- }));
1016
- }
1017
- else {
1018
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
1019
- }
1020
- }
1021
874
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
1022
875
  if (fromRetrieval != null) {
1023
876
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
@@ -1038,6 +891,12 @@ function toolToVertex$2(apiClient, fromObject) {
1038
891
  if (fromCodeExecution != null) {
1039
892
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
1040
893
  }
894
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
895
+ 'functionDeclarations',
896
+ ]);
897
+ if (fromFunctionDeclarations != null) {
898
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
899
+ }
1041
900
  return toObject;
1042
901
  }
1043
902
  function functionCallingConfigToVertex$1(apiClient, fromObject) {
@@ -1080,14 +939,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1080
939
  }
1081
940
  const fromContents = getValueByPath(fromObject, ['contents']);
1082
941
  if (parentObject !== undefined && fromContents != null) {
1083
- if (Array.isArray(fromContents)) {
1084
- setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
942
+ let transformedList = tContents(apiClient, fromContents);
943
+ if (Array.isArray(transformedList)) {
944
+ transformedList = transformedList.map((item) => {
1085
945
  return contentToVertex$2(apiClient, item);
1086
- })));
1087
- }
1088
- else {
1089
- setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
946
+ });
1090
947
  }
948
+ setValueByPath(parentObject, ['contents'], transformedList);
1091
949
  }
1092
950
  const fromSystemInstruction = getValueByPath(fromObject, [
1093
951
  'systemInstruction',
@@ -1097,14 +955,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1097
955
  }
1098
956
  const fromTools = getValueByPath(fromObject, ['tools']);
1099
957
  if (parentObject !== undefined && fromTools != null) {
1100
- if (Array.isArray(fromTools)) {
1101
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
958
+ let transformedList = fromTools;
959
+ if (Array.isArray(transformedList)) {
960
+ transformedList = transformedList.map((item) => {
1102
961
  return toolToVertex$2(apiClient, item);
1103
- }));
1104
- }
1105
- else {
1106
- setValueByPath(parentObject, ['tools'], fromTools);
962
+ });
1107
963
  }
964
+ setValueByPath(parentObject, ['tools'], transformedList);
1108
965
  }
1109
966
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
1110
967
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -1242,14 +1099,13 @@ function listCachedContentsResponseFromMldev(apiClient, fromObject) {
1242
1099
  'cachedContents',
1243
1100
  ]);
1244
1101
  if (fromCachedContents != null) {
1245
- if (Array.isArray(fromCachedContents)) {
1246
- setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1102
+ let transformedList = fromCachedContents;
1103
+ if (Array.isArray(transformedList)) {
1104
+ transformedList = transformedList.map((item) => {
1247
1105
  return cachedContentFromMldev(apiClient, item);
1248
- }));
1249
- }
1250
- else {
1251
- setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1106
+ });
1252
1107
  }
1108
+ setValueByPath(toObject, ['cachedContents'], transformedList);
1253
1109
  }
1254
1110
  return toObject;
1255
1111
  }
@@ -1303,14 +1159,13 @@ function listCachedContentsResponseFromVertex(apiClient, fromObject) {
1303
1159
  'cachedContents',
1304
1160
  ]);
1305
1161
  if (fromCachedContents != null) {
1306
- if (Array.isArray(fromCachedContents)) {
1307
- setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1162
+ let transformedList = fromCachedContents;
1163
+ if (Array.isArray(transformedList)) {
1164
+ transformedList = transformedList.map((item) => {
1308
1165
  return cachedContentFromVertex(apiClient, item);
1309
- }));
1310
- }
1311
- else {
1312
- setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1166
+ });
1313
1167
  }
1168
+ setValueByPath(toObject, ['cachedContents'], transformedList);
1314
1169
  }
1315
1170
  return toObject;
1316
1171
  }
@@ -1512,17 +1367,6 @@ var Language;
1512
1367
  Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
1513
1368
  Language["PYTHON"] = "PYTHON";
1514
1369
  })(Language || (Language = {}));
1515
- /** Optional. The type of the data. */
1516
- var Type;
1517
- (function (Type) {
1518
- Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
1519
- Type["STRING"] = "STRING";
1520
- Type["NUMBER"] = "NUMBER";
1521
- Type["INTEGER"] = "INTEGER";
1522
- Type["BOOLEAN"] = "BOOLEAN";
1523
- Type["ARRAY"] = "ARRAY";
1524
- Type["OBJECT"] = "OBJECT";
1525
- })(Type || (Type = {}));
1526
1370
  /** Required. Harm category. */
1527
1371
  var HarmCategory;
1528
1372
  (function (HarmCategory) {
@@ -1556,6 +1400,17 @@ var Mode;
1556
1400
  Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1557
1401
  Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1558
1402
  })(Mode || (Mode = {}));
1403
+ /** Optional. The type of the data. */
1404
+ var Type;
1405
+ (function (Type) {
1406
+ Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
1407
+ Type["STRING"] = "STRING";
1408
+ Type["NUMBER"] = "NUMBER";
1409
+ Type["INTEGER"] = "INTEGER";
1410
+ Type["BOOLEAN"] = "BOOLEAN";
1411
+ Type["ARRAY"] = "ARRAY";
1412
+ Type["OBJECT"] = "OBJECT";
1413
+ })(Type || (Type = {}));
1559
1414
  /** Output only. The reason why the model stopped generating tokens.
1560
1415
 
1561
1416
  If empty, the model has not stopped generating the tokens.
@@ -1625,6 +1480,33 @@ var MediaResolution;
1625
1480
  MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1626
1481
  MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1627
1482
  })(MediaResolution || (MediaResolution = {}));
1483
+ /** Output only. The detailed state of the job. */
1484
+ var JobState;
1485
+ (function (JobState) {
1486
+ JobState["JOB_STATE_UNSPECIFIED"] = "JOB_STATE_UNSPECIFIED";
1487
+ JobState["JOB_STATE_QUEUED"] = "JOB_STATE_QUEUED";
1488
+ JobState["JOB_STATE_PENDING"] = "JOB_STATE_PENDING";
1489
+ JobState["JOB_STATE_RUNNING"] = "JOB_STATE_RUNNING";
1490
+ JobState["JOB_STATE_SUCCEEDED"] = "JOB_STATE_SUCCEEDED";
1491
+ JobState["JOB_STATE_FAILED"] = "JOB_STATE_FAILED";
1492
+ JobState["JOB_STATE_CANCELLING"] = "JOB_STATE_CANCELLING";
1493
+ JobState["JOB_STATE_CANCELLED"] = "JOB_STATE_CANCELLED";
1494
+ JobState["JOB_STATE_PAUSED"] = "JOB_STATE_PAUSED";
1495
+ JobState["JOB_STATE_EXPIRED"] = "JOB_STATE_EXPIRED";
1496
+ JobState["JOB_STATE_UPDATING"] = "JOB_STATE_UPDATING";
1497
+ JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
1498
+ })(JobState || (JobState = {}));
1499
+ /** Optional. Adapter size for tuning. */
1500
+ var AdapterSize;
1501
+ (function (AdapterSize) {
1502
+ AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1503
+ AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1504
+ AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1505
+ AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1506
+ AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1507
+ AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1508
+ AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1509
+ })(AdapterSize || (AdapterSize = {}));
1628
1510
  /** Options for feature selection preference. */
1629
1511
  var FeatureSelectionPreference;
1630
1512
  (function (FeatureSelectionPreference) {
@@ -2125,6 +2007,8 @@ class EmbedContentResponse {
2125
2007
  /** The output images response. */
2126
2008
  class GenerateImagesResponse {
2127
2009
  }
2010
+ class DeleteModelResponse {
2011
+ }
2128
2012
  /** Response for counting tokens. */
2129
2013
  class CountTokensResponse {
2130
2014
  }
@@ -2134,6 +2018,9 @@ class ComputeTokensResponse {
2134
2018
  /** Response with generated videos. */
2135
2019
  class GenerateVideosResponse {
2136
2020
  }
2021
+ /** Response for the list tuning jobs method. */
2022
+ class ListTuningJobsResponse {
2023
+ }
2137
2024
  /** Empty response for caches.delete method. */
2138
2025
  class DeleteCachedContentResponse {
2139
2026
  }
@@ -2230,7 +2117,7 @@ class Caches extends BaseModule {
2230
2117
  * ```ts
2231
2118
  * const contents = ...; // Initialize the content to cache.
2232
2119
  * const response = await ai.caches.create({
2233
- * model: 'gemini-1.5-flash',
2120
+ * model: 'gemini-2.0-flash-001',
2234
2121
  * config: {
2235
2122
  * 'contents': contents,
2236
2123
  * 'displayName': 'test cache',
@@ -2302,7 +2189,7 @@ class Caches extends BaseModule {
2302
2189
  *
2303
2190
  * @example
2304
2191
  * ```ts
2305
- * await ai.caches.get({name: 'gemini-1.5-flash'});
2192
+ * await ai.caches.get({name: '...'}); // The server-generated resource name.
2306
2193
  * ```
2307
2194
  */
2308
2195
  async get(params) {
@@ -2367,7 +2254,7 @@ class Caches extends BaseModule {
2367
2254
  *
2368
2255
  * @example
2369
2256
  * ```ts
2370
- * await ai.caches.delete({name: 'gemini-1.5-flash'});
2257
+ * await ai.caches.delete({name: '...'}); // The server-generated resource name.
2371
2258
  * ```
2372
2259
  */
2373
2260
  async delete(params) {
@@ -2437,7 +2324,7 @@ class Caches extends BaseModule {
2437
2324
  * @example
2438
2325
  * ```ts
2439
2326
  * const response = await ai.caches.update({
2440
- * name: 'gemini-1.5-flash',
2327
+ * name: '...', // The server-generated resource name.
2441
2328
  * config: {'ttl': '7600s'}
2442
2329
  * });
2443
2330
  * ```
@@ -2835,7 +2722,12 @@ class Chat {
2835
2722
  contents: this.getHistory(true).concat(inputContent),
2836
2723
  config: (_a = params.config) !== null && _a !== void 0 ? _a : this.config,
2837
2724
  });
2838
- this.sendPromise = streamResponse.then(() => undefined);
2725
+ // Resolve the internal tracking of send completion promise - `sendPromise`
2726
+ // for both success and failure response. The actual failure is still
2727
+ // propagated by the `await streamResponse`.
2728
+ this.sendPromise = streamResponse
2729
+ .then(() => undefined)
2730
+ .catch(() => undefined);
2839
2731
  const response = await streamResponse;
2840
2732
  const result = this.processStreamResponse(response, inputContent);
2841
2733
  return result;
@@ -2923,7 +2815,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
2923
2815
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
2924
2816
  const USER_AGENT_HEADER = 'User-Agent';
2925
2817
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
2926
- const SDK_VERSION = '0.10.0'; // x-release-please-version
2818
+ const SDK_VERSION = '0.11.0'; // x-release-please-version
2927
2819
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
2928
2820
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
2929
2821
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -3728,14 +3620,13 @@ function listFilesResponseFromMldev(apiClient, fromObject) {
3728
3620
  }
3729
3621
  const fromFiles = getValueByPath(fromObject, ['files']);
3730
3622
  if (fromFiles != null) {
3731
- if (Array.isArray(fromFiles)) {
3732
- setValueByPath(toObject, ['files'], fromFiles.map((item) => {
3623
+ let transformedList = fromFiles;
3624
+ if (Array.isArray(transformedList)) {
3625
+ transformedList = transformedList.map((item) => {
3733
3626
  return fileFromMldev(apiClient, item);
3734
- }));
3735
- }
3736
- else {
3737
- setValueByPath(toObject, ['files'], fromFiles);
3627
+ });
3738
3628
  }
3629
+ setValueByPath(toObject, ['files'], transformedList);
3739
3630
  }
3740
3631
  return toObject;
3741
3632
  }
@@ -4102,14 +3993,13 @@ function contentToMldev$1(apiClient, fromObject) {
4102
3993
  const toObject = {};
4103
3994
  const fromParts = getValueByPath(fromObject, ['parts']);
4104
3995
  if (fromParts != null) {
4105
- if (Array.isArray(fromParts)) {
4106
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3996
+ let transformedList = fromParts;
3997
+ if (Array.isArray(transformedList)) {
3998
+ transformedList = transformedList.map((item) => {
4107
3999
  return partToMldev$1(apiClient, item);
4108
- }));
4109
- }
4110
- else {
4111
- setValueByPath(toObject, ['parts'], fromParts);
4000
+ });
4112
4001
  }
4002
+ setValueByPath(toObject, ['parts'], transformedList);
4113
4003
  }
4114
4004
  const fromRole = getValueByPath(fromObject, ['role']);
4115
4005
  if (fromRole != null) {
@@ -4121,14 +4011,13 @@ function contentToVertex$1(apiClient, fromObject) {
4121
4011
  const toObject = {};
4122
4012
  const fromParts = getValueByPath(fromObject, ['parts']);
4123
4013
  if (fromParts != null) {
4124
- if (Array.isArray(fromParts)) {
4125
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4014
+ let transformedList = fromParts;
4015
+ if (Array.isArray(transformedList)) {
4016
+ transformedList = transformedList.map((item) => {
4126
4017
  return partToVertex$1(apiClient, item);
4127
- }));
4128
- }
4129
- else {
4130
- setValueByPath(toObject, ['parts'], fromParts);
4018
+ });
4131
4019
  }
4020
+ setValueByPath(toObject, ['parts'], transformedList);
4132
4021
  }
4133
4022
  const fromRole = getValueByPath(fromObject, ['role']);
4134
4023
  if (fromRole != null) {
@@ -4136,143 +4025,6 @@ function contentToVertex$1(apiClient, fromObject) {
4136
4025
  }
4137
4026
  return toObject;
4138
4027
  }
4139
- function schemaToVertex$1(apiClient, fromObject) {
4140
- const toObject = {};
4141
- const fromExample = getValueByPath(fromObject, ['example']);
4142
- if (fromExample != null) {
4143
- setValueByPath(toObject, ['example'], fromExample);
4144
- }
4145
- const fromPattern = getValueByPath(fromObject, ['pattern']);
4146
- if (fromPattern != null) {
4147
- setValueByPath(toObject, ['pattern'], fromPattern);
4148
- }
4149
- const fromDefault = getValueByPath(fromObject, ['default']);
4150
- if (fromDefault != null) {
4151
- setValueByPath(toObject, ['default'], fromDefault);
4152
- }
4153
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
4154
- if (fromMaxLength != null) {
4155
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
4156
- }
4157
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
4158
- if (fromMinLength != null) {
4159
- setValueByPath(toObject, ['minLength'], fromMinLength);
4160
- }
4161
- const fromMinProperties = getValueByPath(fromObject, [
4162
- 'minProperties',
4163
- ]);
4164
- if (fromMinProperties != null) {
4165
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
4166
- }
4167
- const fromMaxProperties = getValueByPath(fromObject, [
4168
- 'maxProperties',
4169
- ]);
4170
- if (fromMaxProperties != null) {
4171
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
4172
- }
4173
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
4174
- if (fromAnyOf != null) {
4175
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
4176
- }
4177
- const fromDescription = getValueByPath(fromObject, ['description']);
4178
- if (fromDescription != null) {
4179
- setValueByPath(toObject, ['description'], fromDescription);
4180
- }
4181
- const fromEnum = getValueByPath(fromObject, ['enum']);
4182
- if (fromEnum != null) {
4183
- setValueByPath(toObject, ['enum'], fromEnum);
4184
- }
4185
- const fromFormat = getValueByPath(fromObject, ['format']);
4186
- if (fromFormat != null) {
4187
- setValueByPath(toObject, ['format'], fromFormat);
4188
- }
4189
- const fromItems = getValueByPath(fromObject, ['items']);
4190
- if (fromItems != null) {
4191
- setValueByPath(toObject, ['items'], fromItems);
4192
- }
4193
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
4194
- if (fromMaxItems != null) {
4195
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
4196
- }
4197
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
4198
- if (fromMaximum != null) {
4199
- setValueByPath(toObject, ['maximum'], fromMaximum);
4200
- }
4201
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
4202
- if (fromMinItems != null) {
4203
- setValueByPath(toObject, ['minItems'], fromMinItems);
4204
- }
4205
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
4206
- if (fromMinimum != null) {
4207
- setValueByPath(toObject, ['minimum'], fromMinimum);
4208
- }
4209
- const fromNullable = getValueByPath(fromObject, ['nullable']);
4210
- if (fromNullable != null) {
4211
- setValueByPath(toObject, ['nullable'], fromNullable);
4212
- }
4213
- const fromProperties = getValueByPath(fromObject, ['properties']);
4214
- if (fromProperties != null) {
4215
- setValueByPath(toObject, ['properties'], fromProperties);
4216
- }
4217
- const fromPropertyOrdering = getValueByPath(fromObject, [
4218
- 'propertyOrdering',
4219
- ]);
4220
- if (fromPropertyOrdering != null) {
4221
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
4222
- }
4223
- const fromRequired = getValueByPath(fromObject, ['required']);
4224
- if (fromRequired != null) {
4225
- setValueByPath(toObject, ['required'], fromRequired);
4226
- }
4227
- const fromTitle = getValueByPath(fromObject, ['title']);
4228
- if (fromTitle != null) {
4229
- setValueByPath(toObject, ['title'], fromTitle);
4230
- }
4231
- const fromType = getValueByPath(fromObject, ['type']);
4232
- if (fromType != null) {
4233
- setValueByPath(toObject, ['type'], fromType);
4234
- }
4235
- return toObject;
4236
- }
4237
- function functionDeclarationToMldev$1(apiClient, fromObject) {
4238
- const toObject = {};
4239
- if (getValueByPath(fromObject, ['response']) !== undefined) {
4240
- throw new Error('response parameter is not supported in Gemini API.');
4241
- }
4242
- const fromDescription = getValueByPath(fromObject, ['description']);
4243
- if (fromDescription != null) {
4244
- setValueByPath(toObject, ['description'], fromDescription);
4245
- }
4246
- const fromName = getValueByPath(fromObject, ['name']);
4247
- if (fromName != null) {
4248
- setValueByPath(toObject, ['name'], fromName);
4249
- }
4250
- const fromParameters = getValueByPath(fromObject, ['parameters']);
4251
- if (fromParameters != null) {
4252
- setValueByPath(toObject, ['parameters'], fromParameters);
4253
- }
4254
- return toObject;
4255
- }
4256
- function functionDeclarationToVertex$1(apiClient, fromObject) {
4257
- const toObject = {};
4258
- const fromResponse = getValueByPath(fromObject, ['response']);
4259
- if (fromResponse != null) {
4260
- setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
4261
- }
4262
- const fromDescription = getValueByPath(fromObject, ['description']);
4263
- if (fromDescription != null) {
4264
- setValueByPath(toObject, ['description'], fromDescription);
4265
- }
4266
- const fromName = getValueByPath(fromObject, ['name']);
4267
- if (fromName != null) {
4268
- setValueByPath(toObject, ['name'], fromName);
4269
- }
4270
- const fromParameters = getValueByPath(fromObject, ['parameters']);
4271
- if (fromParameters != null) {
4272
- setValueByPath(toObject, ['parameters'], fromParameters);
4273
- }
4274
- return toObject;
4275
- }
4276
4028
  function googleSearchToMldev$1() {
4277
4029
  const toObject = {};
4278
4030
  return toObject;
@@ -4331,19 +4083,6 @@ function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
4331
4083
  }
4332
4084
  function toolToMldev$1(apiClient, fromObject) {
4333
4085
  const toObject = {};
4334
- const fromFunctionDeclarations = getValueByPath(fromObject, [
4335
- 'functionDeclarations',
4336
- ]);
4337
- if (fromFunctionDeclarations != null) {
4338
- if (Array.isArray(fromFunctionDeclarations)) {
4339
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4340
- return functionDeclarationToMldev$1(apiClient, item);
4341
- }));
4342
- }
4343
- else {
4344
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4345
- }
4346
- }
4347
4086
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4348
4087
  throw new Error('retrieval parameter is not supported in Gemini API.');
4349
4088
  }
@@ -4363,23 +4102,16 @@ function toolToMldev$1(apiClient, fromObject) {
4363
4102
  if (fromCodeExecution != null) {
4364
4103
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4365
4104
  }
4366
- return toObject;
4367
- }
4368
- function toolToVertex$1(apiClient, fromObject) {
4369
- const toObject = {};
4370
4105
  const fromFunctionDeclarations = getValueByPath(fromObject, [
4371
4106
  'functionDeclarations',
4372
4107
  ]);
4373
4108
  if (fromFunctionDeclarations != null) {
4374
- if (Array.isArray(fromFunctionDeclarations)) {
4375
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4376
- return functionDeclarationToVertex$1(apiClient, item);
4377
- }));
4378
- }
4379
- else {
4380
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4381
- }
4109
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4382
4110
  }
4111
+ return toObject;
4112
+ }
4113
+ function toolToVertex$1(apiClient, fromObject) {
4114
+ const toObject = {};
4383
4115
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
4384
4116
  if (fromRetrieval != null) {
4385
4117
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
@@ -4400,6 +4132,12 @@ function toolToVertex$1(apiClient, fromObject) {
4400
4132
  if (fromCodeExecution != null) {
4401
4133
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4402
4134
  }
4135
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
4136
+ 'functionDeclarations',
4137
+ ]);
4138
+ if (fromFunctionDeclarations != null) {
4139
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4140
+ }
4403
4141
  return toObject;
4404
4142
  }
4405
4143
  function sessionResumptionConfigToMldev(apiClient, fromObject) {
@@ -4639,14 +4377,13 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
4639
4377
  }
4640
4378
  const fromTools = getValueByPath(fromObject, ['tools']);
4641
4379
  if (parentObject !== undefined && fromTools != null) {
4642
- if (Array.isArray(fromTools)) {
4643
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4380
+ let transformedList = tTools(apiClient, fromTools);
4381
+ if (Array.isArray(transformedList)) {
4382
+ transformedList = transformedList.map((item) => {
4644
4383
  return toolToMldev$1(apiClient, tTool(apiClient, item));
4645
- })));
4646
- }
4647
- else {
4648
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
4384
+ });
4649
4385
  }
4386
+ setValueByPath(parentObject, ['setup', 'tools'], transformedList);
4650
4387
  }
4651
4388
  const fromSessionResumption = getValueByPath(fromObject, [
4652
4389
  'sessionResumption',
@@ -4731,14 +4468,13 @@ function liveConnectConfigToVertex(apiClient, fromObject, parentObject) {
4731
4468
  }
4732
4469
  const fromTools = getValueByPath(fromObject, ['tools']);
4733
4470
  if (parentObject !== undefined && fromTools != null) {
4734
- if (Array.isArray(fromTools)) {
4735
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4471
+ let transformedList = tTools(apiClient, fromTools);
4472
+ if (Array.isArray(transformedList)) {
4473
+ transformedList = transformedList.map((item) => {
4736
4474
  return toolToVertex$1(apiClient, tTool(apiClient, item));
4737
- })));
4738
- }
4739
- else {
4740
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
4475
+ });
4741
4476
  }
4477
+ setValueByPath(parentObject, ['setup', 'tools'], transformedList);
4742
4478
  }
4743
4479
  const fromSessionResumption = getValueByPath(fromObject, [
4744
4480
  'sessionResumption',
@@ -4983,14 +4719,13 @@ function contentFromMldev$1(apiClient, fromObject) {
4983
4719
  const toObject = {};
4984
4720
  const fromParts = getValueByPath(fromObject, ['parts']);
4985
4721
  if (fromParts != null) {
4986
- if (Array.isArray(fromParts)) {
4987
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4722
+ let transformedList = fromParts;
4723
+ if (Array.isArray(transformedList)) {
4724
+ transformedList = transformedList.map((item) => {
4988
4725
  return partFromMldev$1(apiClient, item);
4989
- }));
4990
- }
4991
- else {
4992
- setValueByPath(toObject, ['parts'], fromParts);
4726
+ });
4993
4727
  }
4728
+ setValueByPath(toObject, ['parts'], transformedList);
4994
4729
  }
4995
4730
  const fromRole = getValueByPath(fromObject, ['role']);
4996
4731
  if (fromRole != null) {
@@ -5002,14 +4737,13 @@ function contentFromVertex$1(apiClient, fromObject) {
5002
4737
  const toObject = {};
5003
4738
  const fromParts = getValueByPath(fromObject, ['parts']);
5004
4739
  if (fromParts != null) {
5005
- if (Array.isArray(fromParts)) {
5006
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4740
+ let transformedList = fromParts;
4741
+ if (Array.isArray(transformedList)) {
4742
+ transformedList = transformedList.map((item) => {
5007
4743
  return partFromVertex$1(apiClient, item);
5008
- }));
5009
- }
5010
- else {
5011
- setValueByPath(toObject, ['parts'], fromParts);
4744
+ });
5012
4745
  }
4746
+ setValueByPath(toObject, ['parts'], transformedList);
5013
4747
  }
5014
4748
  const fromRole = getValueByPath(fromObject, ['role']);
5015
4749
  if (fromRole != null) {
@@ -5143,14 +4877,13 @@ function liveServerToolCallFromMldev(apiClient, fromObject) {
5143
4877
  'functionCalls',
5144
4878
  ]);
5145
4879
  if (fromFunctionCalls != null) {
5146
- if (Array.isArray(fromFunctionCalls)) {
5147
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4880
+ let transformedList = fromFunctionCalls;
4881
+ if (Array.isArray(transformedList)) {
4882
+ transformedList = transformedList.map((item) => {
5148
4883
  return functionCallFromMldev(apiClient, item);
5149
- }));
5150
- }
5151
- else {
5152
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4884
+ });
5153
4885
  }
4886
+ setValueByPath(toObject, ['functionCalls'], transformedList);
5154
4887
  }
5155
4888
  return toObject;
5156
4889
  }
@@ -5160,14 +4893,13 @@ function liveServerToolCallFromVertex(apiClient, fromObject) {
5160
4893
  'functionCalls',
5161
4894
  ]);
5162
4895
  if (fromFunctionCalls != null) {
5163
- if (Array.isArray(fromFunctionCalls)) {
5164
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4896
+ let transformedList = fromFunctionCalls;
4897
+ if (Array.isArray(transformedList)) {
4898
+ transformedList = transformedList.map((item) => {
5165
4899
  return functionCallFromVertex(apiClient, item);
5166
- }));
5167
- }
5168
- else {
5169
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4900
+ });
5170
4901
  }
4902
+ setValueByPath(toObject, ['functionCalls'], transformedList);
5171
4903
  }
5172
4904
  return toObject;
5173
4905
  }
@@ -5253,53 +4985,49 @@ function usageMetadataFromMldev(apiClient, fromObject) {
5253
4985
  'promptTokensDetails',
5254
4986
  ]);
5255
4987
  if (fromPromptTokensDetails != null) {
5256
- if (Array.isArray(fromPromptTokensDetails)) {
5257
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
4988
+ let transformedList = fromPromptTokensDetails;
4989
+ if (Array.isArray(transformedList)) {
4990
+ transformedList = transformedList.map((item) => {
5258
4991
  return modalityTokenCountFromMldev(apiClient, item);
5259
- }));
5260
- }
5261
- else {
5262
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
4992
+ });
5263
4993
  }
4994
+ setValueByPath(toObject, ['promptTokensDetails'], transformedList);
5264
4995
  }
5265
4996
  const fromCacheTokensDetails = getValueByPath(fromObject, [
5266
4997
  'cacheTokensDetails',
5267
4998
  ]);
5268
4999
  if (fromCacheTokensDetails != null) {
5269
- if (Array.isArray(fromCacheTokensDetails)) {
5270
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
5000
+ let transformedList = fromCacheTokensDetails;
5001
+ if (Array.isArray(transformedList)) {
5002
+ transformedList = transformedList.map((item) => {
5271
5003
  return modalityTokenCountFromMldev(apiClient, item);
5272
- }));
5273
- }
5274
- else {
5275
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
5004
+ });
5276
5005
  }
5006
+ setValueByPath(toObject, ['cacheTokensDetails'], transformedList);
5277
5007
  }
5278
5008
  const fromResponseTokensDetails = getValueByPath(fromObject, [
5279
5009
  'responseTokensDetails',
5280
5010
  ]);
5281
5011
  if (fromResponseTokensDetails != null) {
5282
- if (Array.isArray(fromResponseTokensDetails)) {
5283
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
5012
+ let transformedList = fromResponseTokensDetails;
5013
+ if (Array.isArray(transformedList)) {
5014
+ transformedList = transformedList.map((item) => {
5284
5015
  return modalityTokenCountFromMldev(apiClient, item);
5285
- }));
5286
- }
5287
- else {
5288
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
5016
+ });
5289
5017
  }
5018
+ setValueByPath(toObject, ['responseTokensDetails'], transformedList);
5290
5019
  }
5291
5020
  const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
5292
5021
  'toolUsePromptTokensDetails',
5293
5022
  ]);
5294
5023
  if (fromToolUsePromptTokensDetails != null) {
5295
- if (Array.isArray(fromToolUsePromptTokensDetails)) {
5296
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
5024
+ let transformedList = fromToolUsePromptTokensDetails;
5025
+ if (Array.isArray(transformedList)) {
5026
+ transformedList = transformedList.map((item) => {
5297
5027
  return modalityTokenCountFromMldev(apiClient, item);
5298
- }));
5299
- }
5300
- else {
5301
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
5028
+ });
5302
5029
  }
5030
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], transformedList);
5303
5031
  }
5304
5032
  return toObject;
5305
5033
  }
@@ -5345,53 +5073,49 @@ function usageMetadataFromVertex(apiClient, fromObject) {
5345
5073
  'promptTokensDetails',
5346
5074
  ]);
5347
5075
  if (fromPromptTokensDetails != null) {
5348
- if (Array.isArray(fromPromptTokensDetails)) {
5349
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
5076
+ let transformedList = fromPromptTokensDetails;
5077
+ if (Array.isArray(transformedList)) {
5078
+ transformedList = transformedList.map((item) => {
5350
5079
  return modalityTokenCountFromVertex(apiClient, item);
5351
- }));
5352
- }
5353
- else {
5354
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
5080
+ });
5355
5081
  }
5082
+ setValueByPath(toObject, ['promptTokensDetails'], transformedList);
5356
5083
  }
5357
5084
  const fromCacheTokensDetails = getValueByPath(fromObject, [
5358
5085
  'cacheTokensDetails',
5359
5086
  ]);
5360
5087
  if (fromCacheTokensDetails != null) {
5361
- if (Array.isArray(fromCacheTokensDetails)) {
5362
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
5088
+ let transformedList = fromCacheTokensDetails;
5089
+ if (Array.isArray(transformedList)) {
5090
+ transformedList = transformedList.map((item) => {
5363
5091
  return modalityTokenCountFromVertex(apiClient, item);
5364
- }));
5365
- }
5366
- else {
5367
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
5092
+ });
5368
5093
  }
5094
+ setValueByPath(toObject, ['cacheTokensDetails'], transformedList);
5369
5095
  }
5370
5096
  const fromResponseTokensDetails = getValueByPath(fromObject, [
5371
5097
  'candidatesTokensDetails',
5372
5098
  ]);
5373
5099
  if (fromResponseTokensDetails != null) {
5374
- if (Array.isArray(fromResponseTokensDetails)) {
5375
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
5100
+ let transformedList = fromResponseTokensDetails;
5101
+ if (Array.isArray(transformedList)) {
5102
+ transformedList = transformedList.map((item) => {
5376
5103
  return modalityTokenCountFromVertex(apiClient, item);
5377
- }));
5378
- }
5379
- else {
5380
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
5104
+ });
5381
5105
  }
5106
+ setValueByPath(toObject, ['responseTokensDetails'], transformedList);
5382
5107
  }
5383
5108
  const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
5384
5109
  'toolUsePromptTokensDetails',
5385
5110
  ]);
5386
5111
  if (fromToolUsePromptTokensDetails != null) {
5387
- if (Array.isArray(fromToolUsePromptTokensDetails)) {
5388
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
5112
+ let transformedList = fromToolUsePromptTokensDetails;
5113
+ if (Array.isArray(transformedList)) {
5114
+ transformedList = transformedList.map((item) => {
5389
5115
  return modalityTokenCountFromVertex(apiClient, item);
5390
- }));
5391
- }
5392
- else {
5393
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
5116
+ });
5394
5117
  }
5118
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], transformedList);
5395
5119
  }
5396
5120
  const fromTrafficType = getValueByPath(fromObject, ['trafficType']);
5397
5121
  if (fromTrafficType != null) {
@@ -5590,14 +5314,13 @@ function contentToMldev(apiClient, fromObject) {
5590
5314
  const toObject = {};
5591
5315
  const fromParts = getValueByPath(fromObject, ['parts']);
5592
5316
  if (fromParts != null) {
5593
- if (Array.isArray(fromParts)) {
5594
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
5317
+ let transformedList = fromParts;
5318
+ if (Array.isArray(transformedList)) {
5319
+ transformedList = transformedList.map((item) => {
5595
5320
  return partToMldev(apiClient, item);
5596
- }));
5597
- }
5598
- else {
5599
- setValueByPath(toObject, ['parts'], fromParts);
5321
+ });
5600
5322
  }
5323
+ setValueByPath(toObject, ['parts'], transformedList);
5601
5324
  }
5602
5325
  const fromRole = getValueByPath(fromObject, ['role']);
5603
5326
  if (fromRole != null) {
@@ -5605,93 +5328,6 @@ function contentToMldev(apiClient, fromObject) {
5605
5328
  }
5606
5329
  return toObject;
5607
5330
  }
5608
- function schemaToMldev(apiClient, fromObject) {
5609
- const toObject = {};
5610
- if (getValueByPath(fromObject, ['example']) !== undefined) {
5611
- throw new Error('example parameter is not supported in Gemini API.');
5612
- }
5613
- if (getValueByPath(fromObject, ['pattern']) !== undefined) {
5614
- throw new Error('pattern parameter is not supported in Gemini API.');
5615
- }
5616
- if (getValueByPath(fromObject, ['default']) !== undefined) {
5617
- throw new Error('default parameter is not supported in Gemini API.');
5618
- }
5619
- if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
5620
- throw new Error('maxLength parameter is not supported in Gemini API.');
5621
- }
5622
- if (getValueByPath(fromObject, ['minLength']) !== undefined) {
5623
- throw new Error('minLength parameter is not supported in Gemini API.');
5624
- }
5625
- if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
5626
- throw new Error('minProperties parameter is not supported in Gemini API.');
5627
- }
5628
- if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
5629
- throw new Error('maxProperties parameter is not supported in Gemini API.');
5630
- }
5631
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
5632
- if (fromAnyOf != null) {
5633
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
5634
- }
5635
- const fromDescription = getValueByPath(fromObject, ['description']);
5636
- if (fromDescription != null) {
5637
- setValueByPath(toObject, ['description'], fromDescription);
5638
- }
5639
- const fromEnum = getValueByPath(fromObject, ['enum']);
5640
- if (fromEnum != null) {
5641
- setValueByPath(toObject, ['enum'], fromEnum);
5642
- }
5643
- const fromFormat = getValueByPath(fromObject, ['format']);
5644
- if (fromFormat != null) {
5645
- setValueByPath(toObject, ['format'], fromFormat);
5646
- }
5647
- const fromItems = getValueByPath(fromObject, ['items']);
5648
- if (fromItems != null) {
5649
- setValueByPath(toObject, ['items'], fromItems);
5650
- }
5651
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
5652
- if (fromMaxItems != null) {
5653
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
5654
- }
5655
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
5656
- if (fromMaximum != null) {
5657
- setValueByPath(toObject, ['maximum'], fromMaximum);
5658
- }
5659
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
5660
- if (fromMinItems != null) {
5661
- setValueByPath(toObject, ['minItems'], fromMinItems);
5662
- }
5663
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
5664
- if (fromMinimum != null) {
5665
- setValueByPath(toObject, ['minimum'], fromMinimum);
5666
- }
5667
- const fromNullable = getValueByPath(fromObject, ['nullable']);
5668
- if (fromNullable != null) {
5669
- setValueByPath(toObject, ['nullable'], fromNullable);
5670
- }
5671
- const fromProperties = getValueByPath(fromObject, ['properties']);
5672
- if (fromProperties != null) {
5673
- setValueByPath(toObject, ['properties'], fromProperties);
5674
- }
5675
- const fromPropertyOrdering = getValueByPath(fromObject, [
5676
- 'propertyOrdering',
5677
- ]);
5678
- if (fromPropertyOrdering != null) {
5679
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
5680
- }
5681
- const fromRequired = getValueByPath(fromObject, ['required']);
5682
- if (fromRequired != null) {
5683
- setValueByPath(toObject, ['required'], fromRequired);
5684
- }
5685
- const fromTitle = getValueByPath(fromObject, ['title']);
5686
- if (fromTitle != null) {
5687
- setValueByPath(toObject, ['title'], fromTitle);
5688
- }
5689
- const fromType = getValueByPath(fromObject, ['type']);
5690
- if (fromType != null) {
5691
- setValueByPath(toObject, ['type'], fromType);
5692
- }
5693
- return toObject;
5694
- }
5695
5331
  function safetySettingToMldev(apiClient, fromObject) {
5696
5332
  const toObject = {};
5697
5333
  if (getValueByPath(fromObject, ['method']) !== undefined) {
@@ -5707,25 +5343,6 @@ function safetySettingToMldev(apiClient, fromObject) {
5707
5343
  }
5708
5344
  return toObject;
5709
5345
  }
5710
- function functionDeclarationToMldev(apiClient, fromObject) {
5711
- const toObject = {};
5712
- if (getValueByPath(fromObject, ['response']) !== undefined) {
5713
- throw new Error('response parameter is not supported in Gemini API.');
5714
- }
5715
- const fromDescription = getValueByPath(fromObject, ['description']);
5716
- if (fromDescription != null) {
5717
- setValueByPath(toObject, ['description'], fromDescription);
5718
- }
5719
- const fromName = getValueByPath(fromObject, ['name']);
5720
- if (fromName != null) {
5721
- setValueByPath(toObject, ['name'], fromName);
5722
- }
5723
- const fromParameters = getValueByPath(fromObject, ['parameters']);
5724
- if (fromParameters != null) {
5725
- setValueByPath(toObject, ['parameters'], fromParameters);
5726
- }
5727
- return toObject;
5728
- }
5729
5346
  function googleSearchToMldev() {
5730
5347
  const toObject = {};
5731
5348
  return toObject;
@@ -5756,19 +5373,6 @@ function googleSearchRetrievalToMldev(apiClient, fromObject) {
5756
5373
  }
5757
5374
  function toolToMldev(apiClient, fromObject) {
5758
5375
  const toObject = {};
5759
- const fromFunctionDeclarations = getValueByPath(fromObject, [
5760
- 'functionDeclarations',
5761
- ]);
5762
- if (fromFunctionDeclarations != null) {
5763
- if (Array.isArray(fromFunctionDeclarations)) {
5764
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
5765
- return functionDeclarationToMldev(apiClient, item);
5766
- }));
5767
- }
5768
- else {
5769
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
5770
- }
5771
- }
5772
5376
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
5773
5377
  throw new Error('retrieval parameter is not supported in Gemini API.');
5774
5378
  }
@@ -5788,6 +5392,12 @@ function toolToMldev(apiClient, fromObject) {
5788
5392
  if (fromCodeExecution != null) {
5789
5393
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5790
5394
  }
5395
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
5396
+ 'functionDeclarations',
5397
+ ]);
5398
+ if (fromFunctionDeclarations != null) {
5399
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
5400
+ }
5791
5401
  return toObject;
5792
5402
  }
5793
5403
  function functionCallingConfigToMldev(apiClient, fromObject) {
@@ -5934,7 +5544,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
5934
5544
  'responseSchema',
5935
5545
  ]);
5936
5546
  if (fromResponseSchema != null) {
5937
- setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
5547
+ setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
5938
5548
  }
5939
5549
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
5940
5550
  throw new Error('routingConfig parameter is not supported in Gemini API.');
@@ -5946,25 +5556,23 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
5946
5556
  'safetySettings',
5947
5557
  ]);
5948
5558
  if (parentObject !== undefined && fromSafetySettings != null) {
5949
- if (Array.isArray(fromSafetySettings)) {
5950
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
5559
+ let transformedList = fromSafetySettings;
5560
+ if (Array.isArray(transformedList)) {
5561
+ transformedList = transformedList.map((item) => {
5951
5562
  return safetySettingToMldev(apiClient, item);
5952
- }));
5953
- }
5954
- else {
5955
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
5563
+ });
5956
5564
  }
5565
+ setValueByPath(parentObject, ['safetySettings'], transformedList);
5957
5566
  }
5958
5567
  const fromTools = getValueByPath(fromObject, ['tools']);
5959
5568
  if (parentObject !== undefined && fromTools != null) {
5960
- if (Array.isArray(fromTools)) {
5961
- setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
5569
+ let transformedList = tTools(apiClient, fromTools);
5570
+ if (Array.isArray(transformedList)) {
5571
+ transformedList = transformedList.map((item) => {
5962
5572
  return toolToMldev(apiClient, tTool(apiClient, item));
5963
- })));
5964
- }
5965
- else {
5966
- setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
5573
+ });
5967
5574
  }
5575
+ setValueByPath(parentObject, ['tools'], transformedList);
5968
5576
  }
5969
5577
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5970
5578
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -6014,14 +5622,13 @@ function generateContentParametersToMldev(apiClient, fromObject) {
6014
5622
  }
6015
5623
  const fromContents = getValueByPath(fromObject, ['contents']);
6016
5624
  if (fromContents != null) {
6017
- if (Array.isArray(fromContents)) {
6018
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
5625
+ let transformedList = tContents(apiClient, fromContents);
5626
+ if (Array.isArray(transformedList)) {
5627
+ transformedList = transformedList.map((item) => {
6019
5628
  return contentToMldev(apiClient, item);
6020
- })));
6021
- }
6022
- else {
6023
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
5629
+ });
6024
5630
  }
5631
+ setValueByPath(toObject, ['contents'], transformedList);
6025
5632
  }
6026
5633
  const fromConfig = getValueByPath(fromObject, ['config']);
6027
5634
  if (fromConfig != null) {
@@ -6176,6 +5783,42 @@ function getModelParametersToMldev(apiClient, fromObject) {
6176
5783
  }
6177
5784
  return toObject;
6178
5785
  }
5786
+ function updateModelConfigToMldev(apiClient, fromObject, parentObject) {
5787
+ const toObject = {};
5788
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5789
+ if (parentObject !== undefined && fromDisplayName != null) {
5790
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
5791
+ }
5792
+ const fromDescription = getValueByPath(fromObject, ['description']);
5793
+ if (parentObject !== undefined && fromDescription != null) {
5794
+ setValueByPath(parentObject, ['description'], fromDescription);
5795
+ }
5796
+ return toObject;
5797
+ }
5798
+ function updateModelParametersToMldev(apiClient, fromObject) {
5799
+ const toObject = {};
5800
+ const fromModel = getValueByPath(fromObject, ['model']);
5801
+ if (fromModel != null) {
5802
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
5803
+ }
5804
+ const fromConfig = getValueByPath(fromObject, ['config']);
5805
+ if (fromConfig != null) {
5806
+ setValueByPath(toObject, ['config'], updateModelConfigToMldev(apiClient, fromConfig, toObject));
5807
+ }
5808
+ return toObject;
5809
+ }
5810
+ function deleteModelParametersToMldev(apiClient, fromObject) {
5811
+ const toObject = {};
5812
+ const fromModel = getValueByPath(fromObject, ['model']);
5813
+ if (fromModel != null) {
5814
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
5815
+ }
5816
+ const fromConfig = getValueByPath(fromObject, ['config']);
5817
+ if (fromConfig != null) {
5818
+ setValueByPath(toObject, ['config'], fromConfig);
5819
+ }
5820
+ return toObject;
5821
+ }
6179
5822
  function countTokensConfigToMldev(apiClient, fromObject) {
6180
5823
  const toObject = {};
6181
5824
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
@@ -6197,14 +5840,13 @@ function countTokensParametersToMldev(apiClient, fromObject) {
6197
5840
  }
6198
5841
  const fromContents = getValueByPath(fromObject, ['contents']);
6199
5842
  if (fromContents != null) {
6200
- if (Array.isArray(fromContents)) {
6201
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
5843
+ let transformedList = tContents(apiClient, fromContents);
5844
+ if (Array.isArray(transformedList)) {
5845
+ transformedList = transformedList.map((item) => {
6202
5846
  return contentToMldev(apiClient, item);
6203
- })));
6204
- }
6205
- else {
6206
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
5847
+ });
6207
5848
  }
5849
+ setValueByPath(toObject, ['contents'], transformedList);
6208
5850
  }
6209
5851
  const fromConfig = getValueByPath(fromObject, ['config']);
6210
5852
  if (fromConfig != null) {
@@ -6349,14 +5991,13 @@ function contentToVertex(apiClient, fromObject) {
6349
5991
  const toObject = {};
6350
5992
  const fromParts = getValueByPath(fromObject, ['parts']);
6351
5993
  if (fromParts != null) {
6352
- if (Array.isArray(fromParts)) {
6353
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
5994
+ let transformedList = fromParts;
5995
+ if (Array.isArray(transformedList)) {
5996
+ transformedList = transformedList.map((item) => {
6354
5997
  return partToVertex(apiClient, item);
6355
- }));
6356
- }
6357
- else {
6358
- setValueByPath(toObject, ['parts'], fromParts);
5998
+ });
6359
5999
  }
6000
+ setValueByPath(toObject, ['parts'], transformedList);
6360
6001
  }
6361
6002
  const fromRole = getValueByPath(fromObject, ['role']);
6362
6003
  if (fromRole != null) {
@@ -6364,104 +6005,6 @@ function contentToVertex(apiClient, fromObject) {
6364
6005
  }
6365
6006
  return toObject;
6366
6007
  }
6367
- function schemaToVertex(apiClient, fromObject) {
6368
- const toObject = {};
6369
- const fromExample = getValueByPath(fromObject, ['example']);
6370
- if (fromExample != null) {
6371
- setValueByPath(toObject, ['example'], fromExample);
6372
- }
6373
- const fromPattern = getValueByPath(fromObject, ['pattern']);
6374
- if (fromPattern != null) {
6375
- setValueByPath(toObject, ['pattern'], fromPattern);
6376
- }
6377
- const fromDefault = getValueByPath(fromObject, ['default']);
6378
- if (fromDefault != null) {
6379
- setValueByPath(toObject, ['default'], fromDefault);
6380
- }
6381
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
6382
- if (fromMaxLength != null) {
6383
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
6384
- }
6385
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
6386
- if (fromMinLength != null) {
6387
- setValueByPath(toObject, ['minLength'], fromMinLength);
6388
- }
6389
- const fromMinProperties = getValueByPath(fromObject, [
6390
- 'minProperties',
6391
- ]);
6392
- if (fromMinProperties != null) {
6393
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
6394
- }
6395
- const fromMaxProperties = getValueByPath(fromObject, [
6396
- 'maxProperties',
6397
- ]);
6398
- if (fromMaxProperties != null) {
6399
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
6400
- }
6401
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
6402
- if (fromAnyOf != null) {
6403
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
6404
- }
6405
- const fromDescription = getValueByPath(fromObject, ['description']);
6406
- if (fromDescription != null) {
6407
- setValueByPath(toObject, ['description'], fromDescription);
6408
- }
6409
- const fromEnum = getValueByPath(fromObject, ['enum']);
6410
- if (fromEnum != null) {
6411
- setValueByPath(toObject, ['enum'], fromEnum);
6412
- }
6413
- const fromFormat = getValueByPath(fromObject, ['format']);
6414
- if (fromFormat != null) {
6415
- setValueByPath(toObject, ['format'], fromFormat);
6416
- }
6417
- const fromItems = getValueByPath(fromObject, ['items']);
6418
- if (fromItems != null) {
6419
- setValueByPath(toObject, ['items'], fromItems);
6420
- }
6421
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
6422
- if (fromMaxItems != null) {
6423
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
6424
- }
6425
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
6426
- if (fromMaximum != null) {
6427
- setValueByPath(toObject, ['maximum'], fromMaximum);
6428
- }
6429
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
6430
- if (fromMinItems != null) {
6431
- setValueByPath(toObject, ['minItems'], fromMinItems);
6432
- }
6433
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
6434
- if (fromMinimum != null) {
6435
- setValueByPath(toObject, ['minimum'], fromMinimum);
6436
- }
6437
- const fromNullable = getValueByPath(fromObject, ['nullable']);
6438
- if (fromNullable != null) {
6439
- setValueByPath(toObject, ['nullable'], fromNullable);
6440
- }
6441
- const fromProperties = getValueByPath(fromObject, ['properties']);
6442
- if (fromProperties != null) {
6443
- setValueByPath(toObject, ['properties'], fromProperties);
6444
- }
6445
- const fromPropertyOrdering = getValueByPath(fromObject, [
6446
- 'propertyOrdering',
6447
- ]);
6448
- if (fromPropertyOrdering != null) {
6449
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
6450
- }
6451
- const fromRequired = getValueByPath(fromObject, ['required']);
6452
- if (fromRequired != null) {
6453
- setValueByPath(toObject, ['required'], fromRequired);
6454
- }
6455
- const fromTitle = getValueByPath(fromObject, ['title']);
6456
- if (fromTitle != null) {
6457
- setValueByPath(toObject, ['title'], fromTitle);
6458
- }
6459
- const fromType = getValueByPath(fromObject, ['type']);
6460
- if (fromType != null) {
6461
- setValueByPath(toObject, ['type'], fromType);
6462
- }
6463
- return toObject;
6464
- }
6465
6008
  function modelSelectionConfigToVertex(apiClient, fromObject) {
6466
6009
  const toObject = {};
6467
6010
  const fromFeatureSelectionPreference = getValueByPath(fromObject, [
@@ -6488,26 +6031,6 @@ function safetySettingToVertex(apiClient, fromObject) {
6488
6031
  }
6489
6032
  return toObject;
6490
6033
  }
6491
- function functionDeclarationToVertex(apiClient, fromObject) {
6492
- const toObject = {};
6493
- const fromResponse = getValueByPath(fromObject, ['response']);
6494
- if (fromResponse != null) {
6495
- setValueByPath(toObject, ['response'], schemaToVertex(apiClient, fromResponse));
6496
- }
6497
- const fromDescription = getValueByPath(fromObject, ['description']);
6498
- if (fromDescription != null) {
6499
- setValueByPath(toObject, ['description'], fromDescription);
6500
- }
6501
- const fromName = getValueByPath(fromObject, ['name']);
6502
- if (fromName != null) {
6503
- setValueByPath(toObject, ['name'], fromName);
6504
- }
6505
- const fromParameters = getValueByPath(fromObject, ['parameters']);
6506
- if (fromParameters != null) {
6507
- setValueByPath(toObject, ['parameters'], fromParameters);
6508
- }
6509
- return toObject;
6510
- }
6511
6034
  function googleSearchToVertex() {
6512
6035
  const toObject = {};
6513
6036
  return toObject;
@@ -6538,19 +6061,6 @@ function googleSearchRetrievalToVertex(apiClient, fromObject) {
6538
6061
  }
6539
6062
  function toolToVertex(apiClient, fromObject) {
6540
6063
  const toObject = {};
6541
- const fromFunctionDeclarations = getValueByPath(fromObject, [
6542
- 'functionDeclarations',
6543
- ]);
6544
- if (fromFunctionDeclarations != null) {
6545
- if (Array.isArray(fromFunctionDeclarations)) {
6546
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
6547
- return functionDeclarationToVertex(apiClient, item);
6548
- }));
6549
- }
6550
- else {
6551
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
6552
- }
6553
- }
6554
6064
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
6555
6065
  if (fromRetrieval != null) {
6556
6066
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
@@ -6571,6 +6081,12 @@ function toolToVertex(apiClient, fromObject) {
6571
6081
  if (fromCodeExecution != null) {
6572
6082
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
6573
6083
  }
6084
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
6085
+ 'functionDeclarations',
6086
+ ]);
6087
+ if (fromFunctionDeclarations != null) {
6088
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
6089
+ }
6574
6090
  return toObject;
6575
6091
  }
6576
6092
  function functionCallingConfigToVertex(apiClient, fromObject) {
@@ -6717,7 +6233,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
6717
6233
  'responseSchema',
6718
6234
  ]);
6719
6235
  if (fromResponseSchema != null) {
6720
- setValueByPath(toObject, ['responseSchema'], schemaToVertex(apiClient, tSchema(apiClient, fromResponseSchema)));
6236
+ setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
6721
6237
  }
6722
6238
  const fromRoutingConfig = getValueByPath(fromObject, [
6723
6239
  'routingConfig',
@@ -6735,25 +6251,23 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
6735
6251
  'safetySettings',
6736
6252
  ]);
6737
6253
  if (parentObject !== undefined && fromSafetySettings != null) {
6738
- if (Array.isArray(fromSafetySettings)) {
6739
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
6254
+ let transformedList = fromSafetySettings;
6255
+ if (Array.isArray(transformedList)) {
6256
+ transformedList = transformedList.map((item) => {
6740
6257
  return safetySettingToVertex(apiClient, item);
6741
- }));
6742
- }
6743
- else {
6744
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
6258
+ });
6745
6259
  }
6260
+ setValueByPath(parentObject, ['safetySettings'], transformedList);
6746
6261
  }
6747
6262
  const fromTools = getValueByPath(fromObject, ['tools']);
6748
6263
  if (parentObject !== undefined && fromTools != null) {
6749
- if (Array.isArray(fromTools)) {
6750
- setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
6264
+ let transformedList = tTools(apiClient, fromTools);
6265
+ if (Array.isArray(transformedList)) {
6266
+ transformedList = transformedList.map((item) => {
6751
6267
  return toolToVertex(apiClient, tTool(apiClient, item));
6752
- })));
6753
- }
6754
- else {
6755
- setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
6268
+ });
6756
6269
  }
6270
+ setValueByPath(parentObject, ['tools'], transformedList);
6757
6271
  }
6758
6272
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
6759
6273
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -6807,14 +6321,13 @@ function generateContentParametersToVertex(apiClient, fromObject) {
6807
6321
  }
6808
6322
  const fromContents = getValueByPath(fromObject, ['contents']);
6809
6323
  if (fromContents != null) {
6810
- if (Array.isArray(fromContents)) {
6811
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
6324
+ let transformedList = tContents(apiClient, fromContents);
6325
+ if (Array.isArray(transformedList)) {
6326
+ transformedList = transformedList.map((item) => {
6812
6327
  return contentToVertex(apiClient, item);
6813
- })));
6814
- }
6815
- else {
6816
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
6328
+ });
6817
6329
  }
6330
+ setValueByPath(toObject, ['contents'], transformedList);
6818
6331
  }
6819
6332
  const fromConfig = getValueByPath(fromObject, ['config']);
6820
6333
  if (fromConfig != null) {
@@ -6976,6 +6489,42 @@ function getModelParametersToVertex(apiClient, fromObject) {
6976
6489
  }
6977
6490
  return toObject;
6978
6491
  }
6492
+ function updateModelConfigToVertex(apiClient, fromObject, parentObject) {
6493
+ const toObject = {};
6494
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
6495
+ if (parentObject !== undefined && fromDisplayName != null) {
6496
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
6497
+ }
6498
+ const fromDescription = getValueByPath(fromObject, ['description']);
6499
+ if (parentObject !== undefined && fromDescription != null) {
6500
+ setValueByPath(parentObject, ['description'], fromDescription);
6501
+ }
6502
+ return toObject;
6503
+ }
6504
+ function updateModelParametersToVertex(apiClient, fromObject) {
6505
+ const toObject = {};
6506
+ const fromModel = getValueByPath(fromObject, ['model']);
6507
+ if (fromModel != null) {
6508
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
6509
+ }
6510
+ const fromConfig = getValueByPath(fromObject, ['config']);
6511
+ if (fromConfig != null) {
6512
+ setValueByPath(toObject, ['config'], updateModelConfigToVertex(apiClient, fromConfig, toObject));
6513
+ }
6514
+ return toObject;
6515
+ }
6516
+ function deleteModelParametersToVertex(apiClient, fromObject) {
6517
+ const toObject = {};
6518
+ const fromModel = getValueByPath(fromObject, ['model']);
6519
+ if (fromModel != null) {
6520
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
6521
+ }
6522
+ const fromConfig = getValueByPath(fromObject, ['config']);
6523
+ if (fromConfig != null) {
6524
+ setValueByPath(toObject, ['config'], fromConfig);
6525
+ }
6526
+ return toObject;
6527
+ }
6979
6528
  function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
6980
6529
  const toObject = {};
6981
6530
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -6986,14 +6535,13 @@ function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
6986
6535
  }
6987
6536
  const fromTools = getValueByPath(fromObject, ['tools']);
6988
6537
  if (parentObject !== undefined && fromTools != null) {
6989
- if (Array.isArray(fromTools)) {
6990
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
6538
+ let transformedList = fromTools;
6539
+ if (Array.isArray(transformedList)) {
6540
+ transformedList = transformedList.map((item) => {
6991
6541
  return toolToVertex(apiClient, item);
6992
- }));
6993
- }
6994
- else {
6995
- setValueByPath(parentObject, ['tools'], fromTools);
6542
+ });
6996
6543
  }
6544
+ setValueByPath(parentObject, ['tools'], transformedList);
6997
6545
  }
6998
6546
  const fromGenerationConfig = getValueByPath(fromObject, [
6999
6547
  'generationConfig',
@@ -7011,14 +6559,13 @@ function countTokensParametersToVertex(apiClient, fromObject) {
7011
6559
  }
7012
6560
  const fromContents = getValueByPath(fromObject, ['contents']);
7013
6561
  if (fromContents != null) {
7014
- if (Array.isArray(fromContents)) {
7015
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
6562
+ let transformedList = tContents(apiClient, fromContents);
6563
+ if (Array.isArray(transformedList)) {
6564
+ transformedList = transformedList.map((item) => {
7016
6565
  return contentToVertex(apiClient, item);
7017
- })));
7018
- }
7019
- else {
7020
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
6566
+ });
7021
6567
  }
6568
+ setValueByPath(toObject, ['contents'], transformedList);
7022
6569
  }
7023
6570
  const fromConfig = getValueByPath(fromObject, ['config']);
7024
6571
  if (fromConfig != null) {
@@ -7034,14 +6581,13 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
7034
6581
  }
7035
6582
  const fromContents = getValueByPath(fromObject, ['contents']);
7036
6583
  if (fromContents != null) {
7037
- if (Array.isArray(fromContents)) {
7038
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
6584
+ let transformedList = tContents(apiClient, fromContents);
6585
+ if (Array.isArray(transformedList)) {
6586
+ transformedList = transformedList.map((item) => {
7039
6587
  return contentToVertex(apiClient, item);
7040
- })));
7041
- }
7042
- else {
7043
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
6588
+ });
7044
6589
  }
6590
+ setValueByPath(toObject, ['contents'], transformedList);
7045
6591
  }
7046
6592
  const fromConfig = getValueByPath(fromObject, ['config']);
7047
6593
  if (fromConfig != null) {
@@ -7189,14 +6735,13 @@ function contentFromMldev(apiClient, fromObject) {
7189
6735
  const toObject = {};
7190
6736
  const fromParts = getValueByPath(fromObject, ['parts']);
7191
6737
  if (fromParts != null) {
7192
- if (Array.isArray(fromParts)) {
7193
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
6738
+ let transformedList = fromParts;
6739
+ if (Array.isArray(transformedList)) {
6740
+ transformedList = transformedList.map((item) => {
7194
6741
  return partFromMldev(apiClient, item);
7195
- }));
7196
- }
7197
- else {
7198
- setValueByPath(toObject, ['parts'], fromParts);
6742
+ });
7199
6743
  }
6744
+ setValueByPath(toObject, ['parts'], transformedList);
7200
6745
  }
7201
6746
  const fromRole = getValueByPath(fromObject, ['role']);
7202
6747
  if (fromRole != null) {
@@ -7264,14 +6809,13 @@ function generateContentResponseFromMldev(apiClient, fromObject) {
7264
6809
  const toObject = {};
7265
6810
  const fromCandidates = getValueByPath(fromObject, ['candidates']);
7266
6811
  if (fromCandidates != null) {
7267
- if (Array.isArray(fromCandidates)) {
7268
- setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
6812
+ let transformedList = fromCandidates;
6813
+ if (Array.isArray(transformedList)) {
6814
+ transformedList = transformedList.map((item) => {
7269
6815
  return candidateFromMldev(apiClient, item);
7270
- }));
7271
- }
7272
- else {
7273
- setValueByPath(toObject, ['candidates'], fromCandidates);
6816
+ });
7274
6817
  }
6818
+ setValueByPath(toObject, ['candidates'], transformedList);
7275
6819
  }
7276
6820
  const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
7277
6821
  if (fromModelVersion != null) {
@@ -7307,14 +6851,13 @@ function embedContentResponseFromMldev(apiClient, fromObject) {
7307
6851
  const toObject = {};
7308
6852
  const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
7309
6853
  if (fromEmbeddings != null) {
7310
- if (Array.isArray(fromEmbeddings)) {
7311
- setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
6854
+ let transformedList = fromEmbeddings;
6855
+ if (Array.isArray(transformedList)) {
6856
+ transformedList = transformedList.map((item) => {
7312
6857
  return contentEmbeddingFromMldev(apiClient, item);
7313
- }));
7314
- }
7315
- else {
7316
- setValueByPath(toObject, ['embeddings'], fromEmbeddings);
6858
+ });
7317
6859
  }
6860
+ setValueByPath(toObject, ['embeddings'], transformedList);
7318
6861
  }
7319
6862
  const fromMetadata = getValueByPath(fromObject, ['metadata']);
7320
6863
  if (fromMetadata != null) {
@@ -7382,14 +6925,13 @@ function generateImagesResponseFromMldev(apiClient, fromObject) {
7382
6925
  'predictions',
7383
6926
  ]);
7384
6927
  if (fromGeneratedImages != null) {
7385
- if (Array.isArray(fromGeneratedImages)) {
7386
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
6928
+ let transformedList = fromGeneratedImages;
6929
+ if (Array.isArray(transformedList)) {
6930
+ transformedList = transformedList.map((item) => {
7387
6931
  return generatedImageFromMldev(apiClient, item);
7388
- }));
7389
- }
7390
- else {
7391
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
6932
+ });
7392
6933
  }
6934
+ setValueByPath(toObject, ['generatedImages'], transformedList);
7393
6935
  }
7394
6936
  const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
7395
6937
  'positivePromptSafetyAttributes',
@@ -7457,6 +6999,10 @@ function modelFromMldev(apiClient, fromObject) {
7457
6999
  }
7458
7000
  return toObject;
7459
7001
  }
7002
+ function deleteModelResponseFromMldev() {
7003
+ const toObject = {};
7004
+ return toObject;
7005
+ }
7460
7006
  function countTokensResponseFromMldev(apiClient, fromObject) {
7461
7007
  const toObject = {};
7462
7008
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -7504,14 +7050,13 @@ function generateVideosResponseFromMldev$1(apiClient, fromObject) {
7504
7050
  'generatedSamples',
7505
7051
  ]);
7506
7052
  if (fromGeneratedVideos != null) {
7507
- if (Array.isArray(fromGeneratedVideos)) {
7508
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
7053
+ let transformedList = fromGeneratedVideos;
7054
+ if (Array.isArray(transformedList)) {
7055
+ transformedList = transformedList.map((item) => {
7509
7056
  return generatedVideoFromMldev$1(apiClient, item);
7510
- }));
7511
- }
7512
- else {
7513
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
7057
+ });
7514
7058
  }
7059
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
7515
7060
  }
7516
7061
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
7517
7062
  'raiMediaFilteredCount',
@@ -7606,14 +7151,13 @@ function contentFromVertex(apiClient, fromObject) {
7606
7151
  const toObject = {};
7607
7152
  const fromParts = getValueByPath(fromObject, ['parts']);
7608
7153
  if (fromParts != null) {
7609
- if (Array.isArray(fromParts)) {
7610
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
7154
+ let transformedList = fromParts;
7155
+ if (Array.isArray(transformedList)) {
7156
+ transformedList = transformedList.map((item) => {
7611
7157
  return partFromVertex(apiClient, item);
7612
- }));
7613
- }
7614
- else {
7615
- setValueByPath(toObject, ['parts'], fromParts);
7158
+ });
7616
7159
  }
7160
+ setValueByPath(toObject, ['parts'], transformedList);
7617
7161
  }
7618
7162
  const fromRole = getValueByPath(fromObject, ['role']);
7619
7163
  if (fromRole != null) {
@@ -7683,14 +7227,13 @@ function generateContentResponseFromVertex(apiClient, fromObject) {
7683
7227
  const toObject = {};
7684
7228
  const fromCandidates = getValueByPath(fromObject, ['candidates']);
7685
7229
  if (fromCandidates != null) {
7686
- if (Array.isArray(fromCandidates)) {
7687
- setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
7230
+ let transformedList = fromCandidates;
7231
+ if (Array.isArray(transformedList)) {
7232
+ transformedList = transformedList.map((item) => {
7688
7233
  return candidateFromVertex(apiClient, item);
7689
- }));
7690
- }
7691
- else {
7692
- setValueByPath(toObject, ['candidates'], fromCandidates);
7234
+ });
7693
7235
  }
7236
+ setValueByPath(toObject, ['candidates'], transformedList);
7694
7237
  }
7695
7238
  const fromCreateTime = getValueByPath(fromObject, ['createTime']);
7696
7239
  if (fromCreateTime != null) {
@@ -7759,14 +7302,13 @@ function embedContentResponseFromVertex(apiClient, fromObject) {
7759
7302
  'embeddings',
7760
7303
  ]);
7761
7304
  if (fromEmbeddings != null) {
7762
- if (Array.isArray(fromEmbeddings)) {
7763
- setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
7305
+ let transformedList = fromEmbeddings;
7306
+ if (Array.isArray(transformedList)) {
7307
+ transformedList = transformedList.map((item) => {
7764
7308
  return contentEmbeddingFromVertex(apiClient, item);
7765
- }));
7766
- }
7767
- else {
7768
- setValueByPath(toObject, ['embeddings'], fromEmbeddings);
7309
+ });
7769
7310
  }
7311
+ setValueByPath(toObject, ['embeddings'], transformedList);
7770
7312
  }
7771
7313
  const fromMetadata = getValueByPath(fromObject, ['metadata']);
7772
7314
  if (fromMetadata != null) {
@@ -7842,14 +7384,13 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
7842
7384
  'predictions',
7843
7385
  ]);
7844
7386
  if (fromGeneratedImages != null) {
7845
- if (Array.isArray(fromGeneratedImages)) {
7846
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
7387
+ let transformedList = fromGeneratedImages;
7388
+ if (Array.isArray(transformedList)) {
7389
+ transformedList = transformedList.map((item) => {
7847
7390
  return generatedImageFromVertex(apiClient, item);
7848
- }));
7849
- }
7850
- else {
7851
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
7391
+ });
7852
7392
  }
7393
+ setValueByPath(toObject, ['generatedImages'], transformedList);
7853
7394
  }
7854
7395
  const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
7855
7396
  'positivePromptSafetyAttributes',
@@ -7912,14 +7453,13 @@ function modelFromVertex(apiClient, fromObject) {
7912
7453
  }
7913
7454
  const fromEndpoints = getValueByPath(fromObject, ['deployedModels']);
7914
7455
  if (fromEndpoints != null) {
7915
- if (Array.isArray(fromEndpoints)) {
7916
- setValueByPath(toObject, ['endpoints'], fromEndpoints.map((item) => {
7456
+ let transformedList = fromEndpoints;
7457
+ if (Array.isArray(transformedList)) {
7458
+ transformedList = transformedList.map((item) => {
7917
7459
  return endpointFromVertex(apiClient, item);
7918
- }));
7919
- }
7920
- else {
7921
- setValueByPath(toObject, ['endpoints'], fromEndpoints);
7460
+ });
7922
7461
  }
7462
+ setValueByPath(toObject, ['endpoints'], transformedList);
7923
7463
  }
7924
7464
  const fromLabels = getValueByPath(fromObject, ['labels']);
7925
7465
  if (fromLabels != null) {
@@ -7931,6 +7471,10 @@ function modelFromVertex(apiClient, fromObject) {
7931
7471
  }
7932
7472
  return toObject;
7933
7473
  }
7474
+ function deleteModelResponseFromVertex() {
7475
+ const toObject = {};
7476
+ return toObject;
7477
+ }
7934
7478
  function countTokensResponseFromVertex(apiClient, fromObject) {
7935
7479
  const toObject = {};
7936
7480
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -7977,14 +7521,13 @@ function generateVideosResponseFromVertex$1(apiClient, fromObject) {
7977
7521
  const toObject = {};
7978
7522
  const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
7979
7523
  if (fromGeneratedVideos != null) {
7980
- if (Array.isArray(fromGeneratedVideos)) {
7981
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
7524
+ let transformedList = fromGeneratedVideos;
7525
+ if (Array.isArray(transformedList)) {
7526
+ transformedList = transformedList.map((item) => {
7982
7527
  return generatedVideoFromVertex$1(apiClient, item);
7983
- }));
7984
- }
7985
- else {
7986
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
7528
+ });
7987
7529
  }
7530
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
7988
7531
  }
7989
7532
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
7990
7533
  'raiMediaFilteredCount',
@@ -8927,6 +8470,146 @@ class Models extends BaseModule {
8927
8470
  });
8928
8471
  }
8929
8472
  }
8473
+ /**
8474
+ * Updates a tuned model by its name.
8475
+ *
8476
+ * @param params - The parameters for updating the model.
8477
+ * @return The response from the API.
8478
+ *
8479
+ * @example
8480
+ * ```ts
8481
+ * const response = await ai.models.update({
8482
+ * model: 'tuned-model-name',
8483
+ * config: {
8484
+ * displayName: 'New display name',
8485
+ * description: 'New description',
8486
+ * },
8487
+ * });
8488
+ * ```
8489
+ */
8490
+ async update(params) {
8491
+ var _a, _b, _c, _d;
8492
+ let response;
8493
+ let path = '';
8494
+ let queryParams = {};
8495
+ if (this.apiClient.isVertexAI()) {
8496
+ const body = updateModelParametersToVertex(this.apiClient, params);
8497
+ path = formatMap('{model}', body['_url']);
8498
+ queryParams = body['_query'];
8499
+ delete body['config'];
8500
+ delete body['_url'];
8501
+ delete body['_query'];
8502
+ response = this.apiClient
8503
+ .request({
8504
+ path: path,
8505
+ queryParams: queryParams,
8506
+ body: JSON.stringify(body),
8507
+ httpMethod: 'PATCH',
8508
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
8509
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
8510
+ })
8511
+ .then((httpResponse) => {
8512
+ return httpResponse.json();
8513
+ });
8514
+ return response.then((apiResponse) => {
8515
+ const resp = modelFromVertex(this.apiClient, apiResponse);
8516
+ return resp;
8517
+ });
8518
+ }
8519
+ else {
8520
+ const body = updateModelParametersToMldev(this.apiClient, params);
8521
+ path = formatMap('{name}', body['_url']);
8522
+ queryParams = body['_query'];
8523
+ delete body['config'];
8524
+ delete body['_url'];
8525
+ delete body['_query'];
8526
+ response = this.apiClient
8527
+ .request({
8528
+ path: path,
8529
+ queryParams: queryParams,
8530
+ body: JSON.stringify(body),
8531
+ httpMethod: 'PATCH',
8532
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
8533
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
8534
+ })
8535
+ .then((httpResponse) => {
8536
+ return httpResponse.json();
8537
+ });
8538
+ return response.then((apiResponse) => {
8539
+ const resp = modelFromMldev(this.apiClient, apiResponse);
8540
+ return resp;
8541
+ });
8542
+ }
8543
+ }
8544
+ /**
8545
+ * Deletes a tuned model by its name.
8546
+ *
8547
+ * @param params - The parameters for deleting the model.
8548
+ * @return The response from the API.
8549
+ *
8550
+ * @example
8551
+ * ```ts
8552
+ * const response = await ai.models.delete({model: 'tuned-model-name'});
8553
+ * ```
8554
+ */
8555
+ async delete(params) {
8556
+ var _a, _b, _c, _d;
8557
+ let response;
8558
+ let path = '';
8559
+ let queryParams = {};
8560
+ if (this.apiClient.isVertexAI()) {
8561
+ const body = deleteModelParametersToVertex(this.apiClient, params);
8562
+ path = formatMap('{name}', body['_url']);
8563
+ queryParams = body['_query'];
8564
+ delete body['config'];
8565
+ delete body['_url'];
8566
+ delete body['_query'];
8567
+ response = this.apiClient
8568
+ .request({
8569
+ path: path,
8570
+ queryParams: queryParams,
8571
+ body: JSON.stringify(body),
8572
+ httpMethod: 'DELETE',
8573
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
8574
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
8575
+ })
8576
+ .then((httpResponse) => {
8577
+ return httpResponse.json();
8578
+ });
8579
+ return response.then(() => {
8580
+ const resp = deleteModelResponseFromVertex();
8581
+ const typedResp = new DeleteModelResponse();
8582
+ Object.assign(typedResp, resp);
8583
+ return typedResp;
8584
+ });
8585
+ }
8586
+ else {
8587
+ const body = deleteModelParametersToMldev(this.apiClient, params);
8588
+ path = formatMap('{name}', body['_url']);
8589
+ queryParams = body['_query'];
8590
+ delete body['config'];
8591
+ delete body['_url'];
8592
+ delete body['_query'];
8593
+ response = this.apiClient
8594
+ .request({
8595
+ path: path,
8596
+ queryParams: queryParams,
8597
+ body: JSON.stringify(body),
8598
+ httpMethod: 'DELETE',
8599
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
8600
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
8601
+ })
8602
+ .then((httpResponse) => {
8603
+ return httpResponse.json();
8604
+ });
8605
+ return response.then(() => {
8606
+ const resp = deleteModelResponseFromMldev();
8607
+ const typedResp = new DeleteModelResponse();
8608
+ Object.assign(typedResp, resp);
8609
+ return typedResp;
8610
+ });
8611
+ }
8612
+ }
8930
8613
  /**
8931
8614
  * Counts the number of tokens in the given contents. Multimodal input is
8932
8615
  * supported for Gemini models.
@@ -9217,14 +8900,13 @@ function generateVideosResponseFromMldev(apiClient, fromObject) {
9217
8900
  'generatedSamples',
9218
8901
  ]);
9219
8902
  if (fromGeneratedVideos != null) {
9220
- if (Array.isArray(fromGeneratedVideos)) {
9221
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
8903
+ let transformedList = fromGeneratedVideos;
8904
+ if (Array.isArray(transformedList)) {
8905
+ transformedList = transformedList.map((item) => {
9222
8906
  return generatedVideoFromMldev(apiClient, item);
9223
- }));
9224
- }
9225
- else {
9226
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
8907
+ });
9227
8908
  }
8909
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
9228
8910
  }
9229
8911
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
9230
8912
  'raiMediaFilteredCount',
@@ -9297,14 +8979,13 @@ function generateVideosResponseFromVertex(apiClient, fromObject) {
9297
8979
  const toObject = {};
9298
8980
  const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
9299
8981
  if (fromGeneratedVideos != null) {
9300
- if (Array.isArray(fromGeneratedVideos)) {
9301
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
8982
+ let transformedList = fromGeneratedVideos;
8983
+ if (Array.isArray(transformedList)) {
8984
+ transformedList = transformedList.map((item) => {
9302
8985
  return generatedVideoFromVertex(apiClient, item);
9303
- }));
9304
- }
9305
- else {
9306
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
8986
+ });
9307
8987
  }
8988
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
9308
8989
  }
9309
8990
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
9310
8991
  'raiMediaFilteredCount',
@@ -9475,6 +9156,736 @@ class Operations extends BaseModule {
9475
9156
  }
9476
9157
  }
9477
9158
 
9159
+ /**
9160
+ * @license
9161
+ * Copyright 2025 Google LLC
9162
+ * SPDX-License-Identifier: Apache-2.0
9163
+ */
9164
+ function getTuningJobParametersToMldev(apiClient, fromObject) {
9165
+ const toObject = {};
9166
+ const fromName = getValueByPath(fromObject, ['name']);
9167
+ if (fromName != null) {
9168
+ setValueByPath(toObject, ['_url', 'name'], fromName);
9169
+ }
9170
+ const fromConfig = getValueByPath(fromObject, ['config']);
9171
+ if (fromConfig != null) {
9172
+ setValueByPath(toObject, ['config'], fromConfig);
9173
+ }
9174
+ return toObject;
9175
+ }
9176
+ function listTuningJobsConfigToMldev(apiClient, fromObject, parentObject) {
9177
+ const toObject = {};
9178
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
9179
+ if (parentObject !== undefined && fromPageSize != null) {
9180
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
9181
+ }
9182
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
9183
+ if (parentObject !== undefined && fromPageToken != null) {
9184
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
9185
+ }
9186
+ const fromFilter = getValueByPath(fromObject, ['filter']);
9187
+ if (parentObject !== undefined && fromFilter != null) {
9188
+ setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
9189
+ }
9190
+ return toObject;
9191
+ }
9192
+ function listTuningJobsParametersToMldev(apiClient, fromObject) {
9193
+ const toObject = {};
9194
+ const fromConfig = getValueByPath(fromObject, ['config']);
9195
+ if (fromConfig != null) {
9196
+ setValueByPath(toObject, ['config'], listTuningJobsConfigToMldev(apiClient, fromConfig, toObject));
9197
+ }
9198
+ return toObject;
9199
+ }
9200
+ function tuningExampleToMldev(apiClient, fromObject) {
9201
+ const toObject = {};
9202
+ const fromTextInput = getValueByPath(fromObject, ['textInput']);
9203
+ if (fromTextInput != null) {
9204
+ setValueByPath(toObject, ['textInput'], fromTextInput);
9205
+ }
9206
+ const fromOutput = getValueByPath(fromObject, ['output']);
9207
+ if (fromOutput != null) {
9208
+ setValueByPath(toObject, ['output'], fromOutput);
9209
+ }
9210
+ return toObject;
9211
+ }
9212
+ function tuningDatasetToMldev(apiClient, fromObject) {
9213
+ const toObject = {};
9214
+ if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
9215
+ throw new Error('gcsUri parameter is not supported in Gemini API.');
9216
+ }
9217
+ const fromExamples = getValueByPath(fromObject, ['examples']);
9218
+ if (fromExamples != null) {
9219
+ let transformedList = fromExamples;
9220
+ if (Array.isArray(transformedList)) {
9221
+ transformedList = transformedList.map((item) => {
9222
+ return tuningExampleToMldev(apiClient, item);
9223
+ });
9224
+ }
9225
+ setValueByPath(toObject, ['examples', 'examples'], transformedList);
9226
+ }
9227
+ return toObject;
9228
+ }
9229
+ function createTuningJobConfigToMldev(apiClient, fromObject, parentObject) {
9230
+ const toObject = {};
9231
+ if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
9232
+ throw new Error('validationDataset parameter is not supported in Gemini API.');
9233
+ }
9234
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9235
+ 'tunedModelDisplayName',
9236
+ ]);
9237
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
9238
+ setValueByPath(parentObject, ['displayName'], fromTunedModelDisplayName);
9239
+ }
9240
+ if (getValueByPath(fromObject, ['description']) !== undefined) {
9241
+ throw new Error('description parameter is not supported in Gemini API.');
9242
+ }
9243
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
9244
+ if (parentObject !== undefined && fromEpochCount != null) {
9245
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'epochCount'], fromEpochCount);
9246
+ }
9247
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
9248
+ 'learningRateMultiplier',
9249
+ ]);
9250
+ if (fromLearningRateMultiplier != null) {
9251
+ setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
9252
+ }
9253
+ if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
9254
+ throw new Error('adapterSize parameter is not supported in Gemini API.');
9255
+ }
9256
+ const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
9257
+ if (parentObject !== undefined && fromBatchSize != null) {
9258
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
9259
+ }
9260
+ const fromLearningRate = getValueByPath(fromObject, ['learningRate']);
9261
+ if (parentObject !== undefined && fromLearningRate != null) {
9262
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
9263
+ }
9264
+ return toObject;
9265
+ }
9266
+ function createTuningJobParametersToMldev(apiClient, fromObject) {
9267
+ const toObject = {};
9268
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9269
+ if (fromBaseModel != null) {
9270
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9271
+ }
9272
+ const fromTrainingDataset = getValueByPath(fromObject, [
9273
+ 'trainingDataset',
9274
+ ]);
9275
+ if (fromTrainingDataset != null) {
9276
+ setValueByPath(toObject, ['tuningTask', 'trainingData'], tuningDatasetToMldev(apiClient, fromTrainingDataset));
9277
+ }
9278
+ const fromConfig = getValueByPath(fromObject, ['config']);
9279
+ if (fromConfig != null) {
9280
+ setValueByPath(toObject, ['config'], createTuningJobConfigToMldev(apiClient, fromConfig, toObject));
9281
+ }
9282
+ return toObject;
9283
+ }
9284
+ function getTuningJobParametersToVertex(apiClient, fromObject) {
9285
+ const toObject = {};
9286
+ const fromName = getValueByPath(fromObject, ['name']);
9287
+ if (fromName != null) {
9288
+ setValueByPath(toObject, ['_url', 'name'], fromName);
9289
+ }
9290
+ const fromConfig = getValueByPath(fromObject, ['config']);
9291
+ if (fromConfig != null) {
9292
+ setValueByPath(toObject, ['config'], fromConfig);
9293
+ }
9294
+ return toObject;
9295
+ }
9296
+ function listTuningJobsConfigToVertex(apiClient, fromObject, parentObject) {
9297
+ const toObject = {};
9298
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
9299
+ if (parentObject !== undefined && fromPageSize != null) {
9300
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
9301
+ }
9302
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
9303
+ if (parentObject !== undefined && fromPageToken != null) {
9304
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
9305
+ }
9306
+ const fromFilter = getValueByPath(fromObject, ['filter']);
9307
+ if (parentObject !== undefined && fromFilter != null) {
9308
+ setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
9309
+ }
9310
+ return toObject;
9311
+ }
9312
+ function listTuningJobsParametersToVertex(apiClient, fromObject) {
9313
+ const toObject = {};
9314
+ const fromConfig = getValueByPath(fromObject, ['config']);
9315
+ if (fromConfig != null) {
9316
+ setValueByPath(toObject, ['config'], listTuningJobsConfigToVertex(apiClient, fromConfig, toObject));
9317
+ }
9318
+ return toObject;
9319
+ }
9320
+ function tuningDatasetToVertex(apiClient, fromObject, parentObject) {
9321
+ const toObject = {};
9322
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
9323
+ if (parentObject !== undefined && fromGcsUri != null) {
9324
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
9325
+ }
9326
+ if (getValueByPath(fromObject, ['examples']) !== undefined) {
9327
+ throw new Error('examples parameter is not supported in Vertex AI.');
9328
+ }
9329
+ return toObject;
9330
+ }
9331
+ function tuningValidationDatasetToVertex(apiClient, fromObject) {
9332
+ const toObject = {};
9333
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
9334
+ if (fromGcsUri != null) {
9335
+ setValueByPath(toObject, ['validationDatasetUri'], fromGcsUri);
9336
+ }
9337
+ return toObject;
9338
+ }
9339
+ function createTuningJobConfigToVertex(apiClient, fromObject, parentObject) {
9340
+ const toObject = {};
9341
+ const fromValidationDataset = getValueByPath(fromObject, [
9342
+ 'validationDataset',
9343
+ ]);
9344
+ if (parentObject !== undefined && fromValidationDataset != null) {
9345
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(apiClient, fromValidationDataset));
9346
+ }
9347
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9348
+ 'tunedModelDisplayName',
9349
+ ]);
9350
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
9351
+ setValueByPath(parentObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
9352
+ }
9353
+ const fromDescription = getValueByPath(fromObject, ['description']);
9354
+ if (parentObject !== undefined && fromDescription != null) {
9355
+ setValueByPath(parentObject, ['description'], fromDescription);
9356
+ }
9357
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
9358
+ if (parentObject !== undefined && fromEpochCount != null) {
9359
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
9360
+ }
9361
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
9362
+ 'learningRateMultiplier',
9363
+ ]);
9364
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
9365
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
9366
+ }
9367
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
9368
+ if (parentObject !== undefined && fromAdapterSize != null) {
9369
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
9370
+ }
9371
+ if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
9372
+ throw new Error('batchSize parameter is not supported in Vertex AI.');
9373
+ }
9374
+ if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
9375
+ throw new Error('learningRate parameter is not supported in Vertex AI.');
9376
+ }
9377
+ return toObject;
9378
+ }
9379
+ function createTuningJobParametersToVertex(apiClient, fromObject) {
9380
+ const toObject = {};
9381
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9382
+ if (fromBaseModel != null) {
9383
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9384
+ }
9385
+ const fromTrainingDataset = getValueByPath(fromObject, [
9386
+ 'trainingDataset',
9387
+ ]);
9388
+ if (fromTrainingDataset != null) {
9389
+ setValueByPath(toObject, ['supervisedTuningSpec', 'trainingDatasetUri'], tuningDatasetToVertex(apiClient, fromTrainingDataset, toObject));
9390
+ }
9391
+ const fromConfig = getValueByPath(fromObject, ['config']);
9392
+ if (fromConfig != null) {
9393
+ setValueByPath(toObject, ['config'], createTuningJobConfigToVertex(apiClient, fromConfig, toObject));
9394
+ }
9395
+ return toObject;
9396
+ }
9397
+ function tunedModelFromMldev(apiClient, fromObject) {
9398
+ const toObject = {};
9399
+ const fromModel = getValueByPath(fromObject, ['name']);
9400
+ if (fromModel != null) {
9401
+ setValueByPath(toObject, ['model'], fromModel);
9402
+ }
9403
+ const fromEndpoint = getValueByPath(fromObject, ['name']);
9404
+ if (fromEndpoint != null) {
9405
+ setValueByPath(toObject, ['endpoint'], fromEndpoint);
9406
+ }
9407
+ return toObject;
9408
+ }
9409
+ function tuningJobFromMldev(apiClient, fromObject) {
9410
+ const toObject = {};
9411
+ const fromName = getValueByPath(fromObject, ['name']);
9412
+ if (fromName != null) {
9413
+ setValueByPath(toObject, ['name'], fromName);
9414
+ }
9415
+ const fromState = getValueByPath(fromObject, ['state']);
9416
+ if (fromState != null) {
9417
+ setValueByPath(toObject, ['state'], tTuningJobStatus(apiClient, fromState));
9418
+ }
9419
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
9420
+ if (fromCreateTime != null) {
9421
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
9422
+ }
9423
+ const fromStartTime = getValueByPath(fromObject, [
9424
+ 'tuningTask',
9425
+ 'startTime',
9426
+ ]);
9427
+ if (fromStartTime != null) {
9428
+ setValueByPath(toObject, ['startTime'], fromStartTime);
9429
+ }
9430
+ const fromEndTime = getValueByPath(fromObject, [
9431
+ 'tuningTask',
9432
+ 'completeTime',
9433
+ ]);
9434
+ if (fromEndTime != null) {
9435
+ setValueByPath(toObject, ['endTime'], fromEndTime);
9436
+ }
9437
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
9438
+ if (fromUpdateTime != null) {
9439
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
9440
+ }
9441
+ const fromDescription = getValueByPath(fromObject, ['description']);
9442
+ if (fromDescription != null) {
9443
+ setValueByPath(toObject, ['description'], fromDescription);
9444
+ }
9445
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9446
+ if (fromBaseModel != null) {
9447
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9448
+ }
9449
+ const fromTunedModel = getValueByPath(fromObject, ['_self']);
9450
+ if (fromTunedModel != null) {
9451
+ setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(apiClient, fromTunedModel));
9452
+ }
9453
+ const fromDistillationSpec = getValueByPath(fromObject, [
9454
+ 'distillationSpec',
9455
+ ]);
9456
+ if (fromDistillationSpec != null) {
9457
+ setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
9458
+ }
9459
+ const fromExperiment = getValueByPath(fromObject, ['experiment']);
9460
+ if (fromExperiment != null) {
9461
+ setValueByPath(toObject, ['experiment'], fromExperiment);
9462
+ }
9463
+ const fromLabels = getValueByPath(fromObject, ['labels']);
9464
+ if (fromLabels != null) {
9465
+ setValueByPath(toObject, ['labels'], fromLabels);
9466
+ }
9467
+ const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
9468
+ if (fromPipelineJob != null) {
9469
+ setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
9470
+ }
9471
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9472
+ 'tunedModelDisplayName',
9473
+ ]);
9474
+ if (fromTunedModelDisplayName != null) {
9475
+ setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
9476
+ }
9477
+ return toObject;
9478
+ }
9479
+ function listTuningJobsResponseFromMldev(apiClient, fromObject) {
9480
+ const toObject = {};
9481
+ const fromNextPageToken = getValueByPath(fromObject, [
9482
+ 'nextPageToken',
9483
+ ]);
9484
+ if (fromNextPageToken != null) {
9485
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
9486
+ }
9487
+ const fromTuningJobs = getValueByPath(fromObject, ['tunedModels']);
9488
+ if (fromTuningJobs != null) {
9489
+ let transformedList = fromTuningJobs;
9490
+ if (Array.isArray(transformedList)) {
9491
+ transformedList = transformedList.map((item) => {
9492
+ return tuningJobFromMldev(apiClient, item);
9493
+ });
9494
+ }
9495
+ setValueByPath(toObject, ['tuningJobs'], transformedList);
9496
+ }
9497
+ return toObject;
9498
+ }
9499
+ function operationFromMldev(apiClient, fromObject) {
9500
+ const toObject = {};
9501
+ const fromName = getValueByPath(fromObject, ['name']);
9502
+ if (fromName != null) {
9503
+ setValueByPath(toObject, ['name'], fromName);
9504
+ }
9505
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
9506
+ if (fromMetadata != null) {
9507
+ setValueByPath(toObject, ['metadata'], fromMetadata);
9508
+ }
9509
+ const fromDone = getValueByPath(fromObject, ['done']);
9510
+ if (fromDone != null) {
9511
+ setValueByPath(toObject, ['done'], fromDone);
9512
+ }
9513
+ const fromError = getValueByPath(fromObject, ['error']);
9514
+ if (fromError != null) {
9515
+ setValueByPath(toObject, ['error'], fromError);
9516
+ }
9517
+ return toObject;
9518
+ }
9519
+ function tunedModelFromVertex(apiClient, fromObject) {
9520
+ const toObject = {};
9521
+ const fromModel = getValueByPath(fromObject, ['model']);
9522
+ if (fromModel != null) {
9523
+ setValueByPath(toObject, ['model'], fromModel);
9524
+ }
9525
+ const fromEndpoint = getValueByPath(fromObject, ['endpoint']);
9526
+ if (fromEndpoint != null) {
9527
+ setValueByPath(toObject, ['endpoint'], fromEndpoint);
9528
+ }
9529
+ return toObject;
9530
+ }
9531
+ function tuningJobFromVertex(apiClient, fromObject) {
9532
+ const toObject = {};
9533
+ const fromName = getValueByPath(fromObject, ['name']);
9534
+ if (fromName != null) {
9535
+ setValueByPath(toObject, ['name'], fromName);
9536
+ }
9537
+ const fromState = getValueByPath(fromObject, ['state']);
9538
+ if (fromState != null) {
9539
+ setValueByPath(toObject, ['state'], tTuningJobStatus(apiClient, fromState));
9540
+ }
9541
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
9542
+ if (fromCreateTime != null) {
9543
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
9544
+ }
9545
+ const fromStartTime = getValueByPath(fromObject, ['startTime']);
9546
+ if (fromStartTime != null) {
9547
+ setValueByPath(toObject, ['startTime'], fromStartTime);
9548
+ }
9549
+ const fromEndTime = getValueByPath(fromObject, ['endTime']);
9550
+ if (fromEndTime != null) {
9551
+ setValueByPath(toObject, ['endTime'], fromEndTime);
9552
+ }
9553
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
9554
+ if (fromUpdateTime != null) {
9555
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
9556
+ }
9557
+ const fromError = getValueByPath(fromObject, ['error']);
9558
+ if (fromError != null) {
9559
+ setValueByPath(toObject, ['error'], fromError);
9560
+ }
9561
+ const fromDescription = getValueByPath(fromObject, ['description']);
9562
+ if (fromDescription != null) {
9563
+ setValueByPath(toObject, ['description'], fromDescription);
9564
+ }
9565
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9566
+ if (fromBaseModel != null) {
9567
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9568
+ }
9569
+ const fromTunedModel = getValueByPath(fromObject, ['tunedModel']);
9570
+ if (fromTunedModel != null) {
9571
+ setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(apiClient, fromTunedModel));
9572
+ }
9573
+ const fromSupervisedTuningSpec = getValueByPath(fromObject, [
9574
+ 'supervisedTuningSpec',
9575
+ ]);
9576
+ if (fromSupervisedTuningSpec != null) {
9577
+ setValueByPath(toObject, ['supervisedTuningSpec'], fromSupervisedTuningSpec);
9578
+ }
9579
+ const fromTuningDataStats = getValueByPath(fromObject, [
9580
+ 'tuningDataStats',
9581
+ ]);
9582
+ if (fromTuningDataStats != null) {
9583
+ setValueByPath(toObject, ['tuningDataStats'], fromTuningDataStats);
9584
+ }
9585
+ const fromEncryptionSpec = getValueByPath(fromObject, [
9586
+ 'encryptionSpec',
9587
+ ]);
9588
+ if (fromEncryptionSpec != null) {
9589
+ setValueByPath(toObject, ['encryptionSpec'], fromEncryptionSpec);
9590
+ }
9591
+ const fromPartnerModelTuningSpec = getValueByPath(fromObject, [
9592
+ 'partnerModelTuningSpec',
9593
+ ]);
9594
+ if (fromPartnerModelTuningSpec != null) {
9595
+ setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
9596
+ }
9597
+ const fromDistillationSpec = getValueByPath(fromObject, [
9598
+ 'distillationSpec',
9599
+ ]);
9600
+ if (fromDistillationSpec != null) {
9601
+ setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
9602
+ }
9603
+ const fromExperiment = getValueByPath(fromObject, ['experiment']);
9604
+ if (fromExperiment != null) {
9605
+ setValueByPath(toObject, ['experiment'], fromExperiment);
9606
+ }
9607
+ const fromLabels = getValueByPath(fromObject, ['labels']);
9608
+ if (fromLabels != null) {
9609
+ setValueByPath(toObject, ['labels'], fromLabels);
9610
+ }
9611
+ const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
9612
+ if (fromPipelineJob != null) {
9613
+ setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
9614
+ }
9615
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9616
+ 'tunedModelDisplayName',
9617
+ ]);
9618
+ if (fromTunedModelDisplayName != null) {
9619
+ setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
9620
+ }
9621
+ return toObject;
9622
+ }
9623
+ function listTuningJobsResponseFromVertex(apiClient, fromObject) {
9624
+ const toObject = {};
9625
+ const fromNextPageToken = getValueByPath(fromObject, [
9626
+ 'nextPageToken',
9627
+ ]);
9628
+ if (fromNextPageToken != null) {
9629
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
9630
+ }
9631
+ const fromTuningJobs = getValueByPath(fromObject, ['tuningJobs']);
9632
+ if (fromTuningJobs != null) {
9633
+ let transformedList = fromTuningJobs;
9634
+ if (Array.isArray(transformedList)) {
9635
+ transformedList = transformedList.map((item) => {
9636
+ return tuningJobFromVertex(apiClient, item);
9637
+ });
9638
+ }
9639
+ setValueByPath(toObject, ['tuningJobs'], transformedList);
9640
+ }
9641
+ return toObject;
9642
+ }
9643
+
9644
+ /**
9645
+ * @license
9646
+ * Copyright 2025 Google LLC
9647
+ * SPDX-License-Identifier: Apache-2.0
9648
+ */
9649
+ class Tunings extends BaseModule {
9650
+ constructor(apiClient) {
9651
+ super();
9652
+ this.apiClient = apiClient;
9653
+ /**
9654
+ * Gets a TuningJob.
9655
+ *
9656
+ * @param name - The resource name of the tuning job.
9657
+ * @return - A TuningJob object.
9658
+ *
9659
+ * @experimental - The SDK's tuning implementation is experimental, and may
9660
+ * change in future versions.
9661
+ */
9662
+ this.get = async (params) => {
9663
+ return await this.getInternal(params);
9664
+ };
9665
+ /**
9666
+ * Lists tuning jobs.
9667
+ *
9668
+ * @param config - The configuration for the list request.
9669
+ * @return - A list of tuning jobs.
9670
+ *
9671
+ * @experimental - The SDK's tuning implementation is experimental, and may
9672
+ * change in future versions.
9673
+ */
9674
+ this.list = async (params = {}) => {
9675
+ return new Pager(PagedItem.PAGED_ITEM_TUNING_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
9676
+ };
9677
+ /**
9678
+ * Creates a supervised fine-tuning job.
9679
+ *
9680
+ * @param params - The parameters for the tuning job.
9681
+ * @return - A TuningJob operation.
9682
+ *
9683
+ * @experimental - The SDK's tuning implementation is experimental, and may
9684
+ * change in future versions.
9685
+ */
9686
+ this.tune = async (params) => {
9687
+ if (this.apiClient.isVertexAI()) {
9688
+ return await this.tuneInternal(params);
9689
+ }
9690
+ else {
9691
+ const operation = await this.tuneMldevInternal(params);
9692
+ let tunedModelName = '';
9693
+ if (operation['metadata'] !== undefined &&
9694
+ operation['metadata']['tunedModel'] !== undefined) {
9695
+ tunedModelName = operation['metadata']['tunedModel'];
9696
+ }
9697
+ else if (operation['name'] !== undefined &&
9698
+ operation['name'].includes('/operations/')) {
9699
+ tunedModelName = operation['name'].split('/operations/')[0];
9700
+ }
9701
+ const tuningJob = {
9702
+ name: tunedModelName,
9703
+ state: JobState.JOB_STATE_QUEUED,
9704
+ };
9705
+ return tuningJob;
9706
+ }
9707
+ };
9708
+ }
9709
+ async getInternal(params) {
9710
+ var _a, _b, _c, _d;
9711
+ let response;
9712
+ let path = '';
9713
+ let queryParams = {};
9714
+ if (this.apiClient.isVertexAI()) {
9715
+ const body = getTuningJobParametersToVertex(this.apiClient, params);
9716
+ path = formatMap('{name}', body['_url']);
9717
+ queryParams = body['_query'];
9718
+ delete body['config'];
9719
+ delete body['_url'];
9720
+ delete body['_query'];
9721
+ response = this.apiClient
9722
+ .request({
9723
+ path: path,
9724
+ queryParams: queryParams,
9725
+ body: JSON.stringify(body),
9726
+ httpMethod: 'GET',
9727
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9728
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9729
+ })
9730
+ .then((httpResponse) => {
9731
+ return httpResponse.json();
9732
+ });
9733
+ return response.then((apiResponse) => {
9734
+ const resp = tuningJobFromVertex(this.apiClient, apiResponse);
9735
+ return resp;
9736
+ });
9737
+ }
9738
+ else {
9739
+ const body = getTuningJobParametersToMldev(this.apiClient, params);
9740
+ path = formatMap('{name}', body['_url']);
9741
+ queryParams = body['_query'];
9742
+ delete body['config'];
9743
+ delete body['_url'];
9744
+ delete body['_query'];
9745
+ response = this.apiClient
9746
+ .request({
9747
+ path: path,
9748
+ queryParams: queryParams,
9749
+ body: JSON.stringify(body),
9750
+ httpMethod: 'GET',
9751
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
9752
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
9753
+ })
9754
+ .then((httpResponse) => {
9755
+ return httpResponse.json();
9756
+ });
9757
+ return response.then((apiResponse) => {
9758
+ const resp = tuningJobFromMldev(this.apiClient, apiResponse);
9759
+ return resp;
9760
+ });
9761
+ }
9762
+ }
9763
+ async listInternal(params) {
9764
+ var _a, _b, _c, _d;
9765
+ let response;
9766
+ let path = '';
9767
+ let queryParams = {};
9768
+ if (this.apiClient.isVertexAI()) {
9769
+ const body = listTuningJobsParametersToVertex(this.apiClient, params);
9770
+ path = formatMap('tuningJobs', body['_url']);
9771
+ queryParams = body['_query'];
9772
+ delete body['config'];
9773
+ delete body['_url'];
9774
+ delete body['_query'];
9775
+ response = this.apiClient
9776
+ .request({
9777
+ path: path,
9778
+ queryParams: queryParams,
9779
+ body: JSON.stringify(body),
9780
+ httpMethod: 'GET',
9781
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9782
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9783
+ })
9784
+ .then((httpResponse) => {
9785
+ return httpResponse.json();
9786
+ });
9787
+ return response.then((apiResponse) => {
9788
+ const resp = listTuningJobsResponseFromVertex(this.apiClient, apiResponse);
9789
+ const typedResp = new ListTuningJobsResponse();
9790
+ Object.assign(typedResp, resp);
9791
+ return typedResp;
9792
+ });
9793
+ }
9794
+ else {
9795
+ const body = listTuningJobsParametersToMldev(this.apiClient, params);
9796
+ path = formatMap('tunedModels', body['_url']);
9797
+ queryParams = body['_query'];
9798
+ delete body['config'];
9799
+ delete body['_url'];
9800
+ delete body['_query'];
9801
+ response = this.apiClient
9802
+ .request({
9803
+ path: path,
9804
+ queryParams: queryParams,
9805
+ body: JSON.stringify(body),
9806
+ httpMethod: 'GET',
9807
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
9808
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
9809
+ })
9810
+ .then((httpResponse) => {
9811
+ return httpResponse.json();
9812
+ });
9813
+ return response.then((apiResponse) => {
9814
+ const resp = listTuningJobsResponseFromMldev(this.apiClient, apiResponse);
9815
+ const typedResp = new ListTuningJobsResponse();
9816
+ Object.assign(typedResp, resp);
9817
+ return typedResp;
9818
+ });
9819
+ }
9820
+ }
9821
+ async tuneInternal(params) {
9822
+ var _a, _b;
9823
+ let response;
9824
+ let path = '';
9825
+ let queryParams = {};
9826
+ if (this.apiClient.isVertexAI()) {
9827
+ const body = createTuningJobParametersToVertex(this.apiClient, params);
9828
+ path = formatMap('tuningJobs', body['_url']);
9829
+ queryParams = body['_query'];
9830
+ delete body['config'];
9831
+ delete body['_url'];
9832
+ delete body['_query'];
9833
+ response = this.apiClient
9834
+ .request({
9835
+ path: path,
9836
+ queryParams: queryParams,
9837
+ body: JSON.stringify(body),
9838
+ httpMethod: 'POST',
9839
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9840
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9841
+ })
9842
+ .then((httpResponse) => {
9843
+ return httpResponse.json();
9844
+ });
9845
+ return response.then((apiResponse) => {
9846
+ const resp = tuningJobFromVertex(this.apiClient, apiResponse);
9847
+ return resp;
9848
+ });
9849
+ }
9850
+ else {
9851
+ throw new Error('This method is only supported by the Vertex AI.');
9852
+ }
9853
+ }
9854
+ async tuneMldevInternal(params) {
9855
+ var _a, _b;
9856
+ let response;
9857
+ let path = '';
9858
+ let queryParams = {};
9859
+ if (this.apiClient.isVertexAI()) {
9860
+ throw new Error('This method is only supported by the Gemini Developer API.');
9861
+ }
9862
+ else {
9863
+ const body = createTuningJobParametersToMldev(this.apiClient, params);
9864
+ path = formatMap('tunedModels', body['_url']);
9865
+ queryParams = body['_query'];
9866
+ delete body['config'];
9867
+ delete body['_url'];
9868
+ delete body['_query'];
9869
+ response = this.apiClient
9870
+ .request({
9871
+ path: path,
9872
+ queryParams: queryParams,
9873
+ body: JSON.stringify(body),
9874
+ httpMethod: 'POST',
9875
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9876
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9877
+ })
9878
+ .then((httpResponse) => {
9879
+ return httpResponse.json();
9880
+ });
9881
+ return response.then((apiResponse) => {
9882
+ const resp = operationFromMldev(this.apiClient, apiResponse);
9883
+ return resp;
9884
+ });
9885
+ }
9886
+ }
9887
+ }
9888
+
9478
9889
  /**
9479
9890
  * @license
9480
9891
  * Copyright 2025 Google LLC
@@ -9556,8 +9967,9 @@ class GoogleGenAI {
9556
9967
  this.caches = new Caches(this.apiClient);
9557
9968
  this.files = new Files(this.apiClient);
9558
9969
  this.operations = new Operations(this.apiClient);
9970
+ this.tunings = new Tunings(this.apiClient);
9559
9971
  }
9560
9972
  }
9561
9973
 
9562
- export { ActivityHandling, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DynamicRetrievalConfigMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session, StartSensitivity, SubjectReferenceType, TrafficType, TurnCoverage, Type, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, setDefaultBaseUrls };
9974
+ export { ActivityHandling, AdapterSize, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session, StartSensitivity, SubjectReferenceType, TrafficType, TurnCoverage, Type, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, setDefaultBaseUrls };
9563
9975
  //# sourceMappingURL=index.mjs.map