@google/genai 1.28.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']);
@@ -600,6 +684,22 @@ var Mode;
600
684
  */
601
685
  Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
602
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 = {}));
603
703
  /** Type of auth scheme. This enum is not supported in Gemini API. */
604
704
  var AuthType;
605
705
  (function (AuthType) {
@@ -629,22 +729,63 @@ var AuthType;
629
729
  */
630
730
  AuthType["OIDC_AUTH"] = "OIDC_AUTH";
631
731
  })(AuthType || (AuthType = {}));
632
- /** The API spec that the external API implements. This enum is not supported in Gemini API. */
633
- var ApiSpec;
634
- (function (ApiSpec) {
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";
635
736
  /**
636
- * Unspecified API spec. This value should not be used.
737
+ * Element is in the HTTP request query.
637
738
  */
638
- ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
739
+ HttpElementLocation["HTTP_IN_QUERY"] = "HTTP_IN_QUERY";
639
740
  /**
640
- * Simple search API spec.
741
+ * Element is in the HTTP request header.
641
742
  */
642
- ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
743
+ HttpElementLocation["HTTP_IN_HEADER"] = "HTTP_IN_HEADER";
643
744
  /**
644
- * Elastic search API spec.
745
+ * Element is in the HTTP request path.
645
746
  */
646
- ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
647
- })(ApiSpec || (ApiSpec = {}));
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 = {}));
648
789
  /** Harm category. */
649
790
  var HarmCategory;
650
791
  (function (HarmCategory) {
@@ -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. This enum is not supported in Gemini API. */
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
  /**
@@ -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;
@@ -1329,6 +1474,14 @@ var TuningMethod;
1329
1474
  */
1330
1475
  TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
1331
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 = {}));
1332
1485
  /** State for the lifecycle of a File. */
1333
1486
  var FileState;
