@google/genai 1.27.0 → 1.28.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.
@@ -1,8 +1,10 @@
1
1
  import { GoogleAuth } from 'google-auth-library';
2
- import { createWriteStream, writeFile } from 'fs';
2
+ import { createWriteStream } from 'fs';
3
+ import * as fs from 'fs/promises';
4
+ import { writeFile } from 'fs/promises';
3
5
  import { Readable } from 'node:stream';
6
+ import { finished } from 'node:stream/promises';
4
7
  import * as NodeWs from 'ws';
5
- import * as fs from 'fs/promises';
6
8
 
7
9
  /**
8
10
  * @license
@@ -506,7 +508,7 @@ function videoFromVertex$1(fromObject) {
506
508
  * Copyright 2025 Google LLC
507
509
  * SPDX-License-Identifier: Apache-2.0
508
510
  */
509
- /** Required. Outcome of the code execution. */
511
+ /** Outcome of the code execution. */
510
512
  var Outcome;
511
513
  (function (Outcome) {
512
514
  /**
@@ -526,7 +528,7 @@ var Outcome;
526
528
  */
527
529
  Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
528
530
  })(Outcome || (Outcome = {}));
529
- /** Required. Programming language of the `code`. */
531
+ /** Programming language of the `code`. */
530
532
  var Language;
531
533
  (function (Language) {
532
534
  /**
@@ -558,7 +560,7 @@ var FunctionResponseScheduling;
558
560
  */
559
561
  FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
560
562
  })(FunctionResponseScheduling || (FunctionResponseScheduling = {}));
561
- /** Optional. The type of the data. */
563
+ /** The type of the data. */
562
564
  var Type;
563
565
  (function (Type) {
564
566
  /**
@@ -594,7 +596,64 @@ var Type;
594
596
  */
595
597
  Type["NULL"] = "NULL";
596
598
  })(Type || (Type = {}));
597
- /** Required. Harm category. */
599
+ /** The mode of the predictor to be used in dynamic retrieval. */
600
+ var Mode;
601
+ (function (Mode) {
602
+ /**
603
+ * Always trigger retrieval.
604
+ */
605
+ Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
606
+ /**
607
+ * Run retrieval only when system decides it is necessary.
608
+ */
609
+ Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
610
+ })(Mode || (Mode = {}));
611
+ /** Type of auth scheme. This enum is not supported in Gemini API. */
612
+ var AuthType;
613
+ (function (AuthType) {
614
+ AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
615
+ /**
616
+ * No Auth.
617
+ */
618
+ AuthType["NO_AUTH"] = "NO_AUTH";
619
+ /**
620
+ * API Key Auth.
621
+ */
622
+ AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
623
+ /**
624
+ * HTTP Basic Auth.
625
+ */
626
+ AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
627
+ /**
628
+ * Google Service Account Auth.
629
+ */
630
+ AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
631
+ /**
632
+ * OAuth auth.
633
+ */
634
+ AuthType["OAUTH"] = "OAUTH";
635
+ /**
636
+ * OpenID Connect (OIDC) Auth.
637
+ */
638
+ AuthType["OIDC_AUTH"] = "OIDC_AUTH";
639
+ })(AuthType || (AuthType = {}));
640
+ /** The API spec that the external API implements. This enum is not supported in Gemini API. */
641
+ var ApiSpec;
642
+ (function (ApiSpec) {
643
+ /**
644
+ * Unspecified API spec. This value should not be used.
645
+ */
646
+ ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
647
+ /**
648
+ * Simple search API spec.
649
+ */
650
+ ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
651
+ /**
652
+ * Elastic search API spec.
653
+ */
654
+ ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
655
+ })(ApiSpec || (ApiSpec = {}));
656
+ /** Harm category. */
598
657
  var HarmCategory;
599
658
  (function (HarmCategory) {
600
659
  /**
@@ -642,7 +701,7 @@ var HarmCategory;
642
701
  */
643
702
  HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
644
703
  })(HarmCategory || (HarmCategory = {}));
645
- /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
704
+ /** Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. This enum is not supported in Gemini API. */
646
705
  var HarmBlockMethod;
647
706
  (function (HarmBlockMethod) {
648
707
  /**
@@ -658,7 +717,7 @@ var HarmBlockMethod;
658
717
  */
659
718
  HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
660
719
  })(HarmBlockMethod || (HarmBlockMethod = {}));
661
- /** Required. The harm block threshold. */
720
+ /** The harm block threshold. */
662
721
  var HarmBlockThreshold;
663
722
  (function (HarmBlockThreshold) {
664
723
  /**
@@ -686,87 +745,6 @@ var HarmBlockThreshold;
686
745
  */
687
746
  HarmBlockThreshold["OFF"] = "OFF";
688
747
  })(HarmBlockThreshold || (HarmBlockThreshold = {}));
689
- /** The mode of the predictor to be used in dynamic retrieval. */
690
- var Mode;
691
- (function (Mode) {
692
- /**
693
- * Always trigger retrieval.
694
- */
695
- Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
696
- /**
697
- * Run retrieval only when system decides it is necessary.
698
- */
699
- Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
700
- })(Mode || (Mode = {}));
701
- /** Type of auth scheme. */
702
- var AuthType;
703
- (function (AuthType) {
704
- AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
705
- /**
706
- * No Auth.
707
- */
708
- AuthType["NO_AUTH"] = "NO_AUTH";
709
- /**
710
- * API Key Auth.
711
- */
712
- AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
713
- /**
714
- * HTTP Basic Auth.
715
- */
716
- AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
717
- /**
718
- * Google Service Account Auth.
719
- */
720
- AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
721
- /**
722
- * OAuth auth.
723
- */
724
- AuthType["OAUTH"] = "OAUTH";
725
- /**
726
- * OpenID Connect (OIDC) Auth.
727
- */
728
- AuthType["OIDC_AUTH"] = "OIDC_AUTH";
729
- })(AuthType || (AuthType = {}));
730
- /** The API spec that the external API implements. */
731
- var ApiSpec;
732
- (function (ApiSpec) {
733
- /**
734
- * Unspecified API spec. This value should not be used.
735
- */
736
- ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
737
- /**
738
- * Simple search API spec.
739
- */
740
- ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
741
- /**
742
- * Elastic search API spec.
743
- */
744
- ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
745
- })(ApiSpec || (ApiSpec = {}));
746
- /** Status of the url retrieval. */
747
- var UrlRetrievalStatus;
748
- (function (UrlRetrievalStatus) {
749
- /**
750
- * Default value. This value is unused
751
- */
752
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
753
- /**
754
- * Url retrieval is successful.
755
- */
756
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
757
- /**
758
- * Url retrieval is failed due to error.
759
- */
760
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
761
- /**
762
- * Url retrieval is failed because the content is behind paywall.
763
- */
764
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
765
- /**
766
- * Url retrieval is failed because the content is unsafe.
767
- */
768
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
769
- })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
770
748
  /** Output only. The reason why the model stopped generating tokens.
771
749
 
772
750
  If empty, the model has not stopped generating the tokens. */
@@ -857,7 +835,7 @@ var HarmProbability;
857
835
  */
858
836
  HarmProbability["HIGH"] = "HIGH";
859
837
  })(HarmProbability || (HarmProbability = {}));
860
- /** Output only. Harm severity levels in the content. */
838
+ /** Output only. Harm severity levels in the content. This enum is not supported in Gemini API. */
861
839
  var HarmSeverity;
862
840
  (function (HarmSeverity) {
863
841
  /**
@@ -881,6 +859,30 @@ var HarmSeverity;
881
859
  */
882
860
  HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
883
861
  })(HarmSeverity || (HarmSeverity = {}));
862
+ /** Status of the url retrieval. */
863
+ var UrlRetrievalStatus;
864
+ (function (UrlRetrievalStatus) {
865
+ /**
866
+ * Default value. This value is unused.
867
+ */
868
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
869
+ /**
870
+ * Url retrieval is successful.
871
+ */
872
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
873
+ /**
874
+ * Url retrieval is failed due to error.
875
+ */
876
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
877
+ /**
878
+ * Url retrieval is failed because the content is behind paywall. This enum value is not supported in Vertex AI.
879
+ */
880
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
881
+ /**
882
+ * Url retrieval is failed because the content is unsafe. This enum value is not supported in Vertex AI.
883
+ */
884
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
885
+ })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
884
886
  /** Output only. The reason why the prompt was blocked. */
885
887
  var BlockedReason;
886
888
  (function (BlockedReason) {
@@ -917,7 +919,7 @@ var BlockedReason;
917
919
  */
918
920
  BlockedReason["JAILBREAK"] = "JAILBREAK";
919
921
  })(BlockedReason || (BlockedReason = {}));
