@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.
@@ -460,6 +460,90 @@ function getOperationParametersToVertex(fromObject) {
460
460
  }
461
461
  return toObject;
462
462
  }
463
+ function importFileOperationFromMldev$1(fromObject) {
464
+ const toObject = {};
465
+ const fromName = getValueByPath(fromObject, ['name']);
466
+ if (fromName != null) {
467
+ setValueByPath(toObject, ['name'], fromName);
468
+ }
469
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
470
+ if (fromMetadata != null) {
471
+ setValueByPath(toObject, ['metadata'], fromMetadata);
472
+ }
473
+ const fromDone = getValueByPath(fromObject, ['done']);
474
+ if (fromDone != null) {
475
+ setValueByPath(toObject, ['done'], fromDone);
476
+ }
477
+ const fromError = getValueByPath(fromObject, ['error']);
478
+ if (fromError != null) {
479
+ setValueByPath(toObject, ['error'], fromError);
480
+ }
481
+ const fromResponse = getValueByPath(fromObject, ['response']);
482
+ if (fromResponse != null) {
483
+ setValueByPath(toObject, ['response'], importFileResponseFromMldev$1(fromResponse));
484
+ }
485
+ return toObject;
486
+ }
487
+ function importFileResponseFromMldev$1(fromObject) {
488
+ const toObject = {};
489
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
490
+ 'sdkHttpResponse',
491
+ ]);
492
+ if (fromSdkHttpResponse != null) {
493
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
494
+ }
495
+ const fromParent = getValueByPath(fromObject, ['parent']);
496
+ if (fromParent != null) {
497
+ setValueByPath(toObject, ['parent'], fromParent);
498
+ }
499
+ const fromDocumentName = getValueByPath(fromObject, ['documentName']);
500
+ if (fromDocumentName != null) {
501
+ setValueByPath(toObject, ['documentName'], fromDocumentName);
502
+ }
503
+ return toObject;
504
+ }
505
+ function uploadToFileSearchStoreOperationFromMldev(fromObject) {
506
+ const toObject = {};
507
+ const fromName = getValueByPath(fromObject, ['name']);
508
+ if (fromName != null) {
509
+ setValueByPath(toObject, ['name'], fromName);
510
+ }
511
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
512
+ if (fromMetadata != null) {
513
+ setValueByPath(toObject, ['metadata'], fromMetadata);
514
+ }
515
+ const fromDone = getValueByPath(fromObject, ['done']);
516
+ if (fromDone != null) {
517
+ setValueByPath(toObject, ['done'], fromDone);
518
+ }
519
+ const fromError = getValueByPath(fromObject, ['error']);
520
+ if (fromError != null) {
521
+ setValueByPath(toObject, ['error'], fromError);
522
+ }
523
+ const fromResponse = getValueByPath(fromObject, ['response']);
524
+ if (fromResponse != null) {
525
+ setValueByPath(toObject, ['response'], uploadToFileSearchStoreResponseFromMldev(fromResponse));
526
+ }
527
+ return toObject;
528
+ }
529
+ function uploadToFileSearchStoreResponseFromMldev(fromObject) {
530
+ const toObject = {};
531
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
532
+ 'sdkHttpResponse',
533
+ ]);
534
+ if (fromSdkHttpResponse != null) {
535
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
536
+ }
537
+ const fromParent = getValueByPath(fromObject, ['parent']);
538
+ if (fromParent != null) {
539
+ setValueByPath(toObject, ['parent'], fromParent);
540
+ }
541
+ const fromDocumentName = getValueByPath(fromObject, ['documentName']);
542
+ if (fromDocumentName != null) {
543
+ setValueByPath(toObject, ['documentName'], fromDocumentName);
544
+ }
545
+ return toObject;
546
+ }
463
547
  function videoFromMldev$1(fromObject) {
464
548
  const toObject = {};
465
549
  const fromUri = getValueByPath(fromObject, ['uri']);
@@ -500,7 +584,7 @@ function videoFromVertex$1(fromObject) {
500
584
  * Copyright 2025 Google LLC
501
585
  * SPDX-License-Identifier: Apache-2.0
502
586
  */
503
- /** Required. Outcome of the code execution. */
587
+ /** Outcome of the code execution. */
504
588
  var Outcome;
505
589
  (function (Outcome) {
506
590
  /**
@@ -520,7 +604,7 @@ var Outcome;
520
604
  */
521
605
  Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
522
606
  })(Outcome || (Outcome = {}));
523
- /** Required. Programming language of the `code`. */
607
+ /** Programming language of the `code`. */
524
608
  var Language;
525
609
  (function (Language) {
526
610
  /**
@@ -552,7 +636,7 @@ var FunctionResponseScheduling;
552
636
  */
553
637
  FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
554
638
  })(FunctionResponseScheduling || (FunctionResponseScheduling = {}));
555
- /** Optional. The type of the data. */
639
+ /** The type of the data. */
556
640
  var Type;
557
641
  (function (Type) {
558
642
  /**
@@ -588,7 +672,121 @@ var Type;
588
672
  */
589
673
  Type["NULL"] = "NULL";
590
674
  })(Type || (Type = {}));
591
- /** Required. Harm category. */
675
+ /** The mode of the predictor to be used in dynamic retrieval. */
676
+ var Mode;
677
+ (function (Mode) {
678
+ /**
679
+ * Always trigger retrieval.
680
+ */
681
+ Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
682
+ /**
683
+ * Run retrieval only when system decides it is necessary.
684
+ */
685
+ Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
686
+ })(Mode || (Mode = {}));
687
+ /** The API spec that the external API implements. This enum is not supported in Gemini API. */
688
+ var ApiSpec;
689
+ (function (ApiSpec) {
690
+ /**
691
+ * Unspecified API spec. This value should not be used.
692
+ */
693
+ ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
694
+ /**
695
+ * Simple search API spec.
696
+ */
697
+ ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
698
+ /**
699
+ * Elastic search API spec.
700
+ */
701
+ ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
702
+ })(ApiSpec || (ApiSpec = {}));
703
+ /** Type of auth scheme. This enum is not supported in Gemini API. */
704
+ var AuthType;
705
+ (function (AuthType) {
706
+ AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
707
+ /**
708
+ * No Auth.
709
+ */
710
+ AuthType["NO_AUTH"] = "NO_AUTH";
711
+ /**
712
+ * API Key Auth.
713
+ */
714
+ AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
715
+ /**
716
+ * HTTP Basic Auth.
717
+ */
718
+ AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
719
+ /**
720
+ * Google Service Account Auth.
721
+ */
722
+ AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
723
+ /**
724
+ * OAuth auth.
725
+ */
726
+ AuthType["OAUTH"] = "OAUTH";
727
+ /**
728
+ * OpenID Connect (OIDC) Auth.
729
+ */
730
+ AuthType["OIDC_AUTH"] = "OIDC_AUTH";
731
+ })(AuthType || (AuthType = {}));
732
+ /** The location of the API key. This enum is not supported in Gemini API. */
733
+ var HttpElementLocation;
734
+ (function (HttpElementLocation) {
735
+ HttpElementLocation["HTTP_IN_UNSPECIFIED"] = "HTTP_IN_UNSPECIFIED";
736
+ /**
737
+ * Element is in the HTTP request query.
738
+ */
739
+ HttpElementLocation["HTTP_IN_QUERY"] = "HTTP_IN_QUERY";
740
+ /**
741
+ * Element is in the HTTP request header.
742
+ */
743
+ HttpElementLocation["HTTP_IN_HEADER"] = "HTTP_IN_HEADER";
744
+ /**
745
+ * Element is in the HTTP request path.
746
+ */
747
+ HttpElementLocation["HTTP_IN_PATH"] = "HTTP_IN_PATH";
748
+ /**
749
+ * Element is in the HTTP request body.
750
+ */
751
+ HttpElementLocation["HTTP_IN_BODY"] = "HTTP_IN_BODY";
752
+ /**
753
+ * Element is in the HTTP request cookie.
754
+ */
755
+ HttpElementLocation["HTTP_IN_COOKIE"] = "HTTP_IN_COOKIE";
756
+ })(HttpElementLocation || (HttpElementLocation = {}));
757
+ /** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
758
+ var PhishBlockThreshold;
759
+ (function (PhishBlockThreshold) {
760
+ /**
761
+ * Defaults to unspecified.
762
+ */
763
+ PhishBlockThreshold["PHISH_BLOCK_THRESHOLD_UNSPECIFIED"] = "PHISH_BLOCK_THRESHOLD_UNSPECIFIED";
764
+ /**
765
+ * Blocks Low and above confidence URL that is risky.
766
+ */
767
+ PhishBlockThreshold["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE";
768
+ /**
769
+ * Blocks Medium and above confidence URL that is risky.
770
+ */
771
+ PhishBlockThreshold["BLOCK_MEDIUM_AND_ABOVE"] = "BLOCK_MEDIUM_AND_ABOVE";
772
+ /**
773
+ * Blocks High and above confidence URL that is risky.
774
+ */
775
+ PhishBlockThreshold["BLOCK_HIGH_AND_ABOVE"] = "BLOCK_HIGH_AND_ABOVE";
776
+ /**
777
+ * Blocks Higher and above confidence URL that is risky.
778
+ */
779
+ PhishBlockThreshold["BLOCK_HIGHER_AND_ABOVE"] = "BLOCK_HIGHER_AND_ABOVE";
780
+ /**
781
+ * Blocks Very high and above confidence URL that is risky.
782
+ */
783
+ PhishBlockThreshold["BLOCK_VERY_HIGH_AND_ABOVE"] = "BLOCK_VERY_HIGH_AND_ABOVE";
784
+ /**
785
+ * Blocks Extremely high confidence URL that is risky.
786
+ */
787
+ PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
788
+ })(PhishBlockThreshold || (PhishBlockThreshold = {}));
789
+ /** Harm category. */
592
790
  var HarmCategory;
593
791
  (function (HarmCategory) {
594
792
  /**
@@ -636,7 +834,7 @@ var HarmCategory;
636
834
  */
637
835
  HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
638
836
  })(HarmCategory || (HarmCategory = {}));
639
- /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
837
+ /** 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. */
640
838
  var HarmBlockMethod;
641
839
  (function (HarmBlockMethod) {
642
840
  /**
@@ -652,7 +850,7 @@ var HarmBlockMethod;
652
850
  */
653
851
  HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
654
852
  })(HarmBlockMethod || (HarmBlockMethod = {}));
655
- /** Required. The harm block threshold. */
853
+ /** The harm block threshold. */
656
854
  var HarmBlockThreshold;
657
855
  (function (HarmBlockThreshold) {
658
856
  /**
@@ -680,87 +878,6 @@ var HarmBlockThreshold;
680
878
  */
681
879
  HarmBlockThreshold["OFF"] = "OFF";
682
880
  })(HarmBlockThreshold || (HarmBlockThreshold = {}));
683
- /** The mode of the predictor to be used in dynamic retrieval. */
684
- var Mode;
685
- (function (Mode) {
686
- /**
687
- * Always trigger retrieval.
688
- */
689
- Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
690
- /**
691
- * Run retrieval only when system decides it is necessary.
692
- */
693
- Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
694
- })(Mode || (Mode = {}));
695
- /** Type of auth scheme. */
696
- var AuthType;
697
- (function (AuthType) {
698
- AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
699
- /**
700
- * No Auth.
701
- */
702
- AuthType["NO_AUTH"] = "NO_AUTH";
703
- /**
704
- * API Key Auth.
705
- */
706
- AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
707
- /**
708
- * HTTP Basic Auth.
709
- */
710
- AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
711
- /**
712
- * Google Service Account Auth.
713
- */
714
- AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
715
- /**
716
- * OAuth auth.
717
- */
718
- AuthType["OAUTH"] = "OAUTH";
719
- /**
720
- * OpenID Connect (OIDC) Auth.
721
- */
722
- AuthType["OIDC_AUTH"] = "OIDC_AUTH";
723
- })(AuthType || (AuthType = {}));
724
- /** The API spec that the external API implements. */
725
- var ApiSpec;
726
- (function (ApiSpec) {
727
- /**
728
- * Unspecified API spec. This value should not be used.
729
- */
730
- ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
731
- /**
732
- * Simple search API spec.
733
- */
734
- ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
735
- /**
736
- * Elastic search API spec.
737
- */
738
- ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
739
- })(ApiSpec || (ApiSpec = {}));
740
- /** Status of the url retrieval. */
741
- var UrlRetrievalStatus;
742
- (function (UrlRetrievalStatus) {
743
- /**
744
- * Default value. This value is unused
745
- */
746
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
747
- /**
748
- * Url retrieval is successful.
749
- */
750
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
751
- /**
752
- * Url retrieval is failed due to error.
753
- */
754
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
755
- /**
756
- * Url retrieval is failed because the content is behind paywall.
757
- */
758
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
759
- /**
760
- * Url retrieval is failed because the content is unsafe.
761
- */
762
- UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
763
- })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
764
881
  /** Output only. The reason why the model stopped generating tokens.
765
882
 
766
883
  If empty, the model has not stopped generating the tokens. */
@@ -851,7 +968,7 @@ var HarmProbability;
851
968
  */
852
969
  HarmProbability["HIGH"] = "HIGH";
853
970
  })(HarmProbability || (HarmProbability = {}));
854
- /** Output only. Harm severity levels in the content. */
971
+ /** Output only. Harm severity levels in the content. This enum is not supported in Gemini API. */
855
972
  var HarmSeverity;
856
973
  (function (HarmSeverity) {
857
974
  /**
@@ -875,6 +992,30 @@ var HarmSeverity;
875
992
  */
876
993
  HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
877
994
  })(HarmSeverity || (HarmSeverity = {}));
