@google/genai 1.50.1 → 1.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1632,7 +1632,7 @@ exports.FeatureSelectionPreference = void 0;
1632
1632
  FeatureSelectionPreference["BALANCED"] = "BALANCED";
1633
1633
  FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
1634
1634
  })(exports.FeatureSelectionPreference || (exports.FeatureSelectionPreference = {}));
1635
- /** Enum representing the Vertex embedding API to use. */
1635
+ /** Enum representing the Gemini Enterprise Agent Platform embedding API to use. */
1636
1636
  exports.EmbeddingApiType = void 0;
1637
1637
  (function (EmbeddingApiType) {
1638
1638
  /**
@@ -1790,6 +1790,20 @@ exports.VideoCompressionQuality = void 0;
1790
1790
  */
1791
1791
  VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
1792
1792
  })(exports.VideoCompressionQuality || (exports.VideoCompressionQuality = {}));
1793
+ /** Resize mode for the image input for video generation. */
1794
+ exports.ImageResizeMode = void 0;
1795
+ (function (ImageResizeMode) {
1796
+ /**
1797
+ * Crop the image to fit the correct aspect ratio (so we lose parts
1798
+ of the image in the process).
1799
+ */
1800
+ ImageResizeMode["CROP"] = "CROP";
1801
+ /**
1802
+ * Pad the image to fit the correct aspect ratio (so we don't lose
1803
+ any parts of the image in the process).
1804
+ */
1805
+ ImageResizeMode["PAD"] = "PAD";
1806
+ })(exports.ImageResizeMode || (exports.ImageResizeMode = {}));
1793
1807
  /** Enum representing the tuning method. */
1794
1808
  exports.TuningMethod = void 0;
