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