@google/genai 1.27.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,11 @@
1
1
  import { GoogleAuth } from 'google-auth-library';
2
- import { createWriteStream, writeFile } from 'fs';
2
+ import { createWriteStream } from 'fs';
3
+ import * as fs from 'fs/promises';
4
+ import { writeFile } from 'fs/promises';
3
5
  import { Readable } from 'node:stream';
6
+ import { finished } from 'node:stream/promises';
4
7
  import * as NodeWs from 'ws';
5
- import * as fs from 'fs/promises';
8
+ import * as path from 'path';
6
9
 
7
10
  /**
8
11
  * @license
@@ -466,6 +469,90 @@ function getOperationParametersToVertex(fromObject) {
466
469
  }
467
470
  return toObject;
468
471
  }
472
+ function importFileOperationFromMldev$1(fromObject) {
473
+ const toObject = {};
474
+ const fromName = getValueByPath(fromObject, ['name']);
475
+ if (fromName != null) {
476
+ setValueByPath(toObject, ['name'], fromName);
477
+ }
478
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
479
+ if (fromMetadata != null) {
480
+ setValueByPath(toObject, ['metadata'], fromMetadata);
481
+ }
482
+ const fromDone = getValueByPath(fromObject, ['done']);
483
+ if (fromDone != null) {
484
+ setValueByPath(toObject, ['done'], fromDone);
485
+ }
486
+ const fromError = getValueByPath(fromObject, ['error']);
487
+ if (fromError != null) {
488
+ setValueByPath(toObject, ['error'], fromError);
489
+ }
490
+ const fromResponse = getValueByPath(fromObject, ['response']);
491
+ if (fromResponse != null) {
492
+ setValueByPath(toObject, ['response'], importFileResponseFromMldev$1(fromResponse));
493
+ }
494
+ return toObject;
495
+ }
496
+ function importFileResponseFromMldev$1(fromObject) {
497
+ const toObject = {};
498
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
499
+ 'sdkHttpResponse',
500
+ ]);
501
+ if (fromSdkHttpResponse != null) {
502
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
503
+ }
504
+ const fromParent = getValueByPath(fromObject, ['parent']);
505
+ if (fromParent != null) {
506
+ setValueByPath(toObject, ['parent'], fromParent);
507
+ }
508
+ const fromDocumentName = getValueByPath(fromObject, ['documentName']);
509
+ if (fromDocumentName != null) {
510
+ setValueByPath(toObject, ['documentName'], fromDocumentName);
511
+ }
512
+ return toObject;
513
+ }
514
+ function uploadToFileSearchStoreOperationFromMldev(fromObject) {
515
+ const toObject = {};
516
+ const fromName = getValueByPath(fromObject, ['name']);
517
+ if (fromName != null) {
518
+ setValueByPath(toObject, ['name'], fromName);
519
+ }
520
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
521
+ if (fromMetadata != null) {
522
+ setValueByPath(toObject, ['metadata'], fromMetadata);
523
+ }
524
+ const fromDone = getValueByPath(fromObject, ['done']);
525
+ if (fromDone != null) {
526
+ setValueByPath(toObject, ['done'], fromDone);
527
+ }
528
+ const fromError = getValueByPath(fromObject, ['error']);
529
+ if (fromError != null) {
530
+ setValueByPath(toObject, ['error'], fromError);
531
+ }
532
+ const fromResponse = getValueByPath(fromObject, ['response']);
533
+ if (fromResponse != null) {
534
+ setValueByPath(toObject, ['response'], uploadToFileSearchStoreResponseFromMldev(fromResponse));
535
+ }
536
+ return toObject;
537
+ }
538
+ function uploadToFileSearchStoreResponseFromMldev(fromObject) {
539
+ const toObject = {};
540
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
541
+ 'sdkHttpResponse',
542
+ ]);
543
+ if (fromSdkHttpResponse != null) {
544
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
545
+ }
546
+ const fromParent = getValueByPath(fromObject, ['parent']);
547
+ if (fromParent != null) {
548
+ setValueByPath(toObject, ['parent'], fromParent);
549
+ }
550
+ const fromDocumentName = getValueByPath(fromObject, ['documentName']);
551
+ if (fromDocumentName != null) {
552
+ setValueByPath(toObject, ['documentName'], fromDocumentName);
553
+ }
554
+ return toObject;
555
+ }
469
556
  function videoFromMldev$1(fromObject) {
470
557
  const toObject = {};
471
558
  const fromUri = getValueByPath(fromObject, ['uri']);
@@ -506,7 +593,7 @@ function videoFromVertex$1(fromObject) {
506
593
  * Copyright 2025 Google LLC
507
594
  * SPDX-License-Identifier: Apache-2.0
508
595
  */
509
- /** Required. Outcome of the code execution. */
596
+ /** Outcome of the code execution. */
510
597
  var Outcome;
511
598
  (function (Outcome) {
512
599
  /**
@@ -526,7 +613,7 @@ var Outcome;
526
613
  */
527
614
  Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
528
615
  })(Outcome || (Outcome = {}));
529
- /** Required. Programming language of the `code`. */
616
+ /** Programming language of the `code`. */
530
617
  var Language;
531
618
  (function (Language) {
532
619
  /**
@@ -558,7 +645,7 @@ var FunctionResponseScheduling;
558
645
  */
559
646
  FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
560
647
  })(FunctionResponseScheduling || (FunctionResponseScheduling = {}));
561
- /** Optional. The type of the data. */
648
+ /** The type of the data. */
562
649
  var Type;
563
650
  (function (Type) {
564
651
  /**
@@ -594,7 +681,121 @@ var Type;
594
681
  */
595
682
  Type["NULL"] = "NULL";
596
683
  })(Type || (Type = {}));
597
- /** Required. Harm category. */
684
+ /** The mode of the predictor to be used in dynamic retrieval. */
685
+ var Mode;
686
+ (function (Mode) {
687
+ /**
688
+ * Always trigger retrieval.
689
+ */
690
+ Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
691
+ /**
692
+ * Run retrieval only when system decides it is necessary.
693
+ */
694
+ Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
695
+ })(Mode || (Mode = {}));
696
+ /** The API spec that the external API implements. This enum is not supported in Gemini API. */
697
+ var ApiSpec;
698
+ (function (ApiSpec) {
699
+ /**
700
+ * Unspecified API spec. This value should not be used.
701
+ */
702
+ ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
703
+ /**
704
+ * Simple search API spec.
705
+ */
706
+ ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
707
+ /**
708
+ * Elastic search API spec.
709
+ */
710
+ ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
711
+ })(ApiSpec || (ApiSpec = {}));
712
+ /** Type of auth scheme. This enum is not supported in Gemini API. */
713
+ var AuthType;
714
+ (function (AuthType) {
715
+ AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
716
+ /**
717
+ * No Auth.
718
+ */
719
+ AuthType["NO_AUTH"] = "NO_AUTH";
720
+ /**
721
+ * API Key Auth.
722
+ */
723
+ AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
724
+ /**
725
+ * HTTP Basic Auth.
726
+ */
727
+ AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
728
+ /**
729
+ * Google Service Account Auth.
730
+ */
731
+ AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
732
+ /**
733
+ * OAuth auth.
734
+ */
735
+ AuthType["OAUTH"] = "OAUTH";
736
+ /**
737
+ * OpenID Connect (OIDC) Auth.
738
+ */
739
+ AuthType["OIDC_AUTH"] = "OIDC_AUTH";
740
+ })(AuthType || (AuthType = {}));
741
+ /** The location of the API key. This enum is not supported in Gemini API. */
742
+ var HttpElementLocation;
743
+ (function (HttpElementLocation) {
744
+ HttpElementLocation["HTTP_IN_UNSPECIFIED"] = "HTTP_IN_UNSPECIFIED";
745
+ /**
746
+ * Element is in the HTTP request query.
747
+ */
748
+ HttpElementLocation["HTTP_IN_QUERY"] = "HTTP_IN_QUERY";
749
+ /**
750
+ * Element is in the HTTP request header.
751
+ */
752
+ HttpElementLocation["HTTP_IN_HEADER"] = "HTTP_IN_HEADER";
753
+ /**
754
+ * Element is in the HTTP request path.
755
+ */
756
+ HttpElementLocation["HTTP_IN_PATH"] = "HTTP_IN_PATH";
757
+ /**
758
+ * Element is in the HTTP request body.
759
+ */
760
+ HttpElementLocation["HTTP_IN_BODY"] = "HTTP_IN_BODY";
761
+ /**
762
+ * Element is in the HTTP request cookie.
763
+ */
764
+ HttpElementLocation["HTTP_IN_COOKIE"] = "HTTP_IN_COOKIE";
765
+ })(HttpElementLocation || (HttpElementLocation = {}));
766
+ /** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
767
+ var PhishBlockThreshold;
768
+ (function (PhishBlockThreshold) {
769
+ /**
770
+ * Defaults to unspecified.
771
+ */
772
+ PhishBlockThreshold["PHISH_BLOCK_THRESHOLD_UNSPECIFIED"] = "PHISH_BLOCK_THRESHOLD_UNSPECIFIED";
773
+ /**
774
+ * Blocks Low and above confidence URL that is risky.
775
+ */
776
+ PhishBlockThreshold["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE";
777
+ /**
778
+ * Blocks Medium and above confidence URL that is risky.
779
+ */
780
+ PhishBlockThreshold["BLOCK_MEDIUM_AND_ABOVE"] = "BLOCK_MEDIUM_AND_ABOVE";
781
+ /**
782
+ * Blocks High and above confidence URL that is risky.
783
+ */
784
+ PhishBlockThreshold["BLOCK_HIGH_AND_ABOVE"] = "BLOCK_HIGH_AND_ABOVE";
785
+ /**
786
+ * Blocks Higher and above confidence URL that is risky.
787
+ */
788
+ PhishBlockThreshold["BLOCK_HIGHER_AND_ABOVE"] = "BLOCK_HIGHER_AND_ABOVE";
789
+ /**
790
+ * Blocks Very high and above confidence URL that is risky.
791
+ */
792
+ PhishBlockThreshold["BLOCK_VERY_HIGH_AND_ABOVE"] = "BLOCK_VERY_HIGH_AND_ABOVE";
793
+ /**
794
+ * Blocks Extremely high confidence URL that is risky.
795
+ */
796
+ PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
797
+ })(PhishBlockThreshold || (PhishBlockThreshold = {}));
798
+ /** Harm category. */
598
799
  var HarmCategory;
599
800
  (function (HarmCategory) {
600
801
  /**
@@ -642,7 +843,7 @@ var HarmCategory;
642
843
  */
643
844
  HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
644
845
  })(HarmCategory || (HarmCategory = {}));
645
- /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
846
+ /** Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. This enum is not supported in Gemini API. */
646
847
  var HarmBlockMethod;
647
848
  (function (HarmBlockMethod) {
648
849
  /**
@@ -658,7 +859,7 @@ var HarmBlockMethod;
658
859
  */
659
860
  HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
660
861
  })(HarmBlockMethod || (HarmBlockMethod = {}));
661
- /** Required. The harm block threshold. */
862
+ /** The harm block threshold. */
662
863
  var HarmBlockThreshold;
663
864
  (function (HarmBlockThreshold) {
664
865
  /**
@@ -686,87 +887,6 @@ var HarmBlockThreshold;
686
887
  */
687
888
  HarmBlockThreshold["OFF"] = "OFF";
688
889
  })(HarmBlockThreshold || (HarmBlockThreshold = {}));
689
- /** The mode of the predictor to be used in dynamic retrieval. */
690
- var Mode;
691
- (function (Mode) {
692
- /**
693
- * Always trigger retrieval.
694
- */
695
- Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
696
- /**
697
- * Run retrieval only when system decides it is necessary.
698
- */
699
- Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
700
- })(Mode || (Mode = {}));
701
- /** Type of auth scheme. */
702
- var AuthType;
703
- (function (AuthType) {
704
- AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
705
- /**
706
- * No Auth.
707
- */
708
- AuthType["NO_AUTH"] = "NO_AUTH";
709
- /**
710
- * API Key Auth.
711
- */
712
- AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
713
- /**
714
- * HTTP Basic Auth.
715
- */
716
- AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
717
- /**
718
- * Google Service Account Auth.
719
- */
720
- AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
721
- /**
722
- * OAuth auth.
723
- */
724
- AuthType["OAUTH"] = "OAUTH";
725
- /**
726
- * OpenID Connect (OIDC) Auth.
727
- */
728
- AuthType["OIDC_AUTH"] = "OIDC_AUTH";
729
- })(AuthType || (AuthType = {}));
730
- /** The API spec that the external API implements. */
731
- var ApiSpec;
732
- (function (ApiSpec) {
733
- /**
734
- * Unspecified API spec. This value should not be used.
735
- */
736
- ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
737
- /**
738
- * Simple search API spec.
739
- */
740
- ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
741
- /**
742
- * Elastic search API spec.
743
- */
744
- ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
745
- })(ApiSpec || (ApiSpec = {}));
746
- /** Status of the url retrieval. */
747
- var UrlRetrievalStatus;
748
- (function (UrlRetrievalStatus) {
749
- /**
750
- * Default value. This value is unused
751
- */
752
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
753
- /**
754
- * Url retrieval is successful.
755
- */
756
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
757
- /**
758
- * Url retrieval is failed due to error.
759
- */
760
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
761
- /**
762
- * Url retrieval is failed because the content is behind paywall.
763
- */
764
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
765
- /**
766
- * Url retrieval is failed because the content is unsafe.
767
- */
768
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
769
- })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
770
890
  /** Output only. The reason why the model stopped generating tokens.
771
891
 
772
892
  If empty, the model has not stopped generating the tokens. */
@@ -857,7 +977,7 @@ var HarmProbability;
857
977
  */
858
978
  HarmProbability["HIGH"] = "HIGH";
859
979
  })(HarmProbability || (HarmProbability = {}));
860
- /** Output only. Harm severity levels in the content. */
980
+ /** Output only. Harm severity levels in the content. This enum is not supported in Gemini API. */
861
981
  var HarmSeverity;
862
982
  (function (HarmSeverity) {
863
983
  /**
@@ -881,6 +1001,30 @@ var HarmSeverity;
881
1001
  */
882
1002
  HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
883
1003
  })(HarmSeverity || (HarmSeverity = {}));
1004
+ /** Status of the url retrieval. */
1005
+ var UrlRetrievalStatus;
1006
+ (function (UrlRetrievalStatus) {
1007
+ /**
1008
+ * Default value. This value is unused.
1009
+ */
1010
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
1011
+ /**
1012
+ * Url retrieval is successful.
1013
+ */
1014
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
1015
+ /**
1016
+ * Url retrieval is failed due to error.
1017
+ */
1018
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
1019
+ /**
1020
+ * Url retrieval is failed because the content is behind paywall. This enum value is not supported in Vertex AI.
1021
+ */
1022
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
1023
+ /**
1024
+ * Url retrieval is failed because the content is unsafe. This enum value is not supported in Vertex AI.
1025
+ */
1026
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
1027
+ })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
884
1028
  /** Output only. The reason why the prompt was blocked. */
885
1029
  var BlockedReason;
886
1030
  (function (BlockedReason) {
@@ -917,7 +1061,7 @@ var BlockedReason;
917
1061
  */
918
1062
  BlockedReason["JAILBREAK"] = "JAILBREAK";
919
1063
  })(BlockedReason || (BlockedReason = {}));
920
- /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
1064
+ /** Output only. The traffic type for this request. This enum is not supported in Gemini API. */
921
1065
  var TrafficType;
922
1066
  (function (TrafficType) {
923
1067
  /**
@@ -925,7 +1069,7 @@ var TrafficType;
925
1069
  */
926
1070
  TrafficType["TRAFFIC_TYPE_UNSPECIFIED"] = "TRAFFIC_TYPE_UNSPECIFIED";
927
1071
  /**
928
- * Type for Pay-As-You-Go traffic.
1072
+ * The request was processed using Pay-As-You-Go quota.
929
1073
  */
930
1074
  TrafficType["ON_DEMAND"] = "ON_DEMAND";
931
1075
  /**
@@ -973,15 +1117,63 @@ var MediaResolution;
973
1117
  */
974
1118
  MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
975
1119
  })(MediaResolution || (MediaResolution = {}));