1795
1809
  (function (TuningMethod) {
@@ -3599,6 +3613,9 @@ function tBatchJobSource(client, src) {
3599
3613
  else if (src.startsWith('bq://')) {
3600
3614
  sourceObj = { format: 'bigquery', bigqueryUri: src };
3601
3615
  }
3616
+ else if (/^projects\/[^/]+\/locations\/[^/]+\/datasets\/[^/]+$/.test(src)) {
3617
+ sourceObj = { format: 'vertex-dataset', vertexDatasetName: src };
3618
+ }
3602
3619
  else {
3603
3620
  throw new Error(`Unsupported string source for Vertex AI: ${src}`);
3604
3621
  }
@@ -3624,14 +3641,18 @@ function tBatchJobSource(client, src) {
3624
3641
  sourceObj = src;
3625
3642
  }
3626
3643
  // Validation logic
3627
- const vertexSourcesCount = [sourceObj.gcsUri, sourceObj.bigqueryUri].filter(Boolean).length;
3644
+ const vertexSourcesCount = [
3645
+ sourceObj.gcsUri,
3646
+ sourceObj.bigqueryUri,
3647
+ sourceObj.vertexDatasetName,
3648
+ ].filter(Boolean).length;
3628
3649
  const mldevSourcesCount = [
3629
3650
  sourceObj.inlinedRequests,
3630
3651
  sourceObj.fileName,
3631
3652
  ].filter(Boolean).length;
3632
3653
  if (client.isVertexAI()) {
3633
3654
  if (mldevSourcesCount > 0 || vertexSourcesCount !== 1) {
3634
- throw new Error('Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.');
3655
+ throw new Error('Exactly one of `gcsUri`, `bigqueryUri`, or `vertexDatasetName` must be set for Vertex AI.');
3635
3656
  }
3636
3657
  }
3637
3658
  else {
@@ -3850,6 +3871,12 @@ function batchJobDestinationFromVertex(fromObject) {
3850
3871
  if (fromBigqueryUri != null) {
3851
3872
  setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
3852
3873
  }
3874
+ const fromVertexDataset = getValueByPath(fromObject, [
3875
+ 'vertexMultimodalDatasetDestination',
3876
+ ]);
3877
+ if (fromVertexDataset != null) {
3878
+ setValueByPath(toObject, ['vertexDataset'], vertexMultimodalDatasetDestinationFromVertex(fromVertexDataset));
3879
+ }
3853
3880
  return toObject;
3854
3881
  }
3855
3882
  function batchJobDestinationToVertex(fromObject) {
@@ -3867,14 +3894,20 @@ function batchJobDestinationToVertex(fromObject) {
3867
3894
  setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryUri);
3868
3895
  }
3869
3896
  if (getValueByPath(fromObject, ['fileName']) !== undefined) {
3870
- throw new Error('fileName parameter is not supported in Vertex AI.');
3897
+ throw new Error('fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3871
3898
  }
3872
3899
  if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
3873
- throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
3900
+ throw new Error('inlinedResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3874
3901
  }
3875
3902
  if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
3876
3903
  undefined) {
3877
- throw new Error('inlinedEmbedContentResponses parameter is not supported in Vertex AI.');
3904
+ throw new Error('inlinedEmbedContentResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3905
+ }
3906
+ const fromVertexDataset = getValueByPath(fromObject, [
3907
+ 'vertexDataset',
3908
+ ]);
3909
+ if (fromVertexDataset != null) {
3910
+ setValueByPath(toObject, ['vertexMultimodalDatasetDestination'], vertexMultimodalDatasetDestinationToVertex(fromVertexDataset));
3878
3911
  }
3879
3912
  return toObject;
3880
3913
  }
@@ -3978,6 +4011,10 @@ function batchJobFromVertex(fromObject) {
3978
4011
  if (fromCompletionStats != null) {
3979
4012
  setValueByPath(toObject, ['completionStats'], fromCompletionStats);
3980
4013
  }
4014
+ const fromOutputInfo = getValueByPath(fromObject, ['outputInfo']);
4015
+ if (fromOutputInfo != null) {
4016
+ setValueByPath(toObject, ['outputInfo'], fromOutputInfo);
4017
+ }
3981
4018
  return toObject;
3982
4019
  }
3983
4020
  function batchJobSourceFromVertex(fromObject) {
@@ -3997,6 +4034,13 @@ function batchJobSourceFromVertex(fromObject) {
3997
4034
  if (fromBigqueryUri != null) {
3998
4035
  setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
3999
4036
  }
4037
+ const fromVertexDatasetName = getValueByPath(fromObject, [
4038
+ 'vertexMultimodalDatasetSource',
4039
+ 'datasetName',
4040
+ ]);
4041
+ if (fromVertexDatasetName != null) {
4042
+ setValueByPath(toObject, ['vertexDatasetName'], fromVertexDatasetName);
4043
+ }
4000
4044
  return toObject;
4001
4045
  }
4002
4046
  function batchJobSourceToMldev(apiClient, fromObject) {
@@ -4026,6 +4070,9 @@ function batchJobSourceToMldev(apiClient, fromObject) {
4026
4070
  }
4027
4071
  setValueByPath(toObject, ['requests', 'requests'], transformedList);
4028
4072
  }
4073
+ if (getValueByPath(fromObject, ['vertexDatasetName']) !== undefined) {
4074
+ throw new Error('vertexDatasetName parameter is not supported in Gemini API.');
4075
+ }
4029
4076
  return toObject;
4030
4077
  }
4031
4078
  function batchJobSourceToVertex(fromObject) {
@@ -4043,10 +4090,16 @@ function batchJobSourceToVertex(fromObject) {
4043
4090
  setValueByPath(toObject, ['bigquerySource', 'inputUri'], fromBigqueryUri);
4044
4091
  }
4045
4092
  if (getValueByPath(fromObject, ['fileName']) !== undefined) {
4046
- throw new Error('fileName parameter is not supported in Vertex AI.');
4093
+ throw new Error('fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
4047
4094
  }
4048
4095
  if (getValueByPath(fromObject, ['inlinedRequests']) !== undefined) {
4049
- throw new Error('inlinedRequests parameter is not supported in Vertex AI.');
4096
+ throw new Error('inlinedRequests parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
4097
+ }
4098
+ const fromVertexDatasetName = getValueByPath(fromObject, [
4099
+ 'vertexDatasetName',
4100
+ ]);
4101
+ if (fromVertexDatasetName != null) {
4102
+ setValueByPath(toObject, ['vertexMultimodalDatasetSource', 'datasetName'], fromVertexDatasetName);
4050
4103
  }
4051
4104
  return toObject;
4052
4105
  }
@@ -4201,7 +4254,7 @@ function createBatchJobConfigToVertex(fromObject, parentObject) {
4201
4254
  setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
4202
4255
  }
4203
4256
  if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
4204
- throw new Error('webhookConfig parameter is not supported in Vertex AI.');
4257
+ throw new Error('webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
4205
4258
  }
4206
4259
  return toObject;
4207
4260
  }
@@ -5043,6 +5096,35 @@ function toolToMldev$4(fromObject) {
5043
5096
  }
5044
5097
  return toObject;
5045
5098
  }
5099
+ function vertexMultimodalDatasetDestinationFromVertex(fromObject) {
5100
+ const toObject = {};
5101
+ const fromBigqueryDestination = getValueByPath(fromObject, [
5102
+ 'bigqueryDestination',
5103
+ 'outputUri',
5104
+ ]);
5105
+ if (fromBigqueryDestination != null) {
5106
+ setValueByPath(toObject, ['bigqueryDestination'], fromBigqueryDestination);
5107
+ }
5108
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5109
+ if (fromDisplayName != null) {
5110
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5111
+ }
5112
+ return toObject;
5113
+ }
5114
+ function vertexMultimodalDatasetDestinationToVertex(fromObject) {
5115
+ const toObject = {};
5116
+ const fromBigqueryDestination = getValueByPath(fromObject, [
5117
+ 'bigqueryDestination',
5118
+ ]);
5119
+ if (fromBigqueryDestination != null) {
5120
+ setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryDestination);
5121
+ }
5122
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5123
+ if (fromDisplayName != null) {
5124
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5125
+ }
5126
+ return toObject;
5127
+ }
5046
5128
 
5047
5129
  /**
5048
5130
  * @license
@@ -5297,7 +5379,7 @@ class Batches extends BaseModule {
5297
5379
  this.createEmbeddings = async (params) => {
5298
5380
  console.warn('batches.createEmbeddings() is experimental and may change without notice.');
5299
5381
  if (this.apiClient.isVertexAI()) {
5300
- throw new Error('Vertex AI does not support batches.createEmbeddings.');
5382
+ throw new Error('Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.createEmbeddings.');
5301
5383
  }
5302
5384
  return this.createEmbeddingsInternal(params);
5303
5385
  };
@@ -5374,7 +5456,7 @@ class Batches extends BaseModule {
5374
5456
  newConfig.dest = `${bigqueryUri}_dest_${timestampStr}`;
5375
5457
  }
5376
5458
  else {
5377
- throw new Error('Unsupported source for Vertex AI: No GCS or BigQuery URI found.');
5459
+ throw new Error('Unsupported source for Gemini Enterprise Agent Platform (previously known as Vertex AI): No GCS or BigQuery URI found.');
5378
5460
  }
5379
5461
  }
5380
5462
  return newConfig;
@@ -6059,7 +6141,7 @@ function functionDeclarationToVertex$2(fromObject) {
6059
6141
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6060
6142
  }
6061
6143
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
6062
- throw new Error('behavior parameter is not supported in Vertex AI.');
6144
+ throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6063
6145
  }
6064
6146
  return toObject;
6065
6147
  }
@@ -6338,13 +6420,13 @@ function partToVertex$2(fromObject) {
6338
6420
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
6339
6421
  }
6340
6422
  if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
6341
- throw new Error('toolCall parameter is not supported in Vertex AI.');
6423
+ throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6342
6424
  }
6343
6425
  if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
6344
- throw new Error('toolResponse parameter is not supported in Vertex AI.');
6426
+ throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6345
6427
  }
6346
6428
  if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
6347
- throw new Error('partMetadata parameter is not supported in Vertex AI.');
6429
+ throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6348
6430
  }
6349
6431
  return toObject;
6350
6432
  }
@@ -6384,7 +6466,7 @@ function toolConfigToVertex$1(fromObject) {
6384
6466
  }
6385
6467
  if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
6386
6468
  undefined) {
6387
- throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
6469
+ throw new Error('includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6388
6470
  }
6389
6471
  return toObject;
6390
6472
  }
@@ -6466,7 +6548,7 @@ function toolToVertex$2(fromObject) {
6466
6548
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
6467
6549
  }
6468
6550
  if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
6469
- throw new Error('fileSearch parameter is not supported in Vertex AI.');
6551
+ throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6470
6552
  }
6471
6553
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
6472
6554
  if (fromGoogleSearch != null) {
@@ -6517,7 +6599,7 @@ function toolToVertex$2(fromObject) {
6517
6599
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
6518
6600
  }
6519
6601
  if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
6520
- throw new Error('mcpServers parameter is not supported in Vertex AI.');
6602
+ throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6521
6603
  }
6522
6604
  return toObject;
6523
6605
  }
@@ -6603,7 +6685,7 @@ class Caches extends BaseModule {
6603
6685
  * @remarks
6604
6686
  * Context caching is only supported for specific models. See [Gemini
6605
6687
  * Developer API reference](https://ai.google.dev/gemini-api/docs/caching?lang=node/context-cac)
6606
- * and [Vertex AI reference](https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
6688
+ * and [Gemini Enterprise Agent Platform reference](https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
6607
6689
  * for more information.
6608
6690
  *
6609
6691
  * @param params - The parameters for the create request.
@@ -7512,7 +7594,7 @@ class Files extends BaseModule {
7512
7594
  }
7513
7595
  /**
7514
7596
  * Uploads a file asynchronously to the Gemini API.
7515
- * This method is not available in Vertex AI.
7597
+ * This method is not available in Gemini Enterprise Agent Platform (previously known as Vertex AI).
7516
7598
  * Supported upload sources:
7517
7599
  * - Node.js: File path (string) or Blob object.
7518
7600
  * - Browser: Blob object (e.g., File).
@@ -7538,7 +7620,7 @@ class Files extends BaseModule {
7538
7620
  * @see {@link types.UploadFileParameters#config} for the optional
7539
7621
  * config in the parameters.
7540
7622
  * @return A promise that resolves to a `types.File` object.
7541
- * @throws An error if called on a Vertex AI client.
7623
+ * @throws An error if called on a Gemini Enterprise Agent Platform (previously known as Vertex AI) client.
7542
7624
  * @throws An error if the `mimeType` is not provided and can not be inferred,
7543
7625
  * the `mimeType` can be provided in the `params.config` parameter.
7544
7626
  * @throws An error occurs if a suitable upload location cannot be established.
@@ -7555,7 +7637,7 @@ class Files extends BaseModule {
7555
7637
  */
7556
7638
  async upload(params) {
7557
7639
  if (this.apiClient.isVertexAI()) {
7558
- throw new Error('Vertex AI does not support uploading files. You can share files through a GCS bucket.');
7640
+ throw new Error('Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files. You can share files through a GCS bucket.');
7559
7641
  }
7560
7642
  return this.apiClient
7561
7643
  .uploadFile(params.file, params.config)
@@ -7959,7 +8041,7 @@ function functionDeclarationToVertex$1(fromObject) {
7959
8041
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
7960
8042
  }
7961
8043
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
7962
- throw new Error('behavior parameter is not supported in Vertex AI.');
8044
+ throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
7963
8045
  }
7964
8046
  return toObject;
7965
8047
  }
@@ -8087,7 +8169,7 @@ function generationConfigToVertex$1(fromObject) {
8087
8169
  }
8088
8170
  if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
8089
8171
  undefined) {
8090
- throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
8172
+ throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8091
8173
  }
8092
8174
  return toObject;
8093
8175
  }
