@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.
@@ -524,6 +524,20 @@ function tCachedContentName(apiClient, name) {
524
524
  }
525
525
  return resourceName(apiClient, name, 'cachedContents');
526
526
  }
527
+ function tTuningJobStatus(apiClient, status) {
528
+ switch (status) {
529
+ case 'STATE_UNSPECIFIED':
530
+ return 'JOB_STATE_UNSPECIFIED';
531
+ case 'CREATING':
532
+ return 'JOB_STATE_RUNNING';
533
+ case 'ACTIVE':
534
+ return 'JOB_STATE_SUCCEEDED';
535
+ case 'FAILED':
536
+ return 'JOB_STATE_FAILED';
537
+ default:
538
+ return status;
539
+ }
540
+ }
527
541
  function tBytes(apiClient, fromImageBytes) {
528
542
  if (typeof fromImageBytes !== 'string') {
529
543
  throw new Error('fromImageBytes must be a string');
@@ -596,14 +610,13 @@ function contentToMldev$2(apiClient, fromObject) {
596
610
  const toObject = {};
597
611
  const fromParts = getValueByPath(fromObject, ['parts']);
598
612
  if (fromParts != null) {
599
- if (Array.isArray(fromParts)) {
600
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
613
+ let transformedList = fromParts;
614
+ if (Array.isArray(transformedList)) {
615
+ transformedList = transformedList.map((item) => {
601
616
  return partToMldev$2(apiClient, item);
602
- }));
603
- }
604
- else {
605
- setValueByPath(toObject, ['parts'], fromParts);
617
+ });
606
618
  }
619
+ setValueByPath(toObject, ['parts'], transformedList);
607
620
  }
608
621
  const fromRole = getValueByPath(fromObject, ['role']);
609
622
  if (fromRole != null) {
@@ -611,25 +624,6 @@ function contentToMldev$2(apiClient, fromObject) {
611
624
  }
612
625
  return toObject;
613
626
  }
614
- function functionDeclarationToMldev$2(apiClient, fromObject) {
615
- const toObject = {};
616
- if (getValueByPath(fromObject, ['response']) !== undefined) {
617
- throw new Error('response parameter is not supported in Gemini API.');
618
- }
619
- const fromDescription = getValueByPath(fromObject, ['description']);
620
- if (fromDescription != null) {
621
- setValueByPath(toObject, ['description'], fromDescription);
622
- }
623
- const fromName = getValueByPath(fromObject, ['name']);
624
- if (fromName != null) {
625
- setValueByPath(toObject, ['name'], fromName);
626
- }
627
- const fromParameters = getValueByPath(fromObject, ['parameters']);
628
- if (fromParameters != null) {
629
- setValueByPath(toObject, ['parameters'], fromParameters);
630
- }
631
- return toObject;
632
- }
633
627
  function googleSearchToMldev$2() {
634
628
  const toObject = {};
635
629
  return toObject;
@@ -660,19 +654,6 @@ function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
660
654
  }
661
655
  function toolToMldev$2(apiClient, fromObject) {
662
656
  const toObject = {};
663
- const fromFunctionDeclarations = getValueByPath(fromObject, [
664
- 'functionDeclarations',
665
- ]);
666
- if (fromFunctionDeclarations != null) {
667
- if (Array.isArray(fromFunctionDeclarations)) {
668
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
669
- return functionDeclarationToMldev$2(apiClient, item);
670
- }));
671
- }
672
- else {
673
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
674
- }
675
- }
676
657
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
677
658
  throw new Error('retrieval parameter is not supported in Gemini API.');
678
659
  }
@@ -692,6 +673,12 @@ function toolToMldev$2(apiClient, fromObject) {
692
673
  if (fromCodeExecution != null) {
693
674
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
694
675
  }
676
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
677
+ 'functionDeclarations',
678
+ ]);
679
+ if (fromFunctionDeclarations != null) {
680
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
681
+ }
695
682
  return toObject;
696
683
  }
697
684
  function functionCallingConfigToMldev$1(apiClient, fromObject) {
@@ -734,14 +721,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
734
721
  }
735
722
  const fromContents = getValueByPath(fromObject, ['contents']);
736
723
  if (parentObject !== undefined && fromContents != null) {
737
- if (Array.isArray(fromContents)) {
738
- setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
724
+ let transformedList = tContents(apiClient, fromContents);
725
+ if (Array.isArray(transformedList)) {
726
+ transformedList = transformedList.map((item) => {
739
727
  return contentToMldev$2(apiClient, item);
740
- })));
741
- }
742
- else {
743
- setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
728
+ });
744
729
  }
730
+ setValueByPath(parentObject, ['contents'], transformedList);
745
731
  }
746
732
  const fromSystemInstruction = getValueByPath(fromObject, [
747
733
  'systemInstruction',
@@ -751,14 +737,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
751
737
  }
752
738
  const fromTools = getValueByPath(fromObject, ['tools']);
753
739
  if (parentObject !== undefined && fromTools != null) {
754
- if (Array.isArray(fromTools)) {
755
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
740
+ let transformedList = fromTools;
741
+ if (Array.isArray(transformedList)) {
742
+ transformedList = transformedList.map((item) => {
756
743
  return toolToMldev$2(apiClient, item);
757
- }));
758
- }
759
- else {
760
- setValueByPath(parentObject, ['tools'], fromTools);
744
+ });
761
745
  }
746
+ setValueByPath(parentObject, ['tools'], transformedList);
762
747
  }
763
748
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
764
749
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -898,14 +883,13 @@ function contentToVertex$2(apiClient, fromObject) {
898
883
  const toObject = {};
899
884
  const fromParts = getValueByPath(fromObject, ['parts']);
900
885
  if (fromParts != null) {
901
- if (Array.isArray(fromParts)) {
902
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
886
+ let transformedList = fromParts;
887
+ if (Array.isArray(transformedList)) {
888
+ transformedList = transformedList.map((item) => {
903
889
  return partToVertex$2(apiClient, item);
904
- }));
905
- }
906
- else {
907
- setValueByPath(toObject, ['parts'], fromParts);
890
+ });
908
891
  }
892
+ setValueByPath(toObject, ['parts'], transformedList);
909
893
  }
910
894
  const fromRole = getValueByPath(fromObject, ['role']);
911
895
  if (fromRole != null) {
@@ -913,124 +897,6 @@ function contentToVertex$2(apiClient, fromObject) {
913
897
  }
914
898
  return toObject;
915
899
  }
916
- function schemaToVertex$2(apiClient, fromObject) {
917
- const toObject = {};
918
- const fromExample = getValueByPath(fromObject, ['example']);
919
- if (fromExample != null) {
920
- setValueByPath(toObject, ['example'], fromExample);
921
- }
922
- const fromPattern = getValueByPath(fromObject, ['pattern']);
923
- if (fromPattern != null) {
924
- setValueByPath(toObject, ['pattern'], fromPattern);
925
- }
926
- const fromDefault = getValueByPath(fromObject, ['default']);
927
- if (fromDefault != null) {
928
- setValueByPath(toObject, ['default'], fromDefault);
929
- }
930
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
931
- if (fromMaxLength != null) {
932
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
933
- }
934
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
935
- if (fromMinLength != null) {
936
- setValueByPath(toObject, ['minLength'], fromMinLength);
937
- }
938
- const fromMinProperties = getValueByPath(fromObject, [
939
- 'minProperties',
940
- ]);
941
- if (fromMinProperties != null) {
942
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
943
- }
944
- const fromMaxProperties = getValueByPath(fromObject, [
945
- 'maxProperties',
946
- ]);
947
- if (fromMaxProperties != null) {
948
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
949
- }
950
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
951
- if (fromAnyOf != null) {
952
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
953
- }
954
- const fromDescription = getValueByPath(fromObject, ['description']);
955
- if (fromDescription != null) {
956
- setValueByPath(toObject, ['description'], fromDescription);
957
- }
958
- const fromEnum = getValueByPath(fromObject, ['enum']);
959
- if (fromEnum != null) {
960
- setValueByPath(toObject, ['enum'], fromEnum);
961
- }
962
- const fromFormat = getValueByPath(fromObject, ['format']);
963
- if (fromFormat != null) {
964
- setValueByPath(toObject, ['format'], fromFormat);
965
- }
966
- const fromItems = getValueByPath(fromObject, ['items']);
967
- if (fromItems != null) {
968
- setValueByPath(toObject, ['items'], fromItems);
969
- }
970
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
971
- if (fromMaxItems != null) {
972
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
973
- }
974
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
975
- if (fromMaximum != null) {
976
- setValueByPath(toObject, ['maximum'], fromMaximum);
977
- }
978
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
979
- if (fromMinItems != null) {
980
- setValueByPath(toObject, ['minItems'], fromMinItems);
981
- }
982
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
983
- if (fromMinimum != null) {
984
- setValueByPath(toObject, ['minimum'], fromMinimum);
985
- }
986
- const fromNullable = getValueByPath(fromObject, ['nullable']);
987
- if (fromNullable != null) {
988
- setValueByPath(toObject, ['nullable'], fromNullable);
989
- }
990
- const fromProperties = getValueByPath(fromObject, ['properties']);
991
- if (fromProperties != null) {
992
- setValueByPath(toObject, ['properties'], fromProperties);
993
- }
994
- const fromPropertyOrdering = getValueByPath(fromObject, [
995
- 'propertyOrdering',
996
- ]);
997
- if (fromPropertyOrdering != null) {
998
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
999
- }
1000
- const fromRequired = getValueByPath(fromObject, ['required']);
1001
- if (fromRequired != null) {
1002
- setValueByPath(toObject, ['required'], fromRequired);
1003
- }
1004
- const fromTitle = getValueByPath(fromObject, ['title']);
1005
- if (fromTitle != null) {
1006
- setValueByPath(toObject, ['title'], fromTitle);
1007
- }
1008
- const fromType = getValueByPath(fromObject, ['type']);
1009
- if (fromType != null) {
1010
- setValueByPath(toObject, ['type'], fromType);
1011
- }
1012
- return toObject;
1013
- }
1014
- function functionDeclarationToVertex$2(apiClient, fromObject) {
1015
- const toObject = {};
1016
- const fromResponse = getValueByPath(fromObject, ['response']);
1017
- if (fromResponse != null) {
1018
- setValueByPath(toObject, ['response'], schemaToVertex$2(apiClient, fromResponse));
1019
- }
1020
- const fromDescription = getValueByPath(fromObject, ['description']);
1021
- if (fromDescription != null) {
1022
- setValueByPath(toObject, ['description'], fromDescription);
1023
- }
1024
- const fromName = getValueByPath(fromObject, ['name']);
1025
- if (fromName != null) {
1026
- setValueByPath(toObject, ['name'], fromName);
1027
- }
1028
- const fromParameters = getValueByPath(fromObject, ['parameters']);
1029
- if (fromParameters != null) {
1030
- setValueByPath(toObject, ['parameters'], fromParameters);
1031
- }
1032
- return toObject;
1033
- }
1034
900
  function googleSearchToVertex$2() {
1035
901
  const toObject = {};
1036
902
  return toObject;
@@ -1061,19 +927,6 @@ function googleSearchRetrievalToVertex$2(apiClient, fromObject) {
1061
927
  }
1062
928
  function toolToVertex$2(apiClient, fromObject) {
1063
929
  const toObject = {};
1064
- const fromFunctionDeclarations = getValueByPath(fromObject, [
1065
- 'functionDeclarations',
1066
- ]);
1067
- if (fromFunctionDeclarations != null) {
1068
- if (Array.isArray(fromFunctionDeclarations)) {
1069
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
1070
- return functionDeclarationToVertex$2(apiClient, item);
1071
- }));
1072
- }
1073
- else {
1074
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
1075
- }
1076
- }
1077
930
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
1078
931
  if (fromRetrieval != null) {
1079
932
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
@@ -1094,6 +947,12 @@ function toolToVertex$2(apiClient, fromObject) {
1094
947
  if (fromCodeExecution != null) {
1095
948
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
1096
949
  }
950
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
951
+ 'functionDeclarations',
952
+ ]);
953
+ if (fromFunctionDeclarations != null) {
954
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
955
+ }
1097
956
  return toObject;
1098
957
  }
1099
958
  function functionCallingConfigToVertex$1(apiClient, fromObject) {
@@ -1136,14 +995,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1136
995
  }
1137
996
  const fromContents = getValueByPath(fromObject, ['contents']);
1138
997
  if (parentObject !== undefined && fromContents != null) {
1139
- if (Array.isArray(fromContents)) {
1140
- setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
998
+ let transformedList = tContents(apiClient, fromContents);
999
+ if (Array.isArray(transformedList)) {
1000
+ transformedList = transformedList.map((item) => {
1141
1001
  return contentToVertex$2(apiClient, item);
1142
- })));
1143
- }
1144
- else {
1145
- setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
1002
+ });
1146
1003
  }
1004
+ setValueByPath(parentObject, ['contents'], transformedList);
1147
1005
  }
1148
1006
  const fromSystemInstruction = getValueByPath(fromObject, [
1149
1007
  'systemInstruction',
@@ -1153,14 +1011,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1153
1011
  }
1154
1012
  const fromTools = getValueByPath(fromObject, ['tools']);
1155
1013
  if (parentObject !== undefined && fromTools != null) {
1156
- if (Array.isArray(fromTools)) {
1157
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
1014
+ let transformedList = fromTools;
1015
+ if (Array.isArray(transformedList)) {
1016
+ transformedList = transformedList.map((item) => {
1158
1017
  return toolToVertex$2(apiClient, item);
1159
- }));
1160
- }
1161
- else {
1162
- setValueByPath(parentObject, ['tools'], fromTools);
1018
+ });
1163
1019
  }
1020
+ setValueByPath(parentObject, ['tools'], transformedList);
1164
1021
  }
1165
1022
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
1166
1023
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -1298,14 +1155,13 @@ function listCachedContentsResponseFromMldev(apiClient, fromObject) {
1298
1155
  'cachedContents',
1299
1156
  ]);
1300
1157
  if (fromCachedContents != null) {
1301
- if (Array.isArray(fromCachedContents)) {
1302
- setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1158
+ let transformedList = fromCachedContents;
1159
+ if (Array.isArray(transformedList)) {
1160
+ transformedList = transformedList.map((item) => {
1303
1161
  return cachedContentFromMldev(apiClient, item);
1304
- }));
1305
- }
1306
- else {
1307
- setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1162
+ });
1308
1163
  }
1164
+ setValueByPath(toObject, ['cachedContents'], transformedList);
1309
1165
  }
1310
1166
  return toObject;
1311
1167
  }
@@ -1359,14 +1215,13 @@ function listCachedContentsResponseFromVertex(apiClient, fromObject) {
1359
1215
  'cachedContents',
1360
1216
  ]);