995
+ /** Status of the url retrieval. */
996
+ var UrlRetrievalStatus;
997
+ (function (UrlRetrievalStatus) {
998
+ /**
999
+ * Default value. This value is unused.
1000
+ */
1001
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
1002
+ /**
1003
+ * Url retrieval is successful.
1004
+ */
1005
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
1006
+ /**
1007
+ * Url retrieval is failed due to error.
1008
+ */
1009
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
1010
+ /**
1011
+ * Url retrieval is failed because the content is behind paywall. This enum value is not supported in Vertex AI.
1012
+ */
1013
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
1014
+ /**
1015
+ * Url retrieval is failed because the content is unsafe. This enum value is not supported in Vertex AI.
1016
+ */
1017
+ UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
1018
+ })(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
878
1019
  /** Output only. The reason why the prompt was blocked. */
879
1020
  var BlockedReason;
880
1021
  (function (BlockedReason) {
@@ -911,7 +1052,7 @@ var BlockedReason;
911
1052
  */
912
1053
  BlockedReason["JAILBREAK"] = "JAILBREAK";
913
1054
  })(BlockedReason || (BlockedReason = {}));
914
- /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
1055
+ /** Output only. The traffic type for this request. This enum is not supported in Gemini API. */
915
1056
  var TrafficType;
916
1057
  (function (TrafficType) {
917
1058
  /**
@@ -919,7 +1060,7 @@ var TrafficType;
919
1060
  */
920
1061
  TrafficType["TRAFFIC_TYPE_UNSPECIFIED"] = "TRAFFIC_TYPE_UNSPECIFIED";
921
1062
  /**
922
- * Type for Pay-As-You-Go traffic.
1063
+ * The request was processed using Pay-As-You-Go quota.
923
1064
  */
924
1065
  TrafficType["ON_DEMAND"] = "ON_DEMAND";
925
1066
  /**
@@ -967,17 +1108,65 @@ var MediaResolution;
967
1108
  */
968
1109
  MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
969
1110
  })(MediaResolution || (MediaResolution = {}));
970
- /** Job state. */
971
- var JobState;
972
- (function (JobState) {
1111
+ /** Tuning mode. This enum is not supported in Gemini API. */
1112
+ var TuningMode;
1113
+ (function (TuningMode) {
973
1114
  /**
974
- * The job state is unspecified.
1115
+ * Tuning mode is unspecified.
975
1116
  */
976
- JobState["JOB_STATE_UNSPECIFIED"] = "JOB_STATE_UNSPECIFIED";
1117
+ TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
977
1118
  /**
978
- * The job has been just created or resumed and processing has not yet begun.
1119
+ * Full fine-tuning mode.
979
1120
  */
980
- JobState["JOB_STATE_QUEUED"] = "JOB_STATE_QUEUED";
1121
+ TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
1122
+ /**
1123
+ * PEFT adapter tuning mode.
1124
+ */
1125
+ TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
1126
+ })(TuningMode || (TuningMode = {}));
1127
+ /** Adapter size for tuning. This enum is not supported in Gemini API. */
1128
+ var AdapterSize;
1129
+ (function (AdapterSize) {
1130
+ /**
1131
+ * Adapter size is unspecified.
1132
+ */
1133
+ AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1134
+ /**
1135
+ * Adapter size 1.
1136
+ */
1137
+ AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1138
+ /**
1139
+ * Adapter size 2.
1140
+ */
1141
+ AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1142
+ /**
1143
+ * Adapter size 4.
1144
+ */
1145
+ AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1146
+ /**
1147
+ * Adapter size 8.
1148
+ */
1149
+ AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1150
+ /**
1151
+ * Adapter size 16.
1152
+ */
1153
+ AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1154
+ /**
1155
+ * Adapter size 32.
1156
+ */
1157
+ AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1158
+ })(AdapterSize || (AdapterSize = {}));
1159
+ /** Job state. */
1160
+ var JobState;
1161
+ (function (JobState) {
1162
+ /**
1163
+ * The job state is unspecified.
1164
+ */
1165
+ JobState["JOB_STATE_UNSPECIFIED"] = "JOB_STATE_UNSPECIFIED";
1166
+ /**
1167
+ * The job has been just created or resumed and processing has not yet begun.
1168
+ */
1169
+ JobState["JOB_STATE_QUEUED"] = "JOB_STATE_QUEUED";
981
1170
  /**
982
1171
  * The service is preparing to run the job.
983
1172
  */
@@ -1019,55 +1208,7 @@ var JobState;
1019
1208
  */
1020
1209
  JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
1021
1210
  })(JobState || (JobState = {}));
1022
- /** Tuning mode. */
1023
- var TuningMode;
1024
- (function (TuningMode) {
1025
- /**
1026
- * Tuning mode is unspecified.
1027
- */
1028
- TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
1029
- /**
1030
- * Full fine-tuning mode.
1031
- */
1032
- TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
1033
- /**
1034
- * PEFT adapter tuning mode.
1035
- */
1036
- TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
1037
- })(TuningMode || (TuningMode = {}));
1038
- /** Optional. Adapter size for tuning. */
1039
- var AdapterSize;
1040
- (function (AdapterSize) {
1041
- /**
1042
- * Adapter size is unspecified.
1043
- */
1044
- AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
1045
- /**
1046
- * Adapter size 1.
1047
- */
1048
- AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
1049
- /**
1050
- * Adapter size 2.
1051
- */
1052
- AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
1053
- /**
1054
- * Adapter size 4.
1055
- */
1056
- AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
1057
- /**
1058
- * Adapter size 8.
1059
- */
1060
- AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
1061
- /**
1062
- * Adapter size 16.
1063
- */
1064
- AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
1065
- /**
1066
- * Adapter size 32.
1067
- */
1068
- AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
1069
- })(AdapterSize || (AdapterSize = {}));
1070
- /** Optional. The tuning task. Either I2V or T2V. */
1211
+ /** The tuning task. Either I2V or T2V. This enum is not supported in Gemini API. */
1071
1212
  var TuningTask;
1072
1213
  (function (TuningTask) {
1073
1214
  /**
@@ -1082,6 +1223,10 @@ var TuningTask;
1082
1223
  * Tuning task for text to video.
1083
1224
  */
1084
1225
  TuningTask["TUNING_TASK_T2V"] = "TUNING_TASK_T2V";
1226
+ /**
1227
+ * Tuning task for reference to video.
1228
+ */
1229
+ TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
1085
1230
  })(TuningTask || (TuningTask = {}));
1086
1231
  /** Options for feature selection preference. */
1087
1232
  var FeatureSelectionPreference;
@@ -1317,6 +1462,26 @@ var VideoCompressionQuality;
1317
1462
  */
1318
1463
  VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
1319
1464
  })(VideoCompressionQuality || (VideoCompressionQuality = {}));
1465
+ /** Enum representing the tuning method. */
1466
+ var TuningMethod;
1467
+ (function (TuningMethod) {
1468
+ /**
1469
+ * Supervised fine tuning.
1470
+ */
1471
+ TuningMethod["SUPERVISED_FINE_TUNING"] = "SUPERVISED_FINE_TUNING";
1472
+ /**
1473
+ * Preference optimization tuning.
1474
+ */
1475
+ TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
1476
+ })(TuningMethod || (TuningMethod = {}));
1477
+ /** State for the lifecycle of a Document. */
1478
+ var DocumentState;
1479
+ (function (DocumentState) {
1480
+ DocumentState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
1481
+ DocumentState["STATE_PENDING"] = "STATE_PENDING";
1482
+ DocumentState["STATE_ACTIVE"] = "STATE_ACTIVE";
1483
+ DocumentState["STATE_FAILED"] = "STATE_FAILED";
1484
+ })(DocumentState || (DocumentState = {}));
1320
1485
  /** State for the lifecycle of a File. */
1321
1486
  var FileState;
1322
1487
  (function (FileState) {
@@ -1744,7 +1909,7 @@ class HttpResponse {
1744
1909
  /** 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. */
1745
1910
  class GenerateContentResponsePromptFeedback {
1746
1911
  }
1747
- /** Usage metadata about response(s). This data type is not supported in Gemini API. */
1912
+ /** 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. */
1748
1913
  class GenerateContentResponseUsageMetadata {
1749
1914
  }
1750
1915
  /** Response message for PredictionService.GenerateContent. */
@@ -2009,11 +2174,11 @@ class GenerateVideosOperation {
2009
2174
  * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2010
2175
  * @internal
2011
2176
  */
2012
- _fromAPIResponse({ apiResponse, isVertexAI, }) {
2177
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2013
2178
  const operation = new GenerateVideosOperation();
2014
2179
  let response;
2015
2180
  const op = apiResponse;
2016
- if (isVertexAI) {
2181
+ if (_isVertexAI) {
2017
2182
  response = generateVideosOperationFromVertex$1(op);
2018
2183
  }
2019
2184
  else {
@@ -2031,6 +2196,32 @@ class DeleteCachedContentResponse {
2031
2196
  }
2032
2197
  class ListCachedContentsResponse {
2033
2198
  }
2199
+ /** Config for documents.list return value. */
2200
+ class ListDocumentsResponse {
2201
+ }
2202
+ /** Config for file_search_stores.list return value. */
2203
+ class ListFileSearchStoresResponse {
2204
+ }
2205
+ /** Response for the resumable upload method. */
2206
+ class UploadToFileSearchStoreResumableResponse {
2207
+ }
2208
+ /** Response for ImportFile to import a File API file with a file search store. */
2209
+ class ImportFileResponse {
2210
+ }
2211
+ /** Long-running operation for importing a file to a FileSearchStore. */
2212
+ class ImportFileOperation {
2213
+ /**
2214
+ * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2215
+ * @internal
2216
+ */
2217
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2218
+ const operation = new ImportFileOperation();
2219
+ const op = apiResponse;
2220
+ const response = importFileOperationFromMldev$1(op);
2221
+ Object.assign(operation, response);
2222
+ return operation;
2223
+ }
2224
+ }
2034
2225
  /** Response for the list files method. */
2035
2226
  class ListFilesResponse {
2036
2227
  }
@@ -2266,6 +2457,23 @@ class LiveMusicServerMessage {
2266
2457
  return undefined;
2267
2458
  }
2268
2459
  }
2460
+ /** The response when long-running operation for uploading a file to a FileSearchStore complete. */
2461
+ class UploadToFileSearchStoreResponse {
2462
+ }
2463
+ /** Long-running operation for uploading a file to a FileSearchStore. */
2464
+ class UploadToFileSearchStoreOperation {
2465
+ /**
2466
+ * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2467
+ * @internal
2468
+ */
2469
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2470
+ const operation = new UploadToFileSearchStoreOperation();
2471
+ const op = apiResponse;
2472
+ const response = uploadToFileSearchStoreOperationFromMldev(op);
2473
+ Object.assign(operation, response);
2474
+ return operation;
2475
+ }
2476
+ }
2269
2477
 
2270
2478
  /**
2271
2479
  * @license
@@ -3262,6 +3470,12 @@ function batchJobFromVertex(fromObject) {
3262
3470
  if (fromDest != null) {
3263
3471
  setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
3264
3472
  }
3473
+ const fromCompletionStats = getValueByPath(fromObject, [
3474
+ 'completionStats',
3475
+ ]);
3476
+ if (fromCompletionStats != null) {
3477
+ setValueByPath(toObject, ['completionStats'], fromCompletionStats);
3478
+ }
3265
3479
  return toObject;
3266
3480
  }
3267
3481
  function batchJobSourceFromVertex(fromObject) {
@@ -3336,13 +3550,13 @@ function batchJobSourceToVertex(fromObject) {
3336
3550
  }
3337
3551
  function blobToMldev$4(fromObject) {
3338
3552
  const toObject = {};
3339
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
3340
- throw new Error('displayName parameter is not supported in Gemini API.');
3341
- }
3342
3553
  const fromData = getValueByPath(fromObject, ['data']);
3343
3554
  if (fromData != null) {
3344
3555
  setValueByPath(toObject, ['data'], fromData);
3345
3556
  }
3557
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
3558
+ throw new Error('displayName parameter is not supported in Gemini API.');
3559
+ }
3346
3560
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
3347
3561
  if (fromMimeType != null) {
3348
3562
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -3385,12 +3599,6 @@ function candidateFromMldev$1(fromObject) {
3385
3599
  if (fromFinishReason != null) {
3386
3600
  setValueByPath(toObject, ['finishReason'], fromFinishReason);
3387
3601
  }
3388
- const fromUrlContextMetadata = getValueByPath(fromObject, [
3389
- 'urlContextMetadata',
3390
- ]);
3391
- if (fromUrlContextMetadata != null) {
3392
- setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
3393
- }
3394
3602
  const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
3395
3603
  if (fromAvgLogprobs != null) {
3396
3604
  setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
@@ -3423,6 +3631,12 @@ function candidateFromMldev$1(fromObject) {
3423
3631
  }
3424
3632
  setValueByPath(toObject, ['safetyRatings'], transformedList);
3425
3633
  }
3634
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
3635
+ 'urlContextMetadata',
3636
+ ]);
3637
+ if (fromUrlContextMetadata != null) {
3638
+ setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
3639
+ }
3426
3640
  return toObject;
3427
3641
  }
3428
3642
  function citationMetadataFromMldev$1(fromObject) {
@@ -3891,15 +4105,18 @@ function googleMapsToMldev$4(fromObject) {
3891
4105
  }
3892
4106
  function googleSearchToMldev$4(fromObject) {
3893
4107
  const toObject = {};
4108
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
4109
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
4110
+ }
4111
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
4112
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
4113
+ }
3894
4114
  const fromTimeRangeFilter = getValueByPath(fromObject, [
3895
4115
  'timeRangeFilter',
3896
4116
  ]);
3897
4117
  if (fromTimeRangeFilter != null) {
3898
4118
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
3899
4119
  }
3900
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
3901
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
3902
- }
3903
4120
  return toObject;
3904
4121
  }
3905
4122
  function inlinedRequestToMldev(apiClient, fromObject) {
@@ -4043,30 +4260,6 @@ function listBatchJobsResponseFromVertex(fromObject) {
4043
4260
  }
4044
4261
  function partToMldev$4(fromObject) {
4045
4262
  const toObject = {};
4046
- const fromVideoMetadata = getValueByPath(fromObject, [
4047
- 'videoMetadata',
4048
- ]);
4049
- if (fromVideoMetadata != null) {
4050
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4051
- }
4052
- const fromThought = getValueByPath(fromObject, ['thought']);
4053
- if (fromThought != null) {
4054
- setValueByPath(toObject, ['thought'], fromThought);
4055
- }
4056
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4057
- if (fromInlineData != null) {
4058
- setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
4059
- }
4060
- const fromFileData = getValueByPath(fromObject, ['fileData']);
4061
- if (fromFileData != null) {
4062
- setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4063
- }
4064
- const fromThoughtSignature = getValueByPath(fromObject, [
4065
- 'thoughtSignature',
4066
- ]);
4067
- if (fromThoughtSignature != null) {
4068
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
4069
- }
4070
4263
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
4071
4264
  if (fromFunctionCall != null) {
4072
4265
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -4083,27 +4276,51 @@ function partToMldev$4(fromObject) {
4083
4276
  if (fromExecutableCode != null) {
4084
4277
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
4085
4278
  }
4279
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
4280
+ if (fromFileData != null) {
4281
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
4282
+ }
4086
4283
  const fromFunctionResponse = getValueByPath(fromObject, [
4087
4284
  'functionResponse',
4088
4285
  ]);
4089
4286
  if (fromFunctionResponse != null) {
4090
4287
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
4091
4288
  }
4289
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
4290
+ if (fromInlineData != null) {
4291
+ setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
4292
+ }
4092
4293
  const fromText = getValueByPath(fromObject, ['text']);
4093
4294
  if (fromText != null) {
4094
4295
  setValueByPath(toObject, ['text'], fromText);
4095
4296
  }
4297
+ const fromThought = getValueByPath(fromObject, ['thought']);
4298
+ if (fromThought != null) {
4299
+ setValueByPath(toObject, ['thought'], fromThought);
4300
+ }
4301
+ const fromThoughtSignature = getValueByPath(fromObject, [
4302
+ 'thoughtSignature',
4303
+ ]);
4304
+ if (fromThoughtSignature != null) {
4305
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
4306
+ }
4307
+ const fromVideoMetadata = getValueByPath(fromObject, [
4308
+ 'videoMetadata',
4309
+ ]);
4310
+ if (fromVideoMetadata != null) {
4311
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
4312
+ }
4096
4313
  return toObject;
4097
4314
  }
4098
4315
  function safetySettingToMldev$1(fromObject) {
4099
4316
  const toObject = {};
4100
- if (getValueByPath(fromObject, ['method']) !== undefined) {
4101
- throw new Error('method parameter is not supported in Gemini API.');
4102
- }
4103
4317
  const fromCategory = getValueByPath(fromObject, ['category']);
4104
4318
  if (fromCategory != null) {
4105
4319
  setValueByPath(toObject, ['category'], fromCategory);
4106
4320
  }
4321
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
4322
+ throw new Error('method parameter is not supported in Gemini API.');
4323
+ }
4107
4324
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
4108
4325
  if (fromThreshold != null) {
4109
4326
  setValueByPath(toObject, ['threshold'], fromThreshold);
@@ -4127,16 +4344,26 @@ function toolToMldev$4(fromObject) {
4127
4344
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
4128
4345
  throw new Error('retrieval parameter is not supported in Gemini API.');
4129
4346
  }
4130
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4131
- if (fromGoogleSearch != null) {
4132
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
4133
- }
4134
4347
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
4135
4348
  'googleSearchRetrieval',
4136
4349
  ]);
4137
4350
  if (fromGoogleSearchRetrieval != null) {
4138
4351
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
4139
4352
  }
4353
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4354
+ if (fromComputerUse != null) {
4355
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
4356
+ }
4357
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
4358
+ if (fromFileSearch != null) {
4359
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
4360
+ }
4361
+ const fromCodeExecution = getValueByPath(fromObject, [
4362
+ 'codeExecution',
4363
+ ]);
4364
+ if (fromCodeExecution != null) {
4365
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4366
+ }
4140
4367
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4141
4368
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4142
4369
  }
@@ -4144,20 +4371,14 @@ function toolToMldev$4(fromObject) {
4144
4371
  if (fromGoogleMaps != null) {
4145
4372
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4146
4373
  }
4374
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4375
+ if (fromGoogleSearch != null) {
4376
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
4377
+ }
4147
4378
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
4148
4379
  if (fromUrlContext != null) {
4149
4380
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
4150
4381
  }
4151
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4152
- if (fromComputerUse != null) {
4153
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
4154
- }
4155
- const fromCodeExecution = getValueByPath(fromObject, [
4156
- 'codeExecution',
4157
- ]);
4158
- if (fromCodeExecution != null) {
4159
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
4160
- }
4161
4382
  return toObject;
4162
4383
  }
4163
4384
 
@@ -4173,6 +4394,8 @@ var PagedItem;
4173
4394
  PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
4174
4395
  PagedItem["PAGED_ITEM_FILES"] = "files";
4175
4396
  PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
4397
+ PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
4398
+ PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
4176
4399
  })(PagedItem || (PagedItem = {}));
4177
4400
  /**
4178
4401
  * Pager class for iterating through paginated results.
@@ -4853,13 +5076,13 @@ class Batches extends BaseModule {
4853
5076
  */
4854
5077
  function blobToMldev$3(fromObject) {
4855
5078
  const toObject = {};
4856
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
4857
- throw new Error('displayName parameter is not supported in Gemini API.');
4858
- }
4859
5079
  const fromData = getValueByPath(fromObject, ['data']);
4860
5080
  if (fromData != null) {
4861
5081
  setValueByPath(toObject, ['data'], fromData);
4862
5082
  }
5083
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
5084
+ throw new Error('displayName parameter is not supported in Gemini API.');
5085
+ }
4863
5086
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
4864
5087
  if (fromMimeType != null) {
4865
5088
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -5122,15 +5345,18 @@ function googleMapsToMldev$3(fromObject) {
5122
5345
  }
5123
5346
  function googleSearchToMldev$3(fromObject) {
5124
5347
  const toObject = {};
5348
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5349
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
5350
+ }
5351
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
5352
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
5353
+ }
5125
5354
  const fromTimeRangeFilter = getValueByPath(fromObject, [
5126
5355
  'timeRangeFilter',
5127
5356
  ]);
5128
5357
  if (fromTimeRangeFilter != null) {
5129
5358
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
5130
5359
  }
5131
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5132
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
5133
- }
5134
5360
  return toObject;
5135
5361
  }
5136
5362
  function listCachedContentsConfigToMldev(fromObject, parentObject) {
@@ -5231,39 +5457,15 @@ function listCachedContentsResponseFromVertex(fromObject) {
5231
5457
  }
5232
5458
  function partToMldev$3(fromObject) {
5233
5459
  const toObject = {};
5234
- const fromVideoMetadata = getValueByPath(fromObject, [
5235
- 'videoMetadata',
5460
+ const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5461
+ if (fromFunctionCall != null) {
5462
+ setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5463
+ }
5464
+ const fromCodeExecutionResult = getValueByPath(fromObject, [
5465
+ 'codeExecutionResult',
5236
5466
  ]);
5237
- if (fromVideoMetadata != null) {
5238
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
5239
- }
5240
- const fromThought = getValueByPath(fromObject, ['thought']);
5241
- if (fromThought != null) {
5242
- setValueByPath(toObject, ['thought'], fromThought);
5243
- }
5244
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5245
- if (fromInlineData != null) {
5246
- setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
5247
- }
5248
- const fromFileData = getValueByPath(fromObject, ['fileData']);
5249
- if (fromFileData != null) {
5250
- setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5251
- }
5252
- const fromThoughtSignature = getValueByPath(fromObject, [
5253
- 'thoughtSignature',
5254
- ]);
5255
- if (fromThoughtSignature != null) {
5256
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5257
- }
5258
- const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
5259
- if (fromFunctionCall != null) {
5260
- setValueByPath(toObject, ['functionCall'], fromFunctionCall);
5261
- }
5262
- const fromCodeExecutionResult = getValueByPath(fromObject, [
5263
- 'codeExecutionResult',
5264
- ]);
5265
- if (fromCodeExecutionResult != null) {
5266
- setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
5467
+ if (fromCodeExecutionResult != null) {
5468
+ setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
5267
5469
  }
5268
5470
  const fromExecutableCode = getValueByPath(fromObject, [
5269
5471
  'executableCode',
@@ -5271,16 +5473,40 @@ function partToMldev$3(fromObject) {
5271
5473
  if (fromExecutableCode != null) {
5272
5474
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
5273
5475
  }
5476
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
5477
+ if (fromFileData != null) {
5478
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
5479
+ }
5274
5480
  const fromFunctionResponse = getValueByPath(fromObject, [
5275
5481
  'functionResponse',
5276
5482
  ]);
5277
5483
  if (fromFunctionResponse != null) {
5278
5484
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
5279
5485
  }
5486
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
5487
+ if (fromInlineData != null) {
5488
+ setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
5489
+ }
5280
5490
  const fromText = getValueByPath(fromObject, ['text']);
5281
5491
  if (fromText != null) {
5282
5492
  setValueByPath(toObject, ['text'], fromText);
5283
5493
  }
5494
+ const fromThought = getValueByPath(fromObject, ['thought']);
5495
+ if (fromThought != null) {
5496
+ setValueByPath(toObject, ['thought'], fromThought);
5497
+ }
5498
+ const fromThoughtSignature = getValueByPath(fromObject, [
5499
+ 'thoughtSignature',
5500
+ ]);
5501
+ if (fromThoughtSignature != null) {
5502
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
5503
+ }
5504
+ const fromVideoMetadata = getValueByPath(fromObject, [
5505
+ 'videoMetadata',
5506
+ ]);
5507
+ if (fromVideoMetadata != null) {
5508
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
5509
+ }
5284
5510
  return toObject;
5285
5511
  }
5286
5512
  function toolToMldev$3(fromObject) {
@@ -5300,16 +5526,26 @@ function toolToMldev$3(fromObject) {
5300
5526
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
5301
5527
  throw new Error('retrieval parameter is not supported in Gemini API.');
5302
5528
  }
5303
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5304
- if (fromGoogleSearch != null) {
5305
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
5306
- }
5307
5529
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5308
5530
  'googleSearchRetrieval',
5309
5531
  ]);
5310
5532
  if (fromGoogleSearchRetrieval != null) {
5311
5533
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5312
5534
  }
5535
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5536
+ if (fromComputerUse != null) {
5537
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
5538
+ }
5539
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
5540
+ if (fromFileSearch != null) {
5541
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
5542
+ }
5543
+ const fromCodeExecution = getValueByPath(fromObject, [
5544
+ 'codeExecution',
5545
+ ]);
5546
+ if (fromCodeExecution != null) {
5547
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5548
+ }
5313
5549
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5314
5550
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5315
5551
  }
@@ -5317,20 +5553,14 @@ function toolToMldev$3(fromObject) {
5317
5553
  if (fromGoogleMaps != null) {
5318
5554
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5319
5555
  }
5556
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5557
+ if (fromGoogleSearch != null) {
5558
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
5559
+ }
5320
5560
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5321
5561
  if (fromUrlContext != null) {
5322
5562
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
5323
5563
  }
5324
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5325
- if (fromComputerUse != null) {
5326
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5327
- }
5328
- const fromCodeExecution = getValueByPath(fromObject, [
5329
- 'codeExecution',
5330
- ]);
5331
- if (fromCodeExecution != null) {
5332
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5333
- }
5334
5564
  return toObject;
5335
5565
  }
5336
5566
  function toolToVertex$2(fromObject) {
@@ -5351,16 +5581,25 @@ function toolToVertex$2(fromObject) {
5351
5581
  if (fromRetrieval != null) {
5352
5582
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
5353
5583
  }
5354
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5355
- if (fromGoogleSearch != null) {
5356
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
5357
- }
5358
5584
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
5359
5585
  'googleSearchRetrieval',
5360
5586
  ]);
5361
5587
  if (fromGoogleSearchRetrieval != null) {
5362
5588
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5363
5589
  }
5590
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5591
+ if (fromComputerUse != null) {
5592
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
5593
+ }
5594
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
5595
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
5596
+ }
5597
+ const fromCodeExecution = getValueByPath(fromObject, [
5598
+ 'codeExecution',
5599
+ ]);
5600
+ if (fromCodeExecution != null) {
5601
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5602
+ }
5364
5603
  const fromEnterpriseWebSearch = getValueByPath(fromObject, [
5365
5604
  'enterpriseWebSearch',
5366
5605
  ]);
@@ -5371,20 +5610,14 @@ function toolToVertex$2(fromObject) {
5371
5610
  if (fromGoogleMaps != null) {
5372
5611
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
5373
5612
  }
5613
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5614
+ if (fromGoogleSearch != null) {
5615
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
5616
+ }
5374
5617
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
5375
5618
  if (fromUrlContext != null) {
5376
5619
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
5377
5620
  }
5378
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5379
- if (fromComputerUse != null) {
5380
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
5381
- }
5382
- const fromCodeExecution = getValueByPath(fromObject, [
5383
- 'codeExecution',
5384
- ]);
5385
- if (fromCodeExecution != null) {
5386
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
5387
- }
5388
5621
  return toObject;
5389
5622
  }
5390
5623
  function updateCachedContentConfigToMldev(fromObject, parentObject) {
@@ -6593,13 +6826,13 @@ class Files extends BaseModule {
6593
6826
  */
6594
6827
  function blobToMldev$2(fromObject) {
6595
6828
  const toObject = {};
6596
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
6597
- throw new Error('displayName parameter is not supported in Gemini API.');
6598
- }
6599
6829
  const fromData = getValueByPath(fromObject, ['data']);
6600
6830
  if (fromData != null) {
6601
6831
  setValueByPath(toObject, ['data'], fromData);
6602
6832
  }
6833
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
6834
+ throw new Error('displayName parameter is not supported in Gemini API.');
6835
+ }
6603
6836
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
6604
6837
  if (fromMimeType != null) {
6605
6838
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -6682,6 +6915,12 @@ function generationConfigToVertex$1(fromObject) {
6682
6915
  if (fromModelSelectionConfig != null) {
6683
6916
  setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
6684
6917
  }
6918
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
6919
+ 'responseJsonSchema',
6920
+ ]);
6921
+ if (fromResponseJsonSchema != null) {
6922
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6923
+ }
6685
6924
  const fromAudioTimestamp = getValueByPath(fromObject, [
6686
6925
  'audioTimestamp',
6687
6926
  ]);
@@ -6728,12 +6967,6 @@ function generationConfigToVertex$1(fromObject) {
6728
6967
  if (fromPresencePenalty != null) {
6729
6968
  setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
6730
6969
  }
6731
- const fromResponseJsonSchema = getValueByPath(fromObject, [
6732
- 'responseJsonSchema',
6733
- ]);
6734
- if (fromResponseJsonSchema != null) {
6735
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6736
- }
6737
6970
  const fromResponseLogprobs = getValueByPath(fromObject, [
6738
6971
  'responseLogprobs',
6739
6972
  ]);
@@ -6815,15 +7048,18 @@ function googleMapsToMldev$2(fromObject) {
6815
7048
  }
6816
7049
  function googleSearchToMldev$2(fromObject) {
6817
7050
  const toObject = {};
7051
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
7052
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
7053
+ }
7054
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
7055
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
7056
+ }
6818
7057
  const fromTimeRangeFilter = getValueByPath(fromObject, [
6819
7058
  'timeRangeFilter',
6820
7059
  ]);
6821
7060
  if (fromTimeRangeFilter != null) {
6822
7061
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
6823
7062
  }
6824
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
6825
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
6826
- }
6827
7063
  return toObject;
6828
7064
  }
6829
7065
  function liveConnectConfigToMldev$1(fromObject, parentObject) {
@@ -7224,30 +7460,6 @@ function liveServerMessageFromVertex(fromObject) {
7224
7460
  }
7225
7461
  function partToMldev$2(fromObject) {
7226
7462
  const toObject = {};
7227
- const fromVideoMetadata = getValueByPath(fromObject, [
7228
- 'videoMetadata',
7229
- ]);
7230
- if (fromVideoMetadata != null) {
7231
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
7232
- }
7233
- const fromThought = getValueByPath(fromObject, ['thought']);
7234
- if (fromThought != null) {
7235
- setValueByPath(toObject, ['thought'], fromThought);
7236
- }
7237
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
7238
- if (fromInlineData != null) {
7239
- setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
7240
- }
7241
- const fromFileData = getValueByPath(fromObject, ['fileData']);
7242
- if (fromFileData != null) {
7243
- setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7244
- }
7245
- const fromThoughtSignature = getValueByPath(fromObject, [
7246
- 'thoughtSignature',
7247
- ]);
7248
- if (fromThoughtSignature != null) {
7249
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7250
- }
7251
7463
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
7252
7464
  if (fromFunctionCall != null) {
7253
7465
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -7264,16 +7476,40 @@ function partToMldev$2(fromObject) {
7264
7476
  if (fromExecutableCode != null) {
7265
7477
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
7266
7478
  }
7479
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
7480
+ if (fromFileData != null) {
7481
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
7482
+ }
7267
7483
  const fromFunctionResponse = getValueByPath(fromObject, [
7268
7484
  'functionResponse',
7269
7485
  ]);
7270
7486
  if (fromFunctionResponse != null) {
7271
7487
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
7272
7488
  }
7489
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
7490
+ if (fromInlineData != null) {
7491
+ setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
7492
+ }
7273
7493
  const fromText = getValueByPath(fromObject, ['text']);
7274
7494
  if (fromText != null) {
7275
7495
  setValueByPath(toObject, ['text'], fromText);
7276
7496
  }
7497
+ const fromThought = getValueByPath(fromObject, ['thought']);
7498
+ if (fromThought != null) {
7499
+ setValueByPath(toObject, ['thought'], fromThought);
7500
+ }
7501
+ const fromThoughtSignature = getValueByPath(fromObject, [
7502
+ 'thoughtSignature',
7503
+ ]);
7504
+ if (fromThoughtSignature != null) {
7505
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
7506
+ }
7507
+ const fromVideoMetadata = getValueByPath(fromObject, [
7508
+ 'videoMetadata',
7509
+ ]);
7510
+ if (fromVideoMetadata != null) {
7511
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
7512
+ }
7277
7513
  return toObject;
7278
7514
  }
7279
7515
  function sessionResumptionConfigToMldev$1(fromObject) {
@@ -7289,6 +7525,10 @@ function sessionResumptionConfigToMldev$1(fromObject) {
7289
7525
  }
7290
7526
  function speechConfigToVertex$1(fromObject) {
7291
7527
  const toObject = {};
7528
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7529
+ if (fromLanguageCode != null) {
7530
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7531
+ }
7292
7532
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
7293
7533
  if (fromVoiceConfig != null) {
7294
7534
  setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
@@ -7296,10 +7536,6 @@ function speechConfigToVertex$1(fromObject) {
7296
7536
  if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
7297
7537
  throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
7298
7538
  }
7299
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
7300
- if (fromLanguageCode != null) {
7301
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
7302
- }
7303
7539
  return toObject;
7304
7540
  }
7305
7541
  function toolToMldev$2(fromObject) {
@@ -7319,16 +7555,26 @@ function toolToMldev$2(fromObject) {
7319
7555
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
7320
7556
  throw new Error('retrieval parameter is not supported in Gemini API.');
7321
7557
  }
7322
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7323
- if (fromGoogleSearch != null) {
7324
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
7325
- }
7326
7558
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7327
7559
  'googleSearchRetrieval',
7328
7560
  ]);
7329
7561
  if (fromGoogleSearchRetrieval != null) {
7330
7562
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7331
7563
  }
7564
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7565
+ if (fromComputerUse != null) {
7566
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
7567
+ }
7568
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
7569
+ if (fromFileSearch != null) {
7570
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
7571
+ }
7572
+ const fromCodeExecution = getValueByPath(fromObject, [
7573
+ 'codeExecution',
7574
+ ]);
7575
+ if (fromCodeExecution != null) {
7576
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7577
+ }
7332
7578
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7333
7579
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
7334
7580
  }
@@ -7336,20 +7582,14 @@ function toolToMldev$2(fromObject) {
7336
7582
  if (fromGoogleMaps != null) {
7337
7583
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
7338
7584
  }
7585
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7586
+ if (fromGoogleSearch != null) {
7587
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
7588
+ }
7339
7589
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7340
7590
  if (fromUrlContext != null) {
7341
7591
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
7342
7592
  }
7343
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7344
- if (fromComputerUse != null) {
7345
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
7346
- }
7347
- const fromCodeExecution = getValueByPath(fromObject, [
7348
- 'codeExecution',
7349
- ]);
7350
- if (fromCodeExecution != null) {
7351
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7352
- }
7353
7593
  return toObject;
7354
7594
  }
7355
7595
  function toolToVertex$1(fromObject) {
@@ -7370,16 +7610,25 @@ function toolToVertex$1(fromObject) {
7370
7610
  if (fromRetrieval != null) {
7371
7611
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
7372
7612
  }
7373
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7374
- if (fromGoogleSearch != null) {
7375
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
7376
- }
7377
7613
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
7378
7614
  'googleSearchRetrieval',
7379
7615
  ]);
7380
7616
  if (fromGoogleSearchRetrieval != null) {
7381
7617
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7382
7618
  }
7619
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7620
+ if (fromComputerUse != null) {
7621
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
7622
+ }
7623
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
7624
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
7625
+ }
7626
+ const fromCodeExecution = getValueByPath(fromObject, [
7627
+ 'codeExecution',
7628
+ ]);
7629
+ if (fromCodeExecution != null) {
7630
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7631
+ }
7383
7632
  const fromEnterpriseWebSearch = getValueByPath(fromObject, [
7384
7633
  'enterpriseWebSearch',
7385
7634
  ]);
@@ -7390,20 +7639,14 @@ function toolToVertex$1(fromObject) {
7390
7639
  if (fromGoogleMaps != null) {
7391
7640
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
7392
7641
  }
7642
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7643
+ if (fromGoogleSearch != null) {
7644
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
7645
+ }
7393
7646
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
7394
7647
  if (fromUrlContext != null) {
7395
7648
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
7396
7649
  }
7397
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7398
- if (fromComputerUse != null) {
7399
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
7400
- }
7401
- const fromCodeExecution = getValueByPath(fromObject, [
7402
- 'codeExecution',
7403
- ]);
7404
- if (fromCodeExecution != null) {
7405
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
7406
- }
7407
7650
  return toObject;
7408
7651
  }
7409
7652
  function usageMetadataFromVertex(fromObject) {
@@ -7506,13 +7749,13 @@ function usageMetadataFromVertex(fromObject) {
7506
7749
  */
7507
7750
  function blobToMldev$1(fromObject) {
7508
7751
  const toObject = {};
7509
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7510
- throw new Error('displayName parameter is not supported in Gemini API.');
7511
- }
7512
7752
  const fromData = getValueByPath(fromObject, ['data']);
7513
7753
  if (fromData != null) {
7514
7754
  setValueByPath(toObject, ['data'], fromData);
7515
7755
  }
7756
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
7757
+ throw new Error('displayName parameter is not supported in Gemini API.');
7758
+ }
7516
7759
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
7517
7760
  if (fromMimeType != null) {
7518
7761
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -7539,12 +7782,6 @@ function candidateFromMldev(fromObject) {
7539
7782
  if (fromFinishReason != null) {
7540
7783
  setValueByPath(toObject, ['finishReason'], fromFinishReason);
7541
7784
  }
7542
- const fromUrlContextMetadata = getValueByPath(fromObject, [
7543
- 'urlContextMetadata',
7544
- ]);
7545
- if (fromUrlContextMetadata != null) {
7546
- setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
7547
- }
7548
7785
  const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
7549
7786
  if (fromAvgLogprobs != null) {
7550
7787
  setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
@@ -7577,6 +7814,12 @@ function candidateFromMldev(fromObject) {
7577
7814
  }
7578
7815
  setValueByPath(toObject, ['safetyRatings'], transformedList);
7579
7816
  }
7817
+ const fromUrlContextMetadata = getValueByPath(fromObject, [
7818
+ 'urlContextMetadata',
7819
+ ]);
7820
+ if (fromUrlContextMetadata != null) {
7821
+ setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
7822
+ }
7580
7823
  return toObject;
7581
7824
  }
7582
7825
  function citationMetadataFromMldev(fromObject) {
@@ -9345,6 +9588,12 @@ function generationConfigToVertex(fromObject) {
9345
9588
  if (fromModelSelectionConfig != null) {
9346
9589
  setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
9347
9590
  }
9591
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
9592
+ 'responseJsonSchema',
9593
+ ]);
9594
+ if (fromResponseJsonSchema != null) {
9595
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9596
+ }
9348
9597
  const fromAudioTimestamp = getValueByPath(fromObject, [
9349
9598
  'audioTimestamp',
9350
9599
  ]);
@@ -9391,12 +9640,6 @@ function generationConfigToVertex(fromObject) {
9391
9640
  if (fromPresencePenalty != null) {
9392
9641
  setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
9393
9642
  }
9394
- const fromResponseJsonSchema = getValueByPath(fromObject, [
9395
- 'responseJsonSchema',
9396
- ]);
9397
- if (fromResponseJsonSchema != null) {
9398
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9399
- }
9400
9643
  const fromResponseLogprobs = getValueByPath(fromObject, [
9401
9644
  'responseLogprobs',
9402
9645
  ]);
@@ -9494,15 +9737,18 @@ function googleMapsToMldev$1(fromObject) {
9494
9737
  }
9495
9738
  function googleSearchToMldev$1(fromObject) {
9496
9739
  const toObject = {};
9740
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9741
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
9742
+ }
9743
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
9744
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
9745
+ }
9497
9746
  const fromTimeRangeFilter = getValueByPath(fromObject, [
9498
9747
  'timeRangeFilter',
9499
9748
  ]);
9500
9749
  if (fromTimeRangeFilter != null) {
9501
9750
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
9502
9751
  }
9503
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9504
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
9505
- }
9506
9752
  return toObject;
9507
9753
  }
9508
9754
  function imageFromMldev(fromObject) {
@@ -9792,30 +10038,6 @@ function modelFromVertex(fromObject) {
9792
10038
  }
9793
10039
  function partToMldev$1(fromObject) {
9794
10040
  const toObject = {};
9795
- const fromVideoMetadata = getValueByPath(fromObject, [
9796
- 'videoMetadata',
9797
- ]);
9798
- if (fromVideoMetadata != null) {
9799
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
9800
- }
9801
- const fromThought = getValueByPath(fromObject, ['thought']);
9802
- if (fromThought != null) {
9803
- setValueByPath(toObject, ['thought'], fromThought);
9804
- }
9805
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
9806
- if (fromInlineData != null) {
9807
- setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
9808
- }
9809
- const fromFileData = getValueByPath(fromObject, ['fileData']);
9810
- if (fromFileData != null) {
9811
- setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
9812
- }
9813
- const fromThoughtSignature = getValueByPath(fromObject, [
9814
- 'thoughtSignature',
9815
- ]);
9816
- if (fromThoughtSignature != null) {
9817
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
9818
- }
9819
10041
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
9820
10042
  if (fromFunctionCall != null) {
9821
10043
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -9832,16 +10054,40 @@ function partToMldev$1(fromObject) {
9832
10054
  if (fromExecutableCode != null) {
9833
10055
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
9834
10056
  }
10057
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
10058
+ if (fromFileData != null) {
10059
+ setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
10060
+ }
9835
10061
  const fromFunctionResponse = getValueByPath(fromObject, [
9836
10062
  'functionResponse',
9837
10063
  ]);
9838
10064
  if (fromFunctionResponse != null) {
9839
10065
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
9840
10066
  }
10067
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
10068
+ if (fromInlineData != null) {
10069
+ setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
10070
+ }
9841
10071
  const fromText = getValueByPath(fromObject, ['text']);
9842
10072
  if (fromText != null) {
9843
10073
  setValueByPath(toObject, ['text'], fromText);
9844
10074
  }
10075
+ const fromThought = getValueByPath(fromObject, ['thought']);
10076
+ if (fromThought != null) {
10077
+ setValueByPath(toObject, ['thought'], fromThought);
10078
+ }
10079
+ const fromThoughtSignature = getValueByPath(fromObject, [
10080
+ 'thoughtSignature',
10081
+ ]);
10082
+ if (fromThoughtSignature != null) {
10083
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
10084
+ }
10085
+ const fromVideoMetadata = getValueByPath(fromObject, [
10086
+ 'videoMetadata',
10087
+ ]);
10088
+ if (fromVideoMetadata != null) {
10089
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
10090
+ }
9845
10091
  return toObject;
9846
10092
  }
9847
10093
  function productImageToVertex(fromObject) {
@@ -10058,13 +10304,13 @@ function safetyAttributesFromVertex(fromObject) {
10058
10304
  }
10059
10305
  function safetySettingToMldev(fromObject) {
10060
10306
  const toObject = {};
10061
- if (getValueByPath(fromObject, ['method']) !== undefined) {
10062
- throw new Error('method parameter is not supported in Gemini API.');
10063
- }
10064
10307
  const fromCategory = getValueByPath(fromObject, ['category']);
10065
10308
  if (fromCategory != null) {
10066
10309
  setValueByPath(toObject, ['category'], fromCategory);
10067
10310
  }
10311
+ if (getValueByPath(fromObject, ['method']) !== undefined) {
10312
+ throw new Error('method parameter is not supported in Gemini API.');
10313
+ }
10068
10314
  const fromThreshold = getValueByPath(fromObject, ['threshold']);
10069
10315
  if (fromThreshold != null) {
10070
10316
  setValueByPath(toObject, ['threshold'], fromThreshold);
@@ -10163,6 +10409,10 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
10163
10409
  }
10164
10410
  function speechConfigToVertex(fromObject) {
10165
10411
  const toObject = {};
10412
+ const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
10413
+ if (fromLanguageCode != null) {
10414
+ setValueByPath(toObject, ['languageCode'], fromLanguageCode);
10415
+ }
10166
10416
  const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
10167
10417
  if (fromVoiceConfig != null) {
10168
10418
  setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
@@ -10170,10 +10420,6 @@ function speechConfigToVertex(fromObject) {
10170
10420
  if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
10171
10421
  throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
10172
10422
  }
10173
- const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
10174
- if (fromLanguageCode != null) {
10175
- setValueByPath(toObject, ['languageCode'], fromLanguageCode);
10176
- }
10177
10423
  return toObject;
10178
10424
  }
10179
10425
  function toolToMldev$1(fromObject) {
@@ -10193,16 +10439,26 @@ function toolToMldev$1(fromObject) {
10193
10439
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
10194
10440
  throw new Error('retrieval parameter is not supported in Gemini API.');
10195
10441
  }
10196
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10197
- if (fromGoogleSearch != null) {
10198
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
10199
- }
10200
10442
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10201
10443
  'googleSearchRetrieval',
10202
10444
  ]);
10203
10445
  if (fromGoogleSearchRetrieval != null) {
10204
10446
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10205
10447
  }
10448
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10449
+ if (fromComputerUse != null) {
10450
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
10451
+ }
10452
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
10453
+ if (fromFileSearch != null) {
10454
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
10455
+ }
10456
+ const fromCodeExecution = getValueByPath(fromObject, [
10457
+ 'codeExecution',
10458
+ ]);
10459
+ if (fromCodeExecution != null) {
10460
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10461
+ }
10206
10462
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10207
10463
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10208
10464
  }
@@ -10210,20 +10466,14 @@ function toolToMldev$1(fromObject) {
10210
10466
  if (fromGoogleMaps != null) {
10211
10467
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10212
10468
  }
10469
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10470
+ if (fromGoogleSearch != null) {
10471
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
10472
+ }
10213
10473
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10214
10474
  if (fromUrlContext != null) {
10215
10475
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
10216
10476
  }
10217
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10218
- if (fromComputerUse != null) {
10219
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10220
- }
10221
- const fromCodeExecution = getValueByPath(fromObject, [
10222
- 'codeExecution',
10223
- ]);
10224
- if (fromCodeExecution != null) {
10225
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10226
- }
10227
10477
  return toObject;
10228
10478
  }
10229
10479
  function toolToVertex(fromObject) {
@@ -10244,16 +10494,25 @@ function toolToVertex(fromObject) {
10244
10494
  if (fromRetrieval != null) {
10245
10495
  setValueByPath(toObject, ['retrieval'], fromRetrieval);
10246
10496
  }
10247
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10248
- if (fromGoogleSearch != null) {
10249
- setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
10250
- }
10251
10497
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
10252
10498
  'googleSearchRetrieval',
10253
10499
  ]);
10254
10500
  if (fromGoogleSearchRetrieval != null) {
10255
10501
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10256
10502
  }
10503
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10504
+ if (fromComputerUse != null) {
10505
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
10506
+ }
10507
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
10508
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
10509
+ }
10510
+ const fromCodeExecution = getValueByPath(fromObject, [
10511
+ 'codeExecution',
10512
+ ]);
10513
+ if (fromCodeExecution != null) {
10514
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10515
+ }
10257
10516
  const fromEnterpriseWebSearch = getValueByPath(fromObject, [
10258
10517
  'enterpriseWebSearch',
10259
10518
  ]);
@@ -10264,20 +10523,14 @@ function toolToVertex(fromObject) {
10264
10523
  if (fromGoogleMaps != null) {
10265
10524
  setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
10266
10525
  }
10526
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10527
+ if (fromGoogleSearch != null) {
10528
+ setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
10529
+ }
10267
10530
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
10268
10531
  if (fromUrlContext != null) {
10269
10532
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
10270
10533
  }
10271
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10272
- if (fromComputerUse != null) {
10273
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
10274
- }
10275
- const fromCodeExecution = getValueByPath(fromObject, [
10276
- 'codeExecution',
10277
- ]);
10278
- if (fromCodeExecution != null) {
10279
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
10280
- }
10281
10534
  return toObject;
10282
10535
  }
10283
10536
  function tunedModelInfoFromMldev(fromObject) {
@@ -10381,6 +10634,18 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
10381
10634
  if (parentObject !== undefined && fromOutputGcsUri != null) {
10382
10635
  setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
10383
10636
  }
10637
+ const fromSafetyFilterLevel = getValueByPath(fromObject, [
10638
+ 'safetyFilterLevel',
10639
+ ]);
10640
+ if (parentObject !== undefined && fromSafetyFilterLevel != null) {
10641
+ setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
10642
+ }
10643
+ const fromPersonGeneration = getValueByPath(fromObject, [
10644
+ 'personGeneration',
10645
+ ]);
10646
+ if (parentObject !== undefined && fromPersonGeneration != null) {
10647
+ setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
10648
+ }
10384
10649
  const fromIncludeRaiReason = getValueByPath(fromObject, [
10385
10650
  'includeRaiReason',
10386
10651
  ]);
@@ -10587,7 +10852,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10587
10852
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10588
10853
  const USER_AGENT_HEADER = 'User-Agent';
10589
10854
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10590
- const SDK_VERSION = '1.27.0'; // x-release-please-version
10855
+ const SDK_VERSION = '1.29.0'; // x-release-please-version
10591
10856
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10592
10857
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10593
10858
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -10965,13 +11230,22 @@ class ApiClient {
10965
11230
  await this.clientOptions.auth.addAuthHeaders(headers, url);
10966
11231
  return headers;
10967
11232
  }
11233
+ getFileName(file) {
11234
+ var _a;
11235
+ let fileName = '';
11236
+ if (typeof file === 'string') {
11237
+ fileName = file.replace(/[/\\]+$/, '');
11238
+ fileName = (_a = fileName.split(/[/\\]/).pop()) !== null && _a !== void 0 ? _a : '';
11239
+ }
11240
+ return fileName;
11241
+ }
10968
11242
  /**
10969
11243
  * Uploads a file asynchronously using Gemini API only, this is not supported
10970
11244
  * in Vertex AI.
10971
11245
  *
10972
11246
  * @param file The string path to the file to be uploaded or a Blob object.
10973
11247
  * @param config Optional parameters specified in the `UploadFileConfig`
10974
- * interface. @see {@link UploadFileConfig}
11248
+ * interface. @see {@link types.UploadFileConfig}
10975
11249
  * @return A promise that resolves to a `File` object.
10976
11250
  * @throws An error if called on a Vertex AI client.
10977
11251
  * @throws An error if the `mimeType` is not provided and can not be inferred,
@@ -10995,42 +11269,71 @@ class ApiClient {
10995
11269
  throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
10996
11270
  }
10997
11271
  fileToUpload.mimeType = mimeType;
10998
- const uploadUrl = await this.fetchUploadUrl(fileToUpload, config);
11272
+ const body = {
11273
+ file: fileToUpload,
11274
+ };
11275
+ const fileName = this.getFileName(file);
11276
+ const path = formatMap('upload/v1beta/files', body['_url']);
11277
+ const uploadUrl = await this.fetchUploadUrl(path, fileToUpload.sizeBytes, fileToUpload.mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
10999
11278
  return uploader.upload(file, uploadUrl, this);
11000
11279
  }
11280
+ /**
11281
+ * Uploads a file to a given file search store asynchronously using Gemini API only, this is not supported
11282
+ * in Vertex AI.
11283
+ *
11284
+ * @param fileSearchStoreName The name of the file search store to upload the file to.
11285
+ * @param file The string path to the file to be uploaded or a Blob object.
11286
+ * @param config Optional parameters specified in the `UploadFileConfig`
11287
+ * interface. @see {@link UploadFileConfig}
11288
+ * @return A promise that resolves to a `File` object.
11289
+ * @throws An error if called on a Vertex AI client.
11290
+ * @throws An error if the `mimeType` is not provided and can not be inferred,
11291
+ */
11292
+ async uploadFileToFileSearchStore(fileSearchStoreName, file, config) {
11293
+ var _a;
11294
+ const uploader = this.clientOptions.uploader;
11295
+ const fileStat = await uploader.stat(file);
11296
+ const sizeBytes = String(fileStat.size);
11297
+ const mimeType = (_a = config === null || config === void 0 ? void 0 : config.mimeType) !== null && _a !== void 0 ? _a : fileStat.type;
11298
+ if (mimeType === undefined || mimeType === '') {
11299
+ throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
11300
+ }
11301
+ const path = `upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`;
11302
+ const fileName = this.getFileName(file);
11303
+ const body = {};
11304
+ if (config === null || config === void 0 ? void 0 : config.customMetadata) {
11305
+ body['customMetadata'] = config.customMetadata;
11306
+ }
11307
+ if (config === null || config === void 0 ? void 0 : config.chunkingConfig) {
11308
+ body['chunkingConfig'] = config.chunkingConfig;
11309
+ }
11310
+ const uploadUrl = await this.fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
11311
+ return uploader.uploadToFileSearchStore(file, uploadUrl, this);
11312
+ }
11001
11313
  /**
11002
11314
  * Downloads a file asynchronously to the specified path.
11003
11315
  *
11004
11316
  * @params params - The parameters for the download request, see {@link
11005
- * DownloadFileParameters}
11317
+ * types.DownloadFileParameters}
11006
11318
  */
11007
11319
  async downloadFile(params) {
11008
11320
  const downloader = this.clientOptions.downloader;
11009
11321
  await downloader.download(params, this);
11010
11322
  }
11011
- async fetchUploadUrl(file, config) {
11323
+ async fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, configHttpOptions) {
11012
11324
  var _a;
11013
11325
  let httpOptions = {};
11014
- if (config === null || config === void 0 ? void 0 : config.httpOptions) {
11015
- httpOptions = config.httpOptions;
11326
+ if (configHttpOptions) {
11327
+ httpOptions = configHttpOptions;
11016
11328
  }
11017
11329
  else {
11018
11330
  httpOptions = {
11019
11331
  apiVersion: '',
11020
- headers: {
11021
- 'Content-Type': 'application/json',
11022
- 'X-Goog-Upload-Protocol': 'resumable',
11023
- 'X-Goog-Upload-Command': 'start',
11024
- 'X-Goog-Upload-Header-Content-Length': `${file.sizeBytes}`,
11025
- 'X-Goog-Upload-Header-Content-Type': `${file.mimeType}`,
11026
- },
11332
+ 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 } : {})),
11027
11333
  };
11028
11334
  }
11029
- const body = {
11030
- 'file': file,
11031
- };
11032
11335
  const httpResponse = await this.request({
11033
- path: formatMap('upload/v1beta/files', body['_url']),
11336
+ path,
11034
11337
  body: JSON.stringify(body),
11035
11338
  httpMethod: 'POST',
11036
11339
  httpOptions,
@@ -12034,11 +12337,27 @@ function hasCallableTools(params) {
12034
12337
  var _a, _b, _c;
12035
12338
  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;
12036
12339
  }
12037
- // Checks whether the list of tools contains any non-callable tools. Will return
12038
- // true if there is at least one non-Callable tool.
12039
- function hasNonCallableTools(params) {
12040
- var _a, _b, _c;
12041
- 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;
12340
+ /**
12341
+ * Returns the indexes of the tools that are not compatible with AFC.
12342
+ */
12343
+ function findAfcIncompatibleToolIndexes(params) {
12344
+ var _a;
12345
+ // Use number[] for an array of numbers in TypeScript
12346
+ const afcIncompatibleToolIndexes = [];
12347
+ if (!((_a = params === null || params === void 0 ? void 0 : params.config) === null || _a === void 0 ? void 0 : _a.tools)) {
12348
+ return afcIncompatibleToolIndexes;
12349
+ }
12350
+ params.config.tools.forEach((tool, index) => {
12351
+ if (isCallableTool(tool)) {
12352
+ return;
12353
+ }
12354
+ const geminiTool = tool;
12355
+ if (geminiTool.functionDeclarations &&
12356
+ geminiTool.functionDeclarations.length > 0) {
12357
+ afcIncompatibleToolIndexes.push(index);
12358
+ }
12359
+ });
12360
+ return afcIncompatibleToolIndexes;
12042
12361
  }
12043
12362
  /**
12044
12363
  * Returns whether to append automatic function calling history to the
@@ -12103,8 +12422,12 @@ class Models extends BaseModule {
12103
12422
  if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
12104
12423
  return await this.generateContentInternal(transformedParams);
12105
12424
  }
12106
- if (hasNonCallableTools(params)) {
12107
- throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
12425
+ const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
12426
+ if (incompatibleToolIndexes.length > 0) {
12427
+ const formattedIndexes = incompatibleToolIndexes
12428
+ .map((index) => `tools[${index}]`)
12429
+ .join(', ');
12430
+ throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${formattedIndexes}.`);
12108
12431
  }
12109
12432
  let response;
12110
12433
  let functionResponseContent;
@@ -12191,9 +12514,14 @@ class Models extends BaseModule {
12191
12514
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
12192
12515
  return await this.generateContentStreamInternal(transformedParams);
12193
12516
  }
12194
- else {
12195
- return await this.processAfcStream(params);
12517
+ const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
12518
+ if (incompatibleToolIndexes.length > 0) {
12519
+ const formattedIndexes = incompatibleToolIndexes
12520
+ .map((index) => `tools[${index}]`)
12521
+ .join(', ');
12522
+ throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
12196
12523
  }
12524
+ return await this.processAfcStream(params);
12197
12525
  };
12198
12526
  /**
12199
12527
  * Generates an image based on a text description and configuration.
@@ -13589,7 +13917,7 @@ class Operations extends BaseModule {
13589
13917
  });
13590
13918
  return operation._fromAPIResponse({
13591
13919
  apiResponse: rawOperation,
13592
- isVertexAI: true,
13920
+ _isVertexAI: true,
13593
13921
  });
13594
13922
  }
13595
13923
  else {
@@ -13599,7 +13927,7 @@ class Operations extends BaseModule {
13599
13927
  });
13600
13928
  return operation._fromAPIResponse({
13601
13929
  apiResponse: rawOperation,
13602
- isVertexAI: false,
13930
+ _isVertexAI: false,
13603
13931
  });
13604
13932
  }
13605
13933
  }
@@ -13628,7 +13956,7 @@ class Operations extends BaseModule {
13628
13956
  });
13629
13957
  return operation._fromAPIResponse({
13630
13958
  apiResponse: rawOperation,
13631
- isVertexAI: true,
13959
+ _isVertexAI: true,
13632
13960
  });
13633
13961
  }
13634
13962
  else {
@@ -13638,7 +13966,7 @@ class Operations extends BaseModule {
13638
13966
  });
13639
13967
  return operation._fromAPIResponse({
13640
13968
  apiResponse: rawOperation,
13641
- isVertexAI: false,
13969
+ _isVertexAI: false,
13642
13970
  });
13643
13971
  }
13644
13972
  }
@@ -13726,13 +14054,13 @@ class Operations extends BaseModule {
13726
14054
  */
13727
14055
  function blobToMldev(fromObject) {
13728
14056
  const toObject = {};
13729
- if (getValueByPath(fromObject, ['displayName']) !== undefined) {
13730
- throw new Error('displayName parameter is not supported in Gemini API.');
13731
- }
13732
14057
  const fromData = getValueByPath(fromObject, ['data']);
13733
14058
  if (fromData != null) {
13734
14059
  setValueByPath(toObject, ['data'], fromData);
13735
14060
  }
14061
+ if (getValueByPath(fromObject, ['displayName']) !== undefined) {
14062
+ throw new Error('displayName parameter is not supported in Gemini API.');
14063
+ }
13736
14064
  const fromMimeType = getValueByPath(fromObject, ['mimeType']);
13737
14065
  if (fromMimeType != null) {
13738
14066
  setValueByPath(toObject, ['mimeType'], fromMimeType);
@@ -13823,15 +14151,18 @@ function googleMapsToMldev(fromObject) {
13823
14151
  }
13824
14152
  function googleSearchToMldev(fromObject) {
13825
14153
  const toObject = {};
14154
+ if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
14155
+ throw new Error('excludeDomains parameter is not supported in Gemini API.');
14156
+ }
14157
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
14158
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
14159
+ }
13826
14160
  const fromTimeRangeFilter = getValueByPath(fromObject, [
13827
14161
  'timeRangeFilter',
13828
14162
  ]);
13829
14163
  if (fromTimeRangeFilter != null) {
13830
14164
  setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
13831
14165
  }
13832
- if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13833
- throw new Error('excludeDomains parameter is not supported in Gemini API.');
13834
- }
13835
14166
  return toObject;
13836
14167
  }
13837
14168
  function liveConnectConfigToMldev(fromObject, parentObject) {
@@ -13958,30 +14289,6 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
13958
14289
  }
13959
14290
  function partToMldev(fromObject) {
13960
14291
  const toObject = {};
13961
- const fromVideoMetadata = getValueByPath(fromObject, [
13962
- 'videoMetadata',
13963
- ]);
13964
- if (fromVideoMetadata != null) {
13965
- setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
13966
- }
13967
- const fromThought = getValueByPath(fromObject, ['thought']);
13968
- if (fromThought != null) {
13969
- setValueByPath(toObject, ['thought'], fromThought);
13970
- }
13971
- const fromInlineData = getValueByPath(fromObject, ['inlineData']);
13972
- if (fromInlineData != null) {
13973
- setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
13974
- }
13975
- const fromFileData = getValueByPath(fromObject, ['fileData']);
13976
- if (fromFileData != null) {
13977
- setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
13978
- }
13979
- const fromThoughtSignature = getValueByPath(fromObject, [
13980
- 'thoughtSignature',
13981
- ]);
13982
- if (fromThoughtSignature != null) {
13983
- setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
13984
- }
13985
14292
  const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
13986
14293
  if (fromFunctionCall != null) {
13987
14294
  setValueByPath(toObject, ['functionCall'], fromFunctionCall);
@@ -13998,25 +14305,49 @@ function partToMldev(fromObject) {
13998
14305
  if (fromExecutableCode != null) {
13999
14306
  setValueByPath(toObject, ['executableCode'], fromExecutableCode);
14000
14307
  }
14308
+ const fromFileData = getValueByPath(fromObject, ['fileData']);
14309
+ if (fromFileData != null) {
14310
+ setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
14311
+ }
14001
14312
  const fromFunctionResponse = getValueByPath(fromObject, [
14002
14313
  'functionResponse',
14003
14314
  ]);
14004
14315
  if (fromFunctionResponse != null) {
14005
14316
  setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
14006
14317
  }
14318
+ const fromInlineData = getValueByPath(fromObject, ['inlineData']);
14319
+ if (fromInlineData != null) {
14320
+ setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
14321
+ }
14007
14322
  const fromText = getValueByPath(fromObject, ['text']);
14008
14323
  if (fromText != null) {
14009
14324
  setValueByPath(toObject, ['text'], fromText);
14010
14325
  }
14011
- return toObject;
14012
- }
14013
- function sessionResumptionConfigToMldev(fromObject) {
14014
- const toObject = {};
14015
- const fromHandle = getValueByPath(fromObject, ['handle']);
14016
- if (fromHandle != null) {
14017
- setValueByPath(toObject, ['handle'], fromHandle);
14326
+ const fromThought = getValueByPath(fromObject, ['thought']);
14327
+ if (fromThought != null) {
14328
+ setValueByPath(toObject, ['thought'], fromThought);
14018
14329
  }
14019
- if (getValueByPath(fromObject, ['transparent']) !== undefined) {
14330
+ const fromThoughtSignature = getValueByPath(fromObject, [
14331
+ 'thoughtSignature',
14332
+ ]);
14333
+ if (fromThoughtSignature != null) {
14334
+ setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
14335
+ }
14336
+ const fromVideoMetadata = getValueByPath(fromObject, [
14337
+ 'videoMetadata',
14338
+ ]);
14339
+ if (fromVideoMetadata != null) {
14340
+ setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
14341
+ }
14342
+ return toObject;
14343
+ }
14344
+ function sessionResumptionConfigToMldev(fromObject) {
14345
+ const toObject = {};
14346
+ const fromHandle = getValueByPath(fromObject, ['handle']);
14347
+ if (fromHandle != null) {
14348
+ setValueByPath(toObject, ['handle'], fromHandle);
14349
+ }
14350
+ if (getValueByPath(fromObject, ['transparent']) !== undefined) {
14020
14351
  throw new Error('transparent parameter is not supported in Gemini API.');
14021
14352
  }
14022
14353
  return toObject;
@@ -14038,16 +14369,26 @@ function toolToMldev(fromObject) {
14038
14369
  if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
14039
14370
  throw new Error('retrieval parameter is not supported in Gemini API.');
14040
14371
  }
14041
- const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14042
- if (fromGoogleSearch != null) {
14043
- setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
14044
- }
14045
14372
  const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
14046
14373
  'googleSearchRetrieval',
14047
14374
  ]);
14048
14375
  if (fromGoogleSearchRetrieval != null) {
14049
14376
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
14050
14377
  }
14378
+ const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
14379
+ if (fromComputerUse != null) {
14380
+ setValueByPath(toObject, ['computerUse'], fromComputerUse);
14381
+ }
14382
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
14383
+ if (fromFileSearch != null) {
14384
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
14385
+ }
14386
+ const fromCodeExecution = getValueByPath(fromObject, [
14387
+ 'codeExecution',
14388
+ ]);
14389
+ if (fromCodeExecution != null) {
14390
+ setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
14391
+ }
14051
14392
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
14052
14393
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
14053
14394
  }
@@ -14055,20 +14396,14 @@ function toolToMldev(fromObject) {
14055
14396
  if (fromGoogleMaps != null) {
14056
14397
  setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
14057
14398
  }
14399
+ const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14400
+ if (fromGoogleSearch != null) {
14401
+ setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
14402
+ }
14058
14403
  const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
14059
14404
  if (fromUrlContext != null) {
14060
14405
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
14061
14406
  }
14062
- const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
14063
- if (fromComputerUse != null) {
14064
- setValueByPath(toObject, ['computerUse'], fromComputerUse);
14065
- }
14066
- const fromCodeExecution = getValueByPath(fromObject, [
14067
- 'codeExecution',
14068
- ]);
14069
- if (fromCodeExecution != null) {
14070
- setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
14071
- }
14072
14407
  return toObject;
14073
14408
  }
14074
14409
 
@@ -14195,139 +14530,883 @@ function convertBidiSetupToTokenSetup(requestDict, config) {
14195
14530
  }
14196
14531
  }
14197
14532
  else {
14198
- // Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
14199
- // defaults apply or all are mutable). This is hit if:
14200
- // - `config.lockAdditionalFields` is undefined.
14201
- // - `config.lockAdditionalFields` is non-empty, BUT
14202
- // `preExistingFieldMask` is null, not a string, or an empty string.
14203
- delete requestDict['fieldMask'];
14533
+ // Case 3: "Lock all fields" (meaning, don't send a field_mask, let server
14534
+ // defaults apply or all are mutable). This is hit if:
14535
+ // - `config.lockAdditionalFields` is undefined.
14536
+ // - `config.lockAdditionalFields` is non-empty, BUT
14537
+ // `preExistingFieldMask` is null, not a string, or an empty string.
14538
+ delete requestDict['fieldMask'];
14539
+ }
14540
+ }
14541
+ else {
14542
+ // No valid `bidiGenerateContentSetup` was found or extracted.
14543
+ // "Lock additional null fields if any".
14544
+ if (preExistingFieldMask !== null &&
14545
+ Array.isArray(preExistingFieldMask) &&
14546
+ preExistingFieldMask.length > 0) {
14547
+ // If there's a pre-existing field mask, it's a string, and it's not
14548
+ // empty, then we should lock all fields.
14549
+ requestDict['fieldMask'] = preExistingFieldMask.join(',');
14550
+ }
14551
+ else {
14552
+ delete requestDict['fieldMask'];
14553
+ }
14554
+ }
14555
+ return requestDict;
14556
+ }
14557
+ class Tokens extends BaseModule {
14558
+ constructor(apiClient) {
14559
+ super();
14560
+ this.apiClient = apiClient;
14561
+ }
14562
+ /**
14563
+ * Creates an ephemeral auth token resource.
14564
+ *
14565
+ * @experimental
14566
+ *
14567
+ * @remarks
14568
+ * Ephemeral auth tokens is only supported in the Gemini Developer API.
14569
+ * It can be used for the session connection to the Live constrained API.
14570
+ * Support in v1alpha only.
14571
+ *
14572
+ * @param params - The parameters for the create request.
14573
+ * @return The created auth token.
14574
+ *
14575
+ * @example
14576
+ * ```ts
14577
+ * const ai = new GoogleGenAI({
14578
+ * apiKey: token.name,
14579
+ * httpOptions: { apiVersion: 'v1alpha' } // Support in v1alpha only.
14580
+ * });
14581
+ *
14582
+ * // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
14583
+ * // when using the token in Live API sessions. Each session connection can
14584
+ * // use a different configuration.
14585
+ * const config: CreateAuthTokenConfig = {
14586
+ * uses: 3,
14587
+ * expireTime: '2025-05-01T00:00:00Z',
14588
+ * }
14589
+ * const token = await ai.tokens.create(config);
14590
+ *
14591
+ * // Case 2: If LiveEphemeralParameters is set, lock all fields in
14592
+ * // LiveConnectConfig when using the token in Live API sessions. For
14593
+ * // example, changing `outputAudioTranscription` in the Live API
14594
+ * // connection will be ignored by the API.
14595
+ * const config: CreateAuthTokenConfig =
14596
+ * uses: 3,
14597
+ * expireTime: '2025-05-01T00:00:00Z',
14598
+ * LiveEphemeralParameters: {
14599
+ * model: 'gemini-2.0-flash-001',
14600
+ * config: {
14601
+ * 'responseModalities': ['AUDIO'],
14602
+ * 'systemInstruction': 'Always answer in English.',
14603
+ * }
14604
+ * }
14605
+ * }
14606
+ * const token = await ai.tokens.create(config);
14607
+ *
14608
+ * // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
14609
+ * // set, lock LiveConnectConfig with set and additional fields (e.g.
14610
+ * // responseModalities, systemInstruction, temperature in this example) when
14611
+ * // using the token in Live API sessions.
14612
+ * const config: CreateAuthTokenConfig =
14613
+ * uses: 3,
14614
+ * expireTime: '2025-05-01T00:00:00Z',
14615
+ * LiveEphemeralParameters: {
14616
+ * model: 'gemini-2.0-flash-001',
14617
+ * config: {
14618
+ * 'responseModalities': ['AUDIO'],
14619
+ * 'systemInstruction': 'Always answer in English.',
14620
+ * }
14621
+ * },
14622
+ * lockAdditionalFields: ['temperature'],
14623
+ * }
14624
+ * const token = await ai.tokens.create(config);
14625
+ *
14626
+ * // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
14627
+ * // empty array, lock LiveConnectConfig with set fields (e.g.
14628
+ * // responseModalities, systemInstruction in this example) when using the
14629
+ * // token in Live API sessions.
14630
+ * const config: CreateAuthTokenConfig =
14631
+ * uses: 3,
14632
+ * expireTime: '2025-05-01T00:00:00Z',
14633
+ * LiveEphemeralParameters: {
14634
+ * model: 'gemini-2.0-flash-001',
14635
+ * config: {
14636
+ * 'responseModalities': ['AUDIO'],
14637
+ * 'systemInstruction': 'Always answer in English.',
14638
+ * }
14639
+ * },
14640
+ * lockAdditionalFields: [],
14641
+ * }
14642
+ * const token = await ai.tokens.create(config);
14643
+ * ```
14644
+ */
14645
+ async create(params) {
14646
+ var _a, _b;
14647
+ let response;
14648
+ let path = '';
14649
+ let queryParams = {};
14650
+ if (this.apiClient.isVertexAI()) {
14651
+ throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
14652
+ }
14653
+ else {
14654
+ const body = createAuthTokenParametersToMldev(this.apiClient, params);
14655
+ path = formatMap('auth_tokens', body['_url']);
14656
+ queryParams = body['_query'];
14657
+ delete body['config'];
14658
+ delete body['_url'];
14659
+ delete body['_query'];
14660
+ const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
14661
+ response = this.apiClient
14662
+ .request({
14663
+ path: path,
14664
+ queryParams: queryParams,
14665
+ body: JSON.stringify(transformedBody),
14666
+ httpMethod: 'POST',
14667
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
14668
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
14669
+ })
14670
+ .then((httpResponse) => {
14671
+ return httpResponse.json();
14672
+ });
14673
+ return response.then((resp) => {
14674
+ return resp;
14675
+ });
14676
+ }
14677
+ }
14678
+ }
14679
+
14680
+ /**
14681
+ * @license
14682
+ * Copyright 2025 Google LLC
14683
+ * SPDX-License-Identifier: Apache-2.0
14684
+ */
14685
+ // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14686
+ function createFileSearchStoreConfigToMldev(fromObject, parentObject) {
14687
+ const toObject = {};
14688
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14689
+ if (parentObject !== undefined && fromDisplayName != null) {
14690
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
14691
+ }
14692
+ return toObject;
14693
+ }
14694
+ function createFileSearchStoreParametersToMldev(fromObject) {
14695
+ const toObject = {};
14696
+ const fromConfig = getValueByPath(fromObject, ['config']);
14697
+ if (fromConfig != null) {
14698
+ createFileSearchStoreConfigToMldev(fromConfig, toObject);
14699
+ }
14700
+ return toObject;
14701
+ }
14702
+ function deleteFileSearchStoreConfigToMldev(fromObject, parentObject) {
14703
+ const toObject = {};
14704
+ const fromForce = getValueByPath(fromObject, ['force']);
14705
+ if (parentObject !== undefined && fromForce != null) {
14706
+ setValueByPath(parentObject, ['_query', 'force'], fromForce);
14707
+ }
14708
+ return toObject;
14709
+ }
14710
+ function deleteFileSearchStoreParametersToMldev(fromObject) {
14711
+ const toObject = {};
14712
+ const fromName = getValueByPath(fromObject, ['name']);
14713
+ if (fromName != null) {
14714
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14715
+ }
14716
+ const fromConfig = getValueByPath(fromObject, ['config']);
14717
+ if (fromConfig != null) {
14718
+ deleteFileSearchStoreConfigToMldev(fromConfig, toObject);
14719
+ }
14720
+ return toObject;
14721
+ }
14722
+ function getFileSearchStoreParametersToMldev(fromObject) {
14723
+ const toObject = {};
14724
+ const fromName = getValueByPath(fromObject, ['name']);
14725
+ if (fromName != null) {
14726
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14727
+ }
14728
+ return toObject;
14729
+ }
14730
+ function importFileConfigToMldev(fromObject, parentObject) {
14731
+ const toObject = {};
14732
+ const fromCustomMetadata = getValueByPath(fromObject, [
14733
+ 'customMetadata',
14734
+ ]);
14735
+ if (parentObject !== undefined && fromCustomMetadata != null) {
14736
+ let transformedList = fromCustomMetadata;
14737
+ if (Array.isArray(transformedList)) {
14738
+ transformedList = transformedList.map((item) => {
14739
+ return item;
14740
+ });
14741
+ }
14742
+ setValueByPath(parentObject, ['customMetadata'], transformedList);
14743
+ }
14744
+ const fromChunkingConfig = getValueByPath(fromObject, [
14745
+ 'chunkingConfig',
14746
+ ]);
14747
+ if (parentObject !== undefined && fromChunkingConfig != null) {
14748
+ setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
14749
+ }
14750
+ return toObject;
14751
+ }
14752
+ function importFileOperationFromMldev(fromObject) {
14753
+ const toObject = {};
14754
+ const fromName = getValueByPath(fromObject, ['name']);
14755
+ if (fromName != null) {
14756
+ setValueByPath(toObject, ['name'], fromName);
14757
+ }
14758
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
14759
+ if (fromMetadata != null) {
14760
+ setValueByPath(toObject, ['metadata'], fromMetadata);
14761
+ }
14762
+ const fromDone = getValueByPath(fromObject, ['done']);
14763
+ if (fromDone != null) {
14764
+ setValueByPath(toObject, ['done'], fromDone);
14765
+ }
14766
+ const fromError = getValueByPath(fromObject, ['error']);
14767
+ if (fromError != null) {
14768
+ setValueByPath(toObject, ['error'], fromError);
14769
+ }
14770
+ const fromResponse = getValueByPath(fromObject, ['response']);
14771
+ if (fromResponse != null) {
14772
+ setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
14773
+ }
14774
+ return toObject;
14775
+ }
14776
+ function importFileParametersToMldev(fromObject) {
14777
+ const toObject = {};
14778
+ const fromFileSearchStoreName = getValueByPath(fromObject, [
14779
+ 'fileSearchStoreName',
14780
+ ]);
14781
+ if (fromFileSearchStoreName != null) {
14782
+ setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
14783
+ }
14784
+ const fromFileName = getValueByPath(fromObject, ['fileName']);
14785
+ if (fromFileName != null) {
14786
+ setValueByPath(toObject, ['fileName'], fromFileName);
14787
+ }
14788
+ const fromConfig = getValueByPath(fromObject, ['config']);
14789
+ if (fromConfig != null) {
14790
+ importFileConfigToMldev(fromConfig, toObject);
14791
+ }
14792
+ return toObject;
14793
+ }
14794
+ function importFileResponseFromMldev(fromObject) {
14795
+ const toObject = {};
14796
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14797
+ 'sdkHttpResponse',
14798
+ ]);
14799
+ if (fromSdkHttpResponse != null) {
14800
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14801
+ }
14802
+ const fromParent = getValueByPath(fromObject, ['parent']);
14803
+ if (fromParent != null) {
14804
+ setValueByPath(toObject, ['parent'], fromParent);
14805
+ }
14806
+ const fromDocumentName = getValueByPath(fromObject, ['documentName']);
14807
+ if (fromDocumentName != null) {
14808
+ setValueByPath(toObject, ['documentName'], fromDocumentName);
14809
+ }
14810
+ return toObject;
14811
+ }
14812
+ function listFileSearchStoresConfigToMldev(fromObject, parentObject) {
14813
+ const toObject = {};
14814
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14815
+ if (parentObject !== undefined && fromPageSize != null) {
14816
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
14817
+ }
14818
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
14819
+ if (parentObject !== undefined && fromPageToken != null) {
14820
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
14821
+ }
14822
+ return toObject;
14823
+ }
14824
+ function listFileSearchStoresParametersToMldev(fromObject) {
14825
+ const toObject = {};
14826
+ const fromConfig = getValueByPath(fromObject, ['config']);
14827
+ if (fromConfig != null) {
14828
+ listFileSearchStoresConfigToMldev(fromConfig, toObject);
14829
+ }
14830
+ return toObject;
14831
+ }
14832
+ function listFileSearchStoresResponseFromMldev(fromObject) {
14833
+ const toObject = {};
14834
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14835
+ 'sdkHttpResponse',
14836
+ ]);
14837
+ if (fromSdkHttpResponse != null) {
14838
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14839
+ }
14840
+ const fromNextPageToken = getValueByPath(fromObject, [
14841
+ 'nextPageToken',
14842
+ ]);
14843
+ if (fromNextPageToken != null) {
14844
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
14845
+ }
14846
+ const fromFileSearchStores = getValueByPath(fromObject, [
14847
+ 'fileSearchStores',
14848
+ ]);
14849
+ if (fromFileSearchStores != null) {
14850
+ let transformedList = fromFileSearchStores;
14851
+ if (Array.isArray(transformedList)) {
14852
+ transformedList = transformedList.map((item) => {
14853
+ return item;
14854
+ });
14855
+ }
14856
+ setValueByPath(toObject, ['fileSearchStores'], transformedList);
14857
+ }
14858
+ return toObject;
14859
+ }
14860
+ function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
14861
+ const toObject = {};
14862
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
14863
+ if (parentObject !== undefined && fromMimeType != null) {
14864
+ setValueByPath(parentObject, ['mimeType'], fromMimeType);
14865
+ }
14866
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14867
+ if (parentObject !== undefined && fromDisplayName != null) {
14868
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
14869
+ }
14870
+ const fromCustomMetadata = getValueByPath(fromObject, [
14871
+ 'customMetadata',
14872
+ ]);
14873
+ if (parentObject !== undefined && fromCustomMetadata != null) {
14874
+ let transformedList = fromCustomMetadata;
14875
+ if (Array.isArray(transformedList)) {
14876
+ transformedList = transformedList.map((item) => {
14877
+ return item;
14878
+ });
14879
+ }
14880
+ setValueByPath(parentObject, ['customMetadata'], transformedList);
14881
+ }
14882
+ const fromChunkingConfig = getValueByPath(fromObject, [
14883
+ 'chunkingConfig',
14884
+ ]);
14885
+ if (parentObject !== undefined && fromChunkingConfig != null) {
14886
+ setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
14887
+ }
14888
+ return toObject;
14889
+ }
14890
+ function uploadToFileSearchStoreParametersToMldev(fromObject) {
14891
+ const toObject = {};
14892
+ const fromFileSearchStoreName = getValueByPath(fromObject, [
14893
+ 'fileSearchStoreName',
14894
+ ]);
14895
+ if (fromFileSearchStoreName != null) {
14896
+ setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
14897
+ }
14898
+ const fromConfig = getValueByPath(fromObject, ['config']);
14899
+ if (fromConfig != null) {
14900
+ uploadToFileSearchStoreConfigToMldev(fromConfig, toObject);
14901
+ }
14902
+ return toObject;
14903
+ }
14904
+ function uploadToFileSearchStoreResumableResponseFromMldev(fromObject) {
14905
+ const toObject = {};
14906
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14907
+ 'sdkHttpResponse',
14908
+ ]);
14909
+ if (fromSdkHttpResponse != null) {
14910
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14911
+ }
14912
+ return toObject;
14913
+ }
14914
+
14915
+ /**
14916
+ * @license
14917
+ * Copyright 2025 Google LLC
14918
+ * SPDX-License-Identifier: Apache-2.0
14919
+ */
14920
+ // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14921
+ function deleteDocumentConfigToMldev(fromObject, parentObject) {
14922
+ const toObject = {};
14923
+ const fromForce = getValueByPath(fromObject, ['force']);
14924
+ if (parentObject !== undefined && fromForce != null) {
14925
+ setValueByPath(parentObject, ['_query', 'force'], fromForce);
14926
+ }
14927
+ return toObject;
14928
+ }
14929
+ function deleteDocumentParametersToMldev(fromObject) {
14930
+ const toObject = {};
14931
+ const fromName = getValueByPath(fromObject, ['name']);
14932
+ if (fromName != null) {
14933
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14934
+ }
14935
+ const fromConfig = getValueByPath(fromObject, ['config']);
14936
+ if (fromConfig != null) {
14937
+ deleteDocumentConfigToMldev(fromConfig, toObject);
14938
+ }
14939
+ return toObject;
14940
+ }
14941
+ function getDocumentParametersToMldev(fromObject) {
14942
+ const toObject = {};
14943
+ const fromName = getValueByPath(fromObject, ['name']);
14944
+ if (fromName != null) {
14945
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14946
+ }
14947
+ return toObject;
14948
+ }
14949
+ function listDocumentsConfigToMldev(fromObject, parentObject) {
14950
+ const toObject = {};
14951
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14952
+ if (parentObject !== undefined && fromPageSize != null) {
14953
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
14954
+ }
14955
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
14956
+ if (parentObject !== undefined && fromPageToken != null) {
14957
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
14958
+ }
14959
+ return toObject;
14960
+ }
14961
+ function listDocumentsParametersToMldev(fromObject) {
14962
+ const toObject = {};
14963
+ const fromParent = getValueByPath(fromObject, ['parent']);
14964
+ if (fromParent != null) {
14965
+ setValueByPath(toObject, ['_url', 'parent'], fromParent);
14966
+ }
14967
+ const fromConfig = getValueByPath(fromObject, ['config']);
14968
+ if (fromConfig != null) {
14969
+ listDocumentsConfigToMldev(fromConfig, toObject);
14970
+ }
14971
+ return toObject;
14972
+ }
14973
+ function listDocumentsResponseFromMldev(fromObject) {
14974
+ const toObject = {};
14975
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14976
+ 'sdkHttpResponse',
14977
+ ]);
14978
+ if (fromSdkHttpResponse != null) {
14979
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14980
+ }
14981
+ const fromNextPageToken = getValueByPath(fromObject, [
14982
+ 'nextPageToken',
14983
+ ]);
14984
+ if (fromNextPageToken != null) {
14985
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
14986
+ }
14987
+ const fromDocuments = getValueByPath(fromObject, ['documents']);
14988
+ if (fromDocuments != null) {
14989
+ let transformedList = fromDocuments;
14990
+ if (Array.isArray(transformedList)) {
14991
+ transformedList = transformedList.map((item) => {
14992
+ return item;
14993
+ });
14994
+ }
14995
+ setValueByPath(toObject, ['documents'], transformedList);
14996
+ }
14997
+ return toObject;
14998
+ }
14999
+
15000
+ /**
15001
+ * @license
15002
+ * Copyright 2025 Google LLC
15003
+ * SPDX-License-Identifier: Apache-2.0
15004
+ */
15005
+ class Documents extends BaseModule {
15006
+ constructor(apiClient) {
15007
+ super();
15008
+ this.apiClient = apiClient;
15009
+ /**
15010
+ * Lists documents.
15011
+ *
15012
+ * @param params - The parameters for the list request.
15013
+ * @return - A pager of documents.
15014
+ *
15015
+ * @example
15016
+ * ```ts
15017
+ * const documents = await ai.documents.list({config: {'pageSize': 2}});
15018
+ * for await (const document of documents) {
15019
+ * console.log(document);
15020
+ * }
15021
+ * ```
15022
+ */
15023
+ this.list = async (params) => {
15024
+ return new Pager(PagedItem.PAGED_ITEM_DOCUMENTS, (x) => this.listInternal({
15025
+ parent: params.parent,
15026
+ config: x.config,
15027
+ }), await this.listInternal(params), params);
15028
+ };
15029
+ }
15030
+ /**
15031
+ * Gets a Document.
15032
+ *
15033
+ * @param params - The parameters for getting a document.
15034
+ * @return Document.
15035
+ */
15036
+ async get(params) {
15037
+ var _a, _b;
15038
+ let response;
15039
+ let path = '';
15040
+ let queryParams = {};
15041
+ if (this.apiClient.isVertexAI()) {
15042
+ throw new Error('This method is only supported by the Gemini Developer API.');
15043
+ }
15044
+ else {
15045
+ const body = getDocumentParametersToMldev(params);
15046
+ path = formatMap('{name}', body['_url']);
15047
+ queryParams = body['_query'];
15048
+ delete body['_url'];
15049
+ delete body['_query'];
15050
+ response = this.apiClient
15051
+ .request({
15052
+ path: path,
15053
+ queryParams: queryParams,
15054
+ body: JSON.stringify(body),
15055
+ httpMethod: 'GET',
15056
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15057
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15058
+ })
15059
+ .then((httpResponse) => {
15060
+ return httpResponse.json();
15061
+ });
15062
+ return response.then((resp) => {
15063
+ return resp;
15064
+ });
15065
+ }
15066
+ }
15067
+ /**
15068
+ * Deletes a Document.
15069
+ *
15070
+ * @param params - The parameters for deleting a document.
15071
+ */
15072
+ async delete(params) {
15073
+ var _a, _b;
15074
+ let path = '';
15075
+ let queryParams = {};
15076
+ if (this.apiClient.isVertexAI()) {
15077
+ throw new Error('This method is only supported by the Gemini Developer API.');
15078
+ }
15079
+ else {
15080
+ const body = deleteDocumentParametersToMldev(params);
15081
+ path = formatMap('{name}', body['_url']);
15082
+ queryParams = body['_query'];
15083
+ delete body['_url'];
15084
+ delete body['_query'];
15085
+ await this.apiClient.request({
15086
+ path: path,
15087
+ queryParams: queryParams,
15088
+ body: JSON.stringify(body),
15089
+ httpMethod: 'DELETE',
15090
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15091
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15092
+ });
15093
+ }
15094
+ }
15095
+ /**
15096
+ * Lists all Documents in a FileSearchStore.
15097
+ *
15098
+ * @param params - The parameters for listing documents.
15099
+ * @return ListDocumentsResponse.
15100
+ */
15101
+ async listInternal(params) {
15102
+ var _a, _b;
15103
+ let response;
15104
+ let path = '';
15105
+ let queryParams = {};
15106
+ if (this.apiClient.isVertexAI()) {
15107
+ throw new Error('This method is only supported by the Gemini Developer API.');
15108
+ }
15109
+ else {
15110
+ const body = listDocumentsParametersToMldev(params);
15111
+ path = formatMap('{parent}/documents', body['_url']);
15112
+ queryParams = body['_query'];
15113
+ delete body['_url'];
15114
+ delete body['_query'];
15115
+ response = this.apiClient
15116
+ .request({
15117
+ path: path,
15118
+ queryParams: queryParams,
15119
+ body: JSON.stringify(body),
15120
+ httpMethod: 'GET',
15121
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15122
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15123
+ })
15124
+ .then((httpResponse) => {
15125
+ return httpResponse.json();
15126
+ });
15127
+ return response.then((apiResponse) => {
15128
+ const resp = listDocumentsResponseFromMldev(apiResponse);
15129
+ const typedResp = new ListDocumentsResponse();
15130
+ Object.assign(typedResp, resp);
15131
+ return typedResp;
15132
+ });
15133
+ }
15134
+ }
15135
+ }
15136
+
15137
+ /**
15138
+ * @license
15139
+ * Copyright 2025 Google LLC
15140
+ * SPDX-License-Identifier: Apache-2.0
15141
+ */
15142
+ class FileSearchStores extends BaseModule {
15143
+ constructor(apiClient, documents = new Documents(apiClient)) {
15144
+ super();
15145
+ this.apiClient = apiClient;
15146
+ this.documents = documents;
15147
+ /**
15148
+ * Lists file search stores.
15149
+ *
15150
+ * @param params - The parameters for the list request.
15151
+ * @return - A pager of file search stores.
15152
+ *
15153
+ * @example
15154
+ * ```ts
15155
+ * const fileSearchStores = await ai.fileSearchStores.list({config: {'pageSize': 2}});
15156
+ * for await (const fileSearchStore of fileSearchStores) {
15157
+ * console.log(fileSearchStore);
15158
+ * }
15159
+ * ```
15160
+ */
15161
+ this.list = async (params = {}) => {
15162
+ return new Pager(PagedItem.PAGED_ITEM_FILE_SEARCH_STORES, (x) => this.listInternal(x), await this.listInternal(params), params);
15163
+ };
15164
+ }
15165
+ /**
15166
+ * Uploads a file asynchronously to a given File Search Store.
15167
+ * This method is not available in Vertex AI.
15168
+ * Supported upload sources:
15169
+ * - Node.js: File path (string) or Blob object.
15170
+ * - Browser: Blob object (e.g., File).
15171
+ *
15172
+ * @remarks
15173
+ * The `mimeType` can be specified in the `config` parameter. If omitted:
15174
+ * - For file path (string) inputs, the `mimeType` will be inferred from the
15175
+ * file extension.
15176
+ * - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
15177
+ * property.
15178
+ *
15179
+ * This section can contain multiple paragraphs and code examples.
15180
+ *
15181
+ * @param params - Optional parameters specified in the
15182
+ * `types.UploadToFileSearchStoreParameters` interface.
15183
+ * @see {@link types.UploadToFileSearchStoreParameters#config} for the optional
15184
+ * config in the parameters.
15185
+ * @return A promise that resolves to a long running operation.
15186
+ * @throws An error if called on a Vertex AI client.
15187
+ * @throws An error if the `mimeType` is not provided and can not be inferred,
15188
+ * the `mimeType` can be provided in the `params.config` parameter.
15189
+ * @throws An error occurs if a suitable upload location cannot be established.
15190
+ *
15191
+ * @example
15192
+ * The following code uploads a file to a given file search store.
15193
+ *
15194
+ * ```ts
15195
+ * const operation = await ai.fileSearchStores.upload({fileSearchStoreName: 'fileSearchStores/foo-bar', file: 'file.txt', config: {
15196
+ * mimeType: 'text/plain',
15197
+ * }});
15198
+ * console.log(operation.name);
15199
+ * ```
15200
+ */
15201
+ async uploadToFileSearchStore(params) {
15202
+ if (this.apiClient.isVertexAI()) {
15203
+ throw new Error('Vertex AI does not support uploading files to a file search store.');
15204
+ }
15205
+ return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName, params.file, params.config);
15206
+ }
15207
+ /**
15208
+ * Creates a File Search Store.
15209
+ *
15210
+ * @param params - The parameters for creating a File Search Store.
15211
+ * @return FileSearchStore.
15212
+ */
15213
+ async create(params) {
15214
+ var _a, _b;
15215
+ let response;
15216
+ let path = '';
15217
+ let queryParams = {};
15218
+ if (this.apiClient.isVertexAI()) {
15219
+ throw new Error('This method is only supported by the Gemini Developer API.');
15220
+ }
15221
+ else {
15222
+ const body = createFileSearchStoreParametersToMldev(params);
15223
+ path = formatMap('fileSearchStores', body['_url']);
15224
+ queryParams = body['_query'];
15225
+ delete body['_url'];
15226
+ delete body['_query'];
15227
+ response = this.apiClient
15228
+ .request({
15229
+ path: path,
15230
+ queryParams: queryParams,
15231
+ body: JSON.stringify(body),
15232
+ httpMethod: 'POST',
15233
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15234
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15235
+ })
15236
+ .then((httpResponse) => {
15237
+ return httpResponse.json();
15238
+ });
15239
+ return response.then((resp) => {
15240
+ return resp;
15241
+ });
15242
+ }
15243
+ }
15244
+ /**
15245
+ * Gets a File Search Store.
15246
+ *
15247
+ * @param params - The parameters for getting a File Search Store.
15248
+ * @return FileSearchStore.
15249
+ */
15250
+ async get(params) {
15251
+ var _a, _b;
15252
+ let response;
15253
+ let path = '';
15254
+ let queryParams = {};
15255
+ if (this.apiClient.isVertexAI()) {
15256
+ throw new Error('This method is only supported by the Gemini Developer API.');
15257
+ }
15258
+ else {
15259
+ const body = getFileSearchStoreParametersToMldev(params);
15260
+ path = formatMap('{name}', body['_url']);
15261
+ queryParams = body['_query'];
15262
+ delete body['_url'];
15263
+ delete body['_query'];
15264
+ response = this.apiClient
15265
+ .request({
15266
+ path: path,
15267
+ queryParams: queryParams,
15268
+ body: JSON.stringify(body),
15269
+ httpMethod: 'GET',
15270
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15271
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15272
+ })
15273
+ .then((httpResponse) => {
15274
+ return httpResponse.json();
15275
+ });
15276
+ return response.then((resp) => {
15277
+ return resp;
15278
+ });
15279
+ }
15280
+ }
15281
+ /**
15282
+ * Deletes a File Search Store.
15283
+ *
15284
+ * @param params - The parameters for deleting a File Search Store.
15285
+ */
15286
+ async delete(params) {
15287
+ var _a, _b;
15288
+ let path = '';
15289
+ let queryParams = {};
15290
+ if (this.apiClient.isVertexAI()) {
15291
+ throw new Error('This method is only supported by the Gemini Developer API.');
15292
+ }
15293
+ else {
15294
+ const body = deleteFileSearchStoreParametersToMldev(params);
15295
+ path = formatMap('{name}', body['_url']);
15296
+ queryParams = body['_query'];
15297
+ delete body['_url'];
15298
+ delete body['_query'];
15299
+ await this.apiClient.request({
15300
+ path: path,
15301
+ queryParams: queryParams,
15302
+ body: JSON.stringify(body),
15303
+ httpMethod: 'DELETE',
15304
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15305
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15306
+ });
14204
15307
  }
14205
15308
  }
14206
- else {
14207
- // No valid `bidiGenerateContentSetup` was found or extracted.
14208
- // "Lock additional null fields if any".
14209
- if (preExistingFieldMask !== null &&
14210
- Array.isArray(preExistingFieldMask) &&
14211
- preExistingFieldMask.length > 0) {
14212
- // If there's a pre-existing field mask, it's a string, and it's not
14213
- // empty, then we should lock all fields.
14214
- requestDict['fieldMask'] = preExistingFieldMask.join(',');
15309
+ /**
15310
+ * Lists all FileSearchStore owned by the user.
15311
+ *
15312
+ * @param params - The parameters for listing file search stores.
15313
+ * @return ListFileSearchStoresResponse.
15314
+ */
15315
+ async listInternal(params) {
15316
+ var _a, _b;
15317
+ let response;
15318
+ let path = '';
15319
+ let queryParams = {};
15320
+ if (this.apiClient.isVertexAI()) {
15321
+ throw new Error('This method is only supported by the Gemini Developer API.');
14215
15322
  }
14216
15323
  else {
14217
- delete requestDict['fieldMask'];
15324
+ const body = listFileSearchStoresParametersToMldev(params);
15325
+ path = formatMap('fileSearchStores', body['_url']);
15326
+ queryParams = body['_query'];
15327
+ delete body['_url'];
15328
+ delete body['_query'];
15329
+ response = this.apiClient
15330
+ .request({
15331
+ path: path,
15332
+ queryParams: queryParams,
15333
+ body: JSON.stringify(body),
15334
+ httpMethod: 'GET',
15335
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15336
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15337
+ })
15338
+ .then((httpResponse) => {
15339
+ return httpResponse.json();
15340
+ });
15341
+ return response.then((apiResponse) => {
15342
+ const resp = listFileSearchStoresResponseFromMldev(apiResponse);
15343
+ const typedResp = new ListFileSearchStoresResponse();
15344
+ Object.assign(typedResp, resp);
15345
+ return typedResp;
15346
+ });
14218
15347
  }
14219
15348
  }
14220
- return requestDict;
14221
- }
14222
- class Tokens extends BaseModule {
14223
- constructor(apiClient) {
14224
- super();
14225
- this.apiClient = apiClient;
15349
+ async uploadToFileSearchStoreInternal(params) {
15350
+ var _a, _b;
15351
+ let response;
15352
+ let path = '';
15353
+ let queryParams = {};
15354
+ if (this.apiClient.isVertexAI()) {
15355
+ throw new Error('This method is only supported by the Gemini Developer API.');
15356
+ }
15357
+ else {
15358
+ const body = uploadToFileSearchStoreParametersToMldev(params);
15359
+ path = formatMap('upload/v1beta/{file_search_store_name}:uploadToFileSearchStore', body['_url']);
15360
+ queryParams = body['_query'];
15361
+ delete body['_url'];
15362
+ delete body['_query'];
15363
+ response = this.apiClient
15364
+ .request({
15365
+ path: path,
15366
+ queryParams: queryParams,
15367
+ body: JSON.stringify(body),
15368
+ httpMethod: 'POST',
15369
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15370
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15371
+ })
15372
+ .then((httpResponse) => {
15373
+ return httpResponse.json();
15374
+ });
15375
+ return response.then((apiResponse) => {
15376
+ const resp = uploadToFileSearchStoreResumableResponseFromMldev(apiResponse);
15377
+ const typedResp = new UploadToFileSearchStoreResumableResponse();
15378
+ Object.assign(typedResp, resp);
15379
+ return typedResp;
15380
+ });
15381
+ }
14226
15382
  }
14227
15383
  /**
14228
- * Creates an ephemeral auth token resource.
14229
- *
14230
- * @experimental
14231
- *
14232
- * @remarks
14233
- * Ephemeral auth tokens is only supported in the Gemini Developer API.
14234
- * It can be used for the session connection to the Live constrained API.
14235
- * Support in v1alpha only.
14236
- *
14237
- * @param params - The parameters for the create request.
14238
- * @return The created auth token.
14239
- *
14240
- * @example
14241
- * ```ts
14242
- * const ai = new GoogleGenAI({
14243
- * apiKey: token.name,
14244
- * httpOptions: { apiVersion: 'v1alpha' } // Support in v1alpha only.
14245
- * });
14246
- *
14247
- * // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
14248
- * // when using the token in Live API sessions. Each session connection can
14249
- * // use a different configuration.
14250
- * const config: CreateAuthTokenConfig = {
14251
- * uses: 3,
14252
- * expireTime: '2025-05-01T00:00:00Z',
14253
- * }
14254
- * const token = await ai.tokens.create(config);
15384
+ * Imports a File from File Service to a FileSearchStore.
14255
15385
  *
14256
- * // Case 2: If LiveEphemeralParameters is set, lock all fields in
14257
- * // LiveConnectConfig when using the token in Live API sessions. For
14258
- * // example, changing `outputAudioTranscription` in the Live API
14259
- * // connection will be ignored by the API.
14260
- * const config: CreateAuthTokenConfig =
14261
- * uses: 3,
14262
- * expireTime: '2025-05-01T00:00:00Z',
14263
- * LiveEphemeralParameters: {
14264
- * model: 'gemini-2.0-flash-001',
14265
- * config: {
14266
- * 'responseModalities': ['AUDIO'],
14267
- * 'systemInstruction': 'Always answer in English.',
14268
- * }
14269
- * }
14270
- * }
14271
- * const token = await ai.tokens.create(config);
14272
- *
14273
- * // Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
14274
- * // set, lock LiveConnectConfig with set and additional fields (e.g.
14275
- * // responseModalities, systemInstruction, temperature in this example) when
14276
- * // using the token in Live API sessions.
14277
- * const config: CreateAuthTokenConfig =
14278
- * uses: 3,
14279
- * expireTime: '2025-05-01T00:00:00Z',
14280
- * LiveEphemeralParameters: {
14281
- * model: 'gemini-2.0-flash-001',
14282
- * config: {
14283
- * 'responseModalities': ['AUDIO'],
14284
- * 'systemInstruction': 'Always answer in English.',
14285
- * }
14286
- * },
14287
- * lockAdditionalFields: ['temperature'],
14288
- * }
14289
- * const token = await ai.tokens.create(config);
15386
+ * This is a long-running operation, see aip.dev/151
14290
15387
  *
14291
- * // Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
14292
- * // empty array, lock LiveConnectConfig with set fields (e.g.
14293
- * // responseModalities, systemInstruction in this example) when using the
14294
- * // token in Live API sessions.
14295
- * const config: CreateAuthTokenConfig =
14296
- * uses: 3,
14297
- * expireTime: '2025-05-01T00:00:00Z',
14298
- * LiveEphemeralParameters: {
14299
- * model: 'gemini-2.0-flash-001',
14300
- * config: {
14301
- * 'responseModalities': ['AUDIO'],
14302
- * 'systemInstruction': 'Always answer in English.',
14303
- * }
14304
- * },
14305
- * lockAdditionalFields: [],
14306
- * }
14307
- * const token = await ai.tokens.create(config);
14308
- * ```
15388
+ * @param params - The parameters for importing a file to a file search store.
15389
+ * @return ImportFileOperation.
14309
15390
  */
14310
- async create(params) {
15391
+ async importFile(params) {
14311
15392
  var _a, _b;
14312
15393
  let response;
14313
15394
  let path = '';
14314
15395
  let queryParams = {};
14315
15396
  if (this.apiClient.isVertexAI()) {
14316
- throw new Error('The client.tokens.create method is only supported by the Gemini Developer API.');
15397
+ throw new Error('This method is only supported by the Gemini Developer API.');
14317
15398
  }
14318
15399
  else {
14319
- const body = createAuthTokenParametersToMldev(this.apiClient, params);
14320
- path = formatMap('auth_tokens', body['_url']);
15400
+ const body = importFileParametersToMldev(params);
15401
+ path = formatMap('{file_search_store_name}:importFile', body['_url']);
14321
15402
  queryParams = body['_query'];
14322
- delete body['config'];
14323
15403
  delete body['_url'];
14324
15404
  delete body['_query'];
14325
- const transformedBody = convertBidiSetupToTokenSetup(body, params.config);
14326
15405
  response = this.apiClient
14327
15406
  .request({
14328
15407
  path: path,
14329
15408
  queryParams: queryParams,
14330
- body: JSON.stringify(transformedBody),
15409
+ body: JSON.stringify(body),
14331
15410
  httpMethod: 'POST',
14332
15411
  httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
14333
15412
  abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
@@ -14335,8 +15414,11 @@ class Tokens extends BaseModule {
14335
15414
  .then((httpResponse) => {
14336
15415
  return httpResponse.json();
14337
15416
  });
14338
- return response.then((resp) => {
14339
- return resp;
15417
+ return response.then((apiResponse) => {
15418
+ const resp = importFileOperationFromMldev(apiResponse);
15419
+ const typedResp = new ImportFileOperation();
15420
+ Object.assign(typedResp, resp);
15421
+ return typedResp;
14340
15422
  });
14341
15423
  }
14342
15424
  }
@@ -14410,15 +15492,35 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
14410
15492
  if (getValueByPath(fromObject, ['labels']) !== undefined) {
14411
15493
  throw new Error('labels parameter is not supported in Gemini API.');
14412
15494
  }
15495
+ if (getValueByPath(fromObject, ['beta']) !== undefined) {
15496
+ throw new Error('beta parameter is not supported in Gemini API.');
15497
+ }
14413
15498
  return toObject;
14414
15499
  }
14415
15500
  function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14416
15501
  const toObject = {};
14417
- const fromValidationDataset = getValueByPath(fromObject, [
14418
- 'validationDataset',
15502
+ let discriminatorValidationDataset = getValueByPath(rootObject, [
15503
+ 'config',
15504
+ 'method',
14419
15505
  ]);
14420
- if (parentObject !== undefined && fromValidationDataset != null) {
14421
- setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
15506
+ if (discriminatorValidationDataset === undefined) {
15507
+ discriminatorValidationDataset = 'SUPERVISED_FINE_TUNING';
15508
+ }
15509
+ if (discriminatorValidationDataset === 'SUPERVISED_FINE_TUNING') {
15510
+ const fromValidationDataset = getValueByPath(fromObject, [
15511
+ 'validationDataset',
15512
+ ]);
15513
+ if (parentObject !== undefined && fromValidationDataset != null) {
15514
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
15515
+ }
15516
+ }
15517
+ else if (discriminatorValidationDataset === 'PREFERENCE_TUNING') {
15518
+ const fromValidationDataset = getValueByPath(fromObject, [
15519
+ 'validationDataset',
15520
+ ]);
15521
+ if (parentObject !== undefined && fromValidationDataset != null) {
15522
+ setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
15523
+ }
14422
15524
  }
14423
15525
  const fromTunedModelDisplayName = getValueByPath(fromObject, [
14424
15526
  'tunedModelDisplayName',
@@ -14430,25 +15532,90 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14430
15532
  if (parentObject !== undefined && fromDescription != null) {
14431
15533
  setValueByPath(parentObject, ['description'], fromDescription);
14432
15534
  }
14433
- const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14434
- if (parentObject !== undefined && fromEpochCount != null) {
14435
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
15535
+ let discriminatorEpochCount = getValueByPath(rootObject, [
15536
+ 'config',
15537
+ 'method',
15538
+ ]);
15539
+ if (discriminatorEpochCount === undefined) {
15540
+ discriminatorEpochCount = 'SUPERVISED_FINE_TUNING';
14436
15541
  }
14437
- const fromLearningRateMultiplier = getValueByPath(fromObject, [
14438
- 'learningRateMultiplier',
15542
+ if (discriminatorEpochCount === 'SUPERVISED_FINE_TUNING') {
15543
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
15544
+ if (parentObject !== undefined && fromEpochCount != null) {
15545
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
15546
+ }
15547
+ }
15548
+ else if (discriminatorEpochCount === 'PREFERENCE_TUNING') {
15549
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
15550
+ if (parentObject !== undefined && fromEpochCount != null) {
15551
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
15552
+ }
15553
+ }
15554
+ let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
15555
+ 'config',
15556
+ 'method',
14439
15557
  ]);
14440
- if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14441
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
15558
+ if (discriminatorLearningRateMultiplier === undefined) {
15559
+ discriminatorLearningRateMultiplier = 'SUPERVISED_FINE_TUNING';
14442
15560
  }
14443
- const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
14444
- 'exportLastCheckpointOnly',
15561
+ if (discriminatorLearningRateMultiplier === 'SUPERVISED_FINE_TUNING') {
15562
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
15563
+ 'learningRateMultiplier',
15564
+ ]);
15565
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
15566
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
15567
+ }
15568
+ }
15569
+ else if (discriminatorLearningRateMultiplier === 'PREFERENCE_TUNING') {
15570
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
15571
+ 'learningRateMultiplier',
15572
+ ]);
15573
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
15574
+ setValueByPath(parentObject, [
15575
+ 'preferenceOptimizationSpec',
15576
+ 'hyperParameters',
15577
+ 'learningRateMultiplier',
15578
+ ], fromLearningRateMultiplier);
15579
+ }
15580
+ }
15581
+ let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
15582
+ if (discriminatorExportLastCheckpointOnly === undefined) {
15583
+ discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
15584
+ }
15585
+ if (discriminatorExportLastCheckpointOnly === 'SUPERVISED_FINE_TUNING') {
15586
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
15587
+ 'exportLastCheckpointOnly',
15588
+ ]);
15589
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
15590
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
15591
+ }
15592
+ }
15593
+ else if (discriminatorExportLastCheckpointOnly === 'PREFERENCE_TUNING') {
15594
+ const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
15595
+ 'exportLastCheckpointOnly',
15596
+ ]);
15597
+ if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
15598
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
15599
+ }
15600
+ }
15601
+ let discriminatorAdapterSize = getValueByPath(rootObject, [
15602
+ 'config',
15603
+ 'method',
14445
15604
  ]);
14446
- if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
14447
- setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
15605
+ if (discriminatorAdapterSize === undefined) {
15606
+ discriminatorAdapterSize = 'SUPERVISED_FINE_TUNING';
15607
+ }
15608
+ if (discriminatorAdapterSize === 'SUPERVISED_FINE_TUNING') {
15609
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
15610
+ if (parentObject !== undefined && fromAdapterSize != null) {
15611
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
15612
+ }
14448
15613
  }
14449
- const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
14450
- if (parentObject !== undefined && fromAdapterSize != null) {
14451
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
15614
+ else if (discriminatorAdapterSize === 'PREFERENCE_TUNING') {
15615
+ const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
15616
+ if (parentObject !== undefined && fromAdapterSize != null) {
15617
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
15618
+ }
14452
15619
  }
14453
15620
  if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
14454
15621
  throw new Error('batchSize parameter is not supported in Vertex AI.');
@@ -14460,6 +15627,10 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14460
15627
  if (parentObject !== undefined && fromLabels != null) {
14461
15628
  setValueByPath(parentObject, ['labels'], fromLabels);
14462
15629
  }
15630
+ const fromBeta = getValueByPath(fromObject, ['beta']);
15631
+ if (parentObject !== undefined && fromBeta != null) {
15632
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'beta'], fromBeta);
15633
+ }
14463
15634
  return toObject;
14464
15635
  }
14465
15636
  function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
@@ -14478,7 +15649,7 @@ function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
14478
15649
  'trainingDataset',
14479
15650
  ]);
