@google/genai 1.28.0 → 1.29.1

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. */
@@ -1798,6 +1951,7 @@ class GenerateContentResponse {
1798
1951
  for (const [fieldName, fieldValue] of Object.entries(part)) {
1799
1952
  if (fieldName !== 'text' &&
1800
1953
  fieldName !== 'thought' &&
1954
+ fieldName !== 'thoughtSignature' &&
1801
1955
  (fieldValue !== null || fieldValue !== undefined)) {
1802
1956
  nonTextParts.push(fieldName);
1803
1957
  }
@@ -2021,11 +2175,11 @@ class GenerateVideosOperation {
2021
2175
  * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2022
2176
  * @internal
2023
2177
  */
2024
- _fromAPIResponse({ apiResponse, isVertexAI, }) {
2178
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2025
2179
  const operation = new GenerateVideosOperation();
2026
2180
  let response;
2027
2181
  const op = apiResponse;
2028
- if (isVertexAI) {
2182
+ if (_isVertexAI) {
2029
2183
  response = generateVideosOperationFromVertex$1(op);
2030
2184
  }
2031
2185
  else {
@@ -2043,6 +2197,32 @@ class DeleteCachedContentResponse {
2043
2197
  }
2044
2198
  class ListCachedContentsResponse {
2045
2199
  }
2200
+ /** Config for documents.list return value. */
2201
+ class ListDocumentsResponse {
2202
+ }
2203
+ /** Config for file_search_stores.list return value. */
2204
+ class ListFileSearchStoresResponse {
2205
+ }
2206
+ /** Response for the resumable upload method. */
2207
+ class UploadToFileSearchStoreResumableResponse {
2208
+ }
2209
+ /** Response for ImportFile to import a File API file with a file search store. */
2210
+ class ImportFileResponse {
2211
+ }
2212
+ /** Long-running operation for importing a file to a FileSearchStore. */
2213
+ class ImportFileOperation {
2214
+ /**
2215
+ * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2216
+ * @internal
2217
+ */
2218
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2219
+ const operation = new ImportFileOperation();
2220
+ const op = apiResponse;
2221
+ const response = importFileOperationFromMldev$1(op);
2222
+ Object.assign(operation, response);
2223
+ return operation;
2224
+ }
2225
+ }
2046
2226
  /** Response for the list files method. */
2047
2227
  class ListFilesResponse {
2048
2228
  }
@@ -2278,6 +2458,23 @@ class LiveMusicServerMessage {
2278
2458
  return undefined;
2279
2459
  }
2280
2460
  }
2461
+ /** The response when long-running operation for uploading a file to a FileSearchStore complete. */
2462
+ class UploadToFileSearchStoreResponse {
2463
+ }
2464
+ /** Long-running operation for uploading a file to a FileSearchStore. */
2465
+ class UploadToFileSearchStoreOperation {
2466
+ /**
2467
+ * Instantiates an Operation of the same type as the one being called with the fields set from the API response.
2468
+ * @internal
2469
+ */
2470
+ _fromAPIResponse({ apiResponse, _isVertexAI, }) {
2471
+ const operation = new UploadToFileSearchStoreOperation();
2472
+ const op = apiResponse;
2473
+ const response = uploadToFileSearchStoreOperationFromMldev(op);
2474
+ Object.assign(operation, response);
2475
+ return operation;
2476
+ }
2477
+ }
2281
2478
 
2282
2479
  /**
2283
2480
  * @license
@@ -2288,6 +2485,9 @@ function tModel(apiClient, model) {
2288
2485
  if (!model || typeof model !== 'string') {
2289
2486
  throw new Error('model is required and must be a string');
2290
2487
  }
2488
+ if (model.includes('..') || model.includes('?') || model.includes('&')) {
2489
+ throw new Error('invalid model parameter');
2490
+ }
2291
2491
  if (apiClient.isVertexAI()) {
2292
2492
  if (model.startsWith('publishers/') ||
2293
2493
  model.startsWith('projects/') ||
@@ -3274,6 +3474,12 @@ function batchJobFromVertex(fromObject) {
3274
3474
  if (fromDest != null) {
3275
3475
  setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
3276
3476
  }
3477
+ const fromCompletionStats = getValueByPath(fromObject, [
3478
+ 'completionStats',
3479
+ ]);
3480
+ if (fromCompletionStats != null) {
3481
+ setValueByPath(toObject, ['completionStats'], fromCompletionStats);
3482
+ }
3277
3483
  return toObject;
3278
3484
  }
3279
3485
  function batchJobSourceFromVertex(fromObject) {
@@ -3906,6 +4112,9 @@ function googleSearchToMldev$4(fromObject) {
3906
4112
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
3907
4113
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
3908
4114
  }
4115
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
4116
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
4117
+ }
3909
4118
  const fromTimeRangeFilter = getValueByPath(fromObject, [
3910
4119
  'timeRangeFilter',
3911
4120
  ]);
@@ -4145,14 +4354,14 @@ function toolToMldev$4(fromObject) {
4145
4354
  if (fromGoogleSearchRetrieval != null) {
4146
4355
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
4147
4356
  }
4148
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
4149
- if (fromGoogleMaps != null) {
4150
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4151
- }
4152
4357
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
4153
4358
  if (fromComputerUse != null) {
4154
4359
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
4155
4360
  }
4361
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
4362
+ if (fromFileSearch != null) {
4363
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
4364
+ }
4156
4365
  const fromCodeExecution = getValueByPath(fromObject, [
4157
4366
  'codeExecution',
4158
4367
  ]);
@@ -4162,6 +4371,10 @@ function toolToMldev$4(fromObject) {
4162
4371
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
4163
4372
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
4164
4373
  }
4374
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
4375
+ if (fromGoogleMaps != null) {
4376
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
4377
+ }
4165
4378
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
4166
4379
  if (fromGoogleSearch != null) {
4167
4380
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
@@ -4185,7 +4398,7 @@ var PagedItem;
4185
4398
  PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
4186
4399
  PagedItem["PAGED_ITEM_FILES"] = "files";
4187
4400
  PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
4188
- PagedItem["PAGED_ITEM_RAG_STORES"] = "ragStores";
4401
+ PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
4189
4402
  PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
4190
4403
  })(PagedItem || (PagedItem = {}));
4191
4404
  /**
@@ -5139,6 +5352,9 @@ function googleSearchToMldev$3(fromObject) {
5139
5352
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
5140
5353
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
5141
5354
  }
5355
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
5356
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
5357
+ }
5142
5358
  const fromTimeRangeFilter = getValueByPath(fromObject, [
5143
5359
  'timeRangeFilter',
5144
5360
  ]);
@@ -5320,14 +5536,14 @@ function toolToMldev$3(fromObject) {
5320
5536
  if (fromGoogleSearchRetrieval != null) {
5321
5537
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5322
5538
  }
5323
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5324
- if (fromGoogleMaps != null) {
5325
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5326
- }
5327
5539
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5328
5540
  if (fromComputerUse != null) {
5329
5541
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
5330
5542
  }
5543
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
5544
+ if (fromFileSearch != null) {
5545
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
5546
+ }
5331
5547
  const fromCodeExecution = getValueByPath(fromObject, [
5332
5548
  'codeExecution',
5333
5549
  ]);
@@ -5337,6 +5553,10 @@ function toolToMldev$3(fromObject) {
5337
5553
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
5338
5554
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
5339
5555
  }
5556
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5557
+ if (fromGoogleMaps != null) {
5558
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
5559
+ }
5340
5560
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5341
5561
  if (fromGoogleSearch != null) {
5342
5562
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
@@ -5371,14 +5591,13 @@ function toolToVertex$2(fromObject) {
5371
5591
  if (fromGoogleSearchRetrieval != null) {
5372
5592
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
5373
5593
  }
5374
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5375
- if (fromGoogleMaps != null) {
5376
- setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
5377
- }
5378
5594
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
5379
5595
  if (fromComputerUse != null) {
5380
5596
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
5381
5597
  }
5598
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
5599
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
5600
+ }
5382
5601
  const fromCodeExecution = getValueByPath(fromObject, [
5383
5602
  'codeExecution',
5384
5603
  ]);
@@ -5391,6 +5610,10 @@ function toolToVertex$2(fromObject) {
5391
5610
  if (fromEnterpriseWebSearch != null) {
5392
5611
  setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
5393
5612
  }
5613
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
5614
+ if (fromGoogleMaps != null) {
5615
+ setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
5616
+ }
5394
5617
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
5395
5618
  if (fromGoogleSearch != null) {
5396
5619
  setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
@@ -6696,6 +6919,12 @@ function generationConfigToVertex$1(fromObject) {
6696
6919
  if (fromModelSelectionConfig != null) {
6697
6920
  setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
6698
6921
  }
6922
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
6923
+ 'responseJsonSchema',
6924
+ ]);
6925
+ if (fromResponseJsonSchema != null) {
6926
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6927
+ }
6699
6928
  const fromAudioTimestamp = getValueByPath(fromObject, [
6700
6929
  'audioTimestamp',
6701
6930
  ]);
@@ -6742,12 +6971,6 @@ function generationConfigToVertex$1(fromObject) {
6742
6971
  if (fromPresencePenalty != null) {
6743
6972
  setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
6744
6973
  }
6745
- const fromResponseJsonSchema = getValueByPath(fromObject, [
6746
- 'responseJsonSchema',
6747
- ]);
6748
- if (fromResponseJsonSchema != null) {
6749
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6750
- }
6751
6974
  const fromResponseLogprobs = getValueByPath(fromObject, [
6752
6975
  'responseLogprobs',
6753
6976
  ]);
@@ -6832,6 +7055,9 @@ function googleSearchToMldev$2(fromObject) {
6832
7055
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
6833
7056
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
6834
7057
  }
7058
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
7059
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
7060
+ }
6835
7061
  const fromTimeRangeFilter = getValueByPath(fromObject, [
6836
7062
  'timeRangeFilter',
6837
7063
  ]);
@@ -7339,14 +7565,14 @@ function toolToMldev$2(fromObject) {
7339
7565
  if (fromGoogleSearchRetrieval != null) {
7340
7566
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7341
7567
  }
7342
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7343
- if (fromGoogleMaps != null) {
7344
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
7345
- }
7346
7568
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7347
7569
  if (fromComputerUse != null) {
7348
7570
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
7349
7571
  }
7572
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
7573
+ if (fromFileSearch != null) {
7574
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
7575
+ }
7350
7576
  const fromCodeExecution = getValueByPath(fromObject, [
7351
7577
  'codeExecution',
7352
7578
  ]);
@@ -7356,6 +7582,10 @@ function toolToMldev$2(fromObject) {
7356
7582
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
7357
7583
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
7358
7584
  }
7585
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7586
+ if (fromGoogleMaps != null) {
7587
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
7588
+ }
7359
7589
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7360
7590
  if (fromGoogleSearch != null) {
7361
7591
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
@@ -7390,14 +7620,13 @@ function toolToVertex$1(fromObject) {
7390
7620
  if (fromGoogleSearchRetrieval != null) {
7391
7621
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
7392
7622
  }
7393
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7394
- if (fromGoogleMaps != null) {
7395
- setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
7396
- }
7397
7623
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
7398
7624
  if (fromComputerUse != null) {
7399
7625
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
7400
7626
  }
7627
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
7628
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
7629
+ }
7401
7630
  const fromCodeExecution = getValueByPath(fromObject, [
7402
7631
  'codeExecution',
7403
7632
  ]);
@@ -7410,6 +7639,10 @@ function toolToVertex$1(fromObject) {
7410
7639
  if (fromEnterpriseWebSearch != null) {
7411
7640
  setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
7412
7641
  }
7642
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
7643
+ if (fromGoogleMaps != null) {
7644
+ setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
7645
+ }
7413
7646
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
7414
7647
  if (fromGoogleSearch != null) {
7415
7648
  setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
@@ -9359,6 +9592,12 @@ function generationConfigToVertex(fromObject) {
9359
9592
  if (fromModelSelectionConfig != null) {
9360
9593
  setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
9361
9594
  }
9595
+ const fromResponseJsonSchema = getValueByPath(fromObject, [
9596
+ 'responseJsonSchema',
9597
+ ]);
9598
+ if (fromResponseJsonSchema != null) {
9599
+ setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9600
+ }
9362
9601
  const fromAudioTimestamp = getValueByPath(fromObject, [
9363
9602
  'audioTimestamp',
9364
9603
  ]);
@@ -9405,12 +9644,6 @@ function generationConfigToVertex(fromObject) {
9405
9644
  if (fromPresencePenalty != null) {
9406
9645
  setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
9407
9646
  }
9408
- const fromResponseJsonSchema = getValueByPath(fromObject, [
9409
- 'responseJsonSchema',
9410
- ]);
9411
- if (fromResponseJsonSchema != null) {
9412
- setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9413
- }
9414
9647
  const fromResponseLogprobs = getValueByPath(fromObject, [
9415
9648
  'responseLogprobs',
9416
9649
  ]);
@@ -9511,6 +9744,9 @@ function googleSearchToMldev$1(fromObject) {
9511
9744
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
9512
9745
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
9513
9746
  }
9747
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
9748
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
9749
+ }
9514
9750
  const fromTimeRangeFilter = getValueByPath(fromObject, [
9515
9751
  'timeRangeFilter',
9516
9752
  ]);
@@ -9748,6 +9984,28 @@ function modelFromMldev(fromObject) {
9748
9984
  if (fromSupportedActions != null) {
9749
9985
  setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
9750
9986
  }
9987
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
9988
+ if (fromTemperature != null) {
9989
+ setValueByPath(toObject, ['temperature'], fromTemperature);
9990
+ }
9991
+ const fromMaxTemperature = getValueByPath(fromObject, [
9992
+ 'maxTemperature',
9993
+ ]);
9994
+ if (fromMaxTemperature != null) {
9995
+ setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
9996
+ }
9997
+ const fromTopP = getValueByPath(fromObject, ['topP']);
9998
+ if (fromTopP != null) {
9999
+ setValueByPath(toObject, ['topP'], fromTopP);
10000
+ }
10001
+ const fromTopK = getValueByPath(fromObject, ['topK']);
10002
+ if (fromTopK != null) {
10003
+ setValueByPath(toObject, ['topK'], fromTopK);
10004
+ }
10005
+ const fromThinking = getValueByPath(fromObject, ['thinking']);
10006
+ if (fromThinking != null) {
10007
+ setValueByPath(toObject, ['thinking'], fromThinking);
10008
+ }
9751
10009
  return toObject;
9752
10010
  }
9753
10011
  function modelFromVertex(fromObject) {
@@ -9876,7 +10134,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
9876
10134
  }
9877
10135
  const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
9878
10136
  if (parentObject !== undefined && fromBaseSteps != null) {
9879
- setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
10137
+ setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
9880
10138
  }
9881
10139
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
9882
10140
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -10213,14 +10471,14 @@ function toolToMldev$1(fromObject) {
10213
10471
  if (fromGoogleSearchRetrieval != null) {
10214
10472
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10215
10473
  }
10216
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10217
- if (fromGoogleMaps != null) {
10218
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10219
- }
10220
10474
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10221
10475
  if (fromComputerUse != null) {
10222
10476
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
10223
10477
  }
10478
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
10479
+ if (fromFileSearch != null) {
10480
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
10481
+ }
10224
10482
  const fromCodeExecution = getValueByPath(fromObject, [
10225
10483
  'codeExecution',
10226
10484
  ]);
@@ -10230,6 +10488,10 @@ function toolToMldev$1(fromObject) {
10230
10488
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
10231
10489
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
10232
10490
  }
10491
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10492
+ if (fromGoogleMaps != null) {
10493
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
10494
+ }
10233
10495
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10234
10496
  if (fromGoogleSearch != null) {
10235
10497
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
@@ -10264,14 +10526,13 @@ function toolToVertex(fromObject) {
10264
10526
  if (fromGoogleSearchRetrieval != null) {
10265
10527
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
10266
10528
  }
10267
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10268
- if (fromGoogleMaps != null) {
10269
- setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
10270
- }
10271
10529
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
10272
10530
  if (fromComputerUse != null) {
10273
10531
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
10274
10532
  }
10533
+ if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
10534
+ throw new Error('fileSearch parameter is not supported in Vertex AI.');
10535
+ }
10275
10536
  const fromCodeExecution = getValueByPath(fromObject, [
10276
10537
  'codeExecution',
10277
10538
  ]);
@@ -10284,6 +10545,10 @@ function toolToVertex(fromObject) {
10284
10545
  if (fromEnterpriseWebSearch != null) {
10285
10546
  setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
10286
10547
  }
10548
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
10549
+ if (fromGoogleMaps != null) {
10550
+ setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
10551
+ }
10287
10552
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
10288
10553
  if (fromGoogleSearch != null) {
10289
10554
  setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
@@ -10613,7 +10878,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10613
10878
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10614
10879
  const USER_AGENT_HEADER = 'User-Agent';
10615
10880
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10616
- const SDK_VERSION = '1.28.0'; // x-release-please-version
10881
+ const SDK_VERSION = '1.29.1'; // x-release-please-version
10617
10882
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10618
10883
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10619
10884
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -10991,6 +11256,15 @@ class ApiClient {
10991
11256
  await this.clientOptions.auth.addAuthHeaders(headers, url);
10992
11257
  return headers;
10993
11258
  }
11259
+ getFileName(file) {
11260
+ var _a;
11261
+ let fileName = '';
11262
+ if (typeof file === 'string') {
11263
+ fileName = file.replace(/[/\\]+$/, '');
11264
+ fileName = (_a = fileName.split(/[/\\]/).pop()) !== null && _a !== void 0 ? _a : '';
11265
+ }
11266
+ return fileName;
11267
+ }
10994
11268
  /**
10995
11269
  * Uploads a file asynchronously using Gemini API only, this is not supported
10996
11270
  * in Vertex AI.
@@ -11003,7 +11277,7 @@ class ApiClient {
11003
11277
  * @throws An error if the `mimeType` is not provided and can not be inferred,
11004
11278
  */
11005
11279
  async uploadFile(file, config) {
11006
- var _a, _b;
11280
+ var _a;
11007
11281
  const fileToUpload = {};
11008
11282
  if (config != null) {
11009
11283
  fileToUpload.mimeType = config.mimeType;
@@ -11021,14 +11295,47 @@ class ApiClient {
11021
11295
  throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
11022
11296
  }
11023
11297
  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);
11298
+ const body = {
11299
+ file: fileToUpload,
11300
+ };
11301
+ const fileName = this.getFileName(file);
11302
+ const path = formatMap('upload/v1beta/files', body['_url']);
11303
+ const uploadUrl = await this.fetchUploadUrl(path, fileToUpload.sizeBytes, fileToUpload.mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
11030
11304
  return uploader.upload(file, uploadUrl, this);
11031
11305
  }
11306
+ /**
11307
+ * Uploads a file to a given file search store asynchronously using Gemini API only, this is not supported
11308
+ * in Vertex AI.
11309
+ *
11310
+ * @param fileSearchStoreName The name of the file search store to upload the file to.
11311
+ * @param file The string path to the file to be uploaded or a Blob object.
11312
+ * @param config Optional parameters specified in the `UploadFileConfig`
11313
+ * interface. @see {@link UploadFileConfig}
11314
+ * @return A promise that resolves to a `File` object.
11315
+ * @throws An error if called on a Vertex AI client.
11316
+ * @throws An error if the `mimeType` is not provided and can not be inferred,
11317
+ */
11318
+ async uploadFileToFileSearchStore(fileSearchStoreName, file, config) {
11319
+ var _a;
11320
+ const uploader = this.clientOptions.uploader;
11321
+ const fileStat = await uploader.stat(file);
11322
+ const sizeBytes = String(fileStat.size);
11323
+ const mimeType = (_a = config === null || config === void 0 ? void 0 : config.mimeType) !== null && _a !== void 0 ? _a : fileStat.type;
11324
+ if (mimeType === undefined || mimeType === '') {
11325
+ throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
11326
+ }
11327
+ const path = `upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`;
11328
+ const fileName = this.getFileName(file);
11329
+ const body = {};
11330
+ if (config === null || config === void 0 ? void 0 : config.customMetadata) {
11331
+ body['customMetadata'] = config.customMetadata;
11332
+ }
11333
+ if (config === null || config === void 0 ? void 0 : config.chunkingConfig) {
11334
+ body['chunkingConfig'] = config.chunkingConfig;
11335
+ }
11336
+ const uploadUrl = await this.fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
11337
+ return uploader.uploadToFileSearchStore(file, uploadUrl, this);
11338
+ }
11032
11339
  /**
11033
11340
  * Downloads a file asynchronously to the specified path.
11034
11341
  *
@@ -11039,23 +11346,20 @@ class ApiClient {
11039
11346
  const downloader = this.clientOptions.downloader;
11040
11347
  await downloader.download(params, this);
11041
11348
  }
11042
- async fetchUploadUrl(file, fileName, config) {
11349
+ async fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, configHttpOptions) {
11043
11350
  var _a;
11044
11351
  let httpOptions = {};
11045
- if (config === null || config === void 0 ? void 0 : config.httpOptions) {
11046
- httpOptions = config.httpOptions;
11352
+ if (configHttpOptions) {
11353
+ httpOptions = configHttpOptions;
11047
11354
  }
11048
11355
  else {
11049
11356
  httpOptions = {
11050
11357
  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 } : {})),
11358
+ 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
11359
  };
11053
11360
  }
11054
- const body = {
11055
- 'file': file,
11056
- };
11057
11361
  const httpResponse = await this.request({
11058
- path: formatMap('upload/v1beta/files', body['_url']),
11362
+ path,
11059
11363
  body: JSON.stringify(body),
11060
11364
  httpMethod: 'POST',
11061
11365
  httpOptions,
@@ -12059,11 +12363,27 @@ function hasCallableTools(params) {
12059
12363
  var _a, _b, _c;
12060
12364
  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
12365
  }
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;
12366
+ /**
12367
+ * Returns the indexes of the tools that are not compatible with AFC.
12368
+ */
12369
+ function findAfcIncompatibleToolIndexes(params) {
12370
+ var _a;
12371
+ // Use number[] for an array of numbers in TypeScript
12372
+ const afcIncompatibleToolIndexes = [];
12373
+ if (!((_a = params === null || params === void 0 ? void 0 : params.config) === null || _a === void 0 ? void 0 : _a.tools)) {
12374
+ return afcIncompatibleToolIndexes;
12375
+ }
12376
+ params.config.tools.forEach((tool, index) => {
12377
+ if (isCallableTool(tool)) {
12378
+ return;
12379
+ }
12380
+ const geminiTool = tool;
12381
+ if (geminiTool.functionDeclarations &&
12382
+ geminiTool.functionDeclarations.length > 0) {
12383
+ afcIncompatibleToolIndexes.push(index);
12384
+ }
12385
+ });
12386
+ return afcIncompatibleToolIndexes;
12067
12387
  }
12068
12388
  /**
12069
12389
  * Returns whether to append automatic function calling history to the
@@ -12128,8 +12448,12 @@ class Models extends BaseModule {
12128
12448
  if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
12129
12449
  return await this.generateContentInternal(transformedParams);
12130
12450
  }
12131
- if (hasNonCallableTools(params)) {
12132
- throw new Error('Automatic function calling with CallableTools and Tools is not yet supported.');
12451
+ const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
12452
+ if (incompatibleToolIndexes.length > 0) {
12453
+ const formattedIndexes = incompatibleToolIndexes
12454
+ .map((index) => `tools[${index}]`)
12455
+ .join(', ');
12456
+ throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${formattedIndexes}.`);
12133
12457
  }
12134
12458
  let response;
12135
12459
  let functionResponseContent;
@@ -12216,9 +12540,14 @@ class Models extends BaseModule {
12216
12540
  const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
12217
12541
  return await this.generateContentStreamInternal(transformedParams);
12218
12542
  }
12219
- else {
12220
- return await this.processAfcStream(params);
12543
+ const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
12544
+ if (incompatibleToolIndexes.length > 0) {
12545
+ const formattedIndexes = incompatibleToolIndexes
12546
+ .map((index) => `tools[${index}]`)
12547
+ .join(', ');
12548
+ throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
12221
12549
  }
12550
+ return await this.processAfcStream(params);
12222
12551
  };
12223
12552
  /**
12224
12553
  * Generates an image based on a text description and configuration.
@@ -13614,7 +13943,7 @@ class Operations extends BaseModule {
13614
13943
  });
13615
13944
  return operation._fromAPIResponse({
13616
13945
  apiResponse: rawOperation,
13617
- isVertexAI: true,
13946
+ _isVertexAI: true,
13618
13947
  });
13619
13948
  }
13620
13949
  else {
@@ -13624,7 +13953,7 @@ class Operations extends BaseModule {
13624
13953
  });
13625
13954
  return operation._fromAPIResponse({
13626
13955
  apiResponse: rawOperation,
13627
- isVertexAI: false,
13956
+ _isVertexAI: false,
13628
13957
  });
13629
13958
  }
13630
13959
  }
@@ -13653,7 +13982,7 @@ class Operations extends BaseModule {
13653
13982
  });
13654
13983
  return operation._fromAPIResponse({
13655
13984
  apiResponse: rawOperation,
13656
- isVertexAI: true,
13985
+ _isVertexAI: true,
13657
13986
  });
13658
13987
  }
13659
13988
  else {
@@ -13663,7 +13992,7 @@ class Operations extends BaseModule {
13663
13992
  });
13664
13993
  return operation._fromAPIResponse({
13665
13994
  apiResponse: rawOperation,
13666
- isVertexAI: false,
13995
+ _isVertexAI: false,
13667
13996
  });
13668
13997
  }
13669
13998
  }
@@ -13851,6 +14180,9 @@ function googleSearchToMldev(fromObject) {
13851
14180
  if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
13852
14181
  throw new Error('excludeDomains parameter is not supported in Gemini API.');
13853
14182
  }
14183
+ if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
14184
+ throw new Error('blockingConfidence parameter is not supported in Gemini API.');
14185
+ }
13854
14186
  const fromTimeRangeFilter = getValueByPath(fromObject, [
13855
14187
  'timeRangeFilter',
13856
14188
  ]);
@@ -14069,14 +14401,14 @@ function toolToMldev(fromObject) {
14069
14401
  if (fromGoogleSearchRetrieval != null) {
14070
14402
  setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
14071
14403
  }
14072
- const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
14073
- if (fromGoogleMaps != null) {
14074
- setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
14075
- }
14076
14404
  const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
14077
14405
  if (fromComputerUse != null) {
14078
14406
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
14079
14407
  }
14408
+ const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
14409
+ if (fromFileSearch != null) {
14410
+ setValueByPath(toObject, ['fileSearch'], fromFileSearch);
14411
+ }
14080
14412
  const fromCodeExecution = getValueByPath(fromObject, [
14081
14413
  'codeExecution',
14082
14414
  ]);
@@ -14086,6 +14418,10 @@ function toolToMldev(fromObject) {
14086
14418
  if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
14087
14419
  throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
14088
14420
  }
14421
+ const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
14422
+ if (fromGoogleMaps != null) {
14423
+ setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
14424
+ }
14089
14425
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
14090
14426
  if (fromGoogleSearch != null) {
14091
14427
  setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
@@ -14373,15 +14709,43 @@ class Tokens extends BaseModule {
14373
14709
  * SPDX-License-Identifier: Apache-2.0
14374
14710
  */
14375
14711
  // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14376
- function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
14712
+ function createFileSearchStoreConfigToMldev(fromObject, parentObject) {
14713
+ const toObject = {};
14714
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14715
+ if (parentObject !== undefined && fromDisplayName != null) {
14716
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
14717
+ }
14718
+ return toObject;
14719
+ }
14720
+ function createFileSearchStoreParametersToMldev(fromObject) {
14721
+ const toObject = {};
14722
+ const fromConfig = getValueByPath(fromObject, ['config']);
14723
+ if (fromConfig != null) {
14724
+ createFileSearchStoreConfigToMldev(fromConfig, toObject);
14725
+ }
14726
+ return toObject;
14727
+ }
14728
+ function deleteFileSearchStoreConfigToMldev(fromObject, parentObject) {
14729
+ const toObject = {};
14730
+ const fromForce = getValueByPath(fromObject, ['force']);
14731
+ if (parentObject !== undefined && fromForce != null) {
14732
+ setValueByPath(parentObject, ['_query', 'force'], fromForce);
14733
+ }
14734
+ return toObject;
14735
+ }
14736
+ function deleteFileSearchStoreParametersToMldev(fromObject) {
14377
14737
  const toObject = {};
14378
14738
  const fromName = getValueByPath(fromObject, ['name']);
14379
14739
  if (fromName != null) {
14380
14740
  setValueByPath(toObject, ['_url', 'name'], fromName);
14381
14741
  }
14742
+ const fromConfig = getValueByPath(fromObject, ['config']);
14743
+ if (fromConfig != null) {
14744
+ deleteFileSearchStoreConfigToMldev(fromConfig, toObject);
14745
+ }
14382
14746
  return toObject;
14383
14747
  }
14384
- function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
14748
+ function getFileSearchStoreParametersToMldev(fromObject) {
14385
14749
  const toObject = {};
14386
14750
  const fromName = getValueByPath(fromObject, ['name']);
14387
14751
  if (fromName != null) {
@@ -14389,137 +14753,856 @@ function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
14389
14753
  }
14390
14754
  return toObject;
14391
14755
  }
14392
- function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
14756
+ function importFileConfigToMldev(fromObject, parentObject) {
14393
14757
  const toObject = {};
14394
- if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
14395
- throw new Error('validationDataset parameter is not supported in Gemini API.');
14758
+ const fromCustomMetadata = getValueByPath(fromObject, [
14759
+ 'customMetadata',
14760
+ ]);
14761
+ if (parentObject !== undefined && fromCustomMetadata != null) {
14762
+ let transformedList = fromCustomMetadata;
14763
+ if (Array.isArray(transformedList)) {
14764
+ transformedList = transformedList.map((item) => {
14765
+ return item;
14766
+ });
14767
+ }
14768
+ setValueByPath(parentObject, ['customMetadata'], transformedList);
14396
14769
  }
14397
- const fromTunedModelDisplayName = getValueByPath(fromObject, [
14398
- 'tunedModelDisplayName',
14770
+ const fromChunkingConfig = getValueByPath(fromObject, [
14771
+ 'chunkingConfig',
14399
14772
  ]);
14400
- if (parentObject !== undefined && fromTunedModelDisplayName != null) {
14401
- setValueByPath(parentObject, ['displayName'], fromTunedModelDisplayName);
14773
+ if (parentObject !== undefined && fromChunkingConfig != null) {
14774
+ setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
14402
14775
  }
14403
- if (getValueByPath(fromObject, ['description']) !== undefined) {
14404
- throw new Error('description parameter is not supported in Gemini API.');
14776
+ return toObject;
14777
+ }
14778
+ function importFileOperationFromMldev(fromObject) {
14779
+ const toObject = {};
14780
+ const fromName = getValueByPath(fromObject, ['name']);
14781
+ if (fromName != null) {
14782
+ setValueByPath(toObject, ['name'], fromName);
14405
14783
  }
14406
- const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
14407
- if (parentObject !== undefined && fromEpochCount != null) {
14408
- setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'epochCount'], fromEpochCount);
14784
+ const fromMetadata = getValueByPath(fromObject, ['metadata']);
14785
+ if (fromMetadata != null) {
14786
+ setValueByPath(toObject, ['metadata'], fromMetadata);
14409
14787
  }
14410
- const fromLearningRateMultiplier = getValueByPath(fromObject, [
14411
- 'learningRateMultiplier',
14412
- ]);
14413
- if (fromLearningRateMultiplier != null) {
14414
- setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
14788
+ const fromDone = getValueByPath(fromObject, ['done']);
14789
+ if (fromDone != null) {
14790
+ setValueByPath(toObject, ['done'], fromDone);
14415
14791
  }
14416
- if (getValueByPath(fromObject, ['exportLastCheckpointOnly']) !==
14417
- undefined) {
14418
- throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
14792
+ const fromError = getValueByPath(fromObject, ['error']);
14793
+ if (fromError != null) {
14794
+ setValueByPath(toObject, ['error'], fromError);
14419
14795
  }
14420
- if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
14421
- undefined) {
14422
- throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
14796
+ const fromResponse = getValueByPath(fromObject, ['response']);
14797
+ if (fromResponse != null) {
14798
+ setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
14423
14799
  }
14424
- if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
14425
- throw new Error('adapterSize parameter is not supported in Gemini API.');
14800
+ return toObject;
14801
+ }
14802
+ function importFileParametersToMldev(fromObject) {
14803
+ const toObject = {};
14804
+ const fromFileSearchStoreName = getValueByPath(fromObject, [
14805
+ 'fileSearchStoreName',
14806
+ ]);
14807
+ if (fromFileSearchStoreName != null) {
14808
+ setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
14426
14809
  }
14427
- const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
14428
- if (parentObject !== undefined && fromBatchSize != null) {
14429
- setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
14810
+ const fromFileName = getValueByPath(fromObject, ['fileName']);
14811
+ if (fromFileName != null) {
14812
+ setValueByPath(toObject, ['fileName'], fromFileName);
14430
14813
  }
14431
- const fromLearningRate = getValueByPath(fromObject, ['learningRate']);
14432
- if (parentObject !== undefined && fromLearningRate != null) {
14433
- setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
14814
+ const fromConfig = getValueByPath(fromObject, ['config']);
14815
+ if (fromConfig != null) {
14816
+ importFileConfigToMldev(fromConfig, toObject);
14434
14817
  }
14435
- if (getValueByPath(fromObject, ['labels']) !== undefined) {
14436
- throw new Error('labels parameter is not supported in Gemini API.');
14818
+ return toObject;
14819
+ }
14820
+ function importFileResponseFromMldev(fromObject) {
14821
+ const toObject = {};
14822
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14823
+ 'sdkHttpResponse',
14824
+ ]);
14825
+ if (fromSdkHttpResponse != null) {
14826
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14437
14827
  }
14438
- if (getValueByPath(fromObject, ['beta']) !== undefined) {
14439
- throw new Error('beta parameter is not supported in Gemini API.');
14828
+ const fromParent = getValueByPath(fromObject, ['parent']);
14829
+ if (fromParent != null) {
14830
+ setValueByPath(toObject, ['parent'], fromParent);
14831
+ }
14832
+ const fromDocumentName = getValueByPath(fromObject, ['documentName']);
14833
+ if (fromDocumentName != null) {
14834
+ setValueByPath(toObject, ['documentName'], fromDocumentName);
14440
14835
  }
14441
14836
  return toObject;
14442
14837
  }
14443
- function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
14838
+ function listFileSearchStoresConfigToMldev(fromObject, parentObject) {
14444
14839
  const toObject = {};
14445
- let discriminatorValidationDataset = getValueByPath(rootObject, [
14446
- 'config',
14447
- 'method',
14448
- ]);
14449
- if (discriminatorValidationDataset === undefined) {
14450
- discriminatorValidationDataset = 'SUPERVISED_FINE_TUNING';
14840
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14841
+ if (parentObject !== undefined && fromPageSize != null) {
14842
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
14451
14843
  }
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
- }
14844
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
14845
+ if (parentObject !== undefined && fromPageToken != null) {
14846
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
14459
14847
  }
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
- }
14848
+ return toObject;
14849
+ }
14850
+ function listFileSearchStoresParametersToMldev(fromObject) {
14851
+ const toObject = {};
14852
+ const fromConfig = getValueByPath(fromObject, ['config']);
14853
+ if (fromConfig != null) {
14854
+ listFileSearchStoresConfigToMldev(fromConfig, toObject);
14467
14855
  }
14468
- const fromTunedModelDisplayName = getValueByPath(fromObject, [
14469
- 'tunedModelDisplayName',
14856
+ return toObject;
14857
+ }
14858
+ function listFileSearchStoresResponseFromMldev(fromObject) {
14859
+ const toObject = {};
14860
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14861
+ 'sdkHttpResponse',
14470
14862
  ]);
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);
14863
+ if (fromSdkHttpResponse != null) {
14864
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14477
14865
  }
14478
- let discriminatorEpochCount = getValueByPath(rootObject, [
14479
- 'config',
14480
- 'method',
14866
+ const fromNextPageToken = getValueByPath(fromObject, [
14867
+ 'nextPageToken',
14481
14868
  ]);
14482
- if (discriminatorEpochCount === undefined) {
14483
- discriminatorEpochCount = 'SUPERVISED_FINE_TUNING';
14869
+ if (fromNextPageToken != null) {
14870
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
14484
14871
  }
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);
14872
+ const fromFileSearchStores = getValueByPath(fromObject, [
14873
+ 'fileSearchStores',
14874
+ ]);
14875
+ if (fromFileSearchStores != null) {
14876
+ let transformedList = fromFileSearchStores;
14877
+ if (Array.isArray(transformedList)) {
14878
+ transformedList = transformedList.map((item) => {
14879
+ return item;
14880
+ });
14489
14881
  }
14882
+ setValueByPath(toObject, ['fileSearchStores'], transformedList);
14490
14883
  }
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);
14884
+ return toObject;
14885
+ }
14886
+ function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
14887
+ const toObject = {};
14888
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
14889
+ if (parentObject !== undefined && fromMimeType != null) {
14890
+ setValueByPath(parentObject, ['mimeType'], fromMimeType);
14891
+ }
14892
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
14893
+ if (parentObject !== undefined && fromDisplayName != null) {
14894
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
14895
+ }
14896
+ const fromCustomMetadata = getValueByPath(fromObject, [
14897
+ 'customMetadata',
14898
+ ]);
14899
+ if (parentObject !== undefined && fromCustomMetadata != null) {
14900
+ let transformedList = fromCustomMetadata;
14901
+ if (Array.isArray(transformedList)) {
14902
+ transformedList = transformedList.map((item) => {
14903
+ return item;
14904
+ });
14495
14905
  }
14906
+ setValueByPath(parentObject, ['customMetadata'], transformedList);
14496
14907
  }
14497
- let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
14498
- 'config',
14499
- 'method',
14908
+ const fromChunkingConfig = getValueByPath(fromObject, [
14909
+ 'chunkingConfig',
14500
14910
  ]);
14501
- if (discriminatorLearningRateMultiplier === undefined) {
14502
- discriminatorLearningRateMultiplier = 'SUPERVISED_FINE_TUNING';
14911
+ if (parentObject !== undefined && fromChunkingConfig != null) {
14912
+ setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
14503
14913
  }
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);
14510
- }
14914
+ return toObject;
14915
+ }
14916
+ function uploadToFileSearchStoreParametersToMldev(fromObject) {
14917
+ const toObject = {};
14918
+ const fromFileSearchStoreName = getValueByPath(fromObject, [
14919
+ 'fileSearchStoreName',
14920
+ ]);
14921
+ if (fromFileSearchStoreName != null) {
14922
+ setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
14511
14923
  }
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
- }
14924
+ const fromConfig = getValueByPath(fromObject, ['config']);
14925
+ if (fromConfig != null) {
14926
+ uploadToFileSearchStoreConfigToMldev(fromConfig, toObject);
14927
+ }
14928
+ return toObject;
14929
+ }
14930
+ function uploadToFileSearchStoreResumableResponseFromMldev(fromObject) {
14931
+ const toObject = {};
14932
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
14933
+ 'sdkHttpResponse',
14934
+ ]);
14935
+ if (fromSdkHttpResponse != null) {
14936
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
14937
+ }
14938
+ return toObject;
14939
+ }
14940
+
14941
+ /**
14942
+ * @license
14943
+ * Copyright 2025 Google LLC
14944
+ * SPDX-License-Identifier: Apache-2.0
14945
+ */
14946
+ // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
14947
+ function deleteDocumentConfigToMldev(fromObject, parentObject) {
14948
+ const toObject = {};
14949
+ const fromForce = getValueByPath(fromObject, ['force']);
14950
+ if (parentObject !== undefined && fromForce != null) {
14951
+ setValueByPath(parentObject, ['_query', 'force'], fromForce);
14952
+ }
14953
+ return toObject;
14954
+ }
14955
+ function deleteDocumentParametersToMldev(fromObject) {
14956
+ const toObject = {};
14957
+ const fromName = getValueByPath(fromObject, ['name']);
14958
+ if (fromName != null) {
14959
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14960
+ }
14961
+ const fromConfig = getValueByPath(fromObject, ['config']);
14962
+ if (fromConfig != null) {
14963
+ deleteDocumentConfigToMldev(fromConfig, toObject);
14964
+ }
14965
+ return toObject;
14966
+ }
14967
+ function getDocumentParametersToMldev(fromObject) {
14968
+ const toObject = {};
14969
+ const fromName = getValueByPath(fromObject, ['name']);
14970
+ if (fromName != null) {
14971
+ setValueByPath(toObject, ['_url', 'name'], fromName);
14972
+ }
14973
+ return toObject;
14974
+ }
14975
+ function listDocumentsConfigToMldev(fromObject, parentObject) {
14976
+ const toObject = {};
14977
+ const fromPageSize = getValueByPath(fromObject, ['pageSize']);
14978
+ if (parentObject !== undefined && fromPageSize != null) {
14979
+ setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
14980
+ }
14981
+ const fromPageToken = getValueByPath(fromObject, ['pageToken']);
14982
+ if (parentObject !== undefined && fromPageToken != null) {
14983
+ setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
14984
+ }
14985
+ return toObject;
14986
+ }
14987
+ function listDocumentsParametersToMldev(fromObject) {
14988
+ const toObject = {};
14989
+ const fromParent = getValueByPath(fromObject, ['parent']);
14990
+ if (fromParent != null) {
14991
+ setValueByPath(toObject, ['_url', 'parent'], fromParent);
14992
+ }
14993
+ const fromConfig = getValueByPath(fromObject, ['config']);
14994
+ if (fromConfig != null) {
14995
+ listDocumentsConfigToMldev(fromConfig, toObject);
14996
+ }
14997
+ return toObject;
14998
+ }
14999
+ function listDocumentsResponseFromMldev(fromObject) {
15000
+ const toObject = {};
15001
+ const fromSdkHttpResponse = getValueByPath(fromObject, [
15002
+ 'sdkHttpResponse',
15003
+ ]);
15004
+ if (fromSdkHttpResponse != null) {
15005
+ setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
15006
+ }
15007
+ const fromNextPageToken = getValueByPath(fromObject, [
15008
+ 'nextPageToken',
15009
+ ]);
15010
+ if (fromNextPageToken != null) {
15011
+ setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
15012
+ }
15013
+ const fromDocuments = getValueByPath(fromObject, ['documents']);
15014
+ if (fromDocuments != null) {
15015
+ let transformedList = fromDocuments;
15016
+ if (Array.isArray(transformedList)) {
15017
+ transformedList = transformedList.map((item) => {
15018
+ return item;
15019
+ });
15020
+ }
15021
+ setValueByPath(toObject, ['documents'], transformedList);
15022
+ }
15023
+ return toObject;
15024
+ }
15025
+
15026
+ /**
15027
+ * @license
15028
+ * Copyright 2025 Google LLC
15029
+ * SPDX-License-Identifier: Apache-2.0
15030
+ */
15031
+ class Documents extends BaseModule {
15032
+ constructor(apiClient) {
15033
+ super();
15034
+ this.apiClient = apiClient;
15035
+ /**
15036
+ * Lists documents.
15037
+ *
15038
+ * @param params - The parameters for the list request.
15039
+ * @return - A pager of documents.
15040
+ *
15041
+ * @example
15042
+ * ```ts
15043
+ * const documents = await ai.documents.list({config: {'pageSize': 2}});
15044
+ * for await (const document of documents) {
15045
+ * console.log(document);
15046
+ * }
15047
+ * ```
15048
+ */
15049
+ this.list = async (params) => {
15050
+ return new Pager(PagedItem.PAGED_ITEM_DOCUMENTS, (x) => this.listInternal({
15051
+ parent: params.parent,
15052
+ config: x.config,
15053
+ }), await this.listInternal(params), params);
15054
+ };
15055
+ }
15056
+ /**
15057
+ * Gets a Document.
15058
+ *
15059
+ * @param params - The parameters for getting a document.
15060
+ * @return Document.
15061
+ */
15062
+ async get(params) {
15063
+ var _a, _b;
15064
+ let response;
15065
+ let path = '';
15066
+ let queryParams = {};
15067
+ if (this.apiClient.isVertexAI()) {
15068
+ throw new Error('This method is only supported by the Gemini Developer API.');
15069
+ }
15070
+ else {
15071
+ const body = getDocumentParametersToMldev(params);
15072
+ path = formatMap('{name}', body['_url']);
15073
+ queryParams = body['_query'];
15074
+ delete body['_url'];
15075
+ delete body['_query'];
15076
+ response = this.apiClient
15077
+ .request({
15078
+ path: path,
15079
+ queryParams: queryParams,
15080
+ body: JSON.stringify(body),
15081
+ httpMethod: 'GET',
15082
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15083
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15084
+ })
15085
+ .then((httpResponse) => {
15086
+ return httpResponse.json();
15087
+ });
15088
+ return response.then((resp) => {
15089
+ return resp;
15090
+ });
15091
+ }
15092
+ }
15093
+ /**
15094
+ * Deletes a Document.
15095
+ *
15096
+ * @param params - The parameters for deleting a document.
15097
+ */
15098
+ async delete(params) {
15099
+ var _a, _b;
15100
+ let path = '';
15101
+ let queryParams = {};
15102
+ if (this.apiClient.isVertexAI()) {
15103
+ throw new Error('This method is only supported by the Gemini Developer API.');
15104
+ }
15105
+ else {
15106
+ const body = deleteDocumentParametersToMldev(params);
15107
+ path = formatMap('{name}', body['_url']);
15108
+ queryParams = body['_query'];
15109
+ delete body['_url'];
15110
+ delete body['_query'];
15111
+ await this.apiClient.request({
15112
+ path: path,
15113
+ queryParams: queryParams,
15114
+ body: JSON.stringify(body),
15115
+ httpMethod: 'DELETE',
15116
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15117
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15118
+ });
15119
+ }
15120
+ }
15121
+ /**
15122
+ * Lists all Documents in a FileSearchStore.
15123
+ *
15124
+ * @param params - The parameters for listing documents.
15125
+ * @return ListDocumentsResponse.
15126
+ */
15127
+ async listInternal(params) {
15128
+ var _a, _b;
15129
+ let response;
15130
+ let path = '';
15131
+ let queryParams = {};
15132
+ if (this.apiClient.isVertexAI()) {
15133
+ throw new Error('This method is only supported by the Gemini Developer API.');
15134
+ }
15135
+ else {
15136
+ const body = listDocumentsParametersToMldev(params);
15137
+ path = formatMap('{parent}/documents', body['_url']);
15138
+ queryParams = body['_query'];
15139
+ delete body['_url'];
15140
+ delete body['_query'];
15141
+ response = this.apiClient
15142
+ .request({
15143
+ path: path,
15144
+ queryParams: queryParams,
15145
+ body: JSON.stringify(body),
15146
+ httpMethod: 'GET',
15147
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15148
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15149
+ })
15150
+ .then((httpResponse) => {
15151
+ return httpResponse.json();
15152
+ });
15153
+ return response.then((apiResponse) => {
15154
+ const resp = listDocumentsResponseFromMldev(apiResponse);
15155
+ const typedResp = new ListDocumentsResponse();
15156
+ Object.assign(typedResp, resp);
15157
+ return typedResp;
15158
+ });
15159
+ }
15160
+ }
15161
+ }
15162
+
15163
+ /**
15164
+ * @license
15165
+ * Copyright 2025 Google LLC
15166
+ * SPDX-License-Identifier: Apache-2.0
15167
+ */
15168
+ class FileSearchStores extends BaseModule {
15169
+ constructor(apiClient, documents = new Documents(apiClient)) {
15170
+ super();
15171
+ this.apiClient = apiClient;
15172
+ this.documents = documents;
15173
+ /**
15174
+ * Lists file search stores.
15175
+ *
15176
+ * @param params - The parameters for the list request.
15177
+ * @return - A pager of file search stores.
15178
+ *
15179
+ * @example
15180
+ * ```ts
15181
+ * const fileSearchStores = await ai.fileSearchStores.list({config: {'pageSize': 2}});
15182
+ * for await (const fileSearchStore of fileSearchStores) {
15183
+ * console.log(fileSearchStore);
15184
+ * }
15185
+ * ```
15186
+ */
15187
+ this.list = async (params = {}) => {
15188
+ return new Pager(PagedItem.PAGED_ITEM_FILE_SEARCH_STORES, (x) => this.listInternal(x), await this.listInternal(params), params);
15189
+ };
15190
+ }
15191
+ /**
15192
+ * Uploads a file asynchronously to a given File Search Store.
15193
+ * This method is not available in Vertex AI.
15194
+ * Supported upload sources:
15195
+ * - Node.js: File path (string) or Blob object.
15196
+ * - Browser: Blob object (e.g., File).
15197
+ *
15198
+ * @remarks
15199
+ * The `mimeType` can be specified in the `config` parameter. If omitted:
15200
+ * - For file path (string) inputs, the `mimeType` will be inferred from the
15201
+ * file extension.
15202
+ * - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
15203
+ * property.
15204
+ *
15205
+ * This section can contain multiple paragraphs and code examples.
15206
+ *
15207
+ * @param params - Optional parameters specified in the
15208
+ * `types.UploadToFileSearchStoreParameters` interface.
15209
+ * @see {@link types.UploadToFileSearchStoreParameters#config} for the optional
15210
+ * config in the parameters.
15211
+ * @return A promise that resolves to a long running operation.
15212
+ * @throws An error if called on a Vertex AI client.
15213
+ * @throws An error if the `mimeType` is not provided and can not be inferred,
15214
+ * the `mimeType` can be provided in the `params.config` parameter.
15215
+ * @throws An error occurs if a suitable upload location cannot be established.
15216
+ *
15217
+ * @example
15218
+ * The following code uploads a file to a given file search store.
15219
+ *
15220
+ * ```ts
15221
+ * const operation = await ai.fileSearchStores.upload({fileSearchStoreName: 'fileSearchStores/foo-bar', file: 'file.txt', config: {
15222
+ * mimeType: 'text/plain',
15223
+ * }});
15224
+ * console.log(operation.name);
15225
+ * ```
15226
+ */
15227
+ async uploadToFileSearchStore(params) {
15228
+ if (this.apiClient.isVertexAI()) {
15229
+ throw new Error('Vertex AI does not support uploading files to a file search store.');
15230
+ }
15231
+ return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName, params.file, params.config);
15232
+ }
15233
+ /**
15234
+ * Creates a File Search Store.
15235
+ *
15236
+ * @param params - The parameters for creating a File Search Store.
15237
+ * @return FileSearchStore.
15238
+ */
15239
+ async create(params) {
15240
+ var _a, _b;
15241
+ let response;
15242
+ let path = '';
15243
+ let queryParams = {};
15244
+ if (this.apiClient.isVertexAI()) {
15245
+ throw new Error('This method is only supported by the Gemini Developer API.');
15246
+ }
15247
+ else {
15248
+ const body = createFileSearchStoreParametersToMldev(params);
15249
+ path = formatMap('fileSearchStores', body['_url']);
15250
+ queryParams = body['_query'];
15251
+ delete body['_url'];
15252
+ delete body['_query'];
15253
+ response = this.apiClient
15254
+ .request({
15255
+ path: path,
15256
+ queryParams: queryParams,
15257
+ body: JSON.stringify(body),
15258
+ httpMethod: 'POST',
15259
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15260
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15261
+ })
15262
+ .then((httpResponse) => {
15263
+ return httpResponse.json();
15264
+ });
15265
+ return response.then((resp) => {
15266
+ return resp;
15267
+ });
15268
+ }
15269
+ }
15270
+ /**
15271
+ * Gets a File Search Store.
15272
+ *
15273
+ * @param params - The parameters for getting a File Search Store.
15274
+ * @return FileSearchStore.
15275
+ */
15276
+ async get(params) {
15277
+ var _a, _b;
15278
+ let response;
15279
+ let path = '';
15280
+ let queryParams = {};
15281
+ if (this.apiClient.isVertexAI()) {
15282
+ throw new Error('This method is only supported by the Gemini Developer API.');
15283
+ }
15284
+ else {
15285
+ const body = getFileSearchStoreParametersToMldev(params);
15286
+ path = formatMap('{name}', body['_url']);
15287
+ queryParams = body['_query'];
15288
+ delete body['_url'];
15289
+ delete body['_query'];
15290
+ response = this.apiClient
15291
+ .request({
15292
+ path: path,
15293
+ queryParams: queryParams,
15294
+ body: JSON.stringify(body),
15295
+ httpMethod: 'GET',
15296
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15297
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15298
+ })
15299
+ .then((httpResponse) => {
15300
+ return httpResponse.json();
15301
+ });
15302
+ return response.then((resp) => {
15303
+ return resp;
15304
+ });
15305
+ }
15306
+ }
15307
+ /**
15308
+ * Deletes a File Search Store.
15309
+ *
15310
+ * @param params - The parameters for deleting a File Search Store.
15311
+ */
15312
+ async delete(params) {
15313
+ var _a, _b;
15314
+ let path = '';
15315
+ let queryParams = {};
15316
+ if (this.apiClient.isVertexAI()) {
15317
+ throw new Error('This method is only supported by the Gemini Developer API.');
15318
+ }
15319
+ else {
15320
+ const body = deleteFileSearchStoreParametersToMldev(params);
15321
+ path = formatMap('{name}', body['_url']);
15322
+ queryParams = body['_query'];
15323
+ delete body['_url'];
15324
+ delete body['_query'];
15325
+ await this.apiClient.request({
15326
+ path: path,
15327
+ queryParams: queryParams,
15328
+ body: JSON.stringify(body),
15329
+ httpMethod: 'DELETE',
15330
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15331
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15332
+ });
15333
+ }
15334
+ }
15335
+ /**
15336
+ * Lists all FileSearchStore owned by the user.
15337
+ *
15338
+ * @param params - The parameters for listing file search stores.
15339
+ * @return ListFileSearchStoresResponse.
15340
+ */
15341
+ async listInternal(params) {
15342
+ var _a, _b;
15343
+ let response;
15344
+ let path = '';
15345
+ let queryParams = {};
15346
+ if (this.apiClient.isVertexAI()) {
15347
+ throw new Error('This method is only supported by the Gemini Developer API.');
15348
+ }
15349
+ else {
15350
+ const body = listFileSearchStoresParametersToMldev(params);
15351
+ path = formatMap('fileSearchStores', body['_url']);
15352
+ queryParams = body['_query'];
15353
+ delete body['_url'];
15354
+ delete body['_query'];
15355
+ response = this.apiClient
15356
+ .request({
15357
+ path: path,
15358
+ queryParams: queryParams,
15359
+ body: JSON.stringify(body),
15360
+ httpMethod: 'GET',
15361
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15362
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15363
+ })
15364
+ .then((httpResponse) => {
15365
+ return httpResponse.json();
15366
+ });
15367
+ return response.then((apiResponse) => {
15368
+ const resp = listFileSearchStoresResponseFromMldev(apiResponse);
15369
+ const typedResp = new ListFileSearchStoresResponse();
15370
+ Object.assign(typedResp, resp);
15371
+ return typedResp;
15372
+ });
15373
+ }
15374
+ }
15375
+ async uploadToFileSearchStoreInternal(params) {
15376
+ var _a, _b;
15377
+ let response;
15378
+ let path = '';
15379
+ let queryParams = {};
15380
+ if (this.apiClient.isVertexAI()) {
15381
+ throw new Error('This method is only supported by the Gemini Developer API.');
15382
+ }
15383
+ else {
15384
+ const body = uploadToFileSearchStoreParametersToMldev(params);
15385
+ path = formatMap('upload/v1beta/{file_search_store_name}:uploadToFileSearchStore', body['_url']);
15386
+ queryParams = body['_query'];
15387
+ delete body['_url'];
15388
+ delete body['_query'];
15389
+ response = this.apiClient
15390
+ .request({
15391
+ path: path,
15392
+ queryParams: queryParams,
15393
+ body: JSON.stringify(body),
15394
+ httpMethod: 'POST',
15395
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15396
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15397
+ })
15398
+ .then((httpResponse) => {
15399
+ return httpResponse.json();
15400
+ });
15401
+ return response.then((apiResponse) => {
15402
+ const resp = uploadToFileSearchStoreResumableResponseFromMldev(apiResponse);
15403
+ const typedResp = new UploadToFileSearchStoreResumableResponse();
15404
+ Object.assign(typedResp, resp);
15405
+ return typedResp;
15406
+ });
15407
+ }
15408
+ }
15409
+ /**
15410
+ * Imports a File from File Service to a FileSearchStore.
15411
+ *
15412
+ * This is a long-running operation, see aip.dev/151
15413
+ *
15414
+ * @param params - The parameters for importing a file to a file search store.
15415
+ * @return ImportFileOperation.
15416
+ */
15417
+ async importFile(params) {
15418
+ var _a, _b;
15419
+ let response;
15420
+ let path = '';
15421
+ let queryParams = {};
15422
+ if (this.apiClient.isVertexAI()) {
15423
+ throw new Error('This method is only supported by the Gemini Developer API.');
15424
+ }
15425
+ else {
15426
+ const body = importFileParametersToMldev(params);
15427
+ path = formatMap('{file_search_store_name}:importFile', body['_url']);
15428
+ queryParams = body['_query'];
15429
+ delete body['_url'];
15430
+ delete body['_query'];
15431
+ response = this.apiClient
15432
+ .request({
15433
+ path: path,
15434
+ queryParams: queryParams,
15435
+ body: JSON.stringify(body),
15436
+ httpMethod: 'POST',
15437
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15438
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15439
+ })
15440
+ .then((httpResponse) => {
15441
+ return httpResponse.json();
15442
+ });
15443
+ return response.then((apiResponse) => {
15444
+ const resp = importFileOperationFromMldev(apiResponse);
15445
+ const typedResp = new ImportFileOperation();
15446
+ Object.assign(typedResp, resp);
15447
+ return typedResp;
15448
+ });
15449
+ }
15450
+ }
15451
+ }
15452
+
15453
+ /**
15454
+ * @license
15455
+ * Copyright 2025 Google LLC
15456
+ * SPDX-License-Identifier: Apache-2.0
15457
+ */
15458
+ // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
15459
+ function cancelTuningJobParametersToMldev(fromObject, _rootObject) {
15460
+ const toObject = {};
15461
+ const fromName = getValueByPath(fromObject, ['name']);
15462
+ if (fromName != null) {
15463
+ setValueByPath(toObject, ['_url', 'name'], fromName);
15464
+ }
15465
+ return toObject;
15466
+ }
15467
+ function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
15468
+ const toObject = {};
15469
+ const fromName = getValueByPath(fromObject, ['name']);
15470
+ if (fromName != null) {
15471
+ setValueByPath(toObject, ['_url', 'name'], fromName);
15472
+ }
15473
+ return toObject;
15474
+ }
15475
+ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
15476
+ const toObject = {};
15477
+ if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
15478
+ throw new Error('validationDataset parameter is not supported in Gemini API.');
15479
+ }
15480
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
15481
+ 'tunedModelDisplayName',
15482
+ ]);
15483
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
15484
+ setValueByPath(parentObject, ['displayName'], fromTunedModelDisplayName);
15485
+ }
15486
+ if (getValueByPath(fromObject, ['description']) !== undefined) {
15487
+ throw new Error('description parameter is not supported in Gemini API.');
15488
+ }
15489
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
15490
+ if (parentObject !== undefined && fromEpochCount != null) {
15491
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'epochCount'], fromEpochCount);
15492
+ }
15493
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
15494
+ 'learningRateMultiplier',
15495
+ ]);
15496
+ if (fromLearningRateMultiplier != null) {
15497
+ setValueByPath(toObject, ['tuningTask', 'hyperparameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
15498
+ }
15499
+ if (getValueByPath(fromObject, ['exportLastCheckpointOnly']) !==
15500
+ undefined) {
15501
+ throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
15502
+ }
15503
+ if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
15504
+ undefined) {
15505
+ throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
15506
+ }
15507
+ if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
15508
+ throw new Error('adapterSize parameter is not supported in Gemini API.');
15509
+ }
15510
+ const fromBatchSize = getValueByPath(fromObject, ['batchSize']);
15511
+ if (parentObject !== undefined && fromBatchSize != null) {
15512
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'batchSize'], fromBatchSize);
15513
+ }
15514
+ const fromLearningRate = getValueByPath(fromObject, ['learningRate']);
15515
+ if (parentObject !== undefined && fromLearningRate != null) {
15516
+ setValueByPath(parentObject, ['tuningTask', 'hyperparameters', 'learningRate'], fromLearningRate);
15517
+ }
15518
+ if (getValueByPath(fromObject, ['labels']) !== undefined) {
15519
+ throw new Error('labels parameter is not supported in Gemini API.');
15520
+ }
15521
+ if (getValueByPath(fromObject, ['beta']) !== undefined) {
15522
+ throw new Error('beta parameter is not supported in Gemini API.');
15523
+ }
15524
+ return toObject;
15525
+ }
15526
+ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
15527
+ const toObject = {};
15528
+ let discriminatorValidationDataset = getValueByPath(rootObject, [
15529
+ 'config',
15530
+ 'method',
15531
+ ]);
15532
+ if (discriminatorValidationDataset === undefined) {
15533
+ discriminatorValidationDataset = 'SUPERVISED_FINE_TUNING';
15534
+ }
15535
+ if (discriminatorValidationDataset === 'SUPERVISED_FINE_TUNING') {
15536
+ const fromValidationDataset = getValueByPath(fromObject, [
15537
+ 'validationDataset',
15538
+ ]);
15539
+ if (parentObject !== undefined && fromValidationDataset != null) {
15540
+ setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
15541
+ }
15542
+ }
15543
+ else if (discriminatorValidationDataset === 'PREFERENCE_TUNING') {
15544
+ const fromValidationDataset = getValueByPath(fromObject, [
15545
+ 'validationDataset',
15546
+ ]);
15547
+ if (parentObject !== undefined && fromValidationDataset != null) {
15548
+ setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
15549
+ }
15550
+ }
15551
+ const fromTunedModelDisplayName = getValueByPath(fromObject, [
15552
+ 'tunedModelDisplayName',
15553
+ ]);
15554
+ if (parentObject !== undefined && fromTunedModelDisplayName != null) {
15555
+ setValueByPath(parentObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
15556
+ }
15557
+ const fromDescription = getValueByPath(fromObject, ['description']);
15558
+ if (parentObject !== undefined && fromDescription != null) {
15559
+ setValueByPath(parentObject, ['description'], fromDescription);
15560
+ }
15561
+ let discriminatorEpochCount = getValueByPath(rootObject, [
15562
+ 'config',
15563
+ 'method',
15564
+ ]);
15565
+ if (discriminatorEpochCount === undefined) {
15566
+ discriminatorEpochCount = 'SUPERVISED_FINE_TUNING';
15567
+ }
15568
+ if (discriminatorEpochCount === 'SUPERVISED_FINE_TUNING') {
15569
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
15570
+ if (parentObject !== undefined && fromEpochCount != null) {
15571
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
15572
+ }
15573
+ }
15574
+ else if (discriminatorEpochCount === 'PREFERENCE_TUNING') {
15575
+ const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
15576
+ if (parentObject !== undefined && fromEpochCount != null) {
15577
+ setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
15578
+ }
15579
+ }
15580
+ let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
15581
+ 'config',
15582
+ 'method',
15583
+ ]);
15584
+ if (discriminatorLearningRateMultiplier === undefined) {
15585
+ discriminatorLearningRateMultiplier = 'SUPERVISED_FINE_TUNING';
15586
+ }
15587
+ if (discriminatorLearningRateMultiplier === 'SUPERVISED_FINE_TUNING') {
15588
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
15589
+ 'learningRateMultiplier',
15590
+ ]);
15591
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
15592
+ setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
15593
+ }
15594
+ }
15595
+ else if (discriminatorLearningRateMultiplier === 'PREFERENCE_TUNING') {
15596
+ const fromLearningRateMultiplier = getValueByPath(fromObject, [
15597
+ 'learningRateMultiplier',
15598
+ ]);
15599
+ if (parentObject !== undefined && fromLearningRateMultiplier != null) {
15600
+ setValueByPath(parentObject, [
15601
+ 'preferenceOptimizationSpec',
15602
+ 'hyperParameters',
15603
+ 'learningRateMultiplier',
15604
+ ], fromLearningRateMultiplier);
15605
+ }
14523
15606
  }