976
- /** Job state. */
977
- var JobState;
978
- (function (JobState) {
1120
+ /** Tuning mode. This enum is not supported in Gemini API. */
1121
+ var TuningMode;
1122
+ (function (TuningMode) {
979
1123
  /**
980
- * The job state is unspecified.
1124
+ * Tuning mode is unspecified.
981
1125
  */
982
- JobState["JOB_STATE_UNSPECIFIED"] = "JOB_STATE_UNSPECIFIED";
1126
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
983
1127
  /**
984
- * The job has been just created or resumed and processing has not yet begun.
1128
+ * Full fine-tuning mode.
1129
+ */
1130
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
1131
+ /**
1132
+ * PEFT adapter tuning mode.
1133
+ */
1134
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
1135
+ })(TuningMode || (TuningMode = {}));
1136
+ /** Adapter size for tuning. This enum is not supported in Gemini API. */
1137
+ var AdapterSize;
1138
+ (function (AdapterSize) {
1139
+ /**
1140
+ * Adapter size is unspecified.
1141
+ */
1142
+ AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1143
+ /**
1144
+ * Adapter size 1.
1145
+ */
1146
+ AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1147
+ /**
1148
+ * Adapter size 2.
1149
+ */
1150
+ AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1151
+ /**
1152
+ * Adapter size 4.
1153
+ */
1154
+ AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1155
+ /**
1156
+ * Adapter size 8.
1157
+ */
1158
+ AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1159
+ /**
1160
+ * Adapter size 16.
1161
+ */
1162
+ AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1163
+ /**
1164
+ * Adapter size 32.
1165
+ */
1166
+ AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1167
+ })(AdapterSize || (AdapterSize = {}));
1168
+ /** Job state. */
1169
+ var JobState;
1170
+ (function (JobState) {
1171
+ /**
1172
+ * The job state is unspecified.
1173
+ */
1174
+ JobState["JOB_STATE_UNSPECIFIED"] = "JOB_STATE_UNSPECIFIED";
1175
+ /**
1176
+ * The job has been just created or resumed and processing has not yet begun.
985
1177
  */
986
1178
  JobState["JOB_STATE_QUEUED"] = "JOB_STATE_QUEUED";
987
1179
  /**
@@ -1025,55 +1217,7 @@ var JobState;
1025
1217
  */
1026
1218
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
1027
1219
  })(JobState || (JobState = {}));
1028
- /** Tuning mode. */
1029
- var TuningMode;
1030
- (function (TuningMode) {
1031
- /**
1032
- * Tuning mode is unspecified.
1033
- */
1034
- TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
1035
- /**
1036
- * Full fine-tuning mode.
1037
- */
1038
- TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
1039
- /**
1040
- * PEFT adapter tuning mode.
1041
- */
1042
- TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
1043
- })(TuningMode || (TuningMode = {}));
1044
- /** Optional. Adapter size for tuning. */
1045
- var AdapterSize;
1046
- (function (AdapterSize) {
1047
- /**
1048
- * Adapter size is unspecified.
1049
- */
1050
- AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1051
- /**
1052
- * Adapter size 1.
1053
- */
1054
- AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1055
- /**
1056
- * Adapter size 2.
1057
- */
1058
- AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1059
- /**
1060
- * Adapter size 4.
1061
- */
1062
- AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1063
- /**
1064
- * Adapter size 8.
1065
- */
1066
- AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1067
- /**
1068
- * Adapter size 16.
1069
- */
1070
- AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1071
- /**
1072
- * Adapter size 32.
1073
- */
1074
- AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1075
- })(AdapterSize || (AdapterSize = {}));
1076
- /** Optional. The tuning task. Either I2V or T2V. */
1220
+ /** The tuning task. Either I2V or T2V. This enum is not supported in Gemini API. */
1077
1221
  var TuningTask;
1078
1222
  (function (TuningTask) {
1079
1223
  /**
@@ -1088,6 +1232,10 @@ var TuningTask;
1088
1232
  * Tuning task for text to video.
1089
1233
  */
1090
1234
  TuningTask["TUNING_TASK_T2V"] = "TUNING_TASK_T2V";
1235
+ /**
1236
+ * Tuning task for reference to video.
1237
+ */
1238
+ TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
1091
1239
  })(TuningTask || (TuningTask = {}));
1092
1240
  /** Options for feature selection preference. */
1093
1241
  var FeatureSelectionPreference;
@@ -1323,6 +1471,26 @@ var VideoCompressionQuality;
1323
1471
  */
1324
1472
  VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
1325
1473
  })(VideoCompressionQuality || (VideoCompressionQuality = {}));
1474
+ /** Enum representing the tuning method. */
1475
+ var TuningMethod;
1476
+ (function (TuningMethod) {
1477
+ /**
1478
+ * Supervised fine tuning.
1479
+ */
1480
+ TuningMethod["SUPERVISED_FINE_TUNING"] = "SUPERVISED_FINE_TUNING";
1481
+ /**
1482
+ * Preference optimization tuning.
1483
+ */
1484
+ TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
1485
+ })(TuningMethod || (TuningMethod = {}));
1486
+ /** State for the lifecycle of a Document. */
1487
+ var DocumentState;
1488
+ (function (DocumentState) {
1489
+ DocumentState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
1490
+ DocumentState["STATE_PENDING"] = "STATE_PENDING";
1491
+ DocumentState["STATE_ACTIVE"] = "STATE_ACTIVE";
1492
+ DocumentState["STATE_FAILED"] = "STATE_FAILED";
1493
+ })(DocumentState || (DocumentState = {}));
1326
1494
  /** State for the lifecycle of a File. */
1327
1495
  var FileState;
