@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.
package/dist/index.cjs CHANGED
@@ -1574,7 +1574,7 @@ exports.FeatureSelectionPreference = void 0;
1574
1574
  FeatureSelectionPreference["BALANCED"] = "BALANCED";
1575
1575
  FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
1576
1576
  })(exports.FeatureSelectionPreference || (exports.FeatureSelectionPreference = {}));
1577
- /** Enum representing the Vertex embedding API to use. */
1577
+ /** Enum representing the Gemini Enterprise Agent Platform embedding API to use. */
1578
1578
  exports.EmbeddingApiType = void 0;
1579
1579
  (function (EmbeddingApiType) {
1580
1580
  /**
@@ -1732,6 +1732,20 @@ exports.VideoCompressionQuality = void 0;
1732
1732
  */
1733
1733
  VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
1734
1734
  })(exports.VideoCompressionQuality || (exports.VideoCompressionQuality = {}));
1735
+ /** Resize mode for the image input for video generation. */
1736
+ exports.ImageResizeMode = void 0;
1737
+ (function (ImageResizeMode) {
1738
+ /**
1739
+ * Crop the image to fit the correct aspect ratio (so we lose parts
1740
+ of the image in the process).
1741
+ */
1742
+ ImageResizeMode["CROP"] = "CROP";
1743
+ /**
1744
+ * Pad the image to fit the correct aspect ratio (so we don't lose
1745
+ any parts of the image in the process).
1746
+ */
1747
+ ImageResizeMode["PAD"] = "PAD";
1748
+ })(exports.ImageResizeMode || (exports.ImageResizeMode = {}));
1735
1749
  /** Enum representing the tuning method. */
1736
1750
  exports.TuningMethod = void 0;