920
- /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
922
+ /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. This enum is not supported in Gemini API. */
921
923
  var TrafficType;
922
924
  (function (TrafficType) {
923
925
  /**
@@ -973,6 +975,54 @@ var MediaResolution;
973
975
  */
974
976
  MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
975
977
  })(MediaResolution || (MediaResolution = {}));
978
+ /** Tuning mode. This enum is not supported in Gemini API. */
979
+ var TuningMode;
980
+ (function (TuningMode) {
981
+ /**
982
+ * Tuning mode is unspecified.
983
+ */
984
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
985
+ /**
986
+ * Full fine-tuning mode.
987
+ */
988
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
989
+ /**
990
+ * PEFT adapter tuning mode.
991
+ */
992
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
993
+ })(TuningMode || (TuningMode = {}));
994
+ /** Adapter size for tuning. This enum is not supported in Gemini API. */
995
+ var AdapterSize;
996
+ (function (AdapterSize) {
997
+ /**
998
+ * Adapter size is unspecified.
999
+ */
1000
+ AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1001
+ /**
1002
+ * Adapter size 1.
1003
+ */
1004
+ AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1005
+ /**
1006
+ * Adapter size 2.
1007
+ */
1008
+ AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1009
+ /**
1010
+ * Adapter size 4.
1011
+ */
1012
+ AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1013
+ /**
1014
+ * Adapter size 8.
1015
+ */
1016
+ AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1017
+ /**
1018
+ * Adapter size 16.
1019
+ */
1020
+ AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1021
+ /**
1022
+ * Adapter size 32.
1023
+ */
1024
+ AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1025
+ })(AdapterSize || (AdapterSize = {}));
976
1026
  /** Job state. */
977
1027
  var JobState;
978
1028
  (function (JobState) {
@@ -1025,55 +1075,7 @@ var JobState;
1025
1075
  */
1026
1076
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
1027
1077
  })(JobState || (JobState = {}));
1028
- /** Tuning mode. */
1029
- var TuningMode;
1030
- (function (TuningMode) {
1031
- /**
1032
- * Tuning mode is unspecified.
1033
- */
1034
- TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
1035
- /**
1036
- * Full fine-tuning mode.
1037
- */
1038
- TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
1039
- /**
1040
- * PEFT adapter tuning mode.
1041
- */
1042
- TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
1043
- })(TuningMode || (TuningMode = {}));
1044
- /** Optional. Adapter size for tuning. */
1045
- var AdapterSize;
1046
- (function (AdapterSize) {
1047
- /**
1048
- * Adapter size is unspecified.
1049
- */
1050
- AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1051
- /**
1052
- * Adapter size 1.
1053
- */
1054
- AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1055
- /**
1056
- * Adapter size 2.
1057
- */
1058
- AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1059
- /**
1060
- * Adapter size 4.
1061
- */
1062
- AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1063
- /**
1064
- * Adapter size 8.
1065
- */
1066
- AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1067
- /**
1068
- * Adapter size 16.
1069
- */
1070
- AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1071
- /**
1072
- * Adapter size 32.
1073
- */
1074
- AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1075
- })(AdapterSize || (AdapterSize = {}));
1076
- /** Optional. The tuning task. Either I2V or T2V. */
1078
+ /** The tuning task. Either I2V or T2V. This enum is not supported in Gemini API. */
1077
1079
  var TuningTask;
1078
1080
  (function (TuningTask) {
1079
1081
  /**
@@ -1323,6 +1325,18 @@ var VideoCompressionQuality;
1323
1325
  */
1324
1326
  VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
1325
1327
  })(VideoCompressionQuality || (VideoCompressionQuality = {}));
1328
+ /** Enum representing the tuning method. */
1329
+ var TuningMethod;
1330
+ (function (TuningMethod) {
1331
+ /**
1332
+ * Supervised fine tuning.
1333
+ */
1334
+ TuningMethod["SUPERVISED_FINE_TUNING"] = "SUPERVISED_FINE_TUNING";
1335
+ /**
1336
+ * Preference optimization tuning.
1337
+ */
1338
+ TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
1339
+ })(TuningMethod || (TuningMethod = {}));
1326
1340
  /** State for the lifecycle of a File. */
1327
1341
  var FileState;
1328
1342
  (function (FileState) {
@@ -3342,13 +3356,13 @@ function batchJobSourceToVertex(fromObject) {
3342
3356
  }
3343
3357
  function blobToMldev$4(fromObject) {
3344
3358
  const toObject = {};
3345
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
3346
- throw new Error('displayName parameter is not supported in Gemini API.');
3347
- }
3348
3359
  const fromData = getValueByPath(fromObject, ['data']);
3349
3360
  if (fromData != null) {
3350
3361
  setValueByPath(toObject, ['data'], fromData);
3351
3362
  }
3363
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
3364
+ throw new Error('displayName parameter is not supported in Gemini API.');
3365
+ }
3352
3366
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
3353
3367
  if (fromMimeType != null) {
3354
3368
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -3391,12 +3405,6 @@ function candidateFromMldev$1(fromObject) {
3391
3405
  if (fromFinishReason != null) {
3392
3406
  setValueByPath(toObject, ['finishReason'], fromFinishReason);
3393
3407
  }
3394
- const fromUrlContextMetadata = getValueByPath(fromObject, [
3395
- 'urlContextMetadata',
3396
- ]);
3397
- if (fromUrlContextMetadata != null) {
3398
- setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
3399
- }
3400
3408
  const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
3401
3409
  if (fromAvgLogprobs != null) {
3402
3410
  setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
@@ -3429,6 +3437,12 @@ function candidateFromMldev$1(fromObject) {
3429
3437
  }
3430
3438
  setValueByPath(toObject, ['safetyRatings'], transformedList);
3431
3439
  }
3440
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
3441
+ 'urlContextMetadata',
3442
+ ]);
3443
+ if (fromUrlContextMetadata != null) {
3444
+ setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
3445
+ }
3432
3446
  return toObject;
3433
3447
  }
3434
3448
  function citationMetadataFromMldev$1(fromObject) {
@@ -3897,15 +3911,15 @@ function googleMapsToMldev$4(fromObject) {
3897
3911
  }
3898
3912
  function googleSearchToMldev$4(fromObject) {
3899
3913
  const toObject = {};
3914
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
3915
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
3916
+ }
3900
3917
  const fromTimeRangeFilter = getValueByPath(fromObject, [
3901
3918
  'timeRangeFilter',
3902
3919
  ]);
3903
3920
  if (fromTimeRangeFilter != null) {
3904
3921
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
3905
3922
  }
3906
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
3907
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
3908
- }
3909
3923
  return toObject;
3910
3924
  }