1328
1496
  (function (FileState) {
@@ -1750,7 +1918,7 @@ class HttpResponse {
1750
1918
  /** 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. */
1751
1919
  class GenerateContentResponsePromptFeedback {
1752
1920
  }
1753
- /** Usage metadata about response(s). This data type is not supported in Gemini API. */
1921
+ /** Usage metadata about the content generation request and response. This message provides a detailed breakdown of token usage and other relevant metrics. This data type is not supported in Gemini API. */
1754
1922
  class GenerateContentResponseUsageMetadata {
1755
1923
  }
1756
1924
  /** Response message for PredictionService.GenerateContent. */
@@ -2015,11 +2183,11 @@ class GenerateVideosOperation {
2015
2183
  * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2016
2184
  * @internal
2017
2185
  */
2018
- _fromAPIResponse({ apiResponse, isVertexAI, }) {
2186
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2019
2187
  const operation = new GenerateVideosOperation();
2020
2188
  let response;
2021
2189
  const op = apiResponse;
2022
- if (isVertexAI) {
2190
+ if (_isVertexAI) {
2023
2191
  response = generateVideosOperationFromVertex$1(op);
2024
2192
  }
2025
2193
  else {
@@ -2037,6 +2205,32 @@ class DeleteCachedContentResponse {
2037
2205
  }
2038
2206
  class ListCachedContentsResponse {
2039
2207
  }
2208
+ /** Config for documents.list return value. */
2209
+ class ListDocumentsResponse {
2210
+ }
2211
+ /** Config for file_search_stores.list return value. */
2212
+ class ListFileSearchStoresResponse {
2213
+ }
2214
+ /** Response for the resumable upload method. */
2215
+ class UploadToFileSearchStoreResumableResponse {
2216
+ }
2217
+ /** Response for ImportFile to import a File API file with a file search store. */
2218
+ class ImportFileResponse {
2219
+ }
2220
+ /** Long-running operation for importing a file to a FileSearchStore. */
2221
+ class ImportFileOperation {
2222
+ /**
2223
+ * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2224
+ * @internal
2225
+ */
2226
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2227
+ const operation = new ImportFileOperation();
2228
+ const op = apiResponse;
2229
+ const response = importFileOperationFromMldev$1(op);
2230
+ Object.assign(operation, response);
2231
+ return operation;
2232
+ }
2233
+ }
2040
2234
  /** Response for the list files method. */
2041
2235
  class ListFilesResponse {
2042
2236
  }
@@ -2272,6 +2466,23 @@ class LiveMusicServerMessage {
2272
2466
  return undefined;
2273
2467
  }
2274
2468
  }
2469
+ /** The response when long-running operation for uploading a file to a FileSearchStore complete. */
2470
+ class UploadToFileSearchStoreResponse {
2471
+ }
2472
+ /** Long-running operation for uploading a file to a FileSearchStore. */
2473
+ class UploadToFileSearchStoreOperation {
2474
+ /**
2475
+ * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2476
+ * @internal
2477
+ */
2478
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2479
+ const operation = new UploadToFileSearchStoreOperation();
2480
+ const op = apiResponse;
2481
+ const response = uploadToFileSearchStoreOperationFromMldev(op);
2482
+ Object.assign(operation, response);
2483
+ return operation;
2484
+ }
2485
+ }
2275
2486
 
2276
2487
  /**
2277
2488
  * @license
@@ -3268,6 +3479,12 @@ function batchJobFromVertex(fromObject) {
3268
3479
  if (fromDest != null) {
3269
3480
  setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
3270
3481
  }
3482
+ const fromCompletionStats = getValueByPath(fromObject, [
3483
+ 'completionStats',
3484
+ ]);
3485
+ if (fromCompletionStats != null) {
3486
+ setValueByPath(toObject, ['completionStats'], fromCompletionStats);
3487
+ }
3271
3488
  return toObject;
3272
3489
  }
3273
3490
  function batchJobSourceFromVertex(fromObject) {
@@ -3342,13 +3559,13 @@ function batchJobSourceToVertex(fromObject) {
3342
3559
  }
3343
3560
  function blobToMldev$4(fromObject) {
3344
3561
  const toObject = {};
3345
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
3346
- throw new Error('displayName parameter is not supported in Gemini API.');
3347
- }
3348
3562
  const fromData = getValueByPath(fromObject, ['data']);
3349
3563
  if (fromData != null) {
3350
3564
  setValueByPath(toObject, ['data'], fromData);
3351
3565
  }
3566
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
3567
+ throw new Error('displayName parameter is not supported in Gemini API.');
3568
+ }
3352
3569
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
3353
3570
  if (fromMimeType != null) {
3354
3571
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -3391,12 +3608,6 @@ function candidateFromMldev$1(fromObject) {
3391
3608
  if (fromFinishReason != null) {
3392
3609
  setValueByPath(toObject, ['finishReason'], fromFinishReason);
3393
3610
  }
3394
- const fromUrlContextMetadata = getValueByPath(fromObject, [
3395
- 'urlContextMetadata',
3396
- ]);
3397
- if (fromUrlContextMetadata != null) {
3398
- setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
3399
- }
3400
3611
  const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
3401
3612
  if (fromAvgLogprobs != null) {
3402
3613
  setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
@@ -3429,6 +3640,12 @@ function candidateFromMldev$1(fromObject) {
3429
3640
  }
3430
3641
  setValueByPath(toObject, ['safetyRatings'], transformedList);
3431
3642
  }
3643
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
3644
+ 'urlContextMetadata',
3645
+ ]);
3646
+ if (fromUrlContextMetadata != null) {
3647
+ setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
3648
+ }
3432
3649
  return toObject;
3433
3650
  }
3434
3651
  function citationMetadataFromMldev$1(fromObject) {
@@ -3897,15 +4114,18 @@ function googleMapsToMldev$4(fromObject) {
3897
4114
  }
3898
4115
  function googleSearchToMldev$4(fromObject) {
3899
4116
  const toObject = {};
4117
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
4118
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
4119
+ }
4120
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
4121
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
4122
+ }
3900
4123
  const fromTimeRangeFilter = getValueByPath(fromObject, [
3901
4124
  'timeRangeFilter',
3902
4125
  ]);
3903
4126
  if (fromTimeRangeFilter != null) {
3904
4127
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
3905
4128
  }
3906
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
3907
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
3908
- }
3909
4129
  return toObject;
3910
4130
  }
3911
4131
  function inlinedRequestToMldev(apiClient, fromObject) {
@@ -4049,30 +4269,6 @@ function listBatchJobsResponseFromVertex(fromObject) {
4049
4269
  }
4050
4270
  function partToMldev$4(fromObject) {
4051
4271
  const toObject = {};
4052
- const fromVideoMetadata = getValueByPath(fromObject, [
4053
- 'videoMetadata',
4054
- ]);
4055
- if (fromVideoMetadata != null) {
4056
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4057
- }
4058
- const fromThought = getValueByPath(fromObject, ['thought']);
4059
- if (fromThought != null) {
4060
- setValueByPath(toObject, ['thought'], fromThought);
4061
- }
4062
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4063
- if (fromInlineData != null) {
4064
- setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
4065
- }
4066
- const fromFileData = getValueByPath(fromObject, ['fileData']);
4067
- if (fromFileData != null) {
4068
- setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4069
- }
4070
- const fromThoughtSignature = getValueByPath(fromObject, [
4071
- 'thoughtSignature',
4072
- ]);
4073
- if (fromThoughtSignature != null) {
4074
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
4075
- }
4076
4272
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4077
4273
  if (fromFunctionCall != null) {
4078
4274
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -4089,27 +4285,51 @@ function partToMldev$4(fromObject) {
4089
4285
  if (fromExecutableCode != null) {
4090
4286
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4091
4287
  }
4288
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
4289
+ if (fromFileData != null) {
4290
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4291
+ }
4092
4292
  const fromFunctionResponse = getValueByPath(fromObject, [
4093
4293
  'functionResponse',
4094
4294
  ]);
4095
4295
  if (fromFunctionResponse != null) {
4096
4296
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4097
4297
  }
4298
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4299
+ if (fromInlineData != null) {
4300
+ setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
4301
+ }
4098
4302
  const fromText = getValueByPath(fromObject, ['text']);
4099
4303
  if (fromText != null) {
4100
4304
  setValueByPath(toObject, ['text'], fromText);
4101
4305
  }
4306
+ const fromThought = getValueByPath(fromObject, ['thought']);
4307
+ if (fromThought != null) {
4308
+ setValueByPath(toObject, ['thought'], fromThought);
4309
+ }
4310
+ const fromThoughtSignature = getValueByPath(fromObject, [
4311
+ 'thoughtSignature',
4312
+ ]);
4313
+ if (fromThoughtSignature != null) {
4314
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
4315
+ }
4316
+ const fromVideoMetadata = getValueByPath(fromObject, [
4317
+ 'videoMetadata',
4318
+ ]);
4319
+ if (fromVideoMetadata != null) {
4320
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4321
+ }
4102
4322
  return toObject;
4103
4323
  }
4104
4324
  function safetySettingToMldev$1(fromObject) {
4105
4325
  const toObject = {};
4106
- if (getValueByPath(fromObject, ['method']) !== undefined) {
4107
- throw new Error('method parameter is not supported in Gemini API.');
4108
- }
4109
4326
  const fromCategory = getValueByPath(fromObject, ['category']);
4110
4327
  if (fromCategory != null) {
4111
4328
  setValueByPath(toObject, ['category'], fromCategory);
4112
4329
  }
4330
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
4331
+ throw new Error('method parameter is not supported in Gemini API.');
4332
+ }
4113
4333
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
4114
4334
  if (fromThreshold != null) {
4115
4335
  setValueByPath(toObject, ['threshold'], fromThreshold);
@@ -4133,16 +4353,26 @@ function toolToMldev$4(fromObject) {
4133
4353
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4134
4354
  throw new Error('retrieval parameter is not supported in Gemini API.');
4135
4355
  }
4136
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4137
- if (fromGoogleSearch != null) {
4138
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
4139
- }
4140
4356
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4141
4357
  'googleSearchRetrieval',
4142
4358
  ]);
4143
4359
  if (fromGoogleSearchRetrieval != null) {
4144
4360
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
4145
4361
  }
4362
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4363
+ if (fromComputerUse != null) {
4364
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
4365
+ }
4366
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
4367
+ if (fromFileSearch != null) {
4368
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
4369
+ }
4370
+ const fromCodeExecution = getValueByPath(fromObject, [
4371
+ 'codeExecution',
4372
+ ]);
4373
+ if (fromCodeExecution != null) {
4374
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4375
+ }
4146
4376
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4147
4377
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4148
4378
  }
@@ -4150,20 +4380,14 @@ function toolToMldev$4(fromObject) {
4150
4380
  if (fromGoogleMaps != null) {
4151
4381
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4152
4382
  }
4383
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4384
+ if (fromGoogleSearch != null) {
4385
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
4386
+ }
4153
4387
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
4154
4388
  if (fromUrlContext != null) {
4155
4389
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
4156
4390
  }
4157
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4158
- if (fromComputerUse != null) {
4159
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
4160
- }
4161
- const fromCodeExecution = getValueByPath(fromObject, [
4162
- 'codeExecution',
4163
- ]);
4164
- if (fromCodeExecution != null) {
4165
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4166
- }
4167
4391
  return toObject;
4168
4392
  }
4169
4393
 
@@ -4179,6 +4403,8 @@ var PagedItem;
4179
4403
  PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
4180
4404
  PagedItem["PAGED_ITEM_FILES"] = "files";
4181
4405
  PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
4406
+ PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
4407
+ PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
4182
4408
  })(PagedItem || (PagedItem = {}));
4183
4409
  /**
4184
4410
  * Pager class for iterating through paginated results.
@@ -4859,13 +5085,13 @@ class Batches extends BaseModule {
4859
5085
  */
4860
5086
  function blobToMldev$3(fromObject) {
4861
5087
  const toObject = {};
4862
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
4863
- throw new Error('displayName parameter is not supported in Gemini API.');
4864
- }
4865
5088
  const fromData = getValueByPath(fromObject, ['data']);
4866
5089
  if (fromData != null) {
4867
5090
  setValueByPath(toObject, ['data'], fromData);
4868
5091
  }
5092
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
5093
+ throw new Error('displayName parameter is not supported in Gemini API.');
5094
+ }
4869
5095
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
4870
5096
  if (fromMimeType != null) {
4871
5097
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -5128,15 +5354,18 @@ function googleMapsToMldev$3(fromObject) {
5128
5354
  }
5129
5355
  function googleSearchToMldev$3(fromObject) {
5130
5356
  const toObject = {};
5357
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5358
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
5359
+ }
5360
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
5361
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
5362
+ }
5131
5363
  const fromTimeRangeFilter = getValueByPath(fromObject, [
5132
5364
  'timeRangeFilter',
5133
5365
  ]);
5134
5366
  if (fromTimeRangeFilter != null) {
5135
5367
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
5136
5368
  }
5137
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5138
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
5139
- }
5140
5369
  return toObject;
5141
5370
  }
5142
5371
  function listCachedContentsConfigToMldev(fromObject, parentObject) {
@@ -5237,39 +5466,15 @@ function listCachedContentsResponseFromVertex(fromObject) {
5237
5466
  }
5238
5467
  function partToMldev$3(fromObject) {
5239
5468
  const toObject = {};
5240
- const fromVideoMetadata = getValueByPath(fromObject, [
5241
- 'videoMetadata',
5469
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5470
+ if (fromFunctionCall != null) {
5471
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5472
+ }
5473
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
5474
+ 'codeExecutionResult',
5242
5475
  ]);
5243
- if (fromVideoMetadata != null) {
5244
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
5245
- }
5246
- const fromThought = getValueByPath(fromObject, ['thought']);
5247
- if (fromThought != null) {
5248
- setValueByPath(toObject, ['thought'], fromThought);
5249
- }
5250
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5251
- if (fromInlineData != null) {
5252
- setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
5253
- }
5254
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5255
- if (fromFileData != null) {
5256
- setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5257
- }
5258
- const fromThoughtSignature = getValueByPath(fromObject, [
5259
- 'thoughtSignature',
5260
- ]);
5261
- if (fromThoughtSignature != null) {
5262
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5263
- }
5264
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5265
- if (fromFunctionCall != null) {
5266
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5267
- }
5268
- const fromCodeExecutionResult = getValueByPath(fromObject, [
5269
- 'codeExecutionResult',
5270
- ]);
5271
- if (fromCodeExecutionResult != null) {
5272
- setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
5476
+ if (fromCodeExecutionResult != null) {
5477
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
5273
5478
  }
5274
5479
  const fromExecutableCode = getValueByPath(fromObject, [
5275
5480
  'executableCode',
@@ -5277,16 +5482,40 @@ function partToMldev$3(fromObject) {
5277
5482
  if (fromExecutableCode != null) {
5278
5483
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5279
5484
  }
5485
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5486
+ if (fromFileData != null) {
5487
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5488
+ }
5280
5489
  const fromFunctionResponse = getValueByPath(fromObject, [
5281
5490
  'functionResponse',
5282
5491
  ]);
5283
5492
  if (fromFunctionResponse != null) {
5284
5493
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
5285
5494
  }
5495
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5496
+ if (fromInlineData != null) {
5497
+ setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
5498
+ }
5286
5499
  const fromText = getValueByPath(fromObject, ['text']);
5287
5500
  if (fromText != null) {
5288
5501
  setValueByPath(toObject, ['text'], fromText);
5289
5502
  }
5503
+ const fromThought = getValueByPath(fromObject, ['thought']);
5504
+ if (fromThought != null) {
5505
+ setValueByPath(toObject, ['thought'], fromThought);
5506
+ }
5507
+ const fromThoughtSignature = getValueByPath(fromObject, [
5508
+ 'thoughtSignature',
5509
+ ]);
5510
+ if (fromThoughtSignature != null) {
5511
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5512
+ }
5513
+ const fromVideoMetadata = getValueByPath(fromObject, [
5514
+ 'videoMetadata',
5515
+ ]);
5516
+ if (fromVideoMetadata != null) {
5517
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
5518
+ }
5290
5519
  return toObject;
5291
5520
  }
5292
5521
  function toolToMldev$3(fromObject) {
@@ -5306,16 +5535,26 @@ function toolToMldev$3(fromObject) {
5306
5535
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
5307
5536
  throw new Error('retrieval parameter is not supported in Gemini API.');
5308
5537
  }
5309
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5310
- if (fromGoogleSearch != null) {
5311
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
5312
- }
5313
5538
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5314
5539
  'googleSearchRetrieval',
5315
5540
  ]);
5316
5541
  if (fromGoogleSearchRetrieval != null) {
5317
5542
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5318
5543
  }
5544
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5545
+ if (fromComputerUse != null) {
5546
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
5547
+ }
5548
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
5549
+ if (fromFileSearch != null) {
5550
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
5551
+ }
5552
+ const fromCodeExecution = getValueByPath(fromObject, [
5553
+ 'codeExecution',
5554
+ ]);
5555
+ if (fromCodeExecution != null) {
5556
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5557
+ }
5319
5558
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5320
5559
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5321
5560
  }
@@ -5323,20 +5562,14 @@ function toolToMldev$3(fromObject) {
5323
5562
  if (fromGoogleMaps != null) {
5324
5563
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5325
5564
  }
5565
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5566
+ if (fromGoogleSearch != null) {
5567
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
5568
+ }
5326
5569
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5327
5570
  if (fromUrlContext != null) {
5328
5571
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
5329
5572
  }
5330
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5331
- if (fromComputerUse != null) {
5332
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5333
- }
5334
- const fromCodeExecution = getValueByPath(fromObject, [
5335
- 'codeExecution',
5336
- ]);
5337
- if (fromCodeExecution != null) {
5338
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5339
- }
5340
5573
  return toObject;
5341
5574
  }
5342
5575
  function toolToVertex$2(fromObject) {
@@ -5357,16 +5590,25 @@ function toolToVertex$2(fromObject) {
5357
5590
  if (fromRetrieval != null) {
5358
5591
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
5359
5592
  }
5360
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5361
- if (fromGoogleSearch != null) {
5362
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
5363
- }
5364
5593
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5365
5594
  'googleSearchRetrieval',
5366
5595
  ]);
5367
5596
  if (fromGoogleSearchRetrieval != null) {
5368
5597
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5369
5598
  }
5599
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5600
+ if (fromComputerUse != null) {
5601
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
5602
+ }
5603
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
5604
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
5605
+ }
5606
+ const fromCodeExecution = getValueByPath(fromObject, [
5607
+ 'codeExecution',
5608
+ ]);
5609
+ if (fromCodeExecution != null) {
5610
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5611
+ }
5370
5612
  const fromEnterpriseWebSearch = getValueByPath(fromObject, [
5371
5613
  'enterpriseWebSearch',
5372
5614
  ]);
@@ -5377,20 +5619,14 @@ function toolToVertex$2(fromObject) {
5377
5619
  if (fromGoogleMaps != null) {
5378
5620
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
5379
5621
  }
5622
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5623
+ if (fromGoogleSearch != null) {
5624
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
5625
+ }
5380
5626
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5381
5627
  if (fromUrlContext != null) {
5382
5628
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
5383
5629
  }
5384
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5385
- if (fromComputerUse != null) {
5386
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5387
- }
5388
- const fromCodeExecution = getValueByPath(fromObject, [
5389
- 'codeExecution',
5390
- ]);
5391
- if (fromCodeExecution != null) {
5392
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5393
- }
5394
5630
  return toObject;
5395
5631
  }
5396
5632
  function updateCachedContentConfigToMldev(fromObject, parentObject) {
@@ -6599,13 +6835,13 @@ class Files extends BaseModule {
6599
6835
  */
6600
6836
  function blobToMldev$2(fromObject) {
6601
6837
  const toObject = {};
6602
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
6603
- throw new Error('displayName parameter is not supported in Gemini API.');
6604
- }
6605
6838
  const fromData = getValueByPath(fromObject, ['data']);
6606
6839
  if (fromData != null) {
6607
6840
  setValueByPath(toObject, ['data'], fromData);
6608
6841
  }
6842
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
6843
+ throw new Error('displayName parameter is not supported in Gemini API.');
6844
+ }
6609
6845
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
6610
6846
  if (fromMimeType != null) {
6611
6847
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -6688,6 +6924,12 @@ function generationConfigToVertex$1(fromObject) {
6688
6924
  if (fromModelSelectionConfig != null) {
6689
6925
  setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
6690
6926
  }
6927
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
6928
+ 'responseJsonSchema',
6929
+ ]);
6930
+ if (fromResponseJsonSchema != null) {
6931
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6932
+ }
6691
6933
  const fromAudioTimestamp = getValueByPath(fromObject, [
6692
6934
  'audioTimestamp',
6693
6935
  ]);
@@ -6734,12 +6976,6 @@ function generationConfigToVertex$1(fromObject) {
6734
6976
  if (fromPresencePenalty != null) {
6735
6977
  setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
6736
6978
  }
6737
- const fromResponseJsonSchema = getValueByPath(fromObject, [
6738
- 'responseJsonSchema',
6739
- ]);
6740
- if (fromResponseJsonSchema != null) {
6741
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6742
- }
6743
6979
  const fromResponseLogprobs = getValueByPath(fromObject, [
6744
6980
  'responseLogprobs',
6745
6981
  ]);
@@ -6821,15 +7057,18 @@ function googleMapsToMldev$2(fromObject) {
6821
7057
  }
6822
7058
  function googleSearchToMldev$2(fromObject) {
6823
7059
  const toObject = {};
7060
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
7061
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
7062
+ }
7063
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
7064
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
7065
+ }
6824
7066
  const fromTimeRangeFilter = getValueByPath(fromObject, [
6825
7067
  'timeRangeFilter',
6826
7068
  ]);
6827
7069
  if (fromTimeRangeFilter != null) {
6828
7070
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
6829
7071
  }
6830
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
6831
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
6832
- }
6833
7072
  return toObject;
6834
7073
  }
6835
7074
  function liveConnectConfigToMldev$1(fromObject, parentObject) {
@@ -7230,30 +7469,6 @@ function liveServerMessageFromVertex(fromObject) {
7230
7469
  }
7231
7470
  function partToMldev$2(fromObject) {
7232
7471
  const toObject = {};
7233
- const fromVideoMetadata = getValueByPath(fromObject, [
7234
- 'videoMetadata',
7235
- ]);
7236
- if (fromVideoMetadata != null) {
7237
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
7238
- }
7239
- const fromThought = getValueByPath(fromObject, ['thought']);
7240
- if (fromThought != null) {
7241
- setValueByPath(toObject, ['thought'], fromThought);
7242
- }
7243
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
7244
- if (fromInlineData != null) {
7245
- setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
7246
- }
7247
- const fromFileData = getValueByPath(fromObject, ['fileData']);
7248
- if (fromFileData != null) {
7249
- setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7250
- }
7251
- const fromThoughtSignature = getValueByPath(fromObject, [
7252
- 'thoughtSignature',
7253
- ]);
7254
- if (fromThoughtSignature != null) {
7255
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7256
- }
7257
7472
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7258
7473
  if (fromFunctionCall != null) {
7259
7474
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7270,16 +7485,40 @@ function partToMldev$2(fromObject) {
7270
7485
  if (fromExecutableCode != null) {
7271
7486
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7272
7487
  }
7488
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
7489
+ if (fromFileData != null) {
7490
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7491
+ }
7273
7492
  const fromFunctionResponse = getValueByPath(fromObject, [
7274
7493
  'functionResponse',
7275
7494
  ]);
7276
7495
  if (fromFunctionResponse != null) {
7277
7496
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
7278
7497
  }
7498
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
7499
+ if (fromInlineData != null) {
7500
+ setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
7501
+ }
7279
7502
  const fromText = getValueByPath(fromObject, ['text']);
7280
7503
  if (fromText != null) {
7281
7504
  setValueByPath(toObject, ['text'], fromText);
7282
7505
  }
7506
+ const fromThought = getValueByPath(fromObject, ['thought']);
7507
+ if (fromThought != null) {
7508
+ setValueByPath(toObject, ['thought'], fromThought);
7509
+ }
7510
+ const fromThoughtSignature = getValueByPath(fromObject, [
7511
+ 'thoughtSignature',
7512
+ ]);
7513
+ if (fromThoughtSignature != null) {
7514
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7515
+ }
7516
+ const fromVideoMetadata = getValueByPath(fromObject, [
7517
+ 'videoMetadata',
7518
+ ]);
7519
+ if (fromVideoMetadata != null) {
7520
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
7521
+ }
7283
7522
  return toObject;
7284
7523
  }
7285
7524
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -7295,6 +7534,10 @@ function sessionResumptionConfigToMldev$1(fromObject) {
7295
7534
  }
7296
7535
  function speechConfigToVertex$1(fromObject) {
7297
7536
  const toObject = {};
7537
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7538
+ if (fromLanguageCode != null) {
7539
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7540
+ }
7298
7541
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
7299
7542
  if (fromVoiceConfig != null) {
7300
7543
  setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
@@ -7302,10 +7545,6 @@ function speechConfigToVertex$1(fromObject) {
7302
7545
  if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
7303
7546
  throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
7304
7547
  }
7305
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7306
- if (fromLanguageCode != null) {
7307
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7308
- }
7309
7548
  return toObject;
7310
7549
  }
7311
7550
  function toolToMldev$2(fromObject) {
@@ -7325,16 +7564,26 @@ function toolToMldev$2(fromObject) {
7325
7564
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
7326
7565
  throw new Error('retrieval parameter is not supported in Gemini API.');
7327
7566
  }
7328
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7329
- if (fromGoogleSearch != null) {
7330
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
7331
- }
7332
7567
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7333
7568
  'googleSearchRetrieval',
7334
7569
  ]);
7335
7570
  if (fromGoogleSearchRetrieval != null) {
7336
7571
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7337
7572
  }
7573
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7574
+ if (fromComputerUse != null) {
7575
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
7576
+ }
7577
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
7578
+ if (fromFileSearch != null) {
7579
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
7580
+ }
7581
+ const fromCodeExecution = getValueByPath(fromObject, [
7582
+ 'codeExecution',
7583
+ ]);
7584
+ if (fromCodeExecution != null) {
7585
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7586
+ }
7338
7587
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7339
7588
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
7340
7589
  }
@@ -7342,20 +7591,14 @@ function toolToMldev$2(fromObject) {
7342
7591
  if (fromGoogleMaps != null) {
7343
7592
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
7344
7593
  }
7594
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7595
+ if (fromGoogleSearch != null) {
7596
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
7597
+ }
7345
7598
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7346
7599
  if (fromUrlContext != null) {
7347
7600
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
7348
7601
  }
7349
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7350
- if (fromComputerUse != null) {
7351
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
7352
- }
7353
- const fromCodeExecution = getValueByPath(fromObject, [
7354
- 'codeExecution',
7355
- ]);
7356
- if (fromCodeExecution != null) {
7357
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7358
- }
7359
7602
  return toObject;
7360
7603
  }
7361
7604
  function toolToVertex$1(fromObject) {
@@ -7376,16 +7619,25 @@ function toolToVertex$1(fromObject) {
7376
7619
  if (fromRetrieval != null) {
7377
7620
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
7378
7621
  }
7379
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7380
- if (fromGoogleSearch != null) {
7381
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
7382
- }
7383
7622
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7384
7623
  'googleSearchRetrieval',
7385
7624
  ]);
7386
7625
  if (fromGoogleSearchRetrieval != null) {
7387
7626
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7388
7627
  }
7628
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7629
+ if (fromComputerUse != null) {
7630
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
7631
+ }
7632
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
7633
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
7634
+ }
7635
+ const fromCodeExecution = getValueByPath(fromObject, [
7636
+ 'codeExecution',
7637
+ ]);
7638
+ if (fromCodeExecution != null) {
7639
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7640
+ }
7389
7641
  const fromEnterpriseWebSearch = getValueByPath(fromObject, [
7390
7642
  'enterpriseWebSearch',
7391
7643
  ]);
@@ -7396,20 +7648,14 @@ function toolToVertex$1(fromObject) {
7396
7648
  if (fromGoogleMaps != null) {
7397
7649
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
7398
7650
  }
7651
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7652
+ if (fromGoogleSearch != null) {
7653
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
7654
+ }
7399
7655
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7400
7656
  if (fromUrlContext != null) {
7401
7657
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
7402
7658
  }
7403
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7404
- if (fromComputerUse != null) {
7405
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
7406
- }
7407
- const fromCodeExecution = getValueByPath(fromObject, [
7408
- 'codeExecution',
7409
- ]);
7410
- if (fromCodeExecution != null) {
7411
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7412
- }
7413
7659
  return toObject;
7414
7660
  }
7415
7661
  function usageMetadataFromVertex(fromObject) {
@@ -7512,13 +7758,13 @@ function usageMetadataFromVertex(fromObject) {
7512
7758
  */
7513
7759
  function blobToMldev$1(fromObject) {
7514
7760
  const toObject = {};
7515
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7516
- throw new Error('displayName parameter is not supported in Gemini API.');
7517
- }
7518
7761
  const fromData = getValueByPath(fromObject, ['data']);
7519
7762
  if (fromData != null) {
7520
7763
  setValueByPath(toObject, ['data'], fromData);
7521
7764
  }
7765
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7766
+ throw new Error('displayName parameter is not supported in Gemini API.');
7767
+ }
7522
7768
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
7523
7769
  if (fromMimeType != null) {
7524
7770
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -7545,12 +7791,6 @@ function candidateFromMldev(fromObject) {
7545
7791
  if (fromFinishReason != null) {
7546
7792
  setValueByPath(toObject, ['finishReason'], fromFinishReason);
7547
7793
  }
7548
- const fromUrlContextMetadata = getValueByPath(fromObject, [
7549
- 'urlContextMetadata',
7550
- ]);
7551
- if (fromUrlContextMetadata != null) {
7552
- setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
7553
- }
7554
7794
  const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
7555
7795
  if (fromAvgLogprobs != null) {
7556
7796
  setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
@@ -7583,6 +7823,12 @@ function candidateFromMldev(fromObject) {
7583
7823
  }
7584
7824
  setValueByPath(toObject, ['safetyRatings'], transformedList);
7585
7825
  }
7826
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
7827
+ 'urlContextMetadata',
7828
+ ]);
7829
+ if (fromUrlContextMetadata != null) {
7830
+ setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
7831
+ }
7586
7832
  return toObject;
7587
7833
  }
7588
7834
  function citationMetadataFromMldev(fromObject) {
@@ -9351,6 +9597,12 @@ function generationConfigToVertex(fromObject) {
9351
9597
  if (fromModelSelectionConfig != null) {
9352
9598
  setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
9353
9599
  }
9600
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
9601
+ 'responseJsonSchema',
9602
+ ]);
9603
+ if (fromResponseJsonSchema != null) {
9604
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9605
+ }
9354
9606
  const fromAudioTimestamp = getValueByPath(fromObject, [
9355
9607
  'audioTimestamp',
9356
9608
  ]);
@@ -9397,12 +9649,6 @@ function generationConfigToVertex(fromObject) {
9397
9649
  if (fromPresencePenalty != null) {
9398
9650
  setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
9399
9651
  }
9400
- const fromResponseJsonSchema = getValueByPath(fromObject, [
9401
- 'responseJsonSchema',
9402
- ]);
9403
- if (fromResponseJsonSchema != null) {
9404
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9405
- }
9406
9652
  const fromResponseLogprobs = getValueByPath(fromObject, [
9407
9653
  'responseLogprobs',
9408
9654
  ]);
@@ -9500,15 +9746,18 @@ function googleMapsToMldev$1(fromObject) {
9500
9746
  }
9501
9747
  function googleSearchToMldev$1(fromObject) {
9502
9748
  const toObject = {};
9749
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9750
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
9751
+ }
9752
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
9753
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
9754
+ }
9503
9755
  const fromTimeRangeFilter = getValueByPath(fromObject, [
9504
9756
  'timeRangeFilter',
9505
9757
  ]);
9506
9758
  if (fromTimeRangeFilter != null) {
9507
9759
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
9508
9760
  }
9509
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9510
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
9511
- }
9512
9761
  return toObject;
9513
9762
  }
9514
9763
  function imageFromMldev(fromObject) {
@@ -9798,30 +10047,6 @@ function modelFromVertex(fromObject) {
9798
10047
  }
9799
10048
  function partToMldev$1(fromObject) {
9800
10049
  const toObject = {};
9801
- const fromVideoMetadata = getValueByPath(fromObject, [
9802
- 'videoMetadata',
9803
- ]);
9804
- if (fromVideoMetadata != null) {
9805
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
9806
- }
9807
- const fromThought = getValueByPath(fromObject, ['thought']);
9808
- if (fromThought != null) {
9809
- setValueByPath(toObject, ['thought'], fromThought);
9810
- }
9811
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
9812
- if (fromInlineData != null) {
9813
- setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
9814
- }
9815
- const fromFileData = getValueByPath(fromObject, ['fileData']);
9816
- if (fromFileData != null) {
9817
- setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
9818
- }
9819
- const fromThoughtSignature = getValueByPath(fromObject, [
9820
- 'thoughtSignature',
9821
- ]);
9822
- if (fromThoughtSignature != null) {
9823
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
9824
- }
9825
10050
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9826
10051
  if (fromFunctionCall != null) {
9827
10052
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -9838,16 +10063,40 @@ function partToMldev$1(fromObject) {
9838
10063
  if (fromExecutableCode != null) {
9839
10064
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9840
10065
  }
10066
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
10067
+ if (fromFileData != null) {
10068
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
10069
+ }
9841
10070
  const fromFunctionResponse = getValueByPath(fromObject, [
9842
10071
  'functionResponse',
9843
10072
  ]);
9844
10073
  if (fromFunctionResponse != null) {
9845
10074
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
9846
10075
  }
10076
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
10077
+ if (fromInlineData != null) {
10078
+ setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
10079
+ }
9847
10080
  const fromText = getValueByPath(fromObject, ['text']);
9848
10081
  if (fromText != null) {
9849
10082
  setValueByPath(toObject, ['text'], fromText);
9850
10083
  }
10084
+ const fromThought = getValueByPath(fromObject, ['thought']);
10085
+ if (fromThought != null) {
10086
+ setValueByPath(toObject, ['thought'], fromThought);
10087
+ }
10088
+ const fromThoughtSignature = getValueByPath(fromObject, [
10089
+ 'thoughtSignature',
10090
+ ]);
10091
+ if (fromThoughtSignature != null) {
10092
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
10093
+ }
10094
+ const fromVideoMetadata = getValueByPath(fromObject, [
10095
+ 'videoMetadata',
10096
+ ]);
10097
+ if (fromVideoMetadata != null) {
10098
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
10099
+ }
9851
10100
  return toObject;
9852
10101
  }
9853
10102
  function productImageToVertex(fromObject) {
@@ -10064,13 +10313,13 @@ function safetyAttributesFromVertex(fromObject) {
10064
10313
  }
10065
10314
  function safetySettingToMldev(fromObject) {
10066
10315
  const toObject = {};
10067
- if (getValueByPath(fromObject, ['method']) !== undefined) {
10068
- throw new Error('method parameter is not supported in Gemini API.');
10069
- }
10070
10316
  const fromCategory = getValueByPath(fromObject, ['category']);
10071
10317
  if (fromCategory != null) {
10072
10318
  setValueByPath(toObject, ['category'], fromCategory);
10073
10319
  }
10320
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
10321
+ throw new Error('method parameter is not supported in Gemini API.');
10322
+ }
10074
10323
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
10075
10324
  if (fromThreshold != null) {
10076
10325
  setValueByPath(toObject, ['threshold'], fromThreshold);
@@ -10169,6 +10418,10 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
10169
10418
  }
10170
10419
  function speechConfigToVertex(fromObject) {
10171
10420
  const toObject = {};
10421
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
10422
+ if (fromLanguageCode != null) {
10423
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
10424
+ }
10172
10425
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
10173
10426
  if (fromVoiceConfig != null) {
10174
10427
  setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
@@ -10176,10 +10429,6 @@ function speechConfigToVertex(fromObject) {
10176
10429
  if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
10177
10430
  throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
10178
10431
  }
10179
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
10180
- if (fromLanguageCode != null) {
10181
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
10182
- }
10183
10432
  return toObject;
10184
10433
  }
10185
10434
  function toolToMldev$1(fromObject) {
@@ -10199,16 +10448,26 @@ function toolToMldev$1(fromObject) {
10199
10448
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
10200
10449
  throw new Error('retrieval parameter is not supported in Gemini API.');
10201
10450
  }
10202
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10203
- if (fromGoogleSearch != null) {
10204
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
10205
- }
10206
10451
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10207
10452
  'googleSearchRetrieval',
10208
10453
  ]);
10209
10454
  if (fromGoogleSearchRetrieval != null) {
10210
10455
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10211
10456
  }
10457
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10458
+ if (fromComputerUse != null) {
10459
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
10460
+ }
10461
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
10462
+ if (fromFileSearch != null) {
10463
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
10464
+ }
10465
+ const fromCodeExecution = getValueByPath(fromObject, [
10466
+ 'codeExecution',
10467
+ ]);
10468
+ if (fromCodeExecution != null) {
10469
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10470
+ }
10212
10471
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10213
10472
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10214
10473
  }
@@ -10216,20 +10475,14 @@ function toolToMldev$1(fromObject) {
10216
10475
  if (fromGoogleMaps != null) {
10217
10476
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10218
10477
  }
10478
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10479
+ if (fromGoogleSearch != null) {
10480
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
10481
+ }
10219
10482
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10220
10483
  if (fromUrlContext != null) {
10221
10484
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
10222
10485
  }
10223
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10224
- if (fromComputerUse != null) {
10225
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10226
- }
10227
- const fromCodeExecution = getValueByPath(fromObject, [
10228
- 'codeExecution',
10229
- ]);
10230
- if (fromCodeExecution != null) {
10231
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10232
- }
10233
10486
  return toObject;
10234
10487
  }
10235
10488
  function toolToVertex(fromObject) {
@@ -10250,16 +10503,25 @@ function toolToVertex(fromObject) {
10250
10503
  if (fromRetrieval != null) {
10251
10504
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
10252
10505
  }
10253
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10254
- if (fromGoogleSearch != null) {
10255
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
10256
- }
10257
10506
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10258
10507
  'googleSearchRetrieval',
10259
10508
  ]);
10260
10509
  if (fromGoogleSearchRetrieval != null) {
10261
10510
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10262
10511
  }
10512
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10513
+ if (fromComputerUse != null) {
10514
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
10515
+ }
10516
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
10517
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
10518
+ }
10519
+ const fromCodeExecution = getValueByPath(fromObject, [
10520
+ 'codeExecution',
10521
+ ]);
10522
+ if (fromCodeExecution != null) {
10523
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10524
+ }
10263
10525
  const fromEnterpriseWebSearch = getValueByPath(fromObject, [
10264
10526
  'enterpriseWebSearch',
10265
10527
  ]);
@@ -10270,20 +10532,14 @@ function toolToVertex(fromObject) {
10270
10532
  if (fromGoogleMaps != null) {
10271
10533
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
10272
10534
  }
10535
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10536
+ if (fromGoogleSearch != null) {
10537
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
10538
+ }
10273
10539
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10274
10540
  if (fromUrlContext != null) {
10275
10541
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
10276
10542
  }
10277
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10278
- if (fromComputerUse != null) {
10279
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10280
- }
10281
- const fromCodeExecution = getValueByPath(fromObject, [
10282
- 'codeExecution',
10283
- ]);
10284
- if (fromCodeExecution != null) {
10285
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10286
- }
10287
10543
  return toObject;
10288
10544
  }
10289
10545
  function tunedModelInfoFromMldev(fromObject) {
@@ -10387,6 +10643,18 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
10387
10643
  if (parentObject !== undefined && fromOutputGcsUri != null) {
10388
10644
  setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
10389
10645
  }
10646
+ const fromSafetyFilterLevel = getValueByPath(fromObject, [
10647
+ 'safetyFilterLevel',
10648
+ ]);
10649
+ if (parentObject !== undefined && fromSafetyFilterLevel != null) {
10650
+ setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
10651
+ }
10652
+ const fromPersonGeneration = getValueByPath(fromObject, [
10653
+ 'personGeneration',
10654
+ ]);
10655
+ if (parentObject !== undefined && fromPersonGeneration != null) {
10656
+ setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
10657
+ }
10390
10658
  const fromIncludeRaiReason = getValueByPath(fromObject, [
10391
10659
  'includeRaiReason',
10392
10660
  ]);
@@ -10593,7 +10861,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10593
10861
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10594
10862
  const USER_AGENT_HEADER = 'User-Agent';
10595
10863
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10596
- const SDK_VERSION = '1.27.0'; // x-release-please-version
10864
+ const SDK_VERSION = '1.29.0'; // x-release-please-version
10597
10865
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10598
10866
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10599
10867
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -10971,13 +11239,22 @@ class ApiClient {
10971
11239
  await this.clientOptions.auth.addAuthHeaders(headers, url);
10972
11240
  return headers;
10973
11241
  }
11242
+ getFileName(file) {
11243
+ var _a;
11244
+ let fileName = '';
11245
+ if (typeof file === 'string') {
11246
+ fileName = file.replace(/[/\\]+$/, '');
11247
+ fileName = (_a = fileName.split(/[/\\]/).pop()) !== null && _a !== void 0 ? _a : '';
11248
+ }
11249
+ return fileName;
11250
+ }
10974
11251
  /**
10975
11252
  * Uploads a file asynchronously using Gemini API only, this is not supported
10976
11253
  * in Vertex AI.
10977
11254
  *
10978
11255
  * @param file The string path to the file to be uploaded or a Blob object.
10979
11256
  * @param config Optional parameters specified in the `UploadFileConfig`
10980
- * interface. @see {@link UploadFileConfig}
11257
+ * interface. @see {@link types.UploadFileConfig}
10981
11258
  * @return A promise that resolves to a `File` object.
10982
11259
  * @throws An error if called on a Vertex AI client.
10983
11260
  * @throws An error if the `mimeType` is not provided and can not be inferred,
@@ -11001,42 +11278,71 @@ class ApiClient {
11001
11278
  throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
11002
11279
  }
11003
11280
  fileToUpload.mimeType = mimeType;
11004
- const uploadUrl = await this.fetchUploadUrl(fileToUpload, config);
11281
+ const body = {
11282
+ file: fileToUpload,
11283
+ };
11284
+ const fileName = this.getFileName(file);
11285
+ const path = formatMap('upload/v1beta/files', body['_url']);
11286
+ const uploadUrl = await this.fetchUploadUrl(path, fileToUpload.sizeBytes, fileToUpload.mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
11005
11287
  return uploader.upload(file, uploadUrl, this);
11006
11288
  }
11289
+ /**
11290
+ * Uploads a file to a given file search store asynchronously using Gemini API only, this is not supported
11291
+ * in Vertex AI.
11292
+ *
11293
+ * @param fileSearchStoreName The name of the file search store to upload the file to.
11294
+ * @param file The string path to the file to be uploaded or a Blob object.
11295
+ * @param config Optional parameters specified in the `UploadFileConfig`
11296
+ * interface. @see {@link UploadFileConfig}
11297
+ * @return A promise that resolves to a `File` object.
11298
+ * @throws An error if called on a Vertex AI client.
11299
+ * @throws An error if the `mimeType` is not provided and can not be inferred,
11300
+ */
11301
+ async uploadFileToFileSearchStore(fileSearchStoreName, file, config) {
11302
+ var _a;
11303
+ const uploader = this.clientOptions.uploader;
11304
+ const fileStat = await uploader.stat(file);
11305
+ const sizeBytes = String(fileStat.size);
11306
+ const mimeType = (_a = config === null || config === void 0 ? void 0 : config.mimeType) !== null && _a !== void 0 ? _a : fileStat.type;
11307
+ if (mimeType === undefined || mimeType === '') {
11308
+ throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
11309
+ }
11310
+ const path = `upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`;
11311
+ const fileName = this.getFileName(file);
11312
+ const body = {};
11313
+ if (config === null || config === void 0 ? void 0 : config.customMetadata) {
11314
+ body['customMetadata'] = config.customMetadata;
11315
+ }
11316
+ if (config === null || config === void 0 ? void 0 : config.chunkingConfig) {
11317
+ body['chunkingConfig'] = config.chunkingConfig;
11318
+ }
11319
+ const uploadUrl = await this.fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
11320
+ return uploader.uploadToFileSearchStore(file, uploadUrl, this);
11321
+ }
11007
11322
  /**
11008
11323
  * Downloads a file asynchronously to the specified path.
11009
11324
  *
11010
11325
  * @params params - The parameters for the download request, see {@link
11011
- * DownloadFileParameters}
11326
+ * types.DownloadFileParameters}
11012
11327
  */
11013
11328
  async downloadFile(params) {
11014
11329
  const downloader = this.clientOptions.downloader;
11015
11330
  await downloader.download(params, this);
11016
11331
  }
11017
- async fetchUploadUrl(file, config) {
11332
+ async fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, configHttpOptions) {
11018
11333
  var _a;
11019
11334
  let httpOptions = {};
11020
- if (config === null || config === void 0 ? void 0 : config.httpOptions) {
11021
- httpOptions = config.httpOptions;
11335
+ if (configHttpOptions) {
11336
+ httpOptions = configHttpOptions;
11022
11337
  }
11023
11338
  else {
11024
11339
  httpOptions = {
11025
11340
  apiVersion: '',
11026
- headers: {
11027
- 'Content-Type': 'application/json',
11028
- 'X-Goog-Upload-Protocol': 'resumable',
11029
- 'X-Goog-Upload-Command': 'start',
11030
- 'X-Goog-Upload-Header-Content-Length': `${file.sizeBytes}`,
11031
- 'X-Goog-Upload-Header-Content-Type': `${file.mimeType}`,
11032
- },
11341
+ headers: Object.assign({ 'Content-Type': 'application/json', 'X-Goog-Upload-Protocol': 'resumable', 'X-Goog-Upload-Command': 'start', 'X-Goog-Upload-Header-Content-Length': `${sizeBytes}`, 'X-Goog-Upload-Header-Content-Type': `${mimeType}` }, (fileName ? { 'X-Goog-Upload-File-Name': fileName } : {})),
11033
11342
  };
11034
11343
  }
11035
- const body = {
11036
- 'file': file,
11037
- };
11038
11344
  const httpResponse = await this.request({
11039
- path: formatMap('upload/v1beta/files', body['_url']),
11345
+ path,
11040
11346
  body: JSON.stringify(body),
11041
11347
  httpMethod: 'POST',
11042
11348
  httpOptions,
@@ -12040,11 +12346,27 @@ function hasCallableTools(params) {
12040
12346
  var _a, _b, _c;
12041
12347
  return (_c = (_b = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools) === null || _b === void 0 ? void 0 : _b.some((tool) => isCallableTool(tool))) !== null && _c !== void 0 ? _c : false;
12042
12348
  }
12043
- // Checks whether the list of tools contains any non-callable tools. Will return
12044
- // true if there is at least one non-Callable tool.
12045
- function hasNonCallableTools(params) {
12046
- var _a, _b, _c;
12047
- return (_c = (_b = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools) === null || _b === void 0 ? void 0 : _b.some((tool) => !isCallableTool(tool))) !== null && _c !== void 0 ? _c : false;
12349
+ /**
12350
+ * Returns the indexes of the tools that are not compatible with AFC.
12351
+ */
12352
+ function findAfcIncompatibleToolIndexes(params) {
12353
+ var _a;
12354
+ // Use number[] for an array of numbers in TypeScript
12355
+ const afcIncompatibleToolIndexes = [];
12356
+ if (!((_a = params === null || params === void 0 ? void 0 : params.config) === null || _a === void 0 ? void 0 : _a.tools)) {
12357
+ return afcIncompatibleToolIndexes;
12358
+ }
12359
+ params.config.tools.forEach((tool, index) => {
12360
+ if (isCallableTool(tool)) {
12361
+ return;
12362
+ }
12363
+ const geminiTool = tool;
12364
+ if (geminiTool.functionDeclarations &&
12365
+ geminiTool.functionDeclarations.length > 0) {
12366
+ afcIncompatibleToolIndexes.push(index);
12367
+ }
12368
+ });
12369
+ return afcIncompatibleToolIndexes;
12048
12370
  }
12049
12371
  /**
12050
12372
  * Returns whether to append automatic function calling history to the
@@ -12109,8 +12431,12 @@ class Models extends BaseModule {
12109
12431
  if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
12110
12432
  return await this.generateContentInternal(transformedParams);
12111
12433
  }
12112
- if (hasNonCallableTools(params)) {
12113
- throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
12434
+ const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
12435
+ if (incompatibleToolIndexes.length > 0) {
12436
+ const formattedIndexes = incompatibleToolIndexes
12437
+ .map((index) => `tools[${index}]`)
12438
+ .join(', ');
12439
+ throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${formattedIndexes}.`);
12114
12440
  }
12115
12441
  let response;
12116
12442
  let functionResponseContent;
@@ -12197,9 +12523,14 @@ class Models extends BaseModule {
12197
12523
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
12198
12524
  return await this.generateContentStreamInternal(transformedParams);
12199
12525
  }
12200
- else {
12201
- return await this.processAfcStream(params);
12526
+ const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
12527
+ if (incompatibleToolIndexes.length > 0) {
12528
+ const formattedIndexes = incompatibleToolIndexes
12529
+ .map((index) => `tools[${index}]`)
12530
+ .join(', ');
12531
+ throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
12202
12532
  }
12533
+ return await this.processAfcStream(params);
12203
12534
  };
12204
12535
  /**
12205
12536
  * Generates an image based on a text description and configuration.
@@ -13595,7 +13926,7 @@ class Operations extends BaseModule {
13595
13926
  });
13596
13927
  return operation._fromAPIResponse({
13597
13928
  apiResponse: rawOperation,
13598
- isVertexAI: true,
13929
+ _isVertexAI: true,
13599
13930
  });
13600
13931
  }
13601
13932
  else {
@@ -13605,7 +13936,7 @@ class Operations extends BaseModule {
13605
13936
  });
13606
13937
  return operation._fromAPIResponse({
13607
13938
  apiResponse: rawOperation,
13608
- isVertexAI: false,
13939
+ _isVertexAI: false,
13609
13940
  });
13610
13941
  }
13611
13942
  }
@@ -13634,7 +13965,7 @@ class Operations extends BaseModule {
13634
13965
  });
13635
13966
  return operation._fromAPIResponse({
13636
13967
  apiResponse: rawOperation,
13637
- isVertexAI: true,
13968
+ _isVertexAI: true,
13638
13969
  });
13639
13970
  }
13640
13971
  else {
@@ -13644,7 +13975,7 @@ class Operations extends BaseModule {
13644
13975
  });
13645
13976
  return operation._fromAPIResponse({
13646
13977
  apiResponse: rawOperation,
13647
- isVertexAI: false,
13978
+ _isVertexAI: false,
13648
13979
  });
13649
13980
  }
13650
13981
  }
@@ -13732,13 +14063,13 @@ class Operations extends BaseModule {
13732
14063
  */
13733
14064
  function blobToMldev(fromObject) {
13734
14065
  const toObject = {};
13735
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
13736
- throw new Error('displayName parameter is not supported in Gemini API.');
13737
- }
13738
14066
  const fromData = getValueByPath(fromObject, ['data']);
13739
14067
  if (fromData != null) {
13740
14068
  setValueByPath(toObject, ['data'], fromData);
13741
14069
  }
14070
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
14071
+ throw new Error('displayName parameter is not supported in Gemini API.');
14072
+ }
13742
14073
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
13743
14074
  if (fromMimeType != null) {
13744
14075
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -13829,15 +14160,18 @@ function googleMapsToMldev(fromObject) {
13829
14160
  }
13830
14161
  function googleSearchToMldev(fromObject) {
13831
14162
  const toObject = {};
14163
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
14164
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
14165
+ }
14166
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
14167
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
14168
+ }
13832
14169
  const fromTimeRangeFilter = getValueByPath(fromObject, [
13833
14170
  'timeRangeFilter',
13834
14171
  ]);
13835
14172
  if (fromTimeRangeFilter != null) {
13836
14173
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
13837
14174
  }
13838
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13839
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
13840
- }
13841
14175
  return toObject;
13842
14176
  }
13843
14177
  function liveConnectConfigToMldev(fromObject, parentObject) {
@@ -13964,30 +14298,6 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
13964
14298
  }
13965
14299
  function partToMldev(fromObject) {
13966
14300
  const toObject = {};
13967
- const fromVideoMetadata = getValueByPath(fromObject, [
13968
- 'videoMetadata',
13969
- ]);
13970
- if (fromVideoMetadata != null) {
13971
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
13972
- }
13973
- const fromThought = getValueByPath(fromObject, ['thought']);
13974
- if (fromThought != null) {
13975
- setValueByPath(toObject, ['thought'], fromThought);
13976
- }
13977
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
13978
- if (fromInlineData != null) {
13979
- setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
13980
- }
13981
- const fromFileData = getValueByPath(fromObject, ['fileData']);
13982
- if (fromFileData != null) {
13983
- setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
13984
- }
13985
- const fromThoughtSignature = getValueByPath(fromObject, [
13986
- 'thoughtSignature',
13987
- ]);
13988
- if (fromThoughtSignature != null) {
13989
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
13990
- }
13991
14301
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
13992
14302
  if (fromFunctionCall != null) {
13993
14303
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -14004,25 +14314,49 @@ function partToMldev(fromObject) {
14004
14314
  if (fromExecutableCode != null) {
14005
14315
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
14006
14316
  }
14317
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
14318
+ if (fromFileData != null) {
14319
+ setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14320
+ }
14007
14321
  const fromFunctionResponse = getValueByPath(fromObject, [
14008
14322
  'functionResponse',
14009
14323
  ]);
14010
14324
  if (fromFunctionResponse != null) {
14011
14325
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
14012
14326
  }
14327
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
14328
+ if (fromInlineData != null) {
14329
+ setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
14330
+ }
14013
14331
  const fromText = getValueByPath(fromObject, ['text']);
14014
14332
  if (fromText != null) {
14015
14333
  setValueByPath(toObject, ['text'], fromText);
14016
14334
  }
14017
- return toObject;
14018
- }
14019
- function sessionResumptionConfigToMldev(fromObject) {
14020
- const toObject = {};
14021
- const fromHandle = getValueByPath(fromObject, ['handle']);
14022
- if (fromHandle != null) {
14023
- setValueByPath(toObject, ['handle'], fromHandle);
14335
+ const fromThought = getValueByPath(fromObject, ['thought']);
14336
+ if (fromThought != null) {
14337
+ setValueByPath(toObject, ['thought'], fromThought);
14024
14338
  }
14025
- if (getValueByPath(fromObject, ['transparent']) !== undefined) {
14339
+ const fromThoughtSignature = getValueByPath(fromObject, [
14340
+ 'thoughtSignature',
14341
+ ]);
14342
+ if (fromThoughtSignature != null) {
14343
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
14344
+ }
14345
+ const fromVideoMetadata = getValueByPath(fromObject, [
14346
+ 'videoMetadata',
14347
+ ]);
14348
+ if (fromVideoMetadata != null) {
14349
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
14350
+ }
14351
+ return toObject;
14352
+ }
14353
+ function sessionResumptionConfigToMldev(fromObject) {
14354
+ const toObject = {};
14355
+ const fromHandle = getValueByPath(fromObject, ['handle']);
14356
+ if (fromHandle != null) {
14357
+ setValueByPath(toObject, ['handle'], fromHandle);
14358
+ }
14359
+ if (getValueByPath(fromObject, ['transparent']) !== undefined) {
14026
14360
  throw new Error('transparent parameter is not supported in Gemini API.');
14027
14361
  }
14028
14362
  return toObject;
@@ -14044,16 +14378,26 @@ function toolToMldev(fromObject) {
14044
14378
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
14045
14379
  throw new Error('retrieval parameter is not supported in Gemini API.');
14046
14380
  }
14047
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14048
- if (fromGoogleSearch != null) {
14049
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
14050
- }
14051
14381
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
14052
14382
  'googleSearchRetrieval',
14053
14383
  ]);
14054
14384
  if (fromGoogleSearchRetrieval != null) {
14055
14385
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
14056
14386
  }
14387
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
14388
+ if (fromComputerUse != null) {
14389
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
14390
+ }
14391
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
14392
+ if (fromFileSearch != null) {
14393
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
14394
+ }
14395
+ const fromCodeExecution = getValueByPath(fromObject, [
14396
+ 'codeExecution',
14397
+ ]);
14398
+ if (fromCodeExecution != null) {
14399
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
14400
+ }
14057
14401
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
14058
14402
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
14059
14403
  }
@@ -14061,20 +14405,14 @@ function toolToMldev(fromObject) {
14061
14405
  if (fromGoogleMaps != null) {
14062
14406
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
14063
14407
  }
14408
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14409
+ if (fromGoogleSearch != null) {
14410
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
14411
+ }
14064
14412
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
14065
14413
  if (fromUrlContext != null) {
14066
14414
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
14067
14415
  }
14068
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
14069
- if (fromComputerUse != null) {
14070
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
14071
- }
14072
- const fromCodeExecution = getValueByPath(fromObject, [
14073
- 'codeExecution',
14074
- ]);
14075
- if (fromCodeExecution != null) {
14076
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
14077
- }
14078
14416
  return toObject;
14079
14417
  }
14080
14418
 
@@ -14201,139 +14539,883 @@ function convertBidiSetupToTokenSetup(requestDict, config) {
14201
14539
  }
14202
14540
  }
14203
14541
  else {
14204
- // Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
14205
- // defaults apply or all are mutable). This is hit if:
14206
- // - `config.lockAdditionalFields` is undefined.
14207
- // - `config.lockAdditionalFields` is non-empty, BUT
14208
- // `preExistingFieldMask` is null, not a string, or an empty string.
14209
- delete requestDict['fieldMask'];
14542
+ // Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
14543
+ // defaults apply or all are mutable). This is hit if:
14544
+ // - `config.lockAdditionalFields` is undefined.
14545
+ // - `config.lockAdditionalFields` is non-empty, BUT
14546
+ // `preExistingFieldMask` is null, not a string, or an empty string.
14547
+ delete requestDict['fieldMask'];
14548
+ }
14549
+ }
14550
+ else {
14551
+ // No valid `bidiGenerateContentSetup` was found or extracted.
14552
+ // "Lock additional null fields if any".
14553
+ if (preExistingFieldMask !== null &&
14554
+ Array.isArray(preExistingFieldMask) &&
14555
+ preExistingFieldMask.length > 0) {
14556
+ // If there's a pre-existing field mask, it's a string, and it's not
14557
+ // empty, then we should lock all fields.
14558
+ requestDict['fieldMask'] = preExistingFieldMask.join(',');
14559
+ }
14560
+ else {
14561
+ delete requestDict['fieldMask'];
14562
+ }
14563
+ }
14564
+ return requestDict;
14565
+ }
14566
+ class Tokens extends BaseModule {
14567
+ constructor(apiClient) {
14568
+ super();
14569
+ this.apiClient = apiClient;
14570
+ }
14571
+ /**
14572
+ * Creates an ephemeral auth token resource.
14573
+ *
14574
+ * @experimental
14575
+ *
14576
+ * @remarks
14577
+ * Ephemeral auth tokens is only supported in the Gemini Developer API.
14578
+ * It can be used for the session connection to the Live constrained API.
14579
+ * Support in v1alpha only.
14580
+ *
14581
+ * @param params - The parameters for the create request.
14582
+ * @return The created auth token.
14583
+ *
14584
+ * @example
14585
+ * ```ts
14586
+ * const ai = new GoogleGenAI({
14587
+ * apiKey: token.name,
14588
+ * httpOptions: { apiVersion: 'v1alpha' } // Support in v1alpha only.
14589
+ * });
14590
+ *
14591
+ * // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
14592
+ * // when using the token in Live API sessions. Each session connection can
14593
+ * // use a different configuration.
14594
+ * const config: CreateAuthTokenConfig = {
14595
+ * uses: 3,
14596
+ * expireTime: '2025-05-01T00:00:00Z',
14597
+ * }
14598
+ * const token = await ai.tokens.create(config);
14599
+ *
14600
+ * // Case 2: If LiveEphemeralParameters is set, lock all fields in
14601
+ * // LiveConnectConfig when using the token in Live API sessions. For
14602
+ * // example, changing `outputAudioTranscription` in the Live API
14603
+ * // connection will be ignored by the API.
14604
+ * const config: CreateAuthTokenConfig =
14605
+ * uses: 3,
14606
+ * expireTime: '2025-05-01T00:00:00Z',
14607
+ * LiveEphemeralParameters: {
14608
+ * model: 'gemini-2.0-flash-001',
14609
+ * config: {
14610
+ * 'responseModalities': ['AUDIO'],
14611
+ * 'systemInstruction': 'Always answer in English.',
14612
+ * }
14613
+ * }
14614
+ * }
14615
+ * const token = await ai.tokens.create(config);
14616
+ *
14617
+ * // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
14618
+ * // set, lock LiveConnectConfig with set and additional fields (e.g.
14619
+ * // responseModalities, systemInstruction, temperature in this example) when
14620
+ * // using the token in Live API sessions.
14621
+ * const config: CreateAuthTokenConfig =
14622
+ * uses: 3,
14623
+ * expireTime: '2025-05-01T00:00:00Z',
14624
+ * LiveEphemeralParameters: {
14625
+ * model: 'gemini-2.0-flash-001',
14626
+ * config: {
14627
+ * 'responseModalities': ['AUDIO'],
14628
+ * 'systemInstruction': 'Always answer in English.',
14629
+ * }
14630
+ * },
14631
+ * lockAdditionalFields: ['temperature'],
14632
+ * }
14633
+ * const token = await ai.tokens.create(config);
14634
+ *
14635
+ * // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
14636
+ * // empty array, lock LiveConnectConfig with set fields (e.g.
14637
+ * // responseModalities, systemInstruction in this example) when using the
14638
+ * // token in Live API sessions.
14639
+ * const config: CreateAuthTokenConfig =
14640
+ * uses: 3,
14641
+ * expireTime: '2025-05-01T00:00:00Z',
14642
+ * LiveEphemeralParameters: {
14643
+ * model: 'gemini-2.0-flash-001',
14644
+ * config: {
14645
+ * 'responseModalities': ['AUDIO'],
14646
+ * 'systemInstruction': 'Always answer in English.',
14647
+ * }
14648
+ * },
14649
+ * lockAdditionalFields: [],
14650
+ * }
14651
+ * const token = await ai.tokens.create(config);
14652
+ * ```
14653
+ */
14654
+ async create(params) {
14655
+ var _a, _b;
14656
+ let response;
14657
+ let path = '';
14658
+ let queryParams = {};
14659
+ if (this.apiClient.isVertexAI()) {
14660
+ throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
14661
+ }
14662
+ else {
14663
+ const body = createAuthTokenParametersToMldev(this.apiClient, params);
14664
+ path = formatMap('auth_tokens', body['_url']);
14665
+ queryParams = body['_query'];
14666
+ delete body['config'];
14667
+ delete body['_url'];
14668
+ delete body['_query'];
14669
+ const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
14670
+ response = this.apiClient
14671
+ .request({
14672
+ path: path,
14673
+ queryParams: queryParams,
14674
+ body: JSON.stringify(transformedBody),
14675
+ httpMethod: 'POST',
14676
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
14677
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
14678
+ })
14679
+ .then((httpResponse) => {
14680
+ return httpResponse.json();
14681
+ });
14682
+ return response.then((resp) => {
14683
+ return resp;
14684
+ });
14685
+ }
14686
+ }
14687
+ }
14688
+
14689
+ /**
14690
+ * @license
14691
+ * Copyright 2025 Google LLC
14692
+ * SPDX-License-Identifier: Apache-2.0
14693
+ */
14694
+ // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14695
+ function createFileSearchStoreConfigToMldev(fromObject, parentObject) {
14696
+ const toObject = {};
14697
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14698
+ if (parentObject !== undefined && fromDisplayName != null) {
14699
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
14700
+ }
14701
+ return toObject;
14702
+ }
14703
+ function createFileSearchStoreParametersToMldev(fromObject) {
14704
+ const toObject = {};
14705
+ const fromConfig = getValueByPath(fromObject, ['config']);
14706
+ if (fromConfig != null) {
14707
+ createFileSearchStoreConfigToMldev(fromConfig, toObject);
14708
+ }
14709
+ return toObject;
14710
+ }
14711
+ function deleteFileSearchStoreConfigToMldev(fromObject, parentObject) {
14712
+ const toObject = {};
14713
+ const fromForce = getValueByPath(fromObject, ['force']);
14714
+ if (parentObject !== undefined && fromForce != null) {
14715
+ setValueByPath(parentObject, ['_query', 'force'], fromForce);
14716
+ }
14717
+ return toObject;
14718
+ }
14719
+ function deleteFileSearchStoreParametersToMldev(fromObject) {
14720
+ const toObject = {};
14721
+ const fromName = getValueByPath(fromObject, ['name']);
14722
+ if (fromName != null) {
14723
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14724
+ }
14725
+ const fromConfig = getValueByPath(fromObject, ['config']);
14726
+ if (fromConfig != null) {
14727
+ deleteFileSearchStoreConfigToMldev(fromConfig, toObject);
14728
+ }
14729
+ return toObject;
14730
+ }
14731
+ function getFileSearchStoreParametersToMldev(fromObject) {
14732
+ const toObject = {};
14733
+ const fromName = getValueByPath(fromObject, ['name']);
14734
+ if (fromName != null) {
14735
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14736
+ }
14737
+ return toObject;
14738
+ }
14739
+ function importFileConfigToMldev(fromObject, parentObject) {
14740
+ const toObject = {};
14741
+ const fromCustomMetadata = getValueByPath(fromObject, [
14742
+ 'customMetadata',
14743
+ ]);
14744
+ if (parentObject !== undefined && fromCustomMetadata != null) {
14745
+ let transformedList = fromCustomMetadata;
14746
+ if (Array.isArray(transformedList)) {
14747
+ transformedList = transformedList.map((item) => {
14748
+ return item;
14749
+ });
14750
+ }
14751
+ setValueByPath(parentObject, ['customMetadata'], transformedList);
14752
+ }
14753
+ const fromChunkingConfig = getValueByPath(fromObject, [
14754
+ 'chunkingConfig',
14755
+ ]);
14756
+ if (parentObject !== undefined && fromChunkingConfig != null) {
14757
+ setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
14758
+ }
14759
+ return toObject;
14760
+ }
14761
+ function importFileOperationFromMldev(fromObject) {
14762
+ const toObject = {};
14763
+ const fromName = getValueByPath(fromObject, ['name']);
14764
+ if (fromName != null) {
14765
+ setValueByPath(toObject, ['name'], fromName);
14766
+ }
14767
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
14768
+ if (fromMetadata != null) {
14769
+ setValueByPath(toObject, ['metadata'], fromMetadata);
14770
+ }
14771
+ const fromDone = getValueByPath(fromObject, ['done']);
14772
+ if (fromDone != null) {
14773
+ setValueByPath(toObject, ['done'], fromDone);
14774
+ }
14775
+ const fromError = getValueByPath(fromObject, ['error']);
14776
+ if (fromError != null) {
14777
+ setValueByPath(toObject, ['error'], fromError);
14778
+ }
14779
+ const fromResponse = getValueByPath(fromObject, ['response']);
14780
+ if (fromResponse != null) {
14781
+ setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
14782
+ }
14783
+ return toObject;
14784
+ }
14785
+ function importFileParametersToMldev(fromObject) {
14786
+ const toObject = {};
14787
+ const fromFileSearchStoreName = getValueByPath(fromObject, [
14788
+ 'fileSearchStoreName',
14789
+ ]);
14790
+ if (fromFileSearchStoreName != null) {
14791
+ setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
14792
+ }
14793
+ const fromFileName = getValueByPath(fromObject, ['fileName']);
14794
+ if (fromFileName != null) {
14795
+ setValueByPath(toObject, ['fileName'], fromFileName);
14796
+ }
14797
+ const fromConfig = getValueByPath(fromObject, ['config']);
14798
+ if (fromConfig != null) {
14799
+ importFileConfigToMldev(fromConfig, toObject);
14800
+ }
14801
+ return toObject;
14802
+ }
14803
+ function importFileResponseFromMldev(fromObject) {
14804
+ const toObject = {};
14805
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14806
+ 'sdkHttpResponse',
14807
+ ]);
14808
+ if (fromSdkHttpResponse != null) {
14809
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14810
+ }
14811
+ const fromParent = getValueByPath(fromObject, ['parent']);
14812
+ if (fromParent != null) {
14813
+ setValueByPath(toObject, ['parent'], fromParent);
14814
+ }
14815
+ const fromDocumentName = getValueByPath(fromObject, ['documentName']);
14816
+ if (fromDocumentName != null) {
14817
+ setValueByPath(toObject, ['documentName'], fromDocumentName);
14818
+ }
14819
+ return toObject;
14820
+ }
14821
+ function listFileSearchStoresConfigToMldev(fromObject, parentObject) {
14822
+ const toObject = {};
14823
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14824
+ if (parentObject !== undefined && fromPageSize != null) {
14825
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
14826
+ }
14827
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
14828
+ if (parentObject !== undefined && fromPageToken != null) {
14829
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
14830
+ }
14831
+ return toObject;
14832
+ }
14833
+ function listFileSearchStoresParametersToMldev(fromObject) {
14834
+ const toObject = {};
14835
+ const fromConfig = getValueByPath(fromObject, ['config']);
14836
+ if (fromConfig != null) {
14837
+ listFileSearchStoresConfigToMldev(fromConfig, toObject);
14838
+ }
14839
+ return toObject;
14840
+ }
14841
+ function listFileSearchStoresResponseFromMldev(fromObject) {
14842
+ const toObject = {};
14843
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14844
+ 'sdkHttpResponse',
14845
+ ]);
14846
+ if (fromSdkHttpResponse != null) {
14847
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14848
+ }
14849
+ const fromNextPageToken = getValueByPath(fromObject, [
14850
+ 'nextPageToken',
14851
+ ]);
14852
+ if (fromNextPageToken != null) {
14853
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
14854
+ }
14855
+ const fromFileSearchStores = getValueByPath(fromObject, [
14856
+ 'fileSearchStores',
14857
+ ]);
14858
+ if (fromFileSearchStores != null) {
14859
+ let transformedList = fromFileSearchStores;
14860
+ if (Array.isArray(transformedList)) {
14861
+ transformedList = transformedList.map((item) => {
14862
+ return item;
14863
+ });
14864
+ }
14865
+ setValueByPath(toObject, ['fileSearchStores'], transformedList);
14866
+ }
14867
+ return toObject;
14868
+ }
14869
+ function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
14870
+ const toObject = {};
14871
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
14872
+ if (parentObject !== undefined && fromMimeType != null) {
14873
+ setValueByPath(parentObject, ['mimeType'], fromMimeType);
14874
+ }
14875
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14876
+ if (parentObject !== undefined && fromDisplayName != null) {
14877
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
14878
+ }
14879
+ const fromCustomMetadata = getValueByPath(fromObject, [
14880
+ 'customMetadata',
14881
+ ]);
14882
+ if (parentObject !== undefined && fromCustomMetadata != null) {
14883
+ let transformedList = fromCustomMetadata;
14884
+ if (Array.isArray(transformedList)) {
14885
+ transformedList = transformedList.map((item) => {
14886
+ return item;
14887
+ });
14888
+ }
14889
+ setValueByPath(parentObject, ['customMetadata'], transformedList);
14890
+ }
14891
+ const fromChunkingConfig = getValueByPath(fromObject, [
14892
+ 'chunkingConfig',
14893
+ ]);
14894
+ if (parentObject !== undefined && fromChunkingConfig != null) {
14895
+ setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
14896
+ }
14897
+ return toObject;
14898
+ }
14899
+ function uploadToFileSearchStoreParametersToMldev(fromObject) {
14900
+ const toObject = {};
14901
+ const fromFileSearchStoreName = getValueByPath(fromObject, [
14902
+ 'fileSearchStoreName',
14903
+ ]);
14904
+ if (fromFileSearchStoreName != null) {
14905
+ setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
14906
+ }
14907
+ const fromConfig = getValueByPath(fromObject, ['config']);
14908
+ if (fromConfig != null) {
14909
+ uploadToFileSearchStoreConfigToMldev(fromConfig, toObject);
14910
+ }
14911
+ return toObject;
14912
+ }
14913
+ function uploadToFileSearchStoreResumableResponseFromMldev(fromObject) {
14914
+ const toObject = {};
14915
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14916
+ 'sdkHttpResponse',
14917
+ ]);
14918
+ if (fromSdkHttpResponse != null) {
14919
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14920
+ }
14921
+ return toObject;
14922
+ }
14923
+
14924
+ /**
14925
+ * @license
14926
+ * Copyright 2025 Google LLC
14927
+ * SPDX-License-Identifier: Apache-2.0
14928
+ */
14929
+ // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14930
+ function deleteDocumentConfigToMldev(fromObject, parentObject) {
14931
+ const toObject = {};
14932
+ const fromForce = getValueByPath(fromObject, ['force']);
14933
+ if (parentObject !== undefined && fromForce != null) {
14934
+ setValueByPath(parentObject, ['_query', 'force'], fromForce);
14935
+ }
14936
+ return toObject;
14937
+ }
14938
+ function deleteDocumentParametersToMldev(fromObject) {
14939
+ const toObject = {};
14940
+ const fromName = getValueByPath(fromObject, ['name']);
14941
+ if (fromName != null) {
14942
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14943
+ }
14944
+ const fromConfig = getValueByPath(fromObject, ['config']);
14945
+ if (fromConfig != null) {
14946
+ deleteDocumentConfigToMldev(fromConfig, toObject);
14947
+ }
14948
+ return toObject;
14949
+ }
14950
+ function getDocumentParametersToMldev(fromObject) {
14951
+ const toObject = {};
14952
+ const fromName = getValueByPath(fromObject, ['name']);
14953
+ if (fromName != null) {
14954
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14955
+ }
14956
+ return toObject;
14957
+ }
14958
+ function listDocumentsConfigToMldev(fromObject, parentObject) {
14959
+ const toObject = {};
14960
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14961
+ if (parentObject !== undefined && fromPageSize != null) {
14962
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
14963
+ }
14964
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
14965
+ if (parentObject !== undefined && fromPageToken != null) {
14966
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
14967
+ }
14968
+ return toObject;
14969
+ }
14970
+ function listDocumentsParametersToMldev(fromObject) {
14971
+ const toObject = {};
14972
+ const fromParent = getValueByPath(fromObject, ['parent']);
14973
+ if (fromParent != null) {
14974
+ setValueByPath(toObject, ['_url', 'parent'], fromParent);
14975
+ }
14976
+ const fromConfig = getValueByPath(fromObject, ['config']);
14977
+ if (fromConfig != null) {
14978
+ listDocumentsConfigToMldev(fromConfig, toObject);
14979
+ }
14980
+ return toObject;
14981
+ }
14982
+ function listDocumentsResponseFromMldev(fromObject) {
14983
+ const toObject = {};
14984
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14985
+ 'sdkHttpResponse',
14986
+ ]);
14987
+ if (fromSdkHttpResponse != null) {
14988
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14989
+ }
14990
+ const fromNextPageToken = getValueByPath(fromObject, [
14991
+ 'nextPageToken',
14992
+ ]);
14993
+ if (fromNextPageToken != null) {
14994
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
14995
+ }
14996
+ const fromDocuments = getValueByPath(fromObject, ['documents']);
14997
+ if (fromDocuments != null) {
14998
+ let transformedList = fromDocuments;
14999
+ if (Array.isArray(transformedList)) {
15000
+ transformedList = transformedList.map((item) => {
15001
+ return item;
15002
+ });
15003
+ }
15004
+ setValueByPath(toObject, ['documents'], transformedList);
15005
+ }
15006
+ return toObject;
15007
+ }
15008
+
15009
+ /**
15010
+ * @license
15011
+ * Copyright 2025 Google LLC
15012
+ * SPDX-License-Identifier: Apache-2.0
15013
+ */
15014
+ class Documents extends BaseModule {
15015
+ constructor(apiClient) {
15016
+ super();
15017
+ this.apiClient = apiClient;
15018
+ /**
15019
+ * Lists documents.
15020
+ *
15021
+ * @param params - The parameters for the list request.
15022
+ * @return - A pager of documents.
15023
+ *
15024
+ * @example
15025
+ * ```ts
15026
+ * const documents = await ai.documents.list({config: {'pageSize': 2}});
15027
+ * for await (const document of documents) {
15028
+ * console.log(document);
15029
+ * }
15030
+ * ```
15031
+ */
15032
+ this.list = async (params) => {
15033
+ return new Pager(PagedItem.PAGED_ITEM_DOCUMENTS, (x) => this.listInternal({
15034
+ parent: params.parent,
15035
+ config: x.config,
15036
+ }), await this.listInternal(params), params);
15037
+ };
15038
+ }
15039
+ /**
15040
+ * Gets a Document.
15041
+ *
15042
+ * @param params - The parameters for getting a document.
15043
+ * @return Document.
15044
+ */
15045
+ async get(params) {
15046
+ var _a, _b;
15047
+ let response;
15048
+ let path = '';
15049
+ let queryParams = {};
15050
+ if (this.apiClient.isVertexAI()) {
15051
+ throw new Error('This method is only supported by the Gemini Developer API.');
15052
+ }
15053
+ else {
15054
+ const body = getDocumentParametersToMldev(params);
15055
+ path = formatMap('{name}', body['_url']);
15056
+ queryParams = body['_query'];
15057
+ delete body['_url'];
15058
+ delete body['_query'];
15059
+ response = this.apiClient
15060
+ .request({
15061
+ path: path,
15062
+ queryParams: queryParams,
15063
+ body: JSON.stringify(body),
15064
+ httpMethod: 'GET',
15065
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15066
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15067
+ })
15068
+ .then((httpResponse) => {
15069
+ return httpResponse.json();
15070
+ });
15071
+ return response.then((resp) => {
15072
+ return resp;
15073
+ });
15074
+ }
15075
+ }
15076
+ /**
15077
+ * Deletes a Document.
15078
+ *
15079
+ * @param params - The parameters for deleting a document.
15080
+ */
15081
+ async delete(params) {
15082
+ var _a, _b;
15083
+ let path = '';
15084
+ let queryParams = {};
15085
+ if (this.apiClient.isVertexAI()) {
15086
+ throw new Error('This method is only supported by the Gemini Developer API.');
15087
+ }
15088
+ else {
15089
+ const body = deleteDocumentParametersToMldev(params);
15090
+ path = formatMap('{name}', body['_url']);
15091
+ queryParams = body['_query'];
15092
+ delete body['_url'];
15093
+ delete body['_query'];
15094
+ await this.apiClient.request({
15095
+ path: path,
15096
+ queryParams: queryParams,
15097
+ body: JSON.stringify(body),
15098
+ httpMethod: 'DELETE',
15099
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15100
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15101
+ });
15102
+ }
15103
+ }
15104
+ /**
15105
+ * Lists all Documents in a FileSearchStore.
15106
+ *
15107
+ * @param params - The parameters for listing documents.
15108
+ * @return ListDocumentsResponse.
15109
+ */
15110
+ async listInternal(params) {
15111
+ var _a, _b;
15112
+ let response;
15113
+ let path = '';
15114
+ let queryParams = {};
15115
+ if (this.apiClient.isVertexAI()) {
15116
+ throw new Error('This method is only supported by the Gemini Developer API.');
15117
+ }
15118
+ else {
15119
+ const body = listDocumentsParametersToMldev(params);
15120
+ path = formatMap('{parent}/documents', body['_url']);
15121
+ queryParams = body['_query'];
15122
+ delete body['_url'];
15123
+ delete body['_query'];
15124
+ response = this.apiClient
15125
+ .request({
15126
+ path: path,
15127
+ queryParams: queryParams,
15128
+ body: JSON.stringify(body),
15129
+ httpMethod: 'GET',
15130
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15131
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15132
+ })
15133
+ .then((httpResponse) => {
15134
+ return httpResponse.json();
15135
+ });
15136
+ return response.then((apiResponse) => {
15137
+ const resp = listDocumentsResponseFromMldev(apiResponse);
15138
+ const typedResp = new ListDocumentsResponse();
15139
+ Object.assign(typedResp, resp);
15140
+ return typedResp;
15141
+ });
15142
+ }
15143
+ }
15144
+ }
15145
+
15146
+ /**
15147
+ * @license
15148
+ * Copyright 2025 Google LLC
15149
+ * SPDX-License-Identifier: Apache-2.0
15150
+ */
15151
+ class FileSearchStores extends BaseModule {
15152
+ constructor(apiClient, documents = new Documents(apiClient)) {
15153
+ super();
15154
+ this.apiClient = apiClient;
15155
+ this.documents = documents;
15156
+ /**
15157
+ * Lists file search stores.
15158
+ *
15159
+ * @param params - The parameters for the list request.
15160
+ * @return - A pager of file search stores.
15161
+ *
15162
+ * @example
15163
+ * ```ts
15164
+ * const fileSearchStores = await ai.fileSearchStores.list({config: {'pageSize': 2}});
15165
+ * for await (const fileSearchStore of fileSearchStores) {
15166
+ * console.log(fileSearchStore);
15167
+ * }
15168
+ * ```
15169
+ */
15170
+ this.list = async (params = {}) => {
15171
+ return new Pager(PagedItem.PAGED_ITEM_FILE_SEARCH_STORES, (x) => this.listInternal(x), await this.listInternal(params), params);
15172
+ };
15173
+ }
15174
+ /**
15175
+ * Uploads a file asynchronously to a given File Search Store.
15176
+ * This method is not available in Vertex AI.
15177
+ * Supported upload sources:
15178
+ * - Node.js: File path (string) or Blob object.
15179
+ * - Browser: Blob object (e.g., File).
15180
+ *
15181
+ * @remarks
15182
+ * The `mimeType` can be specified in the `config` parameter. If omitted:
15183
+ * - For file path (string) inputs, the `mimeType` will be inferred from the
15184
+ * file extension.
15185
+ * - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
15186
+ * property.
15187
+ *
15188
+ * This section can contain multiple paragraphs and code examples.
15189
+ *
15190
+ * @param params - Optional parameters specified in the
15191
+ * `types.UploadToFileSearchStoreParameters` interface.
15192
+ * @see {@link types.UploadToFileSearchStoreParameters#config} for the optional
15193
+ * config in the parameters.
15194
+ * @return A promise that resolves to a long running operation.
15195
+ * @throws An error if called on a Vertex AI client.
15196
+ * @throws An error if the `mimeType` is not provided and can not be inferred,
15197
+ * the `mimeType` can be provided in the `params.config` parameter.
15198
+ * @throws An error occurs if a suitable upload location cannot be established.
15199
+ *
15200
+ * @example
15201
+ * The following code uploads a file to a given file search store.
15202
+ *
15203
+ * ```ts
15204
+ * const operation = await ai.fileSearchStores.upload({fileSearchStoreName: 'fileSearchStores/foo-bar', file: 'file.txt', config: {
15205
+ * mimeType: 'text/plain',
15206
+ * }});
15207
+ * console.log(operation.name);
15208
+ * ```
15209
+ */
15210
+ async uploadToFileSearchStore(params) {
15211
+ if (this.apiClient.isVertexAI()) {
15212
+ throw new Error('Vertex AI does not support uploading files to a file search store.');
15213
+ }
15214
+ return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName, params.file, params.config);
15215
+ }
15216
+ /**
15217
+ * Creates a File Search Store.
15218
+ *
15219
+ * @param params - The parameters for creating a File Search Store.
15220
+ * @return FileSearchStore.
15221
+ */
15222
+ async create(params) {
15223
+ var _a, _b;
15224
+ let response;
15225
+ let path = '';
15226
+ let queryParams = {};
15227
+ if (this.apiClient.isVertexAI()) {
15228
+ throw new Error('This method is only supported by the Gemini Developer API.');
15229
+ }
15230
+ else {
15231
+ const body = createFileSearchStoreParametersToMldev(params);
15232
+ path = formatMap('fileSearchStores', body['_url']);
15233
+ queryParams = body['_query'];
15234
+ delete body['_url'];
15235
+ delete body['_query'];
15236
+ response = this.apiClient
15237
+ .request({
15238
+ path: path,
15239
+ queryParams: queryParams,
15240
+ body: JSON.stringify(body),
15241
+ httpMethod: 'POST',
15242
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15243
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15244
+ })
15245
+ .then((httpResponse) => {
15246
+ return httpResponse.json();
15247
+ });
15248
+ return response.then((resp) => {
15249
+ return resp;
15250
+ });
15251
+ }
15252
+ }
15253
+ /**
15254
+ * Gets a File Search Store.
15255
+ *
15256
+ * @param params - The parameters for getting a File Search Store.
15257
+ * @return FileSearchStore.
15258
+ */
15259
+ async get(params) {
15260
+ var _a, _b;
15261
+ let response;
15262
+ let path = '';
15263
+ let queryParams = {};
15264
+ if (this.apiClient.isVertexAI()) {
15265
+ throw new Error('This method is only supported by the Gemini Developer API.');
15266
+ }
15267
+ else {
15268
+ const body = getFileSearchStoreParametersToMldev(params);
15269
+ path = formatMap('{name}', body['_url']);
15270
+ queryParams = body['_query'];
15271
+ delete body['_url'];
15272
+ delete body['_query'];
15273
+ response = this.apiClient
15274
+ .request({
15275
+ path: path,
15276
+ queryParams: queryParams,
15277
+ body: JSON.stringify(body),
15278
+ httpMethod: 'GET',
15279
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15280
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15281
+ })
15282
+ .then((httpResponse) => {
15283
+ return httpResponse.json();
15284
+ });
15285
+ return response.then((resp) => {
15286
+ return resp;
15287
+ });
15288
+ }
15289
+ }
15290
+ /**
15291
+ * Deletes a File Search Store.
15292
+ *
15293
+ * @param params - The parameters for deleting a File Search Store.
15294
+ */
15295
+ async delete(params) {
15296
+ var _a, _b;
15297
+ let path = '';
15298
+ let queryParams = {};
15299
+ if (this.apiClient.isVertexAI()) {
15300
+ throw new Error('This method is only supported by the Gemini Developer API.');
15301
+ }
15302
+ else {
15303
+ const body = deleteFileSearchStoreParametersToMldev(params);
15304
+ path = formatMap('{name}', body['_url']);
15305
+ queryParams = body['_query'];
15306
+ delete body['_url'];
15307
+ delete body['_query'];
15308
+ await this.apiClient.request({
15309
+ path: path,
15310
+ queryParams: queryParams,
15311
+ body: JSON.stringify(body),
15312
+ httpMethod: 'DELETE',
15313
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15314
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15315
+ });
15316
+ }
15317
+ }
15318
+ /**
15319
+ * Lists all FileSearchStore owned by the user.
15320
+ *
15321
+ * @param params - The parameters for listing file search stores.
15322
+ * @return ListFileSearchStoresResponse.
15323
+ */
15324
+ async listInternal(params) {
15325
+ var _a, _b;
15326
+ let response;
15327
+ let path = '';
15328
+ let queryParams = {};
15329
+ if (this.apiClient.isVertexAI()) {
15330
+ throw new Error('This method is only supported by the Gemini Developer API.');
15331
+ }
15332
+ else {
15333
+ const body = listFileSearchStoresParametersToMldev(params);
15334
+ path = formatMap('fileSearchStores', body['_url']);
15335
+ queryParams = body['_query'];
15336
+ delete body['_url'];
15337
+ delete body['_query'];
15338
+ response = this.apiClient
15339
+ .request({
15340
+ path: path,
15341
+ queryParams: queryParams,
15342
+ body: JSON.stringify(body),
15343
+ httpMethod: 'GET',
15344
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15345
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15346
+ })
15347
+ .then((httpResponse) => {
15348
+ return httpResponse.json();
15349
+ });
15350
+ return response.then((apiResponse) => {
15351
+ const resp = listFileSearchStoresResponseFromMldev(apiResponse);
15352
+ const typedResp = new ListFileSearchStoresResponse();
15353
+ Object.assign(typedResp, resp);
15354
+ return typedResp;
15355
+ });
14210
15356
  }
14211
15357
  }
