@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/README.md +12 -12
- package/dist/genai.d.ts +168 -101
- package/dist/index.cjs +157 -141
- package/dist/index.mjs +158 -142
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +185 -151
- package/dist/node/index.mjs +186 -152
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +168 -101
- package/dist/tokenizer/node.cjs +15 -1
- package/dist/tokenizer/node.d.ts +1 -1
- package/dist/tokenizer/node.mjs +15 -1
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +16 -2
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +75 -24
- package/dist/vertex_internal/index.js +16 -2
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +151 -140
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +168 -101
- package/package.json +6 -1
package/dist/node/index.mjs
CHANGED
|
@@ -1610,7 +1610,7 @@ var FeatureSelectionPreference;
|
|
|
1610
1610
|
FeatureSelectionPreference["BALANCED"] = "BALANCED";
|
|
1611
1611
|
FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
|
|
1612
1612
|
})(FeatureSelectionPreference || (FeatureSelectionPreference = {}));
|
|
1613
|
-
/** Enum representing the
|
|
1613
|
+
/** Enum representing the Gemini Enterprise Agent Platform embedding API to use. */
|
|
1614
1614
|
var EmbeddingApiType;
|
|
1615
1615
|
(function (EmbeddingApiType) {
|
|
1616
1616
|
/**
|
|
@@ -1768,6 +1768,20 @@ var VideoCompressionQuality;
|
|
|
1768
1768
|
*/
|
|
1769
1769
|
VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
|
|
1770
1770
|
})(VideoCompressionQuality || (VideoCompressionQuality = {}));
|
|
1771
|
+
/** Resize mode for the image input for video generation. */
|
|
1772
|
+
var ImageResizeMode;
|
|
1773
|
+
(function (ImageResizeMode) {
|
|
1774
|
+
/**
|
|
1775
|
+
* Crop the image to fit the correct aspect ratio (so we lose parts
|
|
1776
|
+
of the image in the process).
|
|
1777
|
+
*/
|
|
1778
|
+
ImageResizeMode["CROP"] = "CROP";
|
|
1779
|
+
/**
|
|
1780
|
+
* Pad the image to fit the correct aspect ratio (so we don't lose
|
|
1781
|
+
any parts of the image in the process).
|
|
1782
|
+
*/
|
|
1783
|
+
ImageResizeMode["PAD"] = "PAD";
|
|
1784
|
+
})(ImageResizeMode || (ImageResizeMode = {}));
|
|
1771
1785
|
/** Enum representing the tuning method. */
|
|
1772
1786
|
var TuningMethod;
|
|
1773
1787
|
(function (TuningMethod) {
|
|
@@ -3577,6 +3591,9 @@ function tBatchJobSource(client, src) {
|
|
|
3577
3591
|
else if (src.startsWith('bq://')) {
|
|
3578
3592
|
sourceObj = { format: 'bigquery', bigqueryUri: src };
|
|
3579
3593
|
}
|
|
3594
|
+
else if (/^projects\/[^/]+\/locations\/[^/]+\/datasets\/[^/]+$/.test(src)) {
|
|
3595
|
+
sourceObj = { format: 'vertex-dataset', vertexDatasetName: src };
|
|
3596
|
+
}
|
|
3580
3597
|
else {
|
|
3581
3598
|
throw new Error(`Unsupported string source for Vertex AI: ${src}`);
|
|
3582
3599
|
}
|
|
@@ -3602,14 +3619,18 @@ function tBatchJobSource(client, src) {
|
|
|
3602
3619
|
sourceObj = src;
|
|
3603
3620
|
}
|
|
3604
3621
|
// Validation logic
|
|
3605
|
-
const vertexSourcesCount = [
|
|
3622
|
+
const vertexSourcesCount = [
|
|
3623
|
+
sourceObj.gcsUri,
|
|
3624
|
+
sourceObj.bigqueryUri,
|
|
3625
|
+
sourceObj.vertexDatasetName,
|
|
3626
|
+
].filter(Boolean).length;
|
|
3606
3627
|
const mldevSourcesCount = [
|
|
3607
3628
|
sourceObj.inlinedRequests,
|
|
3608
3629
|
sourceObj.fileName,
|
|
3609
3630
|
].filter(Boolean).length;
|
|
3610
3631
|
if (client.isVertexAI()) {
|
|
3611
3632
|
if (mldevSourcesCount > 0 || vertexSourcesCount !== 1) {
|
|
3612
|
-
throw new Error('Exactly one of `gcsUri` or `
|
|
3633
|
+
throw new Error('Exactly one of `gcsUri`, `bigqueryUri`, or `vertexDatasetName` must be set for Vertex AI.');
|
|
3613
3634
|
}
|
|
3614
3635
|
}
|
|
3615
3636
|
else {
|
|
@@ -3828,6 +3849,12 @@ function batchJobDestinationFromVertex(fromObject) {
|
|
|
3828
3849
|
if (fromBigqueryUri != null) {
|
|
3829
3850
|
setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
|
|
3830
3851
|
}
|
|
3852
|
+
const fromVertexDataset = getValueByPath(fromObject, [
|
|
3853
|
+
'vertexMultimodalDatasetDestination',
|
|
3854
|
+
]);
|
|
3855
|
+
if (fromVertexDataset != null) {
|
|
3856
|
+
setValueByPath(toObject, ['vertexDataset'], vertexMultimodalDatasetDestinationFromVertex(fromVertexDataset));
|
|
3857
|
+
}
|
|
3831
3858
|
return toObject;
|
|
3832
3859
|
}
|
|
3833
3860
|
function batchJobDestinationToVertex(fromObject) {
|
|
@@ -3845,14 +3872,20 @@ function batchJobDestinationToVertex(fromObject) {
|
|
|
3845
3872
|
setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryUri);
|
|
3846
3873
|
}
|
|
3847
3874
|
if (getValueByPath(fromObject, ['fileName']) !== undefined) {
|
|
3848
|
-
throw new Error('fileName parameter is not supported in Vertex AI.');
|
|
3875
|
+
throw new Error('fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
3849
3876
|
}
|
|
3850
3877
|
if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
|
|
3851
|
-
throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
|
|
3878
|
+
throw new Error('inlinedResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
3852
3879
|
}
|
|
3853
3880
|
if (getValueByPath(fromObject, ['inlinedEmbedContentResponses']) !==
|
|
3854
3881
|
undefined) {
|
|
3855
|
-
throw new Error('inlinedEmbedContentResponses parameter is not supported in Vertex AI.');
|
|
3882
|
+
throw new Error('inlinedEmbedContentResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
3883
|
+
}
|
|
3884
|
+
const fromVertexDataset = getValueByPath(fromObject, [
|
|
3885
|
+
'vertexDataset',
|
|
3886
|
+
]);
|
|
3887
|
+
if (fromVertexDataset != null) {
|
|
3888
|
+
setValueByPath(toObject, ['vertexMultimodalDatasetDestination'], vertexMultimodalDatasetDestinationToVertex(fromVertexDataset));
|
|
3856
3889
|
}
|
|
3857
3890
|
return toObject;
|
|
3858
3891
|
}
|
|
@@ -3956,6 +3989,10 @@ function batchJobFromVertex(fromObject) {
|
|
|
3956
3989
|
if (fromCompletionStats != null) {
|
|
3957
3990
|
setValueByPath(toObject, ['completionStats'], fromCompletionStats);
|
|
3958
3991
|
}
|
|
3992
|
+
const fromOutputInfo = getValueByPath(fromObject, ['outputInfo']);
|
|
3993
|
+
if (fromOutputInfo != null) {
|
|
3994
|
+
setValueByPath(toObject, ['outputInfo'], fromOutputInfo);
|
|
3995
|
+
}
|
|
3959
3996
|
return toObject;
|
|
3960
3997
|
}
|
|
3961
3998
|
function batchJobSourceFromVertex(fromObject) {
|
|
@@ -3975,6 +4012,13 @@ function batchJobSourceFromVertex(fromObject) {
|
|
|
3975
4012
|
if (fromBigqueryUri != null) {
|
|
3976
4013
|
setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
|
|
3977
4014
|
}
|
|
4015
|
+
const fromVertexDatasetName = getValueByPath(fromObject, [
|
|
4016
|
+
'vertexMultimodalDatasetSource',
|
|
4017
|
+
'datasetName',
|
|
4018
|
+
]);
|
|
4019
|
+
if (fromVertexDatasetName != null) {
|
|
4020
|
+
setValueByPath(toObject, ['vertexDatasetName'], fromVertexDatasetName);
|
|
4021
|
+
}
|
|
3978
4022
|
return toObject;
|
|
3979
4023
|
}
|
|
3980
4024
|
function batchJobSourceToMldev(apiClient, fromObject) {
|
|
@@ -4004,6 +4048,9 @@ function batchJobSourceToMldev(apiClient, fromObject) {
|
|
|
4004
4048
|
}
|
|
4005
4049
|
setValueByPath(toObject, ['requests', 'requests'], transformedList);
|
|
4006
4050
|
}
|
|
4051
|
+
if (getValueByPath(fromObject, ['vertexDatasetName']) !== undefined) {
|
|
4052
|
+
throw new Error('vertexDatasetName parameter is not supported in Gemini API.');
|
|
4053
|
+
}
|
|
4007
4054
|
return toObject;
|
|
4008
4055
|
}
|
|
4009
4056
|
function batchJobSourceToVertex(fromObject) {
|
|
@@ -4021,10 +4068,16 @@ function batchJobSourceToVertex(fromObject) {
|
|
|
4021
4068
|
setValueByPath(toObject, ['bigquerySource', 'inputUri'], fromBigqueryUri);
|
|
4022
4069
|
}
|
|
4023
4070
|
if (getValueByPath(fromObject, ['fileName']) !== undefined) {
|
|
4024
|
-
throw new Error('fileName parameter is not supported in Vertex AI.');
|
|
4071
|
+
throw new Error('fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
4025
4072
|
}
|
|
4026
4073
|
if (getValueByPath(fromObject, ['inlinedRequests']) !== undefined) {
|
|
4027
|
-
throw new Error('inlinedRequests parameter is not supported in Vertex AI.');
|
|
4074
|
+
throw new Error('inlinedRequests parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
4075
|
+
}
|
|
4076
|
+
const fromVertexDatasetName = getValueByPath(fromObject, [
|
|
4077
|
+
'vertexDatasetName',
|
|
4078
|
+
]);
|
|
4079
|
+
if (fromVertexDatasetName != null) {
|
|
4080
|
+
setValueByPath(toObject, ['vertexMultimodalDatasetSource', 'datasetName'], fromVertexDatasetName);
|
|
4028
4081
|
}
|
|
4029
4082
|
return toObject;
|
|
4030
4083
|
}
|
|
@@ -4179,7 +4232,7 @@ function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
|
4179
4232
|
setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
|
|
4180
4233
|
}
|
|
4181
4234
|
if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
|
|
4182
|
-
throw new Error('webhookConfig parameter is not supported in Vertex AI.');
|
|
4235
|
+
throw new Error('webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
4183
4236
|
}
|
|
4184
4237
|
return toObject;
|
|
4185
4238
|
}
|
|
@@ -5021,6 +5074,35 @@ function toolToMldev$4(fromObject) {
|
|
|
5021
5074
|
}
|
|
5022
5075
|
return toObject;
|
|
5023
5076
|
}
|
|
5077
|
+
function vertexMultimodalDatasetDestinationFromVertex(fromObject) {
|
|
5078
|
+
const toObject = {};
|
|
5079
|
+
const fromBigqueryDestination = getValueByPath(fromObject, [
|
|
5080
|
+
'bigqueryDestination',
|
|
5081
|
+
'outputUri',
|
|
5082
|
+
]);
|
|
5083
|
+
if (fromBigqueryDestination != null) {
|
|
5084
|
+
setValueByPath(toObject, ['bigqueryDestination'], fromBigqueryDestination);
|
|
5085
|
+
}
|
|
5086
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
5087
|
+
if (fromDisplayName != null) {
|
|
5088
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
5089
|
+
}
|
|
5090
|
+
return toObject;
|
|
5091
|
+
}
|
|
5092
|
+
function vertexMultimodalDatasetDestinationToVertex(fromObject) {
|
|
5093
|
+
const toObject = {};
|
|
5094
|
+
const fromBigqueryDestination = getValueByPath(fromObject, [
|
|
5095
|
+
'bigqueryDestination',
|
|
5096
|
+
]);
|
|
5097
|
+
if (fromBigqueryDestination != null) {
|
|
5098
|
+
setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryDestination);
|
|
5099
|
+
}
|
|
5100
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
5101
|
+
if (fromDisplayName != null) {
|
|
5102
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
5103
|
+
}
|
|
5104
|
+
return toObject;
|
|
5105
|
+
}
|
|
5024
5106
|
|
|
5025
5107
|
/**
|
|
5026
5108
|
* @license
|
|
@@ -5275,7 +5357,7 @@ class Batches extends BaseModule {
|
|
|
5275
5357
|
this.createEmbeddings = async (params) => {
|
|
5276
5358
|
console.warn('batches.createEmbeddings() is experimental and may change without notice.');
|
|
5277
5359
|
if (this.apiClient.isVertexAI()) {
|
|
5278
|
-
throw new Error('Vertex AI does not support batches.createEmbeddings.');
|
|
5360
|
+
throw new Error('Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.createEmbeddings.');
|
|
5279
5361
|
}
|
|
5280
5362
|
return this.createEmbeddingsInternal(params);
|
|
5281
5363
|
};
|
|
@@ -5352,7 +5434,7 @@ class Batches extends BaseModule {
|
|
|
5352
5434
|
newConfig.dest = `${bigqueryUri}_dest_${timestampStr}`;
|
|
5353
5435
|
}
|
|
5354
5436
|
else {
|
|
5355
|
-
throw new Error('Unsupported source for Vertex AI: No GCS or BigQuery URI found.');
|
|
5437
|
+
throw new Error('Unsupported source for Gemini Enterprise Agent Platform (previously known as Vertex AI): No GCS or BigQuery URI found.');
|
|
5356
5438
|
}
|
|
5357
5439
|
}
|
|
5358
5440
|
return newConfig;
|
|
@@ -6037,7 +6119,7 @@ function functionDeclarationToVertex$2(fromObject) {
|
|
|
6037
6119
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
6038
6120
|
}
|
|
6039
6121
|
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
6040
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
6122
|
+
throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
6041
6123
|
}
|
|
6042
6124
|
return toObject;
|
|
6043
6125
|
}
|
|
@@ -6316,13 +6398,13 @@ function partToVertex$2(fromObject) {
|
|
|
6316
6398
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
6317
6399
|
}
|
|
6318
6400
|
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
6319
|
-
throw new Error('toolCall parameter is not supported in Vertex AI.');
|
|
6401
|
+
throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
6320
6402
|
}
|
|
6321
6403
|
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
6322
|
-
throw new Error('toolResponse parameter is not supported in Vertex AI.');
|
|
6404
|
+
throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
6323
6405
|
}
|
|
6324
6406
|
if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
|
|
6325
|
-
throw new Error('partMetadata parameter is not supported in Vertex AI.');
|
|
6407
|
+
throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
6326
6408
|
}
|
|
6327
6409
|
return toObject;
|
|
6328
6410
|
}
|
|
@@ -6362,7 +6444,7 @@ function toolConfigToVertex$1(fromObject) {
|
|
|
6362
6444
|
}
|
|
6363
6445
|
if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
|
|
6364
6446
|
undefined) {
|
|
6365
|
-
throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
|
|
6447
|
+
throw new Error('includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
6366
6448
|
}
|
|
6367
6449
|
return toObject;
|
|
6368
6450
|
}
|
|
@@ -6444,7 +6526,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6444
6526
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6445
6527
|
}
|
|
6446
6528
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6447
|
-
throw new Error('fileSearch parameter is not supported in Vertex AI.');
|
|
6529
|
+
throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
6448
6530
|
}
|
|
6449
6531
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
6450
6532
|
if (fromGoogleSearch != null) {
|
|
@@ -6495,7 +6577,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6495
6577
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
6496
6578
|
}
|
|
6497
6579
|
if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
|
|
6498
|
-
throw new Error('mcpServers parameter is not supported in Vertex AI.');
|
|
6580
|
+
throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
6499
6581
|
}
|
|
6500
6582
|
return toObject;
|
|
6501
6583
|
}
|
|
@@ -6581,7 +6663,7 @@ class Caches extends BaseModule {
|
|
|
6581
6663
|
* @remarks
|
|
6582
6664
|
* Context caching is only supported for specific models. See [Gemini
|
|
6583
6665
|
* Developer API reference](https://ai.google.dev/gemini-api/docs/caching?lang=node/context-cac)
|
|
6584
|
-
* and [
|
|
6666
|
+
* and [Gemini Enterprise Agent Platform reference](https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported_models)
|
|
6585
6667
|
* for more information.
|
|
6586
6668
|
*
|
|
6587
6669
|
* @param params - The parameters for the create request.
|
|
@@ -7490,7 +7572,7 @@ class Files extends BaseModule {
|
|
|
7490
7572
|
}
|
|
7491
7573
|
/**
|
|
7492
7574
|
* Uploads a file asynchronously to the Gemini API.
|
|
7493
|
-
* This method is not available in Vertex AI.
|
|
7575
|
+
* This method is not available in Gemini Enterprise Agent Platform (previously known as Vertex AI).
|
|
7494
7576
|
* Supported upload sources:
|
|
7495
7577
|
* - Node.js: File path (string) or Blob object.
|
|
7496
7578
|
* - Browser: Blob object (e.g., File).
|
|
@@ -7516,7 +7598,7 @@ class Files extends BaseModule {
|
|
|
7516
7598
|
* @see {@link types.UploadFileParameters#config} for the optional
|
|
7517
7599
|
* config in the parameters.
|
|
7518
7600
|
* @return A promise that resolves to a `types.File` object.
|
|
7519
|
-
* @throws An error if called on a Vertex AI client.
|
|
7601
|
+
* @throws An error if called on a Gemini Enterprise Agent Platform (previously known as Vertex AI) client.
|
|
7520
7602
|
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
7521
7603
|
* the `mimeType` can be provided in the `params.config` parameter.
|
|
7522
7604
|
* @throws An error occurs if a suitable upload location cannot be established.
|
|
@@ -7533,7 +7615,7 @@ class Files extends BaseModule {
|
|
|
7533
7615
|
*/
|
|
7534
7616
|
async upload(params) {
|
|
7535
7617
|
if (this.apiClient.isVertexAI()) {
|
|
7536
|
-
throw new Error('Vertex AI does not support uploading files. You can share files through a GCS bucket.');
|
|
7618
|
+
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.');
|
|
7537
7619
|
}
|
|
7538
7620
|
return this.apiClient
|
|
7539
7621
|
.uploadFile(params.file, params.config)
|
|
@@ -7937,7 +8019,7 @@ function functionDeclarationToVertex$1(fromObject) {
|
|
|
7937
8019
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
7938
8020
|
}
|
|
7939
8021
|
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
7940
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
8022
|
+
throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
7941
8023
|
}
|
|
7942
8024
|
return toObject;
|
|
7943
8025
|
}
|
|
@@ -8065,7 +8147,7 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
8065
8147
|
}
|
|
8066
8148
|
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
8067
8149
|
undefined) {
|
|
8068
|
-
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
8150
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
8069
8151
|
}
|
|
8070
8152
|
return toObject;
|
|
8071
8153
|
}
|
|
@@ -8681,13 +8763,13 @@ function partToVertex$1(fromObject) {
|
|
|
8681
8763
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
8682
8764
|
}
|
|
8683
8765
|
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
8684
|
-
throw new Error('toolCall parameter is not supported in Vertex AI.');
|
|
8766
|
+
throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
8685
8767
|
}
|
|
8686
8768
|
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
8687
|
-
throw new Error('toolResponse parameter is not supported in Vertex AI.');
|
|
8769
|
+
throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
8688
8770
|
}
|
|
8689
8771
|
if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
|
|
8690
|
-
throw new Error('partMetadata parameter is not supported in Vertex AI.');
|
|
8772
|
+
throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
8691
8773
|
}
|
|
8692
8774
|
return toObject;
|
|
8693
8775
|
}
|
|
@@ -8795,7 +8877,7 @@ function toolToVertex$1(fromObject) {
|
|
|
8795
8877
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8796
8878
|
}
|
|
8797
8879
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
8798
|
-
throw new Error('fileSearch parameter is not supported in Vertex AI.');
|
|
8880
|
+
throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
8799
8881
|
}
|
|
8800
8882
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
8801
8883
|
if (fromGoogleSearch != null) {
|
|
@@ -8846,7 +8928,7 @@ function toolToVertex$1(fromObject) {
|
|
|
8846
8928
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
8847
8929
|
}
|
|
8848
8930
|
if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
|
|
8849
|
-
throw new Error('mcpServers parameter is not supported in Vertex AI.');
|
|
8931
|
+
throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
8850
8932
|
}
|
|
8851
8933
|
return toObject;
|
|
8852
8934
|
}
|
|
@@ -9870,7 +9952,7 @@ function functionDeclarationToVertex(fromObject, _rootObject) {
|
|
|
9870
9952
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
9871
9953
|
}
|
|
9872
9954
|
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
9873
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
9955
|
+
throw new Error('behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
9874
9956
|
}
|
|
9875
9957
|
return toObject;
|
|
9876
9958
|
}
|
|
@@ -10205,7 +10287,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
10205
10287
|
}
|
|
10206
10288
|
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
10207
10289
|
undefined) {
|
|
10208
|
-
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
10290
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
10209
10291
|
}
|
|
10210
10292
|
const fromModelArmorConfig = getValueByPath(fromObject, [
|
|
10211
10293
|
'modelArmorConfig',
|
|
@@ -10699,6 +10781,9 @@ function generateVideosConfigToMldev(fromObject, parentObject, rootObject) {
|
|
|
10699
10781
|
if (parentObject !== undefined && fromWebhookConfig != null) {
|
|
10700
10782
|
setValueByPath(parentObject, ['webhookConfig'], fromWebhookConfig);
|
|
10701
10783
|
}
|
|
10784
|
+
if (getValueByPath(fromObject, ['resizeMode']) !== undefined) {
|
|
10785
|
+
throw new Error('resizeMode parameter is not supported in Gemini API.');
|
|
10786
|
+
}
|
|
10702
10787
|
return toObject;
|
|
10703
10788
|
}
|
|
10704
10789
|
function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
|
|
@@ -10794,7 +10879,11 @@ function generateVideosConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
10794
10879
|
setValueByPath(parentObject, ['labels'], fromLabels);
|
|
10795
10880
|
}
|
|
10796
10881
|
if (getValueByPath(fromObject, ['webhookConfig']) !== undefined) {
|
|
10797
|
-
throw new Error('webhookConfig parameter is not supported in Vertex AI.');
|
|
10882
|
+
throw new Error('webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
10883
|
+
}
|
|
10884
|
+
const fromResizeMode = getValueByPath(fromObject, ['resizeMode']);
|
|
10885
|
+
if (parentObject !== undefined && fromResizeMode != null) {
|
|
10886
|
+
setValueByPath(parentObject, ['parameters', 'resizeMode'], fromResizeMode);
|
|
10798
10887
|
}
|
|
10799
10888
|
return toObject;
|
|
10800
10889
|
}
|
|
@@ -11189,7 +11278,7 @@ function generationConfigToVertex(fromObject, _rootObject) {
|
|
|
11189
11278
|
}
|
|
11190
11279
|
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
11191
11280
|
undefined) {
|
|
11192
|
-
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
11281
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
11193
11282
|
}
|
|
11194
11283
|
return toObject;
|
|
11195
11284
|
}
|
|
@@ -11749,13 +11838,13 @@ function partToVertex(fromObject, _rootObject) {
|
|
|
11749
11838
|
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
11750
11839
|
}
|
|
11751
11840
|
if (getValueByPath(fromObject, ['toolCall']) !== undefined) {
|
|
11752
|
-
throw new Error('toolCall parameter is not supported in Vertex AI.');
|
|
11841
|
+
throw new Error('toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
11753
11842
|
}
|
|
11754
11843
|
if (getValueByPath(fromObject, ['toolResponse']) !== undefined) {
|
|
11755
|
-
throw new Error('toolResponse parameter is not supported in Vertex AI.');
|
|
11844
|
+
throw new Error('toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
11756
11845
|
}
|
|
11757
11846
|
if (getValueByPath(fromObject, ['partMetadata']) !== undefined) {
|
|
11758
|
-
throw new Error('partMetadata parameter is not supported in Vertex AI.');
|
|
11847
|
+
throw new Error('partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
11759
11848
|
}
|
|
11760
11849
|
return toObject;
|
|
11761
11850
|
}
|
|
@@ -12112,7 +12201,7 @@ function toolConfigToVertex(fromObject, _rootObject) {
|
|
|
12112
12201
|
}
|
|
12113
12202
|
if (getValueByPath(fromObject, ['includeServerSideToolInvocations']) !==
|
|
12114
12203
|
undefined) {
|
|
12115
|
-
throw new Error('includeServerSideToolInvocations parameter is not supported in Vertex AI.');
|
|
12204
|
+
throw new Error('includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
12116
12205
|
}
|
|
12117
12206
|
return toObject;
|
|
12118
12207
|
}
|
|
@@ -12194,7 +12283,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12194
12283
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12195
12284
|
}
|
|
12196
12285
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12197
|
-
throw new Error('fileSearch parameter is not supported in Vertex AI.');
|
|
12286
|
+
throw new Error('fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
12198
12287
|
}
|
|
12199
12288
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
12200
12289
|
if (fromGoogleSearch != null) {
|
|
@@ -12245,7 +12334,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12245
12334
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
12246
12335
|
}
|
|
12247
12336
|
if (getValueByPath(fromObject, ['mcpServers']) !== undefined) {
|
|
12248
|
-
throw new Error('mcpServers parameter is not supported in Vertex AI.');
|
|
12337
|
+
throw new Error('mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
12249
12338
|
}
|
|
12250
12339
|
return toObject;
|
|
12251
12340
|
}
|
|
@@ -12803,7 +12892,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12803
12892
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12804
12893
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12805
12894
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12806
|
-
const SDK_VERSION = '1.
|
|
12895
|
+
const SDK_VERSION = '1.51.0'; // x-release-please-version
|
|
12807
12896
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12808
12897
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12809
12898
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -14458,7 +14547,7 @@ class Models extends BaseModule {
|
|
|
14458
14547
|
/**
|
|
14459
14548
|
* Makes an API request to generate content with a given model.
|
|
14460
14549
|
*
|
|
14461
|
-
* For the `model` parameter, supported formats for
|
|
14550
|
+
* For the `model` parameter, supported formats for Gemini Enterprise Agent Platform API include:
|
|
14462
14551
|
* - The Gemini model ID, for example: 'gemini-2.0-flash'
|
|
14463
14552
|
* - The full resource name starts with 'projects/', for example:
|
|
14464
14553
|
* 'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
|
|
@@ -14549,7 +14638,7 @@ class Models extends BaseModule {
|
|
|
14549
14638
|
* Makes an API request to generate content with a given model and yields the
|
|
14550
14639
|
* response in chunks.
|
|
14551
14640
|
*
|
|
14552
|
-
* For the `model` parameter, supported formats for
|
|
14641
|
+
* For the `model` parameter, supported formats for Gemini Enterprise Agent Platform API include:
|
|
14553
14642
|
* - The Gemini model ID, for example: 'gemini-2.0-flash'
|
|
14554
14643
|
* - The full resource name starts with 'projects/', for example:
|
|
14555
14644
|
* 'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
|
|
@@ -14678,7 +14767,7 @@ class Models extends BaseModule {
|
|
|
14678
14767
|
if (this.apiClient.isVertexAI()) {
|
|
14679
14768
|
if (!actualParams.config.queryBase) {
|
|
14680
14769
|
if ((_a = actualParams.config) === null || _a === void 0 ? void 0 : _a.filter) {
|
|
14681
|
-
throw new Error('Filtering tuned models list for Vertex AI is not currently supported');
|
|
14770
|
+
throw new Error('Filtering tuned models list for Gemini Enterprise Agent Platform (previously known as Vertex AI) is not currently supported');
|
|
14682
14771
|
}
|
|
14683
14772
|
else {
|
|
14684
14773
|
actualParams.config.filter = 'labels.tune-type:*';
|
|
@@ -14723,7 +14812,7 @@ class Models extends BaseModule {
|
|
|
14723
14812
|
};
|
|
14724
14813
|
/**
|
|
14725
14814
|
* Upscales an image based on an image, upscale factor, and configuration.
|
|
14726
|
-
* Only supported in
|
|
14815
|
+
* Only supported in Gemini Enterprise Agent Platform currently.
|
|
14727
14816
|
*
|
|
14728
14817
|
* @param params - The parameters for upscaling an image.
|
|
14729
14818
|
* @return The response from the API.
|
|
@@ -15324,7 +15413,7 @@ class Models extends BaseModule {
|
|
|
15324
15413
|
});
|
|
15325
15414
|
}
|
|
15326
15415
|
else {
|
|
15327
|
-
throw new Error('This method is only supported by the Vertex AI.');
|
|
15416
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
15328
15417
|
}
|
|
15329
15418
|
}
|
|
15330
15419
|
/**
|
|
@@ -15367,7 +15456,7 @@ class Models extends BaseModule {
|
|
|
15367
15456
|
});
|
|
15368
15457
|
}
|
|
15369
15458
|
else {
|
|
15370
|
-
throw new Error('This method is only supported by the Vertex AI.');
|
|
15459
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
15371
15460
|
}
|
|
15372
15461
|
}
|
|
15373
15462
|
/**
|
|
@@ -15425,7 +15514,7 @@ class Models extends BaseModule {
|
|
|
15425
15514
|
});
|
|
15426
15515
|
}
|
|
15427
15516
|
else {
|
|
15428
|
-
throw new Error('This method is only supported by the Vertex AI.');
|
|
15517
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
15429
15518
|
}
|
|
15430
15519
|
}
|
|
15431
15520
|
/**
|
|
@@ -15479,7 +15568,7 @@ class Models extends BaseModule {
|
|
|
15479
15568
|
});
|
|
15480
15569
|
}
|
|
15481
15570
|
else {
|
|
15482
|
-
throw new Error('This method is only supported by the Vertex AI.');
|
|
15571
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
15483
15572
|
}
|
|
15484
15573
|
}
|
|
15485
15574
|
/**
|
|
@@ -15897,7 +15986,7 @@ class Models extends BaseModule {
|
|
|
15897
15986
|
});
|
|
15898
15987
|
}
|
|
15899
15988
|
else {
|
|
15900
|
-
throw new Error('This method is only supported by the Vertex AI.');
|
|
15989
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
15901
15990
|
}
|
|
15902
15991
|
}
|
|
15903
15992
|
/**
|
|
@@ -16121,7 +16210,7 @@ class Operations extends BaseModule {
|
|
|
16121
16210
|
return response;
|
|
16122
16211
|
}
|
|
16123
16212
|
else {
|
|
16124
|
-
throw new Error('This method is only supported by the Vertex AI.');
|
|
16213
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
16125
16214
|
}
|
|
16126
16215
|
}
|
|
16127
16216
|
}
|
|
@@ -17125,7 +17214,7 @@ class FileSearchStores extends BaseModule {
|
|
|
17125
17214
|
}
|
|
17126
17215
|
/**
|
|
17127
17216
|
* Uploads a file asynchronously to a given File Search Store.
|
|
17128
|
-
* This method is not available in Vertex AI.
|
|
17217
|
+
* This method is not available in Gemini Enterprise Agent Platform (previously known as Vertex AI).
|
|
17129
17218
|
* Supported upload sources:
|
|
17130
17219
|
* - Node.js: File path (string) or Blob object.
|
|
17131
17220
|
* - Browser: Blob object (e.g., File).
|
|
@@ -17144,7 +17233,7 @@ class FileSearchStores extends BaseModule {
|
|
|
17144
17233
|
* @see {@link types.UploadToFileSearchStoreParameters#config} for the optional
|
|
17145
17234
|
* config in the parameters.
|
|
17146
17235
|
* @return A promise that resolves to a long running operation.
|
|
17147
|
-
* @throws An error if called on a Vertex AI client.
|
|
17236
|
+
* @throws An error if called on a Gemini Enterprise Agent Platform (previously known as Vertex AI) client.
|
|
17148
17237
|
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
17149
17238
|
* the `mimeType` can be provided in the `params.config` parameter.
|
|
17150
17239
|
* @throws An error occurs if a suitable upload location cannot be established.
|
|
@@ -17161,7 +17250,7 @@ class FileSearchStores extends BaseModule {
|
|
|
17161
17250
|
*/
|
|
17162
17251
|
async uploadToFileSearchStore(params) {
|
|
17163
17252
|
if (this.apiClient.isVertexAI()) {
|
|
17164
|
-
throw new Error('Vertex AI does not support uploading files to a file search store.');
|
|
17253
|
+
throw new Error('Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files to a file search store.');
|
|
17165
17254
|
}
|
|
17166
17255
|
return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName, params.file, params.config);
|
|
17167
17256
|
}
|
|
@@ -18036,14 +18125,14 @@ class BaseWebhooks extends APIResource {
|
|
|
18036
18125
|
* Creates a new Webhook.
|
|
18037
18126
|
*/
|
|
18038
18127
|
create(params, options) {
|
|
18039
|
-
const { api_version = this._client.apiVersion
|
|
18040
|
-
return this._client.post(path `/${api_version}/webhooks`, Object.assign({
|
|
18128
|
+
const { api_version = this._client.apiVersion } = params, body = __rest(params, ["api_version"]);
|
|
18129
|
+
return this._client.post(path `/${api_version}/webhooks`, Object.assign({ body }, options));
|
|
18041
18130
|
}
|
|
18042
18131
|
/**
|
|
18043
18132
|
* Updates an existing Webhook.
|
|
18044
18133
|
*/
|
|
18045
|
-
update(id, params, options) {
|
|
18046
|
-
const { api_version = this._client.apiVersion, update_mask } =
|
|
18134
|
+
update(id, params = {}, options) {
|
|
18135
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion, update_mask } = _a, body = __rest(_a, ["api_version", "update_mask"]);
|
|
18047
18136
|
return this._client.patch(path `/${api_version}/webhooks/${id}`, Object.assign({ query: { update_mask }, body }, options));
|
|
18048
18137
|
}
|
|
18049
18138
|
/**
|
|
@@ -19913,22 +20002,6 @@ function getTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
|
19913
20002
|
}
|
|
19914
20003
|
return toObject;
|
|
19915
20004
|
}
|
|
19916
|
-
function listTuningJobsConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
19917
|
-
const toObject = {};
|
|
19918
|
-
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
19919
|
-
if (parentObject !== undefined && fromPageSize != null) {
|
|
19920
|
-
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
19921
|
-
}
|
|
19922
|
-
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
19923
|
-
if (parentObject !== undefined && fromPageToken != null) {
|
|
19924
|
-
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
19925
|
-
}
|
|
19926
|
-
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
19927
|
-
if (parentObject !== undefined && fromFilter != null) {
|
|
19928
|
-
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
19929
|
-
}
|
|
19930
|
-
return toObject;
|
|
19931
|
-
}
|
|
19932
20005
|
function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
19933
20006
|
const toObject = {};
|
|
19934
20007
|
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
@@ -19945,14 +20018,6 @@ function listTuningJobsConfigToVertex(fromObject, parentObject, _rootObject) {
|
|
|
19945
20018
|
}
|
|
19946
20019
|
return toObject;
|
|
19947
20020
|
}
|
|
19948
|
-
function listTuningJobsParametersToMldev(fromObject, rootObject) {
|
|
19949
|
-
const toObject = {};
|
|
19950
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
19951
|
-
if (fromConfig != null) {
|
|
19952
|
-
listTuningJobsConfigToMldev(fromConfig, toObject);
|
|
19953
|
-
}
|
|
19954
|
-
return toObject;
|
|
19955
|
-
}
|
|
19956
20021
|
function listTuningJobsParametersToVertex(fromObject, rootObject) {
|
|
19957
20022
|
const toObject = {};
|
|
19958
20023
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
@@ -19961,32 +20026,6 @@ function listTuningJobsParametersToVertex(fromObject, rootObject) {
|
|
|
19961
20026
|
}
|
|
19962
20027
|
return toObject;
|
|
19963
20028
|
}
|
|
19964
|
-
function listTuningJobsResponseFromMldev(fromObject, rootObject) {
|
|
19965
|
-
const toObject = {};
|
|
19966
|
-
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
19967
|
-
'sdkHttpResponse',
|
|
19968
|
-
]);
|
|
19969
|
-
if (fromSdkHttpResponse != null) {
|
|
19970
|
-
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
19971
|
-
}
|
|
19972
|
-
const fromNextPageToken = getValueByPath(fromObject, [
|
|
19973
|
-
'nextPageToken',
|
|
19974
|
-
]);
|
|
19975
|
-
if (fromNextPageToken != null) {
|
|
19976
|
-
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
19977
|
-
}
|
|
19978
|
-
const fromTuningJobs = getValueByPath(fromObject, ['tunedModels']);
|
|
19979
|
-
if (fromTuningJobs != null) {
|
|
19980
|
-
let transformedList = fromTuningJobs;
|
|
19981
|
-
if (Array.isArray(transformedList)) {
|
|
19982
|
-
transformedList = transformedList.map((item) => {
|
|
19983
|
-
return tuningJobFromMldev(item);
|
|
19984
|
-
});
|
|
19985
|
-
}
|
|
19986
|
-
setValueByPath(toObject, ['tuningJobs'], transformedList);
|
|
19987
|
-
}
|
|
19988
|
-
return toObject;
|
|
19989
|
-
}
|
|
19990
20029
|
function listTuningJobsResponseFromVertex(fromObject, rootObject) {
|
|
19991
20030
|
const toObject = {};
|
|
19992
20031
|
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
@@ -20104,7 +20143,7 @@ function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
|
20104
20143
|
}
|
|
20105
20144
|
}
|
|
20106
20145
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
20107
|
-
throw new Error('examples parameter is not supported in Vertex AI.');
|
|
20146
|
+
throw new Error('examples parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
20108
20147
|
}
|
|
20109
20148
|
return toObject;
|
|
20110
20149
|
}
|
|
@@ -20520,7 +20559,7 @@ class Tunings extends BaseModule {
|
|
|
20520
20559
|
}
|
|
20521
20560
|
}
|
|
20522
20561
|
async listInternal(params) {
|
|
20523
|
-
var _a, _b
|
|
20562
|
+
var _a, _b;
|
|
20524
20563
|
let response;
|
|
20525
20564
|
let path = '';
|
|
20526
20565
|
let queryParams = {};
|
|
@@ -20556,35 +20595,7 @@ class Tunings extends BaseModule {
|
|
|
20556
20595
|
});
|
|
20557
20596
|
}
|
|
20558
20597
|
else {
|
|
20559
|
-
|
|
20560
|
-
path = formatMap('tunedModels', body['_url']);
|
|
20561
|
-
queryParams = body['_query'];
|
|
20562
|
-
delete body['_url'];
|
|
20563
|
-
delete body['_query'];
|
|
20564
|
-
response = this.apiClient
|
|
20565
|
-
.request({
|
|
20566
|
-
path: path,
|
|
20567
|
-
queryParams: queryParams,
|
|
20568
|
-
body: JSON.stringify(body),
|
|
20569
|
-
httpMethod: 'GET',
|
|
20570
|
-
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
20571
|
-
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
20572
|
-
})
|
|
20573
|
-
.then((httpResponse) => {
|
|
20574
|
-
return httpResponse.json().then((jsonResponse) => {
|
|
20575
|
-
const response = jsonResponse;
|
|
20576
|
-
response.sdkHttpResponse = {
|
|
20577
|
-
headers: httpResponse.headers,
|
|
20578
|
-
};
|
|
20579
|
-
return response;
|
|
20580
|
-
});
|
|
20581
|
-
});
|
|
20582
|
-
return response.then((apiResponse) => {
|
|
20583
|
-
const resp = listTuningJobsResponseFromMldev(apiResponse);
|
|
20584
|
-
const typedResp = new ListTuningJobsResponse();
|
|
20585
|
-
Object.assign(typedResp, resp);
|
|
20586
|
-
return typedResp;
|
|
20587
|
-
});
|
|
20598
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
20588
20599
|
}
|
|
20589
20600
|
}
|
|
20590
20601
|
/**
|
|
@@ -20701,7 +20712,7 @@ class Tunings extends BaseModule {
|
|
|
20701
20712
|
});
|
|
20702
20713
|
}
|
|
20703
20714
|
else {
|
|
20704
|
-
throw new Error('This method is only supported by the Vertex AI.');
|
|
20715
|
+
throw new Error('This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).');
|
|
20705
20716
|
}
|
|
20706
20717
|
}
|
|
20707
20718
|
async tuneMldevInternal(params) {
|
|
@@ -21098,6 +21109,33 @@ class NodeFiles extends Files {
|
|
|
21098
21109
|
* SPDX-License-Identifier: Apache-2.0
|
|
21099
21110
|
*/
|
|
21100
21111
|
const LANGUAGE_LABEL_PREFIX = 'gl-node/';
|
|
21112
|
+
function resolveCloudFlag(options) {
|
|
21113
|
+
var _a;
|
|
21114
|
+
if (options.enterprise !== undefined || options.vertexai !== undefined) {
|
|
21115
|
+
if (options.enterprise !== undefined &&
|
|
21116
|
+
options.vertexai !== undefined &&
|
|
21117
|
+
options.enterprise !== options.vertexai) {
|
|
21118
|
+
throw new Error('enterprise and vertexAI flags have conflicting values, please set enterprise value only.');
|
|
21119
|
+
}
|
|
21120
|
+
return (_a = options.enterprise) !== null && _a !== void 0 ? _a : options.vertexai;
|
|
21121
|
+
}
|
|
21122
|
+
const envEnterpriseStr = getEnv('GOOGLE_GENAI_USE_ENTERPRISE');
|
|
21123
|
+
const envVertexaiStr = getEnv('GOOGLE_GENAI_USE_VERTEXAI');
|
|
21124
|
+
const useEnterpriseEnv = stringToBoolean(envEnterpriseStr);
|
|
21125
|
+
const useVertexaiEnv = stringToBoolean(envVertexaiStr);
|
|
21126
|
+
if (envEnterpriseStr !== undefined &&
|
|
21127
|
+
envVertexaiStr !== undefined &&
|
|
21128
|
+
useEnterpriseEnv !== useVertexaiEnv) {
|
|
21129
|
+
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.');
|
|
21130
|
+
}
|
|
21131
|
+
if (envEnterpriseStr !== undefined) {
|
|
21132
|
+
return useEnterpriseEnv;
|
|
21133
|
+
}
|
|
21134
|
+
if (envVertexaiStr !== undefined) {
|
|
21135
|
+
return useVertexaiEnv;
|
|
21136
|
+
}
|
|
21137
|
+
return false;
|
|
21138
|
+
}
|
|
21101
21139
|
/**
|
|
21102
21140
|
* The Google GenAI SDK.
|
|
21103
21141
|
*
|
|
@@ -21175,25 +21213,24 @@ class GoogleGenAI {
|
|
|
21175
21213
|
return this._webhooks;
|
|
21176
21214
|
}
|
|
21177
21215
|
constructor(options) {
|
|
21178
|
-
var _a, _b, _c, _d
|
|
21216
|
+
var _a, _b, _c, _d;
|
|
21179
21217
|
// Validate explicitly set initializer values.
|
|
21180
21218
|
if ((options.project || options.location) && options.apiKey) {
|
|
21181
21219
|
throw new Error('Project/location and API key are mutually exclusive in the client initializer.');
|
|
21182
21220
|
}
|
|
21183
|
-
this.vertexai =
|
|
21184
|
-
(_b = (_a = options.vertexai) !== null && _a !== void 0 ? _a : getBooleanEnv('GOOGLE_GENAI_USE_VERTEXAI')) !== null && _b !== void 0 ? _b : false;
|
|
21221
|
+
this.vertexai = resolveCloudFlag(options);
|
|
21185
21222
|
const envApiKey = getApiKeyFromEnv();
|
|
21186
21223
|
const envProject = getEnv('GOOGLE_CLOUD_PROJECT');
|
|
21187
21224
|
const envLocation = getEnv('GOOGLE_CLOUD_LOCATION');
|
|
21188
|
-
this.apiKey = (
|
|
21189
|
-
this.project = (
|
|
21190
|
-
this.location = (
|
|
21225
|
+
this.apiKey = (_a = options.apiKey) !== null && _a !== void 0 ? _a : envApiKey;
|
|
21226
|
+
this.project = (_b = options.project) !== null && _b !== void 0 ? _b : envProject;
|
|
21227
|
+
this.location = (_c = options.location) !== null && _c !== void 0 ? _c : envLocation;
|
|
21191
21228
|
if (!this.vertexai && !this.apiKey) {
|
|
21192
21229
|
console.warn('API key should be set when using the Gemini API.');
|
|
21193
21230
|
}
|
|
21194
21231
|
// Handle when to use Vertex AI in express mode (api key)
|
|
21195
|
-
if (
|
|
21196
|
-
if ((
|
|
21232
|
+
if (this.vertexai) {
|
|
21233
|
+
if ((_d = options.googleAuthOptions) === null || _d === void 0 ? void 0 : _d.credentials) {
|
|
21197
21234
|
// Explicit credentials take precedence over implicit api_key.
|
|
21198
21235
|
console.debug('The user provided Google Cloud credentials will take precedence' +
|
|
21199
21236
|
' over the API key from the environment variable.');
|
|
@@ -21223,7 +21260,7 @@ class GoogleGenAI {
|
|
|
21223
21260
|
this.location = 'global';
|
|
21224
21261
|
}
|
|
21225
21262
|
}
|
|
21226
|
-
const baseUrl = getBaseUrl(options.httpOptions,
|
|
21263
|
+
const baseUrl = getBaseUrl(options.httpOptions, this.vertexai, getEnv('GOOGLE_VERTEX_BASE_URL'), getEnv('GOOGLE_GEMINI_BASE_URL'));
|
|
21227
21264
|
if (baseUrl) {
|
|
21228
21265
|
if (options.httpOptions) {
|
|
21229
21266
|
options.httpOptions.baseUrl = baseUrl;
|
|
@@ -21266,9 +21303,6 @@ function getEnv(env) {
|
|
|
21266
21303
|
var _a, _b, _c;
|
|
21267
21304
|
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;
|
|
21268
21305
|
}
|
|
21269
|
-
function getBooleanEnv(env) {
|
|
21270
|
-
return stringToBoolean(getEnv(env));
|
|
21271
|
-
}
|
|
21272
21306
|
function stringToBoolean(str) {
|
|
21273
21307
|
if (str === undefined) {
|
|
21274
21308
|
return false;
|
|
@@ -21284,5 +21318,5 @@ function getApiKeyFromEnv() {
|
|
|
21284
21318
|
return envGoogleApiKey || envGeminiApiKey || undefined;
|
|
21285
21319
|
}
|
|
21286
21320
|
|
|
21287
|
-
export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, 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, ModelStage, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReplayResponse, ResourceScope, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, ServiceTier, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, ToolResponse, ToolType, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
21321
|
+
export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, 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, ImageResizeMode, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, ModelStage, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReplayResponse, ResourceScope, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, ServiceTier, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, ToolResponse, ToolType, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
21288
21322
|
//# sourceMappingURL=index.mjs.map
|