1361
1217
  if (fromCachedContents != null) {
1362
- if (Array.isArray(fromCachedContents)) {
1363
- setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1218
+ let transformedList = fromCachedContents;
1219
+ if (Array.isArray(transformedList)) {
1220
+ transformedList = transformedList.map((item) => {
1364
1221
  return cachedContentFromVertex(apiClient, item);
1365
- }));
1366
- }
1367
- else {
1368
- setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1222
+ });
1369
1223
  }
1224
+ setValueByPath(toObject, ['cachedContents'], transformedList);
1370
1225
  }
1371
1226
  return toObject;
1372
1227
  }
@@ -1568,17 +1423,6 @@ exports.Language = void 0;
1568
1423
  Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
1569
1424
  Language["PYTHON"] = "PYTHON";
1570
1425
  })(exports.Language || (exports.Language = {}));
1571
- /** Optional. The type of the data. */
1572
- exports.Type = void 0;
1573
- (function (Type) {
1574
- Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
1575
- Type["STRING"] = "STRING";
1576
- Type["NUMBER"] = "NUMBER";
1577
- Type["INTEGER"] = "INTEGER";
1578
- Type["BOOLEAN"] = "BOOLEAN";
1579
- Type["ARRAY"] = "ARRAY";
1580
- Type["OBJECT"] = "OBJECT";
1581
- })(exports.Type || (exports.Type = {}));
1582
1426
  /** Required. Harm category. */
1583
1427
  exports.HarmCategory = void 0;
1584
1428
  (function (HarmCategory) {
@@ -1612,6 +1456,17 @@ exports.Mode = void 0;
1612
1456
  Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1613
1457
  Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1614
1458
  })(exports.Mode || (exports.Mode = {}));
1459
+ /** Optional. The type of the data. */
1460
+ exports.Type = void 0;
1461
+ (function (Type) {
1462
+ Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
1463
+ Type["STRING"] = "STRING";
1464
+ Type["NUMBER"] = "NUMBER";
1465
+ Type["INTEGER"] = "INTEGER";
1466
+ Type["BOOLEAN"] = "BOOLEAN";
1467
+ Type["ARRAY"] = "ARRAY";
1468
+ Type["OBJECT"] = "OBJECT";
1469
+ })(exports.Type || (exports.Type = {}));
1615
1470
  /** Output only. The reason why the model stopped generating tokens.
1616
1471
 
1617
1472
  If empty, the model has not stopped generating the tokens.
@@ -1681,6 +1536,33 @@ exports.MediaResolution = void 0;
1681
1536
  MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1682
1537
  MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1683
1538
  })(exports.MediaResolution || (exports.MediaResolution = {}));
1539
+ /** Output only. The detailed state of the job. */
1540
+ exports.JobState = void 0;
1541
+ (function (JobState) {
1542
+ JobState["JOB_STATE_UNSPECIFIED"] = "JOB_STATE_UNSPECIFIED";
1543
+ JobState["JOB_STATE_QUEUED"] = "JOB_STATE_QUEUED";
1544
+ JobState["JOB_STATE_PENDING"] = "JOB_STATE_PENDING";
1545
+ JobState["JOB_STATE_RUNNING"] = "JOB_STATE_RUNNING";
1546
+ JobState["JOB_STATE_SUCCEEDED"] = "JOB_STATE_SUCCEEDED";
1547
+ JobState["JOB_STATE_FAILED"] = "JOB_STATE_FAILED";
1548
+ JobState["JOB_STATE_CANCELLING"] = "JOB_STATE_CANCELLING";
1549
+ JobState["JOB_STATE_CANCELLED"] = "JOB_STATE_CANCELLED";
1550
+ JobState["JOB_STATE_PAUSED"] = "JOB_STATE_PAUSED";
1551
+ JobState["JOB_STATE_EXPIRED"] = "JOB_STATE_EXPIRED";
1552
+ JobState["JOB_STATE_UPDATING"] = "JOB_STATE_UPDATING";
1553
+ JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
1554
+ })(exports.JobState || (exports.JobState = {}));
1555
+ /** Optional. Adapter size for tuning. */
1556
+ exports.AdapterSize = void 0;
1557
+ (function (AdapterSize) {
1558
+ AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1559
+ AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1560
+ AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1561
+ AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1562
+ AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1563
+ AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1564
+ AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1565
+ })(exports.AdapterSize || (exports.AdapterSize = {}));
1684
1566
  /** Options for feature selection preference. */
1685
1567
  exports.FeatureSelectionPreference = void 0;