14524
15607
  let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
14525
15608
  if (discriminatorExportLastCheckpointOnly === undefined) {
@@ -15394,7 +16477,28 @@ const INITIAL_RETRY_DELAY_MS = 1000;
15394
16477
  const DELAY_MULTIPLIER = 2;
15395
16478
  const X_GOOG_UPLOAD_STATUS_HEADER_FIELD = 'x-goog-upload-status';
15396
16479
  async function uploadBlob(file, uploadUrl, apiClient) {
15397
- var _a, _b, _c;
16480
+ var _a;
16481
+ const response = await uploadBlobInternal(file, uploadUrl, apiClient);
16482
+ const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
16483
+ 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') {
16484
+ throw new Error('Failed to upload file: Upload status is not finalized.');
16485
+ }
16486
+ return responseJson['file'];
16487
+ }
16488
+ async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient) {
16489
+ var _a;
16490
+ const response = await uploadBlobInternal(file, uploadUrl, apiClient);
16491
+ const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
16492
+ 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') {
16493
+ throw new Error('Failed to upload file: Upload status is not finalized.');
16494
+ }
16495
+ const resp = uploadToFileSearchStoreOperationFromMldev(responseJson);
16496
+ const typedResp = new UploadToFileSearchStoreOperation();
16497
+ Object.assign(typedResp, resp);
16498
+ return typedResp;
16499
+ }
16500
+ async function uploadBlobInternal(file, uploadUrl, apiClient) {
16501
+ var _a, _b;
15398
16502
  let fileSize = 0;
15399
16503
  let offset = 0;
15400
16504
  let response = new HttpResponse(new Response());
@@ -15442,11 +16546,7 @@ async function uploadBlob(file, uploadUrl, apiClient) {
15442
16546
  throw new Error('All content has been uploaded, but the upload status is not finalized.');
15443
16547
  }
15444
16548
  }
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'];
16549
+ return response;
15450
16550
  }
