@google/genai 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -470,6 +470,20 @@ function tCachedContentName(apiClient, name) {
470
470
  }
471
471
  return resourceName(apiClient, name, 'cachedContents');
472
472
  }
473
+ function tTuningJobStatus(apiClient, status) {
474
+ switch (status) {
475
+ case 'STATE_UNSPECIFIED':
476
+ return 'JOB_STATE_UNSPECIFIED';
477
+ case 'CREATING':
478
+ return 'JOB_STATE_RUNNING';
479
+ case 'ACTIVE':
480
+ return 'JOB_STATE_SUCCEEDED';
481
+ case 'FAILED':
482
+ return 'JOB_STATE_FAILED';
483
+ default:
484
+ return status;
485
+ }
486
+ }
473
487
  function tBytes(apiClient, fromImageBytes) {
474
488
  if (typeof fromImageBytes !== 'string') {
475
489
  throw new Error('fromImageBytes must be a string');
@@ -542,14 +556,13 @@ function contentToMldev$2(apiClient, fromObject) {
542
556
  const toObject = {};
543
557
  const fromParts = getValueByPath(fromObject, ['parts']);
544
558
  if (fromParts != null) {
545
- if (Array.isArray(fromParts)) {
546
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
559
+ let transformedList = fromParts;
560
+ if (Array.isArray(transformedList)) {
561
+ transformedList = transformedList.map((item) => {
547
562
  return partToMldev$2(apiClient, item);
548
- }));
549
- }
550
- else {
551
- setValueByPath(toObject, ['parts'], fromParts);
563
+ });
552
564
  }
565
+ setValueByPath(toObject, ['parts'], transformedList);
553
566
  }
554
567
  const fromRole = getValueByPath(fromObject, ['role']);
555
568
  if (fromRole != null) {
@@ -557,25 +570,6 @@ function contentToMldev$2(apiClient, fromObject) {
557
570
  }
558
571
  return toObject;
559
572
  }
560
- function functionDeclarationToMldev$2(apiClient, fromObject) {
561
- const toObject = {};
562
- if (getValueByPath(fromObject, ['response']) !== undefined) {
563
- throw new Error('response parameter is not supported in Gemini API.');
564
- }
565
- const fromDescription = getValueByPath(fromObject, ['description']);
566
- if (fromDescription != null) {
567
- setValueByPath(toObject, ['description'], fromDescription);
568
- }
569
- const fromName = getValueByPath(fromObject, ['name']);
570
- if (fromName != null) {
571
- setValueByPath(toObject, ['name'], fromName);
572
- }
573
- const fromParameters = getValueByPath(fromObject, ['parameters']);
574
- if (fromParameters != null) {
575
- setValueByPath(toObject, ['parameters'], fromParameters);
576
- }
577
- return toObject;
578
- }
579
573
  function googleSearchToMldev$2() {
580
574
  const toObject = {};
581
575
  return toObject;
@@ -606,19 +600,6 @@ function googleSearchRetrievalToMldev$2(apiClient, fromObject) {
606
600
  }
607
601
  function toolToMldev$2(apiClient, fromObject) {
608
602
  const toObject = {};
609
- const fromFunctionDeclarations = getValueByPath(fromObject, [
610
- 'functionDeclarations',
611
- ]);
612
- if (fromFunctionDeclarations != null) {
613
- if (Array.isArray(fromFunctionDeclarations)) {
614
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
615
- return functionDeclarationToMldev$2(apiClient, item);
616
- }));
617
- }
618
- else {
619
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
620
- }
621
- }
622
603
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
623
604
  throw new Error('retrieval parameter is not supported in Gemini API.');
624
605
  }
@@ -638,6 +619,12 @@ function toolToMldev$2(apiClient, fromObject) {
638
619
  if (fromCodeExecution != null) {
639
620
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
640
621
  }
622
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
623
+ 'functionDeclarations',
624
+ ]);
625
+ if (fromFunctionDeclarations != null) {
626
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
627
+ }
641
628
  return toObject;
642
629
  }
643
630
  function functionCallingConfigToMldev$1(apiClient, fromObject) {
@@ -680,14 +667,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
680
667
  }
681
668
  const fromContents = getValueByPath(fromObject, ['contents']);
682
669
  if (parentObject !== undefined && fromContents != null) {
683
- if (Array.isArray(fromContents)) {
684
- setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
670
+ let transformedList = tContents(apiClient, fromContents);
671
+ if (Array.isArray(transformedList)) {
672
+ transformedList = transformedList.map((item) => {
685
673
  return contentToMldev$2(apiClient, item);
686
- })));
687
- }
688
- else {
689
- setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
674
+ });
690
675
  }
676
+ setValueByPath(parentObject, ['contents'], transformedList);
691
677
  }
692
678
  const fromSystemInstruction = getValueByPath(fromObject, [
693
679
  'systemInstruction',
@@ -697,14 +683,13 @@ function createCachedContentConfigToMldev(apiClient, fromObject, parentObject) {
697
683
  }
698
684
  const fromTools = getValueByPath(fromObject, ['tools']);
699
685
  if (parentObject !== undefined && fromTools != null) {
700
- if (Array.isArray(fromTools)) {
701
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
686
+ let transformedList = fromTools;
687
+ if (Array.isArray(transformedList)) {
688
+ transformedList = transformedList.map((item) => {
702
689
  return toolToMldev$2(apiClient, item);
703
- }));
704
- }
705
- else {
706
- setValueByPath(parentObject, ['tools'], fromTools);
690
+ });
707
691
  }
692
+ setValueByPath(parentObject, ['tools'], transformedList);
708
693
  }
709
694
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
710
695
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -844,14 +829,13 @@ function contentToVertex$2(apiClient, fromObject) {
844
829
  const toObject = {};
845
830
  const fromParts = getValueByPath(fromObject, ['parts']);
846
831
  if (fromParts != null) {
847
- if (Array.isArray(fromParts)) {
848
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
832
+ let transformedList = fromParts;
833
+ if (Array.isArray(transformedList)) {
834
+ transformedList = transformedList.map((item) => {
849
835
  return partToVertex$2(apiClient, item);
850
- }));
851
- }
852
- else {
853
- setValueByPath(toObject, ['parts'], fromParts);
836
+ });
854
837
  }
838
+ setValueByPath(toObject, ['parts'], transformedList);
855
839
  }
856
840
  const fromRole = getValueByPath(fromObject, ['role']);
857
841
  if (fromRole != null) {
@@ -859,124 +843,6 @@ function contentToVertex$2(apiClient, fromObject) {
859
843
  }
860
844
  return toObject;
861
845
  }
862
- function schemaToVertex$2(apiClient, fromObject) {
863
- const toObject = {};
864
- const fromExample = getValueByPath(fromObject, ['example']);
865
- if (fromExample != null) {
866
- setValueByPath(toObject, ['example'], fromExample);
867
- }
868
- const fromPattern = getValueByPath(fromObject, ['pattern']);
869
- if (fromPattern != null) {
870
- setValueByPath(toObject, ['pattern'], fromPattern);
871
- }
872
- const fromDefault = getValueByPath(fromObject, ['default']);
873
- if (fromDefault != null) {
874
- setValueByPath(toObject, ['default'], fromDefault);
875
- }
876
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
877
- if (fromMaxLength != null) {
878
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
879
- }
880
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
881
- if (fromMinLength != null) {
882
- setValueByPath(toObject, ['minLength'], fromMinLength);
883
- }
884
- const fromMinProperties = getValueByPath(fromObject, [
885
- 'minProperties',
886
- ]);
887
- if (fromMinProperties != null) {
888
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
889
- }
890
- const fromMaxProperties = getValueByPath(fromObject, [
891
- 'maxProperties',
892
- ]);
893
- if (fromMaxProperties != null) {
894
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
895
- }
896
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
897
- if (fromAnyOf != null) {
898
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
899
- }
900
- const fromDescription = getValueByPath(fromObject, ['description']);
901
- if (fromDescription != null) {
902
- setValueByPath(toObject, ['description'], fromDescription);
903
- }
904
- const fromEnum = getValueByPath(fromObject, ['enum']);
905
- if (fromEnum != null) {
906
- setValueByPath(toObject, ['enum'], fromEnum);
907
- }
908
- const fromFormat = getValueByPath(fromObject, ['format']);
909
- if (fromFormat != null) {
910
- setValueByPath(toObject, ['format'], fromFormat);
911
- }
912
- const fromItems = getValueByPath(fromObject, ['items']);
913
- if (fromItems != null) {
914
- setValueByPath(toObject, ['items'], fromItems);
915
- }
916
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
917
- if (fromMaxItems != null) {
918
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
919
- }
920
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
921
- if (fromMaximum != null) {
922
- setValueByPath(toObject, ['maximum'], fromMaximum);
923
- }
924
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
925
- if (fromMinItems != null) {
926
- setValueByPath(toObject, ['minItems'], fromMinItems);
927
- }
928
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
929
- if (fromMinimum != null) {
930
- setValueByPath(toObject, ['minimum'], fromMinimum);
931
- }
932
- const fromNullable = getValueByPath(fromObject, ['nullable']);
933
- if (fromNullable != null) {
934
- setValueByPath(toObject, ['nullable'], fromNullable);
935
- }
936
- const fromProperties = getValueByPath(fromObject, ['properties']);
937
- if (fromProperties != null) {
938
- setValueByPath(toObject, ['properties'], fromProperties);
939
- }
940
- const fromPropertyOrdering = getValueByPath(fromObject, [
941
- 'propertyOrdering',
942
- ]);
943
- if (fromPropertyOrdering != null) {
944
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
945
- }
946
- const fromRequired = getValueByPath(fromObject, ['required']);
947
- if (fromRequired != null) {
948
- setValueByPath(toObject, ['required'], fromRequired);
949
- }
950
- const fromTitle = getValueByPath(fromObject, ['title']);
951
- if (fromTitle != null) {
952
- setValueByPath(toObject, ['title'], fromTitle);
953
- }
954
- const fromType = getValueByPath(fromObject, ['type']);
955
- if (fromType != null) {
956
- setValueByPath(toObject, ['type'], fromType);
957
- }
958
- return toObject;
959
- }
960
- function functionDeclarationToVertex$2(apiClient, fromObject) {
961
- const toObject = {};
962
- const fromResponse = getValueByPath(fromObject, ['response']);
963
- if (fromResponse != null) {
964
- setValueByPath(toObject, ['response'], schemaToVertex$2(apiClient, fromResponse));
965
- }
966
- const fromDescription = getValueByPath(fromObject, ['description']);
967
- if (fromDescription != null) {
968
- setValueByPath(toObject, ['description'], fromDescription);
969
- }
970
- const fromName = getValueByPath(fromObject, ['name']);
971
- if (fromName != null) {
972
- setValueByPath(toObject, ['name'], fromName);
973
- }
974
- const fromParameters = getValueByPath(fromObject, ['parameters']);
975
- if (fromParameters != null) {
976
- setValueByPath(toObject, ['parameters'], fromParameters);
977
- }
978
- return toObject;
979
- }
980
846
  function googleSearchToVertex$2() {
981
847
  const toObject = {};
982
848
  return toObject;
@@ -1007,19 +873,6 @@ function googleSearchRetrievalToVertex$2(apiClient, fromObject) {
1007
873
  }
1008
874
  function toolToVertex$2(apiClient, fromObject) {
1009
875
  const toObject = {};
1010
- const fromFunctionDeclarations = getValueByPath(fromObject, [
1011
- 'functionDeclarations',
1012
- ]);
1013
- if (fromFunctionDeclarations != null) {
1014
- if (Array.isArray(fromFunctionDeclarations)) {
1015
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
1016
- return functionDeclarationToVertex$2(apiClient, item);
1017
- }));
1018
- }
1019
- else {
1020
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
1021
- }
1022
- }
1023
876
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
1024
877
  if (fromRetrieval != null) {
1025
878
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
@@ -1040,6 +893,12 @@ function toolToVertex$2(apiClient, fromObject) {
1040
893
  if (fromCodeExecution != null) {
1041
894
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
1042
895
  }
896
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
897
+ 'functionDeclarations',
898
+ ]);
899
+ if (fromFunctionDeclarations != null) {
900
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
901
+ }
1043
902
  return toObject;
1044
903
  }
1045
904
  function functionCallingConfigToVertex$1(apiClient, fromObject) {
@@ -1082,14 +941,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1082
941
  }
1083
942
  const fromContents = getValueByPath(fromObject, ['contents']);
1084
943
  if (parentObject !== undefined && fromContents != null) {
1085
- if (Array.isArray(fromContents)) {
1086
- setValueByPath(parentObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
944
+ let transformedList = tContents(apiClient, fromContents);
945
+ if (Array.isArray(transformedList)) {
946
+ transformedList = transformedList.map((item) => {
1087
947
  return contentToVertex$2(apiClient, item);
1088
- })));
1089
- }
1090
- else {
1091
- setValueByPath(parentObject, ['contents'], tContents(apiClient, fromContents));
948
+ });
1092
949
  }
950
+ setValueByPath(parentObject, ['contents'], transformedList);
1093
951
  }
1094
952
  const fromSystemInstruction = getValueByPath(fromObject, [
1095
953
  'systemInstruction',
@@ -1099,14 +957,13 @@ function createCachedContentConfigToVertex(apiClient, fromObject, parentObject)
1099
957
  }
1100
958
  const fromTools = getValueByPath(fromObject, ['tools']);
1101
959
  if (parentObject !== undefined && fromTools != null) {
1102
- if (Array.isArray(fromTools)) {
1103
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
960
+ let transformedList = fromTools;
961
+ if (Array.isArray(transformedList)) {
962
+ transformedList = transformedList.map((item) => {
1104
963
  return toolToVertex$2(apiClient, item);
1105
- }));
1106
- }
1107
- else {
1108
- setValueByPath(parentObject, ['tools'], fromTools);
964
+ });
1109
965
  }
966
+ setValueByPath(parentObject, ['tools'], transformedList);
1110
967
  }
1111
968
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
1112
969
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -1244,14 +1101,13 @@ function listCachedContentsResponseFromMldev(apiClient, fromObject) {
1244
1101
  'cachedContents',
1245
1102
  ]);
1246
1103
  if (fromCachedContents != null) {
1247
- if (Array.isArray(fromCachedContents)) {
1248
- setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1104
+ let transformedList = fromCachedContents;
1105
+ if (Array.isArray(transformedList)) {
1106
+ transformedList = transformedList.map((item) => {
1249
1107
  return cachedContentFromMldev(apiClient, item);
1250
- }));
1251
- }
1252
- else {
1253
- setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1108
+ });
1254
1109
  }
1110
+ setValueByPath(toObject, ['cachedContents'], transformedList);
1255
1111
  }
1256
1112
  return toObject;
1257
1113
  }
@@ -1305,14 +1161,13 @@ function listCachedContentsResponseFromVertex(apiClient, fromObject) {
1305
1161
  'cachedContents',
1306
1162
  ]);
1307
1163
  if (fromCachedContents != null) {
1308
- if (Array.isArray(fromCachedContents)) {
1309
- setValueByPath(toObject, ['cachedContents'], fromCachedContents.map((item) => {
1164
+ let transformedList = fromCachedContents;
1165
+ if (Array.isArray(transformedList)) {
1166
+ transformedList = transformedList.map((item) => {
1310
1167
  return cachedContentFromVertex(apiClient, item);
1311
- }));
1312
- }
1313
- else {
1314
- setValueByPath(toObject, ['cachedContents'], fromCachedContents);
1168
+ });
1315
1169
  }
1170
+ setValueByPath(toObject, ['cachedContents'], transformedList);
1316
1171
  }
1317
1172
  return toObject;
1318
1173
  }