14480
15651
  if (fromTrainingDataset != null) {
14481
- setValueByPath(toObject, ['tuningTask', 'trainingData'], tuningDatasetToMldev(fromTrainingDataset));
15652
+ tuningDatasetToMldev(fromTrainingDataset);
14482
15653
  }
14483
15654
  const fromConfig = getValueByPath(fromObject, ['config']);
14484
15655
  if (fromConfig != null) {
@@ -14502,11 +15673,11 @@ function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
14502
15673
  'trainingDataset',
14503
15674
  ]);
14504
15675
  if (fromTrainingDataset != null) {
14505
- tuningDatasetToVertex(fromTrainingDataset, toObject);
15676
+ tuningDatasetToVertex(fromTrainingDataset, toObject, rootObject);
14506
15677
  }
14507
15678
  const fromConfig = getValueByPath(fromObject, ['config']);
14508
15679
  if (fromConfig != null) {
14509
- createTuningJobConfigToVertex(fromConfig, toObject);
15680
+ createTuningJobConfigToVertex(fromConfig, toObject, rootObject);
14510
15681
  }
14511
15682
  return toObject;
14512
15683
  }
@@ -14658,17 +15829,49 @@ function tuningDatasetToMldev(fromObject, _rootObject) {
14658
15829
  }
