@google/genai 1.26.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.
package/dist/index.cjs CHANGED
@@ -472,7 +472,7 @@ function videoFromVertex$1(fromObject) {
472
472
  * Copyright 2025 Google LLC
473
473
  * SPDX-License-Identifier: Apache-2.0
474
474
  */
475
- /** Required. Outcome of the code execution. */
475
+ /** Outcome of the code execution. */
476
476
  exports.Outcome = void 0;
477
477
  (function (Outcome) {
478
478
  /**
@@ -492,7 +492,7 @@ exports.Outcome = void 0;
492
492
  */
493
493
  Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
494
494
  })(exports.Outcome || (exports.Outcome = {}));
495
- /** Required. Programming language of the `code`. */
495
+ /** Programming language of the `code`. */
496
496
  exports.Language = void 0;
497
497
  (function (Language) {
498
498
  /**
@@ -524,7 +524,7 @@ exports.FunctionResponseScheduling = void 0;
524
524
  */
525
525
  FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
526
526
  })(exports.FunctionResponseScheduling || (exports.FunctionResponseScheduling = {}));
527
- /** Optional. The type of the data. */
527
+ /** The type of the data. */
528
528
  exports.Type = void 0;
529
529
  (function (Type) {
530
530
  /**
@@ -560,7 +560,64 @@ exports.Type = void 0;
560
560
  */
561
561
  Type["NULL"] = "NULL";
562
562
  })(exports.Type || (exports.Type = {}));
563
- /** Required. Harm category. */
563
+ /** The mode of the predictor to be used in dynamic retrieval. */
564
+ exports.Mode = void 0;
565
+ (function (Mode) {
566
+ /**
567
+ * Always trigger retrieval.
568
+ */
569
+ Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
570
+ /**
571
+ * Run retrieval only when system decides it is necessary.
572
+ */
573
+ Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
574
+ })(exports.Mode || (exports.Mode = {}));
575
+ /** Type of auth scheme. This enum is not supported in Gemini API. */
576
+ exports.AuthType = void 0;
577
+ (function (AuthType) {
578
+ AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
579
+ /**
580
+ * No Auth.
581
+ */
582
+ AuthType["NO_AUTH"] = "NO_AUTH";
583
+ /**
584
+ * API Key Auth.
585
+ */
586
+ AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
587
+ /**
588
+ * HTTP Basic Auth.
589
+ */
590
+ AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
591
+ /**
592
+ * Google Service Account Auth.
593
+ */
594
+ AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
595
+ /**
596
+ * OAuth auth.
597
+ */
598
+ AuthType["OAUTH"] = "OAUTH";
599
+ /**
600
+ * OpenID Connect (OIDC) Auth.
601
+ */
602
+ AuthType["OIDC_AUTH"] = "OIDC_AUTH";
603
+ })(exports.AuthType || (exports.AuthType = {}));
604
+ /** The API spec that the external API implements. This enum is not supported in Gemini API. */
605
+ exports.ApiSpec = void 0;
606
+ (function (ApiSpec) {
607
+ /**
608
+ * Unspecified API spec. This value should not be used.
609
+ */
610
+ ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
611
+ /**
612
+ * Simple search API spec.
613
+ */
614
+ ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
615
+ /**
616
+ * Elastic search API spec.
617
+ */
618
+ ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
619
+ })(exports.ApiSpec || (exports.ApiSpec = {}));
620
+ /** Harm category. */
564
621
  exports.HarmCategory = void 0;
565
622
  (function (HarmCategory) {
566
623
  /**
@@ -588,27 +645,27 @@ exports.HarmCategory = void 0;
588
645
  */
589
646
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
590
647
  /**
591
- * The harm category is image hate.
648
+ * The harm category is image hate. This enum value is not supported in Gemini API.
592
649
  */
593
650
  HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
594
651
  /**
595
- * The harm category is image dangerous content.
652
+ * The harm category is image dangerous content. This enum value is not supported in Gemini API.
596
653
  */
597
654
  HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
598
655
  /**
599
- * The harm category is image harassment.
656
+ * The harm category is image harassment. This enum value is not supported in Gemini API.
600
657
  */
601
658
  HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
602
659
  /**
603
- * The harm category is image sexually explicit content.
660
+ * The harm category is image sexually explicit content. This enum value is not supported in Gemini API.
604
661
  */
605
662
  HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
606
663
  /**
607
- * The harm category is for jailbreak prompts.
664
+ * The harm category is for jailbreak prompts. This enum value is not supported in Gemini API.
608
665
  */
609
666
  HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
610
667
  })(exports.HarmCategory || (exports.HarmCategory = {}));
611
- /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
668
+ /** 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. */
612
669
  exports.HarmBlockMethod = void 0;
613
670
  (function (HarmBlockMethod) {
614
671
  /**
@@ -624,7 +681,7 @@ exports.HarmBlockMethod = void 0;
624
681
  */
625
682
  HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
626
683
  })(exports.HarmBlockMethod || (exports.HarmBlockMethod = {}));
627
- /** Required. The harm block threshold. */
684
+ /** The harm block threshold. */
628
685
  exports.HarmBlockThreshold = void 0;
629
686
  (function (HarmBlockThreshold) {
630
687
  /**
@@ -652,87 +709,6 @@ exports.HarmBlockThreshold = void 0;
652
709
  */
653
710
  HarmBlockThreshold["OFF"] = "OFF";
654
711
  })(exports.HarmBlockThreshold || (exports.HarmBlockThreshold = {}));
655
- /** The mode of the predictor to be used in dynamic retrieval. */
656
- exports.Mode = void 0;
657
- (function (Mode) {
658
- /**
659
- * Always trigger retrieval.
660
- */
661
- Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
662
- /**
663
- * Run retrieval only when system decides it is necessary.
664
- */
665
- Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
666
- })(exports.Mode || (exports.Mode = {}));
667
- /** Type of auth scheme. */
668
- exports.AuthType = void 0;
669
- (function (AuthType) {
670
- AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
671
- /**
672
- * No Auth.
673
- */
674
- AuthType["NO_AUTH"] = "NO_AUTH";
675
- /**
676
- * API Key Auth.
677
- */
678
- AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
679
- /**
680
- * HTTP Basic Auth.
681
- */
682
- AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
683
- /**
684
- * Google Service Account Auth.
685
- */
686
- AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
687
- /**
688
- * OAuth auth.
689
- */
690
- AuthType["OAUTH"] = "OAUTH";
691
- /**
692
- * OpenID Connect (OIDC) Auth.
693
- */
694
- AuthType["OIDC_AUTH"] = "OIDC_AUTH";
695
- })(exports.AuthType || (exports.AuthType = {}));
696
- /** The API spec that the external API implements. */
697
- exports.ApiSpec = void 0;
698
- (function (ApiSpec) {
699
- /**
700
- * Unspecified API spec. This value should not be used.
701
- */
702
- ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
703
- /**
704
- * Simple search API spec.
705
- */
706
- ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
707
- /**
708
- * Elastic search API spec.
709
- */
710
- ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
711
- })(exports.ApiSpec || (exports.ApiSpec = {}));
712
- /** Status of the url retrieval. */
713
- exports.UrlRetrievalStatus = void 0;
714
- (function (UrlRetrievalStatus) {
715
- /**
716
- * Default value. This value is unused
717
- */
718
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
719
- /**
720
- * Url retrieval is successful.
721
- */
722
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
723
- /**
724
- * Url retrieval is failed due to error.
725
- */
726
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
727
- /**
728
- * Url retrieval is failed because the content is behind paywall.
729
- */
730
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
731
- /**
732
- * Url retrieval is failed because the content is unsafe.
733
- */
734
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
735
- })(exports.UrlRetrievalStatus || (exports.UrlRetrievalStatus = {}));
736
712
  /** Output only. The reason why the model stopped generating tokens.
737
713
 
738
714
  If empty, the model has not stopped generating the tokens. */
@@ -823,7 +799,7 @@ exports.HarmProbability = void 0;
823
799
  */
824
800
  HarmProbability["HIGH"] = "HIGH";
825
801
  })(exports.HarmProbability || (exports.HarmProbability = {}));
826
- /** Output only. Harm severity levels in the content. */
802
+ /** Output only. Harm severity levels in the content. This enum is not supported in Gemini API. */
827
803
  exports.HarmSeverity = void 0;
828
804
  (function (HarmSeverity) {
829
805
  /**
@@ -847,6 +823,30 @@ exports.HarmSeverity = void 0;
847
823
  */
848
824
  HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
849
825
  })(exports.HarmSeverity || (exports.HarmSeverity = {}));
826
+ /** Status of the url retrieval. */
827
+ exports.UrlRetrievalStatus = void 0;
828
+ (function (UrlRetrievalStatus) {
829
+ /**
830
+ * Default value. This value is unused.
831
+ */
832
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
833
+ /**
834
+ * Url retrieval is successful.
835
+ */
836
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
837
+ /**
838
+ * Url retrieval is failed due to error.
839
+ */
840
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
841
+ /**
842
+ * Url retrieval is failed because the content is behind paywall. This enum value is not supported in Vertex AI.
843
+ */
844
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
845
+ /**
846
+ * Url retrieval is failed because the content is unsafe. This enum value is not supported in Vertex AI.
847
+ */
848
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
849
+ })(exports.UrlRetrievalStatus || (exports.UrlRetrievalStatus = {}));
850
850
  /** Output only. The reason why the prompt was blocked. */
851
851
  exports.BlockedReason = void 0;
852
852
  (function (BlockedReason) {
@@ -875,15 +875,15 @@ exports.BlockedReason = void 0;
875
875
  */
876
876
  BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
877
877
  /**
878
- * The prompt was blocked by Model Armor.
878
+ * The prompt was blocked by Model Armor. This enum value is not supported in Gemini API.
879
879
  */
880
880
  BlockedReason["MODEL_ARMOR"] = "MODEL_ARMOR";
881
881
  /**
882
- * The prompt was blocked as a jailbreak attempt.
882
+ * The prompt was blocked as a jailbreak attempt. This enum value is not supported in Gemini API.
883
883
  */
884
884
  BlockedReason["JAILBREAK"] = "JAILBREAK";
885
885
  })(exports.BlockedReason || (exports.BlockedReason = {}));