1334
1487
  (function (FileState) {
@@ -1756,7 +1909,7 @@ class HttpResponse {
1756
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. */
1757
1910
  class GenerateContentResponsePromptFeedback {
1758
1911
  }
1759
- /** 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. */
1760
1913
  class GenerateContentResponseUsageMetadata {
1761
1914
  }
1762
1915
  /** Response message for PredictionService.GenerateContent. */
@@ -2021,11 +2174,11 @@ class GenerateVideosOperation {
2021
2174
  * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2022
2175
  * @internal
2023
2176
  */
2024
- _fromAPIResponse({ apiResponse, isVertexAI, }) {
2177
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2025
2178
  const operation = new GenerateVideosOperation();
2026
2179
  let response;
2027
2180
  const op = apiResponse;
2028
- if (isVertexAI) {
2181
+ if (_isVertexAI) {
2029
2182
  response = generateVideosOperationFromVertex$1(op);
2030
2183
  }
2031
2184
  else {
@@ -2043,6 +2196,32 @@ class DeleteCachedContentResponse {
2043
2196
  }
2044
2197
  class ListCachedContentsResponse {
2045
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
+ }
2046
2225
  /** Response for the list files method. */
2047
2226
  class ListFilesResponse {
2048
2227
  }
@@ -2278,6 +2457,23 @@ class LiveMusicServerMessage {
2278
2457
  return undefined;
2279
2458
  }
2280
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
+ }
2281
2477
 
2282
2478
  /**
2283
2479
  * @license
@@ -3274,6 +3470,12 @@ function batchJobFromVertex(fromObject) {
3274
3470
  if (fromDest != null) {
3275
3471
  setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
3276
3472
  }
3473
+ const fromCompletionStats = getValueByPath(fromObject, [
3474
+ 'completionStats',
3475
+ ]);
3476
+ if (fromCompletionStats != null) {
3477
+ setValueByPath(toObject, ['completionStats'], fromCompletionStats);
3478
+ }
3277
3479
  return toObject;
3278
3480
  }
3279
3481
  function batchJobSourceFromVertex(fromObject) {
@@ -3906,6 +4108,9 @@ function googleSearchToMldev$4(fromObject) {
3906
4108
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
3907
4109
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
3908
4110
  }
4111
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
4112
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
4113
+ }
3909
4114
  const fromTimeRangeFilter = getValueByPath(fromObject, [
3910
4115
  'timeRangeFilter',
3911
4116
  ]);
@@ -4145,14 +4350,14 @@ function toolToMldev$4(fromObject) {
4145
4350
  if (fromGoogleSearchRetrieval != null) {
4146
4351
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
4147
4352
  }
4148
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
4149
- if (fromGoogleMaps != null) {
4150
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4151
- }
4152
4353
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4153
4354
  if (fromComputerUse != null) {
4154
4355
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
4155
4356
  }
4357
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
4358
+ if (fromFileSearch != null) {
4359
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
4360
+ }
4156
4361
  const fromCodeExecution = getValueByPath(fromObject, [
4157
4362
  'codeExecution',
4158
4363
  ]);
@@ -4162,6 +4367,10 @@ function toolToMldev$4(fromObject) {
4162
4367
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4163
4368
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4164
4369
  }
4370
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
4371
+ if (fromGoogleMaps != null) {
4372
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4373
+ }
4165
4374
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4166
4375
  if (fromGoogleSearch != null) {
4167
4376
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
@@ -4185,7 +4394,7 @@ var PagedItem;
4185
4394
  PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
4186
4395
  PagedItem["PAGED_ITEM_FILES"] = "files";
4187
4396
  PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
4188
- PagedItem["PAGED_ITEM_RAG_STORES"] = "ragStores";
4397
+ PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
4189
4398
  PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
4190
4399
  })(PagedItem || (PagedItem = {}));
4191
4400
  /**
@@ -5139,6 +5348,9 @@ function googleSearchToMldev$3(fromObject) {
5139
5348
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5140
5349
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
5141
5350
  }
5351
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
5352
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
5353
+ }
5142
5354
  const fromTimeRangeFilter = getValueByPath(fromObject, [
5143
5355
  'timeRangeFilter',
5144
5356
  ]);
@@ -5320,14 +5532,14 @@ function toolToMldev$3(fromObject) {
5320
5532
  if (fromGoogleSearchRetrieval != null) {
5321
5533
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5322
5534
  }
5323
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5324
- if (fromGoogleMaps != null) {
5325
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5326
- }
5327
5535
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5328
5536
  if (fromComputerUse != null) {
5329
5537
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
5330
5538
  }
5539
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
5540
+ if (fromFileSearch != null) {
5541
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
5542
+ }
5331
5543
  const fromCodeExecution = getValueByPath(fromObject, [
5332
5544
  'codeExecution',
5333
5545
  ]);
@@ -5337,6 +5549,10 @@ function toolToMldev$3(fromObject) {
5337
5549
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5338
5550
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5339
5551
  }
5552
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5553
+ if (fromGoogleMaps != null) {
5554
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5555
+ }
5340
5556
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5341
5557
  if (fromGoogleSearch != null) {
5342
5558
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
@@ -5371,14 +5587,13 @@ function toolToVertex$2(fromObject) {
5371
5587
  if (fromGoogleSearchRetrieval != null) {
5372
5588
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5373
5589
  }
5374
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5375
- if (fromGoogleMaps != null) {
5376
- setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
5377
- }
5378
5590
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5379
5591
  if (fromComputerUse != null) {
5380
5592
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
5381
5593
  }
5594
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
5595
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
5596
+ }
5382
5597
  const fromCodeExecution = getValueByPath(fromObject, [
5383
5598
  'codeExecution',
5384
5599
  ]);
@@ -5391,6 +5606,10 @@ function toolToVertex$2(fromObject) {
5391
5606
  if (fromEnterpriseWebSearch != null) {
5392
5607
  setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
5393
5608
  }
5609
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5610
+ if (fromGoogleMaps != null) {
5611
+ setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
5612
+ }
5394
5613
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5395
5614
  if (fromGoogleSearch != null) {
5396
5615
  setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
@@ -6696,6 +6915,12 @@ function generationConfigToVertex$1(fromObject) {
6696
6915
  if (fromModelSelectionConfig != null) {
6697
6916
  setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
6698
6917
  }
6918
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
6919
+ 'responseJsonSchema',
6920
+ ]);
6921
+ if (fromResponseJsonSchema != null) {
6922
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6923
+ }
6699
6924
  const fromAudioTimestamp = getValueByPath(fromObject, [
6700
6925
  'audioTimestamp',
6701
6926
  ]);
@@ -6742,12 +6967,6 @@ function generationConfigToVertex$1(fromObject) {
6742
6967
  if (fromPresencePenalty != null) {
6743
6968
  setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
6744
6969
  }
6745
- const fromResponseJsonSchema = getValueByPath(fromObject, [
6746
- 'responseJsonSchema',
6747
- ]);
6748
- if (fromResponseJsonSchema != null) {
6749
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6750
- }
6751
6970
  const fromResponseLogprobs = getValueByPath(fromObject, [
6752
6971
  'responseLogprobs',
6753
6972
  ]);
@@ -6832,6 +7051,9 @@ function googleSearchToMldev$2(fromObject) {
6832
7051
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
6833
7052
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
6834
7053
  }
7054
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
7055
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
7056
+ }
6835
7057
  const fromTimeRangeFilter = getValueByPath(fromObject, [
6836
7058
  'timeRangeFilter',
6837
7059
  ]);
@@ -7339,14 +7561,14 @@ function toolToMldev$2(fromObject) {
7339
7561
  if (fromGoogleSearchRetrieval != null) {
7340
7562
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7341
7563
  }
7342
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7343
- if (fromGoogleMaps != null) {
7344
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
7345
- }
7346
7564
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7347
7565
  if (fromComputerUse != null) {
7348
7566
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
7349
7567
  }
7568
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
7569
+ if (fromFileSearch != null) {
7570
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
7571
+ }
7350
7572
  const fromCodeExecution = getValueByPath(fromObject, [
7351
7573
  'codeExecution',
7352
7574
  ]);
@@ -7356,6 +7578,10 @@ function toolToMldev$2(fromObject) {
7356
7578
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7357
7579
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
7358
7580
  }
7581
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7582
+ if (fromGoogleMaps != null) {
7583
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
7584
+ }
7359
7585
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7360
7586
  if (fromGoogleSearch != null) {
7361
7587
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
@@ -7390,14 +7616,13 @@ function toolToVertex$1(fromObject) {
7390
7616
  if (fromGoogleSearchRetrieval != null) {
7391
7617
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7392
7618
  }
7393
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7394
- if (fromGoogleMaps != null) {
7395
- setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
7396
- }
7397
7619
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7398
7620
  if (fromComputerUse != null) {
7399
7621
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
7400
7622
  }
7623
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
7624
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
7625
+ }
7401
7626
  const fromCodeExecution = getValueByPath(fromObject, [
7402
7627
  'codeExecution',
7403
7628
  ]);
@@ -7410,6 +7635,10 @@ function toolToVertex$1(fromObject) {
7410
7635
  if (fromEnterpriseWebSearch != null) {
7411
7636
  setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
7412
7637
  }
7638
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7639
+ if (fromGoogleMaps != null) {
7640
+ setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
7641
+ }
7413
7642
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7414
7643
  if (fromGoogleSearch != null) {
7415
7644
  setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
@@ -9359,6 +9588,12 @@ function generationConfigToVertex(fromObject) {
9359
9588
  if (fromModelSelectionConfig != null) {
9360
9589
  setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
9361
9590
  }
9591
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
9592
+ 'responseJsonSchema',
9593
+ ]);
9594
+ if (fromResponseJsonSchema != null) {
9595
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9596
+ }
9362
9597
  const fromAudioTimestamp = getValueByPath(fromObject, [
9363
9598
  'audioTimestamp',
9364
9599
  ]);
@@ -9405,12 +9640,6 @@ function generationConfigToVertex(fromObject) {
9405
9640
  if (fromPresencePenalty != null) {
9406
9641
  setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
9407
9642
  }
9408
- const fromResponseJsonSchema = getValueByPath(fromObject, [
9409
- 'responseJsonSchema',
9410
- ]);
9411
- if (fromResponseJsonSchema != null) {
9412
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9413
- }
9414
9643
  const fromResponseLogprobs = getValueByPath(fromObject, [
9415
9644
  'responseLogprobs',
9416
9645
  ]);
@@ -9511,6 +9740,9 @@ function googleSearchToMldev$1(fromObject) {
9511
9740
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9512
9741
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
9513
9742
  }
9743
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
9744
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
9745
+ }
9514
9746
  const fromTimeRangeFilter = getValueByPath(fromObject, [
9515
9747
  'timeRangeFilter',
9516
9748
  ]);
@@ -10213,14 +10445,14 @@ function toolToMldev$1(fromObject) {
10213
10445
  if (fromGoogleSearchRetrieval != null) {
10214
10446
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10215
10447
  }
10216
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10217
- if (fromGoogleMaps != null) {
10218
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10219
- }
10220
10448
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10221
10449
  if (fromComputerUse != null) {
10222
10450
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
10223
10451
  }
10452
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
10453
+ if (fromFileSearch != null) {
10454
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
10455
+ }
10224
10456
  const fromCodeExecution = getValueByPath(fromObject, [
10225
10457
  'codeExecution',
10226
10458
  ]);
@@ -10230,6 +10462,10 @@ function toolToMldev$1(fromObject) {
10230
10462
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10231
10463
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10232
10464
  }
10465
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10466
+ if (fromGoogleMaps != null) {
10467
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10468
+ }
10233
10469
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10234
10470
  if (fromGoogleSearch != null) {
10235
10471
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
@@ -10264,14 +10500,13 @@ function toolToVertex(fromObject) {
10264
10500
  if (fromGoogleSearchRetrieval != null) {
10265
10501
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10266
10502
  }
10267
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10268
- if (fromGoogleMaps != null) {
10269
- setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
10270
- }
10271
10503
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10272
10504
  if (fromComputerUse != null) {
10273
10505
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
10274
10506
  }
10507
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
10508
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
10509
+ }
10275
10510
  const fromCodeExecution = getValueByPath(fromObject, [
10276
10511
  'codeExecution',
10277
10512
  ]);
@@ -10284,6 +10519,10 @@ function toolToVertex(fromObject) {
10284
10519
  if (fromEnterpriseWebSearch != null) {
10285
10520
  setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
10286
10521
  }
10522
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10523
+ if (fromGoogleMaps != null) {
10524
+ setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
10525
+ }
10287
10526
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10288
10527
  if (fromGoogleSearch != null) {
10289
10528
  setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
@@ -10613,7 +10852,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10613
10852
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10614
10853
  const USER_AGENT_HEADER = 'User-Agent';
10615
10854
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10616
- const SDK_VERSION = '1.28.0'; // x-release-please-version
10855
+ const SDK_VERSION = '1.29.0'; // x-release-please-version
10617
10856
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10618
10857
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10619
10858
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -10991,6 +11230,15 @@ class ApiClient {
10991
11230
  await this.clientOptions.auth.addAuthHeaders(headers, url);
10992
11231
  return headers;
10993
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
+ }
10994
11242
  /**
10995
11243
  * Uploads a file asynchronously using Gemini API only, this is not supported
10996
11244
  * in Vertex AI.
@@ -11003,7 +11251,7 @@ class ApiClient {
11003
11251
  * @throws An error if the `mimeType` is not provided and can not be inferred,
11004
11252
  */
11005
11253
  async uploadFile(file, config) {
11006
- var _a, _b;
11254
+ var _a;
11007
11255
  const fileToUpload = {};
11008
11256
  if (config != null) {
11009
11257
  fileToUpload.mimeType = config.mimeType;
@@ -11021,41 +11269,71 @@ class ApiClient {
11021
11269
  throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
11022
11270
  }
11023
11271
  fileToUpload.mimeType = mimeType;
11024
- let fileName = '';
11025
- if (typeof file === 'string') {
11026
- fileName = file.replace(/[/\\]+$/, '');
11027
- fileName = (_b = fileName.split(/[/\\]/).pop()) !== null && _b !== void 0 ? _b : '';
11028
- }
11029
- const uploadUrl = await this.fetchUploadUrl(fileToUpload, fileName, 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);
11030
11278
  return uploader.upload(file, uploadUrl, this);
11031
11279
  }
11032
11280
  /**
11033
- * Downloads a file asynchronously to the specified path.
11281
+ * Uploads a file to a given file search store asynchronously using Gemini API only, this is not supported
11282
+ * in Vertex AI.
11034
11283
  *
11035
- * @params params - The parameters for the download request, see {@link
11036
- * types.DownloadFileParameters}
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,
11037
11291
  */
11038
- async downloadFile(params) {
11039
- const downloader = this.clientOptions.downloader;
11040
- await downloader.download(params, this);
11041
- }
11042
- async fetchUploadUrl(file, fileName, config) {
11292
+ async uploadFileToFileSearchStore(fileSearchStoreName, file, config) {
11043
11293
  var _a;
11044
- let httpOptions = {};
11045
- if (config === null || config === void 0 ? void 0 : config.httpOptions) {
11046
- httpOptions = config.httpOptions;
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
+ }
11313
+ /**
11314
+ * Downloads a file asynchronously to the specified path.
11315
+ *
11316
+ * @params params - The parameters for the download request, see {@link
11317
+ * types.DownloadFileParameters}
11318
+ */
11319
+ async downloadFile(params) {
11320
+ const downloader = this.clientOptions.downloader;
11321
+ await downloader.download(params, this);
11322
+ }
11323
+ async fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, configHttpOptions) {
11324
+ var _a;
11325
+ let httpOptions = {};
11326
+ if (configHttpOptions) {
11327
+ httpOptions = configHttpOptions;
11047
11328
  }
11048
11329
  else {
11049
11330
  httpOptions = {
11050
11331
  apiVersion: '',
11051
- headers: Object.assign({ 'Content-Type': 'application/json', 'X-Goog-Upload-Protocol': 'resumable', 'X-Goog-Upload-Command': 'start', 'X-Goog-Upload-Header-Content-Length': `${file.sizeBytes}`, 'X-Goog-Upload-Header-Content-Type': `${file.mimeType}` }, (fileName ? { 'X-Goog-Upload-File-Name': fileName } : {})),
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 } : {})),
11052
11333
  };
11053
11334
  }
11054
- const body = {
11055
- 'file': file,
11056
- };
11057
11335
  const httpResponse = await this.request({
11058
- path: formatMap('upload/v1beta/files', body['_url']),
11336
+ path,
11059
11337
  body: JSON.stringify(body),
11060
11338
  httpMethod: 'POST',
11061
11339
  httpOptions,
@@ -12059,11 +12337,27 @@ function hasCallableTools(params) {
12059
12337
  var _a, _b, _c;
12060
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;
12061
12339
  }
12062
- // Checks whether the list of tools contains any non-callable tools. Will return
12063
- // true if there is at least one non-Callable tool.
12064
- function hasNonCallableTools(params) {
12065
- var _a, _b, _c;
12066
- 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;
12067
12361
  }
12068
12362
  /**
12069
12363
  * Returns whether to append automatic function calling history to the
@@ -12128,8 +12422,12 @@ class Models extends BaseModule {
12128
12422
  if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
12129
12423
  return await this.generateContentInternal(transformedParams);
12130
12424
  }
12131
- if (hasNonCallableTools(params)) {
12132
- 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}.`);
12133
12431
  }
12134
12432
  let response;
12135
12433
  let functionResponseContent;
@@ -12216,9 +12514,14 @@ class Models extends BaseModule {
12216
12514
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
12217
12515
  return await this.generateContentStreamInternal(transformedParams);
12218
12516
  }
12219
- else {
12220
- 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.`);
12221
12523
  }
12524
+ return await this.processAfcStream(params);
12222
12525
  };
12223
12526
  /**
12224
12527
  * Generates an image based on a text description and configuration.
@@ -13614,7 +13917,7 @@ class Operations extends BaseModule {
13614
13917
  });
13615
13918
  return operation._fromAPIResponse({
13616
13919
  apiResponse: rawOperation,
13617
- isVertexAI: true,
13920
+ _isVertexAI: true,
13618
13921
  });
13619
13922
  }
13620
13923
  else {
@@ -13624,7 +13927,7 @@ class Operations extends BaseModule {
13624
13927
  });
13625
13928
  return operation._fromAPIResponse({
13626
13929
  apiResponse: rawOperation,
13627
- isVertexAI: false,
13930
+ _isVertexAI: false,
13628
13931
  });
13629
13932
  }
13630
13933
  }
@@ -13653,7 +13956,7 @@ class Operations extends BaseModule {
13653
13956
  });
13654
13957
  return operation._fromAPIResponse({
13655
13958
  apiResponse: rawOperation,
13656
- isVertexAI: true,
13959
+ _isVertexAI: true,
13657
13960
  });
13658
13961
  }
13659
13962
  else {
@@ -13663,7 +13966,7 @@ class Operations extends BaseModule {
13663
13966
  });
13664
13967
  return operation._fromAPIResponse({
13665
13968
  apiResponse: rawOperation,
13666
- isVertexAI: false,
13969
+ _isVertexAI: false,
13667
13970
  });
13668
13971
  }
13669
13972
  }
@@ -13851,6 +14154,9 @@ function googleSearchToMldev(fromObject) {
13851
14154
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13852
14155
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
13853
14156
  }
14157
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
14158
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
14159
+ }
13854
14160
  const fromTimeRangeFilter = getValueByPath(fromObject, [
13855
14161
  'timeRangeFilter',
13856
14162
  ]);
@@ -14069,14 +14375,14 @@ function toolToMldev(fromObject) {
14069
14375
  if (fromGoogleSearchRetrieval != null) {
14070
14376
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
14071
14377
  }
14072
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
14073
- if (fromGoogleMaps != null) {
14074
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
14075
- }
14076
14378
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
14077
14379
  if (fromComputerUse != null) {
14078
14380
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
14079
14381
  }
14382
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
14383
+ if (fromFileSearch != null) {
14384
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
14385
+ }
14080
14386
  const fromCodeExecution = getValueByPath(fromObject, [
14081
14387
  'codeExecution',
14082
14388
  ]);
@@ -14086,6 +14392,10 @@ function toolToMldev(fromObject) {
14086
14392
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
14087
14393
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
14088
14394
  }
14395
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
14396
+ if (fromGoogleMaps != null) {
14397
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
14398
+ }
14089
14399
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14090
14400
  if (fromGoogleSearch != null) {
14091
14401
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
@@ -14373,15 +14683,43 @@ class Tokens extends BaseModule {
14373
14683
  * SPDX-License-Identifier: Apache-2.0
14374
14684
  */
14375
14685
  // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14376
- function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
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) {
14377
14711
  const toObject = {};
14378
14712
  const fromName = getValueByPath(fromObject, ['name']);
14379
14713
  if (fromName != null) {
14380
14714
  setValueByPath(toObject, ['_url', 'name'], fromName);
14381
14715
  }
14716
+ const fromConfig = getValueByPath(fromObject, ['config']);
14717
+ if (fromConfig != null) {
14718
+ deleteFileSearchStoreConfigToMldev(fromConfig, toObject);
14719
+ }
14382
14720
  return toObject;
14383
14721
  }
14384
- function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
14722
+ function getFileSearchStoreParametersToMldev(fromObject) {
14385
14723
  const toObject = {};
14386
14724
  const fromName = getValueByPath(fromObject, ['name']);
14387
14725
  if (fromName != null) {
@@ -14389,141 +14727,860 @@ function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
14389
14727
  }
14390
14728
  return toObject;
14391
14729
  }
14392
- function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
14730
+ function importFileConfigToMldev(fromObject, parentObject) {
14393
14731
  const toObject = {};
14394
- if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
14395
- throw new Error('validationDataset parameter is not supported in Gemini API.');
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);
14396
14743
  }
14397
- const fromTunedModelDisplayName = getValueByPath(fromObject, [
14398
- 'tunedModelDisplayName',
14744
+ const fromChunkingConfig = getValueByPath(fromObject, [
14745
+ 'chunkingConfig',
14399
14746
  ]);
14400
- if (parentObject !== undefined && fromTunedModelDisplayName != null) {
14401
- setValueByPath(parentObject, ['displayName'], fromTunedModelDisplayName);
14747
+ if (parentObject !== undefined && fromChunkingConfig != null) {
14748
+ setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
14402
14749
  }
14403
- if (getValueByPath(fromObject, ['description']) !== undefined) {
14404
- throw new Error('description parameter is not supported in Gemini API.');
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);
14405
14757
  }
14406
- const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14407
- if (parentObject !== undefined && fromEpochCount != null) {
14408
- setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'epochCount'], fromEpochCount);
14758
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
14759
+ if (fromMetadata != null) {
14760
+ setValueByPath(toObject, ['metadata'], fromMetadata);
14409
14761
  }
14410
- const fromLearningRateMultiplier = getValueByPath(fromObject, [
14411
- 'learningRateMultiplier',
14412
- ]);
14413
- if (fromLearningRateMultiplier != null) {
14414
- setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
14762
+ const fromDone = getValueByPath(fromObject, ['done']);
14763
+ if (fromDone != null) {
14764
+ setValueByPath(toObject, ['done'], fromDone);
14415
14765
  }
14416
- if (getValueByPath(fromObject, ['exportLastCheckpointOnly']) !==
14417
- undefined) {
14418
- throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
14766
+ const fromError = getValueByPath(fromObject, ['error']);
14767
+ if (fromError != null) {
14768
+ setValueByPath(toObject, ['error'], fromError);
14419
14769
  }
14420
- if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
14421
- undefined) {
14422
- throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
14770
+ const fromResponse = getValueByPath(fromObject, ['response']);
14771
+ if (fromResponse != null) {
14772
+ setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
14423
14773
  }
14424
- if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
14425
- throw new Error('adapterSize parameter is not supported in Gemini API.');
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);
14426
14783
  }
14427
- const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
14428
- if (parentObject !== undefined && fromBatchSize != null) {
14429
- setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
14784
+ const fromFileName = getValueByPath(fromObject, ['fileName']);
14785
+ if (fromFileName != null) {
14786
+ setValueByPath(toObject, ['fileName'], fromFileName);
14430
14787
  }
14431
- const fromLearningRate = getValueByPath(fromObject, ['learningRate']);
14432
- if (parentObject !== undefined && fromLearningRate != null) {
14433
- setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
14788
+ const fromConfig = getValueByPath(fromObject, ['config']);
14789
+ if (fromConfig != null) {
14790
+ importFileConfigToMldev(fromConfig, toObject);
14434
14791
  }
14435
- if (getValueByPath(fromObject, ['labels']) !== undefined) {
14436
- throw new Error('labels parameter is not supported in Gemini API.');
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);
14437
14801
  }
14438
- if (getValueByPath(fromObject, ['beta']) !== undefined) {
14439
- throw new Error('beta parameter is not supported in Gemini API.');
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);
14440
14809
  }
14441
14810
  return toObject;
14442
14811
  }
14443
- function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14812
+ function listFileSearchStoresConfigToMldev(fromObject, parentObject) {
14444
14813
  const toObject = {};
14445
- let discriminatorValidationDataset = getValueByPath(rootObject, [
14446
- 'config',
14447
- 'method',
14448
- ]);
14449
- if (discriminatorValidationDataset === undefined) {
14450
- discriminatorValidationDataset = 'SUPERVISED_FINE_TUNING';
14814
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14815
+ if (parentObject !== undefined && fromPageSize != null) {
14816
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
14451
14817
  }
14452
- if (discriminatorValidationDataset === 'SUPERVISED_FINE_TUNING') {
14453
- const fromValidationDataset = getValueByPath(fromObject, [
14454
- 'validationDataset',
14455
- ]);
14456
- if (parentObject !== undefined && fromValidationDataset != null) {
14457
- setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
14458
- }
14818
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
14819
+ if (parentObject !== undefined && fromPageToken != null) {
14820
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
14459
14821
  }
14460
- else if (discriminatorValidationDataset === 'PREFERENCE_TUNING') {
14461
- const fromValidationDataset = getValueByPath(fromObject, [
14462
- 'validationDataset',
14463
- ]);
14464
- if (parentObject !== undefined && fromValidationDataset != null) {
14465
- setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
14466
- }
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);
14467
14829
  }
14468
- const fromTunedModelDisplayName = getValueByPath(fromObject, [
14469
- 'tunedModelDisplayName',
14830
+ return toObject;
14831
+ }
14832
+ function listFileSearchStoresResponseFromMldev(fromObject) {
14833
+ const toObject = {};
14834
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14835
+ 'sdkHttpResponse',
14470
14836
  ]);
14471
- if (parentObject !== undefined && fromTunedModelDisplayName != null) {
14472
- setValueByPath(parentObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
14473
- }
14474
- const fromDescription = getValueByPath(fromObject, ['description']);
14475
- if (parentObject !== undefined && fromDescription != null) {
14476
- setValueByPath(parentObject, ['description'], fromDescription);
14837
+ if (fromSdkHttpResponse != null) {
14838
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14477
14839
  }
14478
- let discriminatorEpochCount = getValueByPath(rootObject, [
14479
- 'config',
14480
- 'method',
14840
+ const fromNextPageToken = getValueByPath(fromObject, [
14841
+ 'nextPageToken',
14481
14842
  ]);
14482
- if (discriminatorEpochCount === undefined) {
14483
- discriminatorEpochCount = 'SUPERVISED_FINE_TUNING';
14843
+ if (fromNextPageToken != null) {
14844
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
14484
14845
  }
14485
- if (discriminatorEpochCount === 'SUPERVISED_FINE_TUNING') {
14486
- const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14487
- if (parentObject !== undefined && fromEpochCount != null) {
14488
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
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
+ });
14489
14855
  }
14856
+ setValueByPath(toObject, ['fileSearchStores'], transformedList);
14490
14857
  }
14491
- else if (discriminatorEpochCount === 'PREFERENCE_TUNING') {
14492
- const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14493
- if (parentObject !== undefined && fromEpochCount != null) {
14494
- setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
14495
- }
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);
14496
14865
  }
14497
- let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
14498
- 'config',
14499
- 'method',
14500
- ]);
14501
- if (discriminatorLearningRateMultiplier === undefined) {
14502
- discriminatorLearningRateMultiplier = 'SUPERVISED_FINE_TUNING';
14866
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14867
+ if (parentObject !== undefined && fromDisplayName != null) {
14868
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
14503
14869
  }
14504
- if (discriminatorLearningRateMultiplier === 'SUPERVISED_FINE_TUNING') {
14505
- const fromLearningRateMultiplier = getValueByPath(fromObject, [
14506
- 'learningRateMultiplier',
14507
- ]);
14508
- if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14509
- setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
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
+ });
14510
14879
  }
14880
+ setValueByPath(parentObject, ['customMetadata'], transformedList);
14511
14881
  }
14512
- else if (discriminatorLearningRateMultiplier === 'PREFERENCE_TUNING') {
14513
- const fromLearningRateMultiplier = getValueByPath(fromObject, [
14514
- 'learningRateMultiplier',
14515
- ]);
14516
- if (parentObject !== undefined && fromLearningRateMultiplier != null) {
14517
- setValueByPath(parentObject, [
14518
- 'preferenceOptimizationSpec',
14519
- 'hyperParameters',
14520
- 'learningRateMultiplier',
14521
- ], fromLearningRateMultiplier);
14522
- }
14882
+ const fromChunkingConfig = getValueByPath(fromObject, [
14883
+ 'chunkingConfig',
14884
+ ]);
14885
+ if (parentObject !== undefined && fromChunkingConfig != null) {
14886
+ setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
14523
14887
  }
14524
- let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
14525
- if (discriminatorExportLastCheckpointOnly === undefined) {
14526
- discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
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
+ });
15307
+ }
15308
+ }
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.');
15322
+ }
15323
+ else {
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
+ });
15347
+ }
15348
+ }
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
+ }
15382
+ }
15383
+ /**
15384
+ * Imports a File from File Service to a FileSearchStore.
15385
+ *
15386
+ * This is a long-running operation, see aip.dev/151
15387
+ *
15388
+ * @param params - The parameters for importing a file to a file search store.
15389
+ * @return ImportFileOperation.
15390
+ */
15391
+ async importFile(params) {
15392
+ var _a, _b;
15393
+ let response;
15394
+ let path = '';
15395
+ let queryParams = {};
15396
+ if (this.apiClient.isVertexAI()) {
15397
+ throw new Error('This method is only supported by the Gemini Developer API.');
15398
+ }
15399
+ else {
15400
+ const body = importFileParametersToMldev(params);
15401
+ path = formatMap('{file_search_store_name}:importFile', body['_url']);
15402
+ queryParams = body['_query'];
15403
+ delete body['_url'];
15404
+ delete body['_query'];
15405
+ response = this.apiClient
15406
+ .request({
15407
+ path: path,
15408
+ queryParams: queryParams,
15409
+ body: JSON.stringify(body),
15410
+ httpMethod: 'POST',
15411
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15412
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15413
+ })
15414
+ .then((httpResponse) => {
15415
+ return httpResponse.json();
15416
+ });
15417
+ return response.then((apiResponse) => {
15418
+ const resp = importFileOperationFromMldev(apiResponse);
15419
+ const typedResp = new ImportFileOperation();
15420
+ Object.assign(typedResp, resp);
15421
+ return typedResp;
15422
+ });
15423
+ }
15424
+ }
15425
+ }
15426
+
15427
+ /**
15428
+ * @license
15429
+ * Copyright 2025 Google LLC
15430
+ * SPDX-License-Identifier: Apache-2.0
15431
+ */
15432
+ // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
15433
+ function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
15434
+ const toObject = {};
15435
+ const fromName = getValueByPath(fromObject, ['name']);
15436
+ if (fromName != null) {
15437
+ setValueByPath(toObject, ['_url', 'name'], fromName);
15438
+ }
15439
+ return toObject;
15440
+ }
15441
+ function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
15442
+ const toObject = {};
15443
+ const fromName = getValueByPath(fromObject, ['name']);
15444
+ if (fromName != null) {
15445
+ setValueByPath(toObject, ['_url', 'name'], fromName);
15446
+ }
15447
+ return toObject;
15448
+ }
15449
+ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
15450
+ const toObject = {};
15451
+ if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
15452
+ throw new Error('validationDataset parameter is not supported in Gemini API.');
15453
+ }
15454
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
15455
+ 'tunedModelDisplayName',
15456
+ ]);
15457
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
15458
+ setValueByPath(parentObject, ['displayName'], fromTunedModelDisplayName);
15459
+ }
15460
+ if (getValueByPath(fromObject, ['description']) !== undefined) {
15461
+ throw new Error('description parameter is not supported in Gemini API.');
15462
+ }
15463
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
15464
+ if (parentObject !== undefined && fromEpochCount != null) {
15465
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'epochCount'], fromEpochCount);
15466
+ }
15467
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
15468
+ 'learningRateMultiplier',
15469
+ ]);
15470
+ if (fromLearningRateMultiplier != null) {
15471
+ setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
15472
+ }
15473
+ if (getValueByPath(fromObject, ['exportLastCheckpointOnly']) !==
15474
+ undefined) {
15475
+ throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
15476
+ }
15477
+ if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
15478
+ undefined) {
15479
+ throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
15480
+ }
15481
+ if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
15482
+ throw new Error('adapterSize parameter is not supported in Gemini API.');
15483
+ }
15484
+ const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
15485
+ if (parentObject !== undefined && fromBatchSize != null) {
15486
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
15487
+ }
15488
+ const fromLearningRate = getValueByPath(fromObject, ['learningRate']);
15489
+ if (parentObject !== undefined && fromLearningRate != null) {
15490
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
15491
+ }
15492
+ if (getValueByPath(fromObject, ['labels']) !== undefined) {
15493
+ throw new Error('labels parameter is not supported in Gemini API.');
15494
+ }
15495
+ if (getValueByPath(fromObject, ['beta']) !== undefined) {
15496
+ throw new Error('beta parameter is not supported in Gemini API.');
15497
+ }
15498
+ return toObject;
15499
+ }
15500
+ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
15501
+ const toObject = {};
15502
+ let discriminatorValidationDataset = getValueByPath(rootObject, [
15503
+ 'config',
15504
+ 'method',
15505
+ ]);
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
+ }
15524
+ }
15525
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
15526
+ 'tunedModelDisplayName',
15527
+ ]);
15528
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
15529
+ setValueByPath(parentObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
15530
+ }
15531
+ const fromDescription = getValueByPath(fromObject, ['description']);
15532
+ if (parentObject !== undefined && fromDescription != null) {
15533
+ setValueByPath(parentObject, ['description'], fromDescription);
15534
+ }
15535
+ let discriminatorEpochCount = getValueByPath(rootObject, [
15536
+ 'config',
15537
+ 'method',
15538
+ ]);
15539
+ if (discriminatorEpochCount === undefined) {
15540
+ discriminatorEpochCount = 'SUPERVISED_FINE_TUNING';
15541
+ }
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',
15557
+ ]);
15558
+ if (discriminatorLearningRateMultiplier === undefined) {
15559
+ discriminatorLearningRateMultiplier = 'SUPERVISED_FINE_TUNING';
15560
+ }
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';
14527
15584
  }