14212
- else {
14213
- // No valid `bidiGenerateContentSetup` was found or extracted.
14214
- // "Lock additional null fields if any".
14215
- if (preExistingFieldMask !== null &&
14216
- Array.isArray(preExistingFieldMask) &&
14217
- preExistingFieldMask.length > 0) {
14218
- // If there's a pre-existing field mask, it's a string, and it's not
14219
- // empty, then we should lock all fields.
14220
- requestDict['fieldMask'] = preExistingFieldMask.join(',');
15358
+ async uploadToFileSearchStoreInternal(params) {
15359
+ var _a, _b;
15360
+ let response;
15361
+ let path = '';
15362
+ let queryParams = {};
15363
+ if (this.apiClient.isVertexAI()) {
15364
+ throw new Error('This method is only supported by the Gemini Developer API.');
14221
15365
  }
14222
15366
  else {
14223
- delete requestDict['fieldMask'];
15367
+ const body = uploadToFileSearchStoreParametersToMldev(params);
15368
+ path = formatMap('upload/v1beta/{file_search_store_name}:uploadToFileSearchStore', body['_url']);
15369
+ queryParams = body['_query'];
15370
+ delete body['_url'];
15371
+ delete body['_query'];
15372
+ response = this.apiClient
15373
+ .request({
15374
+ path: path,
15375
+ queryParams: queryParams,
15376
+ body: JSON.stringify(body),
15377
+ httpMethod: 'POST',
15378
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15379
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15380
+ })
15381
+ .then((httpResponse) => {
15382
+ return httpResponse.json();
15383
+ });
15384
+ return response.then((apiResponse) => {
15385
+ const resp = uploadToFileSearchStoreResumableResponseFromMldev(apiResponse);
15386
+ const typedResp = new UploadToFileSearchStoreResumableResponse();
15387
+ Object.assign(typedResp, resp);
15388
+ return typedResp;
15389
+ });
14224
15390
  }
14225
15391
  }
14226
- return requestDict;
14227
- }
14228
- class Tokens extends BaseModule {
14229
- constructor(apiClient) {
14230
- super();
14231
- this.apiClient = apiClient;
14232
- }
14233
15392
  /**
14234
- * Creates an ephemeral auth token resource.
14235
- *
14236
- * @experimental
14237
- *
14238
- * @remarks
14239
- * Ephemeral auth tokens is only supported in the Gemini Developer API.
14240
- * It can be used for the session connection to the Live constrained API.
14241
- * Support in v1alpha only.
14242
- *
14243
- * @param params - The parameters for the create request.
14244
- * @return The created auth token.
14245
- *
14246
- * @example
14247
- * ```ts
14248
- * const ai = new GoogleGenAI({
14249
- * apiKey: token.name,
14250
- * httpOptions: { apiVersion: 'v1alpha' } // Support in v1alpha only.
14251
- * });
14252
- *
14253
- * // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
14254
- * // when using the token in Live API sessions. Each session connection can
14255
- * // use a different configuration.
14256
- * const config: CreateAuthTokenConfig = {
14257
- * uses: 3,
14258
- * expireTime: '2025-05-01T00:00:00Z',
14259
- * }
14260
- * const token = await ai.tokens.create(config);
14261
- *
14262
- * // Case 2: If LiveEphemeralParameters is set, lock all fields in
14263
- * // LiveConnectConfig when using the token in Live API sessions. For
14264
- * // example, changing `outputAudioTranscription` in the Live API
14265
- * // connection will be ignored by the API.
14266
- * const config: CreateAuthTokenConfig =
14267
- * uses: 3,
14268
- * expireTime: '2025-05-01T00:00:00Z',
14269
- * LiveEphemeralParameters: {
14270
- * model: 'gemini-2.0-flash-001',
14271
- * config: {
14272
- * 'responseModalities': ['AUDIO'],
14273
- * 'systemInstruction': 'Always answer in English.',
14274
- * }
14275
- * }
14276
- * }
14277
- * const token = await ai.tokens.create(config);
15393
+ * Imports a File from File Service to a FileSearchStore.
14278
15394
  *
14279
- * // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
14280
- * // set, lock LiveConnectConfig with set and additional fields (e.g.
14281
- * // responseModalities, systemInstruction, temperature in this example) when
14282
- * // using the token in Live API sessions.
14283
- * const config: CreateAuthTokenConfig =
14284
- * uses: 3,
14285
- * expireTime: '2025-05-01T00:00:00Z',
14286
- * LiveEphemeralParameters: {
14287
- * model: 'gemini-2.0-flash-001',
14288
- * config: {
14289
- * 'responseModalities': ['AUDIO'],
14290
- * 'systemInstruction': 'Always answer in English.',
14291
- * }
14292
- * },
14293
- * lockAdditionalFields: ['temperature'],
14294
- * }
14295
- * const token = await ai.tokens.create(config);
15395
+ * This is a long-running operation, see aip.dev/151
14296
15396
  *
14297
- * // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
14298
- * // empty array, lock LiveConnectConfig with set fields (e.g.
14299
- * // responseModalities, systemInstruction in this example) when using the
14300
- * // token in Live API sessions.
14301
- * const config: CreateAuthTokenConfig =
14302
- * uses: 3,
14303
- * expireTime: '2025-05-01T00:00:00Z',
14304
- * LiveEphemeralParameters: {
14305
- * model: 'gemini-2.0-flash-001',
14306
- * config: {
14307
- * 'responseModalities': ['AUDIO'],
14308
- * 'systemInstruction': 'Always answer in English.',
14309
- * }
14310
- * },
14311
- * lockAdditionalFields: [],
14312
- * }
14313
- * const token = await ai.tokens.create(config);
14314
- * ```
15397
+ * @param params - The parameters for importing a file to a file search store.
15398
+ * @return ImportFileOperation.
14315
15399
  */
14316
- async create(params) {
15400
+ async importFile(params) {
14317
15401
  var _a, _b;
14318
15402
  let response;
14319
15403
  let path = '';
14320
15404
  let queryParams = {};
14321
15405
  if (this.apiClient.isVertexAI()) {
14322
- throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
15406
+ throw new Error('This method is only supported by the Gemini Developer API.');
14323
15407
  }
14324
15408
  else {
14325
- const body = createAuthTokenParametersToMldev(this.apiClient, params);
14326
- path = formatMap('auth_tokens', body['_url']);
15409
+ const body = importFileParametersToMldev(params);
15410
+ path = formatMap('{file_search_store_name}:importFile', body['_url']);
14327
15411
  queryParams = body['_query'];
14328
- delete body['config'];
14329
15412
  delete body['_url'];
14330
15413
  delete body['_query'];
14331
- const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
14332
15414
  response = this.apiClient
14333
15415
  .request({
14334
15416
  path: path,
14335
15417
  queryParams: queryParams,
14336
- body: JSON.stringify(transformedBody),
15418
+ body: JSON.stringify(body),
14337
15419
  httpMethod: 'POST',
14338
15420
  httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
14339
15421
  abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
@@ -14341,8 +15423,11 @@ class Tokens extends BaseModule {
14341
15423
  .then((httpResponse) => {
14342
15424
  return httpResponse.json();
14343
15425
  });
14344
- return response.then((resp) => {
14345
- return resp;
15426
+ return response.then((apiResponse) => {
15427
+ const resp = importFileOperationFromMldev(apiResponse);
15428
+ const typedResp = new ImportFileOperation();
15429
+ Object.assign(typedResp, resp);
15430
+ return typedResp;
14346
15431
  });
14347
15432
  }
14348
15433
  }
@@ -14436,14 +15521,19 @@ class NodeDownloader {
14436
15521
  const response = await downloadFile(params, apiClient);
14437
15522
  if (response instanceof HttpResponse) {
14438
15523
  const writer = createWriteStream(params.downloadPath);
14439
- Readable.fromWeb(response.responseInternal.body).pipe(writer);
15524
+ const body = Readable.fromWeb(response.responseInternal.body);
15525
+ body.pipe(writer);
15526
+ await finished(writer);
14440
15527
  }
14441
15528
  else {
14442
- writeFile(params.downloadPath, response, { encoding: 'base64' }, (error) => {
14443
- if (error) {
14444
- throw new Error(`Failed to write file to ${params.downloadPath}: ${error}`);
14445
- }
14446
- });
15529
+ try {
15530
+ await writeFile(params.downloadPath, response, {
15531
+ encoding: 'base64',
15532
+ });
15533
+ }
15534
+ catch (error) {
15535
+ throw new Error(`Failed to write file to ${params.downloadPath}: ${error}`);
15536
+ }
14447
15537
  }
14448
15538
  }
14449
15539
  }
@@ -14590,15 +15680,35 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
14590
15680
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
14591
15681
  throw new Error('labels parameter is not supported in Gemini API.');
14592
15682
  }
15683
+ if (getValueByPath(fromObject, ['beta']) !== undefined) {
15684
+ throw new Error('beta parameter is not supported in Gemini API.');
15685
+ }
14593
15686
  return toObject;
14594
15687
  }
14595
15688
  function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14596
15689
  const toObject = {};
14597
- const fromValidationDataset = getValueByPath(fromObject, [
14598
- 'validationDataset',
15690
+ let discriminatorValidationDataset = getValueByPath(rootObject, [
15691
+ 'config',
15692
+ 'method',
14599
15693
  ]);
14600
- if (parentObject !== undefined && fromValidationDataset != null) {
14601
- setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
15694
+ if (discriminatorValidationDataset === undefined) {
15695
+ discriminatorValidationDataset = 'SUPERVISED_FINE_TUNING';
15696
+ }
15697
+ if (discriminatorValidationDataset === 'SUPERVISED_FINE_TUNING') {
15698
+ const fromValidationDataset = getValueByPath(fromObject, [
15699
+ 'validationDataset',
15700
+ ]);
15701
+ if (parentObject !== undefined && fromValidationDataset != null) {
15702
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
15703
+ }
15704
+ }
15705
+ else if (discriminatorValidationDataset === 'PREFERENCE_TUNING') {
15706
+ const fromValidationDataset = getValueByPath(fromObject, [
15707
+ 'validationDataset',
15708
+ ]);
15709
+ if (parentObject !== undefined && fromValidationDataset != null) {
15710
+ setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
15711
+ }
14602
15712
  }
14603
15713
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
14604
15714
  'tunedModelDisplayName',
@@ -14610,25 +15720,90 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14610
15720
  if (parentObject !== undefined && fromDescription != null) {
14611
15721
  setValueByPath(parentObject, ['description'], fromDescription);
14612
15722
  }
14613
- const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14614
- if (parentObject !== undefined && fromEpochCount != null) {
14615
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
15723
+ let discriminatorEpochCount = getValueByPath(rootObject, [
15724
+ 'config',
15725
+ 'method',
15726
+ ]);
15727
+ if (discriminatorEpochCount === undefined) {
15728
+ discriminatorEpochCount = 'SUPERVISED_FINE_TUNING';
14616
15729
  }
14617
- const fromLearningRateMultiplier = getValueByPath(fromObject, [
14618
- 'learningRateMultiplier',
15730
+ if (discriminatorEpochCount === 'SUPERVISED_FINE_TUNING') {
15731
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
15732
+ if (parentObject !== undefined && fromEpochCount != null) {
15733
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
15734
+ }
15735
+ }
15736
+ else if (discriminatorEpochCount === 'PREFERENCE_TUNING') {
15737
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
15738
+ if (parentObject !== undefined && fromEpochCount != null) {
15739
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
15740
+ }
15741
+ }
15742
+ let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
15743
+ 'config',
15744
+ 'method',
14619
15745
  ]);
14620
- if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14621
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
15746
+ if (discriminatorLearningRateMultiplier === undefined) {
15747
+ discriminatorLearningRateMultiplier = 'SUPERVISED_FINE_TUNING';
15748
+ }
15749
+ if (discriminatorLearningRateMultiplier === 'SUPERVISED_FINE_TUNING') {
15750
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
15751
+ 'learningRateMultiplier',
15752
+ ]);
15753
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
15754
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
15755
+ }
15756
+ }
15757
+ else if (discriminatorLearningRateMultiplier === 'PREFERENCE_TUNING') {
15758
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
15759
+ 'learningRateMultiplier',
15760
+ ]);
15761
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
15762
+ setValueByPath(parentObject, [
15763
+ 'preferenceOptimizationSpec',
15764
+ 'hyperParameters',
15765
+ 'learningRateMultiplier',
15766
+ ], fromLearningRateMultiplier);
15767
+ }
14622
15768
  }
14623
- const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
14624
- 'exportLastCheckpointOnly',
15769
+ let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
15770
+ if (discriminatorExportLastCheckpointOnly === undefined) {
15771
+ discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
15772
+ }
15773
+ if (discriminatorExportLastCheckpointOnly === 'SUPERVISED_FINE_TUNING') {
15774
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
15775
+ 'exportLastCheckpointOnly',
15776
+ ]);
15777
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
15778
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
15779
+ }
15780
+ }
15781
+ else if (discriminatorExportLastCheckpointOnly === 'PREFERENCE_TUNING') {
15782
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
15783
+ 'exportLastCheckpointOnly',
15784
+ ]);
15785
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
15786
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
15787
+ }
15788
+ }
15789
+ let discriminatorAdapterSize = getValueByPath(rootObject, [
15790
+ 'config',
15791
+ 'method',
14625
15792
  ]);