@@ -8703,13 +8785,13 @@ function partToVertex$1(fromObject) {
8703
8785
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
8704
8786
  }
8705
8787
  if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
8706
- throw new Error('toolCall parameter is not supported in Vertex AI.');
8788
+ throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8707
8789
  }
8708
8790
  if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
8709
- throw new Error('toolResponse parameter is not supported in Vertex AI.');
8791
+ throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8710
8792
  }
8711
8793
  if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
8712
- throw new Error('partMetadata parameter is not supported in Vertex AI.');
8794
+ throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8713
8795
  }
8714
8796
  return toObject;
8715
8797
  }
@@ -8817,7 +8899,7 @@ function toolToVertex$1(fromObject) {
8817
8899
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
8818
8900
  }
8819
8901
  if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
8820
- throw new Error('fileSearch parameter is not supported in Vertex AI.');
8902
+ throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8821
8903
  }
8822
8904
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
8823
8905
  if (fromGoogleSearch != null) {
@@ -8868,7 +8950,7 @@ function toolToVertex$1(fromObject) {
8868
8950
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
8869
8951
  }
8870
8952
  if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
8871
- throw new Error('mcpServers parameter is not supported in Vertex AI.');
8953
+ throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
8872
8954
  }
8873
8955
  return toObject;