3911
3925
  function inlinedRequestToMldev(apiClient, fromObject) {
@@ -4049,30 +4063,6 @@ function listBatchJobsResponseFromVertex(fromObject) {
4049
4063
  }
4050
4064
  function partToMldev$4(fromObject) {
4051
4065
  const toObject = {};
4052
- const fromVideoMetadata = getValueByPath(fromObject, [
4053
- 'videoMetadata',
4054
- ]);
4055
- if (fromVideoMetadata != null) {
4056
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4057
- }
4058
- const fromThought = getValueByPath(fromObject, ['thought']);
4059
- if (fromThought != null) {
4060
- setValueByPath(toObject, ['thought'], fromThought);
4061
- }
4062
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4063
- if (fromInlineData != null) {
4064
- setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
4065
- }
4066
- const fromFileData = getValueByPath(fromObject, ['fileData']);
4067
- if (fromFileData != null) {
4068
- setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4069
- }
4070
- const fromThoughtSignature = getValueByPath(fromObject, [
4071
- 'thoughtSignature',
4072
- ]);
4073
- if (fromThoughtSignature != null) {
4074
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
4075
- }
4076
4066
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4077
4067
  if (fromFunctionCall != null) {
4078
4068
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -4089,27 +4079,51 @@ function partToMldev$4(fromObject) {
4089
4079
  if (fromExecutableCode != null) {
4090
4080
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4091
4081
  }
4082
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
4083
+ if (fromFileData != null) {
4084
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4085
+ }
4092
4086
  const fromFunctionResponse = getValueByPath(fromObject, [
4093
4087
  'functionResponse',
4094
4088
  ]);
4095
4089
  if (fromFunctionResponse != null) {
4096
4090
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4097
4091
  }
4092
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4093
+ if (fromInlineData != null) {
4094
+ setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
4095
+ }
4098
4096
  const fromText = getValueByPath(fromObject, ['text']);
4099
4097
  if (fromText != null) {
4100
4098
  setValueByPath(toObject, ['text'], fromText);
4101
4099
  }
4100
+ const fromThought = getValueByPath(fromObject, ['thought']);
4101
+ if (fromThought != null) {
4102
+ setValueByPath(toObject, ['thought'], fromThought);
4103
+ }
4104
+ const fromThoughtSignature = getValueByPath(fromObject, [
4105
+ 'thoughtSignature',
4106
+ ]);
4107
+ if (fromThoughtSignature != null) {
4108
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
4109
+ }
4110
+ const fromVideoMetadata = getValueByPath(fromObject, [
4111
+ 'videoMetadata',
4112
+ ]);
4113
+ if (fromVideoMetadata != null) {
4114
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4115
+ }
4102
4116
  return toObject;
4103
4117
  }
4104
4118
  function safetySettingToMldev$1(fromObject) {
4105
4119
  const toObject = {};
4106
- if (getValueByPath(fromObject, ['method']) !== undefined) {
4107
- throw new Error('method parameter is not supported in Gemini API.');
4108
- }
4109
4120
  const fromCategory = getValueByPath(fromObject, ['category']);
4110
4121
  if (fromCategory != null) {
4111
4122
  setValueByPath(toObject, ['category'], fromCategory);
4112
4123
  }
4124
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
4125
+ throw new Error('method parameter is not supported in Gemini API.');
4126
+ }
4113
4127
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
4114
4128
  if (fromThreshold != null) {
4115
4129
  setValueByPath(toObject, ['threshold'], fromThreshold);
@@ -4133,27 +4147,16 @@ function toolToMldev$4(fromObject) {
4133
4147
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4134
4148
  throw new Error('retrieval parameter is not supported in Gemini API.');
4135
4149
  }
4136
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4137
- if (fromGoogleSearch != null) {
4138
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
4139
- }
4140
4150
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4141
4151
  'googleSearchRetrieval',
4142
4152
  ]);
4143
4153
  if (fromGoogleSearchRetrieval != null) {
4144
4154
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
4145
4155
  }
4146
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4147
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4148
- }
4149
4156
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
4150
4157
  if (fromGoogleMaps != null) {
4151
4158
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4152
4159
  }
4153
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
4154
- if (fromUrlContext != null) {
4155
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
4156
- }
4157
4160
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4158
4161
  if (fromComputerUse != null) {
4159
4162
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -4164,6 +4167,17 @@ function toolToMldev$4(fromObject) {
4164
4167
  if (fromCodeExecution != null) {
4165
4168
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4166
4169
  }
4170
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4171
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4172
+ }
4173
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4174
+ if (fromGoogleSearch != null) {
4175
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
4176
+ }
4177
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
4178
+ if (fromUrlContext != null) {
4179
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
4180
+ }
4167
4181
  return toObject;
4168
4182
  }
4169
4183
 
@@ -4179,6 +4193,8 @@ var PagedItem;
4179
4193
  PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
4180
4194
  PagedItem["PAGED_ITEM_FILES"] = "files";
4181
4195
  PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
4196
+ PagedItem["PAGED_ITEM_RAG_STORES"] = "ragStores";
4197
+ PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
4182
4198
  })(PagedItem || (PagedItem = {}));
4183
4199
  /**
4184
4200
  * Pager class for iterating through paginated results.
@@ -4859,13 +4875,13 @@ class Batches extends BaseModule {
4859
4875
  */
4860
4876
  function blobToMldev$3(fromObject) {
4861
4877
  const toObject = {};
4862
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
4863
- throw new Error('displayName parameter is not supported in Gemini API.');
4864
- }
4865
4878
  const fromData = getValueByPath(fromObject, ['data']);
4866
4879
  if (fromData != null) {
4867
4880
  setValueByPath(toObject, ['data'], fromData);
4868
4881
  }
4882
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
4883
+ throw new Error('displayName parameter is not supported in Gemini API.');
4884
+ }
4869
4885
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
4870
4886
  if (fromMimeType != null) {
4871
4887
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -5128,15 +5144,15 @@ function googleMapsToMldev$3(fromObject) {
5128
5144
  }
5129
5145
  function googleSearchToMldev$3(fromObject) {
5130
5146
  const toObject = {};
5147
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5148
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
5149
+ }
5131
5150
  const fromTimeRangeFilter = getValueByPath(fromObject, [
5132
5151
  'timeRangeFilter',
5133
5152
  ]);
5134
5153
  if (fromTimeRangeFilter != null) {
5135
5154
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
5136
5155
  }
5137
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5138
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
5139
- }
5140
5156
  return toObject;
5141
5157
  }