14626
- if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
14627
- setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
15793
+ if (discriminatorAdapterSize === undefined) {
15794
+ discriminatorAdapterSize = 'SUPERVISED_FINE_TUNING';
15795
+ }
15796
+ if (discriminatorAdapterSize === 'SUPERVISED_FINE_TUNING') {
15797
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
15798
+ if (parentObject !== undefined && fromAdapterSize != null) {
15799
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
15800
+ }
14628
15801
  }
14629
- const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
14630
- if (parentObject !== undefined && fromAdapterSize != null) {
14631
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
15802
+ else if (discriminatorAdapterSize === 'PREFERENCE_TUNING') {
15803
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
15804
+ if (parentObject !== undefined && fromAdapterSize != null) {
15805
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
15806
+ }
14632
15807
  }
14633
15808
  if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
14634
15809
  throw new Error('batchSize parameter is not supported in Vertex AI.');
@@ -14640,6 +15815,10 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14640
15815
  if (parentObject !== undefined && fromLabels != null) {
14641
15816
  setValueByPath(parentObject, ['labels'], fromLabels);
14642
15817
  }
15818
+ const fromBeta = getValueByPath(fromObject, ['beta']);
15819
+ if (parentObject !== undefined && fromBeta != null) {
15820
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'beta'], fromBeta);
15821
+ }
14643
15822
  return toObject;