886
- /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
886
+ /** 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. */
887
887
  exports.TrafficType = void 0;
888
888
  (function (TrafficType) {
889
889
  /**
@@ -939,6 +939,54 @@ exports.MediaResolution = void 0;
939
939
  */
940
940
  MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
941
941
  })(exports.MediaResolution || (exports.MediaResolution = {}));
942
+ /** Tuning mode. This enum is not supported in Gemini API. */
943
+ exports.TuningMode = void 0;
944
+ (function (TuningMode) {
945
+ /**
946
+ * Tuning mode is unspecified.
947
+ */
948
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
949
+ /**
950
+ * Full fine-tuning mode.
951
+ */
952
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
953
+ /**
954
+ * PEFT adapter tuning mode.
955
+ */
956
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
957
+ })(exports.TuningMode || (exports.TuningMode = {}));
958
+ /** Adapter size for tuning. This enum is not supported in Gemini API. */
959
+ exports.AdapterSize = void 0;
960
+ (function (AdapterSize) {
961
+ /**
962
+ * Adapter size is unspecified.
963
+ */
964
+ AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
965
+ /**
966
+ * Adapter size 1.
967
+ */
968
+ AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
969
+ /**
970
+ * Adapter size 2.
971
+ */
972
+ AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
973
+ /**
974
+ * Adapter size 4.
975
+ */
976
+ AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
977
+ /**
978
+ * Adapter size 8.
979
+ */
980
+ AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
981
+ /**
982
+ * Adapter size 16.
983
+ */
984
+ AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
985
+ /**
986
+ * Adapter size 32.
987
+ */
988
+ AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
989
+ })(exports.AdapterSize || (exports.AdapterSize = {}));
942
990
  /** Job state. */
943
991
  exports.JobState = void 0;
944
992
  (function (JobState) {
@@ -991,55 +1039,7 @@ exports.JobState = void 0;
991
1039
  */
992
1040
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
993
1041
  })(exports.JobState || (exports.JobState = {}));
994
- /** Tuning mode. */
995
- exports.TuningMode = void 0;
996
- (function (TuningMode) {
997
- /**
998
- * Tuning mode is unspecified.
999
- */
1000
- TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
1001
- /**
1002
- * Full fine-tuning mode.
1003
- */
1004
- TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
1005
- /**
1006
- * PEFT adapter tuning mode.
1007
- */
1008
- TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
1009
- })(exports.TuningMode || (exports.TuningMode = {}));
1010
- /** Optional. Adapter size for tuning. */
1011
- exports.AdapterSize = void 0;
1012
- (function (AdapterSize) {
1013
- /**
1014
- * Adapter size is unspecified.
1015
- */
1016
- AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1017
- /**
1018
- * Adapter size 1.
1019
- */
1020
- AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1021
- /**
1022
- * Adapter size 2.
1023
- */
1024
- AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1025
- /**
1026
- * Adapter size 4.
1027
- */
1028
- AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1029
- /**
1030
- * Adapter size 8.
1031
- */
1032
- AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1033
- /**
1034
- * Adapter size 16.
1035
- */
1036
- AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1037
- /**
1038
- * Adapter size 32.
1039
- */
1040
- AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1041
- })(exports.AdapterSize || (exports.AdapterSize = {}));
1042
- /** Optional. The tuning task. Either I2V or T2V. */
1042
+ /** The tuning task. Either I2V or T2V. This enum is not supported in Gemini API. */
1043
1043
  exports.TuningTask = void 0;
1044
1044
  (function (TuningTask) {
1045
1045
  /**
@@ -1289,6 +1289,18 @@ exports.VideoCompressionQuality = void 0;
1289
1289
  */
1290
1290
  VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
1291
1291
  })(exports.VideoCompressionQuality || (exports.VideoCompressionQuality = {}));
1292
+ /** Enum representing the tuning method. */
1293
+ exports.TuningMethod = void 0;
1294
+ (function (TuningMethod) {
1295
+ /**
1296
+ * Supervised fine tuning.
1297
+ */
1298
+ TuningMethod["SUPERVISED_FINE_TUNING"] = "SUPERVISED_FINE_TUNING";
1299
+ /**
1300
+ * Preference optimization tuning.
1301
+ */
1302
+ TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
1303
+ })(exports.TuningMethod || (exports.TuningMethod = {}));
1292
1304
  /** State for the lifecycle of a File. */
1293
1305
  exports.FileState = void 0;
1294
1306
  (function (FileState) {
@@ -1716,7 +1728,7 @@ class HttpResponse {
1716
1728
  /** Content filter results for a prompt sent in the request. Note: This is sent only in the first stream chunk and only if no candidates were generated due to content violations. */
1717
1729
  class GenerateContentResponsePromptFeedback {
1718
1730
  }
1719
- /** Usage metadata about response(s). */
1731
+ /** Usage metadata about response(s). This data type is not supported in Gemini API. */
1720
1732
  class GenerateContentResponseUsageMetadata {
1721
1733
  }
1722
1734
  /** Response message for PredictionService.GenerateContent. */
@@ -3308,13 +3320,13 @@ function batchJobSourceToVertex(fromObject) {
3308
3320
  }
3309
3321
  function blobToMldev$4(fromObject) {
3310
3322
  const toObject = {};
3311
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
3312
- throw new Error('displayName parameter is not supported in Gemini API.');
3313
- }
3314
3323
  const fromData = getValueByPath(fromObject, ['data']);
3315
3324
  if (fromData != null) {
3316
3325
  setValueByPath(toObject, ['data'], fromData);
3317
3326
  }
3327
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
3328
+ throw new Error('displayName parameter is not supported in Gemini API.');
3329
+ }
3318
3330
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
3319
3331
  if (fromMimeType != null) {
3320
3332
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -3357,12 +3369,6 @@ function candidateFromMldev$1(fromObject) {
3357
3369
  if (fromFinishReason != null) {
3358
3370
  setValueByPath(toObject, ['finishReason'], fromFinishReason);
3359
3371
  }
3360
- const fromUrlContextMetadata = getValueByPath(fromObject, [
3361
- 'urlContextMetadata',
3362
- ]);
3363
- if (fromUrlContextMetadata != null) {
3364
- setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
3365
- }
3366
3372
  const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
3367
3373
  if (fromAvgLogprobs != null) {
3368
3374
  setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
@@ -3395,6 +3401,12 @@ function candidateFromMldev$1(fromObject) {
3395
3401
  }
3396
3402
  setValueByPath(toObject, ['safetyRatings'], transformedList);
3397
3403
  }
3404
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
3405
+ 'urlContextMetadata',
3406
+ ]);
3407
+ if (fromUrlContextMetadata != null) {
3408
+ setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
3409
+ }
3398
3410
  return toObject;
3399
3411
  }
3400
3412
  function citationMetadataFromMldev$1(fromObject) {
@@ -3863,15 +3875,15 @@ function googleMapsToMldev$4(fromObject) {
3863
3875
  }
3864
3876
  function googleSearchToMldev$4(fromObject) {
3865
3877
  const toObject = {};
3878
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
3879
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
3880
+ }
3866
3881
  const fromTimeRangeFilter = getValueByPath(fromObject, [
3867
3882
  'timeRangeFilter',
3868
3883
  ]);
3869
3884
  if (fromTimeRangeFilter != null) {
3870
3885
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
3871
3886
  }
3872
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
3873
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
3874
- }
3875
3887
  return toObject;
3876
3888
  }
3877
3889
  function inlinedRequestToMldev(apiClient, fromObject) {
@@ -4015,30 +4027,6 @@ function listBatchJobsResponseFromVertex(fromObject) {
4015
4027
  }
4016
4028
  function partToMldev$4(fromObject) {
4017
4029
  const toObject = {};
4018
- const fromVideoMetadata = getValueByPath(fromObject, [
4019
- 'videoMetadata',
4020
- ]);
4021
- if (fromVideoMetadata != null) {
4022
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4023
- }
4024
- const fromThought = getValueByPath(fromObject, ['thought']);
4025
- if (fromThought != null) {
4026
- setValueByPath(toObject, ['thought'], fromThought);
4027
- }
4028
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4029
- if (fromInlineData != null) {
4030
- setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
4031
- }
4032
- const fromFileData = getValueByPath(fromObject, ['fileData']);
4033
- if (fromFileData != null) {
4034
- setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4035
- }
4036
- const fromThoughtSignature = getValueByPath(fromObject, [
4037
- 'thoughtSignature',
4038
- ]);
4039
- if (fromThoughtSignature != null) {
4040
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
4041
- }
4042
4030
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4043
4031
  if (fromFunctionCall != null) {
4044
4032
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -4055,27 +4043,51 @@ function partToMldev$4(fromObject) {
4055
4043
  if (fromExecutableCode != null) {
4056
4044
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4057
4045
  }
4046
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
4047
+ if (fromFileData != null) {
4048
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4049
+ }
4058
4050
  const fromFunctionResponse = getValueByPath(fromObject, [
4059
4051
  'functionResponse',
4060
4052
  ]);
4061
4053
  if (fromFunctionResponse != null) {
4062
4054
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4063
4055
  }
4056
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4057
+ if (fromInlineData != null) {
4058
+ setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
4059
+ }
4064
4060
  const fromText = getValueByPath(fromObject, ['text']);
4065
4061
  if (fromText != null) {
4066
4062
  setValueByPath(toObject, ['text'], fromText);
4067
4063
  }
4064
+ const fromThought = getValueByPath(fromObject, ['thought']);
4065
+ if (fromThought != null) {
4066
+ setValueByPath(toObject, ['thought'], fromThought);
4067
+ }
4068
+ const fromThoughtSignature = getValueByPath(fromObject, [
4069
+ 'thoughtSignature',
4070
+ ]);
4071
+ if (fromThoughtSignature != null) {
4072
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
4073
+ }
4074
+ const fromVideoMetadata = getValueByPath(fromObject, [
4075
+ 'videoMetadata',
4076
+ ]);
4077
+ if (fromVideoMetadata != null) {
4078
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4079
+ }
4068
4080
  return toObject;
4069
4081
  }
4070
4082
  function safetySettingToMldev$1(fromObject) {
4071
4083
  const toObject = {};
4072
- if (getValueByPath(fromObject, ['method']) !== undefined) {
4073
- throw new Error('method parameter is not supported in Gemini API.');
4074
- }
4075
4084
  const fromCategory = getValueByPath(fromObject, ['category']);
4076
4085
  if (fromCategory != null) {
4077
4086
  setValueByPath(toObject, ['category'], fromCategory);
4078
4087
  }
4088
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
4089
+ throw new Error('method parameter is not supported in Gemini API.');
4090
+ }
4079
4091
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
4080
4092
  if (fromThreshold != null) {
4081
4093
  setValueByPath(toObject, ['threshold'], fromThreshold);
@@ -4099,36 +4111,36 @@ function toolToMldev$4(fromObject) {
4099
4111
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4100
4112
  throw new Error('retrieval parameter is not supported in Gemini API.');
4101
4113
  }
4102
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4103
- if (fromGoogleSearch != null) {
4104
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
4105
- }
4106
4114
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4107
4115
  'googleSearchRetrieval',
4108
4116
  ]);
4109
4117
  if (fromGoogleSearchRetrieval != null) {
4110
4118
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
4111
4119
  }
4112
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4113
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4114
- }
4115
4120
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
4116
4121
  if (fromGoogleMaps != null) {
4117
4122
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4118
4123
  }
4119
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
4120
- if (fromUrlContext != null) {
4121
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
4122
- }
4123
4124
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4124
4125
  if (fromComputerUse != null) {
4125
4126
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
4126
4127
  }
4127
- const fromCodeExecution = getValueByPath(fromObject, [
4128
- 'codeExecution',
4129
- ]);
4130
- if (fromCodeExecution != null) {
4131
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4128
+ const fromCodeExecution = getValueByPath(fromObject, [
4129
+ 'codeExecution',
4130
+ ]);
4131
+ if (fromCodeExecution != null) {
4132
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4133
+ }
4134
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4135
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4136
+ }
4137
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4138
+ if (fromGoogleSearch != null) {
4139
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
4140
+ }
4141
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
4142
+ if (fromUrlContext != null) {
4143
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
4132
4144
  }
4133
4145
  return toObject;
4134
4146
  }
