@google/genai 1.13.0 → 1.15.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 +24 -0
- package/dist/genai.d.ts +308 -47
- package/dist/index.cjs +507 -84
- package/dist/index.mjs +507 -85
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +507 -84
- package/dist/node/index.mjs +507 -85
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +308 -47
- package/dist/web/index.mjs +507 -85
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +308 -47
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -445,18 +445,6 @@ exports.ApiSpec = void 0;
|
|
|
445
445
|
*/
|
|
446
446
|
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
447
447
|
})(exports.ApiSpec || (exports.ApiSpec = {}));
|
|
448
|
-
/** Required. The environment being operated. */
|
|
449
|
-
exports.Environment = void 0;
|
|
450
|
-
(function (Environment) {
|
|
451
|
-
/**
|
|
452
|
-
* Defaults to browser.
|
|
453
|
-
*/
|
|
454
|
-
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
455
|
-
/**
|
|
456
|
-
* Operates in a web browser.
|
|
457
|
-
*/
|
|
458
|
-
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
459
|
-
})(exports.Environment || (exports.Environment = {}));
|
|
460
448
|
/** Status of the url retrieval. */
|
|
461
449
|
exports.UrlRetrievalStatus = void 0;
|
|
462
450
|
(function (UrlRetrievalStatus) {
|
|
@@ -724,6 +712,22 @@ exports.JobState = void 0;
|
|
|
724
712
|
*/
|
|
725
713
|
JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
|
|
726
714
|
})(exports.JobState || (exports.JobState = {}));
|
|
715
|
+
/** Tuning mode. */
|
|
716
|
+
exports.TuningMode = void 0;
|
|
717
|
+
(function (TuningMode) {
|
|
718
|
+
/**
|
|
719
|
+
* Tuning mode is unspecified.
|
|
720
|
+
*/
|
|
721
|
+
TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
|
|
722
|
+
/**
|
|
723
|
+
* Full fine-tuning mode.
|
|
724
|
+
*/
|
|
725
|
+
TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
|
|
726
|
+
/**
|
|
727
|
+
* PEFT adapter tuning mode.
|
|
728
|
+
*/
|
|
729
|
+
TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
|
|
730
|
+
})(exports.TuningMode || (exports.TuningMode = {}));
|
|
727
731
|
/** Optional. Adapter size for tuning. */
|
|
728
732
|
exports.AdapterSize = void 0;
|
|
729
733
|
(function (AdapterSize) {
|
|
@@ -792,6 +796,18 @@ exports.DynamicRetrievalConfigMode = void 0;
|
|
|
792
796
|
*/
|
|
793
797
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
794
798
|
})(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
|
|
799
|
+
/** The environment being operated. */
|
|
800
|
+
exports.Environment = void 0;
|
|
801
|
+
(function (Environment) {
|
|
802
|
+
/**
|
|
803
|
+
* Defaults to browser.
|
|
804
|
+
*/
|
|
805
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
806
|
+
/**
|
|
807
|
+
* Operates in a web browser.
|
|
808
|
+
*/
|
|
809
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
810
|
+
})(exports.Environment || (exports.Environment = {}));
|
|
795
811
|
/** Config for the function calling config mode. */
|
|
796
812
|
exports.FunctionCallingConfigMode = void 0;
|
|
797
813
|
(function (FunctionCallingConfigMode) {
|
|
@@ -909,6 +925,15 @@ exports.EditMode = void 0;
|
|
|
909
925
|
EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
|
|
910
926
|
EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
|
|
911
927
|
})(exports.EditMode || (exports.EditMode = {}));
|
|
928
|
+
/** Enum that represents the segmentation mode. */
|
|
929
|
+
exports.SegmentMode = void 0;
|
|
930
|
+
(function (SegmentMode) {
|
|
931
|
+
SegmentMode["FOREGROUND"] = "FOREGROUND";
|
|
932
|
+
SegmentMode["BACKGROUND"] = "BACKGROUND";
|
|
933
|
+
SegmentMode["PROMPT"] = "PROMPT";
|
|
934
|
+
SegmentMode["SEMANTIC"] = "SEMANTIC";
|
|
935
|
+
SegmentMode["INTERACTIVE"] = "INTERACTIVE";
|
|
936
|
+
})(exports.SegmentMode || (exports.SegmentMode = {}));
|
|
912
937
|
/** Enum that controls the compression quality of the generated videos. */
|
|
913
938
|
exports.VideoCompressionQuality = void 0;
|
|
914
939
|
(function (VideoCompressionQuality) {
|
|
@@ -1555,6 +1580,9 @@ class UpscaleImageResponse {
|
|
|
1555
1580
|
/** The output images response. */
|
|
1556
1581
|
class RecontextImageResponse {
|
|
1557
1582
|
}
|
|
1583
|
+
/** The output images response. */
|
|
1584
|
+
class SegmentImageResponse {
|
|
1585
|
+
}
|
|
1558
1586
|
class ListModelsResponse {
|
|
1559
1587
|
}
|
|
1560
1588
|
class DeleteModelResponse {
|
|
@@ -2898,6 +2926,9 @@ function googleSearchToMldev$4(fromObject) {
|
|
|
2898
2926
|
if (fromTimeRangeFilter != null) {
|
|
2899
2927
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
|
|
2900
2928
|
}
|
|
2929
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
2930
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
2931
|
+
}
|
|
2901
2932
|
return toObject;
|
|
2902
2933
|
}
|
|
2903
2934
|
function dynamicRetrievalConfigToMldev$4(fromObject) {
|
|
@@ -2928,6 +2959,14 @@ function urlContextToMldev$4() {
|
|
|
2928
2959
|
const toObject = {};
|
|
2929
2960
|
return toObject;
|
|
2930
2961
|
}
|
|
2962
|
+
function toolComputerUseToMldev$4(fromObject) {
|
|
2963
|
+
const toObject = {};
|
|
2964
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
2965
|
+
if (fromEnvironment != null) {
|
|
2966
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
2967
|
+
}
|
|
2968
|
+
return toObject;
|
|
2969
|
+
}
|
|
2931
2970
|
function toolToMldev$4(fromObject) {
|
|
2932
2971
|
const toObject = {};
|
|
2933
2972
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -2965,16 +3004,16 @@ function toolToMldev$4(fromObject) {
|
|
|
2965
3004
|
if (fromUrlContext != null) {
|
|
2966
3005
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
|
|
2967
3006
|
}
|
|
3007
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
3008
|
+
if (fromComputerUse != null) {
|
|
3009
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$4(fromComputerUse));
|
|
3010
|
+
}
|
|
2968
3011
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
2969
3012
|
'codeExecution',
|
|
2970
3013
|
]);
|
|
2971
3014
|
if (fromCodeExecution != null) {
|
|
2972
3015
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
2973
3016
|
}
|
|
2974
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
2975
|
-
if (fromComputerUse != null) {
|
|
2976
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
2977
|
-
}
|
|
2978
3017
|
return toObject;
|
|
2979
3018
|
}
|
|
2980
3019
|
function functionCallingConfigToMldev$2(fromObject) {
|
|
@@ -4282,6 +4321,7 @@ class Batches extends BaseModule {
|
|
|
4282
4321
|
* ```
|
|
4283
4322
|
*/
|
|
4284
4323
|
this.create = async (params) => {
|
|
4324
|
+
var _a, _b;
|
|
4285
4325
|
if (this.apiClient.isVertexAI()) {
|
|
4286
4326
|
const timestamp = Date.now();
|
|
4287
4327
|
const timestampStr = timestamp.toString();
|
|
@@ -4306,6 +4346,55 @@ class Batches extends BaseModule {
|
|
|
4306
4346
|
}
|
|
4307
4347
|
}
|
|
4308
4348
|
}
|
|
4349
|
+
else {
|
|
4350
|
+
if (Array.isArray(params.src) ||
|
|
4351
|
+
(typeof params.src !== 'string' && params.src.inlinedRequests)) {
|
|
4352
|
+
// Move system instruction to httpOptions extraBody.
|
|
4353
|
+
let path = '';
|
|
4354
|
+
let queryParams = {};
|
|
4355
|
+
const body = createBatchJobParametersToMldev(this.apiClient, params);
|
|
4356
|
+
path = formatMap('{model}:batchGenerateContent', body['_url']);
|
|
4357
|
+
queryParams = body['_query'];
|
|
4358
|
+
// Move system instruction to 'request':
|
|
4359
|
+
// {'systemInstruction': system_instruction}
|
|
4360
|
+
const batch = body['batch'];
|
|
4361
|
+
const inputConfig = batch['inputConfig'];
|
|
4362
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4363
|
+
const requests = requestsWrapper['requests'];
|
|
4364
|
+
const newRequests = [];
|
|
4365
|
+
for (const request of requests) {
|
|
4366
|
+
const requestDict = request;
|
|
4367
|
+
if (requestDict['systemInstruction']) {
|
|
4368
|
+
const systemInstructionValue = requestDict['systemInstruction'];
|
|
4369
|
+
delete requestDict['systemInstruction'];
|
|
4370
|
+
const requestContent = requestDict['request'];
|
|
4371
|
+
requestContent['systemInstruction'] = systemInstructionValue;
|
|
4372
|
+
requestDict['request'] = requestContent;
|
|
4373
|
+
}
|
|
4374
|
+
newRequests.push(requestDict);
|
|
4375
|
+
}
|
|
4376
|
+
requestsWrapper['requests'] = newRequests;
|
|
4377
|
+
delete body['config'];
|
|
4378
|
+
delete body['_url'];
|
|
4379
|
+
delete body['_query'];
|
|
4380
|
+
const response = this.apiClient
|
|
4381
|
+
.request({
|
|
4382
|
+
path: path,
|
|
4383
|
+
queryParams: queryParams,
|
|
4384
|
+
body: JSON.stringify(body),
|
|
4385
|
+
httpMethod: 'POST',
|
|
4386
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4387
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4388
|
+
})
|
|
4389
|
+
.then((httpResponse) => {
|
|
4390
|
+
return httpResponse.json();
|
|
4391
|
+
});
|
|
4392
|
+
return response.then((apiResponse) => {
|
|
4393
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4394
|
+
return resp;
|
|
4395
|
+
});
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4309
4398
|
return await this.createInternal(params);
|
|
4310
4399
|
};
|
|
4311
4400
|
/**
|
|
@@ -4828,6 +4917,9 @@ function googleSearchToMldev$3(fromObject) {
|
|
|
4828
4917
|
if (fromTimeRangeFilter != null) {
|
|
4829
4918
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(fromTimeRangeFilter));
|
|
4830
4919
|
}
|
|
4920
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
4921
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
4922
|
+
}
|
|
4831
4923
|
return toObject;
|
|
4832
4924
|
}
|
|
4833
4925
|
function dynamicRetrievalConfigToMldev$3(fromObject) {
|
|
@@ -4858,6 +4950,14 @@ function urlContextToMldev$3() {
|
|
|
4858
4950
|
const toObject = {};
|
|
4859
4951
|
return toObject;
|
|
4860
4952
|
}
|
|
4953
|
+
function toolComputerUseToMldev$3(fromObject) {
|
|
4954
|
+
const toObject = {};
|
|
4955
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
4956
|
+
if (fromEnvironment != null) {
|
|
4957
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
4958
|
+
}
|
|
4959
|
+
return toObject;
|
|
4960
|
+
}
|
|
4861
4961
|
function toolToMldev$3(fromObject) {
|
|
4862
4962
|
const toObject = {};
|
|
4863
4963
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -4895,16 +4995,16 @@ function toolToMldev$3(fromObject) {
|
|
|
4895
4995
|
if (fromUrlContext != null) {
|
|
4896
4996
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
|
|
4897
4997
|
}
|
|
4998
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4999
|
+
if (fromComputerUse != null) {
|
|
5000
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$3(fromComputerUse));
|
|
5001
|
+
}
|
|
4898
5002
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
4899
5003
|
'codeExecution',
|
|
4900
5004
|
]);
|
|
4901
5005
|
if (fromCodeExecution != null) {
|
|
4902
5006
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
4903
5007
|
}
|
|
4904
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4905
|
-
if (fromComputerUse != null) {
|
|
4906
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
4907
|
-
}
|
|
4908
5008
|
return toObject;
|
|
4909
5009
|
}
|
|
4910
5010
|
function functionCallingConfigToMldev$1(fromObject) {
|
|
@@ -5265,6 +5365,12 @@ function googleSearchToVertex$2(fromObject) {
|
|
|
5265
5365
|
if (fromTimeRangeFilter != null) {
|
|
5266
5366
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$2(fromTimeRangeFilter));
|
|
5267
5367
|
}
|
|
5368
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
5369
|
+
'excludeDomains',
|
|
5370
|
+
]);
|
|
5371
|
+
if (fromExcludeDomains != null) {
|
|
5372
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
5373
|
+
}
|
|
5268
5374
|
return toObject;
|
|
5269
5375
|
}
|
|
5270
5376
|
function dynamicRetrievalConfigToVertex$2(fromObject) {
|
|
@@ -5291,8 +5397,14 @@ function googleSearchRetrievalToVertex$2(fromObject) {
|
|
|
5291
5397
|
}
|
|
5292
5398
|
return toObject;
|
|
5293
5399
|
}
|
|
5294
|
-
function enterpriseWebSearchToVertex$2() {
|
|
5400
|
+
function enterpriseWebSearchToVertex$2(fromObject) {
|
|
5295
5401
|
const toObject = {};
|
|
5402
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
5403
|
+
'excludeDomains',
|
|
5404
|
+
]);
|
|
5405
|
+
if (fromExcludeDomains != null) {
|
|
5406
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
5407
|
+
}
|
|
5296
5408
|
return toObject;
|
|
5297
5409
|
}
|
|
5298
5410
|
function apiKeyConfigToVertex$2(fromObject) {
|
|
@@ -5347,6 +5459,14 @@ function urlContextToVertex$2() {
|
|
|
5347
5459
|
const toObject = {};
|
|
5348
5460
|
return toObject;
|
|
5349
5461
|
}
|
|
5462
|
+
function toolComputerUseToVertex$2(fromObject) {
|
|
5463
|
+
const toObject = {};
|
|
5464
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5465
|
+
if (fromEnvironment != null) {
|
|
5466
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5467
|
+
}
|
|
5468
|
+
return toObject;
|
|
5469
|
+
}
|
|
5350
5470
|
function toolToVertex$2(fromObject) {
|
|
5351
5471
|
const toObject = {};
|
|
5352
5472
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -5379,7 +5499,7 @@ function toolToVertex$2(fromObject) {
|
|
|
5379
5499
|
'enterpriseWebSearch',
|
|
5380
5500
|
]);
|
|
5381
5501
|
if (fromEnterpriseWebSearch != null) {
|
|
5382
|
-
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2());
|
|
5502
|
+
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2(fromEnterpriseWebSearch));
|
|
5383
5503
|
}
|
|
5384
5504
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5385
5505
|
if (fromGoogleMaps != null) {
|
|
@@ -5389,16 +5509,16 @@ function toolToVertex$2(fromObject) {
|
|
|
5389
5509
|
if (fromUrlContext != null) {
|
|
5390
5510
|
setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
|
|
5391
5511
|
}
|
|
5512
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5513
|
+
if (fromComputerUse != null) {
|
|
5514
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$2(fromComputerUse));
|
|
5515
|
+
}
|
|
5392
5516
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5393
5517
|
'codeExecution',
|
|
5394
5518
|
]);
|
|
5395
5519
|
if (fromCodeExecution != null) {
|
|
5396
5520
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5397
5521
|
}
|
|
5398
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5399
|
-
if (fromComputerUse != null) {
|
|
5400
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5401
|
-
}
|
|
5402
5522
|
return toObject;
|
|
5403
5523
|
}
|
|
5404
5524
|
function functionCallingConfigToVertex$1(fromObject) {
|
|
@@ -6185,9 +6305,6 @@ function isValidContent(content) {
|
|
|
6185
6305
|
if (part === undefined || Object.keys(part).length === 0) {
|
|
6186
6306
|
return false;
|
|
6187
6307
|
}
|
|
6188
|
-
if (!part.thought && part.text !== undefined && part.text === '') {
|
|
6189
|
-
return false;
|
|
6190
|
-
}
|
|
6191
6308
|
}
|
|
6192
6309
|
return true;
|
|
6193
6310
|
}
|
|
@@ -7284,6 +7401,9 @@ function googleSearchToMldev$2(fromObject) {
|
|
|
7284
7401
|
if (fromTimeRangeFilter != null) {
|
|
7285
7402
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(fromTimeRangeFilter));
|
|
7286
7403
|
}
|
|
7404
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
7405
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
7406
|
+
}
|
|
7287
7407
|
return toObject;
|
|
7288
7408
|
}
|
|
7289
7409
|
function dynamicRetrievalConfigToMldev$2(fromObject) {
|
|
@@ -7314,6 +7434,14 @@ function urlContextToMldev$2() {
|
|
|
7314
7434
|
const toObject = {};
|
|
7315
7435
|
return toObject;
|
|
7316
7436
|
}
|
|
7437
|
+
function toolComputerUseToMldev$2(fromObject) {
|
|
7438
|
+
const toObject = {};
|
|
7439
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
7440
|
+
if (fromEnvironment != null) {
|
|
7441
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
7442
|
+
}
|
|
7443
|
+
return toObject;
|
|
7444
|
+
}
|
|
7317
7445
|
function toolToMldev$2(fromObject) {
|
|
7318
7446
|
const toObject = {};
|
|
7319
7447
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -7351,16 +7479,16 @@ function toolToMldev$2(fromObject) {
|
|
|
7351
7479
|
if (fromUrlContext != null) {
|
|
7352
7480
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
|
|
7353
7481
|
}
|
|
7482
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7483
|
+
if (fromComputerUse != null) {
|
|
7484
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$2(fromComputerUse));
|
|
7485
|
+
}
|
|
7354
7486
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
7355
7487
|
'codeExecution',
|
|
7356
7488
|
]);
|
|
7357
7489
|
if (fromCodeExecution != null) {
|
|
7358
7490
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
7359
7491
|
}
|
|
7360
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7361
|
-
if (fromComputerUse != null) {
|
|
7362
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
7363
|
-
}
|
|
7364
7492
|
return toObject;
|
|
7365
7493
|
}
|
|
7366
7494
|
function sessionResumptionConfigToMldev$1(fromObject) {
|
|
@@ -7976,6 +8104,12 @@ function googleSearchToVertex$1(fromObject) {
|
|
|
7976
8104
|
if (fromTimeRangeFilter != null) {
|
|
7977
8105
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$1(fromTimeRangeFilter));
|
|
7978
8106
|
}
|
|
8107
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
8108
|
+
'excludeDomains',
|
|
8109
|
+
]);
|
|
8110
|
+
if (fromExcludeDomains != null) {
|
|
8111
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
8112
|
+
}
|
|
7979
8113
|
return toObject;
|
|
7980
8114
|
}
|
|
7981
8115
|
function dynamicRetrievalConfigToVertex$1(fromObject) {
|
|
@@ -8002,8 +8136,14 @@ function googleSearchRetrievalToVertex$1(fromObject) {
|
|
|
8002
8136
|
}
|
|
8003
8137
|
return toObject;
|
|
8004
8138
|
}
|
|
8005
|
-
function enterpriseWebSearchToVertex$1() {
|
|
8139
|
+
function enterpriseWebSearchToVertex$1(fromObject) {
|
|
8006
8140
|
const toObject = {};
|
|
8141
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
8142
|
+
'excludeDomains',
|
|
8143
|
+
]);
|
|
8144
|
+
if (fromExcludeDomains != null) {
|
|
8145
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
8146
|
+
}
|
|
8007
8147
|
return toObject;
|
|
8008
8148
|
}
|
|
8009
8149
|
function apiKeyConfigToVertex$1(fromObject) {
|
|
@@ -8058,6 +8198,14 @@ function urlContextToVertex$1() {
|
|
|
8058
8198
|
const toObject = {};
|
|
8059
8199
|
return toObject;
|
|
8060
8200
|
}
|
|
8201
|
+
function toolComputerUseToVertex$1(fromObject) {
|
|
8202
|
+
const toObject = {};
|
|
8203
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
8204
|
+
if (fromEnvironment != null) {
|
|
8205
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
8206
|
+
}
|
|
8207
|
+
return toObject;
|
|
8208
|
+
}
|
|
8061
8209
|
function toolToVertex$1(fromObject) {
|
|
8062
8210
|
const toObject = {};
|
|
8063
8211
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -8090,7 +8238,7 @@ function toolToVertex$1(fromObject) {
|
|
|
8090
8238
|
'enterpriseWebSearch',
|
|
8091
8239
|
]);
|
|
8092
8240
|
if (fromEnterpriseWebSearch != null) {
|
|
8093
|
-
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1());
|
|
8241
|
+
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1(fromEnterpriseWebSearch));
|
|
8094
8242
|
}
|
|
8095
8243
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
8096
8244
|
if (fromGoogleMaps != null) {
|
|
@@ -8100,16 +8248,16 @@ function toolToVertex$1(fromObject) {
|
|
|
8100
8248
|
if (fromUrlContext != null) {
|
|
8101
8249
|
setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
|
|
8102
8250
|
}
|
|
8251
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8252
|
+
if (fromComputerUse != null) {
|
|
8253
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$1(fromComputerUse));
|
|
8254
|
+
}
|
|
8103
8255
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8104
8256
|
'codeExecution',
|
|
8105
8257
|
]);
|
|
8106
8258
|
if (fromCodeExecution != null) {
|
|
8107
8259
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
8108
8260
|
}
|
|
8109
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8110
|
-
if (fromComputerUse != null) {
|
|
8111
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8112
|
-
}
|
|
8113
8261
|
return toObject;
|
|
8114
8262
|
}
|
|
8115
8263
|
function sessionResumptionConfigToVertex(fromObject) {
|
|
@@ -9637,6 +9785,9 @@ function googleSearchToMldev$1(fromObject) {
|
|
|
9637
9785
|
if (fromTimeRangeFilter != null) {
|
|
9638
9786
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(fromTimeRangeFilter));
|
|
9639
9787
|
}
|
|
9788
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
9789
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
9790
|
+
}
|
|
9640
9791
|
return toObject;
|
|
9641
9792
|
}
|
|
9642
9793
|
function dynamicRetrievalConfigToMldev$1(fromObject) {
|
|
@@ -9667,6 +9818,14 @@ function urlContextToMldev$1() {
|
|
|
9667
9818
|
const toObject = {};
|
|
9668
9819
|
return toObject;
|
|
9669
9820
|
}
|
|
9821
|
+
function toolComputerUseToMldev$1(fromObject) {
|
|
9822
|
+
const toObject = {};
|
|
9823
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
9824
|
+
if (fromEnvironment != null) {
|
|
9825
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
9826
|
+
}
|
|
9827
|
+
return toObject;
|
|
9828
|
+
}
|
|
9670
9829
|
function toolToMldev$1(fromObject) {
|
|
9671
9830
|
const toObject = {};
|
|
9672
9831
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -9704,16 +9863,16 @@ function toolToMldev$1(fromObject) {
|
|
|
9704
9863
|
if (fromUrlContext != null) {
|
|
9705
9864
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
|
|
9706
9865
|
}
|
|
9866
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
9867
|
+
if (fromComputerUse != null) {
|
|
9868
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$1(fromComputerUse));
|
|
9869
|
+
}
|
|
9707
9870
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
9708
9871
|
'codeExecution',
|
|
9709
9872
|
]);
|
|
9710
9873
|
if (fromCodeExecution != null) {
|
|
9711
9874
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
9712
9875
|
}
|
|
9713
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
9714
|
-
if (fromComputerUse != null) {
|
|
9715
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
9716
|
-
}
|
|
9717
9876
|
return toObject;
|
|
9718
9877
|
}
|
|
9719
9878
|
function functionCallingConfigToMldev(fromObject) {
|
|
@@ -10350,6 +10509,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
10350
10509
|
if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
|
|
10351
10510
|
throw new Error('lastFrame parameter is not supported in Gemini API.');
|
|
10352
10511
|
}
|
|
10512
|
+
if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
|
|
10513
|
+
throw new Error('referenceImages parameter is not supported in Gemini API.');
|
|
10514
|
+
}
|
|
10353
10515
|
if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
|
|
10354
10516
|
throw new Error('compressionQuality parameter is not supported in Gemini API.');
|
|
10355
10517
|
}
|
|
@@ -10677,6 +10839,12 @@ function googleSearchToVertex(fromObject) {
|
|
|
10677
10839
|
if (fromTimeRangeFilter != null) {
|
|
10678
10840
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex(fromTimeRangeFilter));
|
|
10679
10841
|
}
|
|
10842
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
10843
|
+
'excludeDomains',
|
|
10844
|
+
]);
|
|
10845
|
+
if (fromExcludeDomains != null) {
|
|
10846
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
10847
|
+
}
|
|
10680
10848
|
return toObject;
|
|
10681
10849
|
}
|
|
10682
10850
|
function dynamicRetrievalConfigToVertex(fromObject) {
|
|
@@ -10703,8 +10871,14 @@ function googleSearchRetrievalToVertex(fromObject) {
|
|
|
10703
10871
|
}
|
|
10704
10872
|
return toObject;
|
|
10705
10873
|
}
|
|
10706
|
-
function enterpriseWebSearchToVertex() {
|
|
10874
|
+
function enterpriseWebSearchToVertex(fromObject) {
|
|
10707
10875
|
const toObject = {};
|
|
10876
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
10877
|
+
'excludeDomains',
|
|
10878
|
+
]);
|
|
10879
|
+
if (fromExcludeDomains != null) {
|
|
10880
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
10881
|
+
}
|
|
10708
10882
|
return toObject;
|
|
10709
10883
|
}
|
|
10710
10884
|
function apiKeyConfigToVertex(fromObject) {
|
|
@@ -10759,6 +10933,14 @@ function urlContextToVertex() {
|
|
|
10759
10933
|
const toObject = {};
|
|
10760
10934
|
return toObject;
|
|
10761
10935
|
}
|
|
10936
|
+
function toolComputerUseToVertex(fromObject) {
|
|
10937
|
+
const toObject = {};
|
|
10938
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
10939
|
+
if (fromEnvironment != null) {
|
|
10940
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
10941
|
+
}
|
|
10942
|
+
return toObject;
|
|
10943
|
+
}
|
|
10762
10944
|
function toolToVertex(fromObject) {
|
|
10763
10945
|
const toObject = {};
|
|
10764
10946
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -10791,7 +10973,7 @@ function toolToVertex(fromObject) {
|
|
|
10791
10973
|
'enterpriseWebSearch',
|
|
10792
10974
|
]);
|
|
10793
10975
|
if (fromEnterpriseWebSearch != null) {
|
|
10794
|
-
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex());
|
|
10976
|
+
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex(fromEnterpriseWebSearch));
|
|
10795
10977
|
}
|
|
10796
10978
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
10797
10979
|
if (fromGoogleMaps != null) {
|
|
@@ -10801,16 +10983,16 @@ function toolToVertex(fromObject) {
|
|
|
10801
10983
|
if (fromUrlContext != null) {
|
|
10802
10984
|
setValueByPath(toObject, ['urlContext'], urlContextToVertex());
|
|
10803
10985
|
}
|
|
10986
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10987
|
+
if (fromComputerUse != null) {
|
|
10988
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex(fromComputerUse));
|
|
10989
|
+
}
|
|
10804
10990
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
10805
10991
|
'codeExecution',
|
|
10806
10992
|
]);
|
|
10807
10993
|
if (fromCodeExecution != null) {
|
|
10808
10994
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
10809
10995
|
}
|
|
10810
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10811
|
-
if (fromComputerUse != null) {
|
|
10812
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
10813
|
-
}
|
|
10814
10996
|
return toObject;
|
|
10815
10997
|
}
|
|
10816
10998
|
function functionCallingConfigToVertex(fromObject) {
|
|
@@ -11640,6 +11822,78 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
|
|
|
11640
11822
|
}
|
|
11641
11823
|
return toObject;
|
|
11642
11824
|
}
|
|
11825
|
+
function scribbleImageToVertex(fromObject) {
|
|
11826
|
+
const toObject = {};
|
|
11827
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
11828
|
+
if (fromImage != null) {
|
|
11829
|
+
setValueByPath(toObject, ['image'], imageToVertex(fromImage));
|
|
11830
|
+
}
|
|
11831
|
+
return toObject;
|
|
11832
|
+
}
|
|
11833
|
+
function segmentImageSourceToVertex(fromObject, parentObject) {
|
|
11834
|
+
const toObject = {};
|
|
11835
|
+
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
11836
|
+
if (parentObject !== undefined && fromPrompt != null) {
|
|
11837
|
+
setValueByPath(parentObject, ['instances[0]', 'prompt'], fromPrompt);
|
|
11838
|
+
}
|
|
11839
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
11840
|
+
if (parentObject !== undefined && fromImage != null) {
|
|
11841
|
+
setValueByPath(parentObject, ['instances[0]', 'image'], imageToVertex(fromImage));
|
|
11842
|
+
}
|
|
11843
|
+
const fromScribbleImage = getValueByPath(fromObject, [
|
|
11844
|
+
'scribbleImage',
|
|
11845
|
+
]);
|
|
11846
|
+
if (parentObject !== undefined && fromScribbleImage != null) {
|
|
11847
|
+
setValueByPath(parentObject, ['instances[0]', 'scribble'], scribbleImageToVertex(fromScribbleImage));
|
|
11848
|
+
}
|
|
11849
|
+
return toObject;
|
|
11850
|
+
}
|
|
11851
|
+
function segmentImageConfigToVertex(fromObject, parentObject) {
|
|
11852
|
+
const toObject = {};
|
|
11853
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
11854
|
+
if (parentObject !== undefined && fromMode != null) {
|
|
11855
|
+
setValueByPath(parentObject, ['parameters', 'mode'], fromMode);
|
|
11856
|
+
}
|
|
11857
|
+
const fromMaxPredictions = getValueByPath(fromObject, [
|
|
11858
|
+
'maxPredictions',
|
|
11859
|
+
]);
|
|
11860
|
+
if (parentObject !== undefined && fromMaxPredictions != null) {
|
|
11861
|
+
setValueByPath(parentObject, ['parameters', 'maxPredictions'], fromMaxPredictions);
|
|
11862
|
+
}
|
|
11863
|
+
const fromConfidenceThreshold = getValueByPath(fromObject, [
|
|
11864
|
+
'confidenceThreshold',
|
|
11865
|
+
]);
|
|
11866
|
+
if (parentObject !== undefined && fromConfidenceThreshold != null) {
|
|
11867
|
+
setValueByPath(parentObject, ['parameters', 'confidenceThreshold'], fromConfidenceThreshold);
|
|
11868
|
+
}
|
|
11869
|
+
const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
|
|
11870
|
+
if (parentObject !== undefined && fromMaskDilation != null) {
|
|
11871
|
+
setValueByPath(parentObject, ['parameters', 'maskDilation'], fromMaskDilation);
|
|
11872
|
+
}
|
|
11873
|
+
const fromBinaryColorThreshold = getValueByPath(fromObject, [
|
|
11874
|
+
'binaryColorThreshold',
|
|
11875
|
+
]);
|
|
11876
|
+
if (parentObject !== undefined && fromBinaryColorThreshold != null) {
|
|
11877
|
+
setValueByPath(parentObject, ['parameters', 'binaryColorThreshold'], fromBinaryColorThreshold);
|
|
11878
|
+
}
|
|
11879
|
+
return toObject;
|
|
11880
|
+
}
|
|
11881
|
+
function segmentImageParametersToVertex(apiClient, fromObject) {
|
|
11882
|
+
const toObject = {};
|
|
11883
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
11884
|
+
if (fromModel != null) {
|
|
11885
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
11886
|
+
}
|
|
11887
|
+
const fromSource = getValueByPath(fromObject, ['source']);
|
|
11888
|
+
if (fromSource != null) {
|
|
11889
|
+
setValueByPath(toObject, ['config'], segmentImageSourceToVertex(fromSource, toObject));
|
|
11890
|
+
}
|
|
11891
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
11892
|
+
if (fromConfig != null) {
|
|
11893
|
+
setValueByPath(toObject, ['config'], segmentImageConfigToVertex(fromConfig, toObject));
|
|
11894
|
+
}
|
|
11895
|
+
return toObject;
|
|
11896
|
+
}
|
|
11643
11897
|
function getModelParametersToVertex(apiClient, fromObject) {
|
|
11644
11898
|
const toObject = {};
|
|
11645
11899
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -11808,6 +12062,20 @@ function videoToVertex(fromObject) {
|
|
|
11808
12062
|
}
|
|
11809
12063
|
return toObject;
|
|
11810
12064
|
}
|
|
12065
|
+
function videoGenerationReferenceImageToVertex(fromObject) {
|
|
12066
|
+
const toObject = {};
|
|
12067
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
12068
|
+
if (fromImage != null) {
|
|
12069
|
+
setValueByPath(toObject, ['image'], imageToVertex(fromImage));
|
|
12070
|
+
}
|
|
12071
|
+
const fromReferenceType = getValueByPath(fromObject, [
|
|
12072
|
+
'referenceType',
|
|
12073
|
+
]);
|
|
12074
|
+
if (fromReferenceType != null) {
|
|
12075
|
+
setValueByPath(toObject, ['referenceType'], fromReferenceType);
|
|
12076
|
+
}
|
|
12077
|
+
return toObject;
|
|
12078
|
+
}
|
|
11811
12079
|
function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
11812
12080
|
const toObject = {};
|
|
11813
12081
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -11874,6 +12142,18 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
|
11874
12142
|
if (parentObject !== undefined && fromLastFrame != null) {
|
|
11875
12143
|
setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
|
|
11876
12144
|
}
|
|
12145
|
+
const fromReferenceImages = getValueByPath(fromObject, [
|
|
12146
|
+
'referenceImages',
|
|
12147
|
+
]);
|
|
12148
|
+
if (parentObject !== undefined && fromReferenceImages != null) {
|
|
12149
|
+
let transformedList = fromReferenceImages;
|
|
12150
|
+
if (Array.isArray(transformedList)) {
|
|
12151
|
+
transformedList = transformedList.map((item) => {
|
|
12152
|
+
return videoGenerationReferenceImageToVertex(item);
|
|
12153
|
+
});
|
|
12154
|
+
}
|
|
12155
|
+
setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
|
|
12156
|
+
}
|
|
11877
12157
|
const fromCompressionQuality = getValueByPath(fromObject, [
|
|
11878
12158
|
'compressionQuality',
|
|
11879
12159
|
]);
|
|
@@ -12923,6 +13203,50 @@ function recontextImageResponseFromVertex(fromObject) {
|
|
|
12923
13203
|
}
|
|
12924
13204
|
return toObject;
|
|
12925
13205
|
}
|
|
13206
|
+
function entityLabelFromVertex(fromObject) {
|
|
13207
|
+
const toObject = {};
|
|
13208
|
+
const fromLabel = getValueByPath(fromObject, ['label']);
|
|
13209
|
+
if (fromLabel != null) {
|
|
13210
|
+
setValueByPath(toObject, ['label'], fromLabel);
|
|
13211
|
+
}
|
|
13212
|
+
const fromScore = getValueByPath(fromObject, ['score']);
|
|
13213
|
+
if (fromScore != null) {
|
|
13214
|
+
setValueByPath(toObject, ['score'], fromScore);
|
|
13215
|
+
}
|
|
13216
|
+
return toObject;
|
|
13217
|
+
}
|
|
13218
|
+
function generatedImageMaskFromVertex(fromObject) {
|
|
13219
|
+
const toObject = {};
|
|
13220
|
+
const fromMask = getValueByPath(fromObject, ['_self']);
|
|
13221
|
+
if (fromMask != null) {
|
|
13222
|
+
setValueByPath(toObject, ['mask'], imageFromVertex(fromMask));
|
|
13223
|
+
}
|
|
13224
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
13225
|
+
if (fromLabels != null) {
|
|
13226
|
+
let transformedList = fromLabels;
|
|
13227
|
+
if (Array.isArray(transformedList)) {
|
|
13228
|
+
transformedList = transformedList.map((item) => {
|
|
13229
|
+
return entityLabelFromVertex(item);
|
|
13230
|
+
});
|
|
13231
|
+
}
|
|
13232
|
+
setValueByPath(toObject, ['labels'], transformedList);
|
|
13233
|
+
}
|
|
13234
|
+
return toObject;
|
|
13235
|
+
}
|
|
13236
|
+
function segmentImageResponseFromVertex(fromObject) {
|
|
13237
|
+
const toObject = {};
|
|
13238
|
+
const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
|
|
13239
|
+
if (fromGeneratedMasks != null) {
|
|
13240
|
+
let transformedList = fromGeneratedMasks;
|
|
13241
|
+
if (Array.isArray(transformedList)) {
|
|
13242
|
+
transformedList = transformedList.map((item) => {
|
|
13243
|
+
return generatedImageMaskFromVertex(item);
|
|
13244
|
+
});
|
|
13245
|
+
}
|
|
13246
|
+
setValueByPath(toObject, ['generatedMasks'], transformedList);
|
|
13247
|
+
}
|
|
13248
|
+
return toObject;
|
|
13249
|
+
}
|
|
12926
13250
|
function endpointFromVertex(fromObject) {
|
|
12927
13251
|
const toObject = {};
|
|
12928
13252
|
const fromName = getValueByPath(fromObject, ['endpoint']);
|
|
@@ -13170,7 +13494,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
13170
13494
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
13171
13495
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
13172
13496
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
13173
|
-
const SDK_VERSION = '1.
|
|
13497
|
+
const SDK_VERSION = '1.15.0'; // x-release-please-version
|
|
13174
13498
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
13175
13499
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
13176
13500
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -15613,6 +15937,61 @@ class Models extends BaseModule {
|
|
|
15613
15937
|
throw new Error('This method is only supported by the Vertex AI.');
|
|
15614
15938
|
}
|
|
15615
15939
|
}
|
|
15940
|
+
/**
|
|
15941
|
+
* Segments an image, creating a mask of a specified area.
|
|
15942
|
+
*
|
|
15943
|
+
* @param params - The parameters for segmenting an image.
|
|
15944
|
+
* @return The response from the API.
|
|
15945
|
+
*
|
|
15946
|
+
* @example
|
|
15947
|
+
* ```ts
|
|
15948
|
+
* const response = await ai.models.segmentImage({
|
|
15949
|
+
* model: 'image-segmentation-001',
|
|
15950
|
+
* source: {
|
|
15951
|
+
* image: image,
|
|
15952
|
+
* },
|
|
15953
|
+
* config: {
|
|
15954
|
+
* mode: 'foreground',
|
|
15955
|
+
* },
|
|
15956
|
+
* });
|
|
15957
|
+
* console.log(response?.generatedMasks?.[0]?.mask?.imageBytes);
|
|
15958
|
+
* ```
|
|
15959
|
+
*/
|
|
15960
|
+
async segmentImage(params) {
|
|
15961
|
+
var _a, _b;
|
|
15962
|
+
let response;
|
|
15963
|
+
let path = '';
|
|
15964
|
+
let queryParams = {};
|
|
15965
|
+
if (this.apiClient.isVertexAI()) {
|
|
15966
|
+
const body = segmentImageParametersToVertex(this.apiClient, params);
|
|
15967
|
+
path = formatMap('{model}:predict', body['_url']);
|
|
15968
|
+
queryParams = body['_query'];
|
|
15969
|
+
delete body['config'];
|
|
15970
|
+
delete body['_url'];
|
|
15971
|
+
delete body['_query'];
|
|
15972
|
+
response = this.apiClient
|
|
15973
|
+
.request({
|
|
15974
|
+
path: path,
|
|
15975
|
+
queryParams: queryParams,
|
|
15976
|
+
body: JSON.stringify(body),
|
|
15977
|
+
httpMethod: 'POST',
|
|
15978
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
15979
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
15980
|
+
})
|
|
15981
|
+
.then((httpResponse) => {
|
|
15982
|
+
return httpResponse.json();
|
|
15983
|
+
});
|
|
15984
|
+
return response.then((apiResponse) => {
|
|
15985
|
+
const resp = segmentImageResponseFromVertex(apiResponse);
|
|
15986
|
+
const typedResp = new SegmentImageResponse();
|
|
15987
|
+
Object.assign(typedResp, resp);
|
|
15988
|
+
return typedResp;
|
|
15989
|
+
});
|
|
15990
|
+
}
|
|
15991
|
+
else {
|
|
15992
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
15993
|
+
}
|
|
15994
|
+
}
|
|
15616
15995
|
/**
|
|
15617
15996
|
* Fetches information about a model by name.
|
|
15618
15997
|
*
|
|
@@ -16577,6 +16956,9 @@ function googleSearchToMldev(fromObject) {
|
|
|
16577
16956
|
if (fromTimeRangeFilter != null) {
|
|
16578
16957
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(fromTimeRangeFilter));
|
|
16579
16958
|
}
|
|
16959
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
16960
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
16961
|
+
}
|
|
16580
16962
|
return toObject;
|
|
16581
16963
|
}
|
|
16582
16964
|
function dynamicRetrievalConfigToMldev(fromObject) {
|
|
@@ -16607,6 +16989,14 @@ function urlContextToMldev() {
|
|
|
16607
16989
|
const toObject = {};
|
|
16608
16990
|
return toObject;
|
|
16609
16991
|
}
|
|
16992
|
+
function toolComputerUseToMldev(fromObject) {
|
|
16993
|
+
const toObject = {};
|
|
16994
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
16995
|
+
if (fromEnvironment != null) {
|
|
16996
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
16997
|
+
}
|
|
16998
|
+
return toObject;
|
|
16999
|
+
}
|
|
16610
17000
|
function toolToMldev(fromObject) {
|
|
16611
17001
|
const toObject = {};
|
|
16612
17002
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -16644,16 +17034,16 @@ function toolToMldev(fromObject) {
|
|
|
16644
17034
|
if (fromUrlContext != null) {
|
|
16645
17035
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
16646
17036
|
}
|
|
17037
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
17038
|
+
if (fromComputerUse != null) {
|
|
17039
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev(fromComputerUse));
|
|
17040
|
+
}
|
|
16647
17041
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
16648
17042
|
'codeExecution',
|
|
16649
17043
|
]);
|
|
16650
17044
|
if (fromCodeExecution != null) {
|
|
16651
17045
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
16652
17046
|
}
|
|
16653
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
16654
|
-
if (fromComputerUse != null) {
|
|
16655
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
16656
|
-
}
|
|
16657
17047
|
return toObject;
|
|
16658
17048
|
}
|
|
16659
17049
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
@@ -17467,6 +17857,10 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
17467
17857
|
undefined) {
|
|
17468
17858
|
throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
|
|
17469
17859
|
}
|
|
17860
|
+
if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
|
|
17861
|
+
undefined) {
|
|
17862
|
+
throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
|
|
17863
|
+
}
|
|
17470
17864
|
if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
|
|
17471
17865
|
throw new Error('adapterSize parameter is not supported in Gemini API.');
|
|
17472
17866
|
}
|
|
@@ -17480,12 +17874,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
17480
17874
|
}
|
|
17481
17875
|
return toObject;
|
|
17482
17876
|
}
|
|
17483
|
-
function
|
|
17877
|
+
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
17484
17878
|
const toObject = {};
|
|
17485
17879
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
17486
17880
|
if (fromBaseModel != null) {
|
|
17487
17881
|
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
17488
17882
|
}
|
|
17883
|
+
const fromPreTunedModel = getValueByPath(fromObject, [
|
|
17884
|
+
'preTunedModel',
|
|
17885
|
+
]);
|
|
17886
|
+
if (fromPreTunedModel != null) {
|
|
17887
|
+
setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
|
|
17888
|
+
}
|
|
17489
17889
|
const fromTrainingDataset = getValueByPath(fromObject, [
|
|
17490
17890
|
'trainingDataset',
|
|
17491
17891
|
]);
|
|
@@ -17599,6 +17999,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
17599
17999
|
if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
|
|
17600
18000
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
17601
18001
|
}
|
|
18002
|
+
const fromPreTunedModelCheckpointId = getValueByPath(fromObject, [
|
|
18003
|
+
'preTunedModelCheckpointId',
|
|
18004
|
+
]);
|
|
18005
|
+
if (fromPreTunedModelCheckpointId != null) {
|
|
18006
|
+
setValueByPath(toObject, ['preTunedModel', 'checkpointId'], fromPreTunedModelCheckpointId);
|
|
18007
|
+
}
|
|
17602
18008
|
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
17603
18009
|
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
17604
18010
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
@@ -17611,12 +18017,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
17611
18017
|
}
|
|
17612
18018
|
return toObject;
|
|
17613
18019
|
}
|
|
17614
|
-
function
|
|
18020
|
+
function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
17615
18021
|
const toObject = {};
|
|
17616
18022
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
17617
18023
|
if (fromBaseModel != null) {
|
|
17618
18024
|
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
17619
18025
|
}
|
|
18026
|
+
const fromPreTunedModel = getValueByPath(fromObject, [
|
|
18027
|
+
'preTunedModel',
|
|
18028
|
+
]);
|
|
18029
|
+
if (fromPreTunedModel != null) {
|
|
18030
|
+
setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
|
|
18031
|
+
}
|
|
17620
18032
|
const fromTrainingDataset = getValueByPath(fromObject, [
|
|
17621
18033
|
'trainingDataset',
|
|
17622
18034
|
]);
|
|
@@ -17691,11 +18103,11 @@ function tuningJobFromMldev(fromObject) {
|
|
|
17691
18103
|
if (fromTunedModel != null) {
|
|
17692
18104
|
setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
|
|
17693
18105
|
}
|
|
17694
|
-
const
|
|
17695
|
-
'
|
|
18106
|
+
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
18107
|
+
'customBaseModel',
|
|
17696
18108
|
]);
|
|
17697
|
-
if (
|
|
17698
|
-
setValueByPath(toObject, ['
|
|
18109
|
+
if (fromCustomBaseModel != null) {
|
|
18110
|
+
setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
|
|
17699
18111
|
}
|
|
17700
18112
|
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
17701
18113
|
if (fromExperiment != null) {
|
|
@@ -17705,18 +18117,14 @@ function tuningJobFromMldev(fromObject) {
|
|
|
17705
18117
|
if (fromLabels != null) {
|
|
17706
18118
|
setValueByPath(toObject, ['labels'], fromLabels);
|
|
17707
18119
|
}
|
|
18120
|
+
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
18121
|
+
if (fromOutputUri != null) {
|
|
18122
|
+
setValueByPath(toObject, ['outputUri'], fromOutputUri);
|
|
18123
|
+
}
|
|
17708
18124
|
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
17709
18125
|
if (fromPipelineJob != null) {
|
|
17710
18126
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
17711
18127
|
}
|
|
17712
|
-
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17713
|
-
if (fromSatisfiesPzi != null) {
|
|
17714
|
-
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17715
|
-
}
|
|
17716
|
-
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17717
|
-
if (fromSatisfiesPzs != null) {
|
|
17718
|
-
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17719
|
-
}
|
|
17720
18128
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
17721
18129
|
'serviceAccount',
|
|
17722
18130
|
]);
|
|
@@ -17873,6 +18281,12 @@ function tuningJobFromVertex(fromObject) {
|
|
|
17873
18281
|
if (fromTunedModel != null) {
|
|
17874
18282
|
setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(fromTunedModel));
|
|
17875
18283
|
}
|
|
18284
|
+
const fromPreTunedModel = getValueByPath(fromObject, [
|
|
18285
|
+
'preTunedModel',
|
|
18286
|
+
]);
|
|
18287
|
+
if (fromPreTunedModel != null) {
|
|
18288
|
+
setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
|
|
18289
|
+
}
|
|
17876
18290
|
const fromSupervisedTuningSpec = getValueByPath(fromObject, [
|
|
17877
18291
|
'supervisedTuningSpec',
|
|
17878
18292
|
]);
|
|
@@ -17897,11 +18311,11 @@ function tuningJobFromVertex(fromObject) {
|
|
|
17897
18311
|
if (fromPartnerModelTuningSpec != null) {
|
|
17898
18312
|
setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
|
|
17899
18313
|
}
|
|
17900
|
-
const
|
|
17901
|
-
'
|
|
18314
|
+
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
18315
|
+
'customBaseModel',
|
|
17902
18316
|
]);
|
|
17903
|
-
if (
|
|
17904
|
-
setValueByPath(toObject, ['
|
|
18317
|
+
if (fromCustomBaseModel != null) {
|
|
18318
|
+
setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
|
|
17905
18319
|
}
|
|
17906
18320
|
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
17907
18321
|
if (fromExperiment != null) {
|
|
@@ -17911,18 +18325,14 @@ function tuningJobFromVertex(fromObject) {
|
|
|
17911
18325
|
if (fromLabels != null) {
|
|
17912
18326
|
setValueByPath(toObject, ['labels'], fromLabels);
|
|
17913
18327
|
}
|
|
18328
|
+
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
18329
|
+
if (fromOutputUri != null) {
|
|
18330
|
+
setValueByPath(toObject, ['outputUri'], fromOutputUri);
|
|
18331
|
+
}
|
|
17914
18332
|
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
17915
18333
|
if (fromPipelineJob != null) {
|
|
17916
18334
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
17917
18335
|
}
|
|
17918
|
-
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17919
|
-
if (fromSatisfiesPzi != null) {
|
|
17920
|
-
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17921
|
-
}
|
|
17922
|
-
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17923
|
-
if (fromSatisfiesPzs != null) {
|
|
17924
|
-
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17925
|
-
}
|
|
17926
18336
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
17927
18337
|
'serviceAccount',
|
|
17928
18338
|
]);
|
|
@@ -18008,10 +18418,22 @@ class Tunings extends BaseModule {
|
|
|
18008
18418
|
*/
|
|
18009
18419
|
this.tune = async (params) => {
|
|
18010
18420
|
if (this.apiClient.isVertexAI()) {
|
|
18011
|
-
|
|
18421
|
+
if (params.baseModel.startsWith('projects/')) {
|
|
18422
|
+
const preTunedModel = {
|
|
18423
|
+
tunedModelName: params.baseModel,
|
|
18424
|
+
};
|
|
18425
|
+
const paramsPrivate = Object.assign(Object.assign({}, params), { preTunedModel: preTunedModel });
|
|
18426
|
+
paramsPrivate.baseModel = undefined;
|
|
18427
|
+
return await this.tuneInternal(paramsPrivate);
|
|
18428
|
+
}
|
|
18429
|
+
else {
|
|
18430
|
+
const paramsPrivate = Object.assign({}, params);
|
|
18431
|
+
return await this.tuneInternal(paramsPrivate);
|
|
18432
|
+
}
|
|
18012
18433
|
}
|
|
18013
18434
|
else {
|
|
18014
|
-
const
|
|
18435
|
+
const paramsPrivate = Object.assign({}, params);
|
|
18436
|
+
const operation = await this.tuneMldevInternal(paramsPrivate);
|
|
18015
18437
|
let tunedModelName = '';
|
|
18016
18438
|
if (operation['metadata'] !== undefined &&
|
|
18017
18439
|
operation['metadata']['tunedModel'] !== undefined) {
|
|
@@ -18171,7 +18593,7 @@ class Tunings extends BaseModule {
|
|
|
18171
18593
|
let path = '';
|
|
18172
18594
|
let queryParams = {};
|
|
18173
18595
|
if (this.apiClient.isVertexAI()) {
|
|
18174
|
-
const body =
|
|
18596
|
+
const body = createTuningJobParametersPrivateToVertex(params);
|
|
18175
18597
|
path = formatMap('tuningJobs', body['_url']);
|
|
18176
18598
|
queryParams = body['_query'];
|
|
18177
18599
|
delete body['config'];
|
|
@@ -18213,7 +18635,7 @@ class Tunings extends BaseModule {
|
|
|
18213
18635
|
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
18214
18636
|
}
|
|
18215
18637
|
else {
|
|
18216
|
-
const body =
|
|
18638
|
+
const body = createTuningJobParametersPrivateToMldev(params);
|
|
18217
18639
|
path = formatMap('tunedModels', body['_url']);
|
|
18218
18640
|
queryParams = body['_query'];
|
|
18219
18641
|
delete body['config'];
|
|
@@ -18693,6 +19115,7 @@ exports.Pager = Pager;
|
|
|
18693
19115
|
exports.RawReferenceImage = RawReferenceImage;
|
|
18694
19116
|
exports.RecontextImageResponse = RecontextImageResponse;
|
|
18695
19117
|
exports.ReplayResponse = ReplayResponse;
|
|
19118
|
+
exports.SegmentImageResponse = SegmentImageResponse;
|
|
18696
19119
|
exports.Session = Session;
|
|
18697
19120
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
18698
19121
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|