14644
15823
  }
14645
15824
  function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
@@ -14658,7 +15837,7 @@ function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
14658
15837
  'trainingDataset',
14659
15838
  ]);
14660
15839
  if (fromTrainingDataset != null) {
14661
- setValueByPath(toObject, ['tuningTask', 'trainingData'], tuningDatasetToMldev(fromTrainingDataset));
15840
+ tuningDatasetToMldev(fromTrainingDataset);
14662
15841
  }
14663
15842
  const fromConfig = getValueByPath(fromObject, ['config']);
14664
15843
  if (fromConfig != null) {
@@ -14682,11 +15861,11 @@ function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
14682
15861
  'trainingDataset',
14683
15862
  ]);
14684
15863
  if (fromTrainingDataset != null) {
14685
- tuningDatasetToVertex(fromTrainingDataset, toObject);
15864
+ tuningDatasetToVertex(fromTrainingDataset, toObject, rootObject);
14686
15865
  }
14687
15866
  const fromConfig = getValueByPath(fromObject, ['config']);
14688
15867
  if (fromConfig != null) {
14689
- createTuningJobConfigToVertex(fromConfig, toObject);
15868
+ createTuningJobConfigToVertex(fromConfig, toObject, rootObject);
14690
15869
  }
14691
15870
  return toObject;