@@ -1514,17 +1369,6 @@ exports.Language = void 0;
1514
1369
  Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
1515
1370
  Language["PYTHON"] = "PYTHON";
1516
1371
  })(exports.Language || (exports.Language = {}));
1517
- /** Optional. The type of the data. */
1518
- exports.Type = void 0;
1519
- (function (Type) {
1520
- Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
1521
- Type["STRING"] = "STRING";
1522
- Type["NUMBER"] = "NUMBER";
1523
- Type["INTEGER"] = "INTEGER";
1524
- Type["BOOLEAN"] = "BOOLEAN";
1525
- Type["ARRAY"] = "ARRAY";
1526
- Type["OBJECT"] = "OBJECT";
1527
- })(exports.Type || (exports.Type = {}));
1528
1372
  /** Required. Harm category. */
1529
1373
  exports.HarmCategory = void 0;
1530
1374
  (function (HarmCategory) {
@@ -1558,6 +1402,17 @@ exports.Mode = void 0;
1558
1402
  Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1559
1403
  Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1560
1404
  })(exports.Mode || (exports.Mode = {}));
1405
+ /** Optional. The type of the data. */
1406
+ exports.Type = void 0;
1407
+ (function (Type) {
1408
+ Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
1409
+ Type["STRING"] = "STRING";
1410
+ Type["NUMBER"] = "NUMBER";
1411
+ Type["INTEGER"] = "INTEGER";
1412
+ Type["BOOLEAN"] = "BOOLEAN";
1413
+ Type["ARRAY"] = "ARRAY";
1414
+ Type["OBJECT"] = "OBJECT";
1415
+ })(exports.Type || (exports.Type = {}));
1561
1416
  /** Output only. The reason why the model stopped generating tokens.
1562
1417
 
1563
1418
  If empty, the model has not stopped generating the tokens.
@@ -1627,6 +1482,33 @@ exports.MediaResolution = void 0;
1627
1482
  MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1628
1483
  MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1629
1484
  })(exports.MediaResolution || (exports.MediaResolution = {}));
1485
+ /** Output only. The detailed state of the job. */
1486
+ exports.JobState = void 0;
1487
+ (function (JobState) {
1488
+ JobState["JOB_STATE_UNSPECIFIED"] = "JOB_STATE_UNSPECIFIED";
1489
+ JobState["JOB_STATE_QUEUED"] = "JOB_STATE_QUEUED";
1490
+ JobState["JOB_STATE_PENDING"] = "JOB_STATE_PENDING";
1491
+ JobState["JOB_STATE_RUNNING"] = "JOB_STATE_RUNNING";
1492
+ JobState["JOB_STATE_SUCCEEDED"] = "JOB_STATE_SUCCEEDED";
1493
+ JobState["JOB_STATE_FAILED"] = "JOB_STATE_FAILED";
1494
+ JobState["JOB_STATE_CANCELLING"] = "JOB_STATE_CANCELLING";
1495
+ JobState["JOB_STATE_CANCELLED"] = "JOB_STATE_CANCELLED";
1496
+ JobState["JOB_STATE_PAUSED"] = "JOB_STATE_PAUSED";
1497
+ JobState["JOB_STATE_EXPIRED"] = "JOB_STATE_EXPIRED";
1498
+ JobState["JOB_STATE_UPDATING"] = "JOB_STATE_UPDATING";
1499
+ JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
1500
+ })(exports.JobState || (exports.JobState = {}));
1501
+ /** Optional. Adapter size for tuning. */
1502
+ exports.AdapterSize = void 0;
1503
+ (function (AdapterSize) {
1504
+ AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1505
+ AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1506
+ AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1507
+ AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1508
+ AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1509
+ AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1510
+ AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1511
+ })(exports.AdapterSize || (exports.AdapterSize = {}));
1630
1512
  /** Options for feature selection preference. */
1631
1513
  exports.FeatureSelectionPreference = void 0;