8874
8956
  }
@@ -9892,7 +9974,7 @@ function functionDeclarationToVertex(fromObject, _rootObject) {
9892
9974
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
9893
9975
  }
9894
9976
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
9895
- throw new Error('behavior parameter is not supported in Vertex AI.');
9977
+ throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
9896
9978
  }
9897
9979
  return toObject;
9898
9980
  }
@@ -10227,7 +10309,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
10227
10309
  }
10228
10310
  if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
10229
10311
  undefined) {
10230
- throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
10312
+ throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
10231
10313
  }
10232
10314
  const fromModelArmorConfig = getValueByPath(fromObject, [
10233
10315
  'modelArmorConfig',
@@ -10721,6 +10803,9 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
10721
10803
  if (parentObject !== undefined && fromWebhookConfig != null) {
10722
10804
  setValueByPath(parentObject, ['webhookConfig'], fromWebhookConfig);
10723
10805
  }
10806
+ if (getValueByPath(fromObject, ['resizeMode']) !== undefined) {
10807
+ throw new Error('resizeMode parameter is not supported in Gemini API.');
10808
+ }
10724
10809
  return toObject;
10725
10810
  }
10726
10811
  function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
@@ -10816,7 +10901,11 @@ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
10816
10901
  setValueByPath(parentObject, ['labels'], fromLabels);
10817
10902
  }
10818
10903
  if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
10819
- throw new Error('webhookConfig parameter is not supported in Vertex AI.');
10904
+ throw new Error('webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
10905
+ }
10906
+ const fromResizeMode = getValueByPath(fromObject, ['resizeMode']);
10907
+ if (parentObject !== undefined && fromResizeMode != null) {
10908
+ setValueByPath(parentObject, ['parameters', 'resizeMode'], fromResizeMode);
10820
10909
  }
10821
10910
  return toObject;
10822
10911
  }
@@ -11211,7 +11300,7 @@ function generationConfigToVertex(fromObject, _rootObject) {
11211
11300
  }
11212
11301
  if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
11213
11302
  undefined) {
11214
- throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
11303
+ throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11215
11304
  }
11216
11305
  return toObject;
11217
11306
  }
@@ -11771,13 +11860,13 @@ function partToVertex(fromObject, _rootObject) {
11771
11860
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
11772
11861
  }
11773
11862
  if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
11774
- throw new Error('toolCall parameter is not supported in Vertex AI.');
11863
+ throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11775
11864
  }