14692
15871
  }
@@ -14838,17 +16017,49 @@ function tuningDatasetToMldev(fromObject, _rootObject) {
14838
16017
  }
14839
16018
  return toObject;
14840
16019
  }
14841
- function tuningDatasetToVertex(fromObject, parentObject, _rootObject) {
16020
+ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
14842
16021
  const toObject = {};
14843
- const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14844
- if (parentObject !== undefined && fromGcsUri != null) {
14845
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
16022
+ let discriminatorGcsUri = getValueByPath(rootObject, [
16023
+ 'config',
16024
+ 'method',
16025
+ ]);
16026
+ if (discriminatorGcsUri === undefined) {
16027
+ discriminatorGcsUri = 'SUPERVISED_FINE_TUNING';
14846
16028
  }
14847
- const fromVertexDatasetResource = getValueByPath(fromObject, [
14848
- 'vertexDatasetResource',
16029
+ if (discriminatorGcsUri === 'SUPERVISED_FINE_TUNING') {
16030
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
16031
+ if (parentObject !== undefined && fromGcsUri != null) {
16032
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
16033
+ }
16034
+ }
16035
+ else if (discriminatorGcsUri === 'PREFERENCE_TUNING') {
16036
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
16037
+ if (parentObject !== undefined && fromGcsUri != null) {
16038
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromGcsUri);
16039
+ }
16040
+ }
16041
+ let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
16042
+ 'config',
16043
+ 'method',
14849
16044
  ]);
14850
- if (parentObject !== undefined && fromVertexDatasetResource != null) {
14851
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
16045
+ if (discriminatorVertexDatasetResource === undefined) {
16046
+ discriminatorVertexDatasetResource = 'SUPERVISED_FINE_TUNING';
16047
+ }
16048
+ if (discriminatorVertexDatasetResource === 'SUPERVISED_FINE_TUNING') {
16049
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
16050
+ 'vertexDatasetResource',
16051
+ ]);
16052
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
16053
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
16054
+ }
16055
+ }
16056
+ else if (discriminatorVertexDatasetResource === 'PREFERENCE_TUNING') {
16057
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
16058
+ 'vertexDatasetResource',
16059
+ ]);
16060
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
16061
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
16062
+ }
14852
16063
  }