14528
15585
  if (discriminatorExportLastCheckpointOnly === 'SUPERVISED_FINE_TUNING') {
14529
15586
  const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
@@ -15394,7 +16451,28 @@ const INITIAL_RETRY_DELAY_MS = 1000;
15394
16451
  const DELAY_MULTIPLIER = 2;
15395
16452
  const X_GOOG_UPLOAD_STATUS_HEADER_FIELD = 'x-goog-upload-status';
15396
16453
  async function uploadBlob(file, uploadUrl, apiClient) {
15397
- 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;
15398
16476
  let fileSize = 0;
15399
16477
  let offset = 0;
15400
16478
  let response = new HttpResponse(new Response());
@@ -15442,11 +16520,7 @@ async function uploadBlob(file, uploadUrl, apiClient) {
15442
16520
  throw new Error('All content has been uploaded, but the upload status is not finalized.');
15443
16521
  }
15444
16522
  }
15445
- const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
15446
- 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') {
15447
- throw new Error('Failed to upload file: Upload status is not finalized.');
15448
- }
15449
- return responseJson['file'];
16523
+ return response;
15450
16524
  }
15451
16525
  async function getBlobStat(file) {
15452
16526
  const fileStat = { size: file.size, type: file.type };
@@ -15463,6 +16537,12 @@ class BrowserUploader {
15463
16537
  }
15464
16538
  return await uploadBlob(file, uploadUrl, apiClient);
15465
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
+ }
15466
16546
  async stat(file) {
15467
16547
  if (typeof file === 'string') {
15468
16548
  throw new Error('File path is not supported in browser uploader.');
@@ -15623,8 +16703,9 @@ class GoogleGenAI {
15623
16703
  this.operations = new Operations(this.apiClient);
15624
16704
  this.authTokens = new Tokens(this.apiClient);
15625
16705
  this.tunings = new Tunings(this.apiClient);
16706
+ this.fileSearchStores = new FileSearchStores(this.apiClient);
15626
16707
  }
15627
16708
  }
15628
16709
 
15629
- export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
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 };
15630
16711
  //# sourceMappingURL=index.mjs.map