11776
11865
  if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
11777
- throw new Error('toolResponse parameter is not supported in Vertex AI.');
11866
+ throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11778
11867
  }
11779
11868
  if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
11780
- throw new Error('partMetadata parameter is not supported in Vertex AI.');
11869
+ throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11781
11870
  }
11782
11871
  return toObject;
11783
11872
  }
@@ -12134,7 +12223,7 @@ function toolConfigToVertex(fromObject, _rootObject) {
12134
12223
  }
12135
12224
  if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
12136
12225
  undefined) {
12137
- throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
12226
+ throw new Error('includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12138
12227
  }
12139
12228
  return toObject;
12140
12229
  }
@@ -12216,7 +12305,7 @@ function toolToVertex(fromObject, rootObject) {
12216
12305
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
12217
12306
  }
12218
12307
  if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
12219
- throw new Error('fileSearch parameter is not supported in Vertex AI.');
12308
+ throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12220
12309
  }
12221
12310
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
12222
12311
  if (fromGoogleSearch != null) {
@@ -12267,7 +12356,7 @@ function toolToVertex(fromObject, rootObject) {
12267
12356
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
12268
12357
  }
12269
12358
  if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
12270
- throw new Error('mcpServers parameter is not supported in Vertex AI.');
12359
+ throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12271
12360
  }
12272
12361
  return toObject;
12273
12362
  }
@@ -12825,7 +12914,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
12825
12914
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
12826
12915
  const USER_AGENT_HEADER = 'User-Agent';
12827
12916
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
12828
- const SDK_VERSION = '1.50.1'; // x-release-please-version
12917
+ const SDK_VERSION = '1.51.0'; // x-release-please-version
12829
12918
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
12830
12919
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
12831
12920
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -14480,7 +14569,7 @@ class Models extends BaseModule {
14480
14569
  /**
14481
14570
  * Makes an API request to generate content with a given model.
14482
14571
  *
14483
- * For the `model` parameter, supported formats for Vertex AI API include:
14572
+ * For the `model` parameter, supported formats for Gemini Enterprise Agent Platform API include:
14484
14573
  * - The Gemini model ID, for example: 'gemini-2.0-flash'
14485
14574
  * - The full resource name starts with 'projects/', for example:
14486
14575
  * 'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
@@ -14571,7 +14660,7 @@ class Models extends BaseModule {
14571
14660
  * Makes an API request to generate content with a given model and yields the
14572
14661
  * response in chunks.
14573
14662
  *
14574
- * For the `model` parameter, supported formats for Vertex AI API include:
14663
+ * For the `model` parameter, supported formats for Gemini Enterprise Agent Platform API include:
14575
14664
  * - The Gemini model ID, for example: 'gemini-2.0-flash'
14576
14665
  * - The full resource name starts with 'projects/', for example:
14577
14666
  * 'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
@@ -14700,7 +14789,7 @@ class Models extends BaseModule {
14700
14789
  if (this.apiClient.isVertexAI()) {
14701
14790
  if (!actualParams.config.queryBase) {
14702
14791
  if ((_a = actualParams.config) === null || _a === void 0 ? void 0 : _a.filter) {
14703
- throw new Error('Filtering tuned models list for Vertex AI is not currently supported');
14792
+ throw new Error('Filtering tuned models list for Gemini Enterprise Agent Platform (previously known as Vertex AI) is not currently supported');
14704
14793
  }
14705
14794
  else {
14706
14795
  actualParams.config.filter = 'labels.tune-type:*';
@@ -14745,7 +14834,7 @@ class Models extends BaseModule {
14745
14834
  };
14746
14835
  /**
14747
14836
  * Upscales an image based on an image, upscale factor, and configuration.
14748
- * Only supported in Vertex AI currently.
14837
+ * Only supported in Gemini Enterprise Agent Platform currently.
14749
14838
  *
14750
14839
  * @param params - The parameters for upscaling an image.
14751
14840
  * @return The response from the API.
@@ -15346,7 +15435,7 @@ class Models extends BaseModule {
15346
15435
  });
15347
15436
  }
15348
15437
  else {
15349
- throw new Error('This method is only supported by the Vertex AI.');
15438
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15350
15439
  }
15351
15440
  }
15352
15441
  /**
@@ -15389,7 +15478,7 @@ class Models extends BaseModule {
15389
15478
  });
15390
15479
  }
15391
15480
  else {
15392
- throw new Error('This method is only supported by the Vertex AI.');
15481
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15393
15482
  }
15394
15483
  }
15395
15484
  /**
@@ -15447,7 +15536,7 @@ class Models extends BaseModule {
15447
15536
  });
15448
15537
  }
15449
15538
  else {
15450
- throw new Error('This method is only supported by the Vertex AI.');
15539
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15451
15540
  }
15452
15541
  }
15453
15542
  /**
@@ -15501,7 +15590,7 @@ class Models extends BaseModule {
15501
15590
  });
15502
15591
  }
15503
15592
  else {
15504
- throw new Error('This method is only supported by the Vertex AI.');
15593
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15505
15594
  }
15506
15595
  }
15507
15596
  /**
@@ -15919,7 +16008,7 @@ class Models extends BaseModule {
15919
16008
  });
15920
16009
  }
15921
16010
  else {
15922
- throw new Error('This method is only supported by the Vertex AI.');
16011
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15923
16012
  }
15924
16013
  }
15925
16014
  /**
@@ -16143,7 +16232,7 @@ class Operations extends BaseModule {
16143
16232
  return response;
16144
16233
  }
16145
16234
  else {
16146
- throw new Error('This method is only supported by the Vertex AI.');
16235
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
16147
16236
  }
16148
16237
  }
16149
16238
  }
@@ -17147,7 +17236,7 @@ class FileSearchStores extends BaseModule {
17147
17236
  }
17148
17237
  /**
17149
17238
  * Uploads a file asynchronously to a given File Search Store.
17150
- * This method is not available in Vertex AI.
17239
+ * This method is not available in Gemini Enterprise Agent Platform (previously known as Vertex AI).
17151
17240
  * Supported upload sources:
17152
17241
  * - Node.js: File path (string) or Blob object.
17153
17242
  * - Browser: Blob object (e.g., File).
@@ -17166,7 +17255,7 @@ class FileSearchStores extends BaseModule {
17166
17255
  * @see {@link types.UploadToFileSearchStoreParameters#config} for the optional
17167
17256
  * config in the parameters.
17168
17257
  * @return A promise that resolves to a long running operation.
17169
- * @throws An error if called on a Vertex AI client.
17258
+ * @throws An error if called on a Gemini Enterprise Agent Platform (previously known as Vertex AI) client.
17170
17259
  * @throws An error if the `mimeType` is not provided and can not be inferred,
17171
17260
  * the `mimeType` can be provided in the `params.config` parameter.
17172
17261
  * @throws An error occurs if a suitable upload location cannot be established.
@@ -17183,7 +17272,7 @@ class FileSearchStores extends BaseModule {
17183
17272
  */
17184
17273
  async uploadToFileSearchStore(params) {
17185
17274
  if (this.apiClient.isVertexAI()) {
17186
- throw new Error('Vertex AI does not support uploading files to a file search store.');
17275
+ throw new Error('Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files to a file search store.');
17187
17276
  }
17188
17277
  return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName, params.file, params.config);
17189
17278
  }