5142
5158
  function listCachedContentsConfigToMldev(fromObject, parentObject) {
@@ -5237,30 +5253,6 @@ function listCachedContentsResponseFromVertex(fromObject) {
5237
5253
  }
5238
5254
  function partToMldev$3(fromObject) {
5239
5255
  const toObject = {};
5240
- const fromVideoMetadata = getValueByPath(fromObject, [
5241
- 'videoMetadata',
5242
- ]);
5243
- if (fromVideoMetadata != null) {
5244
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
5245
- }
5246
- const fromThought = getValueByPath(fromObject, ['thought']);
5247
- if (fromThought != null) {
5248
- setValueByPath(toObject, ['thought'], fromThought);
5249
- }
5250
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5251
- if (fromInlineData != null) {
5252
- setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
5253
- }
5254
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5255
- if (fromFileData != null) {
5256
- setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5257
- }
5258
- const fromThoughtSignature = getValueByPath(fromObject, [
5259
- 'thoughtSignature',
5260
- ]);
5261
- if (fromThoughtSignature != null) {
5262
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5263
- }
5264
5256
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5265
5257
  if (fromFunctionCall != null) {
5266
5258
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -5277,16 +5269,40 @@ function partToMldev$3(fromObject) {
5277
5269
  if (fromExecutableCode != null) {
5278
5270
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5279
5271
  }
5272
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5273
+ if (fromFileData != null) {
5274
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5275
+ }
5280
5276
  const fromFunctionResponse = getValueByPath(fromObject, [
5281
5277
  'functionResponse',
5282
5278
  ]);
5283
5279
  if (fromFunctionResponse != null) {
5284
5280
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
5285
5281
  }
5282
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5283
+ if (fromInlineData != null) {
5284
+ setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
5285
+ }
5286
5286
  const fromText = getValueByPath(fromObject, ['text']);
5287
5287
  if (fromText != null) {
5288
5288
  setValueByPath(toObject, ['text'], fromText);
5289
5289
  }
5290
+ const fromThought = getValueByPath(fromObject, ['thought']);
5291
+ if (fromThought != null) {
5292
+ setValueByPath(toObject, ['thought'], fromThought);
5293
+ }
5294
+ const fromThoughtSignature = getValueByPath(fromObject, [
5295
+ 'thoughtSignature',
5296
+ ]);
5297
+ if (fromThoughtSignature != null) {
5298
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5299
+ }
5300
+ const fromVideoMetadata = getValueByPath(fromObject, [
5301
+ 'videoMetadata',
5302
+ ]);
5303
+ if (fromVideoMetadata != null) {
5304
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
5305
+ }
5290
5306
  return toObject;
5291
5307
  }
5292
5308
  function toolToMldev$3(fromObject) {
@@ -5306,27 +5322,16 @@ function toolToMldev$3(fromObject) {
5306
5322
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
5307
5323
  throw new Error('retrieval parameter is not supported in Gemini API.');
5308
5324
  }
5309
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5310
- if (fromGoogleSearch != null) {
5311
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
5312
- }
5313
5325
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5314
5326
  'googleSearchRetrieval',
5315
5327
  ]);
5316
5328
  if (fromGoogleSearchRetrieval != null) {
5317
5329
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5318
5330
  }
5319
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5320
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5321
- }
5322
5331
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5323
5332
  if (fromGoogleMaps != null) {
5324
5333
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5325
5334
  }
5326
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5327
- if (fromUrlContext != null) {
5328
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
5329
- }
5330
5335
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5331
5336
  if (fromComputerUse != null) {
5332
5337
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -5337,6 +5342,17 @@ function toolToMldev$3(fromObject) {
5337
5342
  if (fromCodeExecution != null) {
5338
5343
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5339
5344
  }
5345
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5346
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5347
+ }
5348
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5349
+ if (fromGoogleSearch != null) {
5350
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
5351
+ }
5352
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5353
+ if (fromUrlContext != null) {
5354
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
5355
+ }
5340
5356
  return toObject;
5341
5357
  }
5342
5358
  function toolToVertex$2(fromObject) {
@@ -5357,30 +5373,16 @@ function toolToVertex$2(fromObject) {
5357
5373
  if (fromRetrieval != null) {
5358
5374
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
5359
5375
  }
5360
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5361
- if (fromGoogleSearch != null) {
5362
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
5363
- }
5364
5376
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5365
5377
  'googleSearchRetrieval',
5366
5378
  ]);
5367
5379
  if (fromGoogleSearchRetrieval != null) {
5368
5380
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5369
5381
  }
5370
- const fromEnterpriseWebSearch = getValueByPath(fromObject, [
5371
- 'enterpriseWebSearch',
5372
- ]);
5373
- if (fromEnterpriseWebSearch != null) {
5374
- setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
5375
- }
5376
5382
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5377
5383
  if (fromGoogleMaps != null) {
5378
5384
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
5379
5385
  }
5380
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5381
- if (fromUrlContext != null) {
5382
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
5383
- }
5384
5386
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5385
5387
  if (fromComputerUse != null) {
5386
5388
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -5391,6 +5393,20 @@ function toolToVertex$2(fromObject) {
5391
5393
  if (fromCodeExecution != null) {
5392
5394
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5393
5395
  }
5396
+ const fromEnterpriseWebSearch = getValueByPath(fromObject, [
5397
+ 'enterpriseWebSearch',
5398
+ ]);
5399
+ if (fromEnterpriseWebSearch != null) {
5400
+ setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
5401
+ }
5402
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5403
+ if (fromGoogleSearch != null) {
5404
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
5405
+ }
5406
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5407
+ if (fromUrlContext != null) {
5408
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
5409
+ }
5394
5410
  return toObject;
5395
5411
  }
5396
5412
  function updateCachedContentConfigToMldev(fromObject, parentObject) {
@@ -6599,13 +6615,13 @@ class Files extends BaseModule {
6599
6615
  */
6600
6616
  function blobToMldev$2(fromObject) {
6601
6617
  const toObject = {};
6602
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
6603
- throw new Error('displayName parameter is not supported in Gemini API.');
6604
- }
6605
6618
  const fromData = getValueByPath(fromObject, ['data']);
6606
6619
  if (fromData != null) {
6607
6620
  setValueByPath(toObject, ['data'], fromData);
6608
6621
  }
6622
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
6623
+ throw new Error('displayName parameter is not supported in Gemini API.');
6624
+ }
6609
6625
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
6610
6626
  if (fromMimeType != null) {
6611
6627
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -6821,15 +6837,15 @@ function googleMapsToMldev$2(fromObject) {
6821
6837
  }
6822
6838
  function googleSearchToMldev$2(fromObject) {
6823
6839
  const toObject = {};
6840
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
6841
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
6842
+ }
6824
6843
  const fromTimeRangeFilter = getValueByPath(fromObject, [
6825
6844
  'timeRangeFilter',
6826
6845
  ]);
6827
6846
  if (fromTimeRangeFilter != null) {
6828
6847
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
6829
6848
  }
6830
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
6831
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
6832
- }
6833
6849
  return toObject;
6834
6850
  }
6835
6851
  function liveConnectConfigToMldev$1(fromObject, parentObject) {
@@ -7230,30 +7246,6 @@ function liveServerMessageFromVertex(fromObject) {
7230
7246
  }
7231
7247
  function partToMldev$2(fromObject) {
7232
7248
  const toObject = {};
7233
- const fromVideoMetadata = getValueByPath(fromObject, [
7234
- 'videoMetadata',
7235
- ]);
7236
- if (fromVideoMetadata != null) {
7237
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
7238
- }
7239
- const fromThought = getValueByPath(fromObject, ['thought']);
7240
- if (fromThought != null) {
7241
- setValueByPath(toObject, ['thought'], fromThought);
7242
- }
7243
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
7244
- if (fromInlineData != null) {
7245
- setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
7246
- }
7247
- const fromFileData = getValueByPath(fromObject, ['fileData']);
7248
- if (fromFileData != null) {
7249
- setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7250
- }
7251
- const fromThoughtSignature = getValueByPath(fromObject, [
7252
- 'thoughtSignature',
7253
- ]);
7254
- if (fromThoughtSignature != null) {
7255
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7256
- }
7257
7249
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7258
7250
  if (fromFunctionCall != null) {
7259
7251
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7270,16 +7262,40 @@ function partToMldev$2(fromObject) {
7270
7262
  if (fromExecutableCode != null) {
7271
7263
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7272
7264
  }
7265
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
7266
+ if (fromFileData != null) {
7267
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7268
+ }
7273
7269
  const fromFunctionResponse = getValueByPath(fromObject, [
7274
7270
  'functionResponse',
7275
7271
  ]);
7276
7272
  if (fromFunctionResponse != null) {
7277
7273
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
7278
7274
  }
7275
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
7276
+ if (fromInlineData != null) {
7277
+ setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
7278
+ }
7279
7279
  const fromText = getValueByPath(fromObject, ['text']);
7280
7280
  if (fromText != null) {
7281
7281
  setValueByPath(toObject, ['text'], fromText);
7282
7282
  }
7283
+ const fromThought = getValueByPath(fromObject, ['thought']);
7284
+ if (fromThought != null) {
7285
+ setValueByPath(toObject, ['thought'], fromThought);
7286
+ }
7287
+ const fromThoughtSignature = getValueByPath(fromObject, [
7288
+ 'thoughtSignature',
7289
+ ]);
7290
+ if (fromThoughtSignature != null) {
7291
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7292
+ }
7293
+ const fromVideoMetadata = getValueByPath(fromObject, [
7294
+ 'videoMetadata',
7295
+ ]);
7296
+ if (fromVideoMetadata != null) {
7297
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
7298
+ }
7283
7299
  return toObject;
7284
7300
  }
7285
7301
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -7295,6 +7311,10 @@ function sessionResumptionConfigToMldev$1(fromObject) {
7295
7311
  }
7296
7312
  function speechConfigToVertex$1(fromObject) {
7297
7313
  const toObject = {};
7314
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7315
+ if (fromLanguageCode != null) {
7316
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7317
+ }
7298
7318
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
7299
7319
  if (fromVoiceConfig != null) {
7300
7320
  setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
@@ -7302,10 +7322,6 @@ function speechConfigToVertex$1(fromObject) {
7302
7322
  if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
7303
7323
  throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
7304
7324
  }
7305
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7306
- if (fromLanguageCode != null) {
7307
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7308
- }
7309
7325
  return toObject;
7310
7326
  }
7311
7327
  function toolToMldev$2(fromObject) {
@@ -7325,27 +7341,16 @@ function toolToMldev$2(fromObject) {
7325
7341
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
7326
7342
  throw new Error('retrieval parameter is not supported in Gemini API.');
7327
7343
  }
7328
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7329
- if (fromGoogleSearch != null) {
7330
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
7331
- }
7332
7344
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7333
7345
  'googleSearchRetrieval',
7334
7346
  ]);
7335
7347
  if (fromGoogleSearchRetrieval != null) {
7336
7348
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7337
7349
  }
7338
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7339
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
7340
- }
7341
7350
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7342
7351
  if (fromGoogleMaps != null) {
7343
7352
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
7344
7353
  }
7345
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7346
- if (fromUrlContext != null) {
7347
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
7348
- }
7349
7354
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7350
7355
  if (fromComputerUse != null) {
7351
7356
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -7356,6 +7361,17 @@ function toolToMldev$2(fromObject) {
7356
7361
  if (fromCodeExecution != null) {
7357
7362
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7358
7363
  }
7364
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7365
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
7366
+ }
7367
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7368
+ if (fromGoogleSearch != null) {
7369
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
7370
+ }
7371
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7372
+ if (fromUrlContext != null) {
7373
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
7374
+ }
7359
7375
  return toObject;
7360
7376
  }
7361
7377
  function toolToVertex$1(fromObject) {
@@ -7376,30 +7392,16 @@ function toolToVertex$1(fromObject) {
7376
7392
  if (fromRetrieval != null) {
7377
7393
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
7378
7394
  }
7379
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7380
- if (fromGoogleSearch != null) {
7381
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
7382
- }
7383
7395
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7384
7396
  'googleSearchRetrieval',
7385
7397
  ]);
7386
7398
  if (fromGoogleSearchRetrieval != null) {
7387
7399
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7388
7400
  }
7389
- const fromEnterpriseWebSearch = getValueByPath(fromObject, [
7390
- 'enterpriseWebSearch',
7391
- ]);
7392
- if (fromEnterpriseWebSearch != null) {
7393
- setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
7394
- }
7395
7401
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7396
7402
  if (fromGoogleMaps != null) {
7397
7403
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
7398
7404
  }
7399
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7400
- if (fromUrlContext != null) {
7401
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
7402
- }
7403
7405
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7404
7406
  if (fromComputerUse != null) {
7405
7407
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -7410,6 +7412,20 @@ function toolToVertex$1(fromObject) {
7410
7412
  if (fromCodeExecution != null) {
7411
7413
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7412
7414
  }
7415
+ const fromEnterpriseWebSearch = getValueByPath(fromObject, [
7416
+ 'enterpriseWebSearch',
7417
+ ]);
7418
+ if (fromEnterpriseWebSearch != null) {
7419
+ setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
7420
+ }
7421
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7422
+ if (fromGoogleSearch != null) {
7423
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
7424
+ }
7425
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7426
+ if (fromUrlContext != null) {
7427
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
7428
+ }
7413
7429
  return toObject;
7414
7430
  }
7415
7431
  function usageMetadataFromVertex(fromObject) {
@@ -7512,13 +7528,13 @@ function usageMetadataFromVertex(fromObject) {
7512
7528
  */
7513
7529
  function blobToMldev$1(fromObject) {
7514
7530
  const toObject = {};
7515
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7516
- throw new Error('displayName parameter is not supported in Gemini API.');
7517
- }
7518
7531
  const fromData = getValueByPath(fromObject, ['data']);
7519
7532
  if (fromData != null) {
7520
7533
  setValueByPath(toObject, ['data'], fromData);
7521
7534
  }
7535
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7536
+ throw new Error('displayName parameter is not supported in Gemini API.');
7537
+ }
7522
7538
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
7523
7539
  if (fromMimeType != null) {
7524
7540
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -7545,12 +7561,6 @@ function candidateFromMldev(fromObject) {
7545
7561
  if (fromFinishReason != null) {
7546
7562
  setValueByPath(toObject, ['finishReason'], fromFinishReason);
7547
7563
  }
7548
- const fromUrlContextMetadata = getValueByPath(fromObject, [
7549
- 'urlContextMetadata',
7550
- ]);
7551
- if (fromUrlContextMetadata != null) {
7552
- setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
7553
- }
7554
7564
  const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
7555
7565
  if (fromAvgLogprobs != null) {
7556
7566
  setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
@@ -7583,6 +7593,12 @@ function candidateFromMldev(fromObject) {
7583
7593
  }
7584
7594
  setValueByPath(toObject, ['safetyRatings'], transformedList);
7585
7595
  }
7596
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
7597
+ 'urlContextMetadata',
7598
+ ]);
7599
+ if (fromUrlContextMetadata != null) {
7600
+ setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
7601
+ }
7586
7602
  return toObject;
7587
7603
  }
7588
7604
  function citationMetadataFromMldev(fromObject) {
@@ -9500,15 +9516,15 @@ function googleMapsToMldev$1(fromObject) {
9500
9516
  }
9501
9517
  function googleSearchToMldev$1(fromObject) {
9502
9518
  const toObject = {};
9519
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9520
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
9521
+ }
9503
9522
  const fromTimeRangeFilter = getValueByPath(fromObject, [
9504
9523
  'timeRangeFilter',
9505
9524
  ]);
9506
9525
  if (fromTimeRangeFilter != null) {
9507
9526
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
9508
9527
  }
9509
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9510
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
9511
- }
9512
9528
  return toObject;
9513
9529
  }
9514
9530
  function imageFromMldev(fromObject) {
@@ -9777,51 +9793,27 @@ function modelFromVertex(fromObject) {
9777
9793
  const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
9778
9794
  if (fromTunedModelInfo != null) {
9779
9795
  setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(fromTunedModelInfo));
9780
- }
9781
- const fromDefaultCheckpointId = getValueByPath(fromObject, [
9782
- 'defaultCheckpointId',
9783
- ]);
9784
- if (fromDefaultCheckpointId != null) {
9785
- setValueByPath(toObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
9786
- }
9787
- const fromCheckpoints = getValueByPath(fromObject, ['checkpoints']);
9788
- if (fromCheckpoints != null) {
9789
- let transformedList = fromCheckpoints;
9790
- if (Array.isArray(transformedList)) {
9791
- transformedList = transformedList.map((item) => {
9792
- return item;
9793
- });
9794
- }
9795
- setValueByPath(toObject, ['checkpoints'], transformedList);
9796
- }
9797
- return toObject;
9798
- }
9799
- function partToMldev$1(fromObject) {
9800
- const toObject = {};
9801
- const fromVideoMetadata = getValueByPath(fromObject, [
9802
- 'videoMetadata',
9803
- ]);
9804
- if (fromVideoMetadata != null) {
9805
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
9806
- }
9807
- const fromThought = getValueByPath(fromObject, ['thought']);
9808
- if (fromThought != null) {
9809
- setValueByPath(toObject, ['thought'], fromThought);
9810
- }
9811
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
9812
- if (fromInlineData != null) {
9813
- setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
9814
- }
9815
- const fromFileData = getValueByPath(fromObject, ['fileData']);
9816
- if (fromFileData != null) {
9817
- setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
9818
- }
9819
- const fromThoughtSignature = getValueByPath(fromObject, [
9820
- 'thoughtSignature',
9796
+ }
9797
+ const fromDefaultCheckpointId = getValueByPath(fromObject, [
9798
+ 'defaultCheckpointId',
9821
9799
  ]);
9822
- if (fromThoughtSignature != null) {
9823
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
9800
+ if (fromDefaultCheckpointId != null) {
9801
+ setValueByPath(toObject, ['defaultCheckpointId'], fromDefaultCheckpointId);
9802
+ }
9803
+ const fromCheckpoints = getValueByPath(fromObject, ['checkpoints']);
9804
+ if (fromCheckpoints != null) {
9805
+ let transformedList = fromCheckpoints;
9806
+ if (Array.isArray(transformedList)) {
9807
+ transformedList = transformedList.map((item) => {
9808
+ return item;
9809
+ });
9810
+ }
9811
+ setValueByPath(toObject, ['checkpoints'], transformedList);
9824
9812
  }
9813
+ return toObject;
9814
+ }
9815
+ function partToMldev$1(fromObject) {
9816
+ const toObject = {};
9825
9817
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9826
9818
  if (fromFunctionCall != null) {
9827
9819
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -9838,16 +9830,40 @@ function partToMldev$1(fromObject) {
9838
9830
  if (fromExecutableCode != null) {
9839
9831
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9840
9832
  }
9833
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
9834
+ if (fromFileData != null) {
9835
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
9836
+ }
9841
9837
  const fromFunctionResponse = getValueByPath(fromObject, [
9842
9838
  'functionResponse',
9843
9839
  ]);
9844
9840
  if (fromFunctionResponse != null) {
9845
9841
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
9846
9842
  }
9843
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
9844
+ if (fromInlineData != null) {
9845
+ setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
9846
+ }
9847
9847
  const fromText = getValueByPath(fromObject, ['text']);
9848
9848
  if (fromText != null) {
9849
9849
  setValueByPath(toObject, ['text'], fromText);
9850
9850
  }
9851
+ const fromThought = getValueByPath(fromObject, ['thought']);
9852
+ if (fromThought != null) {
9853
+ setValueByPath(toObject, ['thought'], fromThought);
9854
+ }
9855
+ const fromThoughtSignature = getValueByPath(fromObject, [
9856
+ 'thoughtSignature',
9857
+ ]);
9858
+ if (fromThoughtSignature != null) {
9859
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
9860
+ }
9861
+ const fromVideoMetadata = getValueByPath(fromObject, [
9862
+ 'videoMetadata',
9863
+ ]);
9864
+ if (fromVideoMetadata != null) {
9865
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
9866
+ }
9851
9867
  return toObject;
9852
9868
  }
9853
9869
  function productImageToVertex(fromObject) {
@@ -10064,13 +10080,13 @@ function safetyAttributesFromVertex(fromObject) {
10064
10080
  }
10065
10081
  function safetySettingToMldev(fromObject) {
10066
10082
  const toObject = {};
10067
- if (getValueByPath(fromObject, ['method']) !== undefined) {
10068
- throw new Error('method parameter is not supported in Gemini API.');
10069
- }
10070
10083
  const fromCategory = getValueByPath(fromObject, ['category']);
10071
10084
  if (fromCategory != null) {
10072
10085
  setValueByPath(toObject, ['category'], fromCategory);
10073
10086
  }
10087
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
10088
+ throw new Error('method parameter is not supported in Gemini API.');
10089
+ }
10074
10090
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
10075
10091
  if (fromThreshold != null) {
10076
10092
  setValueByPath(toObject, ['threshold'], fromThreshold);
@@ -10169,6 +10185,10 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
10169
10185
  }
10170
10186
  function speechConfigToVertex(fromObject) {
10171
10187
  const toObject = {};
10188
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
10189
+ if (fromLanguageCode != null) {
10190
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
10191
+ }
10172
10192
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
10173
10193
  if (fromVoiceConfig != null) {
10174
10194
  setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
@@ -10176,10 +10196,6 @@ function speechConfigToVertex(fromObject) {
10176
10196
  if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
10177
10197
  throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
10178
10198
  }
10179
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
10180
- if (fromLanguageCode != null) {
10181
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
10182
- }
10183
10199
  return toObject;
10184
10200
  }
10185
10201
  function toolToMldev$1(fromObject) {
@@ -10199,27 +10215,16 @@ function toolToMldev$1(fromObject) {
10199
10215
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
10200
10216
  throw new Error('retrieval parameter is not supported in Gemini API.');
10201
10217
  }
10202
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10203
- if (fromGoogleSearch != null) {
10204
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
10205
- }
10206
10218
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10207
10219
  'googleSearchRetrieval',
10208
10220
  ]);
10209
10221
  if (fromGoogleSearchRetrieval != null) {
10210
10222
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10211
10223
  }
10212
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10213
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10214
- }
10215
10224
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10216
10225
  if (fromGoogleMaps != null) {
10217
10226
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10218
10227
  }
10219
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10220
- if (fromUrlContext != null) {
10221
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
10222
- }
10223
10228
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10224
10229
  if (fromComputerUse != null) {
10225
10230
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -10230,6 +10235,17 @@ function toolToMldev$1(fromObject) {
10230
10235
  if (fromCodeExecution != null) {
10231
10236
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10232
10237
  }
10238
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10239
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10240
+ }
10241
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10242
+ if (fromGoogleSearch != null) {
10243
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
10244
+ }
10245
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10246
+ if (fromUrlContext != null) {
10247
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
10248
+ }
10233
10249
  return toObject;
10234
10250
  }
10235
10251
  function toolToVertex(fromObject) {
@@ -10250,30 +10266,16 @@ function toolToVertex(fromObject) {
10250
10266
  if (fromRetrieval != null) {
10251
10267
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
10252
10268
  }
10253
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10254
- if (fromGoogleSearch != null) {
10255
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
10256
- }
10257
10269
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10258
10270
  'googleSearchRetrieval',
10259
10271
  ]);
10260
10272
  if (fromGoogleSearchRetrieval != null) {
10261
10273
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10262
10274
  }
10263
- const fromEnterpriseWebSearch = getValueByPath(fromObject, [
10264
- 'enterpriseWebSearch',
10265
- ]);
10266
- if (fromEnterpriseWebSearch != null) {
10267
- setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
10268
- }
10269
10275
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10270
10276
  if (fromGoogleMaps != null) {
10271
10277
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
10272
10278
  }
10273
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10274
- if (fromUrlContext != null) {
10275
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
10276
- }
10277
10279
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10278
10280
  if (fromComputerUse != null) {
10279
10281
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -10284,6 +10286,20 @@ function toolToVertex(fromObject) {
10284
10286
  if (fromCodeExecution != null) {
10285
10287
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10286
10288
  }
10289
+ const fromEnterpriseWebSearch = getValueByPath(fromObject, [
10290
+ 'enterpriseWebSearch',
10291
+ ]);
10292
+ if (fromEnterpriseWebSearch != null) {
10293
+ setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
10294
+ }
10295
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10296
+ if (fromGoogleSearch != null) {
10297
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
10298
+ }
10299
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10300
+ if (fromUrlContext != null) {
10301
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
10302
+ }
10287
10303
  return toObject;
10288
10304
  }
10289
10305
  function tunedModelInfoFromMldev(fromObject) {
@@ -10387,6 +10403,18 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
10387
10403
  if (parentObject !== undefined && fromOutputGcsUri != null) {
10388
10404
  setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
10389
10405
  }
10406
+ const fromSafetyFilterLevel = getValueByPath(fromObject, [
10407
+ 'safetyFilterLevel',
10408
+ ]);
10409
+ if (parentObject !== undefined && fromSafetyFilterLevel != null) {
10410
+ setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
10411
+ }
10412
+ const fromPersonGeneration = getValueByPath(fromObject, [
10413
+ 'personGeneration',
10414
+ ]);
10415
+ if (parentObject !== undefined && fromPersonGeneration != null) {
10416
+ setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
10417
+ }
10390
10418
  const fromIncludeRaiReason = getValueByPath(fromObject, [
10391
10419
  'includeRaiReason',
10392
10420
  ]);
@@ -10593,7 +10621,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10593
10621
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10594
10622
  const USER_AGENT_HEADER = 'User-Agent';
10595
10623
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10596
- const SDK_VERSION = '1.27.0'; // x-release-please-version
10624
+ const SDK_VERSION = '1.28.0'; // x-release-please-version
10597
10625
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10598
10626
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10599
10627
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -10977,13 +11005,13 @@ class ApiClient {
10977
11005
  *
10978
11006
  * @param file The string path to the file to be uploaded or a Blob object.
10979
11007
  * @param config Optional parameters specified in the `UploadFileConfig`
10980
- * interface. @see {@link UploadFileConfig}
11008
+ * interface. @see {@link types.UploadFileConfig}
10981
11009
  * @return A promise that resolves to a `File` object.
10982
11010
  * @throws An error if called on a Vertex AI client.
10983
11011
  * @throws An error if the `mimeType` is not provided and can not be inferred,
10984
11012
  */
10985
11013
  async uploadFile(file, config) {
10986
- var _a;
11014
+ var _a, _b;
10987
11015
  const fileToUpload = {};
10988
11016
  if (config != null) {
10989
11017
  fileToUpload.mimeType = config.mimeType;
@@ -11001,20 +11029,25 @@ class ApiClient {
11001
11029
  throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
11002
11030
  }
11003
11031
  fileToUpload.mimeType = mimeType;
11004
- const uploadUrl = await this.fetchUploadUrl(fileToUpload, config);
11032
+ let fileName = '';
11033
+ if (typeof file === 'string') {
11034
+ fileName = file.replace(/[/\\]+$/, '');
11035
+ fileName = (_b = fileName.split(/[/\\]/).pop()) !== null && _b !== void 0 ? _b : '';
11036
+ }
11037
+ const uploadUrl = await this.fetchUploadUrl(fileToUpload, fileName, config);
11005
11038
  return uploader.upload(file, uploadUrl, this);
11006
11039
  }
11007
11040
  /**
11008
11041
  * Downloads a file asynchronously to the specified path.
11009
11042
  *
11010
11043
  * @params params - The parameters for the download request, see {@link
11011
- * DownloadFileParameters}
11044
+ * types.DownloadFileParameters}
11012
11045
  */
11013
11046
  async downloadFile(params) {
11014
11047
  const downloader = this.clientOptions.downloader;
11015
11048
  await downloader.download(params, this);
11016
11049
  }
11017
- async fetchUploadUrl(file, config) {
11050
+ async fetchUploadUrl(file, fileName, config) {
11018
11051
  var _a;
11019
11052
  let httpOptions = {};
11020
11053
  if (config === null || config === void 0 ? void 0 : config.httpOptions) {
@@ -11023,13 +11056,7 @@ class ApiClient {
11023
11056
  else {
11024
11057
  httpOptions = {
11025
11058
  apiVersion: '',
11026
- headers: {
11027
- 'Content-Type': 'application/json',
11028
- 'X-Goog-Upload-Protocol': 'resumable',
11029
- 'X-Goog-Upload-Command': 'start',
11030
- 'X-Goog-Upload-Header-Content-Length': `${file.sizeBytes}`,
11031
- 'X-Goog-Upload-Header-Content-Type': `${file.mimeType}`,
11032
- },
11059
+ headers: Object.assign({ 'Content-Type': 'application/json', 'X-Goog-Upload-Protocol': 'resumable', 'X-Goog-Upload-Command': 'start', 'X-Goog-Upload-Header-Content-Length': `${file.sizeBytes}`, 'X-Goog-Upload-Header-Content-Type': `${file.mimeType}` }, (fileName ? { 'X-Goog-Upload-File-Name': fileName } : {})),
11033
11060
  };
11034
11061
  }
11035
11062
  const body = {
@@ -13732,13 +13759,13 @@ class Operations extends BaseModule {
13732
13759
  */
13733
13760
  function blobToMldev(fromObject) {
13734
13761
  const toObject = {};
13735
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
13736
- throw new Error('displayName parameter is not supported in Gemini API.');
13737
- }
13738
13762
  const fromData = getValueByPath(fromObject, ['data']);
13739
13763
  if (fromData != null) {
13740
13764
  setValueByPath(toObject, ['data'], fromData);
13741
13765
  }
13766
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
13767
+ throw new Error('displayName parameter is not supported in Gemini API.');
13768
+ }
13742
13769
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
13743
13770
  if (fromMimeType != null) {
13744
13771
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -13829,15 +13856,15 @@ function googleMapsToMldev(fromObject) {
13829
13856
  }
13830
13857
  function googleSearchToMldev(fromObject) {
13831
13858
  const toObject = {};
13859
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13860
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
13861
+ }
13832
13862
  const fromTimeRangeFilter = getValueByPath(fromObject, [
13833
13863
  'timeRangeFilter',
13834
13864
  ]);
13835
13865
  if (fromTimeRangeFilter != null) {
13836
13866
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
13837
13867
  }
13838
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13839
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
13840
- }
13841
13868
  return toObject;
13842
13869
  }
13843
13870
  function liveConnectConfigToMldev(fromObject, parentObject) {
@@ -13964,30 +13991,6 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
13964
13991
  }
13965
13992
  function partToMldev(fromObject) {
13966
13993
  const toObject = {};
13967
- const fromVideoMetadata = getValueByPath(fromObject, [
13968
- 'videoMetadata',
13969
- ]);
13970
- if (fromVideoMetadata != null) {
13971
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
13972
- }
13973
- const fromThought = getValueByPath(fromObject, ['thought']);
13974
- if (fromThought != null) {
13975
- setValueByPath(toObject, ['thought'], fromThought);
13976
- }
13977
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
13978
- if (fromInlineData != null) {
13979
- setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
13980
- }
13981
- const fromFileData = getValueByPath(fromObject, ['fileData']);
13982
- if (fromFileData != null) {
13983
- setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
13984
- }
13985
- const fromThoughtSignature = getValueByPath(fromObject, [
13986
- 'thoughtSignature',
13987
- ]);
13988
- if (fromThoughtSignature != null) {
13989
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
13990
- }
13991
13994
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
13992
13995
  if (fromFunctionCall != null) {
13993
13996
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -14004,16 +14007,40 @@ function partToMldev(fromObject) {
14004
14007
  if (fromExecutableCode != null) {
14005
14008
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
14006
14009
  }
14010
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
14011
+ if (fromFileData != null) {
14012
+ setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14013
+ }
14007
14014
  const fromFunctionResponse = getValueByPath(fromObject, [
14008
14015
  'functionResponse',
14009
14016
  ]);
14010
14017
  if (fromFunctionResponse != null) {
14011
14018
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
14012
14019
  }
14020
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
14021
+ if (fromInlineData != null) {
14022
+ setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
14023
+ }
14013
14024
  const fromText = getValueByPath(fromObject, ['text']);
14014
14025
  if (fromText != null) {
14015
14026
  setValueByPath(toObject, ['text'], fromText);
14016
14027
  }
14028
+ const fromThought = getValueByPath(fromObject, ['thought']);
14029
+ if (fromThought != null) {
14030
+ setValueByPath(toObject, ['thought'], fromThought);
14031
+ }
14032
+ const fromThoughtSignature = getValueByPath(fromObject, [
14033
+ 'thoughtSignature',
14034
+ ]);
14035
+ if (fromThoughtSignature != null) {
14036
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
14037
+ }
14038
+ const fromVideoMetadata = getValueByPath(fromObject, [
14039
+ 'videoMetadata',
14040
+ ]);
14041
+ if (fromVideoMetadata != null) {
14042
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
14043
+ }
14017
14044
  return toObject;
14018
14045
  }
14019
14046
  function sessionResumptionConfigToMldev(fromObject) {
@@ -14044,27 +14071,16 @@ function toolToMldev(fromObject) {
14044
14071
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
14045
14072
  throw new Error('retrieval parameter is not supported in Gemini API.');
14046
14073
  }
14047
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14048
- if (fromGoogleSearch != null) {
14049
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
14050
- }
14051
14074
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
14052
14075
  'googleSearchRetrieval',
14053
14076
  ]);
14054
14077
  if (fromGoogleSearchRetrieval != null) {
14055
14078
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
14056
14079
  }
14057
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
14058
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
14059
- }
14060
14080
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
14061
14081
  if (fromGoogleMaps != null) {
14062
14082
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
14063
14083
  }
14064
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
14065
- if (fromUrlContext != null) {
14066
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
14067
- }
14068
14084
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
14069
14085
  if (fromComputerUse != null) {
14070
14086
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -14075,6 +14091,17 @@ function toolToMldev(fromObject) {
14075
14091
  if (fromCodeExecution != null) {
14076
14092
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
14077
14093
  }
14094
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
14095
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
14096
+ }
14097
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14098
+ if (fromGoogleSearch != null) {
14099
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
14100
+ }
14101
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
14102
+ if (fromUrlContext != null) {
14103
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
14104
+ }
14078
14105
  return toObject;
14079
14106
  }
14080
14107
 
@@ -14436,14 +14463,19 @@ class NodeDownloader {
14436
14463
  const response = await downloadFile(params, apiClient);
14437
14464
  if (response instanceof HttpResponse) {
14438
14465
  const writer = createWriteStream(params.downloadPath);
14439
- Readable.fromWeb(response.responseInternal.body).pipe(writer);
14466
+ const body = Readable.fromWeb(response.responseInternal.body);
14467
+ body.pipe(writer);
14468
+ await finished(writer);
14440
14469
  }
14441
14470
  else {
14442
- writeFile(params.downloadPath, response, { encoding: 'base64' }, (error) => {
14443
- if (error) {
14444
- throw new Error(`Failed to write file to ${params.downloadPath}: ${error}`);
14445
- }
14446
- });
14471
+ try {
14472
+ await writeFile(params.downloadPath, response, {
14473
+ encoding: 'base64',
14474
+ });
14475
+ }
14476
+ catch (error) {
14477
+ throw new Error(`Failed to write file to ${params.downloadPath}: ${error}`);
14478
+ }
14447
14479
  }
14448
14480
  }
14449
14481
  }
@@ -14590,15 +14622,35 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
14590
14622
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
14591
14623
  throw new Error('labels parameter is not supported in Gemini API.');
14592
14624
  }
14625
+ if (getValueByPath(fromObject, ['beta']) !== undefined) {
14626
+ throw new Error('beta parameter is not supported in Gemini API.');
14627
+ }
14593
14628
  return toObject;
14594
14629
  }
14595
14630
  function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14596
14631
  const toObject = {};
14597
- const fromValidationDataset = getValueByPath(fromObject, [
14598
- 'validationDataset',
14632
+ let discriminatorValidationDataset = getValueByPath(rootObject, [
14633
+ 'config',
14634
+ 'method',
14599
14635
  ]);
14600
- if (parentObject !== undefined && fromValidationDataset != null) {
14601
- setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
14636
+ if (discriminatorValidationDataset === undefined) {
14637
+ discriminatorValidationDataset = 'SUPERVISED_FINE_TUNING';
14638
+ }
14639
+ if (discriminatorValidationDataset === 'SUPERVISED_FINE_TUNING') {
14640
+ const fromValidationDataset = getValueByPath(fromObject, [
14641
+ 'validationDataset',
14642
+ ]);
14643
+ if (parentObject !== undefined && fromValidationDataset != null) {
14644
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
14645
+ }
14646
+ }
14647
+ else if (discriminatorValidationDataset === 'PREFERENCE_TUNING') {
14648
+ const fromValidationDataset = getValueByPath(fromObject, [
14649
+ 'validationDataset',
14650
+ ]);
14651
+ if (parentObject !== undefined && fromValidationDataset != null) {
14652
+ setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
14653
+ }
14602
14654
  }
14603
14655
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
14604
14656
  'tunedModelDisplayName',
@@ -14610,25 +14662,90 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14610
14662
  if (parentObject !== undefined && fromDescription != null) {
14611
14663
  setValueByPath(parentObject, ['description'], fromDescription);
14612
14664
  }
14613
- const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14614
- if (parentObject !== undefined && fromEpochCount != null) {
14615
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
14665
+ let discriminatorEpochCount = getValueByPath(rootObject, [
14666
+ 'config',
14667
+ 'method',
14668
+ ]);
14669
+ if (discriminatorEpochCount === undefined) {
14670
+ discriminatorEpochCount = 'SUPERVISED_FINE_TUNING';
14616
14671
  }
14617
- const fromLearningRateMultiplier = getValueByPath(fromObject, [
14618
- 'learningRateMultiplier',
14672
+ if (discriminatorEpochCount === 'SUPERVISED_FINE_TUNING') {
14673
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14674
+ if (parentObject !== undefined && fromEpochCount != null) {
14675
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
14676
+ }
14677
+ }
14678
+ else if (discriminatorEpochCount === 'PREFERENCE_TUNING') {
14679
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14680
+ if (parentObject !== undefined && fromEpochCount != null) {
14681
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
14682
+ }
14683
+ }
14684
+ let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
14685
+ 'config',
14686
+ 'method',
14619
14687
  ]);
14620
- if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14621
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
14688
+ if (discriminatorLearningRateMultiplier === undefined) {
14689
+ discriminatorLearningRateMultiplier = 'SUPERVISED_FINE_TUNING';
14690
+ }
14691
+ if (discriminatorLearningRateMultiplier === 'SUPERVISED_FINE_TUNING') {
14692
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
14693
+ 'learningRateMultiplier',
14694
+ ]);
14695
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14696
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
14697
+ }
14698
+ }
14699
+ else if (discriminatorLearningRateMultiplier === 'PREFERENCE_TUNING') {
14700
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
14701
+ 'learningRateMultiplier',
14702
+ ]);
14703
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14704
+ setValueByPath(parentObject, [
14705
+ 'preferenceOptimizationSpec',
14706
+ 'hyperParameters',
14707
+ 'learningRateMultiplier',
14708
+ ], fromLearningRateMultiplier);
14709
+ }
14622
14710
  }
14623
- const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
14624
- 'exportLastCheckpointOnly',
14711
+ let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
14712
+ if (discriminatorExportLastCheckpointOnly === undefined) {
14713
+ discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
14714
+ }
14715
+ if (discriminatorExportLastCheckpointOnly === 'SUPERVISED_FINE_TUNING') {
14716
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
14717
+ 'exportLastCheckpointOnly',
14718
+ ]);
14719
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
14720
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
14721
+ }
14722
+ }
14723
+ else if (discriminatorExportLastCheckpointOnly === 'PREFERENCE_TUNING') {
14724
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
14725
+ 'exportLastCheckpointOnly',
14726
+ ]);
14727
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
14728
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
14729
+ }
14730
+ }
14731
+ let discriminatorAdapterSize = getValueByPath(rootObject, [
14732
+ 'config',
14733
+ 'method',
14625
14734
  ]);
14626
- if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
14627
- setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
14735
+ if (discriminatorAdapterSize === undefined) {
14736
+ discriminatorAdapterSize = 'SUPERVISED_FINE_TUNING';
14737
+ }
14738
+ if (discriminatorAdapterSize === 'SUPERVISED_FINE_TUNING') {
14739
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
14740
+ if (parentObject !== undefined && fromAdapterSize != null) {
14741
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
14742
+ }
14628
14743
  }
14629
- const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
14630
- if (parentObject !== undefined && fromAdapterSize != null) {
14631
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
14744
+ else if (discriminatorAdapterSize === 'PREFERENCE_TUNING') {
14745
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
14746
+ if (parentObject !== undefined && fromAdapterSize != null) {
14747
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
14748
+ }
14632
14749
  }
14633
14750
  if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
14634
14751
  throw new Error('batchSize parameter is not supported in Vertex AI.');
@@ -14640,6 +14757,10 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14640
14757
  if (parentObject !== undefined && fromLabels != null) {
14641
14758
  setValueByPath(parentObject, ['labels'], fromLabels);
14642
14759
  }
14760
+ const fromBeta = getValueByPath(fromObject, ['beta']);
14761
+ if (parentObject !== undefined && fromBeta != null) {
14762
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'beta'], fromBeta);
14763
+ }
14643
14764
  return toObject;
14644
14765
  }
14645
14766
  function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
@@ -14658,7 +14779,7 @@ function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
14658
14779
  'trainingDataset',
14659
14780
  ]);
14660
14781
  if (fromTrainingDataset != null) {
14661
- setValueByPath(toObject, ['tuningTask', 'trainingData'], tuningDatasetToMldev(fromTrainingDataset));
14782
+ tuningDatasetToMldev(fromTrainingDataset);
14662
14783
  }
14663
14784
  const fromConfig = getValueByPath(fromObject, ['config']);
14664
14785
  if (fromConfig != null) {
@@ -14682,11 +14803,11 @@ function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
14682
14803
  'trainingDataset',
14683
14804
  ]);
14684
14805
  if (fromTrainingDataset != null) {
14685
- tuningDatasetToVertex(fromTrainingDataset, toObject);
14806
+ tuningDatasetToVertex(fromTrainingDataset, toObject, rootObject);
14686
14807
  }
14687
14808
  const fromConfig = getValueByPath(fromObject, ['config']);
14688
14809
  if (fromConfig != null) {
14689
- createTuningJobConfigToVertex(fromConfig, toObject);
14810
+ createTuningJobConfigToVertex(fromConfig, toObject, rootObject);
14690
14811
  }
14691
14812
  return toObject;
14692
14813
  }