@@ -4145,6 +4157,8 @@ exports.PagedItem = void 0;
4145
4157
  PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
4146
4158
  PagedItem["PAGED_ITEM_FILES"] = "files";
4147
4159
  PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
4160
+ PagedItem["PAGED_ITEM_RAG_STORES"] = "ragStores";
4161
+ PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
4148
4162
  })(exports.PagedItem || (exports.PagedItem = {}));
4149
4163
  /**
4150
4164
  * Pager class for iterating through paginated results.
@@ -4825,13 +4839,13 @@ class Batches extends BaseModule {
4825
4839
  */
4826
4840
  function blobToMldev$3(fromObject) {
4827
4841
  const toObject = {};
4828
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
4829
- throw new Error('displayName parameter is not supported in Gemini API.');
4830
- }
4831
4842
  const fromData = getValueByPath(fromObject, ['data']);
4832
4843
  if (fromData != null) {
4833
4844
  setValueByPath(toObject, ['data'], fromData);
4834
4845
  }
4846
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
4847
+ throw new Error('displayName parameter is not supported in Gemini API.');
4848
+ }
4835
4849
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
4836
4850
  if (fromMimeType != null) {
4837
4851
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -5094,15 +5108,15 @@ function googleMapsToMldev$3(fromObject) {
5094
5108
  }
5095
5109
  function googleSearchToMldev$3(fromObject) {
5096
5110
  const toObject = {};
5111
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5112
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
5113
+ }
5097
5114
  const fromTimeRangeFilter = getValueByPath(fromObject, [
5098
5115
  'timeRangeFilter',
5099
5116
  ]);
5100
5117
  if (fromTimeRangeFilter != null) {
5101
5118
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
5102
5119
  }
5103
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5104
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
5105
- }
5106
5120
  return toObject;
5107
5121
  }