14853
16064
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
14854
16065
  throw new Error('examples parameter is not supported in Vertex AI.');
@@ -14967,6 +16178,12 @@ function tuningJobFromVertex(fromObject, _rootObject) {
14967
16178
  if (fromSupervisedTuningSpec != null) {
14968
16179
  setValueByPath(toObject, ['supervisedTuningSpec'], fromSupervisedTuningSpec);
14969
16180
  }
16181
+ const fromPreferenceOptimizationSpec = getValueByPath(fromObject, [
16182
+ 'preferenceOptimizationSpec',
16183
+ ]);
16184
+ if (fromPreferenceOptimizationSpec != null) {
16185
+ setValueByPath(toObject, ['preferenceOptimizationSpec'], fromPreferenceOptimizationSpec);
16186
+ }
14970
16187
  const fromTuningDataStats = getValueByPath(fromObject, [
14971
16188
  'tuningDataStats',
14972
16189
  ]);
@@ -15333,7 +16550,7 @@ class Tunings extends BaseModule {
15333
16550
  let path = '';
15334
16551
  let queryParams = {};
15335
16552
  if (this.apiClient.isVertexAI()) {
15336
- const body = createTuningJobParametersPrivateToVertex(params);
16553
+ const body = createTuningJobParametersPrivateToVertex(params, params);
15337
16554
  path = formatMap('tuningJobs', body['_url']);
15338
16555
  queryParams = body['_query'];
15339
16556
  delete body['_url'];
@@ -15411,7 +16628,28 @@ const INITIAL_RETRY_DELAY_MS = 1000;
15411
16628
  const DELAY_MULTIPLIER = 2;
15412
16629
  const X_GOOG_UPLOAD_STATUS_HEADER_FIELD = 'x-goog-upload-status';
15413
16630
  async function uploadBlob(file, uploadUrl, apiClient) {
15414
- var _a, _b, _c;
16631
+ var _a;
16632
+ const response = await uploadBlobInternal(file, uploadUrl, apiClient);
16633
+ const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
16634
+ if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
16635
+ throw new Error('Failed to upload file: Upload status is not finalized.');
16636
+ }
16637
+ return responseJson['file'];
16638
+ }
16639
+ async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient) {
16640
+ var _a;
16641
+ const response = await uploadBlobInternal(file, uploadUrl, apiClient);
16642
+ const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
16643
+ if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
16644
+ throw new Error('Failed to upload file: Upload status is not finalized.');
16645
+ }
16646
+ const resp = uploadToFileSearchStoreOperationFromMldev(responseJson);
16647
+ const typedResp = new UploadToFileSearchStoreOperation();
16648
+ Object.assign(typedResp, resp);
16649
+ return typedResp;
16650
+ }
16651
+ async function uploadBlobInternal(file, uploadUrl, apiClient) {
16652
+ var _a, _b;
15415
16653
  let fileSize = 0;
15416
16654
  let offset = 0;
15417
16655
  let response = new HttpResponse(new Response());
@@ -15459,11 +16697,7 @@ async function uploadBlob(file, uploadUrl, apiClient) {
15459
16697
  throw new Error('All content has been uploaded, but the upload status is not finalized.');
15460
16698
  }
15461
16699
  }
15462
- const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
15463
- if (((_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
15464
- throw new Error('Failed to upload file: Upload status is not finalized.');
15465
- }
15466
- return responseJson['file'];
16700
+ return response;
15467
16701
  }
15468
16702
  async function getBlobStat(file) {
15469
16703
  const fileStat = { size: file.size, type: file.type };
@@ -15499,6 +16733,14 @@ class NodeUploader {
15499
16733
  return uploadBlob(file, uploadUrl, apiClient);
15500
16734
  }
15501
16735
  }
16736
+ async uploadToFileSearchStore(file, uploadUrl, apiClient) {
16737
+ if (typeof file === 'string') {
16738
+ return await this.uploadFileToFileSearchStoreFromPath(file, uploadUrl, apiClient);
16739
+ }
16740
+ else {
16741
+ return uploadBlobToFileSearchStore(file, uploadUrl, apiClient);
16742
+ }
16743
+ }
15502
16744
  /**
15503
16745
  * Infers the MIME type of a file based on its extension.
15504
16746
  *
@@ -15590,12 +16832,34 @@ class NodeUploader {
15590
16832
  return mimeType;
15591
16833
  }
15592
16834
  async uploadFileFromPath(file, uploadUrl, apiClient) {
15593
- var _a, _b, _c;
16835
+ var _a;
16836
+ const response = await this.uploadFileFromPathInternal(file, uploadUrl, apiClient);
16837
+ const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
16838
+ if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
16839
+ throw new Error('Failed to upload file: Upload status is not finalized.');
16840
+ }
16841
+ return responseJson['file'];
16842
+ }
16843
+ async uploadFileToFileSearchStoreFromPath(file, uploadUrl, apiClient) {
16844
+ var _a;
16845
+ const response = await this.uploadFileFromPathInternal(file, uploadUrl, apiClient);
16846
+ const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
16847
+ if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
16848
+ throw new Error('Failed to upload file: Upload status is not finalized.');
16849
+ }
16850
+ const resp = uploadToFileSearchStoreOperationFromMldev(responseJson);
16851
+ const typedResp = new UploadToFileSearchStoreOperation();
16852
+ Object.assign(typedResp, resp);
16853
+ return typedResp;
16854
+ }
16855
+ async uploadFileFromPathInternal(file, uploadUrl, apiClient) {
16856
+ var _a, _b;
15594
16857
  let fileSize = 0;
15595
16858
  let offset = 0;
15596
16859
  let response = new HttpResponse(new Response());
15597
16860
  let uploadCommand = 'upload';
15598
16861
  let fileHandle;
16862
+ const fileName = path.basename(file);
15599
16863
  try {
15600
16864
  fileHandle = await fs.open(file, 'r');
15601
16865
  if (!fileHandle) {
@@ -15627,6 +16891,7 @@ class NodeUploader {
15627
16891
  'X-Goog-Upload-Command': uploadCommand,
15628
16892
  'X-Goog-Upload-Offset': String(offset),
15629
16893
  'Content-Length': String(bytesRead),
16894
+ 'X-Goog-Upload-File-Name': fileName,
15630
16895
  },
15631
16896
  },
15632
16897
  });
@@ -15647,11 +16912,7 @@ class NodeUploader {
15647
16912
  throw new Error('All content has been uploaded, but the upload status is not finalized.');
15648
16913
  }
15649
16914
  }
15650
- const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
15651
- if (((_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
15652
- throw new Error('Failed to upload file: Upload status is not finalized.');
15653
- }
15654
- return responseJson['file'];
16915
+ return response;
15655
16916
  }
15656
16917
  finally {
15657
16918
  // Ensure the file handle is always closed
@@ -15751,6 +17012,9 @@ class GoogleGenAI {
15751
17012
  ' precedence over the API key from the environment variables.');
15752
17013
  this.apiKey = undefined;
15753
17014
  }
17015
+ if (!this.location && !this.apiKey) {
17016
+ this.location = 'global';
17017
+ }
15754
17018
  }
15755
17019
  const baseUrl = getBaseUrl(options.httpOptions, options.vertexai, getEnv('GOOGLE_VERTEX_BASE_URL'), getEnv('GOOGLE_GEMINI_BASE_URL'));
15756
17020
  if (baseUrl) {
@@ -15787,6 +17051,7 @@ class GoogleGenAI {
15787
17051
  this.operations = new Operations(this.apiClient);
15788
17052
  this.authTokens = new Tokens(this.apiClient);
15789
17053
  this.tunings = new Tunings(this.apiClient);
17054
+ this.fileSearchStores = new FileSearchStores(this.apiClient);
15790
17055
  }
15791
17056
  }
15792
17057
  function getEnv(env) {
@@ -15811,5 +17076,5 @@ function getApiKeyFromEnv() {
15811
17076
  return envGoogleApiKey || envGeminiApiKey || undefined;
15812
17077
  }
15813
17078
 
15814
- export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
17079
+ export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, 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, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, PhishBlockThreshold, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
15815
17080
  //# sourceMappingURL=index.mjs.map