@@ -14838,17 +14959,49 @@ function tuningDatasetToMldev(fromObject, _rootObject) {
14838
14959
  }
14839
14960
  return toObject;
14840
14961
  }
14841
- function tuningDatasetToVertex(fromObject, parentObject, _rootObject) {
14962
+ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
14842
14963
  const toObject = {};
14843
- const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14844
- if (parentObject !== undefined && fromGcsUri != null) {
14845
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
14964
+ let discriminatorGcsUri = getValueByPath(rootObject, [
14965
+ 'config',
14966
+ 'method',
14967
+ ]);
14968
+ if (discriminatorGcsUri === undefined) {
14969
+ discriminatorGcsUri = 'SUPERVISED_FINE_TUNING';
14846
14970
  }
14847
- const fromVertexDatasetResource = getValueByPath(fromObject, [
14848
- 'vertexDatasetResource',
14971
+ if (discriminatorGcsUri === 'SUPERVISED_FINE_TUNING') {
14972
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14973
+ if (parentObject !== undefined && fromGcsUri != null) {
14974
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
14975
+ }
14976
+ }
14977
+ else if (discriminatorGcsUri === 'PREFERENCE_TUNING') {
14978
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14979
+ if (parentObject !== undefined && fromGcsUri != null) {
14980
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromGcsUri);
14981
+ }
14982
+ }
14983
+ let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
14984
+ 'config',
14985
+ 'method',
14849
14986
  ]);
14850
- if (parentObject !== undefined && fromVertexDatasetResource != null) {
14851
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
14987
+ if (discriminatorVertexDatasetResource === undefined) {
14988
+ discriminatorVertexDatasetResource = 'SUPERVISED_FINE_TUNING';
14989
+ }
14990
+ if (discriminatorVertexDatasetResource === 'SUPERVISED_FINE_TUNING') {
14991
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
14992
+ 'vertexDatasetResource',
14993
+ ]);
14994
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
14995
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
14996
+ }
14997
+ }
14998
+ else if (discriminatorVertexDatasetResource === 'PREFERENCE_TUNING') {
14999
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
15000
+ 'vertexDatasetResource',
15001
+ ]);
15002
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
15003
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
15004
+ }
14852
15005
  }
