@google/genai 1.29.1 → 1.31.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/genai.d.ts +160 -73
- package/dist/index.cjs +824 -434
- package/dist/index.mjs +824 -435
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +3996 -3606
- package/dist/node/index.mjs +3996 -3607
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +160 -73
- package/dist/web/index.mjs +3996 -3607
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +160 -73
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -758,6 +758,22 @@ exports.PhishBlockThreshold = void 0;
|
|
|
758
758
|
*/
|
|
759
759
|
PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
|
|
760
760
|
})(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
|
|
761
|
+
/** The level of thoughts tokens that the model should generate. */
|
|
762
|
+
exports.ThinkingLevel = void 0;
|
|
763
|
+
(function (ThinkingLevel) {
|
|
764
|
+
/**
|
|
765
|
+
* Default value.
|
|
766
|
+
*/
|
|
767
|
+
ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
|
|
768
|
+
/**
|
|
769
|
+
* Low thinking level.
|
|
770
|
+
*/
|
|
771
|
+
ThinkingLevel["LOW"] = "LOW";
|
|
772
|
+
/**
|
|
773
|
+
* High thinking level.
|
|
774
|
+
*/
|
|
775
|
+
ThinkingLevel["HIGH"] = "HIGH";
|
|
776
|
+
})(exports.ThinkingLevel || (exports.ThinkingLevel = {}));
|
|
761
777
|
/** Harm category. */
|
|
762
778
|
exports.HarmCategory = void 0;
|
|
763
779
|
(function (HarmCategory) {
|
|
@@ -1200,6 +1216,26 @@ exports.TuningTask = void 0;
|
|
|
1200
1216
|
*/
|
|
1201
1217
|
TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
|
|
1202
1218
|
})(exports.TuningTask || (exports.TuningTask = {}));
|
|
1219
|
+
/** The tokenization quality used for given media. */
|
|
1220
|
+
exports.PartMediaResolutionLevel = void 0;
|
|
1221
|
+
(function (PartMediaResolutionLevel) {
|
|
1222
|
+
/**
|
|
1223
|
+
* Media resolution has not been set.
|
|
1224
|
+
*/
|
|
1225
|
+
PartMediaResolutionLevel["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
|
|
1226
|
+
/**
|
|
1227
|
+
* Media resolution set to low.
|
|
1228
|
+
*/
|
|
1229
|
+
PartMediaResolutionLevel["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
|
|
1230
|
+
/**
|
|
1231
|
+
* Media resolution set to medium.
|
|
1232
|
+
*/
|
|
1233
|
+
PartMediaResolutionLevel["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
|
|
1234
|
+
/**
|
|
1235
|
+
* Media resolution set to high.
|
|
1236
|
+
*/
|
|
1237
|
+
PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1238
|
+
})(exports.PartMediaResolutionLevel || (exports.PartMediaResolutionLevel = {}));
|
|
1203
1239
|
/** Options for feature selection preference. */
|
|
1204
1240
|
exports.FeatureSelectionPreference = void 0;
|
|
1205
1241
|
(function (FeatureSelectionPreference) {
|
|
@@ -1734,13 +1770,11 @@ class FunctionResponse {
|
|
|
1734
1770
|
/**
|
|
1735
1771
|
* Creates a `Part` object from a `URI` string.
|
|
1736
1772
|
*/
|
|
1737
|
-
function createPartFromUri(uri, mimeType) {
|
|
1738
|
-
return {
|
|
1739
|
-
fileData: {
|
|
1773
|
+
function createPartFromUri(uri, mimeType, mediaResolution) {
|
|
1774
|
+
return Object.assign({ fileData: {
|
|
1740
1775
|
fileUri: uri,
|
|
1741
1776
|
mimeType: mimeType,
|
|
1742
|
-
},
|
|
1743
|
-
};
|
|
1777
|
+
} }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
|
|
1744
1778
|
}
|
|
1745
1779
|
/**
|
|
1746
1780
|
* Creates a `Part` object from a `text` string.
|
|
@@ -1772,13 +1806,11 @@ function createPartFromFunctionResponse(id, name, response, parts = []) {
|
|
|
1772
1806
|
/**
|
|
1773
1807
|
* Creates a `Part` object from a `base64` encoded `string`.
|
|
1774
1808
|
*/
|
|
1775
|
-
function createPartFromBase64(data, mimeType) {
|
|
1776
|
-
return {
|
|
1777
|
-
inlineData: {
|
|
1809
|
+
function createPartFromBase64(data, mimeType, mediaResolution) {
|
|
1810
|
+
return Object.assign({ inlineData: {
|
|
1778
1811
|
data: data,
|
|
1779
1812
|
mimeType: mimeType,
|
|
1780
|
-
},
|
|
1781
|
-
};
|
|
1813
|
+
} }, (mediaResolution && { mediaResolution: { level: mediaResolution } }));
|
|
1782
1814
|
}
|
|
1783
1815
|
/**
|
|
1784
1816
|
* Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
|
|
@@ -2164,6 +2196,9 @@ class GenerateVideosOperation {
|
|
|
2164
2196
|
/** Response for the list tuning jobs method. */
|
|
2165
2197
|
class ListTuningJobsResponse {
|
|
2166
2198
|
}
|
|
2199
|
+
/** Empty response for tunings.cancel method. */
|
|
2200
|
+
class CancelTuningJobResponse {
|
|
2201
|
+
}
|
|
2167
2202
|
/** Empty response for caches.delete method. */
|
|
2168
2203
|
class DeleteCachedContentResponse {
|
|
2169
2204
|
}
|
|
@@ -3858,6 +3893,46 @@ function fileDataToMldev$4(fromObject) {
|
|
|
3858
3893
|
}
|
|
3859
3894
|
return toObject;
|
|
3860
3895
|
}
|
|
3896
|
+
function functionCallToMldev$4(fromObject) {
|
|
3897
|
+
const toObject = {};
|
|
3898
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
3899
|
+
if (fromId != null) {
|
|
3900
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
3901
|
+
}
|
|
3902
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
3903
|
+
if (fromArgs != null) {
|
|
3904
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
3905
|
+
}
|
|
3906
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3907
|
+
if (fromName != null) {
|
|
3908
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3909
|
+
}
|
|
3910
|
+
if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
|
|
3911
|
+
throw new Error('partialArgs parameter is not supported in Gemini API.');
|
|
3912
|
+
}
|
|
3913
|
+
if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
|
|
3914
|
+
throw new Error('willContinue parameter is not supported in Gemini API.');
|
|
3915
|
+
}
|
|
3916
|
+
return toObject;
|
|
3917
|
+
}
|
|
3918
|
+
function functionCallingConfigToMldev$2(fromObject) {
|
|
3919
|
+
const toObject = {};
|
|
3920
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3921
|
+
if (fromMode != null) {
|
|
3922
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3923
|
+
}
|
|
3924
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
3925
|
+
'allowedFunctionNames',
|
|
3926
|
+
]);
|
|
3927
|
+
if (fromAllowedFunctionNames != null) {
|
|
3928
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
3929
|
+
}
|
|
3930
|
+
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
3931
|
+
undefined) {
|
|
3932
|
+
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
3933
|
+
}
|
|
3934
|
+
return toObject;
|
|
3935
|
+
}
|
|
3861
3936
|
function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
3862
3937
|
const toObject = {};
|
|
3863
3938
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
@@ -3970,7 +4045,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
|
3970
4045
|
}
|
|
3971
4046
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
3972
4047
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
3973
|
-
setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
|
|
4048
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
|
|
3974
4049
|
}
|
|
3975
4050
|
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
3976
4051
|
throw new Error('labels parameter is not supported in Gemini API.');
|
|
@@ -4008,7 +4083,7 @@ function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
|
4008
4083
|
}
|
|
4009
4084
|
const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
|
|
4010
4085
|
if (fromImageConfig != null) {
|
|
4011
|
-
setValueByPath(toObject, ['imageConfig'], fromImageConfig);
|
|
4086
|
+
setValueByPath(toObject, ['imageConfig'], imageConfigToMldev$1(fromImageConfig));
|
|
4012
4087
|
}
|
|
4013
4088
|
return toObject;
|
|
4014
4089
|
}
|
|
@@ -4095,6 +4170,25 @@ function googleSearchToMldev$4(fromObject) {
|
|
|
4095
4170
|
}
|
|
4096
4171
|
return toObject;
|
|
4097
4172
|
}
|
|
4173
|
+
function imageConfigToMldev$1(fromObject) {
|
|
4174
|
+
const toObject = {};
|
|
4175
|
+
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
4176
|
+
if (fromAspectRatio != null) {
|
|
4177
|
+
setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
|
|
4178
|
+
}
|
|
4179
|
+
const fromImageSize = getValueByPath(fromObject, ['imageSize']);
|
|
4180
|
+
if (fromImageSize != null) {
|
|
4181
|
+
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
4182
|
+
}
|
|
4183
|
+
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
4184
|
+
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
4185
|
+
}
|
|
4186
|
+
if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
|
|
4187
|
+
undefined) {
|
|
4188
|
+
throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
|
|
4189
|
+
}
|
|
4190
|
+
return toObject;
|
|
4191
|
+
}
|
|
4098
4192
|
function inlinedRequestToMldev(apiClient, fromObject) {
|
|
4099
4193
|
const toObject = {};
|
|
4100
4194
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -4236,9 +4330,11 @@ function listBatchJobsResponseFromVertex(fromObject) {
|
|
|
4236
4330
|
}
|
|
4237
4331
|
function partToMldev$4(fromObject) {
|
|
4238
4332
|
const toObject = {};
|
|
4239
|
-
const
|
|
4240
|
-
|
|
4241
|
-
|
|
4333
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
4334
|
+
'mediaResolution',
|
|
4335
|
+
]);
|
|
4336
|
+
if (fromMediaResolution != null) {
|
|
4337
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
4242
4338
|
}
|
|
4243
4339
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
4244
4340
|
'codeExecutionResult',
|
|
@@ -4256,6 +4352,10 @@ function partToMldev$4(fromObject) {
|
|
|
4256
4352
|
if (fromFileData != null) {
|
|
4257
4353
|
setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
|
|
4258
4354
|
}
|
|
4355
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4356
|
+
if (fromFunctionCall != null) {
|
|
4357
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$4(fromFunctionCall));
|
|
4358
|
+
}
|
|
4259
4359
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4260
4360
|
'functionResponse',
|
|
4261
4361
|
]);
|
|
@@ -4303,6 +4403,22 @@ function safetySettingToMldev$1(fromObject) {
|
|
|
4303
4403
|
}
|
|
4304
4404
|
return toObject;
|
|
4305
4405
|
}
|
|
4406
|
+
function toolConfigToMldev$2(fromObject) {
|
|
4407
|
+
const toObject = {};
|
|
4408
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
4409
|
+
'functionCallingConfig',
|
|
4410
|
+
]);
|
|
4411
|
+
if (fromFunctionCallingConfig != null) {
|
|
4412
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4413
|
+
}
|
|
4414
|
+
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
4415
|
+
'retrievalConfig',
|
|
4416
|
+
]);
|
|
4417
|
+
if (fromRetrievalConfig != null) {
|
|
4418
|
+
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
4419
|
+
}
|
|
4420
|
+
return toObject;
|
|
4421
|
+
}
|
|
4306
4422
|
function toolToMldev$4(fromObject) {
|
|
4307
4423
|
const toObject = {};
|
|
4308
4424
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -4550,6 +4666,23 @@ class Batches extends BaseModule {
|
|
|
4550
4666
|
constructor(apiClient) {
|
|
4551
4667
|
super();
|
|
4552
4668
|
this.apiClient = apiClient;
|
|
4669
|
+
/**
|
|
4670
|
+
* Lists batch jobs.
|
|
4671
|
+
*
|
|
4672
|
+
* @param params - The parameters for the list request.
|
|
4673
|
+
* @return - A pager of batch jobs.
|
|
4674
|
+
*
|
|
4675
|
+
* @example
|
|
4676
|
+
* ```ts
|
|
4677
|
+
* const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
|
|
4678
|
+
* for await (const batchJob of batchJobs) {
|
|
4679
|
+
* console.log(batchJob);
|
|
4680
|
+
* }
|
|
4681
|
+
* ```
|
|
4682
|
+
*/
|
|
4683
|
+
this.list = async (params = {}) => {
|
|
4684
|
+
return new Pager(exports.PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4685
|
+
};
|
|
4553
4686
|
/**
|
|
4554
4687
|
* Create batch job.
|
|
4555
4688
|
*
|
|
@@ -4598,23 +4731,6 @@ class Batches extends BaseModule {
|
|
|
4598
4731
|
}
|
|
4599
4732
|
return this.createEmbeddingsInternal(params);
|
|
4600
4733
|
};
|
|
4601
|
-
/**
|
|
4602
|
-
* Lists batch job configurations.
|
|
4603
|
-
*
|
|
4604
|
-
* @param params - The parameters for the list request.
|
|
4605
|
-
* @return The paginated results of the list of batch jobs.
|
|
4606
|
-
*
|
|
4607
|
-
* @example
|
|
4608
|
-
* ```ts
|
|
4609
|
-
* const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
|
|
4610
|
-
* for await (const batchJob of batchJobs) {
|
|
4611
|
-
* console.log(batchJob);
|
|
4612
|
-
* }
|
|
4613
|
-
* ```
|
|
4614
|
-
*/
|
|
4615
|
-
this.list = async (params = {}) => {
|
|
4616
|
-
return new Pager(exports.PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4617
|
-
};
|
|
4618
4734
|
}
|
|
4619
4735
|
// Helper function to handle inlined generate content requests
|
|
4620
4736
|
createInlinedGenerateContentRequest(params) {
|
|
@@ -5125,7 +5241,7 @@ function createCachedContentConfigToMldev(fromObject, parentObject) {
|
|
|
5125
5241
|
}
|
|
5126
5242
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
5127
5243
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
5128
|
-
setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
|
|
5244
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$1(fromToolConfig));
|
|
5129
5245
|
}
|
|
5130
5246
|
if (getValueByPath(fromObject, ['kmsKeyName']) !== undefined) {
|
|
5131
5247
|
throw new Error('kmsKeyName parameter is not supported in Gemini API.');
|
|
@@ -5257,6 +5373,46 @@ function fileDataToMldev$3(fromObject) {
|
|
|
5257
5373
|
}
|
|
5258
5374
|
return toObject;
|
|
5259
5375
|
}
|
|
5376
|
+
function functionCallToMldev$3(fromObject) {
|
|
5377
|
+
const toObject = {};
|
|
5378
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
5379
|
+
if (fromId != null) {
|
|
5380
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
5381
|
+
}
|
|
5382
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
5383
|
+
if (fromArgs != null) {
|
|
5384
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
5385
|
+
}
|
|
5386
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5387
|
+
if (fromName != null) {
|
|
5388
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5389
|
+
}
|
|
5390
|
+
if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
|
|
5391
|
+
throw new Error('partialArgs parameter is not supported in Gemini API.');
|
|
5392
|
+
}
|
|
5393
|
+
if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
|
|
5394
|
+
throw new Error('willContinue parameter is not supported in Gemini API.');
|
|
5395
|
+
}
|
|
5396
|
+
return toObject;
|
|
5397
|
+
}
|
|
5398
|
+
function functionCallingConfigToMldev$1(fromObject) {
|
|
5399
|
+
const toObject = {};
|
|
5400
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5401
|
+
if (fromMode != null) {
|
|
5402
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
5403
|
+
}
|
|
5404
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
5405
|
+
'allowedFunctionNames',
|
|
5406
|
+
]);
|
|
5407
|
+
if (fromAllowedFunctionNames != null) {
|
|
5408
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
5409
|
+
}
|
|
5410
|
+
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
5411
|
+
undefined) {
|
|
5412
|
+
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
5413
|
+
}
|
|
5414
|
+
return toObject;
|
|
5415
|
+
}
|
|
5260
5416
|
function functionDeclarationToVertex$2(fromObject) {
|
|
5261
5417
|
const toObject = {};
|
|
5262
5418
|
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
@@ -5433,9 +5589,11 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
5433
5589
|
}
|
|
5434
5590
|
function partToMldev$3(fromObject) {
|
|
5435
5591
|
const toObject = {};
|
|
5436
|
-
const
|
|
5437
|
-
|
|
5438
|
-
|
|
5592
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
5593
|
+
'mediaResolution',
|
|
5594
|
+
]);
|
|
5595
|
+
if (fromMediaResolution != null) {
|
|
5596
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
5439
5597
|
}
|
|
5440
5598
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5441
5599
|
'codeExecutionResult',
|
|
@@ -5453,6 +5611,10 @@ function partToMldev$3(fromObject) {
|
|
|
5453
5611
|
if (fromFileData != null) {
|
|
5454
5612
|
setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
|
|
5455
5613
|
}
|
|
5614
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5615
|
+
if (fromFunctionCall != null) {
|
|
5616
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$3(fromFunctionCall));
|
|
5617
|
+
}
|
|
5456
5618
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
5457
5619
|
'functionResponse',
|
|
5458
5620
|
]);
|
|
@@ -5485,6 +5647,22 @@ function partToMldev$3(fromObject) {
|
|
|
5485
5647
|
}
|
|
5486
5648
|
return toObject;
|
|
5487
5649
|
}
|
|
5650
|
+
function toolConfigToMldev$1(fromObject) {
|
|
5651
|
+
const toObject = {};
|
|
5652
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
5653
|
+
'functionCallingConfig',
|
|
5654
|
+
]);
|
|
5655
|
+
if (fromFunctionCallingConfig != null) {
|
|
5656
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5657
|
+
}
|
|
5658
|
+
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
5659
|
+
'retrievalConfig',
|
|
5660
|
+
]);
|
|
5661
|
+
if (fromRetrievalConfig != null) {
|
|
5662
|
+
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
5663
|
+
}
|
|
5664
|
+
return toObject;
|
|
5665
|
+
}
|
|
5488
5666
|
function toolToMldev$3(fromObject) {
|
|
5489
5667
|
const toObject = {};
|
|
5490
5668
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -5655,10 +5833,10 @@ class Caches extends BaseModule {
|
|
|
5655
5833
|
super();
|
|
5656
5834
|
this.apiClient = apiClient;
|
|
5657
5835
|
/**
|
|
5658
|
-
* Lists cached
|
|
5836
|
+
* Lists cached contents.
|
|
5659
5837
|
*
|
|
5660
5838
|
* @param params - The parameters for the list request.
|
|
5661
|
-
* @return
|
|
5839
|
+
* @return - A pager of cached contents.
|
|
5662
5840
|
*
|
|
5663
5841
|
* @example
|
|
5664
5842
|
* ```ts
|
|
@@ -6409,101 +6587,336 @@ class Chat {
|
|
|
6409
6587
|
* Copyright 2025 Google LLC
|
|
6410
6588
|
* SPDX-License-Identifier: Apache-2.0
|
|
6411
6589
|
*/
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
this.name = 'ApiError';
|
|
6419
|
-
this.status = options.status;
|
|
6420
|
-
Object.setPrototypeOf(this, ApiError.prototype);
|
|
6590
|
+
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
6591
|
+
function createFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
6592
|
+
const toObject = {};
|
|
6593
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
6594
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
6595
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
6421
6596
|
}
|
|
6597
|
+
return toObject;
|
|
6422
6598
|
}
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
*/
|
|
6429
|
-
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
6430
|
-
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6431
|
-
const USER_AGENT_HEADER = 'User-Agent';
|
|
6432
|
-
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6433
|
-
const SDK_VERSION = '1.29.1'; // x-release-please-version
|
|
6434
|
-
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6435
|
-
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6436
|
-
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
6437
|
-
const responseLineRE = /^\s*data: (.*)(?:\n\n|\r\r|\r\n\r\n)/;
|
|
6438
|
-
/**
|
|
6439
|
-
* The ApiClient class is used to send requests to the Gemini API or Vertex AI
|
|
6440
|
-
* endpoints.
|
|
6441
|
-
*/
|
|
6442
|
-
class ApiClient {
|
|
6443
|
-
constructor(opts) {
|
|
6444
|
-
var _a, _b;
|
|
6445
|
-
this.clientOptions = Object.assign(Object.assign({}, opts), { project: opts.project, location: opts.location, apiKey: opts.apiKey, vertexai: opts.vertexai });
|
|
6446
|
-
const initHttpOptions = {};
|
|
6447
|
-
if (this.clientOptions.vertexai) {
|
|
6448
|
-
initHttpOptions.apiVersion =
|
|
6449
|
-
(_a = this.clientOptions.apiVersion) !== null && _a !== void 0 ? _a : VERTEX_AI_API_DEFAULT_VERSION;
|
|
6450
|
-
initHttpOptions.baseUrl = this.baseUrlFromProjectLocation();
|
|
6451
|
-
this.normalizeAuthParameters();
|
|
6452
|
-
}
|
|
6453
|
-
else {
|
|
6454
|
-
// Gemini API
|
|
6455
|
-
initHttpOptions.apiVersion =
|
|
6456
|
-
(_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : GOOGLE_AI_API_DEFAULT_VERSION;
|
|
6457
|
-
initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;
|
|
6458
|
-
}
|
|
6459
|
-
initHttpOptions.headers = this.getDefaultHeaders();
|
|
6460
|
-
this.clientOptions.httpOptions = initHttpOptions;
|
|
6461
|
-
if (opts.httpOptions) {
|
|
6462
|
-
this.clientOptions.httpOptions = this.patchHttpOptions(initHttpOptions, opts.httpOptions);
|
|
6463
|
-
}
|
|
6464
|
-
}
|
|
6465
|
-
/**
|
|
6466
|
-
* Determines the base URL for Vertex AI based on project and location.
|
|
6467
|
-
* Uses the global endpoint if location is 'global' or if project/location
|
|
6468
|
-
* are not specified (implying API key usage).
|
|
6469
|
-
* @private
|
|
6470
|
-
*/
|
|
6471
|
-
baseUrlFromProjectLocation() {
|
|
6472
|
-
if (this.clientOptions.project &&
|
|
6473
|
-
this.clientOptions.location &&
|
|
6474
|
-
this.clientOptions.location !== 'global') {
|
|
6475
|
-
// Regional endpoint
|
|
6476
|
-
return `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
|
|
6477
|
-
}
|
|
6478
|
-
// Global endpoint (covers 'global' location and API key usage)
|
|
6479
|
-
return `https://aiplatform.googleapis.com/`;
|
|
6599
|
+
function createFileSearchStoreParametersToMldev(fromObject) {
|
|
6600
|
+
const toObject = {};
|
|
6601
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6602
|
+
if (fromConfig != null) {
|
|
6603
|
+
createFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
6480
6604
|
}
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
normalizeAuthParameters() {
|
|
6489
|
-
if (this.clientOptions.project && this.clientOptions.location) {
|
|
6490
|
-
// Using project/location for auth, clear potential API key
|
|
6491
|
-
this.clientOptions.apiKey = undefined;
|
|
6492
|
-
return;
|
|
6493
|
-
}
|
|
6494
|
-
// Using API key for auth (or no auth provided yet), clear project/location
|
|
6495
|
-
this.clientOptions.project = undefined;
|
|
6496
|
-
this.clientOptions.location = undefined;
|
|
6605
|
+
return toObject;
|
|
6606
|
+
}
|
|
6607
|
+
function deleteFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
6608
|
+
const toObject = {};
|
|
6609
|
+
const fromForce = getValueByPath(fromObject, ['force']);
|
|
6610
|
+
if (parentObject !== undefined && fromForce != null) {
|
|
6611
|
+
setValueByPath(parentObject, ['_query', 'force'], fromForce);
|
|
6497
6612
|
}
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6613
|
+
return toObject;
|
|
6614
|
+
}
|
|
6615
|
+
function deleteFileSearchStoreParametersToMldev(fromObject) {
|
|
6616
|
+
const toObject = {};
|
|
6617
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
6618
|
+
if (fromName != null) {
|
|
6619
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
6501
6620
|
}
|
|
6502
|
-
|
|
6503
|
-
|
|
6621
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6622
|
+
if (fromConfig != null) {
|
|
6623
|
+
deleteFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
6504
6624
|
}
|
|
6505
|
-
|
|
6506
|
-
|
|
6625
|
+
return toObject;
|
|
6626
|
+
}
|
|
6627
|
+
function getFileSearchStoreParametersToMldev(fromObject) {
|
|
6628
|
+
const toObject = {};
|
|
6629
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
6630
|
+
if (fromName != null) {
|
|
6631
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
6632
|
+
}
|
|
6633
|
+
return toObject;
|
|
6634
|
+
}
|
|
6635
|
+
function importFileConfigToMldev(fromObject, parentObject) {
|
|
6636
|
+
const toObject = {};
|
|
6637
|
+
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
6638
|
+
'customMetadata',
|
|
6639
|
+
]);
|
|
6640
|
+
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
6641
|
+
let transformedList = fromCustomMetadata;
|
|
6642
|
+
if (Array.isArray(transformedList)) {
|
|
6643
|
+
transformedList = transformedList.map((item) => {
|
|
6644
|
+
return item;
|
|
6645
|
+
});
|
|
6646
|
+
}
|
|
6647
|
+
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
6648
|
+
}
|
|
6649
|
+
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
6650
|
+
'chunkingConfig',
|
|
6651
|
+
]);
|
|
6652
|
+
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
6653
|
+
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
6654
|
+
}
|
|
6655
|
+
return toObject;
|
|
6656
|
+
}
|
|
6657
|
+
function importFileOperationFromMldev(fromObject) {
|
|
6658
|
+
const toObject = {};
|
|
6659
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
6660
|
+
if (fromName != null) {
|
|
6661
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
6662
|
+
}
|
|
6663
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
6664
|
+
if (fromMetadata != null) {
|
|
6665
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
6666
|
+
}
|
|
6667
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
6668
|
+
if (fromDone != null) {
|
|
6669
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
6670
|
+
}
|
|
6671
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
6672
|
+
if (fromError != null) {
|
|
6673
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
6674
|
+
}
|
|
6675
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
6676
|
+
if (fromResponse != null) {
|
|
6677
|
+
setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
|
|
6678
|
+
}
|
|
6679
|
+
return toObject;
|
|
6680
|
+
}
|
|
6681
|
+
function importFileParametersToMldev(fromObject) {
|
|
6682
|
+
const toObject = {};
|
|
6683
|
+
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
6684
|
+
'fileSearchStoreName',
|
|
6685
|
+
]);
|
|
6686
|
+
if (fromFileSearchStoreName != null) {
|
|
6687
|
+
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
6688
|
+
}
|
|
6689
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
6690
|
+
if (fromFileName != null) {
|
|
6691
|
+
setValueByPath(toObject, ['fileName'], fromFileName);
|
|
6692
|
+
}
|
|
6693
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6694
|
+
if (fromConfig != null) {
|
|
6695
|
+
importFileConfigToMldev(fromConfig, toObject);
|
|
6696
|
+
}
|
|
6697
|
+
return toObject;
|
|
6698
|
+
}
|
|
6699
|
+
function importFileResponseFromMldev(fromObject) {
|
|
6700
|
+
const toObject = {};
|
|
6701
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
6702
|
+
'sdkHttpResponse',
|
|
6703
|
+
]);
|
|
6704
|
+
if (fromSdkHttpResponse != null) {
|
|
6705
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
6706
|
+
}
|
|
6707
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
6708
|
+
if (fromParent != null) {
|
|
6709
|
+
setValueByPath(toObject, ['parent'], fromParent);
|
|
6710
|
+
}
|
|
6711
|
+
const fromDocumentName = getValueByPath(fromObject, ['documentName']);
|
|
6712
|
+
if (fromDocumentName != null) {
|
|
6713
|
+
setValueByPath(toObject, ['documentName'], fromDocumentName);
|
|
6714
|
+
}
|
|
6715
|
+
return toObject;
|
|
6716
|
+
}
|
|
6717
|
+
function listFileSearchStoresConfigToMldev(fromObject, parentObject) {
|
|
6718
|
+
const toObject = {};
|
|
6719
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
6720
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
6721
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
6722
|
+
}
|
|
6723
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
6724
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
6725
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
6726
|
+
}
|
|
6727
|
+
return toObject;
|
|
6728
|
+
}
|
|
6729
|
+
function listFileSearchStoresParametersToMldev(fromObject) {
|
|
6730
|
+
const toObject = {};
|
|
6731
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6732
|
+
if (fromConfig != null) {
|
|
6733
|
+
listFileSearchStoresConfigToMldev(fromConfig, toObject);
|
|
6734
|
+
}
|
|
6735
|
+
return toObject;
|
|
6736
|
+
}
|
|
6737
|
+
function listFileSearchStoresResponseFromMldev(fromObject) {
|
|
6738
|
+
const toObject = {};
|
|
6739
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
6740
|
+
'sdkHttpResponse',
|
|
6741
|
+
]);
|
|
6742
|
+
if (fromSdkHttpResponse != null) {
|
|
6743
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
6744
|
+
}
|
|
6745
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
6746
|
+
'nextPageToken',
|
|
6747
|
+
]);
|
|
6748
|
+
if (fromNextPageToken != null) {
|
|
6749
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
6750
|
+
}
|
|
6751
|
+
const fromFileSearchStores = getValueByPath(fromObject, [
|
|
6752
|
+
'fileSearchStores',
|
|
6753
|
+
]);
|
|
6754
|
+
if (fromFileSearchStores != null) {
|
|
6755
|
+
let transformedList = fromFileSearchStores;
|
|
6756
|
+
if (Array.isArray(transformedList)) {
|
|
6757
|
+
transformedList = transformedList.map((item) => {
|
|
6758
|
+
return item;
|
|
6759
|
+
});
|
|
6760
|
+
}
|
|
6761
|
+
setValueByPath(toObject, ['fileSearchStores'], transformedList);
|
|
6762
|
+
}
|
|
6763
|
+
return toObject;
|
|
6764
|
+
}
|
|
6765
|
+
function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
6766
|
+
const toObject = {};
|
|
6767
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
6768
|
+
if (parentObject !== undefined && fromMimeType != null) {
|
|
6769
|
+
setValueByPath(parentObject, ['mimeType'], fromMimeType);
|
|
6770
|
+
}
|
|
6771
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
6772
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
6773
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
6774
|
+
}
|
|
6775
|
+
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
6776
|
+
'customMetadata',
|
|
6777
|
+
]);
|
|
6778
|
+
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
6779
|
+
let transformedList = fromCustomMetadata;
|
|
6780
|
+
if (Array.isArray(transformedList)) {
|
|
6781
|
+
transformedList = transformedList.map((item) => {
|
|
6782
|
+
return item;
|
|
6783
|
+
});
|
|
6784
|
+
}
|
|
6785
|
+
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
6786
|
+
}
|
|
6787
|
+
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
6788
|
+
'chunkingConfig',
|
|
6789
|
+
]);
|
|
6790
|
+
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
6791
|
+
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
6792
|
+
}
|
|
6793
|
+
return toObject;
|
|
6794
|
+
}
|
|
6795
|
+
function uploadToFileSearchStoreParametersToMldev(fromObject) {
|
|
6796
|
+
const toObject = {};
|
|
6797
|
+
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
6798
|
+
'fileSearchStoreName',
|
|
6799
|
+
]);
|
|
6800
|
+
if (fromFileSearchStoreName != null) {
|
|
6801
|
+
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
6802
|
+
}
|
|
6803
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
6804
|
+
if (fromConfig != null) {
|
|
6805
|
+
uploadToFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
6806
|
+
}
|
|
6807
|
+
return toObject;
|
|
6808
|
+
}
|
|
6809
|
+
function uploadToFileSearchStoreResumableResponseFromMldev(fromObject) {
|
|
6810
|
+
const toObject = {};
|
|
6811
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
6812
|
+
'sdkHttpResponse',
|
|
6813
|
+
]);
|
|
6814
|
+
if (fromSdkHttpResponse != null) {
|
|
6815
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
6816
|
+
}
|
|
6817
|
+
return toObject;
|
|
6818
|
+
}
|
|
6819
|
+
|
|
6820
|
+
/**
|
|
6821
|
+
* @license
|
|
6822
|
+
* Copyright 2025 Google LLC
|
|
6823
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6824
|
+
*/
|
|
6825
|
+
/**
|
|
6826
|
+
* API errors raised by the GenAI API.
|
|
6827
|
+
*/
|
|
6828
|
+
class ApiError extends Error {
|
|
6829
|
+
constructor(options) {
|
|
6830
|
+
super(options.message);
|
|
6831
|
+
this.name = 'ApiError';
|
|
6832
|
+
this.status = options.status;
|
|
6833
|
+
Object.setPrototypeOf(this, ApiError.prototype);
|
|
6834
|
+
}
|
|
6835
|
+
}
|
|
6836
|
+
|
|
6837
|
+
/**
|
|
6838
|
+
* @license
|
|
6839
|
+
* Copyright 2025 Google LLC
|
|
6840
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6841
|
+
*/
|
|
6842
|
+
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
6843
|
+
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6844
|
+
const USER_AGENT_HEADER = 'User-Agent';
|
|
6845
|
+
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6846
|
+
const SDK_VERSION = '1.31.0'; // x-release-please-version
|
|
6847
|
+
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6848
|
+
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6849
|
+
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
6850
|
+
const responseLineRE = /^\s*data: (.*)(?:\n\n|\r\r|\r\n\r\n)/;
|
|
6851
|
+
/**
|
|
6852
|
+
* The ApiClient class is used to send requests to the Gemini API or Vertex AI
|
|
6853
|
+
* endpoints.
|
|
6854
|
+
*/
|
|
6855
|
+
class ApiClient {
|
|
6856
|
+
constructor(opts) {
|
|
6857
|
+
var _a, _b;
|
|
6858
|
+
this.clientOptions = Object.assign(Object.assign({}, opts), { project: opts.project, location: opts.location, apiKey: opts.apiKey, vertexai: opts.vertexai });
|
|
6859
|
+
const initHttpOptions = {};
|
|
6860
|
+
if (this.clientOptions.vertexai) {
|
|
6861
|
+
initHttpOptions.apiVersion =
|
|
6862
|
+
(_a = this.clientOptions.apiVersion) !== null && _a !== void 0 ? _a : VERTEX_AI_API_DEFAULT_VERSION;
|
|
6863
|
+
initHttpOptions.baseUrl = this.baseUrlFromProjectLocation();
|
|
6864
|
+
this.normalizeAuthParameters();
|
|
6865
|
+
}
|
|
6866
|
+
else {
|
|
6867
|
+
// Gemini API
|
|
6868
|
+
initHttpOptions.apiVersion =
|
|
6869
|
+
(_b = this.clientOptions.apiVersion) !== null && _b !== void 0 ? _b : GOOGLE_AI_API_DEFAULT_VERSION;
|
|
6870
|
+
initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;
|
|
6871
|
+
}
|
|
6872
|
+
initHttpOptions.headers = this.getDefaultHeaders();
|
|
6873
|
+
this.clientOptions.httpOptions = initHttpOptions;
|
|
6874
|
+
if (opts.httpOptions) {
|
|
6875
|
+
this.clientOptions.httpOptions = this.patchHttpOptions(initHttpOptions, opts.httpOptions);
|
|
6876
|
+
}
|
|
6877
|
+
}
|
|
6878
|
+
/**
|
|
6879
|
+
* Determines the base URL for Vertex AI based on project and location.
|
|
6880
|
+
* Uses the global endpoint if location is 'global' or if project/location
|
|
6881
|
+
* are not specified (implying API key usage).
|
|
6882
|
+
* @private
|
|
6883
|
+
*/
|
|
6884
|
+
baseUrlFromProjectLocation() {
|
|
6885
|
+
if (this.clientOptions.project &&
|
|
6886
|
+
this.clientOptions.location &&
|
|
6887
|
+
this.clientOptions.location !== 'global') {
|
|
6888
|
+
// Regional endpoint
|
|
6889
|
+
return `https://${this.clientOptions.location}-aiplatform.googleapis.com/`;
|
|
6890
|
+
}
|
|
6891
|
+
// Global endpoint (covers 'global' location and API key usage)
|
|
6892
|
+
return `https://aiplatform.googleapis.com/`;
|
|
6893
|
+
}
|
|
6894
|
+
/**
|
|
6895
|
+
* Normalizes authentication parameters for Vertex AI.
|
|
6896
|
+
* If project and location are provided, API key is cleared.
|
|
6897
|
+
* If project and location are not provided (implying API key usage),
|
|
6898
|
+
* project and location are cleared.
|
|
6899
|
+
* @private
|
|
6900
|
+
*/
|
|
6901
|
+
normalizeAuthParameters() {
|
|
6902
|
+
if (this.clientOptions.project && this.clientOptions.location) {
|
|
6903
|
+
// Using project/location for auth, clear potential API key
|
|
6904
|
+
this.clientOptions.apiKey = undefined;
|
|
6905
|
+
return;
|
|
6906
|
+
}
|
|
6907
|
+
// Using API key for auth (or no auth provided yet), clear project/location
|
|
6908
|
+
this.clientOptions.project = undefined;
|
|
6909
|
+
this.clientOptions.location = undefined;
|
|
6910
|
+
}
|
|
6911
|
+
isVertexAI() {
|
|
6912
|
+
var _a;
|
|
6913
|
+
return (_a = this.clientOptions.vertexai) !== null && _a !== void 0 ? _a : false;
|
|
6914
|
+
}
|
|
6915
|
+
getProject() {
|
|
6916
|
+
return this.clientOptions.project;
|
|
6917
|
+
}
|
|
6918
|
+
getLocation() {
|
|
6919
|
+
return this.clientOptions.location;
|
|
6507
6920
|
}
|
|
6508
6921
|
getApiVersion() {
|
|
6509
6922
|
if (this.clientOptions.httpOptions &&
|
|
@@ -6879,11 +7292,8 @@ class ApiClient {
|
|
|
6879
7292
|
const path = `upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`;
|
|
6880
7293
|
const fileName = this.getFileName(file);
|
|
6881
7294
|
const body = {};
|
|
6882
|
-
if (config
|
|
6883
|
-
body
|
|
6884
|
-
}
|
|
6885
|
-
if (config === null || config === void 0 ? void 0 : config.chunkingConfig) {
|
|
6886
|
-
body['chunkingConfig'] = config.chunkingConfig;
|
|
7295
|
+
if (config != null) {
|
|
7296
|
+
uploadToFileSearchStoreConfigToMldev(config, body);
|
|
6887
7297
|
}
|
|
6888
7298
|
const uploadUrl = await this.fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
|
|
6889
7299
|
return uploader.uploadToFileSearchStore(file, uploadUrl, this);
|
|
@@ -7288,19 +7698,16 @@ class Files extends BaseModule {
|
|
|
7288
7698
|
super();
|
|
7289
7699
|
this.apiClient = apiClient;
|
|
7290
7700
|
/**
|
|
7291
|
-
* Lists
|
|
7701
|
+
* Lists files.
|
|
7292
7702
|
*
|
|
7293
|
-
* @param params - The parameters for the list request
|
|
7294
|
-
* @return
|
|
7703
|
+
* @param params - The parameters for the list request.
|
|
7704
|
+
* @return - A pager of files.
|
|
7295
7705
|
*
|
|
7296
7706
|
* @example
|
|
7297
|
-
* The following code prints the names of all files from the service, the
|
|
7298
|
-
* size of each page is 10.
|
|
7299
|
-
*
|
|
7300
7707
|
* ```ts
|
|
7301
|
-
* const
|
|
7302
|
-
* for await (const file of
|
|
7303
|
-
* console.log(file
|
|
7708
|
+
* const files = await ai.files.list({config: {'pageSize': 2}});
|
|
7709
|
+
* for await (const file of files) {
|
|
7710
|
+
* console.log(file);
|
|
7304
7711
|
* }
|
|
7305
7712
|
* ```
|
|
7306
7713
|
*/
|
|
@@ -7535,259 +7942,24 @@ class Files extends BaseModule {
|
|
|
7535
7942
|
httpMethod: 'DELETE',
|
|
7536
7943
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7537
7944
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7538
|
-
})
|
|
7539
|
-
.then((httpResponse) => {
|
|
7540
|
-
return httpResponse.json().then((jsonResponse) => {
|
|
7541
|
-
const response = jsonResponse;
|
|
7542
|
-
response.sdkHttpResponse = {
|
|
7543
|
-
headers: httpResponse.headers,
|
|
7544
|
-
};
|
|
7545
|
-
return response;
|
|
7546
|
-
});
|
|
7547
|
-
});
|
|
7548
|
-
return response.then((apiResponse) => {
|
|
7549
|
-
const resp = deleteFileResponseFromMldev(apiResponse);
|
|
7550
|
-
const typedResp = new DeleteFileResponse();
|
|
7551
|
-
Object.assign(typedResp, resp);
|
|
7552
|
-
return typedResp;
|
|
7553
|
-
});
|
|
7554
|
-
}
|
|
7555
|
-
}
|
|
7556
|
-
}
|
|
7557
|
-
|
|
7558
|
-
/**
|
|
7559
|
-
* @license
|
|
7560
|
-
* Copyright 2025 Google LLC
|
|
7561
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
7562
|
-
*/
|
|
7563
|
-
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
7564
|
-
function createFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
7565
|
-
const toObject = {};
|
|
7566
|
-
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7567
|
-
if (parentObject !== undefined && fromDisplayName != null) {
|
|
7568
|
-
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
7569
|
-
}
|
|
7570
|
-
return toObject;
|
|
7571
|
-
}
|
|
7572
|
-
function createFileSearchStoreParametersToMldev(fromObject) {
|
|
7573
|
-
const toObject = {};
|
|
7574
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7575
|
-
if (fromConfig != null) {
|
|
7576
|
-
createFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
7577
|
-
}
|
|
7578
|
-
return toObject;
|
|
7579
|
-
}
|
|
7580
|
-
function deleteFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
7581
|
-
const toObject = {};
|
|
7582
|
-
const fromForce = getValueByPath(fromObject, ['force']);
|
|
7583
|
-
if (parentObject !== undefined && fromForce != null) {
|
|
7584
|
-
setValueByPath(parentObject, ['_query', 'force'], fromForce);
|
|
7585
|
-
}
|
|
7586
|
-
return toObject;
|
|
7587
|
-
}
|
|
7588
|
-
function deleteFileSearchStoreParametersToMldev(fromObject) {
|
|
7589
|
-
const toObject = {};
|
|
7590
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
7591
|
-
if (fromName != null) {
|
|
7592
|
-
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7593
|
-
}
|
|
7594
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7595
|
-
if (fromConfig != null) {
|
|
7596
|
-
deleteFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
7597
|
-
}
|
|
7598
|
-
return toObject;
|
|
7599
|
-
}
|
|
7600
|
-
function getFileSearchStoreParametersToMldev(fromObject) {
|
|
7601
|
-
const toObject = {};
|
|
7602
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
7603
|
-
if (fromName != null) {
|
|
7604
|
-
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7605
|
-
}
|
|
7606
|
-
return toObject;
|
|
7607
|
-
}
|
|
7608
|
-
function importFileConfigToMldev(fromObject, parentObject) {
|
|
7609
|
-
const toObject = {};
|
|
7610
|
-
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
7611
|
-
'customMetadata',
|
|
7612
|
-
]);
|
|
7613
|
-
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
7614
|
-
let transformedList = fromCustomMetadata;
|
|
7615
|
-
if (Array.isArray(transformedList)) {
|
|
7616
|
-
transformedList = transformedList.map((item) => {
|
|
7617
|
-
return item;
|
|
7618
|
-
});
|
|
7619
|
-
}
|
|
7620
|
-
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
7621
|
-
}
|
|
7622
|
-
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
7623
|
-
'chunkingConfig',
|
|
7624
|
-
]);
|
|
7625
|
-
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
7626
|
-
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
7627
|
-
}
|
|
7628
|
-
return toObject;
|
|
7629
|
-
}
|
|
7630
|
-
function importFileOperationFromMldev(fromObject) {
|
|
7631
|
-
const toObject = {};
|
|
7632
|
-
const fromName = getValueByPath(fromObject, ['name']);
|
|
7633
|
-
if (fromName != null) {
|
|
7634
|
-
setValueByPath(toObject, ['name'], fromName);
|
|
7635
|
-
}
|
|
7636
|
-
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
7637
|
-
if (fromMetadata != null) {
|
|
7638
|
-
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
7639
|
-
}
|
|
7640
|
-
const fromDone = getValueByPath(fromObject, ['done']);
|
|
7641
|
-
if (fromDone != null) {
|
|
7642
|
-
setValueByPath(toObject, ['done'], fromDone);
|
|
7643
|
-
}
|
|
7644
|
-
const fromError = getValueByPath(fromObject, ['error']);
|
|
7645
|
-
if (fromError != null) {
|
|
7646
|
-
setValueByPath(toObject, ['error'], fromError);
|
|
7647
|
-
}
|
|
7648
|
-
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
7649
|
-
if (fromResponse != null) {
|
|
7650
|
-
setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
|
|
7651
|
-
}
|
|
7652
|
-
return toObject;
|
|
7653
|
-
}
|
|
7654
|
-
function importFileParametersToMldev(fromObject) {
|
|
7655
|
-
const toObject = {};
|
|
7656
|
-
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
7657
|
-
'fileSearchStoreName',
|
|
7658
|
-
]);
|
|
7659
|
-
if (fromFileSearchStoreName != null) {
|
|
7660
|
-
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
7661
|
-
}
|
|
7662
|
-
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
7663
|
-
if (fromFileName != null) {
|
|
7664
|
-
setValueByPath(toObject, ['fileName'], fromFileName);
|
|
7665
|
-
}
|
|
7666
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7667
|
-
if (fromConfig != null) {
|
|
7668
|
-
importFileConfigToMldev(fromConfig, toObject);
|
|
7669
|
-
}
|
|
7670
|
-
return toObject;
|
|
7671
|
-
}
|
|
7672
|
-
function importFileResponseFromMldev(fromObject) {
|
|
7673
|
-
const toObject = {};
|
|
7674
|
-
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7675
|
-
'sdkHttpResponse',
|
|
7676
|
-
]);
|
|
7677
|
-
if (fromSdkHttpResponse != null) {
|
|
7678
|
-
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7679
|
-
}
|
|
7680
|
-
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
7681
|
-
if (fromParent != null) {
|
|
7682
|
-
setValueByPath(toObject, ['parent'], fromParent);
|
|
7683
|
-
}
|
|
7684
|
-
const fromDocumentName = getValueByPath(fromObject, ['documentName']);
|
|
7685
|
-
if (fromDocumentName != null) {
|
|
7686
|
-
setValueByPath(toObject, ['documentName'], fromDocumentName);
|
|
7687
|
-
}
|
|
7688
|
-
return toObject;
|
|
7689
|
-
}
|
|
7690
|
-
function listFileSearchStoresConfigToMldev(fromObject, parentObject) {
|
|
7691
|
-
const toObject = {};
|
|
7692
|
-
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
7693
|
-
if (parentObject !== undefined && fromPageSize != null) {
|
|
7694
|
-
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
7695
|
-
}
|
|
7696
|
-
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
7697
|
-
if (parentObject !== undefined && fromPageToken != null) {
|
|
7698
|
-
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
7699
|
-
}
|
|
7700
|
-
return toObject;
|
|
7701
|
-
}
|
|
7702
|
-
function listFileSearchStoresParametersToMldev(fromObject) {
|
|
7703
|
-
const toObject = {};
|
|
7704
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7705
|
-
if (fromConfig != null) {
|
|
7706
|
-
listFileSearchStoresConfigToMldev(fromConfig, toObject);
|
|
7707
|
-
}
|
|
7708
|
-
return toObject;
|
|
7709
|
-
}
|
|
7710
|
-
function listFileSearchStoresResponseFromMldev(fromObject) {
|
|
7711
|
-
const toObject = {};
|
|
7712
|
-
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7713
|
-
'sdkHttpResponse',
|
|
7714
|
-
]);
|
|
7715
|
-
if (fromSdkHttpResponse != null) {
|
|
7716
|
-
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7717
|
-
}
|
|
7718
|
-
const fromNextPageToken = getValueByPath(fromObject, [
|
|
7719
|
-
'nextPageToken',
|
|
7720
|
-
]);
|
|
7721
|
-
if (fromNextPageToken != null) {
|
|
7722
|
-
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
7723
|
-
}
|
|
7724
|
-
const fromFileSearchStores = getValueByPath(fromObject, [
|
|
7725
|
-
'fileSearchStores',
|
|
7726
|
-
]);
|
|
7727
|
-
if (fromFileSearchStores != null) {
|
|
7728
|
-
let transformedList = fromFileSearchStores;
|
|
7729
|
-
if (Array.isArray(transformedList)) {
|
|
7730
|
-
transformedList = transformedList.map((item) => {
|
|
7731
|
-
return item;
|
|
7945
|
+
})
|
|
7946
|
+
.then((httpResponse) => {
|
|
7947
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
7948
|
+
const response = jsonResponse;
|
|
7949
|
+
response.sdkHttpResponse = {
|
|
7950
|
+
headers: httpResponse.headers,
|
|
7951
|
+
};
|
|
7952
|
+
return response;
|
|
7953
|
+
});
|
|
7732
7954
|
});
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
7739
|
-
const toObject = {};
|
|
7740
|
-
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7741
|
-
if (parentObject !== undefined && fromMimeType != null) {
|
|
7742
|
-
setValueByPath(parentObject, ['mimeType'], fromMimeType);
|
|
7743
|
-
}
|
|
7744
|
-
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7745
|
-
if (parentObject !== undefined && fromDisplayName != null) {
|
|
7746
|
-
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
7747
|
-
}
|
|
7748
|
-
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
7749
|
-
'customMetadata',
|
|
7750
|
-
]);
|
|
7751
|
-
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
7752
|
-
let transformedList = fromCustomMetadata;
|
|
7753
|
-
if (Array.isArray(transformedList)) {
|
|
7754
|
-
transformedList = transformedList.map((item) => {
|
|
7755
|
-
return item;
|
|
7955
|
+
return response.then((apiResponse) => {
|
|
7956
|
+
const resp = deleteFileResponseFromMldev(apiResponse);
|
|
7957
|
+
const typedResp = new DeleteFileResponse();
|
|
7958
|
+
Object.assign(typedResp, resp);
|
|
7959
|
+
return typedResp;
|
|
7756
7960
|
});
|
|
7757
7961
|
}
|
|
7758
|
-
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
7759
|
-
}
|
|
7760
|
-
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
7761
|
-
'chunkingConfig',
|
|
7762
|
-
]);
|
|
7763
|
-
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
7764
|
-
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
7765
|
-
}
|
|
7766
|
-
return toObject;
|
|
7767
|
-
}
|
|
7768
|
-
function uploadToFileSearchStoreParametersToMldev(fromObject) {
|
|
7769
|
-
const toObject = {};
|
|
7770
|
-
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
7771
|
-
'fileSearchStoreName',
|
|
7772
|
-
]);
|
|
7773
|
-
if (fromFileSearchStoreName != null) {
|
|
7774
|
-
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
7775
|
-
}
|
|
7776
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7777
|
-
if (fromConfig != null) {
|
|
7778
|
-
uploadToFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
7779
|
-
}
|
|
7780
|
-
return toObject;
|
|
7781
|
-
}
|
|
7782
|
-
function uploadToFileSearchStoreResumableResponseFromMldev(fromObject) {
|
|
7783
|
-
const toObject = {};
|
|
7784
|
-
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7785
|
-
'sdkHttpResponse',
|
|
7786
|
-
]);
|
|
7787
|
-
if (fromSdkHttpResponse != null) {
|
|
7788
|
-
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7789
7962
|
}
|
|
7790
|
-
return toObject;
|
|
7791
7963
|
}
|
|
7792
7964
|
|
|
7793
7965
|
/**
|
|
@@ -7892,17 +8064,14 @@ class Documents extends BaseModule {
|
|
|
7892
8064
|
*
|
|
7893
8065
|
* @example
|
|
7894
8066
|
* ```ts
|
|
7895
|
-
* const documents = await ai.documents.list({config: {'pageSize': 2}});
|
|
8067
|
+
* const documents = await ai.documents.list({parent:'rag_store_name', config: {'pageSize': 2}});
|
|
7896
8068
|
* for await (const document of documents) {
|
|
7897
8069
|
* console.log(document);
|
|
7898
8070
|
* }
|
|
7899
8071
|
* ```
|
|
7900
8072
|
*/
|
|
7901
8073
|
this.list = async (params) => {
|
|
7902
|
-
return new Pager(exports.PagedItem.PAGED_ITEM_DOCUMENTS, (x) => this.listInternal({
|
|
7903
|
-
parent: params.parent,
|
|
7904
|
-
config: x.config,
|
|
7905
|
-
}), await this.listInternal(params), params);
|
|
8074
|
+
return new Pager(exports.PagedItem.PAGED_ITEM_DOCUMENTS, (x) => this.listInternal({ parent: params.parent, config: x.config }), await this.listInternal(params), params);
|
|
7906
8075
|
};
|
|
7907
8076
|
}
|
|
7908
8077
|
/**
|
|
@@ -7970,12 +8139,6 @@ class Documents extends BaseModule {
|
|
|
7970
8139
|
});
|
|
7971
8140
|
}
|
|
7972
8141
|
}
|
|
7973
|
-
/**
|
|
7974
|
-
* Lists all Documents in a FileSearchStore.
|
|
7975
|
-
*
|
|
7976
|
-
* @param params - The parameters for listing documents.
|
|
7977
|
-
* @return ListDocumentsResponse.
|
|
7978
|
-
*/
|
|
7979
8142
|
async listInternal(params) {
|
|
7980
8143
|
var _a, _b;
|
|
7981
8144
|
let response;
|
|
@@ -8184,12 +8347,6 @@ class FileSearchStores extends BaseModule {
|
|
|
8184
8347
|
});
|
|
8185
8348
|
}
|
|
8186
8349
|
}
|
|
8187
|
-
/**
|
|
8188
|
-
* Lists all FileSearchStore owned by the user.
|
|
8189
|
-
*
|
|
8190
|
-
* @param params - The parameters for listing file search stores.
|
|
8191
|
-
* @return ListFileSearchStoresResponse.
|
|
8192
|
-
*/
|
|
8193
8350
|
async listInternal(params) {
|
|
8194
8351
|
var _a, _b;
|
|
8195
8352
|
let response;
|
|
@@ -8355,6 +8512,28 @@ function fileDataToMldev$2(fromObject) {
|
|
|
8355
8512
|
}
|
|
8356
8513
|
return toObject;
|
|
8357
8514
|
}
|
|
8515
|
+
function functionCallToMldev$2(fromObject) {
|
|
8516
|
+
const toObject = {};
|
|
8517
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
8518
|
+
if (fromId != null) {
|
|
8519
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
8520
|
+
}
|
|
8521
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
8522
|
+
if (fromArgs != null) {
|
|
8523
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
8524
|
+
}
|
|
8525
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
8526
|
+
if (fromName != null) {
|
|
8527
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
8528
|
+
}
|
|
8529
|
+
if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
|
|
8530
|
+
throw new Error('partialArgs parameter is not supported in Gemini API.');
|
|
8531
|
+
}
|
|
8532
|
+
if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
|
|
8533
|
+
throw new Error('willContinue parameter is not supported in Gemini API.');
|
|
8534
|
+
}
|
|
8535
|
+
return toObject;
|
|
8536
|
+
}
|
|
8358
8537
|
function functionDeclarationToVertex$1(fromObject) {
|
|
8359
8538
|
const toObject = {};
|
|
8360
8539
|
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
@@ -8943,9 +9122,11 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
8943
9122
|
}
|
|
8944
9123
|
function partToMldev$2(fromObject) {
|
|
8945
9124
|
const toObject = {};
|
|
8946
|
-
const
|
|
8947
|
-
|
|
8948
|
-
|
|
9125
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
9126
|
+
'mediaResolution',
|
|
9127
|
+
]);
|
|
9128
|
+
if (fromMediaResolution != null) {
|
|
9129
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
8949
9130
|
}
|
|
8950
9131
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
8951
9132
|
'codeExecutionResult',
|
|
@@ -8963,6 +9144,10 @@ function partToMldev$2(fromObject) {
|
|
|
8963
9144
|
if (fromFileData != null) {
|
|
8964
9145
|
setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
|
|
8965
9146
|
}
|
|
9147
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
9148
|
+
if (fromFunctionCall != null) {
|
|
9149
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$2(fromFunctionCall));
|
|
9150
|
+
}
|
|
8966
9151
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
8967
9152
|
'functionResponse',
|
|
8968
9153
|
]);
|
|
@@ -9884,6 +10069,46 @@ function fileDataToMldev$1(fromObject) {
|
|
|
9884
10069
|
}
|
|
9885
10070
|
return toObject;
|
|
9886
10071
|
}
|
|
10072
|
+
function functionCallToMldev$1(fromObject) {
|
|
10073
|
+
const toObject = {};
|
|
10074
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
10075
|
+
if (fromId != null) {
|
|
10076
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
10077
|
+
}
|
|
10078
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
10079
|
+
if (fromArgs != null) {
|
|
10080
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
10081
|
+
}
|
|
10082
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
10083
|
+
if (fromName != null) {
|
|
10084
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
10085
|
+
}
|
|
10086
|
+
if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
|
|
10087
|
+
throw new Error('partialArgs parameter is not supported in Gemini API.');
|
|
10088
|
+
}
|
|
10089
|
+
if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
|
|
10090
|
+
throw new Error('willContinue parameter is not supported in Gemini API.');
|
|
10091
|
+
}
|
|
10092
|
+
return toObject;
|
|
10093
|
+
}
|
|
10094
|
+
function functionCallingConfigToMldev(fromObject) {
|
|
10095
|
+
const toObject = {};
|
|
10096
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
10097
|
+
if (fromMode != null) {
|
|
10098
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
10099
|
+
}
|
|
10100
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
10101
|
+
'allowedFunctionNames',
|
|
10102
|
+
]);
|
|
10103
|
+
if (fromAllowedFunctionNames != null) {
|
|
10104
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
10105
|
+
}
|
|
10106
|
+
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
10107
|
+
undefined) {
|
|
10108
|
+
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
10109
|
+
}
|
|
10110
|
+
return toObject;
|
|
10111
|
+
}
|
|
9887
10112
|
function functionDeclarationToVertex(fromObject) {
|
|
9888
10113
|
const toObject = {};
|
|
9889
10114
|
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
@@ -10031,7 +10256,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
10031
10256
|
}
|
|
10032
10257
|
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
10033
10258
|
if (parentObject !== undefined && fromToolConfig != null) {
|
|
10034
|
-
setValueByPath(parentObject, ['toolConfig'], fromToolConfig);
|
|
10259
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev(fromToolConfig));
|
|
10035
10260
|
}
|
|
10036
10261
|
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
10037
10262
|
throw new Error('labels parameter is not supported in Gemini API.');
|
|
@@ -10069,7 +10294,7 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
10069
10294
|
}
|
|
10070
10295
|
const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
|
|
10071
10296
|
if (fromImageConfig != null) {
|
|
10072
|
-
setValueByPath(toObject, ['imageConfig'], fromImageConfig);
|
|
10297
|
+
setValueByPath(toObject, ['imageConfig'], imageConfigToMldev(fromImageConfig));
|
|
10073
10298
|
}
|
|
10074
10299
|
return toObject;
|
|
10075
10300
|
}
|
|
@@ -10233,7 +10458,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
10233
10458
|
}
|
|
10234
10459
|
const fromImageConfig = getValueByPath(fromObject, ['imageConfig']);
|
|
10235
10460
|
if (fromImageConfig != null) {
|
|
10236
|
-
setValueByPath(toObject, ['imageConfig'], fromImageConfig);
|
|
10461
|
+
setValueByPath(toObject, ['imageConfig'], imageConfigToVertex(fromImageConfig));
|
|
10237
10462
|
}
|
|
10238
10463
|
return toObject;
|
|
10239
10464
|
}
|
|
@@ -11234,6 +11459,49 @@ function googleSearchToMldev$1(fromObject) {
|
|
|
11234
11459
|
}
|
|
11235
11460
|
return toObject;
|
|
11236
11461
|
}
|
|
11462
|
+
function imageConfigToMldev(fromObject) {
|
|
11463
|
+
const toObject = {};
|
|
11464
|
+
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
11465
|
+
if (fromAspectRatio != null) {
|
|
11466
|
+
setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
|
|
11467
|
+
}
|
|
11468
|
+
const fromImageSize = getValueByPath(fromObject, ['imageSize']);
|
|
11469
|
+
if (fromImageSize != null) {
|
|
11470
|
+
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
11471
|
+
}
|
|
11472
|
+
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
11473
|
+
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
11474
|
+
}
|
|
11475
|
+
if (getValueByPath(fromObject, ['outputCompressionQuality']) !==
|
|
11476
|
+
undefined) {
|
|
11477
|
+
throw new Error('outputCompressionQuality parameter is not supported in Gemini API.');
|
|
11478
|
+
}
|
|
11479
|
+
return toObject;
|
|
11480
|
+
}
|
|
11481
|
+
function imageConfigToVertex(fromObject) {
|
|
11482
|
+
const toObject = {};
|
|
11483
|
+
const fromAspectRatio = getValueByPath(fromObject, ['aspectRatio']);
|
|
11484
|
+
if (fromAspectRatio != null) {
|
|
11485
|
+
setValueByPath(toObject, ['aspectRatio'], fromAspectRatio);
|
|
11486
|
+
}
|
|
11487
|
+
const fromImageSize = getValueByPath(fromObject, ['imageSize']);
|
|
11488
|
+
if (fromImageSize != null) {
|
|
11489
|
+
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
11490
|
+
}
|
|
11491
|
+
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
11492
|
+
'outputMimeType',
|
|
11493
|
+
]);
|
|
11494
|
+
if (fromOutputMimeType != null) {
|
|
11495
|
+
setValueByPath(toObject, ['imageOutputOptions', 'mimeType'], fromOutputMimeType);
|
|
11496
|
+
}
|
|
11497
|
+
const fromOutputCompressionQuality = getValueByPath(fromObject, [
|
|
11498
|
+
'outputCompressionQuality',
|
|
11499
|
+
]);
|
|
11500
|
+
if (fromOutputCompressionQuality != null) {
|
|
11501
|
+
setValueByPath(toObject, ['imageOutputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
11502
|
+
}
|
|
11503
|
+
return toObject;
|
|
11504
|
+
}
|
|
11237
11505
|
function imageFromMldev(fromObject) {
|
|
11238
11506
|
const toObject = {};
|
|
11239
11507
|
const fromImageBytes = getValueByPath(fromObject, [
|
|
@@ -11543,9 +11811,11 @@ function modelFromVertex(fromObject) {
|
|
|
11543
11811
|
}
|
|
11544
11812
|
function partToMldev$1(fromObject) {
|
|
11545
11813
|
const toObject = {};
|
|
11546
|
-
const
|
|
11547
|
-
|
|
11548
|
-
|
|
11814
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
11815
|
+
'mediaResolution',
|
|
11816
|
+
]);
|
|
11817
|
+
if (fromMediaResolution != null) {
|
|
11818
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
11549
11819
|
}
|
|
11550
11820
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
11551
11821
|
'codeExecutionResult',
|
|
@@ -11563,6 +11833,10 @@ function partToMldev$1(fromObject) {
|
|
|
11563
11833
|
if (fromFileData != null) {
|
|
11564
11834
|
setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
|
|
11565
11835
|
}
|
|
11836
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
11837
|
+
if (fromFunctionCall != null) {
|
|
11838
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev$1(fromFunctionCall));
|
|
11839
|
+
}
|
|
11566
11840
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
11567
11841
|
'functionResponse',
|
|
11568
11842
|
]);
|
|
@@ -11927,6 +12201,22 @@ function speechConfigToVertex(fromObject) {
|
|
|
11927
12201
|
}
|
|
11928
12202
|
return toObject;
|
|
11929
12203
|
}
|
|
12204
|
+
function toolConfigToMldev(fromObject) {
|
|
12205
|
+
const toObject = {};
|
|
12206
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
12207
|
+
'functionCallingConfig',
|
|
12208
|
+
]);
|
|
12209
|
+
if (fromFunctionCallingConfig != null) {
|
|
12210
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
12211
|
+
}
|
|
12212
|
+
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
12213
|
+
'retrievalConfig',
|
|
12214
|
+
]);
|
|
12215
|
+
if (fromRetrievalConfig != null) {
|
|
12216
|
+
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
12217
|
+
}
|
|
12218
|
+
return toObject;
|
|
12219
|
+
}
|
|
11930
12220
|
function toolToMldev$1(fromObject) {
|
|
11931
12221
|
const toObject = {};
|
|
11932
12222
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -13402,6 +13692,7 @@ class Models extends BaseModule {
|
|
|
13402
13692
|
* ```
|
|
13403
13693
|
*/
|
|
13404
13694
|
this.generateContentStream = async (params) => {
|
|
13695
|
+
var _a, _b, _c, _d, _e;
|
|
13405
13696
|
this.maybeMoveToResponseJsonSchem(params);
|
|
13406
13697
|
if (shouldDisableAfc(params.config)) {
|
|
13407
13698
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
@@ -13414,6 +13705,17 @@ class Models extends BaseModule {
|
|
|
13414
13705
|
.join(', ');
|
|
13415
13706
|
throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
|
|
13416
13707
|
}
|
|
13708
|
+
// With tool compatibility confirmed, validate that the configuration are
|
|
13709
|
+
// compatible with each other and raise an error if invalid.
|
|
13710
|
+
const streamFunctionCall = (_c = (_b = (_a = params === null || params === void 0 ? void 0 : params.config) === null || _a === void 0 ? void 0 : _a.toolConfig) === null || _b === void 0 ? void 0 : _b.functionCallingConfig) === null || _c === void 0 ? void 0 : _c.streamFunctionCallArguments;
|
|
13711
|
+
const disableAfc = (_e = (_d = params === null || params === void 0 ? void 0 : params.config) === null || _d === void 0 ? void 0 : _d.automaticFunctionCalling) === null || _e === void 0 ? void 0 : _e.disable;
|
|
13712
|
+
if (streamFunctionCall && !disableAfc) {
|
|
13713
|
+
throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, " +
|
|
13714
|
+
'this feature is not compatible with automatic function calling (AFC). ' +
|
|
13715
|
+
"Please set 'config.automaticFunctionCalling.disable' to true to disable AFC " +
|
|
13716
|
+
"or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' " +
|
|
13717
|
+
'to be undefined or set to false to disable streaming function call arguments feature.');
|
|
13718
|
+
}
|
|
13417
13719
|
return await this.processAfcStream(params);
|
|
13418
13720
|
};
|
|
13419
13721
|
/**
|
|
@@ -15031,6 +15333,28 @@ function fileDataToMldev(fromObject) {
|
|
|
15031
15333
|
}
|
|
15032
15334
|
return toObject;
|
|
15033
15335
|
}
|
|
15336
|
+
function functionCallToMldev(fromObject) {
|
|
15337
|
+
const toObject = {};
|
|
15338
|
+
const fromId = getValueByPath(fromObject, ['id']);
|
|
15339
|
+
if (fromId != null) {
|
|
15340
|
+
setValueByPath(toObject, ['id'], fromId);
|
|
15341
|
+
}
|
|
15342
|
+
const fromArgs = getValueByPath(fromObject, ['args']);
|
|
15343
|
+
if (fromArgs != null) {
|
|
15344
|
+
setValueByPath(toObject, ['args'], fromArgs);
|
|
15345
|
+
}
|
|
15346
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
15347
|
+
if (fromName != null) {
|
|
15348
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
15349
|
+
}
|
|
15350
|
+
if (getValueByPath(fromObject, ['partialArgs']) !== undefined) {
|
|
15351
|
+
throw new Error('partialArgs parameter is not supported in Gemini API.');
|
|
15352
|
+
}
|
|
15353
|
+
if (getValueByPath(fromObject, ['willContinue']) !== undefined) {
|
|
15354
|
+
throw new Error('willContinue parameter is not supported in Gemini API.');
|
|
15355
|
+
}
|
|
15356
|
+
return toObject;
|
|
15357
|
+
}
|
|
15034
15358
|
function googleMapsToMldev(fromObject) {
|
|
15035
15359
|
const toObject = {};
|
|
15036
15360
|
if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
|
|
@@ -15182,9 +15506,11 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
|
15182
15506
|
}
|
|
15183
15507
|
function partToMldev(fromObject) {
|
|
15184
15508
|
const toObject = {};
|
|
15185
|
-
const
|
|
15186
|
-
|
|
15187
|
-
|
|
15509
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
15510
|
+
'mediaResolution',
|
|
15511
|
+
]);
|
|
15512
|
+
if (fromMediaResolution != null) {
|
|
15513
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
15188
15514
|
}
|
|
15189
15515
|
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
15190
15516
|
'codeExecutionResult',
|
|
@@ -15202,6 +15528,10 @@ function partToMldev(fromObject) {
|
|
|
15202
15528
|
if (fromFileData != null) {
|
|
15203
15529
|
setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
|
|
15204
15530
|
}
|
|
15531
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
15532
|
+
if (fromFunctionCall != null) {
|
|
15533
|
+
setValueByPath(toObject, ['functionCall'], functionCallToMldev(fromFunctionCall));
|
|
15534
|
+
}
|
|
15205
15535
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
15206
15536
|
'functionResponse',
|
|
15207
15537
|
]);
|
|
@@ -15592,6 +15922,26 @@ function cancelTuningJobParametersToVertex(fromObject, _rootObject) {
|
|
|
15592
15922
|
}
|
|
15593
15923
|
return toObject;
|
|
15594
15924
|
}
|
|
15925
|
+
function cancelTuningJobResponseFromMldev(fromObject, _rootObject) {
|
|
15926
|
+
const toObject = {};
|
|
15927
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
15928
|
+
'sdkHttpResponse',
|
|
15929
|
+
]);
|
|
15930
|
+
if (fromSdkHttpResponse != null) {
|
|
15931
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
15932
|
+
}
|
|
15933
|
+
return toObject;
|
|
15934
|
+
}
|
|
15935
|
+
function cancelTuningJobResponseFromVertex(fromObject, _rootObject) {
|
|
15936
|
+
const toObject = {};
|
|
15937
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
15938
|
+
'sdkHttpResponse',
|
|
15939
|
+
]);
|
|
15940
|
+
if (fromSdkHttpResponse != null) {
|
|
15941
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
15942
|
+
}
|
|
15943
|
+
return toObject;
|
|
15944
|
+
}
|
|
15595
15945
|
function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
15596
15946
|
const toObject = {};
|
|
15597
15947
|
if (getValueByPath(fromObject, ['validationDataset']) !== undefined) {
|
|
@@ -16253,28 +16603,33 @@ class Tunings extends BaseModule {
|
|
|
16253
16603
|
super();
|
|
16254
16604
|
this.apiClient = apiClient;
|
|
16255
16605
|
/**
|
|
16256
|
-
*
|
|
16606
|
+
* Lists tuning jobs.
|
|
16257
16607
|
*
|
|
16258
|
-
* @param
|
|
16259
|
-
* @return - A
|
|
16608
|
+
* @param params - The parameters for the list request.
|
|
16609
|
+
* @return - A pager of tuning jobs.
|
|
16260
16610
|
*
|
|
16261
|
-
* @
|
|
16262
|
-
*
|
|
16611
|
+
* @example
|
|
16612
|
+
* ```ts
|
|
16613
|
+
* const tuningJobs = await ai.tunings.list({config: {'pageSize': 2}});
|
|
16614
|
+
* for await (const tuningJob of tuningJobs) {
|
|
16615
|
+
* console.log(tuningJob);
|
|
16616
|
+
* }
|
|
16617
|
+
* ```
|
|
16263
16618
|
*/
|
|
16264
|
-
this.
|
|
16265
|
-
return await this.
|
|
16619
|
+
this.list = async (params = {}) => {
|
|
16620
|
+
return new Pager(exports.PagedItem.PAGED_ITEM_TUNING_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
16266
16621
|
};
|
|
16267
16622
|
/**
|
|
16268
|
-
*
|
|
16623
|
+
* Gets a TuningJob.
|
|
16269
16624
|
*
|
|
16270
|
-
* @param
|
|
16271
|
-
* @return - A
|
|
16625
|
+
* @param name - The resource name of the tuning job.
|
|
16626
|
+
* @return - A TuningJob object.
|
|
16272
16627
|
*
|
|
16273
16628
|
* @experimental - The SDK's tuning implementation is experimental, and may
|
|
16274
16629
|
* change in future versions.
|
|
16275
16630
|
*/
|
|
16276
|
-
this.
|
|
16277
|
-
return
|
|
16631
|
+
this.get = async (params) => {
|
|
16632
|
+
return await this.getInternal(params);
|
|
16278
16633
|
};
|
|
16279
16634
|
/**
|
|
16280
16635
|
* Creates a supervised fine-tuning job.
|
|
@@ -16469,6 +16824,7 @@ class Tunings extends BaseModule {
|
|
|
16469
16824
|
*/
|
|
16470
16825
|
async cancel(params) {
|
|
16471
16826
|
var _a, _b, _c, _d;
|
|
16827
|
+
let response;
|
|
16472
16828
|
let path = '';
|
|
16473
16829
|
let queryParams = {};
|
|
16474
16830
|
if (this.apiClient.isVertexAI()) {
|
|
@@ -16477,13 +16833,29 @@ class Tunings extends BaseModule {
|
|
|
16477
16833
|
queryParams = body['_query'];
|
|
16478
16834
|
delete body['_url'];
|
|
16479
16835
|
delete body['_query'];
|
|
16480
|
-
|
|
16836
|
+
response = this.apiClient
|
|
16837
|
+
.request({
|
|
16481
16838
|
path: path,
|
|
16482
16839
|
queryParams: queryParams,
|
|
16483
16840
|
body: JSON.stringify(body),
|
|
16484
16841
|
httpMethod: 'POST',
|
|
16485
16842
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
16486
16843
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
16844
|
+
})
|
|
16845
|
+
.then((httpResponse) => {
|
|
16846
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
16847
|
+
const response = jsonResponse;
|
|
16848
|
+
response.sdkHttpResponse = {
|
|
16849
|
+
headers: httpResponse.headers,
|
|
16850
|
+
};
|
|
16851
|
+
return response;
|
|
16852
|
+
});
|
|
16853
|
+
});
|
|
16854
|
+
return response.then((apiResponse) => {
|
|
16855
|
+
const resp = cancelTuningJobResponseFromVertex(apiResponse);
|
|
16856
|
+
const typedResp = new CancelTuningJobResponse();
|
|
16857
|
+
Object.assign(typedResp, resp);
|
|
16858
|
+
return typedResp;
|
|
16487
16859
|
});
|
|
16488
16860
|
}
|
|
16489
16861
|
else {
|
|
@@ -16492,13 +16864,29 @@ class Tunings extends BaseModule {
|
|
|
16492
16864
|
queryParams = body['_query'];
|
|
16493
16865
|
delete body['_url'];
|
|
16494
16866
|
delete body['_query'];
|
|
16495
|
-
|
|
16867
|
+
response = this.apiClient
|
|
16868
|
+
.request({
|
|
16496
16869
|
path: path,
|
|
16497
16870
|
queryParams: queryParams,
|
|
16498
16871
|
body: JSON.stringify(body),
|
|
16499
16872
|
httpMethod: 'POST',
|
|
16500
16873
|
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
16501
16874
|
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
16875
|
+
})
|
|
16876
|
+
.then((httpResponse) => {
|
|
16877
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
16878
|
+
const response = jsonResponse;
|
|
16879
|
+
response.sdkHttpResponse = {
|
|
16880
|
+
headers: httpResponse.headers,
|
|
16881
|
+
};
|
|
16882
|
+
return response;
|
|
16883
|
+
});
|
|
16884
|
+
});
|
|
16885
|
+
return response.then((apiResponse) => {
|
|
16886
|
+
const resp = cancelTuningJobResponseFromMldev(apiResponse);
|
|
16887
|
+
const typedResp = new CancelTuningJobResponse();
|
|
16888
|
+
Object.assign(typedResp, resp);
|
|
16889
|
+
return typedResp;
|
|
16502
16890
|
});
|
|
16503
16891
|
}
|
|
16504
16892
|
}
|
|
@@ -16653,13 +17041,14 @@ class GoogleGenAI {
|
|
|
16653
17041
|
this.vertexai = (_a = options.vertexai) !== null && _a !== void 0 ? _a : false;
|
|
16654
17042
|
this.apiKey = options.apiKey;
|
|
16655
17043
|
this.apiVersion = options.apiVersion;
|
|
17044
|
+
this.httpOptions = options.httpOptions;
|
|
16656
17045
|
const auth = new WebAuth(this.apiKey);
|
|
16657
17046
|
this.apiClient = new ApiClient({
|
|
16658
17047
|
auth: auth,
|
|
16659
17048
|
apiVersion: this.apiVersion,
|
|
16660
17049
|
apiKey: this.apiKey,
|
|
16661
17050
|
vertexai: this.vertexai,
|
|
16662
|
-
httpOptions:
|
|
17051
|
+
httpOptions: this.httpOptions,
|
|
16663
17052
|
userAgentExtra: LANGUAGE_LABEL_PREFIX + 'cross',
|
|
16664
17053
|
uploader: new CrossUploader(),
|
|
16665
17054
|
downloader: new CrossDownloader(),
|
|
@@ -16680,6 +17069,7 @@ class GoogleGenAI {
|
|
|
16680
17069
|
exports.ApiError = ApiError;
|
|
16681
17070
|
exports.Batches = Batches;
|
|
16682
17071
|
exports.Caches = Caches;
|
|
17072
|
+
exports.CancelTuningJobResponse = CancelTuningJobResponse;
|
|
16683
17073
|
exports.Chat = Chat;
|
|
16684
17074
|
exports.Chats = Chats;
|
|
16685
17075
|
exports.ComputeTokensResponse = ComputeTokensResponse;
|