14659
15830
  return toObject;
14660
15831
  }
14661
- function tuningDatasetToVertex(fromObject, parentObject, _rootObject) {
15832
+ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
14662
15833
  const toObject = {};
14663
- const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
14664
- if (parentObject !== undefined && fromGcsUri != null) {
14665
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
15834
+ let discriminatorGcsUri = getValueByPath(rootObject, [
15835
+ 'config',
15836
+ 'method',
15837
+ ]);
15838
+ if (discriminatorGcsUri === undefined) {
15839
+ discriminatorGcsUri = 'SUPERVISED_FINE_TUNING';
14666
15840
  }
14667
- const fromVertexDatasetResource = getValueByPath(fromObject, [
14668
- 'vertexDatasetResource',
15841
+ if (discriminatorGcsUri === 'SUPERVISED_FINE_TUNING') {
15842
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
15843
+ if (parentObject !== undefined && fromGcsUri != null) {
15844
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
15845
+ }
15846
+ }
15847
+ else if (discriminatorGcsUri === 'PREFERENCE_TUNING') {
15848
+ const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
15849
+ if (parentObject !== undefined && fromGcsUri != null) {
15850
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromGcsUri);
15851
+ }
15852
+ }
15853
+ let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
15854
+ 'config',
15855
+ 'method',
14669
15856
  ]);
14670
- if (parentObject !== undefined && fromVertexDatasetResource != null) {
14671
- setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
15857
+ if (discriminatorVertexDatasetResource === undefined) {
15858
+ discriminatorVertexDatasetResource = 'SUPERVISED_FINE_TUNING';
15859
+ }
15860
+ if (discriminatorVertexDatasetResource === 'SUPERVISED_FINE_TUNING') {
15861
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
15862
+ 'vertexDatasetResource',
15863
+ ]);
15864
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
15865
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
15866
+ }
15867
+ }
15868
+ else if (discriminatorVertexDatasetResource === 'PREFERENCE_TUNING') {
15869
+ const fromVertexDatasetResource = getValueByPath(fromObject, [
15870
+ 'vertexDatasetResource',
15871
+ ]);
15872
+ if (parentObject !== undefined && fromVertexDatasetResource != null) {
15873
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
15874
+ }
14672
15875
  }