1632
1514
  (function (FeatureSelectionPreference) {
@@ -2127,6 +2009,8 @@ class EmbedContentResponse {
2127
2009
  /** The output images response. */
2128
2010
  class GenerateImagesResponse {
2129
2011
  }
2012
+ class DeleteModelResponse {
2013
+ }
2130
2014
  /** Response for counting tokens. */
2131
2015
  class CountTokensResponse {
2132
2016
  }
@@ -2136,6 +2020,9 @@ class ComputeTokensResponse {
2136
2020
  /** Response with generated videos. */
2137
2021
  class GenerateVideosResponse {
2138
2022
  }
2023
+ /** Response for the list tuning jobs method. */
2024
+ class ListTuningJobsResponse {
2025
+ }
2139
2026
  /** Empty response for caches.delete method. */
2140
2027
  class DeleteCachedContentResponse {
2141
2028
  }
@@ -2232,7 +2119,7 @@ class Caches extends BaseModule {
2232
2119
  * ```ts
2233
2120
  * const contents = ...; // Initialize the content to cache.
2234
2121
  * const response = await ai.caches.create({
2235
- * model: 'gemini-1.5-flash',
2122
+ * model: 'gemini-2.0-flash-001',
2236
2123
  * config: {
2237
2124
  * 'contents': contents,
2238
2125
  * 'displayName': 'test cache',
@@ -2304,7 +2191,7 @@ class Caches extends BaseModule {
2304
2191
  *
2305
2192
  * @example
2306
2193
  * ```ts
2307
- * await ai.caches.get({name: 'gemini-1.5-flash'});
2194
+ * await ai.caches.get({name: '...'}); // The server-generated resource name.
2308
2195
  * ```
2309
2196
  */
2310
2197
  async get(params) {
@@ -2369,7 +2256,7 @@ class Caches extends BaseModule {
2369
2256
  *
2370
2257
  * @example
2371
2258
  * ```ts
2372
- * await ai.caches.delete({name: 'gemini-1.5-flash'});
2259
+ * await ai.caches.delete({name: '...'}); // The server-generated resource name.
2373
2260
  * ```
2374
2261
  */
2375
2262
  async delete(params) {
@@ -2439,7 +2326,7 @@ class Caches extends BaseModule {
2439
2326
  * @example
2440
2327
  * ```ts
2441
2328
  * const response = await ai.caches.update({
2442
- * name: 'gemini-1.5-flash',
2329
+ * name: '...', // The server-generated resource name.
2443
2330
  * config: {'ttl': '7600s'}
2444
2331
  * });
2445
2332
  * ```
@@ -2837,7 +2724,12 @@ class Chat {
2837
2724
  contents: this.getHistory(true).concat(inputContent),
2838
2725
  config: (_a = params.config) !== null && _a !== void 0 ? _a : this.config,
2839
2726
  });
2840
- this.sendPromise = streamResponse.then(() => undefined);
2727
+ // Resolve the internal tracking of send completion promise - `sendPromise`
2728
+ // for both success and failure response. The actual failure is still
2729
+ // propagated by the `await streamResponse`.
2730
+ this.sendPromise = streamResponse
2731
+ .then(() => undefined)
2732
+ .catch(() => undefined);
2841
2733
  const response = await streamResponse;
2842
2734
  const result = this.processStreamResponse(response, inputContent);
2843
2735
  return result;
@@ -2925,7 +2817,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
2925
2817
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
2926
2818
  const USER_AGENT_HEADER = 'User-Agent';
2927
2819
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
2928
- const SDK_VERSION = '0.10.0'; // x-release-please-version
2820
+ const SDK_VERSION = '0.12.0'; // x-release-please-version
2929
2821
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
2930
2822
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
2931
2823
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -3730,14 +3622,13 @@ function listFilesResponseFromMldev(apiClient, fromObject) {
3730
3622
  }
3731
3623
  const fromFiles = getValueByPath(fromObject, ['files']);
3732
3624
  if (fromFiles != null) {
3733
- if (Array.isArray(fromFiles)) {
3734
- setValueByPath(toObject, ['files'], fromFiles.map((item) => {
3625
+ let transformedList = fromFiles;
3626
+ if (Array.isArray(transformedList)) {
3627
+ transformedList = transformedList.map((item) => {
3735
3628
  return fileFromMldev(apiClient, item);
3736
- }));
3737
- }
3738
- else {
3739
- setValueByPath(toObject, ['files'], fromFiles);
3629
+ });
3740
3630
  }
3631
+ setValueByPath(toObject, ['files'], transformedList);
3741
3632
  }
3742
3633
  return toObject;
3743
3634
  }
@@ -4104,14 +3995,13 @@ function contentToMldev$1(apiClient, fromObject) {
4104
3995
  const toObject = {};
4105
3996
  const fromParts = getValueByPath(fromObject, ['parts']);
4106
3997
  if (fromParts != null) {
4107
- if (Array.isArray(fromParts)) {
4108
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
3998
+ let transformedList = fromParts;
3999
+ if (Array.isArray(transformedList)) {
4000
+ transformedList = transformedList.map((item) => {
4109
4001
  return partToMldev$1(apiClient, item);
4110
- }));
4111
- }
4112
- else {
4113
- setValueByPath(toObject, ['parts'], fromParts);
4002
+ });
4114
4003
  }
4004
+ setValueByPath(toObject, ['parts'], transformedList);
4115
4005
  }
4116
4006
  const fromRole = getValueByPath(fromObject, ['role']);
4117
4007
  if (fromRole != null) {
@@ -4123,14 +4013,13 @@ function contentToVertex$1(apiClient, fromObject) {
4123
4013
  const toObject = {};
4124
4014
  const fromParts = getValueByPath(fromObject, ['parts']);
4125
4015
  if (fromParts != null) {
4126
- if (Array.isArray(fromParts)) {
4127
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4016
+ let transformedList = fromParts;
4017
+ if (Array.isArray(transformedList)) {
4018
+ transformedList = transformedList.map((item) => {
4128
4019
  return partToVertex$1(apiClient, item);
4129
- }));
4130
- }
4131
- else {
4132
- setValueByPath(toObject, ['parts'], fromParts);
4020
+ });
4133
4021
  }
4022
+ setValueByPath(toObject, ['parts'], transformedList);
4134
4023
  }
4135
4024
  const fromRole = getValueByPath(fromObject, ['role']);
4136
4025
  if (fromRole != null) {
@@ -4138,143 +4027,6 @@ function contentToVertex$1(apiClient, fromObject) {
4138
4027
  }
4139
4028
  return toObject;
4140
4029
  }
4141
- function schemaToVertex$1(apiClient, fromObject) {
4142
- const toObject = {};
4143
- const fromExample = getValueByPath(fromObject, ['example']);
4144
- if (fromExample != null) {
4145
- setValueByPath(toObject, ['example'], fromExample);
4146
- }
4147
- const fromPattern = getValueByPath(fromObject, ['pattern']);
4148
- if (fromPattern != null) {
4149
- setValueByPath(toObject, ['pattern'], fromPattern);
4150
- }
4151
- const fromDefault = getValueByPath(fromObject, ['default']);
4152
- if (fromDefault != null) {
4153
- setValueByPath(toObject, ['default'], fromDefault);
4154
- }
4155
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
4156
- if (fromMaxLength != null) {
4157
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
4158
- }
4159
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
4160
- if (fromMinLength != null) {
4161
- setValueByPath(toObject, ['minLength'], fromMinLength);
4162
- }
4163
- const fromMinProperties = getValueByPath(fromObject, [
4164
- 'minProperties',
4165
- ]);
4166
- if (fromMinProperties != null) {
4167
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
4168
- }
4169
- const fromMaxProperties = getValueByPath(fromObject, [
4170
- 'maxProperties',
4171
- ]);
4172
- if (fromMaxProperties != null) {
4173
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
4174
- }
4175
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
4176
- if (fromAnyOf != null) {
4177
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
4178
- }
4179
- const fromDescription = getValueByPath(fromObject, ['description']);
4180
- if (fromDescription != null) {
4181
- setValueByPath(toObject, ['description'], fromDescription);
4182
- }
4183
- const fromEnum = getValueByPath(fromObject, ['enum']);
4184
- if (fromEnum != null) {
4185
- setValueByPath(toObject, ['enum'], fromEnum);
4186
- }
4187
- const fromFormat = getValueByPath(fromObject, ['format']);
4188
- if (fromFormat != null) {
4189
- setValueByPath(toObject, ['format'], fromFormat);
4190
- }
4191
- const fromItems = getValueByPath(fromObject, ['items']);
4192
- if (fromItems != null) {
4193
- setValueByPath(toObject, ['items'], fromItems);
4194
- }
4195
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
4196
- if (fromMaxItems != null) {
4197
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
4198
- }
4199
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
4200
- if (fromMaximum != null) {
4201
- setValueByPath(toObject, ['maximum'], fromMaximum);
4202
- }
4203
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
4204
- if (fromMinItems != null) {
4205
- setValueByPath(toObject, ['minItems'], fromMinItems);
4206
- }
4207
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
4208
- if (fromMinimum != null) {
4209
- setValueByPath(toObject, ['minimum'], fromMinimum);
4210
- }
4211
- const fromNullable = getValueByPath(fromObject, ['nullable']);
4212
- if (fromNullable != null) {
4213
- setValueByPath(toObject, ['nullable'], fromNullable);
4214
- }
4215
- const fromProperties = getValueByPath(fromObject, ['properties']);
4216
- if (fromProperties != null) {
4217
- setValueByPath(toObject, ['properties'], fromProperties);
4218
- }
4219
- const fromPropertyOrdering = getValueByPath(fromObject, [
4220
- 'propertyOrdering',
4221
- ]);
4222
- if (fromPropertyOrdering != null) {
4223
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
4224
- }
4225
- const fromRequired = getValueByPath(fromObject, ['required']);
4226
- if (fromRequired != null) {
4227
- setValueByPath(toObject, ['required'], fromRequired);
4228
- }
4229
- const fromTitle = getValueByPath(fromObject, ['title']);
4230
- if (fromTitle != null) {
4231
- setValueByPath(toObject, ['title'], fromTitle);
4232
- }
4233
- const fromType = getValueByPath(fromObject, ['type']);
4234
- if (fromType != null) {
4235
- setValueByPath(toObject, ['type'], fromType);
4236
- }
4237
- return toObject;
4238
- }
4239
- function functionDeclarationToMldev$1(apiClient, fromObject) {
4240
- const toObject = {};
4241
- if (getValueByPath(fromObject, ['response']) !== undefined) {
4242
- throw new Error('response parameter is not supported in Gemini API.');
4243
- }
4244
- const fromDescription = getValueByPath(fromObject, ['description']);
4245
- if (fromDescription != null) {
4246
- setValueByPath(toObject, ['description'], fromDescription);
4247
- }
4248
- const fromName = getValueByPath(fromObject, ['name']);
4249
- if (fromName != null) {
4250
- setValueByPath(toObject, ['name'], fromName);
4251
- }
4252
- const fromParameters = getValueByPath(fromObject, ['parameters']);
4253
- if (fromParameters != null) {
4254
- setValueByPath(toObject, ['parameters'], fromParameters);
4255
- }
4256
- return toObject;
4257
- }
4258
- function functionDeclarationToVertex$1(apiClient, fromObject) {
4259
- const toObject = {};
4260
- const fromResponse = getValueByPath(fromObject, ['response']);
4261
- if (fromResponse != null) {
4262
- setValueByPath(toObject, ['response'], schemaToVertex$1(apiClient, fromResponse));
4263
- }
4264
- const fromDescription = getValueByPath(fromObject, ['description']);
4265
- if (fromDescription != null) {
4266
- setValueByPath(toObject, ['description'], fromDescription);
4267
- }
4268
- const fromName = getValueByPath(fromObject, ['name']);
4269
- if (fromName != null) {
4270
- setValueByPath(toObject, ['name'], fromName);
4271
- }
4272
- const fromParameters = getValueByPath(fromObject, ['parameters']);
4273
- if (fromParameters != null) {
4274
- setValueByPath(toObject, ['parameters'], fromParameters);
4275
- }
4276
- return toObject;
4277
- }
4278
4030
  function googleSearchToMldev$1() {
4279
4031
  const toObject = {};
4280
4032
  return toObject;
@@ -4333,19 +4085,6 @@ function googleSearchRetrievalToVertex$1(apiClient, fromObject) {
4333
4085
  }
4334
4086
  function toolToMldev$1(apiClient, fromObject) {
4335
4087
  const toObject = {};
4336
- const fromFunctionDeclarations = getValueByPath(fromObject, [
4337
- 'functionDeclarations',
4338
- ]);
4339
- if (fromFunctionDeclarations != null) {
4340
- if (Array.isArray(fromFunctionDeclarations)) {
4341
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4342
- return functionDeclarationToMldev$1(apiClient, item);
4343
- }));
4344
- }
4345
- else {
4346
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4347
- }
4348
- }
4349
4088
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4350
4089
  throw new Error('retrieval parameter is not supported in Gemini API.');
4351
4090
  }
@@ -4365,23 +4104,16 @@ function toolToMldev$1(apiClient, fromObject) {
4365
4104
  if (fromCodeExecution != null) {
4366
4105
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4367
4106
  }
4368
- return toObject;
4369
- }
4370
- function toolToVertex$1(apiClient, fromObject) {
4371
- const toObject = {};
4372
4107
  const fromFunctionDeclarations = getValueByPath(fromObject, [
4373
4108
  'functionDeclarations',
4374
4109
  ]);
4375
4110
  if (fromFunctionDeclarations != null) {
4376
- if (Array.isArray(fromFunctionDeclarations)) {
4377
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
4378
- return functionDeclarationToVertex$1(apiClient, item);
4379
- }));
4380
- }
4381
- else {
4382
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4383
- }
4111
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4384
4112
  }
4113
+ return toObject;
4114
+ }
4115
+ function toolToVertex$1(apiClient, fromObject) {
4116
+ const toObject = {};
4385
4117
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
4386
4118
  if (fromRetrieval != null) {
4387
4119
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
@@ -4402,6 +4134,12 @@ function toolToVertex$1(apiClient, fromObject) {
4402
4134
  if (fromCodeExecution != null) {
4403
4135
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4404
4136
  }
4137
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
4138
+ 'functionDeclarations',
4139
+ ]);
4140
+ if (fromFunctionDeclarations != null) {
4141
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
4142
+ }
4405
4143
  return toObject;
4406
4144
  }
4407
4145
  function sessionResumptionConfigToMldev(apiClient, fromObject) {
@@ -4641,14 +4379,13 @@ function liveConnectConfigToMldev(apiClient, fromObject, parentObject) {
4641
4379
  }
4642
4380
  const fromTools = getValueByPath(fromObject, ['tools']);
4643
4381
  if (parentObject !== undefined && fromTools != null) {
4644
- if (Array.isArray(fromTools)) {
4645
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4382
+ let transformedList = tTools(apiClient, fromTools);
4383
+ if (Array.isArray(transformedList)) {
4384
+ transformedList = transformedList.map((item) => {
4646
4385
  return toolToMldev$1(apiClient, tTool(apiClient, item));
4647
- })));
4648
- }
4649
- else {
4650
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
4386
+ });
4651
4387
  }
4388
+ setValueByPath(parentObject, ['setup', 'tools'], transformedList);
4652
4389
  }
4653
4390
  const fromSessionResumption = getValueByPath(fromObject, [
4654
4391
  'sessionResumption',
@@ -4733,14 +4470,13 @@ function liveConnectConfigToVertex(apiClient, fromObject, parentObject) {
4733
4470
  }
4734
4471
  const fromTools = getValueByPath(fromObject, ['tools']);
4735
4472
  if (parentObject !== undefined && fromTools != null) {
4736
- if (Array.isArray(fromTools)) {
4737
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
4473
+ let transformedList = tTools(apiClient, fromTools);
4474
+ if (Array.isArray(transformedList)) {
4475
+ transformedList = transformedList.map((item) => {
4738
4476
  return toolToVertex$1(apiClient, tTool(apiClient, item));
4739
- })));
4740
- }
4741
- else {
4742
- setValueByPath(parentObject, ['setup', 'tools'], tTools(apiClient, fromTools));
4477
+ });
4743
4478
  }
4479
+ setValueByPath(parentObject, ['setup', 'tools'], transformedList);
4744
4480
  }
4745
4481
  const fromSessionResumption = getValueByPath(fromObject, [
4746
4482
  'sessionResumption',
@@ -4985,14 +4721,13 @@ function contentFromMldev$1(apiClient, fromObject) {
4985
4721
  const toObject = {};
4986
4722
  const fromParts = getValueByPath(fromObject, ['parts']);
4987
4723
  if (fromParts != null) {
4988
- if (Array.isArray(fromParts)) {
4989
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4724
+ let transformedList = fromParts;
4725
+ if (Array.isArray(transformedList)) {
4726
+ transformedList = transformedList.map((item) => {
4990
4727
  return partFromMldev$1(apiClient, item);
4991
- }));
4992
- }
4993
- else {
4994
- setValueByPath(toObject, ['parts'], fromParts);
4728
+ });
4995
4729
  }
4730
+ setValueByPath(toObject, ['parts'], transformedList);
4996
4731
  }
4997
4732
  const fromRole = getValueByPath(fromObject, ['role']);
4998
4733
  if (fromRole != null) {
@@ -5004,14 +4739,13 @@ function contentFromVertex$1(apiClient, fromObject) {
5004
4739
  const toObject = {};
5005
4740
  const fromParts = getValueByPath(fromObject, ['parts']);
5006
4741
  if (fromParts != null) {
5007
- if (Array.isArray(fromParts)) {
5008
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
4742
+ let transformedList = fromParts;
4743
+ if (Array.isArray(transformedList)) {
4744
+ transformedList = transformedList.map((item) => {
5009
4745
  return partFromVertex$1(apiClient, item);
5010
- }));
5011
- }
5012
- else {
5013
- setValueByPath(toObject, ['parts'], fromParts);
4746
+ });
5014
4747
  }
4748
+ setValueByPath(toObject, ['parts'], transformedList);
5015
4749
  }
5016
4750
  const fromRole = getValueByPath(fromObject, ['role']);
5017
4751
  if (fromRole != null) {
@@ -5057,6 +4791,12 @@ function liveServerContentFromMldev(apiClient, fromObject) {
5057
4791
  if (fromInterrupted != null) {
5058
4792
  setValueByPath(toObject, ['interrupted'], fromInterrupted);
5059
4793
  }
4794
+ const fromGroundingMetadata = getValueByPath(fromObject, [
4795
+ 'groundingMetadata',
4796
+ ]);
4797
+ if (fromGroundingMetadata != null) {
4798
+ setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
4799
+ }
5060
4800
  const fromGenerationComplete = getValueByPath(fromObject, [
5061
4801
  'generationComplete',
5062
4802
  ]);
@@ -5091,6 +4831,12 @@ function liveServerContentFromVertex(apiClient, fromObject) {
5091
4831
  if (fromInterrupted != null) {
5092
4832
  setValueByPath(toObject, ['interrupted'], fromInterrupted);
5093
4833
  }
4834
+ const fromGroundingMetadata = getValueByPath(fromObject, [
4835
+ 'groundingMetadata',
4836
+ ]);
4837
+ if (fromGroundingMetadata != null) {
4838
+ setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
4839
+ }
5094
4840
  const fromGenerationComplete = getValueByPath(fromObject, [
5095
4841
  'generationComplete',
5096
4842
  ]);
@@ -5145,14 +4891,13 @@ function liveServerToolCallFromMldev(apiClient, fromObject) {
5145
4891
  'functionCalls',
5146
4892
  ]);
5147
4893
  if (fromFunctionCalls != null) {
5148
- if (Array.isArray(fromFunctionCalls)) {
5149
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4894
+ let transformedList = fromFunctionCalls;
4895
+ if (Array.isArray(transformedList)) {
4896
+ transformedList = transformedList.map((item) => {
5150
4897
  return functionCallFromMldev(apiClient, item);
5151
- }));
5152
- }
5153
- else {
5154
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4898
+ });
5155
4899
  }
4900
+ setValueByPath(toObject, ['functionCalls'], transformedList);
5156
4901
  }
5157
4902
  return toObject;
5158
4903
  }
@@ -5162,14 +4907,13 @@ function liveServerToolCallFromVertex(apiClient, fromObject) {
5162
4907
  'functionCalls',
5163
4908
  ]);
5164
4909
  if (fromFunctionCalls != null) {
5165
- if (Array.isArray(fromFunctionCalls)) {
5166
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls.map((item) => {
4910
+ let transformedList = fromFunctionCalls;
4911
+ if (Array.isArray(transformedList)) {
4912
+ transformedList = transformedList.map((item) => {
5167
4913
  return functionCallFromVertex(apiClient, item);
5168
- }));
5169
- }
5170
- else {
5171
- setValueByPath(toObject, ['functionCalls'], fromFunctionCalls);
4914
+ });
5172
4915
  }
4916
+ setValueByPath(toObject, ['functionCalls'], transformedList);
5173
4917
  }
5174
4918
  return toObject;
5175
4919
  }
@@ -5255,53 +4999,49 @@ function usageMetadataFromMldev(apiClient, fromObject) {
5255
4999
  'promptTokensDetails',
5256
5000
  ]);
5257
5001
  if (fromPromptTokensDetails != null) {
5258
- if (Array.isArray(fromPromptTokensDetails)) {
5259
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
5002
+ let transformedList = fromPromptTokensDetails;
5003
+ if (Array.isArray(transformedList)) {
5004
+ transformedList = transformedList.map((item) => {
5260
5005
  return modalityTokenCountFromMldev(apiClient, item);
5261
- }));
5262
- }
5263
- else {
5264
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
5006
+ });
5265
5007
  }
5008
+ setValueByPath(toObject, ['promptTokensDetails'], transformedList);
5266
5009
  }
5267
5010
  const fromCacheTokensDetails = getValueByPath(fromObject, [
5268
5011
  'cacheTokensDetails',
5269
5012
  ]);
5270
5013
  if (fromCacheTokensDetails != null) {
5271
- if (Array.isArray(fromCacheTokensDetails)) {
5272
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
5014
+ let transformedList = fromCacheTokensDetails;
5015
+ if (Array.isArray(transformedList)) {
5016
+ transformedList = transformedList.map((item) => {
5273
5017
  return modalityTokenCountFromMldev(apiClient, item);
5274
- }));
5275
- }
5276
- else {
5277
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
5018
+ });
5278
5019
  }
5020
+ setValueByPath(toObject, ['cacheTokensDetails'], transformedList);
5279
5021
  }
5280
5022
  const fromResponseTokensDetails = getValueByPath(fromObject, [
5281
5023
  'responseTokensDetails',
5282
5024
  ]);
5283
5025
  if (fromResponseTokensDetails != null) {
5284
- if (Array.isArray(fromResponseTokensDetails)) {
5285
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
5026
+ let transformedList = fromResponseTokensDetails;
5027
+ if (Array.isArray(transformedList)) {
5028
+ transformedList = transformedList.map((item) => {
5286
5029
  return modalityTokenCountFromMldev(apiClient, item);
5287
- }));
5288
- }
5289
- else {
5290
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
5030
+ });
5291
5031
  }
5032
+ setValueByPath(toObject, ['responseTokensDetails'], transformedList);
5292
5033
  }
5293
5034
  const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
5294
5035
  'toolUsePromptTokensDetails',
5295
5036
  ]);
5296
5037
  if (fromToolUsePromptTokensDetails != null) {
5297
- if (Array.isArray(fromToolUsePromptTokensDetails)) {
5298
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
5038
+ let transformedList = fromToolUsePromptTokensDetails;
5039
+ if (Array.isArray(transformedList)) {
5040
+ transformedList = transformedList.map((item) => {
5299
5041
  return modalityTokenCountFromMldev(apiClient, item);
5300
- }));
5301
- }
5302
- else {
5303
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
5042
+ });
5304
5043
  }
5044
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], transformedList);
5305
5045
  }
5306
5046
  return toObject;
5307
5047
  }
@@ -5347,53 +5087,49 @@ function usageMetadataFromVertex(apiClient, fromObject) {
5347
5087
  'promptTokensDetails',
5348
5088
  ]);
5349
5089
  if (fromPromptTokensDetails != null) {
5350
- if (Array.isArray(fromPromptTokensDetails)) {
5351
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
5090
+ let transformedList = fromPromptTokensDetails;
5091
+ if (Array.isArray(transformedList)) {
5092
+ transformedList = transformedList.map((item) => {
5352
5093
  return modalityTokenCountFromVertex(apiClient, item);
5353
- }));
5354
- }
5355
- else {
5356
- setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
5094
+ });
5357
5095
  }
5096
+ setValueByPath(toObject, ['promptTokensDetails'], transformedList);
5358
5097
  }
5359
5098
  const fromCacheTokensDetails = getValueByPath(fromObject, [
5360
5099
  'cacheTokensDetails',
5361
5100
  ]);
5362
5101
  if (fromCacheTokensDetails != null) {
5363
- if (Array.isArray(fromCacheTokensDetails)) {
5364
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
5102
+ let transformedList = fromCacheTokensDetails;
5103
+ if (Array.isArray(transformedList)) {
5104
+ transformedList = transformedList.map((item) => {
5365
5105
  return modalityTokenCountFromVertex(apiClient, item);
5366
- }));
5367
- }
5368
- else {
5369
- setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
5106
+ });
5370
5107
  }
5108
+ setValueByPath(toObject, ['cacheTokensDetails'], transformedList);
5371
5109
  }
5372
5110
  const fromResponseTokensDetails = getValueByPath(fromObject, [
5373
5111
  'candidatesTokensDetails',
5374
5112
  ]);
5375
5113
  if (fromResponseTokensDetails != null) {
5376
- if (Array.isArray(fromResponseTokensDetails)) {
5377
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
5114
+ let transformedList = fromResponseTokensDetails;
5115
+ if (Array.isArray(transformedList)) {
5116
+ transformedList = transformedList.map((item) => {
5378
5117
  return modalityTokenCountFromVertex(apiClient, item);
5379
- }));
5380
- }
5381
- else {
5382
- setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
5118
+ });
5383
5119
  }
5120
+ setValueByPath(toObject, ['responseTokensDetails'], transformedList);
5384
5121
  }
5385
5122
  const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
5386
5123
  'toolUsePromptTokensDetails',
5387
5124
  ]);
5388
5125
  if (fromToolUsePromptTokensDetails != null) {
5389
- if (Array.isArray(fromToolUsePromptTokensDetails)) {
5390
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
5126
+ let transformedList = fromToolUsePromptTokensDetails;
5127
+ if (Array.isArray(transformedList)) {
5128
+ transformedList = transformedList.map((item) => {
5391
5129
  return modalityTokenCountFromVertex(apiClient, item);
5392
- }));
5393
- }
5394
- else {
5395
- setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
5130
+ });
5396
5131
  }
5132
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], transformedList);
5397
5133
  }
5398
5134
  const fromTrafficType = getValueByPath(fromObject, ['trafficType']);
5399
5135
  if (fromTrafficType != null) {
@@ -5592,14 +5328,13 @@ function contentToMldev(apiClient, fromObject) {
5592
5328
  const toObject = {};
5593
5329
  const fromParts = getValueByPath(fromObject, ['parts']);
5594
5330
  if (fromParts != null) {
5595
- if (Array.isArray(fromParts)) {
5596
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
5331
+ let transformedList = fromParts;
5332
+ if (Array.isArray(transformedList)) {
5333
+ transformedList = transformedList.map((item) => {
5597
5334
  return partToMldev(apiClient, item);
5598
- }));
5599
- }
5600
- else {
5601
- setValueByPath(toObject, ['parts'], fromParts);
5335
+ });
5602
5336
  }
5337
+ setValueByPath(toObject, ['parts'], transformedList);
5603
5338
  }
5604
5339
  const fromRole = getValueByPath(fromObject, ['role']);
5605
5340
  if (fromRole != null) {
@@ -5607,93 +5342,6 @@ function contentToMldev(apiClient, fromObject) {
5607
5342
  }
5608
5343
  return toObject;
5609
5344
  }
5610
- function schemaToMldev(apiClient, fromObject) {
5611
- const toObject = {};
5612
- if (getValueByPath(fromObject, ['example']) !== undefined) {
5613
- throw new Error('example parameter is not supported in Gemini API.');
5614
- }
5615
- if (getValueByPath(fromObject, ['pattern']) !== undefined) {
5616
- throw new Error('pattern parameter is not supported in Gemini API.');
5617
- }
5618
- if (getValueByPath(fromObject, ['default']) !== undefined) {
5619
- throw new Error('default parameter is not supported in Gemini API.');
5620
- }
5621
- if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
5622
- throw new Error('maxLength parameter is not supported in Gemini API.');
5623
- }
5624
- if (getValueByPath(fromObject, ['minLength']) !== undefined) {
5625
- throw new Error('minLength parameter is not supported in Gemini API.');
5626
- }
5627
- if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
5628
- throw new Error('minProperties parameter is not supported in Gemini API.');
5629
- }
5630
- if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
5631
- throw new Error('maxProperties parameter is not supported in Gemini API.');
5632
- }
5633
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
5634
- if (fromAnyOf != null) {
5635
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
5636
- }
5637
- const fromDescription = getValueByPath(fromObject, ['description']);
5638
- if (fromDescription != null) {
5639
- setValueByPath(toObject, ['description'], fromDescription);
5640
- }
5641
- const fromEnum = getValueByPath(fromObject, ['enum']);
5642
- if (fromEnum != null) {
5643
- setValueByPath(toObject, ['enum'], fromEnum);
5644
- }
5645
- const fromFormat = getValueByPath(fromObject, ['format']);
5646
- if (fromFormat != null) {
5647
- setValueByPath(toObject, ['format'], fromFormat);
5648
- }
5649
- const fromItems = getValueByPath(fromObject, ['items']);
5650
- if (fromItems != null) {
5651
- setValueByPath(toObject, ['items'], fromItems);
5652
- }
5653
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
5654
- if (fromMaxItems != null) {
5655
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
5656
- }
5657
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
5658
- if (fromMaximum != null) {
5659
- setValueByPath(toObject, ['maximum'], fromMaximum);
5660
- }
5661
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
5662
- if (fromMinItems != null) {
5663
- setValueByPath(toObject, ['minItems'], fromMinItems);
5664
- }
5665
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
5666
- if (fromMinimum != null) {
5667
- setValueByPath(toObject, ['minimum'], fromMinimum);
5668
- }
5669
- const fromNullable = getValueByPath(fromObject, ['nullable']);
5670
- if (fromNullable != null) {
5671
- setValueByPath(toObject, ['nullable'], fromNullable);
5672
- }
5673
- const fromProperties = getValueByPath(fromObject, ['properties']);
5674
- if (fromProperties != null) {
5675
- setValueByPath(toObject, ['properties'], fromProperties);
5676
- }
5677
- const fromPropertyOrdering = getValueByPath(fromObject, [
5678
- 'propertyOrdering',
5679
- ]);
5680
- if (fromPropertyOrdering != null) {
5681
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
5682
- }
5683
- const fromRequired = getValueByPath(fromObject, ['required']);
5684
- if (fromRequired != null) {
5685
- setValueByPath(toObject, ['required'], fromRequired);
5686
- }
5687
- const fromTitle = getValueByPath(fromObject, ['title']);
5688
- if (fromTitle != null) {
5689
- setValueByPath(toObject, ['title'], fromTitle);
5690
- }
5691
- const fromType = getValueByPath(fromObject, ['type']);
5692
- if (fromType != null) {
5693
- setValueByPath(toObject, ['type'], fromType);
5694
- }
5695
- return toObject;
5696
- }
5697
5345
  function safetySettingToMldev(apiClient, fromObject) {
5698
5346
  const toObject = {};
5699
5347
  if (getValueByPath(fromObject, ['method']) !== undefined) {
@@ -5709,25 +5357,6 @@ function safetySettingToMldev(apiClient, fromObject) {
5709
5357
  }
5710
5358
  return toObject;
5711
5359
  }
5712
- function functionDeclarationToMldev(apiClient, fromObject) {
5713
- const toObject = {};
5714
- if (getValueByPath(fromObject, ['response']) !== undefined) {
5715
- throw new Error('response parameter is not supported in Gemini API.');
5716
- }
5717
- const fromDescription = getValueByPath(fromObject, ['description']);
5718
- if (fromDescription != null) {
5719
- setValueByPath(toObject, ['description'], fromDescription);
5720
- }
5721
- const fromName = getValueByPath(fromObject, ['name']);
5722
- if (fromName != null) {
5723
- setValueByPath(toObject, ['name'], fromName);
5724
- }
5725
- const fromParameters = getValueByPath(fromObject, ['parameters']);
5726
- if (fromParameters != null) {
5727
- setValueByPath(toObject, ['parameters'], fromParameters);
5728
- }
5729
- return toObject;
5730
- }
5731
5360
  function googleSearchToMldev() {
5732
5361
  const toObject = {};
5733
5362
  return toObject;
@@ -5758,19 +5387,6 @@ function googleSearchRetrievalToMldev(apiClient, fromObject) {
5758
5387
  }
5759
5388
  function toolToMldev(apiClient, fromObject) {
5760
5389
  const toObject = {};
5761
- const fromFunctionDeclarations = getValueByPath(fromObject, [
5762
- 'functionDeclarations',
5763
- ]);
5764
- if (fromFunctionDeclarations != null) {
5765
- if (Array.isArray(fromFunctionDeclarations)) {
5766
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
5767
- return functionDeclarationToMldev(apiClient, item);
5768
- }));
5769
- }
5770
- else {
5771
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
5772
- }
5773
- }
5774
5390
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
5775
5391
  throw new Error('retrieval parameter is not supported in Gemini API.');
5776
5392
  }
@@ -5790,6 +5406,12 @@ function toolToMldev(apiClient, fromObject) {
5790
5406
  if (fromCodeExecution != null) {
5791
5407
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5792
5408
  }
5409
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
5410
+ 'functionDeclarations',
5411
+ ]);
5412
+ if (fromFunctionDeclarations != null) {
5413
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
5414
+ }
5793
5415
  return toObject;
5794
5416
  }
5795
5417
  function functionCallingConfigToMldev(apiClient, fromObject) {
@@ -5936,7 +5558,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
5936
5558
  'responseSchema',
5937
5559
  ]);
5938
5560
  if (fromResponseSchema != null) {
5939
- setValueByPath(toObject, ['responseSchema'], schemaToMldev(apiClient, tSchema(apiClient, fromResponseSchema)));
5561
+ setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
5940
5562
  }
5941
5563
  if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
5942
5564
  throw new Error('routingConfig parameter is not supported in Gemini API.');
@@ -5948,25 +5570,23 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
5948
5570
  'safetySettings',
5949
5571
  ]);
5950
5572
  if (parentObject !== undefined && fromSafetySettings != null) {
5951
- if (Array.isArray(fromSafetySettings)) {
5952
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
5573
+ let transformedList = fromSafetySettings;
5574
+ if (Array.isArray(transformedList)) {
5575
+ transformedList = transformedList.map((item) => {
5953
5576
  return safetySettingToMldev(apiClient, item);
5954
- }));
5955
- }
5956
- else {
5957
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
5577
+ });
5958
5578
  }
5579
+ setValueByPath(parentObject, ['safetySettings'], transformedList);
5959
5580
  }
5960
5581
  const fromTools = getValueByPath(fromObject, ['tools']);
5961
5582
  if (parentObject !== undefined && fromTools != null) {
5962
- if (Array.isArray(fromTools)) {
5963
- setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
5583
+ let transformedList = tTools(apiClient, fromTools);
5584
+ if (Array.isArray(transformedList)) {
5585
+ transformedList = transformedList.map((item) => {
5964
5586
  return toolToMldev(apiClient, tTool(apiClient, item));
5965
- })));
5966
- }
5967
- else {
5968
- setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
5587
+ });
5969
5588
  }
5589
+ setValueByPath(parentObject, ['tools'], transformedList);
5970
5590
  }
5971
5591
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
5972
5592
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -6016,14 +5636,13 @@ function generateContentParametersToMldev(apiClient, fromObject) {
6016
5636
  }
6017
5637
  const fromContents = getValueByPath(fromObject, ['contents']);
6018
5638
  if (fromContents != null) {
6019
- if (Array.isArray(fromContents)) {
6020
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
5639
+ let transformedList = tContents(apiClient, fromContents);
5640
+ if (Array.isArray(transformedList)) {
5641
+ transformedList = transformedList.map((item) => {
6021
5642
  return contentToMldev(apiClient, item);
6022
- })));
6023
- }
6024
- else {
6025
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
5643
+ });
6026
5644
  }
5645
+ setValueByPath(toObject, ['contents'], transformedList);
6027
5646
  }
6028
5647
  const fromConfig = getValueByPath(fromObject, ['config']);
6029
5648
  if (fromConfig != null) {
@@ -6178,6 +5797,42 @@ function getModelParametersToMldev(apiClient, fromObject) {
6178
5797
  }
6179
5798
  return toObject;
6180
5799
  }
5800
+ function updateModelConfigToMldev(apiClient, fromObject, parentObject) {
5801
+ const toObject = {};
5802
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5803
+ if (parentObject !== undefined && fromDisplayName != null) {
5804
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
5805
+ }
5806
+ const fromDescription = getValueByPath(fromObject, ['description']);
5807
+ if (parentObject !== undefined && fromDescription != null) {
5808
+ setValueByPath(parentObject, ['description'], fromDescription);
5809
+ }
5810
+ return toObject;
5811
+ }
5812
+ function updateModelParametersToMldev(apiClient, fromObject) {
5813
+ const toObject = {};
5814
+ const fromModel = getValueByPath(fromObject, ['model']);
5815
+ if (fromModel != null) {
5816
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
5817
+ }
5818
+ const fromConfig = getValueByPath(fromObject, ['config']);
5819
+ if (fromConfig != null) {
5820
+ setValueByPath(toObject, ['config'], updateModelConfigToMldev(apiClient, fromConfig, toObject));
5821
+ }
5822
+ return toObject;
5823
+ }
5824
+ function deleteModelParametersToMldev(apiClient, fromObject) {
5825
+ const toObject = {};
5826
+ const fromModel = getValueByPath(fromObject, ['model']);
5827
+ if (fromModel != null) {
5828
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
5829
+ }
5830
+ const fromConfig = getValueByPath(fromObject, ['config']);
5831
+ if (fromConfig != null) {
5832
+ setValueByPath(toObject, ['config'], fromConfig);
5833
+ }
5834
+ return toObject;
5835
+ }
6181
5836
  function countTokensConfigToMldev(apiClient, fromObject) {
6182
5837
  const toObject = {};
6183
5838
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
@@ -6199,14 +5854,13 @@ function countTokensParametersToMldev(apiClient, fromObject) {
6199
5854
  }
6200
5855
  const fromContents = getValueByPath(fromObject, ['contents']);
6201
5856
  if (fromContents != null) {
6202
- if (Array.isArray(fromContents)) {
6203
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
5857
+ let transformedList = tContents(apiClient, fromContents);
5858
+ if (Array.isArray(transformedList)) {
5859
+ transformedList = transformedList.map((item) => {
6204
5860
  return contentToMldev(apiClient, item);
6205
- })));
6206
- }
6207
- else {
6208
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
5861
+ });
6209
5862
  }
5863
+ setValueByPath(toObject, ['contents'], transformedList);
6210
5864
  }
6211
5865
  const fromConfig = getValueByPath(fromObject, ['config']);
6212
5866
  if (fromConfig != null) {
@@ -6351,14 +6005,13 @@ function contentToVertex(apiClient, fromObject) {
6351
6005
  const toObject = {};
6352
6006
  const fromParts = getValueByPath(fromObject, ['parts']);
6353
6007
  if (fromParts != null) {
6354
- if (Array.isArray(fromParts)) {
6355
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
6008
+ let transformedList = fromParts;
6009
+ if (Array.isArray(transformedList)) {
6010
+ transformedList = transformedList.map((item) => {
6356
6011
  return partToVertex(apiClient, item);
6357
- }));
6358
- }
6359
- else {
6360
- setValueByPath(toObject, ['parts'], fromParts);
6012
+ });
6361
6013
  }
6014
+ setValueByPath(toObject, ['parts'], transformedList);
6362
6015
  }
6363
6016
  const fromRole = getValueByPath(fromObject, ['role']);
6364
6017
  if (fromRole != null) {
@@ -6366,104 +6019,6 @@ function contentToVertex(apiClient, fromObject) {
6366
6019
  }
6367
6020
  return toObject;
6368
6021
  }
6369
- function schemaToVertex(apiClient, fromObject) {
6370
- const toObject = {};
6371
- const fromExample = getValueByPath(fromObject, ['example']);
6372
- if (fromExample != null) {
6373
- setValueByPath(toObject, ['example'], fromExample);
6374
- }
6375
- const fromPattern = getValueByPath(fromObject, ['pattern']);
6376
- if (fromPattern != null) {
6377
- setValueByPath(toObject, ['pattern'], fromPattern);
6378
- }
6379
- const fromDefault = getValueByPath(fromObject, ['default']);
6380
- if (fromDefault != null) {
6381
- setValueByPath(toObject, ['default'], fromDefault);
6382
- }
6383
- const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
6384
- if (fromMaxLength != null) {
6385
- setValueByPath(toObject, ['maxLength'], fromMaxLength);
6386
- }
6387
- const fromMinLength = getValueByPath(fromObject, ['minLength']);
6388
- if (fromMinLength != null) {
6389
- setValueByPath(toObject, ['minLength'], fromMinLength);
6390
- }
6391
- const fromMinProperties = getValueByPath(fromObject, [
6392
- 'minProperties',
6393
- ]);
6394
- if (fromMinProperties != null) {
6395
- setValueByPath(toObject, ['minProperties'], fromMinProperties);
6396
- }
6397
- const fromMaxProperties = getValueByPath(fromObject, [
6398
- 'maxProperties',
6399
- ]);
6400
- if (fromMaxProperties != null) {
6401
- setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
6402
- }
6403
- const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
6404
- if (fromAnyOf != null) {
6405
- setValueByPath(toObject, ['anyOf'], fromAnyOf);
6406
- }
6407
- const fromDescription = getValueByPath(fromObject, ['description']);
6408
- if (fromDescription != null) {
6409
- setValueByPath(toObject, ['description'], fromDescription);
6410
- }
6411
- const fromEnum = getValueByPath(fromObject, ['enum']);
6412
- if (fromEnum != null) {
6413
- setValueByPath(toObject, ['enum'], fromEnum);
6414
- }
6415
- const fromFormat = getValueByPath(fromObject, ['format']);
6416
- if (fromFormat != null) {
6417
- setValueByPath(toObject, ['format'], fromFormat);
6418
- }
6419
- const fromItems = getValueByPath(fromObject, ['items']);
6420
- if (fromItems != null) {
6421
- setValueByPath(toObject, ['items'], fromItems);
6422
- }
6423
- const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
6424
- if (fromMaxItems != null) {
6425
- setValueByPath(toObject, ['maxItems'], fromMaxItems);
6426
- }
6427
- const fromMaximum = getValueByPath(fromObject, ['maximum']);
6428
- if (fromMaximum != null) {
6429
- setValueByPath(toObject, ['maximum'], fromMaximum);
6430
- }
6431
- const fromMinItems = getValueByPath(fromObject, ['minItems']);
6432
- if (fromMinItems != null) {
6433
- setValueByPath(toObject, ['minItems'], fromMinItems);
6434
- }
6435
- const fromMinimum = getValueByPath(fromObject, ['minimum']);
6436
- if (fromMinimum != null) {
6437
- setValueByPath(toObject, ['minimum'], fromMinimum);
6438
- }
6439
- const fromNullable = getValueByPath(fromObject, ['nullable']);
6440
- if (fromNullable != null) {
6441
- setValueByPath(toObject, ['nullable'], fromNullable);
6442
- }
6443
- const fromProperties = getValueByPath(fromObject, ['properties']);
6444
- if (fromProperties != null) {
6445
- setValueByPath(toObject, ['properties'], fromProperties);
6446
- }
6447
- const fromPropertyOrdering = getValueByPath(fromObject, [
6448
- 'propertyOrdering',
6449
- ]);
6450
- if (fromPropertyOrdering != null) {
6451
- setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
6452
- }
6453
- const fromRequired = getValueByPath(fromObject, ['required']);
6454
- if (fromRequired != null) {
6455
- setValueByPath(toObject, ['required'], fromRequired);
6456
- }
6457
- const fromTitle = getValueByPath(fromObject, ['title']);
6458
- if (fromTitle != null) {
6459
- setValueByPath(toObject, ['title'], fromTitle);
6460
- }
6461
- const fromType = getValueByPath(fromObject, ['type']);
6462
- if (fromType != null) {
6463
- setValueByPath(toObject, ['type'], fromType);
6464
- }
6465
- return toObject;
6466
- }
6467
6022
  function modelSelectionConfigToVertex(apiClient, fromObject) {
6468
6023
  const toObject = {};
6469
6024
  const fromFeatureSelectionPreference = getValueByPath(fromObject, [
@@ -6490,26 +6045,6 @@ function safetySettingToVertex(apiClient, fromObject) {
6490
6045
  }
6491
6046
  return toObject;
6492
6047
  }
6493
- function functionDeclarationToVertex(apiClient, fromObject) {
6494
- const toObject = {};
6495
- const fromResponse = getValueByPath(fromObject, ['response']);
6496
- if (fromResponse != null) {
6497
- setValueByPath(toObject, ['response'], schemaToVertex(apiClient, fromResponse));
6498
- }
6499
- const fromDescription = getValueByPath(fromObject, ['description']);
6500
- if (fromDescription != null) {
6501
- setValueByPath(toObject, ['description'], fromDescription);
6502
- }
6503
- const fromName = getValueByPath(fromObject, ['name']);
6504
- if (fromName != null) {
6505
- setValueByPath(toObject, ['name'], fromName);
6506
- }
6507
- const fromParameters = getValueByPath(fromObject, ['parameters']);
6508
- if (fromParameters != null) {
6509
- setValueByPath(toObject, ['parameters'], fromParameters);
6510
- }
6511
- return toObject;
6512
- }
6513
6048
  function googleSearchToVertex() {
6514
6049
  const toObject = {};
6515
6050
  return toObject;
@@ -6540,19 +6075,6 @@ function googleSearchRetrievalToVertex(apiClient, fromObject) {
6540
6075
  }
6541
6076
  function toolToVertex(apiClient, fromObject) {
6542
6077
  const toObject = {};
6543
- const fromFunctionDeclarations = getValueByPath(fromObject, [
6544
- 'functionDeclarations',
6545
- ]);
6546
- if (fromFunctionDeclarations != null) {
6547
- if (Array.isArray(fromFunctionDeclarations)) {
6548
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations.map((item) => {
6549
- return functionDeclarationToVertex(apiClient, item);
6550
- }));
6551
- }
6552
- else {
6553
- setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
6554
- }
6555
- }
6556
6078
  const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
6557
6079
  if (fromRetrieval != null) {
6558
6080
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
@@ -6573,6 +6095,12 @@ function toolToVertex(apiClient, fromObject) {
6573
6095
  if (fromCodeExecution != null) {
6574
6096
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
6575
6097
  }
6098
+ const fromFunctionDeclarations = getValueByPath(fromObject, [
6099
+ 'functionDeclarations',
6100
+ ]);
6101
+ if (fromFunctionDeclarations != null) {
6102
+ setValueByPath(toObject, ['functionDeclarations'], fromFunctionDeclarations);
6103
+ }
6576
6104
  return toObject;
6577
6105
  }
6578
6106
  function functionCallingConfigToVertex(apiClient, fromObject) {
@@ -6719,7 +6247,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
6719
6247
  'responseSchema',
6720
6248
  ]);
6721
6249
  if (fromResponseSchema != null) {
6722
- setValueByPath(toObject, ['responseSchema'], schemaToVertex(apiClient, tSchema(apiClient, fromResponseSchema)));
6250
+ setValueByPath(toObject, ['responseSchema'], tSchema(apiClient, fromResponseSchema));
6723
6251
  }
6724
6252
  const fromRoutingConfig = getValueByPath(fromObject, [
6725
6253
  'routingConfig',
@@ -6737,25 +6265,23 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
6737
6265
  'safetySettings',
6738
6266
  ]);
6739
6267
  if (parentObject !== undefined && fromSafetySettings != null) {
6740
- if (Array.isArray(fromSafetySettings)) {
6741
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings.map((item) => {
6268
+ let transformedList = fromSafetySettings;
6269
+ if (Array.isArray(transformedList)) {
6270
+ transformedList = transformedList.map((item) => {
6742
6271
  return safetySettingToVertex(apiClient, item);
6743
- }));
6744
- }
6745
- else {
6746
- setValueByPath(parentObject, ['safetySettings'], fromSafetySettings);
6272
+ });
6747
6273
  }
6274
+ setValueByPath(parentObject, ['safetySettings'], transformedList);
6748
6275
  }
6749
6276
  const fromTools = getValueByPath(fromObject, ['tools']);
6750
6277
  if (parentObject !== undefined && fromTools != null) {
6751
- if (Array.isArray(fromTools)) {
6752
- setValueByPath(parentObject, ['tools'], tTools(apiClient, tTools(apiClient, fromTools).map((item) => {
6278
+ let transformedList = tTools(apiClient, fromTools);
6279
+ if (Array.isArray(transformedList)) {
6280
+ transformedList = transformedList.map((item) => {
6753
6281
  return toolToVertex(apiClient, tTool(apiClient, item));
6754
- })));
6755
- }
6756
- else {
6757
- setValueByPath(parentObject, ['tools'], tTools(apiClient, fromTools));
6282
+ });
6758
6283
  }
6284
+ setValueByPath(parentObject, ['tools'], transformedList);
6759
6285
  }
6760
6286
  const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
6761
6287
  if (parentObject !== undefined && fromToolConfig != null) {
@@ -6809,14 +6335,13 @@ function generateContentParametersToVertex(apiClient, fromObject) {
6809
6335
  }
6810
6336
  const fromContents = getValueByPath(fromObject, ['contents']);
6811
6337
  if (fromContents != null) {
6812
- if (Array.isArray(fromContents)) {
6813
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
6338
+ let transformedList = tContents(apiClient, fromContents);
6339
+ if (Array.isArray(transformedList)) {
6340
+ transformedList = transformedList.map((item) => {
6814
6341
  return contentToVertex(apiClient, item);
6815
- })));
6816
- }
6817
- else {
6818
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
6342
+ });
6819
6343
  }
6344
+ setValueByPath(toObject, ['contents'], transformedList);
6820
6345
  }
6821
6346
  const fromConfig = getValueByPath(fromObject, ['config']);
6822
6347
  if (fromConfig != null) {
@@ -6978,6 +6503,42 @@ function getModelParametersToVertex(apiClient, fromObject) {
6978
6503
  }
6979
6504
  return toObject;
6980
6505
  }
6506
+ function updateModelConfigToVertex(apiClient, fromObject, parentObject) {
6507
+ const toObject = {};
6508
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
6509
+ if (parentObject !== undefined && fromDisplayName != null) {
6510
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
6511
+ }
6512
+ const fromDescription = getValueByPath(fromObject, ['description']);
6513
+ if (parentObject !== undefined && fromDescription != null) {
6514
+ setValueByPath(parentObject, ['description'], fromDescription);
6515
+ }
6516
+ return toObject;
6517
+ }
6518
+ function updateModelParametersToVertex(apiClient, fromObject) {
6519
+ const toObject = {};
6520
+ const fromModel = getValueByPath(fromObject, ['model']);
6521
+ if (fromModel != null) {
6522
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
6523
+ }
6524
+ const fromConfig = getValueByPath(fromObject, ['config']);
6525
+ if (fromConfig != null) {
6526
+ setValueByPath(toObject, ['config'], updateModelConfigToVertex(apiClient, fromConfig, toObject));
6527
+ }
6528
+ return toObject;
6529
+ }
6530
+ function deleteModelParametersToVertex(apiClient, fromObject) {
6531
+ const toObject = {};
6532
+ const fromModel = getValueByPath(fromObject, ['model']);
6533
+ if (fromModel != null) {
6534
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
6535
+ }
6536
+ const fromConfig = getValueByPath(fromObject, ['config']);
6537
+ if (fromConfig != null) {
6538
+ setValueByPath(toObject, ['config'], fromConfig);
6539
+ }
6540
+ return toObject;
6541
+ }
6981
6542
  function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
6982
6543
  const toObject = {};
6983
6544
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -6988,14 +6549,13 @@ function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
6988
6549
  }
6989
6550
  const fromTools = getValueByPath(fromObject, ['tools']);
6990
6551
  if (parentObject !== undefined && fromTools != null) {
6991
- if (Array.isArray(fromTools)) {
6992
- setValueByPath(parentObject, ['tools'], fromTools.map((item) => {
6552
+ let transformedList = fromTools;
6553
+ if (Array.isArray(transformedList)) {
6554
+ transformedList = transformedList.map((item) => {
6993
6555
  return toolToVertex(apiClient, item);
6994
- }));
6995
- }
6996
- else {
6997
- setValueByPath(parentObject, ['tools'], fromTools);
6556
+ });
6998
6557
  }
6558
+ setValueByPath(parentObject, ['tools'], transformedList);
6999
6559
  }
7000
6560
  const fromGenerationConfig = getValueByPath(fromObject, [
7001
6561
  'generationConfig',
@@ -7013,14 +6573,13 @@ function countTokensParametersToVertex(apiClient, fromObject) {
7013
6573
  }
7014
6574
  const fromContents = getValueByPath(fromObject, ['contents']);
7015
6575
  if (fromContents != null) {
7016
- if (Array.isArray(fromContents)) {
7017
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
6576
+ let transformedList = tContents(apiClient, fromContents);
6577
+ if (Array.isArray(transformedList)) {
6578
+ transformedList = transformedList.map((item) => {
7018
6579
  return contentToVertex(apiClient, item);
7019
- })));
7020
- }
7021
- else {
7022
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
6580
+ });
7023
6581
  }
6582
+ setValueByPath(toObject, ['contents'], transformedList);
7024
6583
  }
7025
6584
  const fromConfig = getValueByPath(fromObject, ['config']);
7026
6585
  if (fromConfig != null) {
@@ -7036,14 +6595,13 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
7036
6595
  }
7037
6596
  const fromContents = getValueByPath(fromObject, ['contents']);
7038
6597
  if (fromContents != null) {
7039
- if (Array.isArray(fromContents)) {
7040
- setValueByPath(toObject, ['contents'], tContents(apiClient, tContents(apiClient, fromContents).map((item) => {
6598
+ let transformedList = tContents(apiClient, fromContents);
6599
+ if (Array.isArray(transformedList)) {
6600
+ transformedList = transformedList.map((item) => {
7041
6601
  return contentToVertex(apiClient, item);
7042
- })));
7043
- }
7044
- else {
7045
- setValueByPath(toObject, ['contents'], tContents(apiClient, fromContents));
6602
+ });
7046
6603
  }
6604
+ setValueByPath(toObject, ['contents'], transformedList);
7047
6605
  }
7048
6606
  const fromConfig = getValueByPath(fromObject, ['config']);
7049
6607
  if (fromConfig != null) {
@@ -7191,14 +6749,13 @@ function contentFromMldev(apiClient, fromObject) {
7191
6749
  const toObject = {};
7192
6750
  const fromParts = getValueByPath(fromObject, ['parts']);
7193
6751
  if (fromParts != null) {
7194
- if (Array.isArray(fromParts)) {
7195
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
6752
+ let transformedList = fromParts;
6753
+ if (Array.isArray(transformedList)) {
6754
+ transformedList = transformedList.map((item) => {
7196
6755
  return partFromMldev(apiClient, item);
7197
- }));
7198
- }
7199
- else {
7200
- setValueByPath(toObject, ['parts'], fromParts);
6756
+ });
7201
6757
  }
6758
+ setValueByPath(toObject, ['parts'], transformedList);
7202
6759
  }
7203
6760
  const fromRole = getValueByPath(fromObject, ['role']);
7204
6761
  if (fromRole != null) {
@@ -7266,14 +6823,13 @@ function generateContentResponseFromMldev(apiClient, fromObject) {
7266
6823
  const toObject = {};
7267
6824
  const fromCandidates = getValueByPath(fromObject, ['candidates']);
7268
6825
  if (fromCandidates != null) {
7269
- if (Array.isArray(fromCandidates)) {
7270
- setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
6826
+ let transformedList = fromCandidates;
6827
+ if (Array.isArray(transformedList)) {
6828
+ transformedList = transformedList.map((item) => {
7271
6829
  return candidateFromMldev(apiClient, item);
7272
- }));
7273
- }
7274
- else {
7275
- setValueByPath(toObject, ['candidates'], fromCandidates);
6830
+ });
7276
6831
  }
6832
+ setValueByPath(toObject, ['candidates'], transformedList);
7277
6833
  }
7278
6834
  const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
7279
6835
  if (fromModelVersion != null) {
@@ -7309,14 +6865,13 @@ function embedContentResponseFromMldev(apiClient, fromObject) {
7309
6865
  const toObject = {};
7310
6866
  const fromEmbeddings = getValueByPath(fromObject, ['embeddings']);
7311
6867
  if (fromEmbeddings != null) {
7312
- if (Array.isArray(fromEmbeddings)) {
7313
- setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
6868
+ let transformedList = fromEmbeddings;
6869
+ if (Array.isArray(transformedList)) {
6870
+ transformedList = transformedList.map((item) => {
7314
6871
  return contentEmbeddingFromMldev(apiClient, item);
7315
- }));
7316
- }
7317
- else {
7318
- setValueByPath(toObject, ['embeddings'], fromEmbeddings);
6872
+ });
7319
6873
  }
6874
+ setValueByPath(toObject, ['embeddings'], transformedList);
7320
6875
  }
7321
6876
  const fromMetadata = getValueByPath(fromObject, ['metadata']);
7322
6877
  if (fromMetadata != null) {
@@ -7384,14 +6939,13 @@ function generateImagesResponseFromMldev(apiClient, fromObject) {
7384
6939
  'predictions',
7385
6940
  ]);
7386
6941
  if (fromGeneratedImages != null) {
7387
- if (Array.isArray(fromGeneratedImages)) {
7388
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
6942
+ let transformedList = fromGeneratedImages;
6943
+ if (Array.isArray(transformedList)) {
6944
+ transformedList = transformedList.map((item) => {
7389
6945
  return generatedImageFromMldev(apiClient, item);
7390
- }));
7391
- }
7392
- else {
7393
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
6946
+ });
7394
6947
  }
6948
+ setValueByPath(toObject, ['generatedImages'], transformedList);
7395
6949
  }
7396
6950
  const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
7397
6951
  'positivePromptSafetyAttributes',
@@ -7459,6 +7013,10 @@ function modelFromMldev(apiClient, fromObject) {
7459
7013
  }
7460
7014
  return toObject;
7461
7015
  }
7016
+ function deleteModelResponseFromMldev() {
7017
+ const toObject = {};
7018
+ return toObject;
7019
+ }
7462
7020
  function countTokensResponseFromMldev(apiClient, fromObject) {
7463
7021
  const toObject = {};
7464
7022
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -7506,14 +7064,13 @@ function generateVideosResponseFromMldev$1(apiClient, fromObject) {
7506
7064
  'generatedSamples',
7507
7065
  ]);
7508
7066
  if (fromGeneratedVideos != null) {
7509
- if (Array.isArray(fromGeneratedVideos)) {
7510
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
7067
+ let transformedList = fromGeneratedVideos;
7068
+ if (Array.isArray(transformedList)) {
7069
+ transformedList = transformedList.map((item) => {
7511
7070
  return generatedVideoFromMldev$1(apiClient, item);
7512
- }));
7513
- }
7514
- else {
7515
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
7071
+ });
7516
7072
  }
7073
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
7517
7074
  }
7518
7075
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
7519
7076
  'raiMediaFilteredCount',
@@ -7608,14 +7165,13 @@ function contentFromVertex(apiClient, fromObject) {
7608
7165
  const toObject = {};
7609
7166
  const fromParts = getValueByPath(fromObject, ['parts']);
7610
7167
  if (fromParts != null) {
7611
- if (Array.isArray(fromParts)) {
7612
- setValueByPath(toObject, ['parts'], fromParts.map((item) => {
7168
+ let transformedList = fromParts;
7169
+ if (Array.isArray(transformedList)) {
7170
+ transformedList = transformedList.map((item) => {
7613
7171
  return partFromVertex(apiClient, item);
7614
- }));
7615
- }
7616
- else {
7617
- setValueByPath(toObject, ['parts'], fromParts);
7172
+ });
7618
7173
  }
7174
+ setValueByPath(toObject, ['parts'], transformedList);
7619
7175
  }
7620
7176
  const fromRole = getValueByPath(fromObject, ['role']);
7621
7177
  if (fromRole != null) {
@@ -7685,14 +7241,13 @@ function generateContentResponseFromVertex(apiClient, fromObject) {
7685
7241
  const toObject = {};
7686
7242
  const fromCandidates = getValueByPath(fromObject, ['candidates']);
7687
7243
  if (fromCandidates != null) {
7688
- if (Array.isArray(fromCandidates)) {
7689
- setValueByPath(toObject, ['candidates'], fromCandidates.map((item) => {
7244
+ let transformedList = fromCandidates;
7245
+ if (Array.isArray(transformedList)) {
7246
+ transformedList = transformedList.map((item) => {
7690
7247
  return candidateFromVertex(apiClient, item);
7691
- }));
7692
- }
7693
- else {
7694
- setValueByPath(toObject, ['candidates'], fromCandidates);
7248
+ });
7695
7249
  }
7250
+ setValueByPath(toObject, ['candidates'], transformedList);
7696
7251
  }
7697
7252
  const fromCreateTime = getValueByPath(fromObject, ['createTime']);
7698
7253
  if (fromCreateTime != null) {
@@ -7761,14 +7316,13 @@ function embedContentResponseFromVertex(apiClient, fromObject) {
7761
7316
  'embeddings',
7762
7317
  ]);
7763
7318
  if (fromEmbeddings != null) {
7764
- if (Array.isArray(fromEmbeddings)) {
7765
- setValueByPath(toObject, ['embeddings'], fromEmbeddings.map((item) => {
7319
+ let transformedList = fromEmbeddings;
7320
+ if (Array.isArray(transformedList)) {
7321
+ transformedList = transformedList.map((item) => {
7766
7322
  return contentEmbeddingFromVertex(apiClient, item);
7767
- }));
7768
- }
7769
- else {
7770
- setValueByPath(toObject, ['embeddings'], fromEmbeddings);
7323
+ });
7771
7324
  }
7325
+ setValueByPath(toObject, ['embeddings'], transformedList);
7772
7326
  }
7773
7327
  const fromMetadata = getValueByPath(fromObject, ['metadata']);
7774
7328
  if (fromMetadata != null) {
@@ -7844,14 +7398,13 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
7844
7398
  'predictions',
7845
7399
  ]);
7846
7400
  if (fromGeneratedImages != null) {
7847
- if (Array.isArray(fromGeneratedImages)) {
7848
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages.map((item) => {
7401
+ let transformedList = fromGeneratedImages;
7402
+ if (Array.isArray(transformedList)) {
7403
+ transformedList = transformedList.map((item) => {
7849
7404
  return generatedImageFromVertex(apiClient, item);
7850
- }));
7851
- }
7852
- else {
7853
- setValueByPath(toObject, ['generatedImages'], fromGeneratedImages);
7405
+ });
7854
7406
  }
7407
+ setValueByPath(toObject, ['generatedImages'], transformedList);
7855
7408
  }
7856
7409
  const fromPositivePromptSafetyAttributes = getValueByPath(fromObject, [
7857
7410
  'positivePromptSafetyAttributes',
@@ -7914,14 +7467,13 @@ function modelFromVertex(apiClient, fromObject) {
7914
7467
  }
7915
7468
  const fromEndpoints = getValueByPath(fromObject, ['deployedModels']);
7916
7469
  if (fromEndpoints != null) {
7917
- if (Array.isArray(fromEndpoints)) {
7918
- setValueByPath(toObject, ['endpoints'], fromEndpoints.map((item) => {
7470
+ let transformedList = fromEndpoints;
7471
+ if (Array.isArray(transformedList)) {
7472
+ transformedList = transformedList.map((item) => {
7919
7473
  return endpointFromVertex(apiClient, item);
7920
- }));
7921
- }
7922
- else {
7923
- setValueByPath(toObject, ['endpoints'], fromEndpoints);
7474
+ });
7924
7475
  }
7476
+ setValueByPath(toObject, ['endpoints'], transformedList);
7925
7477
  }
7926
7478
  const fromLabels = getValueByPath(fromObject, ['labels']);
7927
7479
  if (fromLabels != null) {
@@ -7933,6 +7485,10 @@ function modelFromVertex(apiClient, fromObject) {
7933
7485
  }
7934
7486
  return toObject;
7935
7487
  }
7488
+ function deleteModelResponseFromVertex() {
7489
+ const toObject = {};
7490
+ return toObject;
7491
+ }
7936
7492
  function countTokensResponseFromVertex(apiClient, fromObject) {
7937
7493
  const toObject = {};
7938
7494
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -7979,14 +7535,13 @@ function generateVideosResponseFromVertex$1(apiClient, fromObject) {
7979
7535
  const toObject = {};
7980
7536
  const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
7981
7537
  if (fromGeneratedVideos != null) {
7982
- if (Array.isArray(fromGeneratedVideos)) {
7983
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
7538
+ let transformedList = fromGeneratedVideos;
7539
+ if (Array.isArray(transformedList)) {
7540
+ transformedList = transformedList.map((item) => {
7984
7541
  return generatedVideoFromVertex$1(apiClient, item);
7985
- }));
7986
- }
7987
- else {
7988
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
7542
+ });
7989
7543
  }
7544
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
7990
7545
  }
7991
7546
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
7992
7547
  'raiMediaFilteredCount',
@@ -8929,6 +8484,146 @@ class Models extends BaseModule {
8929
8484
  });
8930
8485
  }
8931
8486
  }
8487
+ /**
8488
+ * Updates a tuned model by its name.
8489
+ *
8490
+ * @param params - The parameters for updating the model.
8491
+ * @return The response from the API.
8492
+ *
8493
+ * @example
8494
+ * ```ts
8495
+ * const response = await ai.models.update({
8496
+ * model: 'tuned-model-name',
8497
+ * config: {
8498
+ * displayName: 'New display name',
8499
+ * description: 'New description',
8500
+ * },
8501
+ * });
8502
+ * ```
8503
+ */
8504
+ async update(params) {
8505
+ var _a, _b, _c, _d;
8506
+ let response;
8507
+ let path = '';
8508
+ let queryParams = {};
8509
+ if (this.apiClient.isVertexAI()) {
8510
+ const body = updateModelParametersToVertex(this.apiClient, params);
8511
+ path = formatMap('{model}', body['_url']);
8512
+ queryParams = body['_query'];
8513
+ delete body['config'];
8514
+ delete body['_url'];
8515
+ delete body['_query'];
8516
+ response = this.apiClient
8517
+ .request({
8518
+ path: path,
8519
+ queryParams: queryParams,
8520
+ body: JSON.stringify(body),
8521
+ httpMethod: 'PATCH',
8522
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
8523
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
8524
+ })
8525
+ .then((httpResponse) => {
8526
+ return httpResponse.json();
8527
+ });
8528
+ return response.then((apiResponse) => {
8529
+ const resp = modelFromVertex(this.apiClient, apiResponse);
8530
+ return resp;
8531
+ });
8532
+ }
8533
+ else {
8534
+ const body = updateModelParametersToMldev(this.apiClient, params);
8535
+ path = formatMap('{name}', body['_url']);
8536
+ queryParams = body['_query'];
8537
+ delete body['config'];
8538
+ delete body['_url'];
8539
+ delete body['_query'];
8540
+ response = this.apiClient
8541
+ .request({
8542
+ path: path,
8543
+ queryParams: queryParams,
8544
+ body: JSON.stringify(body),
8545
+ httpMethod: 'PATCH',
8546
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
8547
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
8548
+ })
8549
+ .then((httpResponse) => {
8550
+ return httpResponse.json();
8551
+ });
8552
+ return response.then((apiResponse) => {
8553
+ const resp = modelFromMldev(this.apiClient, apiResponse);
8554
+ return resp;
8555
+ });
8556
+ }
8557
+ }
8558
+ /**
8559
+ * Deletes a tuned model by its name.
8560
+ *
8561
+ * @param params - The parameters for deleting the model.
8562
+ * @return The response from the API.
8563
+ *
8564
+ * @example
8565
+ * ```ts
8566
+ * const response = await ai.models.delete({model: 'tuned-model-name'});
8567
+ * ```
8568
+ */
8569
+ async delete(params) {
8570
+ var _a, _b, _c, _d;
8571
+ let response;
8572
+ let path = '';
8573
+ let queryParams = {};
8574
+ if (this.apiClient.isVertexAI()) {
8575
+ const body = deleteModelParametersToVertex(this.apiClient, params);
8576
+ path = formatMap('{name}', body['_url']);
8577
+ queryParams = body['_query'];
8578
+ delete body['config'];
8579
+ delete body['_url'];
8580
+ delete body['_query'];
8581
+ response = this.apiClient
8582
+ .request({
8583
+ path: path,
8584
+ queryParams: queryParams,
8585
+ body: JSON.stringify(body),
8586
+ httpMethod: 'DELETE',
8587
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
8588
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
8589
+ })
8590
+ .then((httpResponse) => {
8591
+ return httpResponse.json();
8592
+ });
8593
+ return response.then(() => {
8594
+ const resp = deleteModelResponseFromVertex();
8595
+ const typedResp = new DeleteModelResponse();
8596
+ Object.assign(typedResp, resp);
8597
+ return typedResp;
8598
+ });
8599
+ }
8600
+ else {
8601
+ const body = deleteModelParametersToMldev(this.apiClient, params);
8602
+ path = formatMap('{name}', body['_url']);
8603
+ queryParams = body['_query'];
8604
+ delete body['config'];
8605
+ delete body['_url'];
8606
+ delete body['_query'];
8607
+ response = this.apiClient
8608
+ .request({
8609
+ path: path,
8610
+ queryParams: queryParams,
8611
+ body: JSON.stringify(body),
8612
+ httpMethod: 'DELETE',
8613
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
8614
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
8615
+ })
8616
+ .then((httpResponse) => {
8617
+ return httpResponse.json();
8618
+ });
8619
+ return response.then(() => {
8620
+ const resp = deleteModelResponseFromMldev();
8621
+ const typedResp = new DeleteModelResponse();
8622
+ Object.assign(typedResp, resp);
8623
+ return typedResp;
8624
+ });
8625
+ }
8626
+ }
8932
8627
  /**
8933
8628
  * Counts the number of tokens in the given contents. Multimodal input is
8934
8629
  * supported for Gemini models.
@@ -9219,14 +8914,13 @@ function generateVideosResponseFromMldev(apiClient, fromObject) {
9219
8914
  'generatedSamples',
9220
8915
  ]);
9221
8916
  if (fromGeneratedVideos != null) {
9222
- if (Array.isArray(fromGeneratedVideos)) {
9223
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
8917
+ let transformedList = fromGeneratedVideos;
8918
+ if (Array.isArray(transformedList)) {
8919
+ transformedList = transformedList.map((item) => {
9224
8920
  return generatedVideoFromMldev(apiClient, item);
9225
- }));
9226
- }
9227
- else {
9228
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
8921
+ });
9229
8922
  }
8923
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
9230
8924
  }
9231
8925
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
9232
8926
  'raiMediaFilteredCount',
@@ -9299,14 +8993,13 @@ function generateVideosResponseFromVertex(apiClient, fromObject) {
9299
8993
  const toObject = {};
9300
8994
  const fromGeneratedVideos = getValueByPath(fromObject, ['videos']);
9301
8995
  if (fromGeneratedVideos != null) {
9302
- if (Array.isArray(fromGeneratedVideos)) {
9303
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos.map((item) => {
8996
+ let transformedList = fromGeneratedVideos;
8997
+ if (Array.isArray(transformedList)) {
8998
+ transformedList = transformedList.map((item) => {
9304
8999
  return generatedVideoFromVertex(apiClient, item);
9305
- }));
9306
- }
9307
- else {
9308
- setValueByPath(toObject, ['generatedVideos'], fromGeneratedVideos);
9000
+ });
9309
9001
  }
9002
+ setValueByPath(toObject, ['generatedVideos'], transformedList);
9310
9003
  }
9311
9004
  const fromRaiMediaFilteredCount = getValueByPath(fromObject, [
9312
9005
  'raiMediaFilteredCount',
@@ -9477,6 +9170,736 @@ class Operations extends BaseModule {
9477
9170
  }
9478
9171
  }
9479
9172
 
9173
+ /**
9174
+ * @license
9175
+ * Copyright 2025 Google LLC
9176
+ * SPDX-License-Identifier: Apache-2.0
9177
+ */
9178
+ function getTuningJobParametersToMldev(apiClient, fromObject) {
9179
+ const toObject = {};
9180
+ const fromName = getValueByPath(fromObject, ['name']);
9181
+ if (fromName != null) {
9182
+ setValueByPath(toObject, ['_url', 'name'], fromName);
9183
+ }
9184
+ const fromConfig = getValueByPath(fromObject, ['config']);
9185
+ if (fromConfig != null) {
9186
+ setValueByPath(toObject, ['config'], fromConfig);
9187
+ }
9188
+ return toObject;
9189
+ }
9190
+ function listTuningJobsConfigToMldev(apiClient, fromObject, parentObject) {
9191
+ const toObject = {};
9192
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
9193
+ if (parentObject !== undefined && fromPageSize != null) {
9194
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
9195
+ }
9196
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
9197
+ if (parentObject !== undefined && fromPageToken != null) {
9198
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
9199
+ }
9200
+ const fromFilter = getValueByPath(fromObject, ['filter']);
9201
+ if (parentObject !== undefined && fromFilter != null) {
9202
+ setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
9203
+ }
9204
+ return toObject;
9205
+ }
9206
+ function listTuningJobsParametersToMldev(apiClient, fromObject) {
9207
+ const toObject = {};
9208
+ const fromConfig = getValueByPath(fromObject, ['config']);
9209
+ if (fromConfig != null) {
9210
+ setValueByPath(toObject, ['config'], listTuningJobsConfigToMldev(apiClient, fromConfig, toObject));
9211
+ }
9212
+ return toObject;
9213
+ }
9214
+ function tuningExampleToMldev(apiClient, fromObject) {
9215
+ const toObject = {};
9216
+ const fromTextInput = getValueByPath(fromObject, ['textInput']);
9217
+ if (fromTextInput != null) {
9218
+ setValueByPath(toObject, ['textInput'], fromTextInput);
9219
+ }
9220
+ const fromOutput = getValueByPath(fromObject, ['output']);
9221
+ if (fromOutput != null) {
9222
+ setValueByPath(toObject, ['output'], fromOutput);
9223
+ }
9224
+ return toObject;
9225
+ }
9226
+ function tuningDatasetToMldev(apiClient, fromObject) {
9227
+ const toObject = {};
9228
+ if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
9229
+ throw new Error('gcsUri parameter is not supported in Gemini API.');
9230
+ }
9231
+ const fromExamples = getValueByPath(fromObject, ['examples']);
9232
+ if (fromExamples != null) {
9233
+ let transformedList = fromExamples;
9234
+ if (Array.isArray(transformedList)) {
9235
+ transformedList = transformedList.map((item) => {
9236
+ return tuningExampleToMldev(apiClient, item);
9237
+ });
9238
+ }
9239
+ setValueByPath(toObject, ['examples', 'examples'], transformedList);
9240
+ }
9241
+ return toObject;
9242
+ }
9243
+ function createTuningJobConfigToMldev(apiClient, fromObject, parentObject) {
9244
+ const toObject = {};
9245
+ if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
9246
+ throw new Error('validationDataset parameter is not supported in Gemini API.');
9247
+ }
9248
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9249
+ 'tunedModelDisplayName',
9250
+ ]);
9251
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
9252
+ setValueByPath(parentObject, ['displayName'], fromTunedModelDisplayName);
9253
+ }
9254
+ if (getValueByPath(fromObject, ['description']) !== undefined) {
9255
+ throw new Error('description parameter is not supported in Gemini API.');
9256
+ }
9257
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
9258
+ if (parentObject !== undefined && fromEpochCount != null) {
9259
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'epochCount'], fromEpochCount);
9260
+ }
9261
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
9262
+ 'learningRateMultiplier',
9263
+ ]);
9264
+ if (fromLearningRateMultiplier != null) {
9265
+ setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
9266
+ }
9267
+ if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
9268
+ throw new Error('adapterSize parameter is not supported in Gemini API.');
9269
+ }
9270
+ const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
9271
+ if (parentObject !== undefined && fromBatchSize != null) {
9272
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
9273
+ }
9274
+ const fromLearningRate = getValueByPath(fromObject, ['learningRate']);
9275
+ if (parentObject !== undefined && fromLearningRate != null) {
9276
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
9277
+ }
9278
+ return toObject;
9279
+ }
9280
+ function createTuningJobParametersToMldev(apiClient, fromObject) {
9281
+ const toObject = {};
9282
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9283
+ if (fromBaseModel != null) {
9284
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9285
+ }
9286
+ const fromTrainingDataset = getValueByPath(fromObject, [
9287
+ 'trainingDataset',
9288
+ ]);
9289
+ if (fromTrainingDataset != null) {
9290
+ setValueByPath(toObject, ['tuningTask', 'trainingData'], tuningDatasetToMldev(apiClient, fromTrainingDataset));
9291
+ }
9292
+ const fromConfig = getValueByPath(fromObject, ['config']);
9293
+ if (fromConfig != null) {
9294
+ setValueByPath(toObject, ['config'], createTuningJobConfigToMldev(apiClient, fromConfig, toObject));
9295
+ }
9296
+ return toObject;
9297
+ }
9298
+ function getTuningJobParametersToVertex(apiClient, fromObject) {
9299
+ const toObject = {};
9300
+ const fromName = getValueByPath(fromObject, ['name']);
9301
+ if (fromName != null) {
9302
+ setValueByPath(toObject, ['_url', 'name'], fromName);
9303
+ }
9304
+ const fromConfig = getValueByPath(fromObject, ['config']);
9305
+ if (fromConfig != null) {
9306
+ setValueByPath(toObject, ['config'], fromConfig);
9307
+ }
9308
+ return toObject;
9309
+ }
9310
+ function listTuningJobsConfigToVertex(apiClient, fromObject, parentObject) {
9311
+ const toObject = {};
9312
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
9313
+ if (parentObject !== undefined && fromPageSize != null) {
9314
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
9315
+ }
9316
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
9317
+ if (parentObject !== undefined && fromPageToken != null) {
9318
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
9319
+ }
9320
+ const fromFilter = getValueByPath(fromObject, ['filter']);
9321
+ if (parentObject !== undefined && fromFilter != null) {
9322
+ setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
9323
+ }
9324
+ return toObject;
9325
+ }
9326
+ function listTuningJobsParametersToVertex(apiClient, fromObject) {
9327
+ const toObject = {};
9328
+ const fromConfig = getValueByPath(fromObject, ['config']);
9329
+ if (fromConfig != null) {
9330
+ setValueByPath(toObject, ['config'], listTuningJobsConfigToVertex(apiClient, fromConfig, toObject));
9331
+ }
9332
+ return toObject;
9333
+ }
9334
+ function tuningDatasetToVertex(apiClient, fromObject, parentObject) {
9335
+ const toObject = {};
9336
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
9337
+ if (parentObject !== undefined && fromGcsUri != null) {
9338
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
9339
+ }
9340
+ if (getValueByPath(fromObject, ['examples']) !== undefined) {
9341
+ throw new Error('examples parameter is not supported in Vertex AI.');
9342
+ }
9343
+ return toObject;
9344
+ }
9345
+ function tuningValidationDatasetToVertex(apiClient, fromObject) {
9346
+ const toObject = {};
9347
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
9348
+ if (fromGcsUri != null) {
9349
+ setValueByPath(toObject, ['validationDatasetUri'], fromGcsUri);
9350
+ }
9351
+ return toObject;
9352
+ }
9353
+ function createTuningJobConfigToVertex(apiClient, fromObject, parentObject) {
9354
+ const toObject = {};
9355
+ const fromValidationDataset = getValueByPath(fromObject, [
9356
+ 'validationDataset',
9357
+ ]);
9358
+ if (parentObject !== undefined && fromValidationDataset != null) {
9359
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(apiClient, fromValidationDataset));
9360
+ }
9361
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9362
+ 'tunedModelDisplayName',
9363
+ ]);
9364
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
9365
+ setValueByPath(parentObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
9366
+ }
9367
+ const fromDescription = getValueByPath(fromObject, ['description']);
9368
+ if (parentObject !== undefined && fromDescription != null) {
9369
+ setValueByPath(parentObject, ['description'], fromDescription);
9370
+ }
9371
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
9372
+ if (parentObject !== undefined && fromEpochCount != null) {
9373
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
9374
+ }
9375
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
9376
+ 'learningRateMultiplier',
9377
+ ]);
9378
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
9379
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
9380
+ }
9381
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
9382
+ if (parentObject !== undefined && fromAdapterSize != null) {
9383
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
9384
+ }
9385
+ if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
9386
+ throw new Error('batchSize parameter is not supported in Vertex AI.');
9387
+ }
9388
+ if (getValueByPath(fromObject, ['learningRate']) !== undefined) {
9389
+ throw new Error('learningRate parameter is not supported in Vertex AI.');
9390
+ }
9391
+ return toObject;
9392
+ }
9393
+ function createTuningJobParametersToVertex(apiClient, fromObject) {
9394
+ const toObject = {};
9395
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9396
+ if (fromBaseModel != null) {
9397
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9398
+ }
9399
+ const fromTrainingDataset = getValueByPath(fromObject, [
9400
+ 'trainingDataset',
9401
+ ]);
9402
+ if (fromTrainingDataset != null) {
9403
+ setValueByPath(toObject, ['supervisedTuningSpec', 'trainingDatasetUri'], tuningDatasetToVertex(apiClient, fromTrainingDataset, toObject));
9404
+ }
9405
+ const fromConfig = getValueByPath(fromObject, ['config']);
9406
+ if (fromConfig != null) {
9407
+ setValueByPath(toObject, ['config'], createTuningJobConfigToVertex(apiClient, fromConfig, toObject));
9408
+ }
9409
+ return toObject;
9410
+ }
9411
+ function tunedModelFromMldev(apiClient, fromObject) {
9412
+ const toObject = {};
9413
+ const fromModel = getValueByPath(fromObject, ['name']);
9414
+ if (fromModel != null) {
9415
+ setValueByPath(toObject, ['model'], fromModel);
9416
+ }
9417
+ const fromEndpoint = getValueByPath(fromObject, ['name']);
9418
+ if (fromEndpoint != null) {
9419
+ setValueByPath(toObject, ['endpoint'], fromEndpoint);
9420
+ }
9421
+ return toObject;
9422
+ }
9423
+ function tuningJobFromMldev(apiClient, fromObject) {
9424
+ const toObject = {};
9425
+ const fromName = getValueByPath(fromObject, ['name']);
9426
+ if (fromName != null) {
9427
+ setValueByPath(toObject, ['name'], fromName);
9428
+ }
9429
+ const fromState = getValueByPath(fromObject, ['state']);
9430
+ if (fromState != null) {
9431
+ setValueByPath(toObject, ['state'], tTuningJobStatus(apiClient, fromState));
9432
+ }
9433
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
9434
+ if (fromCreateTime != null) {
9435
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
9436
+ }
9437
+ const fromStartTime = getValueByPath(fromObject, [
9438
+ 'tuningTask',
9439
+ 'startTime',
9440
+ ]);
9441
+ if (fromStartTime != null) {
9442
+ setValueByPath(toObject, ['startTime'], fromStartTime);
9443
+ }
9444
+ const fromEndTime = getValueByPath(fromObject, [
9445
+ 'tuningTask',
9446
+ 'completeTime',
9447
+ ]);
9448
+ if (fromEndTime != null) {
9449
+ setValueByPath(toObject, ['endTime'], fromEndTime);
9450
+ }
9451
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
9452
+ if (fromUpdateTime != null) {
9453
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
9454
+ }
9455
+ const fromDescription = getValueByPath(fromObject, ['description']);
9456
+ if (fromDescription != null) {
9457
+ setValueByPath(toObject, ['description'], fromDescription);
9458
+ }
9459
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9460
+ if (fromBaseModel != null) {
9461
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9462
+ }
9463
+ const fromTunedModel = getValueByPath(fromObject, ['_self']);
9464
+ if (fromTunedModel != null) {
9465
+ setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(apiClient, fromTunedModel));
9466
+ }
9467
+ const fromDistillationSpec = getValueByPath(fromObject, [
9468
+ 'distillationSpec',
9469
+ ]);
9470
+ if (fromDistillationSpec != null) {
9471
+ setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
9472
+ }
9473
+ const fromExperiment = getValueByPath(fromObject, ['experiment']);
9474
+ if (fromExperiment != null) {
9475
+ setValueByPath(toObject, ['experiment'], fromExperiment);
9476
+ }
9477
+ const fromLabels = getValueByPath(fromObject, ['labels']);
9478
+ if (fromLabels != null) {
9479
+ setValueByPath(toObject, ['labels'], fromLabels);
9480
+ }
9481
+ const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
9482
+ if (fromPipelineJob != null) {
9483
+ setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
9484
+ }
9485
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9486
+ 'tunedModelDisplayName',
9487
+ ]);
9488
+ if (fromTunedModelDisplayName != null) {
9489
+ setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
9490
+ }
9491
+ return toObject;
9492
+ }
9493
+ function listTuningJobsResponseFromMldev(apiClient, fromObject) {
9494
+ const toObject = {};
9495
+ const fromNextPageToken = getValueByPath(fromObject, [
9496
+ 'nextPageToken',
9497
+ ]);
9498
+ if (fromNextPageToken != null) {
9499
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
9500
+ }
9501
+ const fromTuningJobs = getValueByPath(fromObject, ['tunedModels']);
9502
+ if (fromTuningJobs != null) {
9503
+ let transformedList = fromTuningJobs;
9504
+ if (Array.isArray(transformedList)) {
9505
+ transformedList = transformedList.map((item) => {
9506
+ return tuningJobFromMldev(apiClient, item);
9507
+ });
9508
+ }
9509
+ setValueByPath(toObject, ['tuningJobs'], transformedList);
9510
+ }
9511
+ return toObject;
9512
+ }
9513
+ function operationFromMldev(apiClient, fromObject) {
9514
+ const toObject = {};
9515
+ const fromName = getValueByPath(fromObject, ['name']);
9516
+ if (fromName != null) {
9517
+ setValueByPath(toObject, ['name'], fromName);
9518
+ }
9519
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
9520
+ if (fromMetadata != null) {
9521
+ setValueByPath(toObject, ['metadata'], fromMetadata);
9522
+ }
9523
+ const fromDone = getValueByPath(fromObject, ['done']);
9524
+ if (fromDone != null) {
9525
+ setValueByPath(toObject, ['done'], fromDone);
9526
+ }
9527
+ const fromError = getValueByPath(fromObject, ['error']);
9528
+ if (fromError != null) {
9529
+ setValueByPath(toObject, ['error'], fromError);
9530
+ }
9531
+ return toObject;
9532
+ }
9533
+ function tunedModelFromVertex(apiClient, fromObject) {
9534
+ const toObject = {};
9535
+ const fromModel = getValueByPath(fromObject, ['model']);
9536
+ if (fromModel != null) {
9537
+ setValueByPath(toObject, ['model'], fromModel);
9538
+ }
9539
+ const fromEndpoint = getValueByPath(fromObject, ['endpoint']);
9540
+ if (fromEndpoint != null) {
9541
+ setValueByPath(toObject, ['endpoint'], fromEndpoint);
9542
+ }
9543
+ return toObject;
9544
+ }
9545
+ function tuningJobFromVertex(apiClient, fromObject) {
9546
+ const toObject = {};
9547
+ const fromName = getValueByPath(fromObject, ['name']);
9548
+ if (fromName != null) {
9549
+ setValueByPath(toObject, ['name'], fromName);
9550
+ }
9551
+ const fromState = getValueByPath(fromObject, ['state']);
9552
+ if (fromState != null) {
9553
+ setValueByPath(toObject, ['state'], tTuningJobStatus(apiClient, fromState));
9554
+ }
9555
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
9556
+ if (fromCreateTime != null) {
9557
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
9558
+ }
9559
+ const fromStartTime = getValueByPath(fromObject, ['startTime']);
9560
+ if (fromStartTime != null) {
9561
+ setValueByPath(toObject, ['startTime'], fromStartTime);
9562
+ }
9563
+ const fromEndTime = getValueByPath(fromObject, ['endTime']);
9564
+ if (fromEndTime != null) {
9565
+ setValueByPath(toObject, ['endTime'], fromEndTime);
9566
+ }
9567
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
9568
+ if (fromUpdateTime != null) {
9569
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
9570
+ }
9571
+ const fromError = getValueByPath(fromObject, ['error']);
9572
+ if (fromError != null) {
9573
+ setValueByPath(toObject, ['error'], fromError);
9574
+ }
9575
+ const fromDescription = getValueByPath(fromObject, ['description']);
9576
+ if (fromDescription != null) {
9577
+ setValueByPath(toObject, ['description'], fromDescription);
9578
+ }
9579
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
9580
+ if (fromBaseModel != null) {
9581
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
9582
+ }
9583
+ const fromTunedModel = getValueByPath(fromObject, ['tunedModel']);
9584
+ if (fromTunedModel != null) {
9585
+ setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(apiClient, fromTunedModel));
9586
+ }
9587
+ const fromSupervisedTuningSpec = getValueByPath(fromObject, [
9588
+ 'supervisedTuningSpec',
9589
+ ]);
9590
+ if (fromSupervisedTuningSpec != null) {
9591
+ setValueByPath(toObject, ['supervisedTuningSpec'], fromSupervisedTuningSpec);
9592
+ }
9593
+ const fromTuningDataStats = getValueByPath(fromObject, [
9594
+ 'tuningDataStats',
9595
+ ]);
9596
+ if (fromTuningDataStats != null) {
9597
+ setValueByPath(toObject, ['tuningDataStats'], fromTuningDataStats);
9598
+ }
9599
+ const fromEncryptionSpec = getValueByPath(fromObject, [
9600
+ 'encryptionSpec',
9601
+ ]);
9602
+ if (fromEncryptionSpec != null) {
9603
+ setValueByPath(toObject, ['encryptionSpec'], fromEncryptionSpec);
9604
+ }
9605
+ const fromPartnerModelTuningSpec = getValueByPath(fromObject, [
9606
+ 'partnerModelTuningSpec',
9607
+ ]);
9608
+ if (fromPartnerModelTuningSpec != null) {
9609
+ setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
9610
+ }
9611
+ const fromDistillationSpec = getValueByPath(fromObject, [
9612
+ 'distillationSpec',
9613
+ ]);
9614
+ if (fromDistillationSpec != null) {
9615
+ setValueByPath(toObject, ['distillationSpec'], fromDistillationSpec);
9616
+ }
9617
+ const fromExperiment = getValueByPath(fromObject, ['experiment']);
9618
+ if (fromExperiment != null) {
9619
+ setValueByPath(toObject, ['experiment'], fromExperiment);
9620
+ }
9621
+ const fromLabels = getValueByPath(fromObject, ['labels']);
9622
+ if (fromLabels != null) {
9623
+ setValueByPath(toObject, ['labels'], fromLabels);
9624
+ }
9625
+ const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
9626
+ if (fromPipelineJob != null) {
9627
+ setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
9628
+ }
9629
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
9630
+ 'tunedModelDisplayName',
9631
+ ]);
9632
+ if (fromTunedModelDisplayName != null) {
9633
+ setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
9634
+ }
9635
+ return toObject;
9636
+ }
9637
+ function listTuningJobsResponseFromVertex(apiClient, fromObject) {
9638
+ const toObject = {};
9639
+ const fromNextPageToken = getValueByPath(fromObject, [
9640
+ 'nextPageToken',
9641
+ ]);
9642
+ if (fromNextPageToken != null) {
9643
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
9644
+ }
9645
+ const fromTuningJobs = getValueByPath(fromObject, ['tuningJobs']);
9646
+ if (fromTuningJobs != null) {
9647
+ let transformedList = fromTuningJobs;
9648
+ if (Array.isArray(transformedList)) {
9649
+ transformedList = transformedList.map((item) => {
9650
+ return tuningJobFromVertex(apiClient, item);
9651
+ });
9652
+ }
9653
+ setValueByPath(toObject, ['tuningJobs'], transformedList);
9654
+ }
9655
+ return toObject;
9656
+ }
9657
+
9658
+ /**
9659
+ * @license
9660
+ * Copyright 2025 Google LLC
9661
+ * SPDX-License-Identifier: Apache-2.0
9662
+ */
9663
+ class Tunings extends BaseModule {
9664
+ constructor(apiClient) {
9665
+ super();
9666
+ this.apiClient = apiClient;
9667
+ /**
9668
+ * Gets a TuningJob.
9669
+ *
9670
+ * @param name - The resource name of the tuning job.
9671
+ * @return - A TuningJob object.
9672
+ *
9673
+ * @experimental - The SDK's tuning implementation is experimental, and may
9674
+ * change in future versions.
9675
+ */
9676
+ this.get = async (params) => {
9677
+ return await this.getInternal(params);
9678
+ };
9679
+ /**
9680
+ * Lists tuning jobs.
9681
+ *
9682
+ * @param config - The configuration for the list request.
9683
+ * @return - A list of tuning jobs.
9684
+ *
9685
+ * @experimental - The SDK's tuning implementation is experimental, and may
9686
+ * change in future versions.
9687
+ */
9688
+ this.list = async (params = {}) => {
9689
+ return new Pager(exports.PagedItem.PAGED_ITEM_TUNING_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
9690
+ };
9691
+ /**
9692
+ * Creates a supervised fine-tuning job.
9693
+ *
9694
+ * @param params - The parameters for the tuning job.
9695
+ * @return - A TuningJob operation.
9696
+ *
9697
+ * @experimental - The SDK's tuning implementation is experimental, and may
9698
+ * change in future versions.
9699
+ */
9700
+ this.tune = async (params) => {
9701
+ if (this.apiClient.isVertexAI()) {
9702
+ return await this.tuneInternal(params);
9703
+ }
9704
+ else {
9705
+ const operation = await this.tuneMldevInternal(params);
9706
+ let tunedModelName = '';
9707
+ if (operation['metadata'] !== undefined &&
9708
+ operation['metadata']['tunedModel'] !== undefined) {
9709
+ tunedModelName = operation['metadata']['tunedModel'];
9710
+ }
9711
+ else if (operation['name'] !== undefined &&
9712
+ operation['name'].includes('/operations/')) {
9713
+ tunedModelName = operation['name'].split('/operations/')[0];
9714
+ }
9715
+ const tuningJob = {
9716
+ name: tunedModelName,
9717
+ state: exports.JobState.JOB_STATE_QUEUED,
9718
+ };
9719
+ return tuningJob;
9720
+ }
9721
+ };
9722
+ }
9723
+ async getInternal(params) {
9724
+ var _a, _b, _c, _d;
9725
+ let response;
9726
+ let path = '';
9727
+ let queryParams = {};
9728
+ if (this.apiClient.isVertexAI()) {
9729
+ const body = getTuningJobParametersToVertex(this.apiClient, params);
9730
+ path = formatMap('{name}', body['_url']);
9731
+ queryParams = body['_query'];
9732
+ delete body['config'];
9733
+ delete body['_url'];
9734
+ delete body['_query'];
9735
+ response = this.apiClient
9736
+ .request({
9737
+ path: path,
9738
+ queryParams: queryParams,
9739
+ body: JSON.stringify(body),
9740
+ httpMethod: 'GET',
9741
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9742
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9743
+ })
9744
+ .then((httpResponse) => {
9745
+ return httpResponse.json();
9746
+ });
9747
+ return response.then((apiResponse) => {
9748
+ const resp = tuningJobFromVertex(this.apiClient, apiResponse);
9749
+ return resp;
9750
+ });
9751
+ }
9752
+ else {
9753
+ const body = getTuningJobParametersToMldev(this.apiClient, params);
9754
+ path = formatMap('{name}', body['_url']);
9755
+ queryParams = body['_query'];
9756
+ delete body['config'];
9757
+ delete body['_url'];
9758
+ delete body['_query'];
9759
+ response = this.apiClient
9760
+ .request({
9761
+ path: path,
9762
+ queryParams: queryParams,
9763
+ body: JSON.stringify(body),
9764
+ httpMethod: 'GET',
9765
+ httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
9766
+ abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
9767
+ })
9768
+ .then((httpResponse) => {
9769
+ return httpResponse.json();
9770
+ });
9771
+ return response.then((apiResponse) => {
9772
+ const resp = tuningJobFromMldev(this.apiClient, apiResponse);
9773
+ return resp;
9774
+ });
9775
+ }
9776
+ }
9777
+ async listInternal(params) {
9778
+ var _a, _b, _c, _d;
9779
+ let response;
9780
+ let path = '';
9781
+ let queryParams = {};
9782
+ if (this.apiClient.isVertexAI()) {
9783
+ const body = listTuningJobsParametersToVertex(this.apiClient, params);
9784
+ path = formatMap('tuningJobs', body['_url']);
9785
+ queryParams = body['_query'];
9786
+ delete body['config'];
9787
+ delete body['_url'];
9788
+ delete body['_query'];
9789
+ response = this.apiClient
9790
+ .request({
9791
+ path: path,
9792
+ queryParams: queryParams,
9793
+ body: JSON.stringify(body),
9794
+ httpMethod: 'GET',
9795
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9796
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9797
+ })
9798
+ .then((httpResponse) => {
9799
+ return httpResponse.json();
9800
+ });
9801
+ return response.then((apiResponse) => {
9802
+ const resp = listTuningJobsResponseFromVertex(this.apiClient, apiResponse);
9803
+ const typedResp = new ListTuningJobsResponse();
9804
+ Object.assign(typedResp, resp);
9805
+ return typedResp;
9806
+ });
9807
+ }
9808
+ else {
9809
+ const body = listTuningJobsParametersToMldev(this.apiClient, params);
9810
+ path = formatMap('tunedModels', 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 = listTuningJobsResponseFromMldev(this.apiClient, apiResponse);
9829
+ const typedResp = new ListTuningJobsResponse();
9830
+ Object.assign(typedResp, resp);
9831
+ return typedResp;
9832
+ });
9833
+ }
9834
+ }
9835
+ async tuneInternal(params) {
9836
+ var _a, _b;
9837
+ let response;
9838
+ let path = '';
9839
+ let queryParams = {};
9840
+ if (this.apiClient.isVertexAI()) {
9841
+ const body = createTuningJobParametersToVertex(this.apiClient, params);
9842
+ path = formatMap('tuningJobs', body['_url']);
9843
+ queryParams = body['_query'];
9844
+ delete body['config'];
9845
+ delete body['_url'];
9846
+ delete body['_query'];
9847
+ response = this.apiClient
9848
+ .request({
9849
+ path: path,
9850
+ queryParams: queryParams,
9851
+ body: JSON.stringify(body),
9852
+ httpMethod: 'POST',
9853
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9854
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9855
+ })
9856
+ .then((httpResponse) => {
9857
+ return httpResponse.json();
9858
+ });
9859
+ return response.then((apiResponse) => {
9860
+ const resp = tuningJobFromVertex(this.apiClient, apiResponse);
9861
+ return resp;
9862
+ });
9863
+ }
9864
+ else {
9865
+ throw new Error('This method is only supported by the Vertex AI.');
9866
+ }
9867
+ }
9868
+ async tuneMldevInternal(params) {
9869
+ var _a, _b;
9870
+ let response;
9871
+ let path = '';
9872
+ let queryParams = {};
9873
+ if (this.apiClient.isVertexAI()) {
9874
+ throw new Error('This method is only supported by the Gemini Developer API.');
9875
+ }
9876
+ else {
9877
+ const body = createTuningJobParametersToMldev(this.apiClient, params);
9878
+ path = formatMap('tunedModels', body['_url']);
9879
+ queryParams = body['_query'];
9880
+ delete body['config'];
9881
+ delete body['_url'];
9882
+ delete body['_query'];
9883
+ response = this.apiClient
9884
+ .request({
9885
+ path: path,
9886
+ queryParams: queryParams,
9887
+ body: JSON.stringify(body),
9888
+ httpMethod: 'POST',
9889
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
9890
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
9891
+ })
9892
+ .then((httpResponse) => {
9893
+ return httpResponse.json();
9894
+ });
9895
+ return response.then((apiResponse) => {
9896
+ const resp = operationFromMldev(this.apiClient, apiResponse);
9897
+ return resp;
9898
+ });
9899
+ }
9900
+ }
9901
+ }
9902
+
9480
9903
  /**
9481
9904
  * @license
9482
9905
  * Copyright 2025 Google LLC
@@ -9558,6 +9981,7 @@ class GoogleGenAI {
9558
9981
  this.caches = new Caches(this.apiClient);
9559
9982
  this.files = new Files(this.apiClient);
9560
9983
  this.operations = new Operations(this.apiClient);
9984
+ this.tunings = new Tunings(this.apiClient);
9561
9985
  }
9562
9986
  }
9563
9987
 
@@ -9569,6 +9993,7 @@ exports.CountTokensResponse = CountTokensResponse;
9569
9993
  exports.CreateFileResponse = CreateFileResponse;
9570
9994
  exports.DeleteCachedContentResponse = DeleteCachedContentResponse;
9571
9995
  exports.DeleteFileResponse = DeleteFileResponse;
9996
+ exports.DeleteModelResponse = DeleteModelResponse;
9572
9997
  exports.EmbedContentResponse = EmbedContentResponse;
9573
9998
  exports.Files = Files;
9574
9999
  exports.FunctionResponse = FunctionResponse;
@@ -9581,6 +10006,7 @@ exports.GoogleGenAI = GoogleGenAI;
9581
10006
  exports.HttpResponse = HttpResponse;
9582
10007
  exports.ListCachedContentsResponse = ListCachedContentsResponse;
9583
10008
  exports.ListFilesResponse = ListFilesResponse;
10009
+ exports.ListTuningJobsResponse = ListTuningJobsResponse;
9584
10010
  exports.Live = Live;
9585
10011
  exports.LiveClientToolResponse = LiveClientToolResponse;
9586
10012
  exports.LiveSendToolResponseParameters = LiveSendToolResponseParameters;