1737
1751
  (function (TuningMethod) {
@@ -3541,6 +3555,9 @@ function tBatchJobSource(client, src) {
3541
3555
  else if (src.startsWith('bq://')) {
3542
3556
  sourceObj = { format: 'bigquery', bigqueryUri: src };
3543
3557
  }
3558
+ else if (/^projects\/[^/]+\/locations\/[^/]+\/datasets\/[^/]+$/.test(src)) {
3559
+ sourceObj = { format: 'vertex-dataset', vertexDatasetName: src };
3560
+ }
3544
3561
  else {
3545
3562
  throw new Error(`Unsupported string source for Vertex AI: ${src}`);
3546
3563
  }
@@ -3566,14 +3583,18 @@ function tBatchJobSource(client, src) {
3566
3583
  sourceObj = src;
3567
3584
  }
3568
3585
  // Validation logic
3569
- const vertexSourcesCount = [sourceObj.gcsUri, sourceObj.bigqueryUri].filter(Boolean).length;
3586
+ const vertexSourcesCount = [
3587
+ sourceObj.gcsUri,
3588
+ sourceObj.bigqueryUri,
3589
+ sourceObj.vertexDatasetName,
3590
+ ].filter(Boolean).length;
3570
3591
  const mldevSourcesCount = [
3571
3592
  sourceObj.inlinedRequests,
3572
3593
  sourceObj.fileName,
3573
3594
  ].filter(Boolean).length;
3574
3595
  if (client.isVertexAI()) {
3575
3596
  if (mldevSourcesCount > 0 || vertexSourcesCount !== 1) {
3576
- throw new Error('Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.');
3597
+ throw new Error('Exactly one of `gcsUri`, `bigqueryUri`, or `vertexDatasetName` must be set for Vertex AI.');
3577
3598
  }
3578
3599
  }
3579
3600
  else {
@@ -3792,6 +3813,12 @@ function batchJobDestinationFromVertex(fromObject) {
3792
3813
  if (fromBigqueryUri != null) {
3793
3814
  setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
3794
3815
  }
3816
+ const fromVertexDataset = getValueByPath(fromObject, [
3817
+ 'vertexMultimodalDatasetDestination',
3818
+ ]);
3819
+ if (fromVertexDataset != null) {
3820
+ setValueByPath(toObject, ['vertexDataset'], vertexMultimodalDatasetDestinationFromVertex(fromVertexDataset));
3821
+ }
3795
3822
  return toObject;
3796
3823
  }
3797
3824
  function batchJobDestinationToVertex(fromObject) {
@@ -3809,14 +3836,20 @@ function batchJobDestinationToVertex(fromObject) {
3809
3836
  setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryUri);
3810
3837
  }
3811
3838
  if (getValueByPath(fromObject, ['fileName']) !== undefined) {
3812
- throw new Error('fileName parameter is not supported in Vertex AI.');
3839
+ throw new Error('fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3813
3840
  }
3814
3841
  if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
3815
- throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
3842
+ throw new Error('inlinedResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3816
3843
  }
3817
3844
  if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
3818
3845
  undefined) {
3819
- throw new Error('inlinedEmbedContentResponses parameter is not supported in Vertex AI.');
3846
+ throw new Error('inlinedEmbedContentResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3847
+ }
3848
+ const fromVertexDataset = getValueByPath(fromObject, [
3849
+ 'vertexDataset',
3850
+ ]);
3851
+ if (fromVertexDataset != null) {
3852
+ setValueByPath(toObject, ['vertexMultimodalDatasetDestination'], vertexMultimodalDatasetDestinationToVertex(fromVertexDataset));
3820
3853
  }
3821
3854
  return toObject;
3822
3855
  }
@@ -3920,6 +3953,10 @@ function batchJobFromVertex(fromObject) {
3920
3953
  if (fromCompletionStats != null) {
3921
3954
  setValueByPath(toObject, ['completionStats'], fromCompletionStats);
3922
3955
  }
3956
+ const fromOutputInfo = getValueByPath(fromObject, ['outputInfo']);
3957
+ if (fromOutputInfo != null) {
3958
+ setValueByPath(toObject, ['outputInfo'], fromOutputInfo);
3959
+ }
3923
3960
  return toObject;
3924
3961
  }
3925
3962
  function batchJobSourceFromVertex(fromObject) {
@@ -3939,6 +3976,13 @@ function batchJobSourceFromVertex(fromObject) {
3939
3976
  if (fromBigqueryUri != null) {
3940
3977
  setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
3941
3978
  }
3979
+ const fromVertexDatasetName = getValueByPath(fromObject, [
3980
+ 'vertexMultimodalDatasetSource',
3981
+ 'datasetName',
3982
+ ]);
3983
+ if (fromVertexDatasetName != null) {
3984
+ setValueByPath(toObject, ['vertexDatasetName'], fromVertexDatasetName);
3985
+ }
3942
3986
  return toObject;
3943
3987
  }
3944
3988
  function batchJobSourceToMldev(apiClient, fromObject) {
@@ -3968,6 +4012,9 @@ function batchJobSourceToMldev(apiClient, fromObject) {
3968
4012
  }
3969
4013
  setValueByPath(toObject, ['requests', 'requests'], transformedList);
3970
4014
  }
4015
+ if (getValueByPath(fromObject, ['vertexDatasetName']) !== undefined) {
4016
+ throw new Error('vertexDatasetName parameter is not supported in Gemini API.');
4017
+ }
3971
4018
  return toObject;
3972
4019
  }
3973
4020
  function batchJobSourceToVertex(fromObject) {
@@ -3985,10 +4032,16 @@ function batchJobSourceToVertex(fromObject) {
3985
4032
  setValueByPath(toObject, ['bigquerySource', 'inputUri'], fromBigqueryUri);
3986
4033
  }
3987
4034
  if (getValueByPath(fromObject, ['fileName']) !== undefined) {
3988
- throw new Error('fileName parameter is not supported in Vertex AI.');
4035
+ throw new Error('fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
3989
4036
  }
3990
4037
  if (getValueByPath(fromObject, ['inlinedRequests']) !== undefined) {
3991
- throw new Error('inlinedRequests parameter is not supported in Vertex AI.');
4038
+ throw new Error('inlinedRequests parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
4039
+ }
4040
+ const fromVertexDatasetName = getValueByPath(fromObject, [
4041
+ 'vertexDatasetName',
4042
+ ]);
4043
+ if (fromVertexDatasetName != null) {
4044
+ setValueByPath(toObject, ['vertexMultimodalDatasetSource', 'datasetName'], fromVertexDatasetName);
3992
4045
  }
3993
4046
  return toObject;
3994
4047
  }
@@ -4143,7 +4196,7 @@ function createBatchJobConfigToVertex(fromObject, parentObject) {
4143
4196
  setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
4144
4197
  }
4145
4198
  if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
4146
- throw new Error('webhookConfig parameter is not supported in Vertex AI.');
4199
+ throw new Error('webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
4147
4200
  }
4148
4201
  return toObject;
4149
4202
  }
@@ -4985,6 +5038,35 @@ function toolToMldev$4(fromObject) {
4985
5038
  }
4986
5039
  return toObject;
4987
5040
  }
5041
+ function vertexMultimodalDatasetDestinationFromVertex(fromObject) {
5042
+ const toObject = {};
5043
+ const fromBigqueryDestination = getValueByPath(fromObject, [
5044
+ 'bigqueryDestination',
5045
+ 'outputUri',
5046
+ ]);
5047
+ if (fromBigqueryDestination != null) {
5048
+ setValueByPath(toObject, ['bigqueryDestination'], fromBigqueryDestination);
5049
+ }
5050
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5051
+ if (fromDisplayName != null) {
5052
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5053
+ }
5054
+ return toObject;
5055
+ }
5056
+ function vertexMultimodalDatasetDestinationToVertex(fromObject) {
5057
+ const toObject = {};
5058
+ const fromBigqueryDestination = getValueByPath(fromObject, [
5059
+ 'bigqueryDestination',
5060
+ ]);
5061
+ if (fromBigqueryDestination != null) {
5062
+ setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryDestination);
5063
+ }
5064
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5065
+ if (fromDisplayName != null) {
5066
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5067
+ }
5068
+ return toObject;
5069
+ }
4988
5070
 
4989
5071
  /**
4990
5072
  * @license
@@ -5239,7 +5321,7 @@ class Batches extends BaseModule {
5239
5321
  this.createEmbeddings = async (params) => {
5240
5322
  console.warn('batches.createEmbeddings() is experimental and may change without notice.');
5241
5323
  if (this.apiClient.isVertexAI()) {
5242
- throw new Error('Vertex AI does not support batches.createEmbeddings.');
5324
+ throw new Error('Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.createEmbeddings.');
5243
5325
  }
5244
5326
  return this.createEmbeddingsInternal(params);
5245
5327
  };
@@ -5316,7 +5398,7 @@ class Batches extends BaseModule {
5316
5398
  newConfig.dest = `${bigqueryUri}_dest_${timestampStr}`;
5317
5399
  }
5318
5400
  else {
5319
- throw new Error('Unsupported source for Vertex AI: No GCS or BigQuery URI found.');
5401
+ throw new Error('Unsupported source for Gemini Enterprise Agent Platform (previously known as Vertex AI): No GCS or BigQuery URI found.');
5320
5402
  }
5321
5403
  }
5322
5404
  return newConfig;
@@ -6001,7 +6083,7 @@ function functionDeclarationToVertex$2(fromObject) {
6001
6083
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
6002
6084
  }
6003
6085
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
6004
- throw new Error('behavior parameter is not supported in Vertex AI.');
6086
+ throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6005
6087
  }
6006
6088
  return toObject;
6007
6089
  }
@@ -6280,13 +6362,13 @@ function partToVertex$2(fromObject) {
6280
6362
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
6281
6363
  }
6282
6364
  if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
6283
- throw new Error('toolCall parameter is not supported in Vertex AI.');
6365
+ throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6284
6366
  }
6285
6367
  if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
6286
- throw new Error('toolResponse parameter is not supported in Vertex AI.');
6368
+ throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6287
6369
  }
6288
6370
  if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
6289
- throw new Error('partMetadata parameter is not supported in Vertex AI.');
6371
+ throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6290
6372
  }
6291
6373
  return toObject;
6292
6374
  }
@@ -6326,7 +6408,7 @@ function toolConfigToVertex$1(fromObject) {
6326
6408
  }
6327
6409
  if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
6328
6410
  undefined) {
6329
- throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
6411
+ throw new Error('includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6330
6412
  }
6331
6413
  return toObject;
6332
6414
  }
@@ -6408,7 +6490,7 @@ function toolToVertex$2(fromObject) {
6408
6490
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
6409
6491
  }
6410
6492
  if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
6411
- throw new Error('fileSearch parameter is not supported in Vertex AI.');
6493
+ throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6412
6494
  }
6413
6495
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
6414
6496
  if (fromGoogleSearch != null) {
@@ -6459,7 +6541,7 @@ function toolToVertex$2(fromObject) {
6459
6541
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
6460
6542
  }
6461
6543
  if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
6462
- throw new Error('mcpServers parameter is not supported in Vertex AI.');
6544
+ throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
6463
6545
  }
6464
6546
  return toObject;
6465
6547
  }
@@ -6545,7 +6627,7 @@ class Caches extends BaseModule {
6545
6627
  * @remarks
6546
6628
  * Context caching is only supported for specific models. See [Gemini
6547
6629
  * Developer API reference](https://ai.google.dev/gemini-api/docs/caching?lang=node/context-cac)
6548
- * and [Vertex AI reference](https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
6630
+ * and [Gemini Enterprise Agent Platform reference](https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
6549
6631
  * for more information.
6550
6632
  *
6551
6633
  * @param params - The parameters for the create request.
@@ -7544,7 +7626,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
7544
7626
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
7545
7627
  const USER_AGENT_HEADER = 'User-Agent';
7546
7628
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
7547
- const SDK_VERSION = '1.50.1'; // x-release-please-version
7629
+ const SDK_VERSION = '1.51.0'; // x-release-please-version
7548
7630
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
7549
7631
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
7550
7632
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -8521,7 +8603,7 @@ class Files extends BaseModule {
8521
8603
  }
8522
8604
  /**
8523
8605
  * Uploads a file asynchronously to the Gemini API.
8524
- * This method is not available in Vertex AI.
8606
+ * This method is not available in Gemini Enterprise Agent Platform (previously known as Vertex AI).
8525
8607
  * Supported upload sources:
8526
8608
  * - Node.js: File path (string) or Blob object.
8527
8609
  * - Browser: Blob object (e.g., File).
@@ -8547,7 +8629,7 @@ class Files extends BaseModule {
8547
8629
  * @see {@link types.UploadFileParameters#config} for the optional
8548
8630
  * config in the parameters.
8549
8631
  * @return A promise that resolves to a `types.File` object.
8550
- * @throws An error if called on a Vertex AI client.
8632
+ * @throws An error if called on a Gemini Enterprise Agent Platform (previously known as Vertex AI) client.
8551
8633
  * @throws An error if the `mimeType` is not provided and can not be inferred,
8552
8634
  * the `mimeType` can be provided in the `params.config` parameter.
8553
8635
  * @throws An error occurs if a suitable upload location cannot be established.
@@ -8564,7 +8646,7 @@ class Files extends BaseModule {
8564
8646
  */
8565
8647
  async upload(params) {
8566
8648
  if (this.apiClient.isVertexAI()) {
8567
- throw new Error('Vertex AI does not support uploading files. You can share files through a GCS bucket.');
8649
+ 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.');
8568
8650
  }
8569
8651
  return this.apiClient
8570
8652
  .uploadFile(params.file, params.config)
@@ -9053,7 +9135,7 @@ class FileSearchStores extends BaseModule {
9053
9135
  }
9054
9136
  /**
9055
9137
  * Uploads a file asynchronously to a given File Search Store.
9056
- * This method is not available in Vertex AI.
9138
+ * This method is not available in Gemini Enterprise Agent Platform (previously known as Vertex AI).
9057
9139
  * Supported upload sources:
9058
9140
  * - Node.js: File path (string) or Blob object.
9059
9141
  * - Browser: Blob object (e.g., File).
@@ -9072,7 +9154,7 @@ class FileSearchStores extends BaseModule {
9072
9154
  * @see {@link types.UploadToFileSearchStoreParameters#config} for the optional
9073
9155
  * config in the parameters.
9074
9156
  * @return A promise that resolves to a long running operation.
9075
- * @throws An error if called on a Vertex AI client.
9157
+ * @throws An error if called on a Gemini Enterprise Agent Platform (previously known as Vertex AI) client.
9076
9158
  * @throws An error if the `mimeType` is not provided and can not be inferred,
9077
9159
  * the `mimeType` can be provided in the `params.config` parameter.
9078
9160
  * @throws An error occurs if a suitable upload location cannot be established.
@@ -9089,7 +9171,7 @@ class FileSearchStores extends BaseModule {
9089
9171
  */
9090
9172
  async uploadToFileSearchStore(params) {
9091
9173
  if (this.apiClient.isVertexAI()) {
9092
- throw new Error('Vertex AI does not support uploading files to a file search store.');
9174
+ throw new Error('Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files to a file search store.');
9093
9175
  }
9094
9176
  return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName, params.file, params.config);
9095
9177
  }
@@ -9964,14 +10046,14 @@ class BaseWebhooks extends APIResource {
9964
10046
  * Creates a new Webhook.
9965
10047
  */
9966
10048
  create(params, options) {
9967
- const { api_version = this._client.apiVersion, webhook_id } = params, body = __rest(params, ["api_version", "webhook_id"]);
9968
- return this._client.post(path `/${api_version}/webhooks`, Object.assign({ query: { webhook_id }, body }, options));
10049
+ const { api_version = this._client.apiVersion } = params, body = __rest(params, ["api_version"]);
10050
+ return this._client.post(path `/${api_version}/webhooks`, Object.assign({ body }, options));
9969
10051
  }
9970
10052
  /**
9971
10053
  * Updates an existing Webhook.
9972
10054
  */
9973
- update(id, params, options) {
9974
- const { api_version = this._client.apiVersion, update_mask } = params, body = __rest(params, ["api_version", "update_mask"]);
10055
+ update(id, params = {}, options) {
10056
+ const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion, update_mask } = _a, body = __rest(_a, ["api_version", "update_mask"]);
9975
10057
  return this._client.patch(path `/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
9976
10058
  }
9977
10059
  /**
@@ -11381,7 +11463,7 @@ function functionDeclarationToVertex$1(fromObject) {
11381
11463
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
11382
11464
  }
11383
11465
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
11384
- throw new Error('behavior parameter is not supported in Vertex AI.');
11466
+ throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11385
11467
  }
11386
11468
  return toObject;
11387
11469
  }
@@ -11509,7 +11591,7 @@ function generationConfigToVertex$1(fromObject) {
11509
11591
  }
11510
11592
  if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
11511
11593
  undefined) {
11512
- throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
11594
+ throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
11513
11595
  }
11514
11596
  return toObject;
11515
11597
  }
@@ -12125,13 +12207,13 @@ function partToVertex$1(fromObject) {
12125
12207
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
12126
12208
  }
12127
12209
  if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
12128
- throw new Error('toolCall parameter is not supported in Vertex AI.');
12210
+ throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12129
12211
  }
12130
12212
  if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
12131
- throw new Error('toolResponse parameter is not supported in Vertex AI.');
12213
+ throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12132
12214
  }
12133
12215
  if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
12134
- throw new Error('partMetadata parameter is not supported in Vertex AI.');
12216
+ throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12135
12217
  }
12136
12218
  return toObject;
12137
12219
  }
@@ -12239,7 +12321,7 @@ function toolToVertex$1(fromObject) {
12239
12321
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
12240
12322
  }
12241
12323
  if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
12242
- throw new Error('fileSearch parameter is not supported in Vertex AI.');
12324
+ throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12243
12325
  }
12244
12326
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
12245
12327
  if (fromGoogleSearch != null) {
@@ -12290,7 +12372,7 @@ function toolToVertex$1(fromObject) {
12290
12372
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
12291
12373
  }
12292
12374
  if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
12293
- throw new Error('mcpServers parameter is not supported in Vertex AI.');
12375
+ throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
12294
12376
  }
12295
12377
  return toObject;
12296
12378
  }
@@ -13314,7 +13396,7 @@ function functionDeclarationToVertex(fromObject, _rootObject) {
13314
13396
  setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
13315
13397
  }
13316
13398
  if (getValueByPath(fromObject, ['behavior']) !== undefined) {
13317
- throw new Error('behavior parameter is not supported in Vertex AI.');
13399
+ throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
13318
13400
  }
13319
13401
  return toObject;
13320
13402
  }
@@ -13649,7 +13731,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
13649
13731
  }
13650
13732
  if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
13651
13733
  undefined) {
13652
- throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
13734
+ throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
13653
13735
  }
13654
13736
  const fromModelArmorConfig = getValueByPath(fromObject, [
13655
13737
  'modelArmorConfig',
@@ -14143,6 +14225,9 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
14143
14225
  if (parentObject !== undefined && fromWebhookConfig != null) {
14144
14226
  setValueByPath(parentObject, ['webhookConfig'], fromWebhookConfig);
14145
14227
  }
14228
+ if (getValueByPath(fromObject, ['resizeMode']) !== undefined) {
14229
+ throw new Error('resizeMode parameter is not supported in Gemini API.');
14230
+ }
14146
14231
  return toObject;
14147
14232
  }
14148
14233
  function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
@@ -14238,7 +14323,11 @@ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
14238
14323
  setValueByPath(parentObject, ['labels'], fromLabels);
14239
14324
  }
14240
14325
  if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
14241
- throw new Error('webhookConfig parameter is not supported in Vertex AI.');
14326
+ throw new Error('webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
14327
+ }
14328
+ const fromResizeMode = getValueByPath(fromObject, ['resizeMode']);
14329
+ if (parentObject !== undefined && fromResizeMode != null) {
14330
+ setValueByPath(parentObject, ['parameters', 'resizeMode'], fromResizeMode);
14242
14331
  }
14243
14332
  return toObject;
14244
14333
  }
@@ -14633,7 +14722,7 @@ function generationConfigToVertex(fromObject, _rootObject) {
14633
14722
  }
14634
14723
  if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
14635
14724
  undefined) {
14636
- throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
14725
+ throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
14637
14726
  }
14638
14727
  return toObject;
14639
14728
  }
@@ -15193,13 +15282,13 @@ function partToVertex(fromObject, _rootObject) {
15193
15282
  setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
15194
15283
  }
15195
15284
  if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
15196
- throw new Error('toolCall parameter is not supported in Vertex AI.');
15285
+ throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15197
15286
  }
15198
15287
  if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
15199
- throw new Error('toolResponse parameter is not supported in Vertex AI.');
15288
+ throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15200
15289
  }
15201
15290
  if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
15202
- throw new Error('partMetadata parameter is not supported in Vertex AI.');
15291
+ throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15203
15292
  }
15204
15293
  return toObject;
15205
15294
  }
@@ -15556,7 +15645,7 @@ function toolConfigToVertex(fromObject, _rootObject) {
15556
15645
  }
15557
15646
  if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
15558
15647
  undefined) {
15559
- throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
15648
+ throw new Error('includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15560
15649
  }
15561
15650
  return toObject;
15562
15651
  }
@@ -15638,7 +15727,7 @@ function toolToVertex(fromObject, rootObject) {
15638
15727
  setValueByPath(toObject, ['computerUse'], fromComputerUse);
15639
15728
  }
15640
15729
  if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
15641
- throw new Error('fileSearch parameter is not supported in Vertex AI.');
15730
+ throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15642
15731
  }
15643
15732
  const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
15644
15733
  if (fromGoogleSearch != null) {
@@ -15689,7 +15778,7 @@ function toolToVertex(fromObject, rootObject) {
15689
15778
  setValueByPath(toObject, ['urlContext'], fromUrlContext);
15690
15779
  }
15691
15780
  if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
15692
- throw new Error('mcpServers parameter is not supported in Vertex AI.');
15781
+ throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
15693
15782
  }
15694
15783
  return toObject;
15695
15784
  }
@@ -16986,7 +17075,7 @@ class Models extends BaseModule {
16986
17075
  /**
16987
17076
  * Makes an API request to generate content with a given model.
16988
17077
  *
16989
- * For the `model` parameter, supported formats for Vertex AI API include:
17078
+ * For the `model` parameter, supported formats for Gemini Enterprise Agent Platform API include:
16990
17079
  * - The Gemini model ID, for example: 'gemini-2.0-flash'
16991
17080
  * - The full resource name starts with 'projects/', for example:
16992
17081
  * 'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
@@ -17077,7 +17166,7 @@ class Models extends BaseModule {
17077
17166
  * Makes an API request to generate content with a given model and yields the
17078
17167
  * response in chunks.
17079
17168
  *
17080
- * For the `model` parameter, supported formats for Vertex AI API include:
17169
+ * For the `model` parameter, supported formats for Gemini Enterprise Agent Platform API include:
17081
17170
  * - The Gemini model ID, for example: 'gemini-2.0-flash'
17082
17171
  * - The full resource name starts with 'projects/', for example:
17083
17172
  * 'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
@@ -17206,7 +17295,7 @@ class Models extends BaseModule {
17206
17295
  if (this.apiClient.isVertexAI()) {
17207
17296
  if (!actualParams.config.queryBase) {
17208
17297
  if ((_a = actualParams.config) === null || _a === void 0 ? void 0 : _a.filter) {
17209
- throw new Error('Filtering tuned models list for Vertex AI is not currently supported');
17298
+ throw new Error('Filtering tuned models list for Gemini Enterprise Agent Platform (previously known as Vertex AI) is not currently supported');
17210
17299
  }
17211
17300
  else {
17212
17301
  actualParams.config.filter = 'labels.tune-type:*';
@@ -17251,7 +17340,7 @@ class Models extends BaseModule {
17251
17340
  };
17252
17341
  /**
17253
17342
  * Upscales an image based on an image, upscale factor, and configuration.
17254
- * Only supported in Vertex AI currently.
17343
+ * Only supported in Gemini Enterprise Agent Platform currently.
17255
17344
  *
17256
17345
  * @param params - The parameters for upscaling an image.
17257
17346
  * @return The response from the API.
@@ -17852,7 +17941,7 @@ class Models extends BaseModule {
17852
17941
  });
17853
17942
  }
17854
17943
  else {
17855
- throw new Error('This method is only supported by the Vertex AI.');
17944
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
17856
17945
  }
17857
17946
  }
17858
17947
  /**
@@ -17895,7 +17984,7 @@ class Models extends BaseModule {
17895
17984
  });
17896
17985
  }
17897
17986
  else {
17898
- throw new Error('This method is only supported by the Vertex AI.');
17987
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
17899
17988
  }
17900
17989
  }
17901
17990
  /**
@@ -17953,7 +18042,7 @@ class Models extends BaseModule {
17953
18042
  });
17954
18043
  }
17955
18044
  else {
17956
- throw new Error('This method is only supported by the Vertex AI.');
18045
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
17957
18046
  }
17958
18047
  }
17959
18048
  /**
@@ -18007,7 +18096,7 @@ class Models extends BaseModule {
18007
18096
  });
18008
18097
  }
18009
18098
  else {
18010
- throw new Error('This method is only supported by the Vertex AI.');
18099
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
18011
18100
  }
18012
18101
  }
18013
18102
  /**
@@ -18425,7 +18514,7 @@ class Models extends BaseModule {
18425
18514
  });
18426
18515
  }
18427
18516
  else {
18428
- throw new Error('This method is only supported by the Vertex AI.');
18517
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
18429
18518
  }
18430
18519
  }
18431
18520
  /**
@@ -18649,7 +18738,7 @@ class Operations extends BaseModule {
18649
18738
  return response;
18650
18739
  }
18651
18740
  else {
18652
- throw new Error('This method is only supported by the Vertex AI.');
18741
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
18653
18742
  }
18654
18743
  }
18655
18744
  }
@@ -19849,22 +19938,6 @@ function getTuningJobParametersToVertex(fromObject, _rootObject) {
19849
19938
  }
19850
19939
  return toObject;
19851
19940
  }
19852
- function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
19853
- const toObject = {};
19854
- const fromPageSize = getValueByPath(fromObject, ['pageSize']);
19855
- if (parentObject !== undefined && fromPageSize != null) {
19856
- setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
19857
- }
19858
- const fromPageToken = getValueByPath(fromObject, ['pageToken']);
19859
- if (parentObject !== undefined && fromPageToken != null) {
19860
- setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
19861
- }
19862
- const fromFilter = getValueByPath(fromObject, ['filter']);
19863
- if (parentObject !== undefined && fromFilter != null) {
19864
- setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
19865
- }
19866
- return toObject;
19867
- }
19868
19941
  function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
19869
19942
  const toObject = {};
19870
19943
  const fromPageSize = getValueByPath(fromObject, ['pageSize']);
@@ -19881,14 +19954,6 @@ function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
19881
19954
  }
19882
19955
  return toObject;
19883
19956
  }
19884
- function listTuningJobsParametersToMldev(fromObject, rootObject) {
19885
- const toObject = {};
19886
- const fromConfig = getValueByPath(fromObject, ['config']);
19887
- if (fromConfig != null) {
19888
- listTuningJobsConfigToMldev(fromConfig, toObject);
19889
- }
19890
- return toObject;
19891
- }
19892
19957
  function listTuningJobsParametersToVertex(fromObject, rootObject) {
19893
19958
  const toObject = {};
19894
19959
  const fromConfig = getValueByPath(fromObject, ['config']);
@@ -19897,32 +19962,6 @@ function listTuningJobsParametersToVertex(fromObject, rootObject) {
19897
19962
  }
19898
19963
  return toObject;
19899
19964
  }
19900
- function listTuningJobsResponseFromMldev(fromObject, rootObject) {
19901
- const toObject = {};
19902
- const fromSdkHttpResponse = getValueByPath(fromObject, [
19903
- 'sdkHttpResponse',
19904
- ]);
19905
- if (fromSdkHttpResponse != null) {
19906
- setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
19907
- }
19908
- const fromNextPageToken = getValueByPath(fromObject, [
19909
- 'nextPageToken',
19910
- ]);
19911
- if (fromNextPageToken != null) {
19912
- setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
19913
- }
19914
- const fromTuningJobs = getValueByPath(fromObject, ['tunedModels']);
19915
- if (fromTuningJobs != null) {
19916
- let transformedList = fromTuningJobs;
19917
- if (Array.isArray(transformedList)) {
19918
- transformedList = transformedList.map((item) => {
19919
- return tuningJobFromMldev(item);
19920
- });
19921
- }
19922
- setValueByPath(toObject, ['tuningJobs'], transformedList);
19923
- }
19924
- return toObject;
19925
- }
19926
19965
  function listTuningJobsResponseFromVertex(fromObject, rootObject) {
19927
19966
  const toObject = {};
19928
19967
  const fromSdkHttpResponse = getValueByPath(fromObject, [
@@ -20040,7 +20079,7 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
20040
20079
  }
20041
20080
  }
20042
20081
  if (getValueByPath(fromObject, ['examples']) !== undefined) {
20043
- throw new Error('examples parameter is not supported in Vertex AI.');
20082
+ throw new Error('examples parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
20044
20083
  }
20045
20084
  return toObject;
20046
20085
  }
@@ -20456,7 +20495,7 @@ class Tunings extends BaseModule {
20456
20495
  }
20457
20496
  }
20458
20497
  async listInternal(params) {
20459
- var _a, _b, _c, _d;
20498
+ var _a, _b;
20460
20499
  let response;
20461
20500
  let path = '';
20462
20501
  let queryParams = {};
@@ -20492,35 +20531,7 @@ class Tunings extends BaseModule {
20492
20531
  });
20493
20532
  }
20494
20533
  else {
20495
- const body = listTuningJobsParametersToMldev(params);
20496
- path = formatMap('tunedModels', body['_url']);
20497
- queryParams = body['_query'];
20498
- delete body['_url'];
20499
- delete body['_query'];
20500
- response = this.apiClient
20501
- .request({
20502
- path: path,
20503
- queryParams: queryParams,
20504
- body: JSON.stringify(body),
20505
- httpMethod: 'GET',
20506
- httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
20507
- abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
20508
- })
20509
- .then((httpResponse) => {
20510
- return httpResponse.json().then((jsonResponse) => {
20511
- const response = jsonResponse;
20512
- response.sdkHttpResponse = {
20513
- headers: httpResponse.headers,
20514
- };
20515
- return response;
20516
- });
20517
- });
20518
- return response.then((apiResponse) => {
20519
- const resp = listTuningJobsResponseFromMldev(apiResponse);
20520
- const typedResp = new ListTuningJobsResponse();
20521
- Object.assign(typedResp, resp);
20522
- return typedResp;
20523
- });
20534
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
20524
20535
  }
20525
20536
  }
20526
20537
  /**
@@ -20637,7 +20648,7 @@ class Tunings extends BaseModule {
20637
20648
  });
20638
20649
  }
20639
20650
  else {
20640
- throw new Error('This method is only supported by the Vertex AI.');
20651
+ throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
20641
20652
  }
20642
20653
  }
20643
20654
  async tuneMldevInternal(params) {
@@ -20781,11 +20792,16 @@ class GoogleGenAI {
20781
20792
  return this._webhooks;
20782
20793
  }
20783
20794
  constructor(options) {
20784
- var _a;
20795
+ var _a, _b;
20785
20796
  if (options.apiKey == null) {
20786
20797
  throw new Error(`An API Key must be set when running in an unspecified environment.\n + ${crossError().message}`);
20787
20798
  }
20788
- this.vertexai = (_a = options.vertexai) !== null && _a !== void 0 ? _a : false;
20799
+ if (options.enterprise !== undefined &&
20800
+ options.vertexai !== undefined &&
20801
+ options.enterprise !== options.vertexai) {
20802
+ throw new Error('enterprise and vertexAI flags have conflicting values, please set enterprise value only.');
20803
+ }
20804
+ this.vertexai = (_b = (_a = options.enterprise) !== null && _a !== void 0 ? _a : options.vertexai) !== null && _b !== void 0 ? _b : false;
20789
20805
  this.apiKey = options.apiKey;
20790
20806
  this.apiVersion = options.apiVersion;
20791
20807
  this.httpOptions = options.httpOptions;