@@ -18058,14 +18147,14 @@ class BaseWebhooks extends APIResource {
18058
18147
  * Creates a new Webhook.
18059
18148
  */
18060
18149
  create(params, options) {
18061
- const { api_version = this._client.apiVersion, webhook_id } = params, body = __rest(params, ["api_version", "webhook_id"]);
18062
- return this._client.post(path `/${api_version}/webhooks`, Object.assign({ query: { webhook_id }, body }, options));
18150
+ const { api_version = this._client.apiVersion } = params, body = __rest(params, ["api_version"]);
18151
+ return this._client.post(path `/${api_version}/webhooks`, Object.assign({ body }, options));
18063
18152
  }
18064
18153
  /**
18065
18154
  * Updates an existing Webhook.
18066
18155
  */
18067
- update(id, params, options) {
18068
- const { api_version = this._client.apiVersion, update_mask } = params, body = __rest(params, ["api_version", "update_mask"]);
18156
+ update(id, params = {}, options) {
18157
+ const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion, update_mask } = _a, body = __rest(_a, ["api_version", "update_mask"]);
18069
18158
  return this._client.patch(path `/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
18070
18159
  }
18071
18160
  /**
@@ -19935,22 +20024,6 @@ function getTuningJobParametersToVertex(fromObject, _rootObject) {
19935
20024
  }
19936
20025
  return toObject;
19937
20026
  }
19938
- function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
19939
- const toObject = {};
19940
- const fromPageSize = getValueByPath(fromObject, ['pageSize']);
19941
- if (parentObject !== undefined && fromPageSize != null) {
19942
- setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
19943
- }
19944
- const fromPageToken = getValueByPath(fromObject, ['pageToken']);
19945
- if (parentObject !== undefined && fromPageToken != null) {
19946
- setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
19947
- }
19948
- const fromFilter = getValueByPath(fromObject, ['filter']);
19949
- if (parentObject !== undefined && fromFilter != null) {
19950
- setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
19951
- }
19952
- return toObject;
19953
- }
19954
20027
  function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
19955
20028
  const toObject = {};
19956
20029
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
@@ -19967,14 +20040,6 @@ function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
19967
20040
  }
19968
20041
  return toObject;
19969
20042
  }
19970
- function listTuningJobsParametersToMldev(fromObject, rootObject) {
19971
- const toObject = {};
19972
- const fromConfig = getValueByPath(fromObject, ['config']);
19973
- if (fromConfig != null) {
19974
- listTuningJobsConfigToMldev(fromConfig, toObject);
19975
- }
19976
- return toObject;
19977
- }
19978
20043
  function listTuningJobsParametersToVertex(fromObject, rootObject) {
19979
20044
  const toObject = {};
19980
20045
  const fromConfig = getValueByPath(fromObject, ['config']);
@@ -19983,32 +20048,6 @@ function listTuningJobsParametersToVertex(fromObject, rootObject) {
19983
20048
  }
19984
20049
  return toObject;
19985
20050
  }
19986
- function listTuningJobsResponseFromMldev(fromObject, rootObject) {
19987
- const toObject = {};
19988
- const fromSdkHttpResponse = getValueByPath(fromObject, [
19989
- 'sdkHttpResponse',
19990
- ]);
19991
- if (fromSdkHttpResponse != null) {
19992
- setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
19993
- }
19994
- const fromNextPageToken = getValueByPath(fromObject, [
19995
- 'nextPageToken',
19996
- ]);
19997
- if (fromNextPageToken != null) {
19998
- setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
19999
- }
20000
- const fromTuningJobs = getValueByPath(fromObject, ['tunedModels']);
20001
- if (fromTuningJobs != null) {
20002
- let transformedList = fromTuningJobs;
20003
- if (Array.isArray(transformedList)) {
20004
- transformedList = transformedList.map((item) => {
20005
- return tuningJobFromMldev(item);
20006
- });
20007
- }
20008
- setValueByPath(toObject, ['tuningJobs'], transformedList);
20009
- }
20010
- return toObject;
20011
- }
20012
20051
  function listTuningJobsResponseFromVertex(fromObject, rootObject) {
20013
20052
  const toObject = {};
20014
20053
  const fromSdkHttpResponse = getValueByPath(fromObject, [
@@ -20126,7 +20165,7 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
20126
20165
  }
20127
20166
  }
20128
20167
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
20129
- throw new Error('examples parameter is not supported in Vertex AI.');
20168
+ throw new Error('examples parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
20130
20169
  }
20131
20170
  return toObject;
20132
20171
  }
@@ -20542,7 +20581,7 @@ class Tunings extends BaseModule {
20542
20581
  }
20543
20582
  }
20544
20583
  async listInternal(params) {
20545
- var _a, _b, _c, _d;
20584
+ var _a, _b;
20546
20585
  let response;
20547
20586
  let path = '';
20548
20587
  let queryParams = {};
@@ -20578,35 +20617,7 @@ class Tunings extends BaseModule {
20578
20617
  });
20579
20618
  }
20580
20619
  else {
20581
- const body = listTuningJobsParametersToMldev(params);
20582
- path = formatMap('tunedModels', body['_url']);
20583
- queryParams = body['_query'];
20584
- delete body['_url'];
20585
- delete body['_query'];
20586
- response = this.apiClient
20587
- .request({
20588
- path: path,
20589
- queryParams: queryParams,
20590
- body: JSON.stringify(body),
20591
- httpMethod: 'GET',
20592
- httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
20593
- abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
20594
- })
20595
- .then((httpResponse) => {
20596
- return httpResponse.json().then((jsonResponse) => {
20597
- const response = jsonResponse;
20598
- response.sdkHttpResponse = {
20599
- headers: httpResponse.headers,
20600
- };
20601
- return response;
20602
- });
20603
- });
20604
- return response.then((apiResponse) => {
20605
- const resp = listTuningJobsResponseFromMldev(apiResponse);
20606
- const typedResp = new ListTuningJobsResponse();
20607
- Object.assign(typedResp, resp);
20608
- return typedResp;
20609
- });
20620
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
20610
20621
  }
20611
20622
  }
20612
20623
  /**
@@ -20723,7 +20734,7 @@ class Tunings extends BaseModule {
20723
20734
  });
20724
20735
  }
20725
20736
  else {
20726
- throw new Error('This method is only supported by the Vertex AI.');
20737
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
20727
20738
  }
20728
20739
  }
20729
20740
  async tuneMldevInternal(params) {
@@ -21120,6 +21131,33 @@ class NodeFiles extends Files {
21120
21131
  * SPDX-License-Identifier: Apache-2.0
21121
21132
  */
21122
21133
  const LANGUAGE_LABEL_PREFIX = 'gl-node/';
21134
+ function resolveCloudFlag(options) {
21135
+ var _a;
21136
+ if (options.enterprise !== undefined || options.vertexai !== undefined) {
21137
+ if (options.enterprise !== undefined &&
21138
+ options.vertexai !== undefined &&
21139
+ options.enterprise !== options.vertexai) {
21140
+ throw new Error('enterprise and vertexAI flags have conflicting values, please set enterprise value only.');
21141
+ }
21142
+ return (_a = options.enterprise) !== null && _a !== void 0 ? _a : options.vertexai;
21143
+ }
21144
+ const envEnterpriseStr = getEnv('GOOGLE_GENAI_USE_ENTERPRISE');
21145
+ const envVertexaiStr = getEnv('GOOGLE_GENAI_USE_VERTEXAI');
21146
+ const useEnterpriseEnv = stringToBoolean(envEnterpriseStr);
21147
+ const useVertexaiEnv = stringToBoolean(envVertexaiStr);
21148
+ if (envEnterpriseStr !== undefined &&
21149
+ envVertexaiStr !== undefined &&
21150
+ useEnterpriseEnv !== useVertexaiEnv) {
21151
+ console.warn('Warning: Both GOOGLE_GENAI_USE_ENTERPRISE and GOOGLE_GENAI_USE_VERTEXAI are set with conflicting values. The value of GOOGLE_GENAI_USE_ENTERPRISE will be used.');
21152
+ }
21153
+ if (envEnterpriseStr !== undefined) {
21154
+ return useEnterpriseEnv;
21155
+ }
21156
+ if (envVertexaiStr !== undefined) {
21157
+ return useVertexaiEnv;
21158
+ }
21159
+ return false;
21160
+ }
21123
21161
  /**
21124
21162
  * The Google GenAI SDK.
21125
21163
  *
@@ -21197,25 +21235,24 @@ class GoogleGenAI {
21197
21235
  return this._webhooks;
21198
21236
  }
21199
21237
  constructor(options) {
21200
- var _a, _b, _c, _d, _e, _f;
21238
+ var _a, _b, _c, _d;
21201
21239
  // Validate explicitly set initializer values.
21202
21240
  if ((options.project || options.location) && options.apiKey) {
21203
21241
  throw new Error('Project/location and API key are mutually exclusive in the client initializer.');
21204
21242
  }
21205
- this.vertexai =
21206
- (_b = (_a = options.vertexai) !== null && _a !== void 0 ? _a : getBooleanEnv('GOOGLE_GENAI_USE_VERTEXAI')) !== null && _b !== void 0 ? _b : false;
21243
+ this.vertexai = resolveCloudFlag(options);
21207
21244
  const envApiKey = getApiKeyFromEnv();
21208
21245
  const envProject = getEnv('GOOGLE_CLOUD_PROJECT');
21209
21246
  const envLocation = getEnv('GOOGLE_CLOUD_LOCATION');
21210
- this.apiKey = (_c = options.apiKey) !== null && _c !== void 0 ? _c : envApiKey;
21211
- this.project = (_d = options.project) !== null && _d !== void 0 ? _d : envProject;
21212
- this.location = (_e = options.location) !== null && _e !== void 0 ? _e : envLocation;
21247
+ this.apiKey = (_a = options.apiKey) !== null && _a !== void 0 ? _a : envApiKey;
21248
+ this.project = (_b = options.project) !== null && _b !== void 0 ? _b : envProject;
21249
+ this.location = (_c = options.location) !== null && _c !== void 0 ? _c : envLocation;
21213
21250
  if (!this.vertexai && !this.apiKey) {
21214
21251
  console.warn('API key should be set when using the Gemini API.');
21215
21252
  }
21216
21253
  // Handle when to use Vertex AI in express mode (api key)
21217
- if (options.vertexai) {
21218
- if ((_f = options.googleAuthOptions) === null || _f === void 0 ? void 0 : _f.credentials) {
21254
+ if (this.vertexai) {
21255
+ if ((_d = options.googleAuthOptions) === null || _d === void 0 ? void 0 : _d.credentials) {
21219
21256
  // Explicit credentials take precedence over implicit api_key.
21220
21257
  console.debug('The user provided Google Cloud credentials will take precedence' +
21221
21258
  ' over the API key from the environment variable.');
@@ -21245,7 +21282,7 @@ class GoogleGenAI {
21245
21282
  this.location = 'global';
21246
21283
  }
21247
21284
  }
21248
- const baseUrl = getBaseUrl(options.httpOptions, options.vertexai, getEnv('GOOGLE_VERTEX_BASE_URL'), getEnv('GOOGLE_GEMINI_BASE_URL'));
21285
+ const baseUrl = getBaseUrl(options.httpOptions, this.vertexai, getEnv('GOOGLE_VERTEX_BASE_URL'), getEnv('GOOGLE_GEMINI_BASE_URL'));
21249
21286
  if (baseUrl) {
21250
21287
  if (options.httpOptions) {
21251
21288
  options.httpOptions.baseUrl = baseUrl;
@@ -21288,9 +21325,6 @@ function getEnv(env) {
21288
21325
  var _a, _b, _c;
21289
21326
  return (_c = (_b = (_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a[env]) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : undefined;
21290
21327
  }
21291
- function getBooleanEnv(env) {
21292
- return stringToBoolean(getEnv(env));
21293
- }
21294
21328
  function stringToBoolean(str) {
21295
21329
  if (str === undefined) {
21296
21330
  return false;