14673
15876
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
14674
15877
  throw new Error('examples parameter is not supported in Vertex AI.');
@@ -14787,6 +15990,12 @@ function tuningJobFromVertex(fromObject, _rootObject) {
14787
15990
  if (fromSupervisedTuningSpec != null) {
14788
15991
  setValueByPath(toObject, ['supervisedTuningSpec'], fromSupervisedTuningSpec);
14789
15992
  }
15993
+ const fromPreferenceOptimizationSpec = getValueByPath(fromObject, [
15994
+ 'preferenceOptimizationSpec',
15995
+ ]);
15996
+ if (fromPreferenceOptimizationSpec != null) {
15997
+ setValueByPath(toObject, ['preferenceOptimizationSpec'], fromPreferenceOptimizationSpec);
15998
+ }
14790
15999
  const fromTuningDataStats = getValueByPath(fromObject, [
14791
16000
  'tuningDataStats',
14792
16001
  ]);
@@ -15153,7 +16362,7 @@ class Tunings extends BaseModule {
15153
16362
  let path = '';
15154
16363
  let queryParams = {};
15155
16364
  if (this.apiClient.isVertexAI()) {
15156
- const body = createTuningJobParametersPrivateToVertex(params);
16365
+ const body = createTuningJobParametersPrivateToVertex(params, params);
15157
16366
  path = formatMap('tuningJobs', body['_url']);
15158
16367
  queryParams = body['_query'];
15159
16368
  delete body['_url'];
@@ -15242,7 +16451,28 @@ const INITIAL_RETRY_DELAY_MS = 1000;
15242
16451
  const DELAY_MULTIPLIER = 2;
15243
16452
  const X_GOOG_UPLOAD_STATUS_HEADER_FIELD = 'x-goog-upload-status';
15244
16453
  async function uploadBlob(file, uploadUrl, apiClient) {
15245
- var _a, _b, _c;
16454
+ var _a;
16455
+ const response = await uploadBlobInternal(file, uploadUrl, apiClient);
16456
+ const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
16457
+ 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') {
16458
+ throw new Error('Failed to upload file: Upload status is not finalized.');
16459
+ }
16460
+ return responseJson['file'];
16461
+ }
16462
+ async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient) {
16463
+ var _a;
16464
+ const response = await uploadBlobInternal(file, uploadUrl, apiClient);
16465
+ const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
16466
+ 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') {
16467
+ throw new Error('Failed to upload file: Upload status is not finalized.');
16468
+ }
16469
+ const resp = uploadToFileSearchStoreOperationFromMldev(responseJson);
16470
+ const typedResp = new UploadToFileSearchStoreOperation();
16471
+ Object.assign(typedResp, resp);
16472
+ return typedResp;
16473
+ }
16474
+ async function uploadBlobInternal(file, uploadUrl, apiClient) {
16475
+ var _a, _b;
15246
16476
  let fileSize = 0;
15247
16477
  let offset = 0;
15248
16478
  let response = new HttpResponse(new Response());
@@ -15290,11 +16520,7 @@ async function uploadBlob(file, uploadUrl, apiClient) {
15290
16520
  throw new Error('All content has been uploaded, but the upload status is not finalized.');
15291
16521
  }
15292
16522
  }