5108
5122
  function listCachedContentsConfigToMldev(fromObject, parentObject) {
@@ -5203,30 +5217,6 @@ function listCachedContentsResponseFromVertex(fromObject) {
5203
5217
  }
5204
5218
  function partToMldev$3(fromObject) {
5205
5219
  const toObject = {};
5206
- const fromVideoMetadata = getValueByPath(fromObject, [
5207
- 'videoMetadata',
5208
- ]);
5209
- if (fromVideoMetadata != null) {
5210
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
5211
- }
5212
- const fromThought = getValueByPath(fromObject, ['thought']);
5213
- if (fromThought != null) {
5214
- setValueByPath(toObject, ['thought'], fromThought);
5215
- }
5216
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5217
- if (fromInlineData != null) {
5218
- setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
5219
- }
5220
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5221
- if (fromFileData != null) {
5222
- setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5223
- }
5224
- const fromThoughtSignature = getValueByPath(fromObject, [
5225
- 'thoughtSignature',
5226
- ]);
5227
- if (fromThoughtSignature != null) {
5228
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5229
- }
5230
5220
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5231
5221
  if (fromFunctionCall != null) {
5232
5222
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -5243,16 +5233,40 @@ function partToMldev$3(fromObject) {
5243
5233
  if (fromExecutableCode != null) {
5244
5234
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5245
5235
  }
5236
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5237
+ if (fromFileData != null) {
5238
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5239
+ }
5246
5240
  const fromFunctionResponse = getValueByPath(fromObject, [
5247
5241
  'functionResponse',
5248
5242
  ]);
5249
5243
  if (fromFunctionResponse != null) {
5250
5244
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
5251
5245
  }
5246
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5247
+ if (fromInlineData != null) {
5248
+ setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
5249
+ }
5252
5250
  const fromText = getValueByPath(fromObject, ['text']);
5253
5251
  if (fromText != null) {
5254
5252
  setValueByPath(toObject, ['text'], fromText);
5255
5253
  }
5254
+ const fromThought = getValueByPath(fromObject, ['thought']);
5255
+ if (fromThought != null) {
5256
+ setValueByPath(toObject, ['thought'], fromThought);
5257
+ }
5258
+ const fromThoughtSignature = getValueByPath(fromObject, [
5259
+ 'thoughtSignature',
5260
+ ]);
5261
+ if (fromThoughtSignature != null) {
5262
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5263
+ }
5264
+ const fromVideoMetadata = getValueByPath(fromObject, [
5265
+ 'videoMetadata',
5266
+ ]);
5267
+ if (fromVideoMetadata != null) {
5268
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
5269
+ }
5256
5270
  return toObject;
5257
5271
  }
5258
5272
  function toolToMldev$3(fromObject) {
@@ -5272,27 +5286,16 @@ function toolToMldev$3(fromObject) {
5272
5286
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
5273
5287
  throw new Error('retrieval parameter is not supported in Gemini API.');
5274
5288
  }
5275
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5276
- if (fromGoogleSearch != null) {
5277
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
5278
- }
5279
5289
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5280
5290
  'googleSearchRetrieval',
5281
5291
  ]);
5282
5292
  if (fromGoogleSearchRetrieval != null) {
5283
5293
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5284
5294
  }
5285
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5286
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5287
- }
5288
5295
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5289
5296
  if (fromGoogleMaps != null) {
5290
5297
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5291
5298
  }
5292
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5293
- if (fromUrlContext != null) {
5294
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
5295
- }
5296
5299
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5297
5300
  if (fromComputerUse != null) {
5298
5301
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -5303,6 +5306,17 @@ function toolToMldev$3(fromObject) {
5303
5306
  if (fromCodeExecution != null) {
5304
5307
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5305
5308
  }
5309
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5310
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5311
+ }
5312
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5313
+ if (fromGoogleSearch != null) {
5314
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
5315
+ }
5316
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5317
+ if (fromUrlContext != null) {
5318
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
5319
+ }
5306
5320
  return toObject;
5307
5321
  }
5308
5322
  function toolToVertex$2(fromObject) {
@@ -5323,30 +5337,16 @@ function toolToVertex$2(fromObject) {
5323
5337
  if (fromRetrieval != null) {
5324
5338
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
5325
5339
  }
5326
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5327
- if (fromGoogleSearch != null) {
5328
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
5329
- }
5330
5340
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5331
5341
  'googleSearchRetrieval',
5332
5342
  ]);
5333
5343
  if (fromGoogleSearchRetrieval != null) {
5334
5344
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5335
5345
  }
5336
- const fromEnterpriseWebSearch = getValueByPath(fromObject, [
5337
- 'enterpriseWebSearch',
5338
- ]);
5339
- if (fromEnterpriseWebSearch != null) {
5340
- setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
5341
- }
5342
5346
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5343
5347
  if (fromGoogleMaps != null) {
5344
5348
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
5345
5349
  }
5346
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5347
- if (fromUrlContext != null) {
5348
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
5349
- }
5350
5350
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5351
5351
  if (fromComputerUse != null) {
5352
5352
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -5357,6 +5357,20 @@ function toolToVertex$2(fromObject) {
5357
5357
  if (fromCodeExecution != null) {
5358
5358
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5359
5359
  }
5360
+ const fromEnterpriseWebSearch = getValueByPath(fromObject, [
5361
+ 'enterpriseWebSearch',
5362
+ ]);
5363
+ if (fromEnterpriseWebSearch != null) {
5364
+ setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
5365
+ }
5366
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5367
+ if (fromGoogleSearch != null) {
5368
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
5369
+ }
5370
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5371
+ if (fromUrlContext != null) {
5372
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
5373
+ }
5360
5374
  return toObject;
5361
5375
  }
5362
5376
  function updateCachedContentConfigToMldev(fromObject, parentObject) {
@@ -6193,7 +6207,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6193
6207
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6194
6208
  const USER_AGENT_HEADER = 'User-Agent';
6195
6209
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6196
- const SDK_VERSION = '1.26.0'; // x-release-please-version
6210
+ const SDK_VERSION = '1.28.0'; // x-release-please-version
6197
6211
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6198
6212
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6199
6213
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -6382,7 +6396,7 @@ class ApiClient {
6382
6396
  else {
6383
6397
  requestInit.body = request.body;
6384
6398
  }
6385
- requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
6399
+ requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
6386
6400
  return this.unaryApiCall(url, requestInit, request.httpMethod);
6387
6401
  }
6388
6402
  patchHttpOptions(baseHttpOptions, requestHttpOptions) {
@@ -6416,10 +6430,10 @@ class ApiClient {
6416
6430
  }
6417
6431
  let requestInit = {};
6418
6432
  requestInit.body = request.body;
6419
- requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, request.abortSignal);
6433
+ requestInit = await this.includeExtraHttpOptionsToRequestInit(requestInit, patchedHttpOptions, url.toString(), request.abortSignal);
6420
6434
  return this.streamApiCall(url, requestInit, request.httpMethod);
6421
6435
  }
6422
- async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, abortSignal) {
6436
+ async includeExtraHttpOptionsToRequestInit(requestInit, httpOptions, url, abortSignal) {
6423
6437
  if ((httpOptions && httpOptions.timeout) || abortSignal) {
6424
6438
  const abortController = new AbortController();
6425
6439
  const signal = abortController.signal;
@@ -6443,7 +6457,7 @@ class ApiClient {
6443
6457
  if (httpOptions && httpOptions.extraBody !== null) {
6444
6458
  includeExtraBodyToRequestInit(requestInit, httpOptions.extraBody);
6445
6459
  }
6446
- requestInit.headers = await this.getHeadersInternal(httpOptions);
6460
+ requestInit.headers = await this.getHeadersInternal(httpOptions, url);
6447
6461
  return requestInit;
6448
6462
  }
6449
6463
  async unaryApiCall(url, requestInit, httpMethod) {
@@ -6556,7 +6570,7 @@ class ApiClient {
6556
6570
  headers[CONTENT_TYPE_HEADER] = 'application/json';
6557
6571
  return headers;
6558
6572
  }
6559
- async getHeadersInternal(httpOptions) {
6573
+ async getHeadersInternal(httpOptions, url) {
6560
6574
  const headers = new Headers();
6561
6575
  if (httpOptions && httpOptions.headers) {
6562
6576
  for (const [key, value] of Object.entries(httpOptions.headers)) {
@@ -6568,7 +6582,7 @@ class ApiClient {
6568
6582
  headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
6569
6583
  }
6570
6584
  }
6571
- await this.clientOptions.auth.addAuthHeaders(headers);
6585
+ await this.clientOptions.auth.addAuthHeaders(headers, url);
6572
6586
  return headers;
6573
6587
  }
6574
6588
  /**
@@ -6577,13 +6591,13 @@ class ApiClient {
6577
6591
  *
6578
6592
  * @param file The string path to the file to be uploaded or a Blob object.
6579
6593
  * @param config Optional parameters specified in the `UploadFileConfig`
6580
- * interface. @see {@link UploadFileConfig}
6594
+ * interface. @see {@link types.UploadFileConfig}
6581
6595
  * @return A promise that resolves to a `File` object.
6582
6596
  * @throws An error if called on a Vertex AI client.
6583
6597
  * @throws An error if the `mimeType` is not provided and can not be inferred,
6584
6598
  */
6585
6599
  async uploadFile(file, config) {
6586
- var _a;
6600
+ var _a, _b;
6587
6601
  const fileToUpload = {};
6588
6602
  if (config != null) {
6589
6603
  fileToUpload.mimeType = config.mimeType;
@@ -6601,20 +6615,25 @@ class ApiClient {
6601
6615
  throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
6602
6616
  }
6603
6617
  fileToUpload.mimeType = mimeType;
6604
- const uploadUrl = await this.fetchUploadUrl(fileToUpload, config);
6618
+ let fileName = '';
6619
+ if (typeof file === 'string') {
6620
+ fileName = file.replace(/[/\\]+$/, '');
6621
+ fileName = (_b = fileName.split(/[/\\]/).pop()) !== null && _b !== void 0 ? _b : '';
6622
+ }
6623
+ const uploadUrl = await this.fetchUploadUrl(fileToUpload, fileName, config);
6605
6624
  return uploader.upload(file, uploadUrl, this);
6606
6625
  }
6607
6626
  /**
6608
6627
  * Downloads a file asynchronously to the specified path.
6609
6628
  *
6610
6629
  * @params params - The parameters for the download request, see {@link
6611
- * DownloadFileParameters}
6630
+ * types.DownloadFileParameters}
6612
6631
  */
6613
6632
  async downloadFile(params) {
6614
6633
  const downloader = this.clientOptions.downloader;
6615
6634
  await downloader.download(params, this);
6616
6635
  }
6617
- async fetchUploadUrl(file, config) {
6636
+ async fetchUploadUrl(file, fileName, config) {
6618
6637
  var _a;
6619
6638
  let httpOptions = {};
6620
6639
  if (config === null || config === void 0 ? void 0 : config.httpOptions) {
@@ -6623,13 +6642,7 @@ class ApiClient {
6623
6642
  else {
6624
6643
  httpOptions = {
6625
6644
  apiVersion: '',
6626
- headers: {
6627
- 'Content-Type': 'application/json',
6628
- 'X-Goog-Upload-Protocol': 'resumable',
6629
- 'X-Goog-Upload-Command': 'start',
6630
- 'X-Goog-Upload-Header-Content-Length': `${file.sizeBytes}`,
6631
- 'X-Goog-Upload-Header-Content-Type': `${file.mimeType}`,
6632
- },
6645
+ 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 } : {})),
6633
6646
  };
6634
6647
  }
6635
6648
  const body = {
@@ -7262,13 +7275,13 @@ class Files extends BaseModule {
7262
7275
  */
7263
7276
  function blobToMldev$2(fromObject) {
7264
7277
  const toObject = {};
7265
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7266
- throw new Error('displayName parameter is not supported in Gemini API.');
7267
- }
7268
7278
  const fromData = getValueByPath(fromObject, ['data']);
7269
7279
  if (fromData != null) {
7270
7280
  setValueByPath(toObject, ['data'], fromData);
7271
7281
  }
7282
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7283
+ throw new Error('displayName parameter is not supported in Gemini API.');
7284
+ }
7272
7285
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
7273
7286
  if (fromMimeType != null) {
7274
7287
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -7484,15 +7497,15 @@ function googleMapsToMldev$2(fromObject) {
7484
7497
  }
7485
7498
  function googleSearchToMldev$2(fromObject) {
7486
7499
  const toObject = {};
7500
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
7501
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
7502
+ }
7487
7503
  const fromTimeRangeFilter = getValueByPath(fromObject, [
7488
7504
  'timeRangeFilter',
7489
7505
  ]);
7490
7506
  if (fromTimeRangeFilter != null) {
7491
7507
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
7492
7508
  }
7493
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
7494
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
7495
- }
7496
7509
  return toObject;
7497
7510
  }
7498
7511
  function liveConnectConfigToMldev$1(fromObject, parentObject) {
@@ -7893,30 +7906,6 @@ function liveServerMessageFromVertex(fromObject) {
7893
7906
  }
7894
7907
  function partToMldev$2(fromObject) {
7895
7908
  const toObject = {};
7896
- const fromVideoMetadata = getValueByPath(fromObject, [
7897
- 'videoMetadata',
7898
- ]);
7899
- if (fromVideoMetadata != null) {
7900
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
7901
- }
7902
- const fromThought = getValueByPath(fromObject, ['thought']);
7903
- if (fromThought != null) {
7904
- setValueByPath(toObject, ['thought'], fromThought);
7905
- }
7906
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
7907
- if (fromInlineData != null) {
7908
- setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
7909
- }
7910
- const fromFileData = getValueByPath(fromObject, ['fileData']);
7911
- if (fromFileData != null) {
7912
- setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7913
- }
7914
- const fromThoughtSignature = getValueByPath(fromObject, [
7915
- 'thoughtSignature',
7916
- ]);
7917
- if (fromThoughtSignature != null) {
7918
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7919
- }
7920
7909
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7921
7910
  if (fromFunctionCall != null) {
7922
7911
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7933,16 +7922,40 @@ function partToMldev$2(fromObject) {
7933
7922
  if (fromExecutableCode != null) {
7934
7923
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7935
7924
  }
7925
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
7926
+ if (fromFileData != null) {
7927
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7928
+ }
7936
7929
  const fromFunctionResponse = getValueByPath(fromObject, [
7937
7930
  'functionResponse',
7938
7931
  ]);
7939
7932
  if (fromFunctionResponse != null) {
7940
7933
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
7941
7934
  }
7935
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
7936
+ if (fromInlineData != null) {
7937
+ setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
7938
+ }
7942
7939
  const fromText = getValueByPath(fromObject, ['text']);
7943
7940
  if (fromText != null) {
7944
7941
  setValueByPath(toObject, ['text'], fromText);
7945
7942
  }
7943
+ const fromThought = getValueByPath(fromObject, ['thought']);
7944
+ if (fromThought != null) {
7945
+ setValueByPath(toObject, ['thought'], fromThought);
7946
+ }
7947
+ const fromThoughtSignature = getValueByPath(fromObject, [
7948
+ 'thoughtSignature',
7949
+ ]);
7950
+ if (fromThoughtSignature != null) {
7951
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7952
+ }
7953
+ const fromVideoMetadata = getValueByPath(fromObject, [
7954
+ 'videoMetadata',
7955
+ ]);
7956
+ if (fromVideoMetadata != null) {
7957
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
7958
+ }
7946
7959
  return toObject;
7947
7960
  }
7948
7961
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -7958,6 +7971,10 @@ function sessionResumptionConfigToMldev$1(fromObject) {
7958
7971
  }
7959
7972
  function speechConfigToVertex$1(fromObject) {
7960
7973
  const toObject = {};
7974
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7975
+ if (fromLanguageCode != null) {
7976
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7977
+ }
7961
7978
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
7962
7979
  if (fromVoiceConfig != null) {
7963
7980
  setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
@@ -7965,10 +7982,6 @@ function speechConfigToVertex$1(fromObject) {
7965
7982
  if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
7966
7983
  throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
7967
7984
  }
7968
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7969
- if (fromLanguageCode != null) {
7970
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7971
- }
7972
7985
  return toObject;
7973
7986
  }
7974
7987
  function toolToMldev$2(fromObject) {
@@ -7988,27 +8001,16 @@ function toolToMldev$2(fromObject) {
7988
8001
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
7989
8002
  throw new Error('retrieval parameter is not supported in Gemini API.');
7990
8003
  }
7991
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7992
- if (fromGoogleSearch != null) {
7993
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
7994
- }
7995
8004
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7996
8005
  'googleSearchRetrieval',
7997
8006
  ]);
7998
8007
  if (fromGoogleSearchRetrieval != null) {
7999
8008
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
8000
8009
  }
8001
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
8002
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
8003
- }
8004
8010
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
8005
8011
  if (fromGoogleMaps != null) {
8006
8012
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
8007
8013
  }
8008
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
8009
- if (fromUrlContext != null) {
8010
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
8011
- }
8012
8014
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8013
8015
  if (fromComputerUse != null) {
8014
8016
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -8019,6 +8021,17 @@ function toolToMldev$2(fromObject) {
8019
8021
  if (fromCodeExecution != null) {
8020
8022
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8021
8023
  }
8024
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
8025
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
8026
+ }
8027
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
8028
+ if (fromGoogleSearch != null) {
8029
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
8030
+ }
8031
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
8032
+ if (fromUrlContext != null) {
8033
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
8034
+ }
8022
8035
  return toObject;
8023
8036
  }
8024
8037
  function toolToVertex$1(fromObject) {
@@ -8039,30 +8052,16 @@ function toolToVertex$1(fromObject) {
8039
8052
  if (fromRetrieval != null) {
8040
8053
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
8041
8054
  }
8042
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
8043
- if (fromGoogleSearch != null) {
8044
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
8045
- }
8046
8055
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
8047
8056
  'googleSearchRetrieval',
8048
8057
  ]);
8049
8058
  if (fromGoogleSearchRetrieval != null) {
8050
8059
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
8051
8060
  }
8052
- const fromEnterpriseWebSearch = getValueByPath(fromObject, [
8053
- 'enterpriseWebSearch',
8054
- ]);
8055
- if (fromEnterpriseWebSearch != null) {
8056
- setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
8057
- }
8058
8061
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
8059
8062
  if (fromGoogleMaps != null) {
8060
8063
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
8061
8064
  }
8062
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
8063
- if (fromUrlContext != null) {
8064
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
8065
- }
8066
8065
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
8067
8066
  if (fromComputerUse != null) {
8068
8067
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -8073,6 +8072,20 @@ function toolToVertex$1(fromObject) {
8073
8072
  if (fromCodeExecution != null) {
8074
8073
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
8075
8074
  }
8075
+ const fromEnterpriseWebSearch = getValueByPath(fromObject, [
8076
+ 'enterpriseWebSearch',
8077
+ ]);
8078
+ if (fromEnterpriseWebSearch != null) {
8079
+ setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
8080
+ }
8081
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
8082
+ if (fromGoogleSearch != null) {
8083
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
8084
+ }
8085
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
8086
+ if (fromUrlContext != null) {
8087
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
8088
+ }
8076
8089
  return toObject;
8077
8090
  }
8078
8091
  function usageMetadataFromVertex(fromObject) {
@@ -8175,13 +8188,13 @@ function usageMetadataFromVertex(fromObject) {
8175
8188
  */
8176
8189
  function blobToMldev$1(fromObject) {
8177
8190
  const toObject = {};
8178
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
8179
- throw new Error('displayName parameter is not supported in Gemini API.');
8180
- }
8181
8191
  const fromData = getValueByPath(fromObject, ['data']);
8182
8192
  if (fromData != null) {
8183
8193
  setValueByPath(toObject, ['data'], fromData);
8184
8194
  }
8195
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
8196
+ throw new Error('displayName parameter is not supported in Gemini API.');
8197
+ }
8185
8198
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
8186
8199
  if (fromMimeType != null) {
8187
8200
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -8208,12 +8221,6 @@ function candidateFromMldev(fromObject) {
8208
8221
  if (fromFinishReason != null) {
8209
8222
  setValueByPath(toObject, ['finishReason'], fromFinishReason);
8210
8223
  }
8211
- const fromUrlContextMetadata = getValueByPath(fromObject, [
8212
- 'urlContextMetadata',
8213
- ]);
8214
- if (fromUrlContextMetadata != null) {
8215
- setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
8216
- }
8217
8224
  const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
8218
8225
  if (fromAvgLogprobs != null) {
8219
8226
  setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
@@ -8246,6 +8253,12 @@ function candidateFromMldev(fromObject) {
8246
8253
  }
8247
8254
  setValueByPath(toObject, ['safetyRatings'], transformedList);
8248
8255
  }
8256
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
8257
+ 'urlContextMetadata',
8258
+ ]);
8259
+ if (fromUrlContextMetadata != null) {
8260
+ setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
8261
+ }
8249
8262
  return toObject;
8250
8263
  }
8251
8264
  function citationMetadataFromMldev(fromObject) {
@@ -10163,15 +10176,15 @@ function googleMapsToMldev$1(fromObject) {
10163
10176
  }
10164
10177
  function googleSearchToMldev$1(fromObject) {
10165
10178
  const toObject = {};
10179
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
10180
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
10181
+ }
10166
10182
  const fromTimeRangeFilter = getValueByPath(fromObject, [
10167
10183
  'timeRangeFilter',
10168
10184
  ]);
10169
10185
  if (fromTimeRangeFilter != null) {
10170
10186
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
10171
10187
  }
10172
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
10173
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
10174
- }
10175
10188
  return toObject;
10176
10189
  }
10177
10190
  function imageFromMldev(fromObject) {
@@ -10461,30 +10474,6 @@ function modelFromVertex(fromObject) {
10461
10474
  }
10462
10475
  function partToMldev$1(fromObject) {
10463
10476
  const toObject = {};
10464
- const fromVideoMetadata = getValueByPath(fromObject, [
10465
- 'videoMetadata',
10466
- ]);
10467
- if (fromVideoMetadata != null) {
10468
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
10469
- }
10470
- const fromThought = getValueByPath(fromObject, ['thought']);
10471
- if (fromThought != null) {
10472
- setValueByPath(toObject, ['thought'], fromThought);
10473
- }
10474
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
10475
- if (fromInlineData != null) {
10476
- setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
10477
- }
10478
- const fromFileData = getValueByPath(fromObject, ['fileData']);
10479
- if (fromFileData != null) {
10480
- setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
10481
- }
10482
- const fromThoughtSignature = getValueByPath(fromObject, [
10483
- 'thoughtSignature',
10484
- ]);
10485
- if (fromThoughtSignature != null) {
10486
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
10487
- }
10488
10477
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
10489
10478
  if (fromFunctionCall != null) {
10490
10479
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -10501,16 +10490,40 @@ function partToMldev$1(fromObject) {
10501
10490
  if (fromExecutableCode != null) {
10502
10491
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
10503
10492
  }
10493
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
10494
+ if (fromFileData != null) {
10495
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
10496
+ }
10504
10497
  const fromFunctionResponse = getValueByPath(fromObject, [
10505
10498
  'functionResponse',
10506
10499
  ]);
10507
10500
  if (fromFunctionResponse != null) {
10508
10501
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
10509
10502
  }
10503
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
10504
+ if (fromInlineData != null) {
10505
+ setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
10506
+ }
10510
10507
  const fromText = getValueByPath(fromObject, ['text']);
10511
10508
  if (fromText != null) {
10512
10509
  setValueByPath(toObject, ['text'], fromText);
10513
10510
  }
10511
+ const fromThought = getValueByPath(fromObject, ['thought']);
10512
+ if (fromThought != null) {
10513
+ setValueByPath(toObject, ['thought'], fromThought);
10514
+ }
10515
+ const fromThoughtSignature = getValueByPath(fromObject, [
10516
+ 'thoughtSignature',
10517
+ ]);
10518
+ if (fromThoughtSignature != null) {
10519
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
10520
+ }
10521
+ const fromVideoMetadata = getValueByPath(fromObject, [
10522
+ 'videoMetadata',
10523
+ ]);
10524
+ if (fromVideoMetadata != null) {
10525
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
10526
+ }
10514
10527
  return toObject;
10515
10528
  }
10516
10529
  function productImageToVertex(fromObject) {
@@ -10727,13 +10740,13 @@ function safetyAttributesFromVertex(fromObject) {
10727
10740
  }
10728
10741
  function safetySettingToMldev(fromObject) {
10729
10742
  const toObject = {};
10730
- if (getValueByPath(fromObject, ['method']) !== undefined) {
10731
- throw new Error('method parameter is not supported in Gemini API.');
10732
- }
10733
10743
  const fromCategory = getValueByPath(fromObject, ['category']);
10734
10744
  if (fromCategory != null) {
10735
10745
  setValueByPath(toObject, ['category'], fromCategory);
10736
10746
  }
10747
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
10748
+ throw new Error('method parameter is not supported in Gemini API.');
10749
+ }
10737
10750
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
10738
10751
  if (fromThreshold != null) {
10739
10752
  setValueByPath(toObject, ['threshold'], fromThreshold);
@@ -10832,6 +10845,10 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
10832
10845
  }
10833
10846
  function speechConfigToVertex(fromObject) {
10834
10847
  const toObject = {};
10848
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
10849
+ if (fromLanguageCode != null) {
10850
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
10851
+ }
10835
10852
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
10836
10853
  if (fromVoiceConfig != null) {
10837
10854
  setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
@@ -10839,10 +10856,6 @@ function speechConfigToVertex(fromObject) {
10839
10856
  if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
10840
10857
  throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
10841
10858
  }
10842
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
10843
- if (fromLanguageCode != null) {
10844
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
10845
- }
10846
10859
  return toObject;
10847
10860
  }
10848
10861
  function toolToMldev$1(fromObject) {
@@ -10862,27 +10875,16 @@ function toolToMldev$1(fromObject) {
10862
10875
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
10863
10876
  throw new Error('retrieval parameter is not supported in Gemini API.');
10864
10877
  }
10865
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10866
- if (fromGoogleSearch != null) {
10867
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
10868
- }
10869
10878
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10870
10879
  'googleSearchRetrieval',
10871
10880
  ]);
10872
10881
  if (fromGoogleSearchRetrieval != null) {
10873
10882
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10874
10883
  }
10875
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10876
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10877
- }
10878
10884
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10879
10885
  if (fromGoogleMaps != null) {
10880
10886
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10881
10887
  }
10882
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10883
- if (fromUrlContext != null) {
10884
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
10885
- }
10886
10888
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10887
10889
  if (fromComputerUse != null) {
10888
10890
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -10893,6 +10895,17 @@ function toolToMldev$1(fromObject) {
10893
10895
  if (fromCodeExecution != null) {
10894
10896
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10895
10897
  }
10898
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10899
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10900
+ }
10901
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10902
+ if (fromGoogleSearch != null) {
10903
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
10904
+ }
10905
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10906
+ if (fromUrlContext != null) {
10907
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
10908
+ }
10896
10909
  return toObject;
10897
10910
  }
10898
10911
  function toolToVertex(fromObject) {
@@ -10913,30 +10926,16 @@ function toolToVertex(fromObject) {
10913
10926
  if (fromRetrieval != null) {
10914
10927
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
10915
10928
  }
10916
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10917
- if (fromGoogleSearch != null) {
10918
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
10919
- }
10920
10929
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10921
10930
  'googleSearchRetrieval',
10922
10931
  ]);
10923
10932
  if (fromGoogleSearchRetrieval != null) {
10924
10933
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10925
10934
  }
10926
- const fromEnterpriseWebSearch = getValueByPath(fromObject, [
10927
- 'enterpriseWebSearch',
10928
- ]);
10929
- if (fromEnterpriseWebSearch != null) {
10930
- setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
10931
- }
10932
10935
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10933
10936
  if (fromGoogleMaps != null) {
10934
10937
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
10935
10938
  }
10936
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10937
- if (fromUrlContext != null) {
10938
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
10939
- }
10940
10939
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10941
10940
  if (fromComputerUse != null) {
10942
10941
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -10947,6 +10946,20 @@ function toolToVertex(fromObject) {
10947
10946
  if (fromCodeExecution != null) {
10948
10947
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10949
10948
  }
10949
+ const fromEnterpriseWebSearch = getValueByPath(fromObject, [
10950
+ 'enterpriseWebSearch',
10951
+ ]);
10952
+ if (fromEnterpriseWebSearch != null) {
10953
+ setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
10954
+ }
10955
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10956
+ if (fromGoogleSearch != null) {
10957
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
10958
+ }
10959
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10960
+ if (fromUrlContext != null) {
10961
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
10962
+ }
10950
10963
  return toObject;
10951
10964
  }
10952
10965
  function tunedModelInfoFromMldev(fromObject) {
@@ -11050,6 +11063,18 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
11050
11063
  if (parentObject !== undefined && fromOutputGcsUri != null) {
11051
11064
  setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
11052
11065
  }
11066
+ const fromSafetyFilterLevel = getValueByPath(fromObject, [
11067
+ 'safetyFilterLevel',
11068
+ ]);
11069
+ if (parentObject !== undefined && fromSafetyFilterLevel != null) {
11070
+ setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
11071
+ }
11072
+ const fromPersonGeneration = getValueByPath(fromObject, [
11073
+ 'personGeneration',
11074
+ ]);
11075
+ if (parentObject !== undefined && fromPersonGeneration != null) {
11076
+ setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
11077
+ }
11053
11078
  const fromIncludeRaiReason = getValueByPath(fromObject, [
11054
11079
  'includeRaiReason',
11055
11080
  ]);
@@ -11770,7 +11795,7 @@ class Live {
11770
11795
  const headers = mapToHeaders(clientHeaders);
11771
11796
  if (this.apiClient.isVertexAI()) {
11772
11797
  url = `${websocketBaseUrl}/ws/google.cloud.aiplatform.${apiVersion}.LlmBidiService/BidiGenerateContent`;
11773
- await this.auth.addAuthHeaders(headers);
11798
+ await this.auth.addAuthHeaders(headers, url);
11774
11799
  }
11775
11800
  else {
11776
11801
  const apiKey = this.apiClient.getApiKey();
@@ -13821,13 +13846,13 @@ class Operations extends BaseModule {
13821
13846
  */
13822
13847
  function blobToMldev(fromObject) {
13823
13848
  const toObject = {};
13824
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
13825
- throw new Error('displayName parameter is not supported in Gemini API.');
13826
- }
13827
13849
  const fromData = getValueByPath(fromObject, ['data']);
13828
13850
  if (fromData != null) {
13829
13851
  setValueByPath(toObject, ['data'], fromData);
13830
13852
  }
13853
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
13854
+ throw new Error('displayName parameter is not supported in Gemini API.');
13855
+ }
13831
13856
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
13832
13857
  if (fromMimeType != null) {
13833
13858
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -13918,15 +13943,15 @@ function googleMapsToMldev(fromObject) {
13918
13943
  }
13919
13944
  function googleSearchToMldev(fromObject) {
13920
13945
  const toObject = {};
13946
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13947
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
13948
+ }
13921
13949
  const fromTimeRangeFilter = getValueByPath(fromObject, [
13922
13950
  'timeRangeFilter',
13923
13951
  ]);
13924
13952
  if (fromTimeRangeFilter != null) {
13925
13953
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
13926
13954
  }
13927
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13928
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
13929
- }
13930
13955
  return toObject;
13931
13956
  }
13932
13957
  function liveConnectConfigToMldev(fromObject, parentObject) {
@@ -14053,30 +14078,6 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
14053
14078
  }
14054
14079
  function partToMldev(fromObject) {
14055
14080
  const toObject = {};
14056
- const fromVideoMetadata = getValueByPath(fromObject, [
14057
- 'videoMetadata',
14058
- ]);
14059
- if (fromVideoMetadata != null) {
14060
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
14061
- }
14062
- const fromThought = getValueByPath(fromObject, ['thought']);
14063
- if (fromThought != null) {
14064
- setValueByPath(toObject, ['thought'], fromThought);
14065
- }
14066
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
14067
- if (fromInlineData != null) {
14068
- setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
14069
- }
14070
- const fromFileData = getValueByPath(fromObject, ['fileData']);
14071
- if (fromFileData != null) {
14072
- setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14073
- }
14074
- const fromThoughtSignature = getValueByPath(fromObject, [
14075
- 'thoughtSignature',
14076
- ]);
14077
- if (fromThoughtSignature != null) {
14078
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
14079
- }
14080
14081
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
14081
14082
  if (fromFunctionCall != null) {
14082
14083
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -14093,16 +14094,40 @@ function partToMldev(fromObject) {
14093
14094
  if (fromExecutableCode != null) {
14094
14095
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
14095
14096
  }
14097
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
14098
+ if (fromFileData != null) {
14099
+ setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14100
+ }
14096
14101
  const fromFunctionResponse = getValueByPath(fromObject, [
14097
14102
  'functionResponse',
14098
14103
  ]);
14099
14104
  if (fromFunctionResponse != null) {
14100
14105
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
14101
14106
  }
14107
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
14108
+ if (fromInlineData != null) {
14109
+ setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
14110
+ }
14102
14111
  const fromText = getValueByPath(fromObject, ['text']);
14103
14112
  if (fromText != null) {
14104
14113
  setValueByPath(toObject, ['text'], fromText);
14105
14114
  }
14115
+ const fromThought = getValueByPath(fromObject, ['thought']);
14116
+ if (fromThought != null) {
14117
+ setValueByPath(toObject, ['thought'], fromThought);
14118
+ }
14119
+ const fromThoughtSignature = getValueByPath(fromObject, [
14120
+ 'thoughtSignature',
14121
+ ]);
14122
+ if (fromThoughtSignature != null) {
14123
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
14124
+ }
14125
+ const fromVideoMetadata = getValueByPath(fromObject, [
14126
+ 'videoMetadata',
14127
+ ]);
14128
+ if (fromVideoMetadata != null) {
14129
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
14130
+ }
14106
14131
  return toObject;
14107
14132
  }
14108
14133
  function sessionResumptionConfigToMldev(fromObject) {
@@ -14133,27 +14158,16 @@ function toolToMldev(fromObject) {
14133
14158
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
14134
14159
  throw new Error('retrieval parameter is not supported in Gemini API.');
14135
14160
  }
14136
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14137
- if (fromGoogleSearch != null) {
14138
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
14139
- }
14140
14161
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
14141
14162
  'googleSearchRetrieval',
14142
14163
  ]);
14143
14164
  if (fromGoogleSearchRetrieval != null) {
14144
14165
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
14145
14166
  }
14146
- if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
14147
- throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
14148
- }
14149
14167
  const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
14150
14168
  if (fromGoogleMaps != null) {
14151
14169
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
14152
14170
  }
14153
- const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
14154
- if (fromUrlContext != null) {
14155
- setValueByPath(toObject, ['urlContext'], fromUrlContext);
14156
- }
14157
14171
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
14158
14172
  if (fromComputerUse != null) {
14159
14173
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
@@ -14164,6 +14178,17 @@ function toolToMldev(fromObject) {
14164
14178
  if (fromCodeExecution != null) {
14165
14179
  setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
14166
14180
  }
14181
+ if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
14182
+ throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
14183
+ }
14184
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14185
+ if (fromGoogleSearch != null) {
14186
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
14187
+ }
14188
+ const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
14189
+ if (fromUrlContext != null) {
14190
+ setValueByPath(toObject, ['urlContext'], fromUrlContext);
14191
+ }
14167
14192
  return toObject;
14168
14193
  }
14169
14194
 
@@ -14443,7 +14468,7 @@ class Tokens extends BaseModule {
14443
14468
  * SPDX-License-Identifier: Apache-2.0
14444
14469
  */
14445
14470
  // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14446
- function cancelTuningJobParametersToMldev(fromObject) {
14471
+ function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
14447
14472
  const toObject = {};
14448
14473
  const fromName = getValueByPath(fromObject, ['name']);
14449
14474
  if (fromName != null) {
@@ -14451,7 +14476,7 @@ function cancelTuningJobParametersToMldev(fromObject) {
14451
14476
  }
14452
14477
  return toObject;
14453
14478
  }
14454
- function cancelTuningJobParametersToVertex(fromObject) {
14479
+ function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
14455
14480
  const toObject = {};
14456
14481
  const fromName = getValueByPath(fromObject, ['name']);
14457
14482
  if (fromName != null) {
@@ -14459,7 +14484,7 @@ function cancelTuningJobParametersToVertex(fromObject) {
14459
14484
  }
14460
14485
  return toObject;
14461
14486
  }
14462
- function createTuningJobConfigToMldev(fromObject, parentObject) {
14487
+ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
14463
14488
  const toObject = {};
14464
14489
  if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
14465
14490
  throw new Error('validationDataset parameter is not supported in Gemini API.');
@@ -14505,15 +14530,35 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
14505
14530
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
14506
14531
  throw new Error('labels parameter is not supported in Gemini API.');
14507
14532
  }
14533
+ if (getValueByPath(fromObject, ['beta']) !== undefined) {
14534
+ throw new Error('beta parameter is not supported in Gemini API.');
14535
+ }
14508
14536
  return toObject;
14509
14537
  }
14510
- function createTuningJobConfigToVertex(fromObject, parentObject) {
14538
+ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14511
14539
  const toObject = {};
14512
- const fromValidationDataset = getValueByPath(fromObject, [
14513
- 'validationDataset',
14540
+ let discriminatorValidationDataset = getValueByPath(rootObject, [
14541
+ 'config',
14542
+ 'method',
14514
14543
  ]);
14515
- if (parentObject !== undefined && fromValidationDataset != null) {
14516
- setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset, toObject));
14544
+ if (discriminatorValidationDataset === undefined) {
14545
+ discriminatorValidationDataset = 'SUPERVISED_FINE_TUNING';
14546
+ }
14547
+ if (discriminatorValidationDataset === 'SUPERVISED_FINE_TUNING') {
14548
+ const fromValidationDataset = getValueByPath(fromObject, [
14549
+ 'validationDataset',
14550
+ ]);
14551
+ if (parentObject !== undefined && fromValidationDataset != null) {
14552
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
14553
+ }
14554
+ }
14555
+ else if (discriminatorValidationDataset === 'PREFERENCE_TUNING') {
14556
+ const fromValidationDataset = getValueByPath(fromObject, [
14557
+ 'validationDataset',
14558
+ ]);
14559
+ if (parentObject !== undefined && fromValidationDataset != null) {
14560
+ setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
14561
+ }
14517
14562
  }
14518
14563
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
14519
14564
  'tunedModelDisplayName',
@@ -14525,25 +14570,90 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
14525
14570
  if (parentObject !== undefined && fromDescription != null) {
14526
14571
  setValueByPath(parentObject, ['description'], fromDescription);
14527
14572
  }
14528
- const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14529
- if (parentObject !== undefined && fromEpochCount != null) {
14530
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
14573
+ let discriminatorEpochCount = getValueByPath(rootObject, [
14574
+ 'config',
14575
+ 'method',
14576
+ ]);
14577
+ if (discriminatorEpochCount === undefined) {
14578
+ discriminatorEpochCount = 'SUPERVISED_FINE_TUNING';
14531
14579
  }
14532
- const fromLearningRateMultiplier = getValueByPath(fromObject, [
14533
- 'learningRateMultiplier',
14580
+ if (discriminatorEpochCount === 'SUPERVISED_FINE_TUNING') {
14581
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14582
+ if (parentObject !== undefined && fromEpochCount != null) {
14583
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
14584
+ }
14585
+ }
14586
+ else if (discriminatorEpochCount === 'PREFERENCE_TUNING') {
14587
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14588
+ if (parentObject !== undefined && fromEpochCount != null) {
14589
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
14590
+ }
14591
+ }
14592
+ let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
14593
+ 'config',
14594
+ 'method',
14534
14595
  ]);
14535
- if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14536
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
14596
+ if (discriminatorLearningRateMultiplier === undefined) {
14597
+ discriminatorLearningRateMultiplier = 'SUPERVISED_FINE_TUNING';
14598
+ }
14599
+ if (discriminatorLearningRateMultiplier === 'SUPERVISED_FINE_TUNING') {
14600
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
14601
+ 'learningRateMultiplier',
14602
+ ]);
14603
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14604
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
14605
+ }
14606
+ }
14607
+ else if (discriminatorLearningRateMultiplier === 'PREFERENCE_TUNING') {
14608
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
14609
+ 'learningRateMultiplier',
14610
+ ]);
14611
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14612
+ setValueByPath(parentObject, [
14613
+ 'preferenceOptimizationSpec',
14614
+ 'hyperParameters',
14615
+ 'learningRateMultiplier',
14616
+ ], fromLearningRateMultiplier);
14617
+ }
14618
+ }
14619
+ let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
14620
+ if (discriminatorExportLastCheckpointOnly === undefined) {
14621
+ discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
14622
+ }
14623
+ if (discriminatorExportLastCheckpointOnly === 'SUPERVISED_FINE_TUNING') {
14624
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
14625
+ 'exportLastCheckpointOnly',
14626
+ ]);
14627
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
14628
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
14629
+ }
14537
14630
  }
14538
- const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
14539
- 'exportLastCheckpointOnly',
14631
+ else if (discriminatorExportLastCheckpointOnly === 'PREFERENCE_TUNING') {
14632
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
14633
+ 'exportLastCheckpointOnly',
14634
+ ]);
14635
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
14636
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
14637
+ }
14638
+ }
14639
+ let discriminatorAdapterSize = getValueByPath(rootObject, [
14640
+ 'config',
14641
+ 'method',
14540
14642
  ]);
14541
- if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
14542
- setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
14643
+ if (discriminatorAdapterSize === undefined) {
14644
+ discriminatorAdapterSize = 'SUPERVISED_FINE_TUNING';
14645
+ }
14646
+ if (discriminatorAdapterSize === 'SUPERVISED_FINE_TUNING') {
14647
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
14648
+ if (parentObject !== undefined && fromAdapterSize != null) {
14649
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
14650
+ }
14543
14651
  }
14544
- const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
14545
- if (parentObject !== undefined && fromAdapterSize != null) {
14546
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
14652
+ else if (discriminatorAdapterSize === 'PREFERENCE_TUNING') {
14653
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
14654
+ if (parentObject !== undefined && fromAdapterSize != null) {
14655
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
14656
+ }
14547
14657
  }
14548
14658
  if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
14549
14659
  throw new Error('batchSize parameter is not supported in Vertex AI.');
@@ -14555,9 +14665,13 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
14555
14665
  if (parentObject !== undefined && fromLabels != null) {
14556
14666
  setValueByPath(parentObject, ['labels'], fromLabels);
14557
14667
  }
14668
+ const fromBeta = getValueByPath(fromObject, ['beta']);
14669
+ if (parentObject !== undefined && fromBeta != null) {
14670
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'beta'], fromBeta);
14671
+ }
14558
14672
  return toObject;
14559
14673
  }
14560
- function createTuningJobParametersPrivateToMldev(fromObject) {
14674
+ function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
14561
14675
  const toObject = {};
14562
14676
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
14563
14677
  if (fromBaseModel != null) {
@@ -14573,7 +14687,7 @@ function createTuningJobParametersPrivateToMldev(fromObject) {
14573
14687
  'trainingDataset',
14574
14688
  ]);
14575
14689
  if (fromTrainingDataset != null) {
14576
- setValueByPath(toObject, ['tuningTask', 'trainingData'], tuningDatasetToMldev(fromTrainingDataset));
14690
+ tuningDatasetToMldev(fromTrainingDataset);
14577
14691
  }
14578
14692
  const fromConfig = getValueByPath(fromObject, ['config']);
14579
14693
  if (fromConfig != null) {
@@ -14581,7 +14695,7 @@ function createTuningJobParametersPrivateToMldev(fromObject) {
14581
14695
  }
14582
14696
  return toObject;
14583
14697
  }
14584
- function createTuningJobParametersPrivateToVertex(fromObject) {
14698
+ function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
14585
14699
  const toObject = {};
14586
14700
  const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
14587
14701
  if (fromBaseModel != null) {
@@ -14597,15 +14711,15 @@ function createTuningJobParametersPrivateToVertex(fromObject) {
14597
14711
  'trainingDataset',
14598
14712
  ]);
14599
14713
  if (fromTrainingDataset != null) {
14600
- setValueByPath(toObject, ['supervisedTuningSpec', 'trainingDatasetUri'], tuningDatasetToVertex(fromTrainingDataset, toObject));
14714
+ tuningDatasetToVertex(fromTrainingDataset, toObject, rootObject);
14601
14715
  }
14602
14716
  const fromConfig = getValueByPath(fromObject, ['config']);
14603
14717
  if (fromConfig != null) {
14604
- createTuningJobConfigToVertex(fromConfig, toObject);
14718
+ createTuningJobConfigToVertex(fromConfig, toObject, rootObject);
14605
14719
  }
14606
14720
  return toObject;
14607
14721
  }
14608
- function getTuningJobParametersToMldev(fromObject) {
14722
+ function getTuningJobParametersToMldev(fromObject, _rootObject) {
14609
14723
  const toObject = {};
14610
14724
  const fromName = getValueByPath(fromObject, ['name']);
14611
14725
  if (fromName != null) {
@@ -14613,7 +14727,7 @@ function getTuningJobParametersToMldev(fromObject) {
14613
14727
  }
14614
14728
  return toObject;
14615
14729
  }
14616
- function getTuningJobParametersToVertex(fromObject) {
14730
+ function getTuningJobParametersToVertex(fromObject, _rootObject) {
14617
14731
  const toObject = {};
14618
14732
  const fromName = getValueByPath(fromObject, ['name']);
14619
14733
  if (fromName != null) {
@@ -14621,7 +14735,7 @@ function getTuningJobParametersToVertex(fromObject) {
14621
14735
  }
14622
14736
  return toObject;
14623
14737
  }
14624
- function listTuningJobsConfigToMldev(fromObject, parentObject) {
14738
+ function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
14625
14739
  const toObject = {};
14626
14740
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14627
14741
  if (parentObject !== undefined && fromPageSize != null) {
@@ -14637,7 +14751,7 @@ function listTuningJobsConfigToMldev(fromObject, parentObject) {
14637
14751
  }
14638
14752
  return toObject;
14639
14753
  }
14640
- function listTuningJobsConfigToVertex(fromObject, parentObject) {
14754
+ function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
14641
14755
  const toObject = {};
14642
14756
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14643
14757
  if (parentObject !== undefined && fromPageSize != null) {
@@ -14653,7 +14767,7 @@ function listTuningJobsConfigToVertex(fromObject, parentObject) {
14653
14767
  }
14654
14768
  return toObject;
14655
14769
  }
14656
- function listTuningJobsParametersToMldev(fromObject) {
14770
+ function listTuningJobsParametersToMldev(fromObject, rootObject) {
14657
14771
  const toObject = {};
14658
14772
  const fromConfig = getValueByPath(fromObject, ['config']);
14659
14773
  if (fromConfig != null) {
@@ -14661,7 +14775,7 @@ function listTuningJobsParametersToMldev(fromObject) {
14661
14775
  }
14662
14776
  return toObject;
14663
14777
  }
14664
- function listTuningJobsParametersToVertex(fromObject) {
14778
+ function listTuningJobsParametersToVertex(fromObject, rootObject) {
14665
14779
  const toObject = {};
14666
14780
  const fromConfig = getValueByPath(fromObject, ['config']);
14667
14781
  if (fromConfig != null) {
@@ -14669,7 +14783,7 @@ function listTuningJobsParametersToVertex(fromObject) {
14669
14783
  }
14670
14784
  return toObject;
14671
14785
  }
14672
- function listTuningJobsResponseFromMldev(fromObject) {
14786
+ function listTuningJobsResponseFromMldev(fromObject, rootObject) {
14673
14787
  const toObject = {};
14674
14788
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14675
14789
  'sdkHttpResponse',
@@ -14695,7 +14809,7 @@ function listTuningJobsResponseFromMldev(fromObject) {
14695
14809
  }
14696
14810
  return toObject;
14697
14811
  }
14698
- function listTuningJobsResponseFromVertex(fromObject) {
14812
+ function listTuningJobsResponseFromVertex(fromObject, rootObject) {
14699
14813
  const toObject = {};
14700
14814
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14701
14815
  'sdkHttpResponse',
@@ -14721,7 +14835,7 @@ function listTuningJobsResponseFromVertex(fromObject) {
14721
14835
  }
14722
14836
  return toObject;
14723
14837
  }
14724
- function tunedModelFromMldev(fromObject) {
14838
+ function tunedModelFromMldev(fromObject, _rootObject) {
14725
14839
  const toObject = {};
14726
14840
  const fromModel = getValueByPath(fromObject, ['name']);
14727
14841
  if (fromModel != null) {
@@ -14733,7 +14847,7 @@ function tunedModelFromMldev(fromObject) {
14733
14847
  }
14734
14848
  return toObject;
14735
14849
  }
14736
- function tuningDatasetToMldev(fromObject) {
14850
+ function tuningDatasetToMldev(fromObject, _rootObject) {
14737
14851
  const toObject = {};
14738
14852
  if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
14739
14853
  throw new Error('gcsUri parameter is not supported in Gemini API.');
@@ -14753,24 +14867,56 @@ function tuningDatasetToMldev(fromObject) {
14753
14867
  }
14754
14868
  return toObject;
14755
14869
  }
14756
- function tuningDatasetToVertex(fromObject, parentObject) {
14870
+ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
14757
14871
  const toObject = {};
14758
- const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14759
- if (parentObject !== undefined && fromGcsUri != null) {
14760
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
14872
+ let discriminatorGcsUri = getValueByPath(rootObject, [
14873
+ 'config',
14874
+ 'method',
14875
+ ]);
14876
+ if (discriminatorGcsUri === undefined) {
14877
+ discriminatorGcsUri = 'SUPERVISED_FINE_TUNING';
14761
14878
  }
14762
- const fromVertexDatasetResource = getValueByPath(fromObject, [
14763
- 'vertexDatasetResource',
14879
+ if (discriminatorGcsUri === 'SUPERVISED_FINE_TUNING') {
14880
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14881
+ if (parentObject !== undefined && fromGcsUri != null) {
14882
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
14883
+ }
14884
+ }
14885
+ else if (discriminatorGcsUri === 'PREFERENCE_TUNING') {
14886
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14887
+ if (parentObject !== undefined && fromGcsUri != null) {
14888
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromGcsUri);
14889
+ }
14890
+ }
14891
+ let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
14892
+ 'config',
14893
+ 'method',
14764
14894
  ]);
14765
- if (parentObject !== undefined && fromVertexDatasetResource != null) {
14766
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
14895
+ if (discriminatorVertexDatasetResource === undefined) {
14896
+ discriminatorVertexDatasetResource = 'SUPERVISED_FINE_TUNING';
14897
+ }
14898
+ if (discriminatorVertexDatasetResource === 'SUPERVISED_FINE_TUNING') {
14899
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
14900
+ 'vertexDatasetResource',
14901
+ ]);
14902
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
14903
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
14904
+ }
14905
+ }
14906
+ else if (discriminatorVertexDatasetResource === 'PREFERENCE_TUNING') {
14907
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
14908
+ 'vertexDatasetResource',
14909
+ ]);
14910
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
14911
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
14912
+ }
14767
14913
  }
14768
14914
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
14769
14915
  throw new Error('examples parameter is not supported in Vertex AI.');
14770
14916
  }
14771
14917
  return toObject;
14772
14918
  }
14773
- function tuningJobFromMldev(fromObject) {
14919
+ function tuningJobFromMldev(fromObject, rootObject) {
14774
14920
  const toObject = {};
14775
14921
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14776
14922
  'sdkHttpResponse',
@@ -14822,7 +14968,7 @@ function tuningJobFromMldev(fromObject) {
14822
14968
  }
14823
14969
  return toObject;
14824
14970
  }
14825
- function tuningJobFromVertex(fromObject) {
14971
+ function tuningJobFromVertex(fromObject, _rootObject) {
14826
14972
  const toObject = {};
14827
14973
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14828
14974
  'sdkHttpResponse',
@@ -14882,6 +15028,12 @@ function tuningJobFromVertex(fromObject) {
14882
15028
  if (fromSupervisedTuningSpec != null) {
14883
15029
  setValueByPath(toObject, ['supervisedTuningSpec'], fromSupervisedTuningSpec);
14884
15030
  }
15031
+ const fromPreferenceOptimizationSpec = getValueByPath(fromObject, [
15032
+ 'preferenceOptimizationSpec',
15033
+ ]);
15034
+ if (fromPreferenceOptimizationSpec != null) {
15035
+ setValueByPath(toObject, ['preferenceOptimizationSpec'], fromPreferenceOptimizationSpec);
15036
+ }
14885
15037
  const fromTuningDataStats = getValueByPath(fromObject, [
14886
15038
  'tuningDataStats',
14887
15039
  ]);
@@ -14942,7 +15094,7 @@ function tuningJobFromVertex(fromObject) {
14942
15094
  }
14943
15095
  return toObject;
14944
15096
  }
14945
- function tuningOperationFromMldev(fromObject) {
15097
+ function tuningOperationFromMldev(fromObject, _rootObject) {
14946
15098
  const toObject = {};
14947
15099
  const fromSdkHttpResponse = getValueByPath(fromObject, [
14948
15100
  'sdkHttpResponse',
@@ -14968,7 +15120,7 @@ function tuningOperationFromMldev(fromObject) {
14968
15120
  }
14969
15121
  return toObject;
14970
15122
  }
14971
- function tuningValidationDatasetToVertex(fromObject, parentObject) {
15123
+ function tuningValidationDatasetToVertex(fromObject, _rootObject) {
14972
15124
  const toObject = {};
14973
15125
  const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14974
15126
  if (fromGcsUri != null) {
@@ -14977,8 +15129,8 @@ function tuningValidationDatasetToVertex(fromObject, parentObject) {
14977
15129
  const fromVertexDatasetResource = getValueByPath(fromObject, [
14978
15130
  'vertexDatasetResource',
14979
15131
  ]);
14980
- if (parentObject !== undefined && fromVertexDatasetResource != null) {
14981
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
15132
+ if (fromVertexDatasetResource != null) {
15133
+ setValueByPath(toObject, ['validationDatasetUri'], fromVertexDatasetResource);
14982
15134
  }
14983
15135
  return toObject;
14984
15136
  }
@@ -15248,7 +15400,7 @@ class Tunings extends BaseModule {
15248
15400
  let path = '';
15249
15401
  let queryParams = {};
15250
15402
  if (this.apiClient.isVertexAI()) {
15251
- const body = createTuningJobParametersPrivateToVertex(params);
15403
+ const body = createTuningJobParametersPrivateToVertex(params, params);
15252
15404
  path = formatMap('tuningJobs', body['_url']);
15253
15405
  queryParams = body['_query'];
15254
15406
  delete body['_url'];
@@ -15331,7 +15483,8 @@ class WebAuth {
15331
15483
  constructor(apiKey) {
15332
15484
  this.apiKey = apiKey;
15333
15485
  }
15334
- async addAuthHeaders(headers) {
15486
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15487
+ async addAuthHeaders(headers, url) {
15335
15488
  if (headers.get(GOOGLE_API_KEY_HEADER) !== null) {
15336
15489
  return;
15337
15490
  }