15451
16551
  async function getBlobStat(file) {
15452
16552
  const fileStat = { size: file.size, type: file.type };
@@ -15463,6 +16563,12 @@ class BrowserUploader {
15463
16563
  }
15464
16564
  return await uploadBlob(file, uploadUrl, apiClient);
15465
16565
  }
16566
+ async uploadToFileSearchStore(file, uploadUrl, apiClient) {
16567
+ if (typeof file === 'string') {
16568
+ throw new Error('File path is not supported in browser uploader.');
16569
+ }
16570
+ return await uploadBlobToFileSearchStore(file, uploadUrl, apiClient);
16571
+ }
15466
16572
  async stat(file) {
15467
16573
  if (typeof file === 'string') {
15468
16574
  throw new Error('File path is not supported in browser uploader.');
@@ -15623,8 +16729,9 @@ class GoogleGenAI {
15623
16729
  this.operations = new Operations(this.apiClient);
15624
16730
  this.authTokens = new Tokens(this.apiClient);
15625
16731
  this.tunings = new Tunings(this.apiClient);
16732
+ this.fileSearchStores = new FileSearchStores(this.apiClient);
15626
16733
  }
15627
16734
  }
15628
16735
 
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 };
16736
+ 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
16737
  //# sourceMappingURL=index.mjs.map