1686
1568
  (function (FeatureSelectionPreference) {
@@ -2181,6 +2063,8 @@ class EmbedContentResponse {
2181
2063
  /** The output images response. */
2182
2064
  class GenerateImagesResponse {
2183
2065
  }
2066
+ class DeleteModelResponse {
2067
+ }
2184
2068
  /** Response for counting tokens. */
2185
2069
  class CountTokensResponse {
2186
2070
  }
@@ -2190,6 +2074,9 @@ class ComputeTokensResponse {
2190
2074
  /** Response with generated videos. */
2191
2075
  class GenerateVideosResponse {
2192
2076
  }
2077
+ /** Response for the list tuning jobs method. */
2078
+ class ListTuningJobsResponse {
2079
+ }
2193
2080
  /** Empty response for caches.delete method. */
2194
2081
  class DeleteCachedContentResponse {
2195
2082
  }
@@ -2286,7 +2173,7 @@ class Caches extends BaseModule {
2286
2173
  * ```ts
2287
2174
  * const contents = ...; // Initialize the content to cache.
2288
2175
  * const response = await ai.caches.create({
2289
- * model: 'gemini-1.5-flash',
2176
+ * model: 'gemini-2.0-flash-001',
2290
2177
  * config: {
2291
2178
  * 'contents': contents,
2292
2179
  * 'displayName': 'test cache',
@@ -2358,7 +2245,7 @@ class Caches extends BaseModule {
2358
2245
  *
2359
2246
  * @example
2360
2247
  * ```ts
2361
- * await ai.caches.get({name: 'gemini-1.5-flash'});
2248
+ * await ai.caches.get({name: '...'}); // The server-generated resource name.
2362
2249
  * ```
2363
2250
  */
2364
2251
  async get(params) {
@@ -2423,7 +2310,7 @@ class Caches extends BaseModule {
2423
2310
  *
2424
2311
  * @example
2425
2312
  * ```ts
2426
- * await ai.caches.delete({name: 'gemini-1.5-flash'});
2313
+ * await ai.caches.delete({name: '...'}); // The server-generated resource name.
2427
2314
  * ```
2428
2315
  */
2429
2316
  async delete(params) {
@@ -2493,7 +2380,7 @@ class Caches extends BaseModule {
2493
2380
  * @example
2494
2381
  * ```ts
2495
2382
  * const response = await ai.caches.update({
2496
- * name: 'gemini-1.5-flash',
2383
+ * name: '...', // The server-generated resource name.
2497
2384
  * config: {'ttl': '7600s'}
2498
2385
  * });
2499
2386
  * ```
@@ -2891,7 +2778,12 @@ class Chat {
2891
2778
  contents: this.getHistory(true).concat(inputContent),
2892
2779
  config: (_a = params.config) !== null && _a !== void 0 ? _a : this.config,
2893
2780
  });
2894
- this.sendPromise = streamResponse.then(() => undefined);
2781
+ // Resolve the internal tracking of send completion promise - `sendPromise`
2782
+ // for both success and failure response. The actual failure is still
2783
+ // propagated by the `await streamResponse`.
2784
+ this.sendPromise = streamResponse
2785
+ .then(() => undefined)
2786
+ .catch(() => undefined);
2895
2787
  const response = await streamResponse;
2896
2788
  const result = this.processStreamResponse(response, inputContent);
2897
2789
  return result;
@@ -3201,14 +3093,13 @@ function listFilesResponseFromMldev(apiClient, fromObject) {
3201
3093
  }
3202
3094
  const fromFiles = getValueByPath(fromObject, ['files']);
3203
3095
  if (fromFiles != null) {
3204
- if (Array.isArray(fromFiles)) {
3205
- setValueByPath(toObject, ['files'], fromFiles.map((item) => {
3096
+ let transformedList = fromFiles;
3097
+ if (Array.isArray(transformedList)) {
3098
+ transformedList = transformedList.map((item) => {
3206
3099
  return fileFromMldev(apiClient, item);
3207
- }));
3208
- }
3209
- else {
3210
- setValueByPath(toObject, ['files'], fromFiles);
3100
+ });
3211
3101
  }
3102
+ setValueByPath(toObject, ['files'], transformedList);
3212
3103
  }
3213
3104
  return toObject;
3214
3105
  }
@@ -3575,14 +3466,13 @@ function contentToMldev$1(apiClient, fromObject) {
3575
3466
  const toObject = {};
3576
3467
  const fromParts = getValueByPath(fromObject, ['parts']);
3577
3468
  if (fromParts != null) {
3578
- if (Array.isArray(fromParts)) {
3579
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3469
+ let transformedList = fromParts;
3470
+ if (Array.isArray(transformedList)) {
3471
+ transformedList = transformedList.map((item) => {
3580
3472
  return partToMldev$1(apiClient, item);
3581
- }));
3582
- }
3583
- else {
3584
- setValueByPath(toObject, ['parts'], fromParts);
3473
+ });
3585
3474
  }
3475
+ setValueByPath(toObject, ['parts'], transformedList);
3586
3476
  }
3587
3477
  const fromRole = getValueByPath(fromObject, ['role']);
3588
3478
  if (fromRole != null) {
@@ -3594,14 +3484,13 @@ function contentToVertex$1(apiClient, fromObject) {
3594
3484
  const toObject = {};
3595
3485
  const fromParts = getValueByPath(fromObject, ['parts']);
3596
3486
  if (fromParts != null) {
3597
- if (Array.isArray(fromParts)) {
3598
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3487
+ let transformedList = fromParts;
3488
+ if (Array.isArray(transformedList)) {
3489
+ transformedList = transformedList.map((item) => {
3599
3490
  return partToVertex$1(apiClient, item);
3600
- }));
3601
- }
3602
- else {
3603
- setValueByPath(toObject, ['parts'], fromParts);
3491
+ });
3604
3492
  }
3493
+ setValueByPath(toObject, ['parts'], transformedList);
3605
3494
  }
3606
3495
  const fromRole = getValueByPath(fromObject, ['role']);
3607
3496
  if (fromRole != null) {
@@ -3609,143 +3498,6 @@ function contentToVertex$1(apiClient, fromObject) {
3609
3498
  }
3610
3499
  return toObject;
3611
3500
  }
3612
- function schemaToVertex$1(apiClient, fromObject) {
3613
- const toObject = {};
3614
- const fromExample = getValueByPath(fromObject, ['example']);
3615
- if (fromExample != null) {
3616
- setValueByPath(toObject, ['example'], fromExample);
3617
- }
3618
- const fromPattern = getValueByPath(fromObject, ['pattern']);
3619
- if (fromPattern != null) {
3620
- setValueByPath(toObject, ['pattern'], fromPattern);
3621
- }
3622
- const fromDefault = getValueByPath(fromObject, ['default']);
3623
- if (fromDefault != null) {
3624
- setValueByPath(toObject, ['default'], fromDefault);
3625
- }
3626
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
3627
- if (fromMaxLength != null) {
3628
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
3629
- }
3630
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
3631
- if (fromMinLength != null) {
3632
- setValueByPath(toObject, ['minLength'], fromMinLength);
3633
- }
3634
- const fromMinProperties = getValueByPath(fromObject, [
3635
- 'minProperties',
3636
- ]);
3637
- if (fromMinProperties != null) {
3638
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
3639
- }
3640
- const fromMaxProperties = getValueByPath(fromObject, [
3641
- 'maxProperties',
3642
- ]);
3643
- if (fromMaxProperties != null) {
3644
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
3645
- }
3646
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
3647
- if (fromAnyOf != null) {
3648
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
3649
- }
3650
- const fromDescription = getValueByPath(fromObject, ['description']);
3651
- if (fromDescription != null) {
3652
- setValueByPath(toObject, ['description'], fromDescription);
3653
- }
3654
- const fromEnum = getValueByPath(fromObject, ['enum']);
3655
- if (fromEnum != null) {
3656
- setValueByPath(toObject, ['enum'], fromEnum);
3657
- }
3658
- const fromFormat = getValueByPath(fromObject, ['format']);
3659
- if (fromFormat != null) {
3660
- setValueByPath(toObject, ['format'], fromFormat);
3661
- }
3662
- const fromItems = getValueByPath(fromObject, ['items']);
3663
- if (fromItems != null) {
3664
- setValueByPath(toObject, ['items'], fromItems);
3665
- }
3666
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
3667
- if (fromMaxItems != null) {
3668
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
3669
- }
3670
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
3671
- if (fromMaximum != null) {
3672
- setValueByPath(toObject, ['maximum'], fromMaximum);
3673
- }
3674
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
3675
- if (fromMinItems != null) {
3676
- setValueByPath(toObject, ['minItems'], fromMinItems);
3677
- }
3678
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
3679
- if (fromMinimum != null) {
3680
- setValueByPath(toObject, ['minimum'], fromMinimum);
3681
- }
3682
- const fromNullable = getValueByPath(fromObject, ['nullable']);
3683
- if (fromNullable != null) {
3684
- setValueByPath(toObject, ['nullable'], fromNullable);
3685
- }
3686
- const fromProperties = getValueByPath(fromObject, ['properties']);
3687
- if (fromProperties != null) {
3688
- setValueByPath(toObject, ['properties'], fromProperties);
3689
- }
3690
- const fromPropertyOrdering = getValueByPath(fromObject, [
3691
- 'propertyOrdering',
3692
- ]);
3693
- if (fromPropertyOrdering != null) {
3694
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
3695
- }
3696
- const fromRequired = getValueByPath(fromObject, ['required']);
3697
- if (fromRequired != null) {
3698
- setValueByPath(toObject, ['required'], fromRequired);
3699
- }
3700
- const fromTitle = getValueByPath(fromObject, ['title']);
3701
- if (fromTitle != null) {
3702
- setValueByPath(toObject, ['title'], fromTitle);
3703
- }
3704
- const fromType = getValueByPath(fromObject, ['type']);
3705
- if (fromType != null) {
3706
- setValueByPath(toObject, ['type'], fromType);
3707
- }
3708
- return toObject;
3709
- }
3710
- function functionDeclarationToMldev$1(apiClient, fromObject) {
3711
- const toObject = {};
3712
- if (getValueByPath(fromObject, ['response']) !== undefined) {
3713
- throw new Error('response parameter is not supported in Gemini API.');
3714
- }
3715
- const fromDescription = getValueByPath(fromObject, ['description']);
3716
- if (fromDescription != null) {
3717
- setValueByPath(toObject, ['description'], fromDescription);
3718
- }
3719
- const fromName = getValueByPath(fromObject, ['name']);
3720
- if (fromName != null) {
3721
- setValueByPath(toObject, ['name'], fromName);
3722
- }
3723
- const fromParameters = getValueByPath(fromObject, ['parameters']);
3724
- if (fromParameters != null) {
3725
- setValueByPath(toObject, ['parameters'], fromParameters);
3726
- }
3727
- return toObject;
3728
- }
3729
- function functionDeclarationToVertex$1(apiClient, fromObject) {
3730
- const toObject = {};
3731
- const fromResponse = getValueByPath(fromObject, ['response']);
3732
- if (fromResponse != null) {
3733
- setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
3734
- }
3735
- const fromDescription = getValueByPath(fromObject, ['description']);
3736
- if (fromDescription != null) {
3737
- setValueByPath(toObject, ['description'], fromDescription);
3738
- }
3739
- const fromName = getValueByPath(fromObject, ['name']);
3740
- if (fromName != null) {
3741
- setValueByPath(toObject, ['name'], fromName);
3742
- }
3743
- const fromParameters = getValueByPath(fromObject, ['parameters']);
3744
- if (fromParameters != null) {
3745
- setValueByPath(toObject, ['parameters'], fromParameters);
3746
- }
3747
- return toObject;
3748
- }
3749
3501
  function googleSearchToMldev$1() {
3750
3502
  const toObject = {};
3751
3503
  return toObject;
@@ -3804,19 +3556,6 @@ function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
3804
3556
  }
3805
3557
  function toolToMldev$1(apiClient, fromObject) {
3806
3558
  const toObject = {};
3807
- const fromFunctionDeclarations = getValueByPath(fromObject, [
3808
- 'functionDeclarations',
3809
- ]);
3810
- if (fromFunctionDeclarations != null) {
3811
- if (Array.isArray(fromFunctionDeclarations)) {
3812
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
3813
- return functionDeclarationToMldev$1(apiClient, item);
3814
- }));
3815
- }
3816
- else {
3817
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
3818
- }
3819
- }
3820
3559
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
3821
3560
  throw new Error('retrieval parameter is not supported in Gemini API.');
3822
3561
  }
@@ -3836,23 +3575,16 @@ function toolToMldev$1(apiClient, fromObject) {
3836
3575
  if (fromCodeExecution != null) {
3837
3576
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
3838
3577
  }
3839
- return toObject;
3840
- }
3841
- function toolToVertex$1(apiClient, fromObject) {
3842
- const toObject = {};
3843
3578
  const fromFunctionDeclarations = getValueByPath(fromObject, [
3844
3579
  'functionDeclarations',
3845
3580
  ]);
3846
3581
  if (fromFunctionDeclarations != null) {
3847
- if (Array.isArray(fromFunctionDeclarations)) {
3848
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
3849
- return functionDeclarationToVertex$1(apiClient, item);
3850
- }));
3851
- }
3852
- else {
3853
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
3854
- }
3582
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
3855
3583
  }
3584
+ return toObject;
3585
+ }
3586
+ function toolToVertex$1(apiClient, fromObject) {
3587
+ const toObject = {};
3856
3588
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
3857
3589
  if (fromRetrieval != null) {
3858
3590
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
@@ -3873,6 +3605,12 @@ function toolToVertex$1(apiClient, fromObject) {
3873
3605
  if (fromCodeExecution != null) {
3874
3606
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
3875
3607
  }
3608
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
3609
+ 'functionDeclarations',
3610
+ ]);
3611
+ if (fromFunctionDeclarations != null) {
3612
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
3613
+ }
3876
3614
  return toObject;
3877
3615
  }
3878
3616
  function sessionResumptionConfigToMldev(apiClient, fromObject) {
@@ -4112,14 +3850,13 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
4112
3850
  }
4113
3851
  const fromTools = getValueByPath(fromObject, ['tools']);
4114
3852
  if (parentObject !== undefined && fromTools != null) {
4115
- if (Array.isArray(fromTools)) {
4116
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
3853
+ let transformedList = tTools(apiClient, fromTools);
3854
+ if (Array.isArray(transformedList)) {
3855
+ transformedList = transformedList.map((item) => {
4117
3856
  return toolToMldev$1(apiClient, tTool(apiClient, item));
4118
- })));
4119
- }
4120
- else {
4121
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
3857
+ });
4122
3858
  }
3859
+ setValueByPath(parentObject, ['setup', 'tools'], transformedList);
4123
3860
  }
4124
3861
  const fromSessionResumption = getValueByPath(fromObject, [
4125
3862
  'sessionResumption',
@@ -4204,14 +3941,13 @@ function liveConnectConfigToVertex(apiClient, fromObject, parentObject) {
4204
3941
  }
4205
3942
  const fromTools = getValueByPath(fromObject, ['tools']);
4206
3943
  if (parentObject !== undefined && fromTools != null) {
4207
- if (Array.isArray(fromTools)) {
4208
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
3944
+ let transformedList = tTools(apiClient, fromTools);
3945
+ if (Array.isArray(transformedList)) {
3946
+ transformedList = transformedList.map((item) => {
4209
3947
  return toolToVertex$1(apiClient, tTool(apiClient, item));
4210
- })));
4211
- }
4212
- else {
4213
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
3948
+ });
4214
3949
  }
3950
+ setValueByPath(parentObject, ['setup', 'tools'], transformedList);
4215
3951
  }
4216
3952
  const fromSessionResumption = getValueByPath(fromObject, [
4217
3953
  'sessionResumption',
@@ -4456,14 +4192,13 @@ function contentFromMldev$1(apiClient, fromObject) {
4456
4192
  const toObject = {};
4457
4193
  const fromParts = getValueByPath(fromObject, ['parts']);
4458
4194
  if (fromParts != null) {
4459
- if (Array.isArray(fromParts)) {
4460
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4195
+ let transformedList = fromParts;
4196
+ if (Array.isArray(transformedList)) {
4197
+ transformedList = transformedList.map((item) => {
4461
4198
  return partFromMldev$1(apiClient, item);
4462
- }));
4463
- }
4464
- else {
4465
- setValueByPath(toObject, ['parts'], fromParts);
4199
+ });
4466
4200
  }
4201
+ setValueByPath(toObject, ['parts'], transformedList);
4467
4202
  }
4468
4203
  const fromRole = getValueByPath(fromObject, ['role']);
4469
4204
  if (fromRole != null) {
@@ -4475,14 +4210,13 @@ function contentFromVertex$1(apiClient, fromObject) {
4475
4210
  const toObject = {};
4476
4211
  const fromParts = getValueByPath(fromObject, ['parts']);
4477
4212
  if (fromParts != null) {
4478
- if (Array.isArray(fromParts)) {
4479
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4213
+ let transformedList = fromParts;
4214
+ if (Array.isArray(transformedList)) {
4215
+ transformedList = transformedList.map((item) => {
4480
4216
  return partFromVertex$1(apiClient, item);
4481
- }));
4482
- }
4483
- else {
4484
- setValueByPath(toObject, ['parts'], fromParts);
4217
+ });
4485
4218
  }
4219
+ setValueByPath(toObject, ['parts'], transformedList);
4486
4220
  }
4487
4221
  const fromRole = getValueByPath(fromObject, ['role']);
4488
4222
  if (fromRole != null) {
@@ -4616,14 +4350,13 @@ function liveServerToolCallFromMldev(apiClient, fromObject) {
4616
4350
  'functionCalls',
4617
4351
  ]);
4618
4352
  if (fromFunctionCalls != null) {
4619
- if (Array.isArray(fromFunctionCalls)) {
4620
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4353
+ let transformedList = fromFunctionCalls;
4354
+ if (Array.isArray(transformedList)) {
4355
+ transformedList = transformedList.map((item) => {
4621
4356
  return functionCallFromMldev(apiClient, item);
4622
- }));
4623
- }
4624
- else {
4625
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4357
+ });
4626
4358
  }
4359
+ setValueByPath(toObject, ['functionCalls'], transformedList);
4627
4360
  }
4628
4361
  return toObject;
4629
4362
  }
@@ -4633,14 +4366,13 @@ function liveServerToolCallFromVertex(apiClient, fromObject) {
4633
4366
  'functionCalls',
4634
4367
  ]);
4635
4368
  if (fromFunctionCalls != null) {
4636
- if (Array.isArray(fromFunctionCalls)) {
4637
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4369
+ let transformedList = fromFunctionCalls;
4370
+ if (Array.isArray(transformedList)) {
4371
+ transformedList = transformedList.map((item) => {
4638
4372
  return functionCallFromVertex(apiClient, item);
4639
- }));
4640
- }
4641
- else {
4642
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4373
+ });
4643
4374
  }
4375
+ setValueByPath(toObject, ['functionCalls'], transformedList);
4644
4376
  }
4645
4377
  return toObject;
4646
4378
  }
@@ -4726,53 +4458,49 @@ function usageMetadataFromMldev(apiClient, fromObject) {
4726
4458
  'promptTokensDetails',
4727
4459
  ]);
4728
4460
  if (fromPromptTokensDetails != null) {
4729
- if (Array.isArray(fromPromptTokensDetails)) {
4730
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
4461
+ let transformedList = fromPromptTokensDetails;
4462
+ if (Array.isArray(transformedList)) {
4463
+ transformedList = transformedList.map((item) => {
4731
4464
  return modalityTokenCountFromMldev(apiClient, item);
4732
- }));
4733
- }
4734
- else {
4735
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
4465
+ });
4736
4466
  }
4467
+ setValueByPath(toObject, ['promptTokensDetails'], transformedList);
4737
4468
  }
4738
4469
  const fromCacheTokensDetails = getValueByPath(fromObject, [
4739
4470
  'cacheTokensDetails',
4740
4471
  ]);
4741
4472
  if (fromCacheTokensDetails != null) {
4742
- if (Array.isArray(fromCacheTokensDetails)) {
4743
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
4473
+ let transformedList = fromCacheTokensDetails;
4474
+ if (Array.isArray(transformedList)) {
4475
+ transformedList = transformedList.map((item) => {
4744
4476
  return modalityTokenCountFromMldev(apiClient, item);
4745
- }));
4746
- }
4747
- else {
4748
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
4477
+ });
4749
4478
  }
4479
+ setValueByPath(toObject, ['cacheTokensDetails'], transformedList);
4750
4480
  }
4751
4481
  const fromResponseTokensDetails = getValueByPath(fromObject, [
4752
4482
  'responseTokensDetails',
4753
4483
  ]);
4754
4484
  if (fromResponseTokensDetails != null) {
4755
- if (Array.isArray(fromResponseTokensDetails)) {
4756
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
4485
+ let transformedList = fromResponseTokensDetails;
4486
+ if (Array.isArray(transformedList)) {
4487
+ transformedList = transformedList.map((item) => {
4757
4488
  return modalityTokenCountFromMldev(apiClient, item);
4758
- }));
4759
- }
4760
- else {
4761
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
4489
+ });
4762
4490
  }
4491
+ setValueByPath(toObject, ['responseTokensDetails'], transformedList);
4763
4492
  }
4764
4493
  const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
4765
4494
  'toolUsePromptTokensDetails',
4766
4495
  ]);
4767
4496
  if (fromToolUsePromptTokensDetails != null) {
4768
- if (Array.isArray(fromToolUsePromptTokensDetails)) {
4769
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
4497
+ let transformedList = fromToolUsePromptTokensDetails;
4498
+ if (Array.isArray(transformedList)) {
4499
+ transformedList = transformedList.map((item) => {
4770
4500
  return modalityTokenCountFromMldev(apiClient, item);
4771
- }));
4772
- }
4773
- else {
4774
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
4501
+ });
4775
4502
  }
4503
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], transformedList);
4776
4504
  }
4777
4505
  return toObject;
4778
4506
  }
@@ -4818,53 +4546,49 @@ function usageMetadataFromVertex(apiClient, fromObject) {
4818
4546
  'promptTokensDetails',
4819
4547
  ]);
4820
4548
  if (fromPromptTokensDetails != null) {
4821
- if (Array.isArray(fromPromptTokensDetails)) {
4822
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
4549
+ let transformedList = fromPromptTokensDetails;
4550
+ if (Array.isArray(transformedList)) {
4551
+ transformedList = transformedList.map((item) => {
4823
4552
  return modalityTokenCountFromVertex(apiClient, item);
4824
- }));
4825
- }
4826
- else {
4827
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
4553
+ });
4828
4554
  }
4555
+ setValueByPath(toObject, ['promptTokensDetails'], transformedList);
4829
4556
  }
4830
4557
  const fromCacheTokensDetails = getValueByPath(fromObject, [
4831
4558
  'cacheTokensDetails',
4832
4559
  ]);
4833
4560
  if (fromCacheTokensDetails != null) {
4834
- if (Array.isArray(fromCacheTokensDetails)) {
4835
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
4561
+ let transformedList = fromCacheTokensDetails;
4562
+ if (Array.isArray(transformedList)) {
4563
+ transformedList = transformedList.map((item) => {
4836
4564
  return modalityTokenCountFromVertex(apiClient, item);
4837
- }));
4838
- }
4839
- else {
4840
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
4565
+ });
4841
4566
  }
4567
+ setValueByPath(toObject, ['cacheTokensDetails'], transformedList);
4842
4568
  }
4843
4569
  const fromResponseTokensDetails = getValueByPath(fromObject, [
4844
4570
  'candidatesTokensDetails',
4845
4571
  ]);
4846
4572
  if (fromResponseTokensDetails != null) {
4847
- if (Array.isArray(fromResponseTokensDetails)) {
4848
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
4573
+ let transformedList = fromResponseTokensDetails;
4574
+ if (Array.isArray(transformedList)) {
4575
+ transformedList = transformedList.map((item) => {
4849
4576
  return modalityTokenCountFromVertex(apiClient, item);
4850
- }));
4851
- }
4852
- else {
4853
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
4577
+ });
4854
4578
  }
4579
+ setValueByPath(toObject, ['responseTokensDetails'], transformedList);
4855
4580
  }
4856
4581
  const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
4857
4582
  'toolUsePromptTokensDetails',
4858
4583
  ]);
4859
4584
  if (fromToolUsePromptTokensDetails != null) {
4860
- if (Array.isArray(fromToolUsePromptTokensDetails)) {
4861
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
4585
+ let transformedList = fromToolUsePromptTokensDetails;
4586
+ if (Array.isArray(transformedList)) {
4587
+ transformedList = transformedList.map((item) => {
4862
4588
  return modalityTokenCountFromVertex(apiClient, item);
4863
- }));
4864
- }
4865
- else {
4866
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
4589
+ });
4867
4590
  }
4591
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], transformedList);
4868
4592
  }
4869
4593
  const fromTrafficType = getValueByPath(fromObject, ['trafficType']);
4870
4594
  if (fromTrafficType != null) {
@@ -5063,14 +4787,13 @@ function contentToMldev(apiClient, fromObject) {
5063
4787
  const toObject = {};
5064
4788
  const fromParts = getValueByPath(fromObject, ['parts']);
5065
4789
  if (fromParts != null) {
5066
- if (Array.isArray(fromParts)) {
5067
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4790
+ let transformedList = fromParts;
4791
+ if (Array.isArray(transformedList)) {
4792
+ transformedList = transformedList.map((item) => {
5068
4793
  return partToMldev(apiClient, item);
5069
- }));
5070
- }
5071
- else {
5072
- setValueByPath(toObject, ['parts'], fromParts);
4794
+ });
5073
4795
  }
4796
+ setValueByPath(toObject, ['parts'], transformedList);
5074
4797
  }
5075
4798
  const fromRole = getValueByPath(fromObject, ['role']);
5076
4799
  if (fromRole != null) {
@@ -5078,93 +4801,6 @@ function contentToMldev(apiClient, fromObject) {
5078
4801
  }
5079
4802
  return toObject;
5080
4803
  }
5081
- function schemaToMldev(apiClient, fromObject) {
5082
- const toObject = {};
5083
- if (getValueByPath(fromObject, ['example']) !== undefined) {
5084
- throw new Error('example parameter is not supported in Gemini API.');
5085
- }
5086
- if (getValueByPath(fromObject, ['pattern']) !== undefined) {
5087
- throw new Error('pattern parameter is not supported in Gemini API.');
5088
- }
5089
- if (getValueByPath(fromObject, ['default']) !== undefined) {
5090
- throw new Error('default parameter is not supported in Gemini API.');
5091
- }
5092
- if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
5093
- throw new Error('maxLength parameter is not supported in Gemini API.');
5094
- }
5095
- if (getValueByPath(fromObject, ['minLength']) !== undefined) {
5096
- throw new Error('minLength parameter is not supported in Gemini API.');
5097
- }
5098
- if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
5099
- throw new Error('minProperties parameter is not supported in Gemini API.');
5100
- }
5101
- if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
5102
- throw new Error('maxProperties parameter is not supported in Gemini API.');
5103
- }
5104
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
5105
- if (fromAnyOf != null) {
5106
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
5107
- }
5108
- const fromDescription = getValueByPath(fromObject, ['description']);
5109
- if (fromDescription != null) {
5110
- setValueByPath(toObject, ['description'], fromDescription);
5111
- }
5112
- const fromEnum = getValueByPath(fromObject, ['enum']);
5113
- if (fromEnum != null) {
5114
- setValueByPath(toObject, ['enum'], fromEnum);
5115
- }
5116
- const fromFormat = getValueByPath(fromObject, ['format']);
5117
- if (fromFormat != null) {
5118
- setValueByPath(toObject, ['format'], fromFormat);
5119
- }
5120
- const fromItems = getValueByPath(fromObject, ['items']);
5121
- if (fromItems != null) {
5122
- setValueByPath(toObject, ['items'], fromItems);
5123
- }
5124
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
5125
- if (fromMaxItems != null) {
5126
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
5127
- }
5128
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
5129
- if (fromMaximum != null) {
5130
- setValueByPath(toObject, ['maximum'], fromMaximum);
5131
- }
5132
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
5133
- if (fromMinItems != null) {
5134
- setValueByPath(toObject, ['minItems'], fromMinItems);
5135
- }
5136
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
5137
- if (fromMinimum != null) {
5138
- setValueByPath(toObject, ['minimum'], fromMinimum);
5139
- }
5140
- const fromNullable = getValueByPath(fromObject, ['nullable']);
5141
- if (fromNullable != null) {
5142
- setValueByPath(toObject, ['nullable'], fromNullable);
5143
- }
5144
- const fromProperties = getValueByPath(fromObject, ['properties']);
5145
- if (fromProperties != null) {
5146
- setValueByPath(toObject, ['properties'], fromProperties);
5147
- }
5148
- const fromPropertyOrdering = getValueByPath(fromObject, [
5149
- 'propertyOrdering',
5150
- ]);
5151
- if (fromPropertyOrdering != null) {
5152
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
5153
- }
5154
- const fromRequired = getValueByPath(fromObject, ['required']);
5155
- if (fromRequired != null) {
5156
- setValueByPath(toObject, ['required'], fromRequired);
5157
- }
5158
- const fromTitle = getValueByPath(fromObject, ['title']);
5159
- if (fromTitle != null) {
5160
- setValueByPath(toObject, ['title'], fromTitle);
5161
- }
5162
- const fromType = getValueByPath(fromObject, ['type']);
5163
- if (fromType != null) {
5164
- setValueByPath(toObject, ['type'], fromType);
5165
- }
5166
- return toObject;
5167
- }
5168
4804
  function safetySettingToMldev(apiClient, fromObject) {
5169
4805
  const toObject = {};
5170
4806
  if (getValueByPath(fromObject, ['method']) !== undefined) {
@@ -5180,25 +4816,6 @@ function safetySettingToMldev(apiClient, fromObject) {
5180
4816
  }
5181
4817
  return toObject;
5182
4818
  }
5183
- function functionDeclarationToMldev(apiClient, fromObject) {
5184
- const toObject = {};
5185
- if (getValueByPath(fromObject, ['response']) !== undefined) {
5186
- throw new Error('response parameter is not supported in Gemini API.');
5187
- }
5188
- const fromDescription = getValueByPath(fromObject, ['description']);
5189
- if (fromDescription != null) {
5190
- setValueByPath(toObject, ['description'], fromDescription);
5191
- }
5192
- const fromName = getValueByPath(fromObject, ['name']);
5193
- if (fromName != null) {
5194
- setValueByPath(toObject, ['name'], fromName);
5195
- }
5196
- const fromParameters = getValueByPath(fromObject, ['parameters']);
5197
- if (fromParameters != null) {
5198
- setValueByPath(toObject, ['parameters'], fromParameters);
5199
- }
5200
- return toObject;
5201
- }
5202
4819
  function googleSearchToMldev() {
5203
4820
  const toObject = {};
5204
4821
  return toObject;
@@ -5229,19 +4846,6 @@ function googleSearchRetrievalToMldev(apiClient, fromObject) {
5229
4846
  }
5230
4847
  function toolToMldev(apiClient, fromObject) {
5231
4848
  const toObject = {};
5232
- const fromFunctionDeclarations = getValueByPath(fromObject, [
5233
- 'functionDeclarations',
5234
- ]);
5235
- if (fromFunctionDeclarations != null) {
5236
- if (Array.isArray(fromFunctionDeclarations)) {
5237
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
5238
- return functionDeclarationToMldev(apiClient, item);
5239
- }));
5240
- }
5241
- else {
5242
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
5243
- }
5244
- }
5245
4849
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
5246
4850
  throw new Error('retrieval parameter is not supported in Gemini API.');
5247
4851
  }
@@ -5261,6 +4865,12 @@ function toolToMldev(apiClient, fromObject) {
5261
4865
  if (fromCodeExecution != null) {
5262
4866
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5263
4867
  }
4868
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
4869
+ 'functionDeclarations',
4870
+ ]);
4871
+ if (fromFunctionDeclarations != null) {
4872
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4873
+ }
5264
4874
  return toObject;
5265
4875
  }
5266
4876
  function functionCallingConfigToMldev(apiClient, fromObject) {
@@ -5407,7 +5017,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
5407
5017
  'responseSchema',
5408
5018
  ]);
5409
5019
  if (fromResponseSchema != null) {
5410
- setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
5020
+ setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
5411
5021
  }
5412
5022
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
5413
5023
  throw new Error('routingConfig parameter is not supported in Gemini API.');
@@ -5419,25 +5029,23 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
5419
5029
  'safetySettings',
5420
5030
  ]);
5421
5031
  if (parentObject !== undefined && fromSafetySettings != null) {
5422
- if (Array.isArray(fromSafetySettings)) {
5423
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
5032
+ let transformedList = fromSafetySettings;
5033
+ if (Array.isArray(transformedList)) {
5034
+ transformedList = transformedList.map((item) => {
5424
5035
  return safetySettingToMldev(apiClient, item);
5425
- }));
5426
- }
5427
- else {
5428
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
5036
+ });
5429
5037
  }
5038
+ setValueByPath(parentObject, ['safetySettings'], transformedList);
5430
5039
  }
5431
5040
  const fromTools = getValueByPath(fromObject, ['tools']);
5432
5041
  if (parentObject !== undefined && fromTools != null) {
5433
- if (Array.isArray(fromTools)) {
5434
- setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
5042
+ let transformedList = tTools(apiClient, fromTools);
5043
+ if (Array.isArray(transformedList)) {
5044
+ transformedList = transformedList.map((item) => {
5435
5045
  return toolToMldev(apiClient, tTool(apiClient, item));
5436
- })));
5437
- }
5438
- else {
5439
- setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
5046
+ });
5440
5047
  }
5048
+ setValueByPath(parentObject, ['tools'], transformedList);
5441
5049
  }
5442
5050
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5443
5051
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -5487,14 +5095,13 @@ function generateContentParametersToMldev(apiClient, fromObject) {
5487
5095
  }
5488
5096
  const fromContents = getValueByPath(fromObject, ['contents']);
5489
5097
  if (fromContents != null) {
5490
- if (Array.isArray(fromContents)) {
5491
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
5098
+ let transformedList = tContents(apiClient, fromContents);
5099
+ if (Array.isArray(transformedList)) {
5100
+ transformedList = transformedList.map((item) => {
5492
5101
  return contentToMldev(apiClient, item);
5493
- })));
5494
- }
5495
- else {
5496
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
5102
+ });
5497
5103
  }
5104
+ setValueByPath(toObject, ['contents'], transformedList);
5498
5105
  }
5499
5106
  const fromConfig = getValueByPath(fromObject, ['config']);
5500
5107
  if (fromConfig != null) {
@@ -5649,6 +5256,42 @@ function getModelParametersToMldev(apiClient, fromObject) {
5649
5256
  }
5650
5257
  return toObject;
5651
5258
  }
5259
+ function updateModelConfigToMldev(apiClient, fromObject, parentObject) {
5260
+ const toObject = {};
5261
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5262
+ if (parentObject !== undefined && fromDisplayName != null) {
5263
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
5264
+ }
5265
+ const fromDescription = getValueByPath(fromObject, ['description']);
5266
+ if (parentObject !== undefined && fromDescription != null) {
5267
+ setValueByPath(parentObject, ['description'], fromDescription);
5268
+ }
5269
+ return toObject;
5270
+ }
5271
+ function updateModelParametersToMldev(apiClient, fromObject) {
5272
+ const toObject = {};
5273
+ const fromModel = getValueByPath(fromObject, ['model']);
5274
+ if (fromModel != null) {
5275
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
5276
+ }
5277
+ const fromConfig = getValueByPath(fromObject, ['config']);
5278
+ if (fromConfig != null) {
5279
+ setValueByPath(toObject, ['config'], updateModelConfigToMldev(apiClient, fromConfig, toObject));
5280
+ }
5281
+ return toObject;
5282
+ }
5283
+ function deleteModelParametersToMldev(apiClient, fromObject) {
5284
+ const toObject = {};
5285
+ const fromModel = getValueByPath(fromObject, ['model']);
5286
+ if (fromModel != null) {
5287
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
5288
+ }
5289
+ const fromConfig = getValueByPath(fromObject, ['config']);
5290
+ if (fromConfig != null) {
5291
+ setValueByPath(toObject, ['config'], fromConfig);
5292
+ }
5293
+ return toObject;
5294
+ }
5652
5295
  function countTokensConfigToMldev(apiClient, fromObject) {
5653
5296
  const toObject = {};
5654
5297
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
@@ -5670,14 +5313,13 @@ function countTokensParametersToMldev(apiClient, fromObject) {
5670
5313
  }
5671
5314
  const fromContents = getValueByPath(fromObject, ['contents']);
5672
5315
  if (fromContents != null) {
5673
- if (Array.isArray(fromContents)) {
5674
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
5316
+ let transformedList = tContents(apiClient, fromContents);
5317
+ if (Array.isArray(transformedList)) {
5318
+ transformedList = transformedList.map((item) => {
5675
5319
  return contentToMldev(apiClient, item);
5676
- })));
5677
- }
5678
- else {
5679
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
5320
+ });
5680
5321
  }
5322
+ setValueByPath(toObject, ['contents'], transformedList);
5681
5323
  }
5682
5324
  const fromConfig = getValueByPath(fromObject, ['config']);
5683
5325
  if (fromConfig != null) {
@@ -5822,14 +5464,13 @@ function contentToVertex(apiClient, fromObject) {
5822
5464
  const toObject = {};
5823
5465
  const fromParts = getValueByPath(fromObject, ['parts']);
5824
5466
  if (fromParts != null) {
5825
- if (Array.isArray(fromParts)) {
5826
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
5467
+ let transformedList = fromParts;
5468
+ if (Array.isArray(transformedList)) {
5469
+ transformedList = transformedList.map((item) => {
5827
5470
  return partToVertex(apiClient, item);
5828
- }));
5829
- }
5830
- else {
5831
- setValueByPath(toObject, ['parts'], fromParts);
5471
+ });
5832
5472
  }
5473
+ setValueByPath(toObject, ['parts'], transformedList);
5833
5474
  }
5834
5475
  const fromRole = getValueByPath(fromObject, ['role']);
5835
5476
  if (fromRole != null) {
@@ -5837,104 +5478,6 @@ function contentToVertex(apiClient, fromObject) {
5837
5478
  }
5838
5479
  return toObject;
5839
5480
  }
5840
- function schemaToVertex(apiClient, fromObject) {
5841
- const toObject = {};
5842
- const fromExample = getValueByPath(fromObject, ['example']);
5843
- if (fromExample != null) {
5844
- setValueByPath(toObject, ['example'], fromExample);
5845
- }
5846
- const fromPattern = getValueByPath(fromObject, ['pattern']);
5847
- if (fromPattern != null) {
5848
- setValueByPath(toObject, ['pattern'], fromPattern);
5849
- }
5850
- const fromDefault = getValueByPath(fromObject, ['default']);
5851
- if (fromDefault != null) {
5852
- setValueByPath(toObject, ['default'], fromDefault);
5853
- }
5854
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
5855
- if (fromMaxLength != null) {
5856
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
5857
- }
5858
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
5859
- if (fromMinLength != null) {
5860
- setValueByPath(toObject, ['minLength'], fromMinLength);
5861
- }
5862
- const fromMinProperties = getValueByPath(fromObject, [
5863
- 'minProperties',
5864
- ]);
5865
- if (fromMinProperties != null) {
5866
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
5867
- }
5868
- const fromMaxProperties = getValueByPath(fromObject, [
5869
- 'maxProperties',
5870
- ]);
5871
- if (fromMaxProperties != null) {
5872
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
5873
- }
5874
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
5875
- if (fromAnyOf != null) {
5876
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
5877
- }
5878
- const fromDescription = getValueByPath(fromObject, ['description']);
5879
- if (fromDescription != null) {
5880
- setValueByPath(toObject, ['description'], fromDescription);
5881
- }
5882
- const fromEnum = getValueByPath(fromObject, ['enum']);
5883
- if (fromEnum != null) {
5884
- setValueByPath(toObject, ['enum'], fromEnum);
5885
- }
5886
- const fromFormat = getValueByPath(fromObject, ['format']);
5887
- if (fromFormat != null) {
5888
- setValueByPath(toObject, ['format'], fromFormat);
5889
- }
5890
- const fromItems = getValueByPath(fromObject, ['items']);
5891
- if (fromItems != null) {
5892
- setValueByPath(toObject, ['items'], fromItems);
5893
- }
5894
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
5895
- if (fromMaxItems != null) {
5896
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
5897
- }
5898
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
5899
- if (fromMaximum != null) {
5900
- setValueByPath(toObject, ['maximum'], fromMaximum);
5901
- }
5902
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
5903
- if (fromMinItems != null) {
5904
- setValueByPath(toObject, ['minItems'], fromMinItems);
5905
- }
5906
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
5907
- if (fromMinimum != null) {
5908
- setValueByPath(toObject, ['minimum'], fromMinimum);
5909
- }
5910
- const fromNullable = getValueByPath(fromObject, ['nullable']);
5911
- if (fromNullable != null) {
5912
- setValueByPath(toObject, ['nullable'], fromNullable);
5913
- }
5914
- const fromProperties = getValueByPath(fromObject, ['properties']);
5915
- if (fromProperties != null) {
5916
- setValueByPath(toObject, ['properties'], fromProperties);
5917
- }
5918
- const fromPropertyOrdering = getValueByPath(fromObject, [
5919
- 'propertyOrdering',
5920
- ]);
5921
- if (fromPropertyOrdering != null) {
5922
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
5923
- }
5924
- const fromRequired = getValueByPath(fromObject, ['required']);
5925
- if (fromRequired != null) {
5926
- setValueByPath(toObject, ['required'], fromRequired);
5927
- }
5928
- const fromTitle = getValueByPath(fromObject, ['title']);
5929
- if (fromTitle != null) {
5930
- setValueByPath(toObject, ['title'], fromTitle);
5931
- }
5932
- const fromType = getValueByPath(fromObject, ['type']);
5933
- if (fromType != null) {
5934
- setValueByPath(toObject, ['type'], fromType);
5935
- }
5936
- return toObject;
5937
- }
5938
5481
  function modelSelectionConfigToVertex(apiClient, fromObject) {
5939
5482
  const toObject = {};
5940
5483
  const fromFeatureSelectionPreference = getValueByPath(fromObject, [
@@ -5961,26 +5504,6 @@ function safetySettingToVertex(apiClient, fromObject) {
5961
5504
  }
5962
5505
  return toObject;
5963
5506
  }
5964
- function functionDeclarationToVertex(apiClient, fromObject) {
5965
- const toObject = {};
5966
- const fromResponse = getValueByPath(fromObject, ['response']);
5967
- if (fromResponse != null) {
5968
- setValueByPath(toObject, ['response'], schemaToVertex(apiClient, fromResponse));
5969
- }
5970
- const fromDescription = getValueByPath(fromObject, ['description']);
5971
- if (fromDescription != null) {
5972
- setValueByPath(toObject, ['description'], fromDescription);
5973
- }
5974
- const fromName = getValueByPath(fromObject, ['name']);
5975
- if (fromName != null) {
5976
- setValueByPath(toObject, ['name'], fromName);
5977
- }
5978
- const fromParameters = getValueByPath(fromObject, ['parameters']);
5979
- if (fromParameters != null) {
5980
- setValueByPath(toObject, ['parameters'], fromParameters);
5981
- }
5982
- return toObject;
5983
- }
5984
5507
  function googleSearchToVertex() {
5985
5508
  const toObject = {};
5986
5509
  return toObject;
@@ -6011,19 +5534,6 @@ function googleSearchRetrievalToVertex(apiClient, fromObject) {
6011
5534
  }
6012
5535
  function toolToVertex(apiClient, fromObject) {
6013
5536
  const toObject = {};
6014
- const fromFunctionDeclarations = getValueByPath(fromObject, [
6015
- 'functionDeclarations',
6016
- ]);
6017
- if (fromFunctionDeclarations != null) {
6018
- if (Array.isArray(fromFunctionDeclarations)) {
6019
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
6020
- return functionDeclarationToVertex(apiClient, item);
6021
- }));
6022
- }
6023
- else {
6024
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
6025
- }
6026
- }
6027
5537
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
6028
5538
  if (fromRetrieval != null) {
6029
5539
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
@@ -6044,6 +5554,12 @@ function toolToVertex(apiClient, fromObject) {
6044
5554
  if (fromCodeExecution != null) {
6045
5555
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
6046
5556
  }
5557
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
5558
+ 'functionDeclarations',
5559
+ ]);
5560
+ if (fromFunctionDeclarations != null) {
5561
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
5562
+ }
6047
5563
  return toObject;
6048
5564
  }
6049
5565
  function functionCallingConfigToVertex(apiClient, fromObject) {
@@ -6190,7 +5706,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
6190
5706
  'responseSchema',
6191
5707
  ]);
6192
5708
  if (fromResponseSchema != null) {
6193
- setValueByPath(toObject, ['responseSchema'], schemaToVertex(apiClient, tSchema(apiClient, fromResponseSchema)));
5709
+ setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
6194
5710
  }
6195
5711
  const fromRoutingConfig = getValueByPath(fromObject, [
6196
5712
  'routingConfig',
@@ -6208,25 +5724,23 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
6208
5724
  'safetySettings',
6209
5725
  ]);
6210
5726
  if (parentObject !== undefined && fromSafetySettings != null) {
6211
- if (Array.isArray(fromSafetySettings)) {
6212
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
5727
+ let transformedList = fromSafetySettings;
5728
+ if (Array.isArray(transformedList)) {
5729
+ transformedList = transformedList.map((item) => {
6213
5730
  return safetySettingToVertex(apiClient, item);
6214
- }));
6215
- }
6216
- else {
6217
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
5731
+ });
6218
5732
  }
5733
+ setValueByPath(parentObject, ['safetySettings'], transformedList);
6219
5734
  }
6220
5735
  const fromTools = getValueByPath(fromObject, ['tools']);
6221
5736
  if (parentObject !== undefined && fromTools != null) {
6222
- if (Array.isArray(fromTools)) {
6223
- setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
5737
+ let transformedList = tTools(apiClient, fromTools);
5738
+ if (Array.isArray(transformedList)) {
5739
+ transformedList = transformedList.map((item) => {
6224
5740
  return toolToVertex(apiClient, tTool(apiClient, item));
6225
- })));
6226
- }
6227
- else {
6228
- setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
5741
+ });
6229
5742
  }
5743
+ setValueByPath(parentObject, ['tools'], transformedList);
6230
5744
  }
6231
5745
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
6232
5746
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -6280,14 +5794,13 @@ function generateContentParametersToVertex(apiClient, fromObject) {
6280
5794
  }
6281
5795
  const fromContents = getValueByPath(fromObject, ['contents']);
6282
5796
  if (fromContents != null) {
6283
- if (Array.isArray(fromContents)) {
6284
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
5797
+ let transformedList = tContents(apiClient, fromContents);
5798
+ if (Array.isArray(transformedList)) {
5799
+ transformedList = transformedList.map((item) => {
6285
5800
  return contentToVertex(apiClient, item);
6286
- })));
6287
- }
6288
- else {
6289
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
5801
+ });
6290
5802
  }
5803
+ setValueByPath(toObject, ['contents'], transformedList);
6291
5804
  }
6292
5805
  const fromConfig = getValueByPath(fromObject, ['config']);
6293
5806
  if (fromConfig != null) {
@@ -6449,6 +5962,42 @@ function getModelParametersToVertex(apiClient, fromObject) {
6449
5962
  }
6450
5963
  return toObject;
6451
5964
  }
5965
+ function updateModelConfigToVertex(apiClient, fromObject, parentObject) {
5966
+ const toObject = {};
5967
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5968
+ if (parentObject !== undefined && fromDisplayName != null) {
5969
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
5970
+ }
5971
+ const fromDescription = getValueByPath(fromObject, ['description']);
5972
+ if (parentObject !== undefined && fromDescription != null) {
5973
+ setValueByPath(parentObject, ['description'], fromDescription);
5974
+ }
5975
+ return toObject;
5976
+ }
5977
+ function updateModelParametersToVertex(apiClient, fromObject) {
5978
+ const toObject = {};
5979
+ const fromModel = getValueByPath(fromObject, ['model']);
5980
+ if (fromModel != null) {
5981
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
5982
+ }
5983
+ const fromConfig = getValueByPath(fromObject, ['config']);
5984
+ if (fromConfig != null) {
5985
+ setValueByPath(toObject, ['config'], updateModelConfigToVertex(apiClient, fromConfig, toObject));
5986
+ }
5987
+ return toObject;
5988
+ }
5989
+ function deleteModelParametersToVertex(apiClient, fromObject) {
5990
+ const toObject = {};
5991
+ const fromModel = getValueByPath(fromObject, ['model']);
5992
+ if (fromModel != null) {
5993
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
5994
+ }
5995
+ const fromConfig = getValueByPath(fromObject, ['config']);
5996
+ if (fromConfig != null) {
5997
+ setValueByPath(toObject, ['config'], fromConfig);
5998
+ }
5999
+ return toObject;
6000
+ }
6452
6001
  function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
6453
6002
  const toObject = {};
6454
6003
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -6459,14 +6008,13 @@ function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
6459
6008
  }
6460
6009
  const fromTools = getValueByPath(fromObject, ['tools']);
6461
6010
  if (parentObject !== undefined && fromTools != null) {
6462
- if (Array.isArray(fromTools)) {
6463
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
6011
+ let transformedList = fromTools;
6012
+ if (Array.isArray(transformedList)) {
6013
+ transformedList = transformedList.map((item) => {
6464
6014
  return toolToVertex(apiClient, item);
6465
- }));
6466
- }
6467
- else {
6468
- setValueByPath(parentObject, ['tools'], fromTools);
6015
+ });
6469
6016
  }
6017
+ setValueByPath(parentObject, ['tools'], transformedList);
6470
6018
  }
6471
6019
  const fromGenerationConfig = getValueByPath(fromObject, [
6472
6020
  'generationConfig',
@@ -6484,14 +6032,13 @@ function countTokensParametersToVertex(apiClient, fromObject) {
6484
6032
  }
6485
6033
  const fromContents = getValueByPath(fromObject, ['contents']);
6486
6034
  if (fromContents != null) {
6487
- if (Array.isArray(fromContents)) {
6488
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
6035
+ let transformedList = tContents(apiClient, fromContents);
6036
+ if (Array.isArray(transformedList)) {
6037
+ transformedList = transformedList.map((item) => {
6489
6038
  return contentToVertex(apiClient, item);
6490
- })));
6491
- }
6492
- else {
6493
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
6039
+ });
6494
6040
  }
6041
+ setValueByPath(toObject, ['contents'], transformedList);
6495
6042
  }
6496
6043
  const fromConfig = getValueByPath(fromObject, ['config']);
6497
6044
  if (fromConfig != null) {
@@ -6507,14 +6054,13 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
6507
6054
  }
6508
6055
  const fromContents = getValueByPath(fromObject, ['contents']);
6509
6056
  if (fromContents != null) {
6510
- if (Array.isArray(fromContents)) {
6511
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
6057
+ let transformedList = tContents(apiClient, fromContents);
6058
+ if (Array.isArray(transformedList)) {
6059
+ transformedList = transformedList.map((item) => {
6512
6060
  return contentToVertex(apiClient, item);
6513
- })));
6514
- }
6515
- else {
6516
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
6061
+ });
6517
6062
  }
6063
+ setValueByPath(toObject, ['contents'], transformedList);
6518
6064
  }
6519
6065
  const fromConfig = getValueByPath(fromObject, ['config']);
6520
6066
  if (fromConfig != null) {
@@ -6662,14 +6208,13 @@ function contentFromMldev(apiClient, fromObject) {
6662
6208
  const toObject = {};
6663
6209
  const fromParts = getValueByPath(fromObject, ['parts']);
6664
6210
  if (fromParts != null) {
6665
- if (Array.isArray(fromParts)) {
6666
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
6211
+ let transformedList = fromParts;
6212
+ if (Array.isArray(transformedList)) {
6213
+ transformedList = transformedList.map((item) => {
6667
6214
  return partFromMldev(apiClient, item);
6668
- }));
6669
- }
6670
- else {
6671
- setValueByPath(toObject, ['parts'], fromParts);
6215
+ });
6672
6216
  }
6217
+ setValueByPath(toObject, ['parts'], transformedList);
6673
6218
  }
6674
6219
  const fromRole = getValueByPath(fromObject, ['role']);
6675
6220
  if (fromRole != null) {
@@ -6737,14 +6282,13 @@ function generateContentResponseFromMldev(apiClient, fromObject) {
6737
6282
  const toObject = {};
6738
6283
  const fromCandidates = getValueByPath(fromObject, ['candidates']);
6739
6284
  if (fromCandidates != null) {
6740
- if (Array.isArray(fromCandidates)) {
6741
- setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
6285
+ let transformedList = fromCandidates;
6286
+ if (Array.isArray(transformedList)) {
6287
+ transformedList = transformedList.map((item) => {
6742
6288
  return candidateFromMldev(apiClient, item);
6743
- }));
6744
- }
6745
- else {
6746
- setValueByPath(toObject, ['candidates'], fromCandidates);
6289
+ });
6747
6290
  }
6291
+ setValueByPath(toObject, ['candidates'], transformedList);
6748
6292
  }
6749
6293
  const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
6750
6294
  if (fromModelVersion != null) {
@@ -6780,14 +6324,13 @@ function embedContentResponseFromMldev(apiClient, fromObject) {
6780
6324
  const toObject = {};
6781
6325
  const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
6782
6326
  if (fromEmbeddings != null) {
6783
- if (Array.isArray(fromEmbeddings)) {
6784
- setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
6327
+ let transformedList = fromEmbeddings;
6328
+ if (Array.isArray(transformedList)) {
6329
+ transformedList = transformedList.map((item) => {
6785
6330
  return contentEmbeddingFromMldev(apiClient, item);
6786
- }));
6787
- }
6788
- else {
6789
- setValueByPath(toObject, ['embeddings'], fromEmbeddings);
6331
+ });
6790
6332
  }
6333
+ setValueByPath(toObject, ['embeddings'], transformedList);
6791
6334
  }
6792
6335
  const fromMetadata = getValueByPath(fromObject, ['metadata']);
6793
6336
  if (fromMetadata != null) {
@@ -6855,14 +6398,13 @@ function generateImagesResponseFromMldev(apiClient, fromObject) {
6855
6398
  'predictions',
6856
6399
  ]);
6857
6400
  if (fromGeneratedImages != null) {
6858
- if (Array.isArray(fromGeneratedImages)) {
6859
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
6401
+ let transformedList = fromGeneratedImages;
6402
+ if (Array.isArray(transformedList)) {
6403
+ transformedList = transformedList.map((item) => {
6860
6404
  return generatedImageFromMldev(apiClient, item);
6861
- }));
6862
- }
6863
- else {
6864
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
6405
+ });
6865
6406
  }
6407
+ setValueByPath(toObject, ['generatedImages'], transformedList);
6866
6408
  }
6867
6409
  const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
6868
6410
  'positivePromptSafetyAttributes',
@@ -6930,6 +6472,10 @@ function modelFromMldev(apiClient, fromObject) {
6930
6472
  }
6931
6473
  return toObject;
6932
6474
  }
6475
+ function deleteModelResponseFromMldev() {
6476
+ const toObject = {};
6477
+ return toObject;
6478
+ }
6933
6479
  function countTokensResponseFromMldev(apiClient, fromObject) {
6934
6480
  const toObject = {};
6935
6481
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -6977,14 +6523,13 @@ function generateVideosResponseFromMldev$1(apiClient, fromObject) {
6977
6523
  'generatedSamples',
6978
6524
  ]);
6979
6525
  if (fromGeneratedVideos != null) {
6980
- if (Array.isArray(fromGeneratedVideos)) {
6981
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
6526
+ let transformedList = fromGeneratedVideos;
6527
+ if (Array.isArray(transformedList)) {
6528
+ transformedList = transformedList.map((item) => {
6982
6529
  return generatedVideoFromMldev$1(apiClient, item);
6983
- }));
6984
- }
6985
- else {
6986
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
6530
+ });
6987
6531
  }
6532
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
6988
6533
  }
6989
6534
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
6990
6535
  'raiMediaFilteredCount',
@@ -7079,14 +6624,13 @@ function contentFromVertex(apiClient, fromObject) {
7079
6624
  const toObject = {};
7080
6625
  const fromParts = getValueByPath(fromObject, ['parts']);
7081
6626
  if (fromParts != null) {
7082
- if (Array.isArray(fromParts)) {
7083
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
6627
+ let transformedList = fromParts;
6628
+ if (Array.isArray(transformedList)) {
6629
+ transformedList = transformedList.map((item) => {
7084
6630
  return partFromVertex(apiClient, item);
7085
- }));
7086
- }
7087
- else {
7088
- setValueByPath(toObject, ['parts'], fromParts);
6631
+ });
7089
6632
  }
6633
+ setValueByPath(toObject, ['parts'], transformedList);
7090
6634
  }
7091
6635
  const fromRole = getValueByPath(fromObject, ['role']);
7092
6636
  if (fromRole != null) {
@@ -7156,14 +6700,13 @@ function generateContentResponseFromVertex(apiClient, fromObject) {
7156
6700
  const toObject = {};
7157
6701
  const fromCandidates = getValueByPath(fromObject, ['candidates']);
7158
6702
  if (fromCandidates != null) {
7159
- if (Array.isArray(fromCandidates)) {
7160
- setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
6703
+ let transformedList = fromCandidates;
6704
+ if (Array.isArray(transformedList)) {
6705
+ transformedList = transformedList.map((item) => {
7161
6706
  return candidateFromVertex(apiClient, item);
7162
- }));
7163
- }
7164
- else {
7165
- setValueByPath(toObject, ['candidates'], fromCandidates);
6707
+ });
7166
6708
  }
6709
+ setValueByPath(toObject, ['candidates'], transformedList);
7167
6710
  }
7168
6711
  const fromCreateTime = getValueByPath(fromObject, ['createTime']);
7169
6712
  if (fromCreateTime != null) {
@@ -7232,14 +6775,13 @@ function embedContentResponseFromVertex(apiClient, fromObject) {
7232
6775
  'embeddings',
7233
6776
  ]);
7234
6777
  if (fromEmbeddings != null) {
7235
- if (Array.isArray(fromEmbeddings)) {
7236
- setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
6778
+ let transformedList = fromEmbeddings;
6779
+ if (Array.isArray(transformedList)) {
6780
+ transformedList = transformedList.map((item) => {
7237
6781
  return contentEmbeddingFromVertex(apiClient, item);
7238
- }));
7239
- }
7240
- else {
7241
- setValueByPath(toObject, ['embeddings'], fromEmbeddings);
6782
+ });
7242
6783
  }
6784
+ setValueByPath(toObject, ['embeddings'], transformedList);
7243
6785
  }
7244
6786
  const fromMetadata = getValueByPath(fromObject, ['metadata']);
7245
6787
  if (fromMetadata != null) {
@@ -7315,14 +6857,13 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
7315
6857
  'predictions',
7316
6858
  ]);
7317
6859
  if (fromGeneratedImages != null) {
7318
- if (Array.isArray(fromGeneratedImages)) {
7319
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
6860
+ let transformedList = fromGeneratedImages;
6861
+ if (Array.isArray(transformedList)) {
6862
+ transformedList = transformedList.map((item) => {
7320
6863
  return generatedImageFromVertex(apiClient, item);
7321
- }));
7322
- }
7323
- else {
7324
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
6864
+ });
7325
6865
  }
6866
+ setValueByPath(toObject, ['generatedImages'], transformedList);
7326
6867
  }
7327
6868
  const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
7328
6869
  'positivePromptSafetyAttributes',
@@ -7385,14 +6926,13 @@ function modelFromVertex(apiClient, fromObject) {
7385
6926
  }
7386
6927
  const fromEndpoints = getValueByPath(fromObject, ['deployedModels']);
7387
6928
  if (fromEndpoints != null) {
7388
- if (Array.isArray(fromEndpoints)) {
7389
- setValueByPath(toObject, ['endpoints'], fromEndpoints.map((item) => {
6929
+ let transformedList = fromEndpoints;
6930
+ if (Array.isArray(transformedList)) {
6931
+ transformedList = transformedList.map((item) => {
7390
6932
  return endpointFromVertex(apiClient, item);
7391
- }));
7392
- }
7393
- else {
7394
- setValueByPath(toObject, ['endpoints'], fromEndpoints);
6933
+ });
7395
6934
  }
6935
+ setValueByPath(toObject, ['endpoints'], transformedList);
7396
6936
  }
7397
6937
  const fromLabels = getValueByPath(fromObject, ['labels']);
7398
6938
  if (fromLabels != null) {
@@ -7404,6 +6944,10 @@ function modelFromVertex(apiClient, fromObject) {
7404
6944
  }
7405
6945
  return toObject;
7406
6946
  }
6947
+ function deleteModelResponseFromVertex() {
6948
+ const toObject = {};
6949
+ return toObject;
6950
+ }
7407
6951
  function countTokensResponseFromVertex(apiClient, fromObject) {
7408
6952
  const toObject = {};
7409
6953
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -7450,14 +6994,13 @@ function generateVideosResponseFromVertex$1(apiClient, fromObject) {
7450
6994
  const toObject = {};
7451
6995
  const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
7452
6996
  if (fromGeneratedVideos != null) {
7453
- if (Array.isArray(fromGeneratedVideos)) {
7454
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
6997
+ let transformedList = fromGeneratedVideos;
6998
+ if (Array.isArray(transformedList)) {
6999
+ transformedList = transformedList.map((item) => {
7455
7000
  return generatedVideoFromVertex$1(apiClient, item);
7456
- }));
7457
- }
7458
- else {
7459
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
7001
+ });
7460
7002
  }
7003
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
7461
7004
  }
7462
7005
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
7463
7006
  'raiMediaFilteredCount',
@@ -8400,6 +7943,146 @@ class Models extends BaseModule {
8400
7943
  });
8401
7944
  }
8402
7945
  }
7946
+ /**
7947
+ * Updates a tuned model by its name.
7948
+ *
7949
+ * @param params - The parameters for updating the model.
7950
+ * @return The response from the API.
7951
+ *
7952
+ * @example
7953
+ * ```ts
7954
+ * const response = await ai.models.update({
7955
+ * model: 'tuned-model-name',
7956
+ * config: {
7957
+ * displayName: 'New display name',
7958
+ * description: 'New description',
7959
+ * },
7960
+ * });
7961
+ * ```
7962
+ */
7963
+ async update(params) {
7964
+ var _a, _b, _c, _d;
7965
+ let response;
7966
+ let path = '';
7967
+ let queryParams = {};
7968
+ if (this.apiClient.isVertexAI()) {
7969
+ const body = updateModelParametersToVertex(this.apiClient, params);
7970
+ path = formatMap('{model}', body['_url']);
7971
+ queryParams = body['_query'];
7972
+ delete body['config'];
7973
+ delete body['_url'];
7974
+ delete body['_query'];
7975
+ response = this.apiClient
7976
+ .request({
7977
+ path: path,
7978
+ queryParams: queryParams,
7979
+ body: JSON.stringify(body),
7980
+ httpMethod: 'PATCH',
7981
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
7982
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
7983
+ })
7984
+ .then((httpResponse) => {
7985
+ return httpResponse.json();
7986
+ });
7987
+ return response.then((apiResponse) => {
7988
+ const resp = modelFromVertex(this.apiClient, apiResponse);
7989
+ return resp;
7990
+ });
7991
+ }
7992
+ else {
7993
+ const body = updateModelParametersToMldev(this.apiClient, params);
7994
+ path = formatMap('{name}', body['_url']);
7995
+ queryParams = body['_query'];
7996
+ delete body['config'];
7997
+ delete body['_url'];
7998
+ delete body['_query'];
7999
+ response = this.apiClient
8000
+ .request({
8001
+ path: path,
8002
+ queryParams: queryParams,
8003
+ body: JSON.stringify(body),
8004
+ httpMethod: 'PATCH',
8005
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
8006
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
8007
+ })
8008
+ .then((httpResponse) => {
8009
+ return httpResponse.json();
8010
+ });
8011
+ return response.then((apiResponse) => {
8012
+ const resp = modelFromMldev(this.apiClient, apiResponse);
8013
+ return resp;
8014
+ });
8015
+ }
8016
+ }
8017
+ /**
8018
+ * Deletes a tuned model by its name.
8019
+ *
8020
+ * @param params - The parameters for deleting the model.
8021
+ * @return The response from the API.
8022
+ *
8023
+ * @example
8024
+ * ```ts
8025
+ * const response = await ai.models.delete({model: 'tuned-model-name'});
8026
+ * ```
8027
+ */
8028
+ async delete(params) {
8029
+ var _a, _b, _c, _d;
8030
+ let response;
8031
+ let path = '';
8032
+ let queryParams = {};
8033
+ if (this.apiClient.isVertexAI()) {
8034
+ const body = deleteModelParametersToVertex(this.apiClient, params);
8035
+ path = formatMap('{name}', body['_url']);
8036
+ queryParams = body['_query'];
8037
+ delete body['config'];
8038
+ delete body['_url'];
8039
+ delete body['_query'];
8040
+ response = this.apiClient
8041
+ .request({
8042
+ path: path,
8043
+ queryParams: queryParams,
8044
+ body: JSON.stringify(body),
8045
+ httpMethod: 'DELETE',
8046
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
8047
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
8048
+ })
8049
+ .then((httpResponse) => {
8050
+ return httpResponse.json();
8051
+ });
8052
+ return response.then(() => {
8053
+ const resp = deleteModelResponseFromVertex();
8054
+ const typedResp = new DeleteModelResponse();
8055
+ Object.assign(typedResp, resp);
8056
+ return typedResp;
8057
+ });
8058
+ }
8059
+ else {
8060
+ const body = deleteModelParametersToMldev(this.apiClient, params);
8061
+ path = formatMap('{name}', body['_url']);
8062
+ queryParams = body['_query'];
8063
+ delete body['config'];
8064
+ delete body['_url'];
8065
+ delete body['_query'];
8066
+ response = this.apiClient
8067
+ .request({
8068
+ path: path,
8069
+ queryParams: queryParams,
8070
+ body: JSON.stringify(body),
8071
+ httpMethod: 'DELETE',
8072
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
8073
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
8074
+ })
8075
+ .then((httpResponse) => {
8076
+ return httpResponse.json();
8077
+ });
8078
+ return response.then(() => {
8079
+ const resp = deleteModelResponseFromMldev();
8080
+ const typedResp = new DeleteModelResponse();
8081
+ Object.assign(typedResp, resp);
8082
+ return typedResp;
8083
+ });
8084
+ }
8085
+ }
8403
8086
  /**
8404
8087
  * Counts the number of tokens in the given contents. Multimodal input is
8405
8088
  * supported for Gemini models.
@@ -8690,14 +8373,13 @@ function generateVideosResponseFromMldev(apiClient, fromObject) {
8690
8373
  'generatedSamples',
8691
8374
  ]);
8692
8375
  if (fromGeneratedVideos != null) {
8693
- if (Array.isArray(fromGeneratedVideos)) {
8694
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
8376
+ let transformedList = fromGeneratedVideos;
8377
+ if (Array.isArray(transformedList)) {
8378
+ transformedList = transformedList.map((item) => {
8695
8379
  return generatedVideoFromMldev(apiClient, item);
8696
- }));
8697
- }
8698
- else {
8699
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
8380
+ });
8700
8381
  }
8382
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
8701
8383
  }
8702
8384
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
8703
8385
  'raiMediaFilteredCount',
@@ -8770,14 +8452,13 @@ function generateVideosResponseFromVertex(apiClient, fromObject) {
8770
8452
  const toObject = {};
8771
8453
  const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
8772
8454
  if (fromGeneratedVideos != null) {
8773
- if (Array.isArray(fromGeneratedVideos)) {
8774
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
8455
+ let transformedList = fromGeneratedVideos;
8456
+ if (Array.isArray(transformedList)) {
8457
+ transformedList = transformedList.map((item) => {
8775
8458
  return generatedVideoFromVertex(apiClient, item);
8776
- }));
8777
- }
8778
- else {
8779
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
8459
+ });
8780
8460
  }
8461
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
8781
8462
  }
8782
8463
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
8783
8464
  'raiMediaFilteredCount',
@@ -8957,7 +8638,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
8957
8638
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
8958
8639
  const USER_AGENT_HEADER = 'User-Agent';
8959
8640
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
8960
- const SDK_VERSION = '0.10.0'; // x-release-please-version
8641
+ const SDK_VERSION = '0.11.0'; // x-release-please-version
8961
8642
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
8962
8643
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
8963
8644
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -9545,6 +9226,736 @@ class NodeWebSocket {
9545
9226
  }
9546
9227
  }
9547
9228
 
9229
+ /**
9230
+ * @license
9231
+ * Copyright 2025 Google LLC
9232
+ * SPDX-License-Identifier: Apache-2.0
9233
+ */
9234
+ function getTuningJobParametersToMldev(apiClient, fromObject) {
9235
+ const toObject = {};
9236
+ const fromName = getValueByPath(fromObject, ['name']);
9237
+ if (fromName != null) {
9238
+ setValueByPath(toObject, ['_url', 'name'], fromName);
9239
+ }
9240
+ const fromConfig = getValueByPath(fromObject, ['config']);
9241
+ if (fromConfig != null) {
9242
+ setValueByPath(toObject, ['config'], fromConfig);
9243
+ }
9244
+ return toObject;
9245
+ }
9246
+ function listTuningJobsConfigToMldev(apiClient, fromObject, parentObject) {
9247
+ const toObject = {};
9248
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
9249
+ if (parentObject !== undefined && fromPageSize != null) {
9250
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
9251
+ }
9252
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
9253
+ if (parentObject !== undefined && fromPageToken != null) {
9254
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
9255
+ }
9256
+ const fromFilter = getValueByPath(fromObject, ['filter']);
9257
+ if (parentObject !== undefined && fromFilter != null) {
9258
+ setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
9259
+ }
9260
+ return toObject;
9261
+ }
9262
+ function listTuningJobsParametersToMldev(apiClient, fromObject) {
9263
+ const toObject = {};
9264
+ const fromConfig = getValueByPath(fromObject, ['config']);
9265
+ if (fromConfig != null) {
9266
+ setValueByPath(toObject, ['config'], listTuningJobsConfigToMldev(apiClient, fromConfig, toObject));
9267
+ }
9268
+ return toObject;
9269
+ }
9270
+ function tuningExampleToMldev(apiClient, fromObject) {
9271
+ const toObject = {};
9272
+ const fromTextInput = getValueByPath(fromObject, ['textInput']);
9273
+ if (fromTextInput != null) {
9274
+ setValueByPath(toObject, ['textInput'], fromTextInput);
9275
+ }
9276
+ const fromOutput = getValueByPath(fromObject, ['output']);
9277
+ if (fromOutput != null) {
9278
+ setValueByPath(toObject, ['output'], fromOutput);
9279
+ }
9280
+ return toObject;
9281
+ }
9282
+ function tuningDatasetToMldev(apiClient, fromObject) {
9283
+ const toObject = {};
9284
+ if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
9285
+ throw new Error('gcsUri parameter is not supported in Gemini API.');
9286
+ }
9287
+ const fromExamples = getValueByPath(fromObject, ['examples']);
9288
+ if (fromExamples != null) {
9289
+ let transformedList = fromExamples;
9290
+ if (Array.isArray(transformedList)) {
9291
+ transformedList = transformedList.map((item) => {
9292
+ return tuningExampleToMldev(apiClient, item);
9293
+ });
9294
+ }
9295
+ setValueByPath(toObject, ['examples', 'examples'], transformedList);
9296
+ }
9297
+ return toObject;
9298
+ }
9299
+ function createTuningJobConfigToMldev(apiClient, fromObject, parentObject) {
9300
+ const toObject = {};
9301
+ if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
9302
+ throw new Error('validationDataset parameter is not supported in Gemini API.');
9303
+ }
9304
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9305
+ 'tunedModelDisplayName',
9306
+ ]);
9307
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
9308
+ setValueByPath(parentObject, ['displayName'], fromTunedModelDisplayName);
9309
+ }
9310
+ if (getValueByPath(fromObject, ['description']) !== undefined) {
9311
+ throw new Error('description parameter is not supported in Gemini API.');
9312
+ }
9313
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
9314
+ if (parentObject !== undefined && fromEpochCount != null) {
9315
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'epochCount'], fromEpochCount);
9316
+ }
9317
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
9318
+ 'learningRateMultiplier',
9319
+ ]);
9320
+ if (fromLearningRateMultiplier != null) {
9321
+ setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
9322
+ }
9323
+ if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
9324
+ throw new Error('adapterSize parameter is not supported in Gemini API.');
9325
+ }
9326
+ const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
9327
+ if (parentObject !== undefined && fromBatchSize != null) {
9328
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
9329
+ }
9330
+ const fromLearningRate = getValueByPath(fromObject, ['learningRate']);
9331
+ if (parentObject !== undefined && fromLearningRate != null) {
9332
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
9333
+ }
9334
+ return toObject;
9335
+ }
9336
+ function createTuningJobParametersToMldev(apiClient, fromObject) {
9337
+ const toObject = {};
9338
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9339
+ if (fromBaseModel != null) {
9340
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9341
+ }
9342
+ const fromTrainingDataset = getValueByPath(fromObject, [
9343
+ 'trainingDataset',
9344
+ ]);
9345
+ if (fromTrainingDataset != null) {
9346
+ setValueByPath(toObject, ['tuningTask', 'trainingData'], tuningDatasetToMldev(apiClient, fromTrainingDataset));
9347
+ }
9348
+ const fromConfig = getValueByPath(fromObject, ['config']);
9349
+ if (fromConfig != null) {
9350
+ setValueByPath(toObject, ['config'], createTuningJobConfigToMldev(apiClient, fromConfig, toObject));
9351
+ }
9352
+ return toObject;
9353
+ }
9354
+ function getTuningJobParametersToVertex(apiClient, fromObject) {
9355
+ const toObject = {};
9356
+ const fromName = getValueByPath(fromObject, ['name']);
9357
+ if (fromName != null) {
9358
+ setValueByPath(toObject, ['_url', 'name'], fromName);
9359
+ }
9360
+ const fromConfig = getValueByPath(fromObject, ['config']);
9361
+ if (fromConfig != null) {
9362
+ setValueByPath(toObject, ['config'], fromConfig);
9363
+ }
9364
+ return toObject;
9365
+ }
9366
+ function listTuningJobsConfigToVertex(apiClient, fromObject, parentObject) {
9367
+ const toObject = {};
9368
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
9369
+ if (parentObject !== undefined && fromPageSize != null) {
9370
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
9371
+ }
9372
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
9373
+ if (parentObject !== undefined && fromPageToken != null) {
9374
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
9375
+ }
9376
+ const fromFilter = getValueByPath(fromObject, ['filter']);
9377
+ if (parentObject !== undefined && fromFilter != null) {
9378
+ setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
9379
+ }
9380
+ return toObject;
9381
+ }
9382
+ function listTuningJobsParametersToVertex(apiClient, fromObject) {
9383
+ const toObject = {};
9384
+ const fromConfig = getValueByPath(fromObject, ['config']);
9385
+ if (fromConfig != null) {
9386
+ setValueByPath(toObject, ['config'], listTuningJobsConfigToVertex(apiClient, fromConfig, toObject));
9387
+ }
9388
+ return toObject;
9389
+ }
9390
+ function tuningDatasetToVertex(apiClient, fromObject, parentObject) {
9391
+ const toObject = {};
9392
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
9393
+ if (parentObject !== undefined && fromGcsUri != null) {
9394
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
9395
+ }
9396
+ if (getValueByPath(fromObject, ['examples']) !== undefined) {
9397
+ throw new Error('examples parameter is not supported in Vertex AI.');
9398
+ }
9399
+ return toObject;
9400
+ }
9401
+ function tuningValidationDatasetToVertex(apiClient, fromObject) {
9402
+ const toObject = {};
9403
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
9404
+ if (fromGcsUri != null) {
9405
+ setValueByPath(toObject, ['validationDatasetUri'], fromGcsUri);
9406
+ }
9407
+ return toObject;
9408
+ }
9409
+ function createTuningJobConfigToVertex(apiClient, fromObject, parentObject) {
9410
+ const toObject = {};
9411
+ const fromValidationDataset = getValueByPath(fromObject, [
9412
+ 'validationDataset',
9413
+ ]);
9414
+ if (parentObject !== undefined && fromValidationDataset != null) {
9415
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(apiClient, fromValidationDataset));
9416
+ }
9417
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9418
+ 'tunedModelDisplayName',
9419
+ ]);
9420
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
9421
+ setValueByPath(parentObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
9422
+ }
9423
+ const fromDescription = getValueByPath(fromObject, ['description']);
9424
+ if (parentObject !== undefined && fromDescription != null) {
9425
+ setValueByPath(parentObject, ['description'], fromDescription);
9426
+ }
9427
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
9428
+ if (parentObject !== undefined && fromEpochCount != null) {
9429
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
9430
+ }
9431
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
9432
+ 'learningRateMultiplier',
9433
+ ]);
9434
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
9435
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
9436
+ }
9437
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
9438
+ if (parentObject !== undefined && fromAdapterSize != null) {
9439
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
9440
+ }
9441
+ if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
9442
+ throw new Error('batchSize parameter is not supported in Vertex AI.');
9443
+ }
9444
+ if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
9445
+ throw new Error('learningRate parameter is not supported in Vertex AI.');
9446
+ }
9447
+ return toObject;
9448
+ }
9449
+ function createTuningJobParametersToVertex(apiClient, fromObject) {
9450
+ const toObject = {};
9451
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9452
+ if (fromBaseModel != null) {
9453
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9454
+ }
9455
+ const fromTrainingDataset = getValueByPath(fromObject, [
9456
+ 'trainingDataset',
9457
+ ]);
9458
+ if (fromTrainingDataset != null) {
9459
+ setValueByPath(toObject, ['supervisedTuningSpec', 'trainingDatasetUri'], tuningDatasetToVertex(apiClient, fromTrainingDataset, toObject));
9460
+ }
9461
+ const fromConfig = getValueByPath(fromObject, ['config']);
9462
+ if (fromConfig != null) {
9463
+ setValueByPath(toObject, ['config'], createTuningJobConfigToVertex(apiClient, fromConfig, toObject));
9464
+ }
9465
+ return toObject;
9466
+ }
9467
+ function tunedModelFromMldev(apiClient, fromObject) {
9468
+ const toObject = {};
9469
+ const fromModel = getValueByPath(fromObject, ['name']);
9470
+ if (fromModel != null) {
9471
+ setValueByPath(toObject, ['model'], fromModel);
9472
+ }
9473
+ const fromEndpoint = getValueByPath(fromObject, ['name']);
9474
+ if (fromEndpoint != null) {
9475
+ setValueByPath(toObject, ['endpoint'], fromEndpoint);
9476
+ }
9477
+ return toObject;
9478
+ }
9479
+ function tuningJobFromMldev(apiClient, fromObject) {
9480
+ const toObject = {};
9481
+ const fromName = getValueByPath(fromObject, ['name']);
9482
+ if (fromName != null) {
9483
+ setValueByPath(toObject, ['name'], fromName);
9484
+ }
9485
+ const fromState = getValueByPath(fromObject, ['state']);
9486
+ if (fromState != null) {
9487
+ setValueByPath(toObject, ['state'], tTuningJobStatus(apiClient, fromState));
9488
+ }
9489
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
9490
+ if (fromCreateTime != null) {
9491
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
9492
+ }
9493
+ const fromStartTime = getValueByPath(fromObject, [
9494
+ 'tuningTask',
9495
+ 'startTime',
9496
+ ]);
9497
+ if (fromStartTime != null) {
9498
+ setValueByPath(toObject, ['startTime'], fromStartTime);
9499
+ }
9500
+ const fromEndTime = getValueByPath(fromObject, [
9501
+ 'tuningTask',
9502
+ 'completeTime',
9503
+ ]);
9504
+ if (fromEndTime != null) {
9505
+ setValueByPath(toObject, ['endTime'], fromEndTime);
9506
+ }
9507
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
9508
+ if (fromUpdateTime != null) {
9509
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
9510
+ }
9511
+ const fromDescription = getValueByPath(fromObject, ['description']);
9512
+ if (fromDescription != null) {
9513
+ setValueByPath(toObject, ['description'], fromDescription);
9514
+ }
9515
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9516
+ if (fromBaseModel != null) {
9517
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9518
+ }
9519
+ const fromTunedModel = getValueByPath(fromObject, ['_self']);
9520
+ if (fromTunedModel != null) {
9521
+ setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(apiClient, fromTunedModel));
9522
+ }
9523
+ const fromDistillationSpec = getValueByPath(fromObject, [
9524
+ 'distillationSpec',
9525
+ ]);
9526
+ if (fromDistillationSpec != null) {
9527
+ setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
9528
+ }
9529
+ const fromExperiment = getValueByPath(fromObject, ['experiment']);
9530
+ if (fromExperiment != null) {
9531
+ setValueByPath(toObject, ['experiment'], fromExperiment);
9532
+ }
9533
+ const fromLabels = getValueByPath(fromObject, ['labels']);
9534
+ if (fromLabels != null) {
9535
+ setValueByPath(toObject, ['labels'], fromLabels);
9536
+ }
9537
+ const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
9538
+ if (fromPipelineJob != null) {
9539
+ setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
9540
+ }
9541
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9542
+ 'tunedModelDisplayName',
9543
+ ]);
9544
+ if (fromTunedModelDisplayName != null) {
9545
+ setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
9546
+ }
9547
+ return toObject;
9548
+ }
9549
+ function listTuningJobsResponseFromMldev(apiClient, fromObject) {
9550
+ const toObject = {};
9551
+ const fromNextPageToken = getValueByPath(fromObject, [
9552
+ 'nextPageToken',
9553
+ ]);
9554
+ if (fromNextPageToken != null) {
9555
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
9556
+ }
9557
+ const fromTuningJobs = getValueByPath(fromObject, ['tunedModels']);
9558
+ if (fromTuningJobs != null) {
9559
+ let transformedList = fromTuningJobs;
9560
+ if (Array.isArray(transformedList)) {
9561
+ transformedList = transformedList.map((item) => {
9562
+ return tuningJobFromMldev(apiClient, item);
9563
+ });
9564
+ }
9565
+ setValueByPath(toObject, ['tuningJobs'], transformedList);
9566
+ }
9567
+ return toObject;
9568
+ }
9569
+ function operationFromMldev(apiClient, fromObject) {
9570
+ const toObject = {};
9571
+ const fromName = getValueByPath(fromObject, ['name']);
9572
+ if (fromName != null) {
9573
+ setValueByPath(toObject, ['name'], fromName);
9574
+ }
9575
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
9576
+ if (fromMetadata != null) {
9577
+ setValueByPath(toObject, ['metadata'], fromMetadata);
9578
+ }
9579
+ const fromDone = getValueByPath(fromObject, ['done']);
9580
+ if (fromDone != null) {
9581
+ setValueByPath(toObject, ['done'], fromDone);
9582
+ }
9583
+ const fromError = getValueByPath(fromObject, ['error']);
9584
+ if (fromError != null) {
9585
+ setValueByPath(toObject, ['error'], fromError);
9586
+ }
9587
+ return toObject;
9588
+ }
9589
+ function tunedModelFromVertex(apiClient, fromObject) {
9590
+ const toObject = {};
9591
+ const fromModel = getValueByPath(fromObject, ['model']);
9592
+ if (fromModel != null) {
9593
+ setValueByPath(toObject, ['model'], fromModel);
9594
+ }
9595
+ const fromEndpoint = getValueByPath(fromObject, ['endpoint']);
9596
+ if (fromEndpoint != null) {
9597
+ setValueByPath(toObject, ['endpoint'], fromEndpoint);
9598
+ }
9599
+ return toObject;
9600
+ }
9601
+ function tuningJobFromVertex(apiClient, fromObject) {
9602
+ const toObject = {};
9603
+ const fromName = getValueByPath(fromObject, ['name']);
9604
+ if (fromName != null) {
9605
+ setValueByPath(toObject, ['name'], fromName);
9606
+ }
9607
+ const fromState = getValueByPath(fromObject, ['state']);
9608
+ if (fromState != null) {
9609
+ setValueByPath(toObject, ['state'], tTuningJobStatus(apiClient, fromState));
9610
+ }
9611
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
9612
+ if (fromCreateTime != null) {
9613
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
9614
+ }
9615
+ const fromStartTime = getValueByPath(fromObject, ['startTime']);
9616
+ if (fromStartTime != null) {
9617
+ setValueByPath(toObject, ['startTime'], fromStartTime);
9618
+ }
9619
+ const fromEndTime = getValueByPath(fromObject, ['endTime']);
9620
+ if (fromEndTime != null) {
9621
+ setValueByPath(toObject, ['endTime'], fromEndTime);
9622
+ }
9623
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
9624
+ if (fromUpdateTime != null) {
9625
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
9626
+ }
9627
+ const fromError = getValueByPath(fromObject, ['error']);
9628
+ if (fromError != null) {
9629
+ setValueByPath(toObject, ['error'], fromError);
9630
+ }
9631
+ const fromDescription = getValueByPath(fromObject, ['description']);
9632
+ if (fromDescription != null) {
9633
+ setValueByPath(toObject, ['description'], fromDescription);
9634
+ }
9635
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9636
+ if (fromBaseModel != null) {
9637
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9638
+ }
9639
+ const fromTunedModel = getValueByPath(fromObject, ['tunedModel']);
9640
+ if (fromTunedModel != null) {
9641
+ setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(apiClient, fromTunedModel));
9642
+ }
9643
+ const fromSupervisedTuningSpec = getValueByPath(fromObject, [
9644
+ 'supervisedTuningSpec',
9645
+ ]);
9646
+ if (fromSupervisedTuningSpec != null) {
9647
+ setValueByPath(toObject, ['supervisedTuningSpec'], fromSupervisedTuningSpec);
9648
+ }
9649
+ const fromTuningDataStats = getValueByPath(fromObject, [
9650
+ 'tuningDataStats',
9651
+ ]);
9652
+ if (fromTuningDataStats != null) {
9653
+ setValueByPath(toObject, ['tuningDataStats'], fromTuningDataStats);
9654
+ }
9655
+ const fromEncryptionSpec = getValueByPath(fromObject, [
9656
+ 'encryptionSpec',
9657
+ ]);
9658
+ if (fromEncryptionSpec != null) {
9659
+ setValueByPath(toObject, ['encryptionSpec'], fromEncryptionSpec);
9660
+ }
9661
+ const fromPartnerModelTuningSpec = getValueByPath(fromObject, [
9662
+ 'partnerModelTuningSpec',
9663
+ ]);
9664
+ if (fromPartnerModelTuningSpec != null) {
9665
+ setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
9666
+ }
9667
+ const fromDistillationSpec = getValueByPath(fromObject, [
9668
+ 'distillationSpec',
9669
+ ]);
9670
+ if (fromDistillationSpec != null) {
9671
+ setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
9672
+ }
9673
+ const fromExperiment = getValueByPath(fromObject, ['experiment']);
9674
+ if (fromExperiment != null) {
9675
+ setValueByPath(toObject, ['experiment'], fromExperiment);
9676
+ }
9677
+ const fromLabels = getValueByPath(fromObject, ['labels']);
9678
+ if (fromLabels != null) {
9679
+ setValueByPath(toObject, ['labels'], fromLabels);
9680
+ }
9681
+ const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
9682
+ if (fromPipelineJob != null) {
9683
+ setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
9684
+ }
9685
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9686
+ 'tunedModelDisplayName',
9687
+ ]);
9688
+ if (fromTunedModelDisplayName != null) {
9689
+ setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
9690
+ }
9691
+ return toObject;
9692
+ }
9693
+ function listTuningJobsResponseFromVertex(apiClient, fromObject) {
9694
+ const toObject = {};
9695
+ const fromNextPageToken = getValueByPath(fromObject, [
9696
+ 'nextPageToken',
9697
+ ]);
9698
+ if (fromNextPageToken != null) {
9699
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
9700
+ }
9701
+ const fromTuningJobs = getValueByPath(fromObject, ['tuningJobs']);
9702
+ if (fromTuningJobs != null) {
9703
+ let transformedList = fromTuningJobs;
9704
+ if (Array.isArray(transformedList)) {
9705
+ transformedList = transformedList.map((item) => {
9706
+ return tuningJobFromVertex(apiClient, item);
9707
+ });
9708
+ }
9709
+ setValueByPath(toObject, ['tuningJobs'], transformedList);
9710
+ }
9711
+ return toObject;
9712
+ }
9713
+
9714
+ /**
9715
+ * @license
9716
+ * Copyright 2025 Google LLC
9717
+ * SPDX-License-Identifier: Apache-2.0
9718
+ */
9719
+ class Tunings extends BaseModule {
9720
+ constructor(apiClient) {
9721
+ super();
9722
+ this.apiClient = apiClient;
9723
+ /**
9724
+ * Gets a TuningJob.
9725
+ *
9726
+ * @param name - The resource name of the tuning job.
9727
+ * @return - A TuningJob object.
9728
+ *
9729
+ * @experimental - The SDK's tuning implementation is experimental, and may
9730
+ * change in future versions.
9731
+ */
9732
+ this.get = async (params) => {
9733
+ return await this.getInternal(params);
9734
+ };
9735
+ /**
9736
+ * Lists tuning jobs.
9737
+ *
9738
+ * @param config - The configuration for the list request.
9739
+ * @return - A list of tuning jobs.
9740
+ *
9741
+ * @experimental - The SDK's tuning implementation is experimental, and may
9742
+ * change in future versions.
9743
+ */
9744
+ this.list = async (params = {}) => {
9745
+ return new Pager(exports.PagedItem.PAGED_ITEM_TUNING_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
9746
+ };
9747
+ /**
9748
+ * Creates a supervised fine-tuning job.
9749
+ *
9750
+ * @param params - The parameters for the tuning job.
9751
+ * @return - A TuningJob operation.
9752
+ *
9753
+ * @experimental - The SDK's tuning implementation is experimental, and may
9754
+ * change in future versions.
9755
+ */
9756
+ this.tune = async (params) => {
9757
+ if (this.apiClient.isVertexAI()) {
9758
+ return await this.tuneInternal(params);
9759
+ }
9760
+ else {
9761
+ const operation = await this.tuneMldevInternal(params);
9762
+ let tunedModelName = '';
9763
+ if (operation['metadata'] !== undefined &&
9764
+ operation['metadata']['tunedModel'] !== undefined) {
9765
+ tunedModelName = operation['metadata']['tunedModel'];
9766
+ }
9767
+ else if (operation['name'] !== undefined &&
9768
+ operation['name'].includes('/operations/')) {
9769
+ tunedModelName = operation['name'].split('/operations/')[0];
9770
+ }
9771
+ const tuningJob = {
9772
+ name: tunedModelName,
9773
+ state: exports.JobState.JOB_STATE_QUEUED,
9774
+ };
9775
+ return tuningJob;
9776
+ }
9777
+ };
9778
+ }
9779
+ async getInternal(params) {
9780
+ var _a, _b, _c, _d;
9781
+ let response;
9782
+ let path = '';
9783
+ let queryParams = {};
9784
+ if (this.apiClient.isVertexAI()) {
9785
+ const body = getTuningJobParametersToVertex(this.apiClient, params);
9786
+ path = formatMap('{name}', body['_url']);
9787
+ queryParams = body['_query'];
9788
+ delete body['config'];
9789
+ delete body['_url'];
9790
+ delete body['_query'];
9791
+ response = this.apiClient
9792
+ .request({
9793
+ path: path,
9794
+ queryParams: queryParams,
9795
+ body: JSON.stringify(body),
9796
+ httpMethod: 'GET',
9797
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9798
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9799
+ })
9800
+ .then((httpResponse) => {
9801
+ return httpResponse.json();
9802
+ });
9803
+ return response.then((apiResponse) => {
9804
+ const resp = tuningJobFromVertex(this.apiClient, apiResponse);
9805
+ return resp;
9806
+ });
9807
+ }
9808
+ else {
9809
+ const body = getTuningJobParametersToMldev(this.apiClient, params);
9810
+ path = formatMap('{name}', body['_url']);
9811
+ queryParams = body['_query'];
9812
+ delete body['config'];
9813
+ delete body['_url'];
9814
+ delete body['_query'];
9815
+ response = this.apiClient
9816
+ .request({
9817
+ path: path,
9818
+ queryParams: queryParams,
9819
+ body: JSON.stringify(body),
9820
+ httpMethod: 'GET',
9821
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
9822
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
9823
+ })
9824
+ .then((httpResponse) => {
9825
+ return httpResponse.json();
9826
+ });
9827
+ return response.then((apiResponse) => {
9828
+ const resp = tuningJobFromMldev(this.apiClient, apiResponse);
9829
+ return resp;
9830
+ });
9831
+ }
9832
+ }
9833
+ async listInternal(params) {
9834
+ var _a, _b, _c, _d;
9835
+ let response;
9836
+ let path = '';
9837
+ let queryParams = {};
9838
+ if (this.apiClient.isVertexAI()) {
9839
+ const body = listTuningJobsParametersToVertex(this.apiClient, params);
9840
+ path = formatMap('tuningJobs', body['_url']);
9841
+ queryParams = body['_query'];
9842
+ delete body['config'];
9843
+ delete body['_url'];
9844
+ delete body['_query'];
9845
+ response = this.apiClient
9846
+ .request({
9847
+ path: path,
9848
+ queryParams: queryParams,
9849
+ body: JSON.stringify(body),
9850
+ httpMethod: 'GET',
9851
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9852
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9853
+ })
9854
+ .then((httpResponse) => {
9855
+ return httpResponse.json();
9856
+ });
9857
+ return response.then((apiResponse) => {
9858
+ const resp = listTuningJobsResponseFromVertex(this.apiClient, apiResponse);
9859
+ const typedResp = new ListTuningJobsResponse();
9860
+ Object.assign(typedResp, resp);
9861
+ return typedResp;
9862
+ });
9863
+ }
9864
+ else {
9865
+ const body = listTuningJobsParametersToMldev(this.apiClient, params);
9866
+ path = formatMap('tunedModels', body['_url']);
9867
+ queryParams = body['_query'];
9868
+ delete body['config'];
9869
+ delete body['_url'];
9870
+ delete body['_query'];
9871
+ response = this.apiClient
9872
+ .request({
9873
+ path: path,
9874
+ queryParams: queryParams,
9875
+ body: JSON.stringify(body),
9876
+ httpMethod: 'GET',
9877
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
9878
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
9879
+ })
9880
+ .then((httpResponse) => {
9881
+ return httpResponse.json();
9882
+ });
9883
+ return response.then((apiResponse) => {
9884
+ const resp = listTuningJobsResponseFromMldev(this.apiClient, apiResponse);
9885
+ const typedResp = new ListTuningJobsResponse();
9886
+ Object.assign(typedResp, resp);
9887
+ return typedResp;
9888
+ });
9889
+ }
9890
+ }
9891
+ async tuneInternal(params) {
9892
+ var _a, _b;
9893
+ let response;
9894
+ let path = '';
9895
+ let queryParams = {};
9896
+ if (this.apiClient.isVertexAI()) {
9897
+ const body = createTuningJobParametersToVertex(this.apiClient, params);
9898
+ path = formatMap('tuningJobs', body['_url']);
9899
+ queryParams = body['_query'];
9900
+ delete body['config'];
9901
+ delete body['_url'];
9902
+ delete body['_query'];
9903
+ response = this.apiClient
9904
+ .request({
9905
+ path: path,
9906
+ queryParams: queryParams,
9907
+ body: JSON.stringify(body),
9908
+ httpMethod: 'POST',
9909
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9910
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9911
+ })
9912
+ .then((httpResponse) => {
9913
+ return httpResponse.json();
9914
+ });
9915
+ return response.then((apiResponse) => {
9916
+ const resp = tuningJobFromVertex(this.apiClient, apiResponse);
9917
+ return resp;
9918
+ });
9919
+ }
9920
+ else {
9921
+ throw new Error('This method is only supported by the Vertex AI.');
9922
+ }
9923
+ }
9924
+ async tuneMldevInternal(params) {
9925
+ var _a, _b;
9926
+ let response;
9927
+ let path = '';
9928
+ let queryParams = {};
9929
+ if (this.apiClient.isVertexAI()) {
9930
+ throw new Error('This method is only supported by the Gemini Developer API.');
9931
+ }
9932
+ else {
9933
+ const body = createTuningJobParametersToMldev(this.apiClient, params);
9934
+ path = formatMap('tunedModels', body['_url']);
9935
+ queryParams = body['_query'];
9936
+ delete body['config'];
9937
+ delete body['_url'];
9938
+ delete body['_query'];
9939
+ response = this.apiClient
9940
+ .request({
9941
+ path: path,
9942
+ queryParams: queryParams,
9943
+ body: JSON.stringify(body),
9944
+ httpMethod: 'POST',
9945
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9946
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9947
+ })
9948
+ .then((httpResponse) => {
9949
+ return httpResponse.json();
9950
+ });
9951
+ return response.then((apiResponse) => {
9952
+ const resp = operationFromMldev(this.apiClient, apiResponse);
9953
+ return resp;
9954
+ });
9955
+ }
9956
+ }
9957
+ }
9958
+
9548
9959
  const MAX_CHUNK_SIZE = 1024 * 1024 * 8; // bytes
9549
9960
  async function uploadBlob(file, uploadUrl, apiClient) {
9550
9961
  var _a, _b;
@@ -9890,6 +10301,7 @@ class GoogleGenAI {
9890
10301
  this.caches = new Caches(this.apiClient);
9891
10302
  this.files = new Files(this.apiClient);
9892
10303
  this.operations = new Operations(this.apiClient);
10304
+ this.tunings = new Tunings(this.apiClient);
9893
10305
  }
9894
10306
  }
9895
10307
  function getEnv(env) {
@@ -9914,6 +10326,7 @@ exports.CountTokensResponse = CountTokensResponse;
9914
10326
  exports.CreateFileResponse = CreateFileResponse;
9915
10327
  exports.DeleteCachedContentResponse = DeleteCachedContentResponse;
9916
10328
  exports.DeleteFileResponse = DeleteFileResponse;
10329
+ exports.DeleteModelResponse = DeleteModelResponse;
9917
10330
  exports.EmbedContentResponse = EmbedContentResponse;
9918
10331
  exports.Files = Files;
9919
10332
  exports.FunctionResponse = FunctionResponse;
@@ -9926,6 +10339,7 @@ exports.GoogleGenAI = GoogleGenAI;
9926
10339
  exports.HttpResponse = HttpResponse;
9927
10340
  exports.ListCachedContentsResponse = ListCachedContentsResponse;
9928
10341
  exports.ListFilesResponse = ListFilesResponse;
10342
+ exports.ListTuningJobsResponse = ListTuningJobsResponse;
9929
10343
  exports.Live = Live;
9930
10344
  exports.LiveClientToolResponse = LiveClientToolResponse;
9931
10345
  exports.LiveSendToolResponseParameters = LiveSendToolResponseParameters;