15293
- const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
15294
- 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') {
15295
- throw new Error('Failed to upload file: Upload status is not finalized.');
15296
- }
15297
- return responseJson['file'];
16523
+ return response;
15298
16524
  }
15299
16525
  async function getBlobStat(file) {
15300
16526
  const fileStat = { size: file.size, type: file.type };
@@ -15311,6 +16537,12 @@ class BrowserUploader {
15311
16537
  }
15312
16538
  return await uploadBlob(file, uploadUrl, apiClient);
15313
16539
  }
16540
+ async uploadToFileSearchStore(file, uploadUrl, apiClient) {
16541
+ if (typeof file === 'string') {
16542
+ throw new Error('File path is not supported in browser uploader.');
16543
+ }
16544
+ return await uploadBlobToFileSearchStore(file, uploadUrl, apiClient);
16545
+ }
15314
16546
  async stat(file) {
15315
16547
  if (typeof file === 'string') {
15316
16548
  throw new Error('File path is not supported in browser uploader.');
@@ -15471,8 +16703,9 @@ class GoogleGenAI {
15471
16703
  this.operations = new Operations(this.apiClient);
15472
16704
  this.authTokens = new Tokens(this.apiClient);
15473
16705
  this.tunings = new Tunings(this.apiClient);
16706
+ this.fileSearchStores = new FileSearchStores(this.apiClient);
15474
16707
  }
15475
16708
  }
15476
16709
 
15477
- 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 };
16710
+ 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 };
15478
16711
  //# sourceMappingURL=index.mjs.map