14853
15006
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
14854
15007
  throw new Error('examples parameter is not supported in Vertex AI.');
@@ -14967,6 +15120,12 @@ function tuningJobFromVertex(fromObject, _rootObject) {
14967
15120
  if (fromSupervisedTuningSpec != null) {
14968
15121
  setValueByPath(toObject, ['supervisedTuningSpec'], fromSupervisedTuningSpec);
14969
15122
  }
15123
+ const fromPreferenceOptimizationSpec = getValueByPath(fromObject, [
15124
+ 'preferenceOptimizationSpec',
15125
+ ]);
15126
+ if (fromPreferenceOptimizationSpec != null) {
15127
+ setValueByPath(toObject, ['preferenceOptimizationSpec'], fromPreferenceOptimizationSpec);
15128
+ }
14970
15129
  const fromTuningDataStats = getValueByPath(fromObject, [
14971
15130
  'tuningDataStats',
14972
15131
  ]);
@@ -15333,7 +15492,7 @@ class Tunings extends BaseModule {
15333
15492
  let path = '';
15334
15493
  let queryParams = {};
15335
15494
  if (this.apiClient.isVertexAI()) {
15336
- const body = createTuningJobParametersPrivateToVertex(params);
15495
+ const body = createTuningJobParametersPrivateToVertex(params, params);
15337
15496
  path = formatMap('tuningJobs', body['_url']);
15338
15497
  queryParams = body['_query'];
15339
15498
  delete body['_url'];
@@ -15751,6 +15910,9 @@ class GoogleGenAI {
15751
15910
  ' precedence over the API key from the environment variables.');
15752
15911
  this.apiKey = undefined;
15753
15912
  }
15913
+ if (!this.location && !this.apiKey) {
15914
+ this.location = 'global';
15915
+ }
15754
15916
  }
15755
15917
  const baseUrl = getBaseUrl(options.httpOptions, options.vertexai, getEnv('GOOGLE_VERTEX_BASE_URL'), getEnv('GOOGLE_GEMINI_BASE_URL'));
15756
15918
  if (baseUrl) {
@@ -15811,5 +15973,5 @@ function getApiKeyFromEnv() {
15811
15973
  return envGoogleApiKey || envGeminiApiKey || undefined;
15812
15974
  }
15813
15975
 
15814
- export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
15976
+ export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
15815
15977
  //# sourceMappingURL=index.mjs.map