@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/index.cjs
CHANGED
|
@@ -389,18 +389,6 @@ exports.ApiSpec = void 0;
|
|
|
389
389
|
*/
|
|
390
390
|
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
391
391
|
})(exports.ApiSpec || (exports.ApiSpec = {}));
|
|
392
|
-
/** Required. The environment being operated. */
|
|
393
|
-
exports.Environment = void 0;
|
|
394
|
-
(function (Environment) {
|
|
395
|
-
/**
|
|
396
|
-
* Defaults to browser.
|
|
397
|
-
*/
|
|
398
|
-
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
399
|
-
/**
|
|
400
|
-
* Operates in a web browser.
|
|
401
|
-
*/
|
|
402
|
-
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
403
|
-
})(exports.Environment || (exports.Environment = {}));
|
|
404
392
|
/** Status of the url retrieval. */
|
|
405
393
|
exports.UrlRetrievalStatus = void 0;
|
|
406
394
|
(function (UrlRetrievalStatus) {
|
|
@@ -668,6 +656,22 @@ exports.JobState = void 0;
|
|
|
668
656
|
*/
|
|
669
657
|
JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
|
|
670
658
|
})(exports.JobState || (exports.JobState = {}));
|
|
659
|
+
/** Tuning mode. */
|
|
660
|
+
exports.TuningMode = void 0;
|
|
661
|
+
(function (TuningMode) {
|
|
662
|
+
/**
|
|
663
|
+
* Tuning mode is unspecified.
|
|
664
|
+
*/
|
|
665
|
+
TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
|
|
666
|
+
/**
|
|
667
|
+
* Full fine-tuning mode.
|
|
668
|
+
*/
|
|
669
|
+
TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
|
|
670
|
+
/**
|
|
671
|
+
* PEFT adapter tuning mode.
|
|
672
|
+
*/
|
|
673
|
+
TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
|
|
674
|
+
})(exports.TuningMode || (exports.TuningMode = {}));
|
|
671
675
|
/** Optional. Adapter size for tuning. */
|
|
672
676
|
exports.AdapterSize = void 0;
|
|
673
677
|
(function (AdapterSize) {
|
|
@@ -736,6 +740,18 @@ exports.DynamicRetrievalConfigMode = void 0;
|
|
|
736
740
|
*/
|
|
737
741
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
738
742
|
})(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
|
|
743
|
+
/** The environment being operated. */
|
|
744
|
+
exports.Environment = void 0;
|
|
745
|
+
(function (Environment) {
|
|
746
|
+
/**
|
|
747
|
+
* Defaults to browser.
|
|
748
|
+
*/
|
|
749
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
750
|
+
/**
|
|
751
|
+
* Operates in a web browser.
|
|
752
|
+
*/
|
|
753
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
754
|
+
})(exports.Environment || (exports.Environment = {}));
|
|
739
755
|
/** Config for the function calling config mode. */
|
|
740
756
|
exports.FunctionCallingConfigMode = void 0;
|
|
741
757
|
(function (FunctionCallingConfigMode) {
|
|
@@ -853,6 +869,15 @@ exports.EditMode = void 0;
|
|
|
853
869
|
EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
|
|
854
870
|
EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
|
|
855
871
|
})(exports.EditMode || (exports.EditMode = {}));
|
|
872
|
+
/** Enum that represents the segmentation mode. */
|
|
873
|
+
exports.SegmentMode = void 0;
|
|
874
|
+
(function (SegmentMode) {
|
|
875
|
+
SegmentMode["FOREGROUND"] = "FOREGROUND";
|
|
876
|
+
SegmentMode["BACKGROUND"] = "BACKGROUND";
|
|
877
|
+
SegmentMode["PROMPT"] = "PROMPT";
|
|
878
|
+
SegmentMode["SEMANTIC"] = "SEMANTIC";
|
|
879
|
+
SegmentMode["INTERACTIVE"] = "INTERACTIVE";
|
|
880
|
+
})(exports.SegmentMode || (exports.SegmentMode = {}));
|
|
856
881
|
/** Enum that controls the compression quality of the generated videos. */
|
|
857
882
|
exports.VideoCompressionQuality = void 0;
|
|
858
883
|
(function (VideoCompressionQuality) {
|
|
@@ -1499,6 +1524,9 @@ class UpscaleImageResponse {
|
|
|
1499
1524
|
/** The output images response. */
|
|
1500
1525
|
class RecontextImageResponse {
|
|
1501
1526
|
}
|
|
1527
|
+
/** The output images response. */
|
|
1528
|
+
class SegmentImageResponse {
|
|
1529
|
+
}
|
|
1502
1530
|
class ListModelsResponse {
|
|
1503
1531
|
}
|
|
1504
1532
|
class DeleteModelResponse {
|
|
@@ -2842,6 +2870,9 @@ function googleSearchToMldev$4(fromObject) {
|
|
|
2842
2870
|
if (fromTimeRangeFilter != null) {
|
|
2843
2871
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
|
|
2844
2872
|
}
|
|
2873
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
2874
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
2875
|
+
}
|
|
2845
2876
|
return toObject;
|
|
2846
2877
|
}
|
|
2847
2878
|
function dynamicRetrievalConfigToMldev$4(fromObject) {
|
|
@@ -2872,6 +2903,14 @@ function urlContextToMldev$4() {
|
|
|
2872
2903
|
const toObject = {};
|
|
2873
2904
|
return toObject;
|
|
2874
2905
|
}
|
|
2906
|
+
function toolComputerUseToMldev$4(fromObject) {
|
|
2907
|
+
const toObject = {};
|
|
2908
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
2909
|
+
if (fromEnvironment != null) {
|
|
2910
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
2911
|
+
}
|
|
2912
|
+
return toObject;
|
|
2913
|
+
}
|
|
2875
2914
|
function toolToMldev$4(fromObject) {
|
|
2876
2915
|
const toObject = {};
|
|
2877
2916
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -2909,16 +2948,16 @@ function toolToMldev$4(fromObject) {
|
|
|
2909
2948
|
if (fromUrlContext != null) {
|
|
2910
2949
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
|
|
2911
2950
|
}
|
|
2951
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
2952
|
+
if (fromComputerUse != null) {
|
|
2953
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$4(fromComputerUse));
|
|
2954
|
+
}
|
|
2912
2955
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
2913
2956
|
'codeExecution',
|
|
2914
2957
|
]);
|
|
2915
2958
|
if (fromCodeExecution != null) {
|
|
2916
2959
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
2917
2960
|
}
|
|
2918
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
2919
|
-
if (fromComputerUse != null) {
|
|
2920
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
2921
|
-
}
|
|
2922
2961
|
return toObject;
|
|
2923
2962
|
}
|
|
2924
2963
|
function functionCallingConfigToMldev$2(fromObject) {
|
|
@@ -4226,6 +4265,7 @@ class Batches extends BaseModule {
|
|
|
4226
4265
|
* ```
|
|
4227
4266
|
*/
|
|
4228
4267
|
this.create = async (params) => {
|
|
4268
|
+
var _a, _b;
|
|
4229
4269
|
if (this.apiClient.isVertexAI()) {
|
|
4230
4270
|
const timestamp = Date.now();
|
|
4231
4271
|
const timestampStr = timestamp.toString();
|
|
@@ -4250,6 +4290,55 @@ class Batches extends BaseModule {
|
|
|
4250
4290
|
}
|
|
4251
4291
|
}
|
|
4252
4292
|
}
|
|
4293
|
+
else {
|
|
4294
|
+
if (Array.isArray(params.src) ||
|
|
4295
|
+
(typeof params.src !== 'string' && params.src.inlinedRequests)) {
|
|
4296
|
+
// Move system instruction to httpOptions extraBody.
|
|
4297
|
+
let path = '';
|
|
4298
|
+
let queryParams = {};
|
|
4299
|
+
const body = createBatchJobParametersToMldev(this.apiClient, params);
|
|
4300
|
+
path = formatMap('{model}:batchGenerateContent', body['_url']);
|
|
4301
|
+
queryParams = body['_query'];
|
|
4302
|
+
// Move system instruction to 'request':
|
|
4303
|
+
// {'systemInstruction': system_instruction}
|
|
4304
|
+
const batch = body['batch'];
|
|
4305
|
+
const inputConfig = batch['inputConfig'];
|
|
4306
|
+
const requestsWrapper = inputConfig['requests'];
|
|
4307
|
+
const requests = requestsWrapper['requests'];
|
|
4308
|
+
const newRequests = [];
|
|
4309
|
+
for (const request of requests) {
|
|
4310
|
+
const requestDict = request;
|
|
4311
|
+
if (requestDict['systemInstruction']) {
|
|
4312
|
+
const systemInstructionValue = requestDict['systemInstruction'];
|
|
4313
|
+
delete requestDict['systemInstruction'];
|
|
4314
|
+
const requestContent = requestDict['request'];
|
|
4315
|
+
requestContent['systemInstruction'] = systemInstructionValue;
|
|
4316
|
+
requestDict['request'] = requestContent;
|
|
4317
|
+
}
|
|
4318
|
+
newRequests.push(requestDict);
|
|
4319
|
+
}
|
|
4320
|
+
requestsWrapper['requests'] = newRequests;
|
|
4321
|
+
delete body['config'];
|
|
4322
|
+
delete body['_url'];
|
|
4323
|
+
delete body['_query'];
|
|
4324
|
+
const response = this.apiClient
|
|
4325
|
+
.request({
|
|
4326
|
+
path: path,
|
|
4327
|
+
queryParams: queryParams,
|
|
4328
|
+
body: JSON.stringify(body),
|
|
4329
|
+
httpMethod: 'POST',
|
|
4330
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4331
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4332
|
+
})
|
|
4333
|
+
.then((httpResponse) => {
|
|
4334
|
+
return httpResponse.json();
|
|
4335
|
+
});
|
|
4336
|
+
return response.then((apiResponse) => {
|
|
4337
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4338
|
+
return resp;
|
|
4339
|
+
});
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4253
4342
|
return await this.createInternal(params);
|
|
4254
4343
|
};
|
|
4255
4344
|
/**
|
|
@@ -4772,6 +4861,9 @@ function googleSearchToMldev$3(fromObject) {
|
|
|
4772
4861
|
if (fromTimeRangeFilter != null) {
|
|
4773
4862
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$3(fromTimeRangeFilter));
|
|
4774
4863
|
}
|
|
4864
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
4865
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
4866
|
+
}
|
|
4775
4867
|
return toObject;
|
|
4776
4868
|
}
|
|
4777
4869
|
function dynamicRetrievalConfigToMldev$3(fromObject) {
|
|
@@ -4802,6 +4894,14 @@ function urlContextToMldev$3() {
|
|
|
4802
4894
|
const toObject = {};
|
|
4803
4895
|
return toObject;
|
|
4804
4896
|
}
|
|
4897
|
+
function toolComputerUseToMldev$3(fromObject) {
|
|
4898
|
+
const toObject = {};
|
|
4899
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
4900
|
+
if (fromEnvironment != null) {
|
|
4901
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
4902
|
+
}
|
|
4903
|
+
return toObject;
|
|
4904
|
+
}
|
|
4805
4905
|
function toolToMldev$3(fromObject) {
|
|
4806
4906
|
const toObject = {};
|
|
4807
4907
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -4839,16 +4939,16 @@ function toolToMldev$3(fromObject) {
|
|
|
4839
4939
|
if (fromUrlContext != null) {
|
|
4840
4940
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev$3());
|
|
4841
4941
|
}
|
|
4942
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4943
|
+
if (fromComputerUse != null) {
|
|
4944
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$3(fromComputerUse));
|
|
4945
|
+
}
|
|
4842
4946
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
4843
4947
|
'codeExecution',
|
|
4844
4948
|
]);
|
|
4845
4949
|
if (fromCodeExecution != null) {
|
|
4846
4950
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
4847
4951
|
}
|
|
4848
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4849
|
-
if (fromComputerUse != null) {
|
|
4850
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
4851
|
-
}
|
|
4852
4952
|
return toObject;
|
|
4853
4953
|
}
|
|
4854
4954
|
function functionCallingConfigToMldev$1(fromObject) {
|
|
@@ -5209,6 +5309,12 @@ function googleSearchToVertex$2(fromObject) {
|
|
|
5209
5309
|
if (fromTimeRangeFilter != null) {
|
|
5210
5310
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$2(fromTimeRangeFilter));
|
|
5211
5311
|
}
|
|
5312
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
5313
|
+
'excludeDomains',
|
|
5314
|
+
]);
|
|
5315
|
+
if (fromExcludeDomains != null) {
|
|
5316
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
5317
|
+
}
|
|
5212
5318
|
return toObject;
|
|
5213
5319
|
}
|
|
5214
5320
|
function dynamicRetrievalConfigToVertex$2(fromObject) {
|
|
@@ -5235,8 +5341,14 @@ function googleSearchRetrievalToVertex$2(fromObject) {
|
|
|
5235
5341
|
}
|
|
5236
5342
|
return toObject;
|
|
5237
5343
|
}
|
|
5238
|
-
function enterpriseWebSearchToVertex$2() {
|
|
5344
|
+
function enterpriseWebSearchToVertex$2(fromObject) {
|
|
5239
5345
|
const toObject = {};
|
|
5346
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
5347
|
+
'excludeDomains',
|
|
5348
|
+
]);
|
|
5349
|
+
if (fromExcludeDomains != null) {
|
|
5350
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
5351
|
+
}
|
|
5240
5352
|
return toObject;
|
|
5241
5353
|
}
|
|
5242
5354
|
function apiKeyConfigToVertex$2(fromObject) {
|
|
@@ -5291,6 +5403,14 @@ function urlContextToVertex$2() {
|
|
|
5291
5403
|
const toObject = {};
|
|
5292
5404
|
return toObject;
|
|
5293
5405
|
}
|
|
5406
|
+
function toolComputerUseToVertex$2(fromObject) {
|
|
5407
|
+
const toObject = {};
|
|
5408
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5409
|
+
if (fromEnvironment != null) {
|
|
5410
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5411
|
+
}
|
|
5412
|
+
return toObject;
|
|
5413
|
+
}
|
|
5294
5414
|
function toolToVertex$2(fromObject) {
|
|
5295
5415
|
const toObject = {};
|
|
5296
5416
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -5323,7 +5443,7 @@ function toolToVertex$2(fromObject) {
|
|
|
5323
5443
|
'enterpriseWebSearch',
|
|
5324
5444
|
]);
|
|
5325
5445
|
if (fromEnterpriseWebSearch != null) {
|
|
5326
|
-
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2());
|
|
5446
|
+
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$2(fromEnterpriseWebSearch));
|
|
5327
5447
|
}
|
|
5328
5448
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5329
5449
|
if (fromGoogleMaps != null) {
|
|
@@ -5333,16 +5453,16 @@ function toolToVertex$2(fromObject) {
|
|
|
5333
5453
|
if (fromUrlContext != null) {
|
|
5334
5454
|
setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
|
|
5335
5455
|
}
|
|
5456
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5457
|
+
if (fromComputerUse != null) {
|
|
5458
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$2(fromComputerUse));
|
|
5459
|
+
}
|
|
5336
5460
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5337
5461
|
'codeExecution',
|
|
5338
5462
|
]);
|
|
5339
5463
|
if (fromCodeExecution != null) {
|
|
5340
5464
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5341
5465
|
}
|
|
5342
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5343
|
-
if (fromComputerUse != null) {
|
|
5344
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5345
|
-
}
|
|
5346
5466
|
return toObject;
|
|
5347
5467
|
}
|
|
5348
5468
|
function functionCallingConfigToVertex$1(fromObject) {
|
|
@@ -6129,9 +6249,6 @@ function isValidContent(content) {
|
|
|
6129
6249
|
if (part === undefined || Object.keys(part).length === 0) {
|
|
6130
6250
|
return false;
|
|
6131
6251
|
}
|
|
6132
|
-
if (!part.thought && part.text !== undefined && part.text === '') {
|
|
6133
|
-
return false;
|
|
6134
|
-
}
|
|
6135
6252
|
}
|
|
6136
6253
|
return true;
|
|
6137
6254
|
}
|
|
@@ -6454,7 +6571,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6454
6571
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6455
6572
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6456
6573
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6457
|
-
const SDK_VERSION = '1.
|
|
6574
|
+
const SDK_VERSION = '1.15.0'; // x-release-please-version
|
|
6458
6575
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6459
6576
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6460
6577
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -7925,6 +8042,9 @@ function googleSearchToMldev$2(fromObject) {
|
|
|
7925
8042
|
if (fromTimeRangeFilter != null) {
|
|
7926
8043
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$2(fromTimeRangeFilter));
|
|
7927
8044
|
}
|
|
8045
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
8046
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
8047
|
+
}
|
|
7928
8048
|
return toObject;
|
|
7929
8049
|
}
|
|
7930
8050
|
function dynamicRetrievalConfigToMldev$2(fromObject) {
|
|
@@ -7955,6 +8075,14 @@ function urlContextToMldev$2() {
|
|
|
7955
8075
|
const toObject = {};
|
|
7956
8076
|
return toObject;
|
|
7957
8077
|
}
|
|
8078
|
+
function toolComputerUseToMldev$2(fromObject) {
|
|
8079
|
+
const toObject = {};
|
|
8080
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
8081
|
+
if (fromEnvironment != null) {
|
|
8082
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
8083
|
+
}
|
|
8084
|
+
return toObject;
|
|
8085
|
+
}
|
|
7958
8086
|
function toolToMldev$2(fromObject) {
|
|
7959
8087
|
const toObject = {};
|
|
7960
8088
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -7992,16 +8120,16 @@ function toolToMldev$2(fromObject) {
|
|
|
7992
8120
|
if (fromUrlContext != null) {
|
|
7993
8121
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev$2());
|
|
7994
8122
|
}
|
|
8123
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8124
|
+
if (fromComputerUse != null) {
|
|
8125
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$2(fromComputerUse));
|
|
8126
|
+
}
|
|
7995
8127
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
7996
8128
|
'codeExecution',
|
|
7997
8129
|
]);
|
|
7998
8130
|
if (fromCodeExecution != null) {
|
|
7999
8131
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
8000
8132
|
}
|
|
8001
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8002
|
-
if (fromComputerUse != null) {
|
|
8003
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8004
|
-
}
|
|
8005
8133
|
return toObject;
|
|
8006
8134
|
}
|
|
8007
8135
|
function sessionResumptionConfigToMldev$1(fromObject) {
|
|
@@ -8617,6 +8745,12 @@ function googleSearchToVertex$1(fromObject) {
|
|
|
8617
8745
|
if (fromTimeRangeFilter != null) {
|
|
8618
8746
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex$1(fromTimeRangeFilter));
|
|
8619
8747
|
}
|
|
8748
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
8749
|
+
'excludeDomains',
|
|
8750
|
+
]);
|
|
8751
|
+
if (fromExcludeDomains != null) {
|
|
8752
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
8753
|
+
}
|
|
8620
8754
|
return toObject;
|
|
8621
8755
|
}
|
|
8622
8756
|
function dynamicRetrievalConfigToVertex$1(fromObject) {
|
|
@@ -8643,8 +8777,14 @@ function googleSearchRetrievalToVertex$1(fromObject) {
|
|
|
8643
8777
|
}
|
|
8644
8778
|
return toObject;
|
|
8645
8779
|
}
|
|
8646
|
-
function enterpriseWebSearchToVertex$1() {
|
|
8780
|
+
function enterpriseWebSearchToVertex$1(fromObject) {
|
|
8647
8781
|
const toObject = {};
|
|
8782
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
8783
|
+
'excludeDomains',
|
|
8784
|
+
]);
|
|
8785
|
+
if (fromExcludeDomains != null) {
|
|
8786
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
8787
|
+
}
|
|
8648
8788
|
return toObject;
|
|
8649
8789
|
}
|
|
8650
8790
|
function apiKeyConfigToVertex$1(fromObject) {
|
|
@@ -8699,6 +8839,14 @@ function urlContextToVertex$1() {
|
|
|
8699
8839
|
const toObject = {};
|
|
8700
8840
|
return toObject;
|
|
8701
8841
|
}
|
|
8842
|
+
function toolComputerUseToVertex$1(fromObject) {
|
|
8843
|
+
const toObject = {};
|
|
8844
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
8845
|
+
if (fromEnvironment != null) {
|
|
8846
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
8847
|
+
}
|
|
8848
|
+
return toObject;
|
|
8849
|
+
}
|
|
8702
8850
|
function toolToVertex$1(fromObject) {
|
|
8703
8851
|
const toObject = {};
|
|
8704
8852
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -8731,7 +8879,7 @@ function toolToVertex$1(fromObject) {
|
|
|
8731
8879
|
'enterpriseWebSearch',
|
|
8732
8880
|
]);
|
|
8733
8881
|
if (fromEnterpriseWebSearch != null) {
|
|
8734
|
-
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1());
|
|
8882
|
+
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex$1(fromEnterpriseWebSearch));
|
|
8735
8883
|
}
|
|
8736
8884
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
8737
8885
|
if (fromGoogleMaps != null) {
|
|
@@ -8741,16 +8889,16 @@ function toolToVertex$1(fromObject) {
|
|
|
8741
8889
|
if (fromUrlContext != null) {
|
|
8742
8890
|
setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
|
|
8743
8891
|
}
|
|
8892
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8893
|
+
if (fromComputerUse != null) {
|
|
8894
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex$1(fromComputerUse));
|
|
8895
|
+
}
|
|
8744
8896
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8745
8897
|
'codeExecution',
|
|
8746
8898
|
]);
|
|
8747
8899
|
if (fromCodeExecution != null) {
|
|
8748
8900
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
8749
8901
|
}
|
|
8750
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8751
|
-
if (fromComputerUse != null) {
|
|
8752
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8753
|
-
}
|
|
8754
8902
|
return toObject;
|
|
8755
8903
|
}
|
|
8756
8904
|
function sessionResumptionConfigToVertex(fromObject) {
|
|
@@ -10278,6 +10426,9 @@ function googleSearchToMldev$1(fromObject) {
|
|
|
10278
10426
|
if (fromTimeRangeFilter != null) {
|
|
10279
10427
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$1(fromTimeRangeFilter));
|
|
10280
10428
|
}
|
|
10429
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
10430
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
10431
|
+
}
|
|
10281
10432
|
return toObject;
|
|
10282
10433
|
}
|
|
10283
10434
|
function dynamicRetrievalConfigToMldev$1(fromObject) {
|
|
@@ -10308,6 +10459,14 @@ function urlContextToMldev$1() {
|
|
|
10308
10459
|
const toObject = {};
|
|
10309
10460
|
return toObject;
|
|
10310
10461
|
}
|
|
10462
|
+
function toolComputerUseToMldev$1(fromObject) {
|
|
10463
|
+
const toObject = {};
|
|
10464
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
10465
|
+
if (fromEnvironment != null) {
|
|
10466
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
10467
|
+
}
|
|
10468
|
+
return toObject;
|
|
10469
|
+
}
|
|
10311
10470
|
function toolToMldev$1(fromObject) {
|
|
10312
10471
|
const toObject = {};
|
|
10313
10472
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -10345,16 +10504,16 @@ function toolToMldev$1(fromObject) {
|
|
|
10345
10504
|
if (fromUrlContext != null) {
|
|
10346
10505
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev$1());
|
|
10347
10506
|
}
|
|
10507
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10508
|
+
if (fromComputerUse != null) {
|
|
10509
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev$1(fromComputerUse));
|
|
10510
|
+
}
|
|
10348
10511
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
10349
10512
|
'codeExecution',
|
|
10350
10513
|
]);
|
|
10351
10514
|
if (fromCodeExecution != null) {
|
|
10352
10515
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
10353
10516
|
}
|
|
10354
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10355
|
-
if (fromComputerUse != null) {
|
|
10356
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
10357
|
-
}
|
|
10358
10517
|
return toObject;
|
|
10359
10518
|
}
|
|
10360
10519
|
function functionCallingConfigToMldev(fromObject) {
|
|
@@ -10991,6 +11150,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
10991
11150
|
if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
|
|
10992
11151
|
throw new Error('lastFrame parameter is not supported in Gemini API.');
|
|
10993
11152
|
}
|
|
11153
|
+
if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
|
|
11154
|
+
throw new Error('referenceImages parameter is not supported in Gemini API.');
|
|
11155
|
+
}
|
|
10994
11156
|
if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
|
|
10995
11157
|
throw new Error('compressionQuality parameter is not supported in Gemini API.');
|
|
10996
11158
|
}
|
|
@@ -11318,6 +11480,12 @@ function googleSearchToVertex(fromObject) {
|
|
|
11318
11480
|
if (fromTimeRangeFilter != null) {
|
|
11319
11481
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToVertex(fromTimeRangeFilter));
|
|
11320
11482
|
}
|
|
11483
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
11484
|
+
'excludeDomains',
|
|
11485
|
+
]);
|
|
11486
|
+
if (fromExcludeDomains != null) {
|
|
11487
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
11488
|
+
}
|
|
11321
11489
|
return toObject;
|
|
11322
11490
|
}
|
|
11323
11491
|
function dynamicRetrievalConfigToVertex(fromObject) {
|
|
@@ -11344,8 +11512,14 @@ function googleSearchRetrievalToVertex(fromObject) {
|
|
|
11344
11512
|
}
|
|
11345
11513
|
return toObject;
|
|
11346
11514
|
}
|
|
11347
|
-
function enterpriseWebSearchToVertex() {
|
|
11515
|
+
function enterpriseWebSearchToVertex(fromObject) {
|
|
11348
11516
|
const toObject = {};
|
|
11517
|
+
const fromExcludeDomains = getValueByPath(fromObject, [
|
|
11518
|
+
'excludeDomains',
|
|
11519
|
+
]);
|
|
11520
|
+
if (fromExcludeDomains != null) {
|
|
11521
|
+
setValueByPath(toObject, ['excludeDomains'], fromExcludeDomains);
|
|
11522
|
+
}
|
|
11349
11523
|
return toObject;
|
|
11350
11524
|
}
|
|
11351
11525
|
function apiKeyConfigToVertex(fromObject) {
|
|
@@ -11400,6 +11574,14 @@ function urlContextToVertex() {
|
|
|
11400
11574
|
const toObject = {};
|
|
11401
11575
|
return toObject;
|
|
11402
11576
|
}
|
|
11577
|
+
function toolComputerUseToVertex(fromObject) {
|
|
11578
|
+
const toObject = {};
|
|
11579
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
11580
|
+
if (fromEnvironment != null) {
|
|
11581
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
11582
|
+
}
|
|
11583
|
+
return toObject;
|
|
11584
|
+
}
|
|
11403
11585
|
function toolToVertex(fromObject) {
|
|
11404
11586
|
const toObject = {};
|
|
11405
11587
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -11432,7 +11614,7 @@ function toolToVertex(fromObject) {
|
|
|
11432
11614
|
'enterpriseWebSearch',
|
|
11433
11615
|
]);
|
|
11434
11616
|
if (fromEnterpriseWebSearch != null) {
|
|
11435
|
-
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex());
|
|
11617
|
+
setValueByPath(toObject, ['enterpriseWebSearch'], enterpriseWebSearchToVertex(fromEnterpriseWebSearch));
|
|
11436
11618
|
}
|
|
11437
11619
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
11438
11620
|
if (fromGoogleMaps != null) {
|
|
@@ -11442,16 +11624,16 @@ function toolToVertex(fromObject) {
|
|
|
11442
11624
|
if (fromUrlContext != null) {
|
|
11443
11625
|
setValueByPath(toObject, ['urlContext'], urlContextToVertex());
|
|
11444
11626
|
}
|
|
11627
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
11628
|
+
if (fromComputerUse != null) {
|
|
11629
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToVertex(fromComputerUse));
|
|
11630
|
+
}
|
|
11445
11631
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
11446
11632
|
'codeExecution',
|
|
11447
11633
|
]);
|
|
11448
11634
|
if (fromCodeExecution != null) {
|
|
11449
11635
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
11450
11636
|
}
|
|
11451
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
11452
|
-
if (fromComputerUse != null) {
|
|
11453
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
11454
|
-
}
|
|
11455
11637
|
return toObject;
|
|
11456
11638
|
}
|
|
11457
11639
|
function functionCallingConfigToVertex(fromObject) {
|
|
@@ -12281,6 +12463,78 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
|
|
|
12281
12463
|
}
|
|
12282
12464
|
return toObject;
|
|
12283
12465
|
}
|
|
12466
|
+
function scribbleImageToVertex(fromObject) {
|
|
12467
|
+
const toObject = {};
|
|
12468
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
12469
|
+
if (fromImage != null) {
|
|
12470
|
+
setValueByPath(toObject, ['image'], imageToVertex(fromImage));
|
|
12471
|
+
}
|
|
12472
|
+
return toObject;
|
|
12473
|
+
}
|
|
12474
|
+
function segmentImageSourceToVertex(fromObject, parentObject) {
|
|
12475
|
+
const toObject = {};
|
|
12476
|
+
const fromPrompt = getValueByPath(fromObject, ['prompt']);
|
|
12477
|
+
if (parentObject !== undefined && fromPrompt != null) {
|
|
12478
|
+
setValueByPath(parentObject, ['instances[0]', 'prompt'], fromPrompt);
|
|
12479
|
+
}
|
|
12480
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
12481
|
+
if (parentObject !== undefined && fromImage != null) {
|
|
12482
|
+
setValueByPath(parentObject, ['instances[0]', 'image'], imageToVertex(fromImage));
|
|
12483
|
+
}
|
|
12484
|
+
const fromScribbleImage = getValueByPath(fromObject, [
|
|
12485
|
+
'scribbleImage',
|
|
12486
|
+
]);
|
|
12487
|
+
if (parentObject !== undefined && fromScribbleImage != null) {
|
|
12488
|
+
setValueByPath(parentObject, ['instances[0]', 'scribble'], scribbleImageToVertex(fromScribbleImage));
|
|
12489
|
+
}
|
|
12490
|
+
return toObject;
|
|
12491
|
+
}
|
|
12492
|
+
function segmentImageConfigToVertex(fromObject, parentObject) {
|
|
12493
|
+
const toObject = {};
|
|
12494
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
12495
|
+
if (parentObject !== undefined && fromMode != null) {
|
|
12496
|
+
setValueByPath(parentObject, ['parameters', 'mode'], fromMode);
|
|
12497
|
+
}
|
|
12498
|
+
const fromMaxPredictions = getValueByPath(fromObject, [
|
|
12499
|
+
'maxPredictions',
|
|
12500
|
+
]);
|
|
12501
|
+
if (parentObject !== undefined && fromMaxPredictions != null) {
|
|
12502
|
+
setValueByPath(parentObject, ['parameters', 'maxPredictions'], fromMaxPredictions);
|
|
12503
|
+
}
|
|
12504
|
+
const fromConfidenceThreshold = getValueByPath(fromObject, [
|
|
12505
|
+
'confidenceThreshold',
|
|
12506
|
+
]);
|
|
12507
|
+
if (parentObject !== undefined && fromConfidenceThreshold != null) {
|
|
12508
|
+
setValueByPath(parentObject, ['parameters', 'confidenceThreshold'], fromConfidenceThreshold);
|
|
12509
|
+
}
|
|
12510
|
+
const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
|
|
12511
|
+
if (parentObject !== undefined && fromMaskDilation != null) {
|
|
12512
|
+
setValueByPath(parentObject, ['parameters', 'maskDilation'], fromMaskDilation);
|
|
12513
|
+
}
|
|
12514
|
+
const fromBinaryColorThreshold = getValueByPath(fromObject, [
|
|
12515
|
+
'binaryColorThreshold',
|
|
12516
|
+
]);
|
|
12517
|
+
if (parentObject !== undefined && fromBinaryColorThreshold != null) {
|
|
12518
|
+
setValueByPath(parentObject, ['parameters', 'binaryColorThreshold'], fromBinaryColorThreshold);
|
|
12519
|
+
}
|
|
12520
|
+
return toObject;
|
|
12521
|
+
}
|
|
12522
|
+
function segmentImageParametersToVertex(apiClient, fromObject) {
|
|
12523
|
+
const toObject = {};
|
|
12524
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
12525
|
+
if (fromModel != null) {
|
|
12526
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
12527
|
+
}
|
|
12528
|
+
const fromSource = getValueByPath(fromObject, ['source']);
|
|
12529
|
+
if (fromSource != null) {
|
|
12530
|
+
setValueByPath(toObject, ['config'], segmentImageSourceToVertex(fromSource, toObject));
|
|
12531
|
+
}
|
|
12532
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
12533
|
+
if (fromConfig != null) {
|
|
12534
|
+
setValueByPath(toObject, ['config'], segmentImageConfigToVertex(fromConfig, toObject));
|
|
12535
|
+
}
|
|
12536
|
+
return toObject;
|
|
12537
|
+
}
|
|
12284
12538
|
function getModelParametersToVertex(apiClient, fromObject) {
|
|
12285
12539
|
const toObject = {};
|
|
12286
12540
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -12449,6 +12703,20 @@ function videoToVertex(fromObject) {
|
|
|
12449
12703
|
}
|
|
12450
12704
|
return toObject;
|
|
12451
12705
|
}
|
|
12706
|
+
function videoGenerationReferenceImageToVertex(fromObject) {
|
|
12707
|
+
const toObject = {};
|
|
12708
|
+
const fromImage = getValueByPath(fromObject, ['image']);
|
|
12709
|
+
if (fromImage != null) {
|
|
12710
|
+
setValueByPath(toObject, ['image'], imageToVertex(fromImage));
|
|
12711
|
+
}
|
|
12712
|
+
const fromReferenceType = getValueByPath(fromObject, [
|
|
12713
|
+
'referenceType',
|
|
12714
|
+
]);
|
|
12715
|
+
if (fromReferenceType != null) {
|
|
12716
|
+
setValueByPath(toObject, ['referenceType'], fromReferenceType);
|
|
12717
|
+
}
|
|
12718
|
+
return toObject;
|
|
12719
|
+
}
|
|
12452
12720
|
function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
12453
12721
|
const toObject = {};
|
|
12454
12722
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -12515,6 +12783,18 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
|
12515
12783
|
if (parentObject !== undefined && fromLastFrame != null) {
|
|
12516
12784
|
setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
|
|
12517
12785
|
}
|
|
12786
|
+
const fromReferenceImages = getValueByPath(fromObject, [
|
|
12787
|
+
'referenceImages',
|
|
12788
|
+
]);
|
|
12789
|
+
if (parentObject !== undefined && fromReferenceImages != null) {
|
|
12790
|
+
let transformedList = fromReferenceImages;
|
|
12791
|
+
if (Array.isArray(transformedList)) {
|
|
12792
|
+
transformedList = transformedList.map((item) => {
|
|
12793
|
+
return videoGenerationReferenceImageToVertex(item);
|
|
12794
|
+
});
|
|
12795
|
+
}
|
|
12796
|
+
setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
|
|
12797
|
+
}
|
|
12518
12798
|
const fromCompressionQuality = getValueByPath(fromObject, [
|
|
12519
12799
|
'compressionQuality',
|
|
12520
12800
|
]);
|
|
@@ -13564,6 +13844,50 @@ function recontextImageResponseFromVertex(fromObject) {
|
|
|
13564
13844
|
}
|
|
13565
13845
|
return toObject;
|
|
13566
13846
|
}
|
|
13847
|
+
function entityLabelFromVertex(fromObject) {
|
|
13848
|
+
const toObject = {};
|
|
13849
|
+
const fromLabel = getValueByPath(fromObject, ['label']);
|
|
13850
|
+
if (fromLabel != null) {
|
|
13851
|
+
setValueByPath(toObject, ['label'], fromLabel);
|
|
13852
|
+
}
|
|
13853
|
+
const fromScore = getValueByPath(fromObject, ['score']);
|
|
13854
|
+
if (fromScore != null) {
|
|
13855
|
+
setValueByPath(toObject, ['score'], fromScore);
|
|
13856
|
+
}
|
|
13857
|
+
return toObject;
|
|
13858
|
+
}
|
|
13859
|
+
function generatedImageMaskFromVertex(fromObject) {
|
|
13860
|
+
const toObject = {};
|
|
13861
|
+
const fromMask = getValueByPath(fromObject, ['_self']);
|
|
13862
|
+
if (fromMask != null) {
|
|
13863
|
+
setValueByPath(toObject, ['mask'], imageFromVertex(fromMask));
|
|
13864
|
+
}
|
|
13865
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
13866
|
+
if (fromLabels != null) {
|
|
13867
|
+
let transformedList = fromLabels;
|
|
13868
|
+
if (Array.isArray(transformedList)) {
|
|
13869
|
+
transformedList = transformedList.map((item) => {
|
|
13870
|
+
return entityLabelFromVertex(item);
|
|
13871
|
+
});
|
|
13872
|
+
}
|
|
13873
|
+
setValueByPath(toObject, ['labels'], transformedList);
|
|
13874
|
+
}
|
|
13875
|
+
return toObject;
|
|
13876
|
+
}
|
|
13877
|
+
function segmentImageResponseFromVertex(fromObject) {
|
|
13878
|
+
const toObject = {};
|
|
13879
|
+
const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
|
|
13880
|
+
if (fromGeneratedMasks != null) {
|
|
13881
|
+
let transformedList = fromGeneratedMasks;
|
|
13882
|
+
if (Array.isArray(transformedList)) {
|
|
13883
|
+
transformedList = transformedList.map((item) => {
|
|
13884
|
+
return generatedImageMaskFromVertex(item);
|
|
13885
|
+
});
|
|
13886
|
+
}
|
|
13887
|
+
setValueByPath(toObject, ['generatedMasks'], transformedList);
|
|
13888
|
+
}
|
|
13889
|
+
return toObject;
|
|
13890
|
+
}
|
|
13567
13891
|
function endpointFromVertex(fromObject) {
|
|
13568
13892
|
const toObject = {};
|
|
13569
13893
|
const fromName = getValueByPath(fromObject, ['endpoint']);
|
|
@@ -15680,6 +16004,61 @@ class Models extends BaseModule {
|
|
|
15680
16004
|
throw new Error('This method is only supported by the Vertex AI.');
|
|
15681
16005
|
}
|
|
15682
16006
|
}
|
|
16007
|
+
/**
|
|
16008
|
+
* Segments an image, creating a mask of a specified area.
|
|
16009
|
+
*
|
|
16010
|
+
* @param params - The parameters for segmenting an image.
|
|
16011
|
+
* @return The response from the API.
|
|
16012
|
+
*
|
|
16013
|
+
* @example
|
|
16014
|
+
* ```ts
|
|
16015
|
+
* const response = await ai.models.segmentImage({
|
|
16016
|
+
* model: 'image-segmentation-001',
|
|
16017
|
+
* source: {
|
|
16018
|
+
* image: image,
|
|
16019
|
+
* },
|
|
16020
|
+
* config: {
|
|
16021
|
+
* mode: 'foreground',
|
|
16022
|
+
* },
|
|
16023
|
+
* });
|
|
16024
|
+
* console.log(response?.generatedMasks?.[0]?.mask?.imageBytes);
|
|
16025
|
+
* ```
|
|
16026
|
+
*/
|
|
16027
|
+
async segmentImage(params) {
|
|
16028
|
+
var _a, _b;
|
|
16029
|
+
let response;
|
|
16030
|
+
let path = '';
|
|
16031
|
+
let queryParams = {};
|
|
16032
|
+
if (this.apiClient.isVertexAI()) {
|
|
16033
|
+
const body = segmentImageParametersToVertex(this.apiClient, params);
|
|
16034
|
+
path = formatMap('{model}:predict', body['_url']);
|
|
16035
|
+
queryParams = body['_query'];
|
|
16036
|
+
delete body['config'];
|
|
16037
|
+
delete body['_url'];
|
|
16038
|
+
delete body['_query'];
|
|
16039
|
+
response = this.apiClient
|
|
16040
|
+
.request({
|
|
16041
|
+
path: path,
|
|
16042
|
+
queryParams: queryParams,
|
|
16043
|
+
body: JSON.stringify(body),
|
|
16044
|
+
httpMethod: 'POST',
|
|
16045
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
16046
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
16047
|
+
})
|
|
16048
|
+
.then((httpResponse) => {
|
|
16049
|
+
return httpResponse.json();
|
|
16050
|
+
});
|
|
16051
|
+
return response.then((apiResponse) => {
|
|
16052
|
+
const resp = segmentImageResponseFromVertex(apiResponse);
|
|
16053
|
+
const typedResp = new SegmentImageResponse();
|
|
16054
|
+
Object.assign(typedResp, resp);
|
|
16055
|
+
return typedResp;
|
|
16056
|
+
});
|
|
16057
|
+
}
|
|
16058
|
+
else {
|
|
16059
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
16060
|
+
}
|
|
16061
|
+
}
|
|
15683
16062
|
/**
|
|
15684
16063
|
* Fetches information about a model by name.
|
|
15685
16064
|
*
|
|
@@ -16644,6 +17023,9 @@ function googleSearchToMldev(fromObject) {
|
|
|
16644
17023
|
if (fromTimeRangeFilter != null) {
|
|
16645
17024
|
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev(fromTimeRangeFilter));
|
|
16646
17025
|
}
|
|
17026
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
17027
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
17028
|
+
}
|
|
16647
17029
|
return toObject;
|
|
16648
17030
|
}
|
|
16649
17031
|
function dynamicRetrievalConfigToMldev(fromObject) {
|
|
@@ -16674,6 +17056,14 @@ function urlContextToMldev() {
|
|
|
16674
17056
|
const toObject = {};
|
|
16675
17057
|
return toObject;
|
|
16676
17058
|
}
|
|
17059
|
+
function toolComputerUseToMldev(fromObject) {
|
|
17060
|
+
const toObject = {};
|
|
17061
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
17062
|
+
if (fromEnvironment != null) {
|
|
17063
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
17064
|
+
}
|
|
17065
|
+
return toObject;
|
|
17066
|
+
}
|
|
16677
17067
|
function toolToMldev(fromObject) {
|
|
16678
17068
|
const toObject = {};
|
|
16679
17069
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -16711,16 +17101,16 @@ function toolToMldev(fromObject) {
|
|
|
16711
17101
|
if (fromUrlContext != null) {
|
|
16712
17102
|
setValueByPath(toObject, ['urlContext'], urlContextToMldev());
|
|
16713
17103
|
}
|
|
17104
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
17105
|
+
if (fromComputerUse != null) {
|
|
17106
|
+
setValueByPath(toObject, ['computerUse'], toolComputerUseToMldev(fromComputerUse));
|
|
17107
|
+
}
|
|
16714
17108
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
16715
17109
|
'codeExecution',
|
|
16716
17110
|
]);
|
|
16717
17111
|
if (fromCodeExecution != null) {
|
|
16718
17112
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
16719
17113
|
}
|
|
16720
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
16721
|
-
if (fromComputerUse != null) {
|
|
16722
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
16723
|
-
}
|
|
16724
17114
|
return toObject;
|
|
16725
17115
|
}
|
|
16726
17116
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
@@ -17360,6 +17750,10 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
17360
17750
|
undefined) {
|
|
17361
17751
|
throw new Error('exportLastCheckpointOnly parameter is not supported in Gemini API.');
|
|
17362
17752
|
}
|
|
17753
|
+
if (getValueByPath(fromObject, ['preTunedModelCheckpointId']) !==
|
|
17754
|
+
undefined) {
|
|
17755
|
+
throw new Error('preTunedModelCheckpointId parameter is not supported in Gemini API.');
|
|
17756
|
+
}
|
|
17363
17757
|
if (getValueByPath(fromObject, ['adapterSize']) !== undefined) {
|
|
17364
17758
|
throw new Error('adapterSize parameter is not supported in Gemini API.');
|
|
17365
17759
|
}
|
|
@@ -17373,12 +17767,18 @@ function createTuningJobConfigToMldev(fromObject, parentObject) {
|
|
|
17373
17767
|
}
|
|
17374
17768
|
return toObject;
|
|
17375
17769
|
}
|
|
17376
|
-
function
|
|
17770
|
+
function createTuningJobParametersPrivateToMldev(fromObject) {
|
|
17377
17771
|
const toObject = {};
|
|
17378
17772
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
17379
17773
|
if (fromBaseModel != null) {
|
|
17380
17774
|
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
17381
17775
|
}
|
|
17776
|
+
const fromPreTunedModel = getValueByPath(fromObject, [
|
|
17777
|
+
'preTunedModel',
|
|
17778
|
+
]);
|
|
17779
|
+
if (fromPreTunedModel != null) {
|
|
17780
|
+
setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
|
|
17781
|
+
}
|
|
17382
17782
|
const fromTrainingDataset = getValueByPath(fromObject, [
|
|
17383
17783
|
'trainingDataset',
|
|
17384
17784
|
]);
|
|
@@ -17492,6 +17892,12 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
17492
17892
|
if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
|
|
17493
17893
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
17494
17894
|
}
|
|
17895
|
+
const fromPreTunedModelCheckpointId = getValueByPath(fromObject, [
|
|
17896
|
+
'preTunedModelCheckpointId',
|
|
17897
|
+
]);
|
|
17898
|
+
if (fromPreTunedModelCheckpointId != null) {
|
|
17899
|
+
setValueByPath(toObject, ['preTunedModel', 'checkpointId'], fromPreTunedModelCheckpointId);
|
|
17900
|
+
}
|
|
17495
17901
|
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
17496
17902
|
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
17497
17903
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
@@ -17504,12 +17910,18 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
17504
17910
|
}
|
|
17505
17911
|
return toObject;
|
|
17506
17912
|
}
|
|
17507
|
-
function
|
|
17913
|
+
function createTuningJobParametersPrivateToVertex(fromObject) {
|
|
17508
17914
|
const toObject = {};
|
|
17509
17915
|
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
17510
17916
|
if (fromBaseModel != null) {
|
|
17511
17917
|
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
17512
17918
|
}
|
|
17919
|
+
const fromPreTunedModel = getValueByPath(fromObject, [
|
|
17920
|
+
'preTunedModel',
|
|
17921
|
+
]);
|
|
17922
|
+
if (fromPreTunedModel != null) {
|
|
17923
|
+
setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
|
|
17924
|
+
}
|
|
17513
17925
|
const fromTrainingDataset = getValueByPath(fromObject, [
|
|
17514
17926
|
'trainingDataset',
|
|
17515
17927
|
]);
|
|
@@ -17584,11 +17996,11 @@ function tuningJobFromMldev(fromObject) {
|
|
|
17584
17996
|
if (fromTunedModel != null) {
|
|
17585
17997
|
setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
|
|
17586
17998
|
}
|
|
17587
|
-
const
|
|
17588
|
-
'
|
|
17999
|
+
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
18000
|
+
'customBaseModel',
|
|
17589
18001
|
]);
|
|
17590
|
-
if (
|
|
17591
|
-
setValueByPath(toObject, ['
|
|
18002
|
+
if (fromCustomBaseModel != null) {
|
|
18003
|
+
setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
|
|
17592
18004
|
}
|
|
17593
18005
|
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
17594
18006
|
if (fromExperiment != null) {
|
|
@@ -17598,18 +18010,14 @@ function tuningJobFromMldev(fromObject) {
|
|
|
17598
18010
|
if (fromLabels != null) {
|
|
17599
18011
|
setValueByPath(toObject, ['labels'], fromLabels);
|
|
17600
18012
|
}
|
|
18013
|
+
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
18014
|
+
if (fromOutputUri != null) {
|
|
18015
|
+
setValueByPath(toObject, ['outputUri'], fromOutputUri);
|
|
18016
|
+
}
|
|
17601
18017
|
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
17602
18018
|
if (fromPipelineJob != null) {
|
|
17603
18019
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
17604
18020
|
}
|
|
17605
|
-
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17606
|
-
if (fromSatisfiesPzi != null) {
|
|
17607
|
-
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17608
|
-
}
|
|
17609
|
-
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17610
|
-
if (fromSatisfiesPzs != null) {
|
|
17611
|
-
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17612
|
-
}
|
|
17613
18021
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
17614
18022
|
'serviceAccount',
|
|
17615
18023
|
]);
|
|
@@ -17766,6 +18174,12 @@ function tuningJobFromVertex(fromObject) {
|
|
|
17766
18174
|
if (fromTunedModel != null) {
|
|
17767
18175
|
setValueByPath(toObject, ['tunedModel'], tunedModelFromVertex(fromTunedModel));
|
|
17768
18176
|
}
|
|
18177
|
+
const fromPreTunedModel = getValueByPath(fromObject, [
|
|
18178
|
+
'preTunedModel',
|
|
18179
|
+
]);
|
|
18180
|
+
if (fromPreTunedModel != null) {
|
|
18181
|
+
setValueByPath(toObject, ['preTunedModel'], fromPreTunedModel);
|
|
18182
|
+
}
|
|
17769
18183
|
const fromSupervisedTuningSpec = getValueByPath(fromObject, [
|
|
17770
18184
|
'supervisedTuningSpec',
|
|
17771
18185
|
]);
|
|
@@ -17790,11 +18204,11 @@ function tuningJobFromVertex(fromObject) {
|
|
|
17790
18204
|
if (fromPartnerModelTuningSpec != null) {
|
|
17791
18205
|
setValueByPath(toObject, ['partnerModelTuningSpec'], fromPartnerModelTuningSpec);
|
|
17792
18206
|
}
|
|
17793
|
-
const
|
|
17794
|
-
'
|
|
18207
|
+
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
18208
|
+
'customBaseModel',
|
|
17795
18209
|
]);
|
|
17796
|
-
if (
|
|
17797
|
-
setValueByPath(toObject, ['
|
|
18210
|
+
if (fromCustomBaseModel != null) {
|
|
18211
|
+
setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
|
|
17798
18212
|
}
|
|
17799
18213
|
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
17800
18214
|
if (fromExperiment != null) {
|
|
@@ -17804,18 +18218,14 @@ function tuningJobFromVertex(fromObject) {
|
|
|
17804
18218
|
if (fromLabels != null) {
|
|
17805
18219
|
setValueByPath(toObject, ['labels'], fromLabels);
|
|
17806
18220
|
}
|
|
18221
|
+
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
18222
|
+
if (fromOutputUri != null) {
|
|
18223
|
+
setValueByPath(toObject, ['outputUri'], fromOutputUri);
|
|
18224
|
+
}
|
|
17807
18225
|
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
17808
18226
|
if (fromPipelineJob != null) {
|
|
17809
18227
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
17810
18228
|
}
|
|
17811
|
-
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17812
|
-
if (fromSatisfiesPzi != null) {
|
|
17813
|
-
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17814
|
-
}
|
|
17815
|
-
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17816
|
-
if (fromSatisfiesPzs != null) {
|
|
17817
|
-
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17818
|
-
}
|
|
17819
18229
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
17820
18230
|
'serviceAccount',
|
|
17821
18231
|
]);
|
|
@@ -17901,10 +18311,22 @@ class Tunings extends BaseModule {
|
|
|
17901
18311
|
*/
|
|
17902
18312
|
this.tune = async (params) => {
|
|
17903
18313
|
if (this.apiClient.isVertexAI()) {
|
|
17904
|
-
|
|
18314
|
+
if (params.baseModel.startsWith('projects/')) {
|
|
18315
|
+
const preTunedModel = {
|
|
18316
|
+
tunedModelName: params.baseModel,
|
|
18317
|
+
};
|
|
18318
|
+
const paramsPrivate = Object.assign(Object.assign({}, params), { preTunedModel: preTunedModel });
|
|
18319
|
+
paramsPrivate.baseModel = undefined;
|
|
18320
|
+
return await this.tuneInternal(paramsPrivate);
|
|
18321
|
+
}
|
|
18322
|
+
else {
|
|
18323
|
+
const paramsPrivate = Object.assign({}, params);
|
|
18324
|
+
return await this.tuneInternal(paramsPrivate);
|
|
18325
|
+
}
|
|
17905
18326
|
}
|
|
17906
18327
|
else {
|
|
17907
|
-
const
|
|
18328
|
+
const paramsPrivate = Object.assign({}, params);
|
|
18329
|
+
const operation = await this.tuneMldevInternal(paramsPrivate);
|
|
17908
18330
|
let tunedModelName = '';
|
|
17909
18331
|
if (operation['metadata'] !== undefined &&
|
|
17910
18332
|
operation['metadata']['tunedModel'] !== undefined) {
|
|
@@ -18064,7 +18486,7 @@ class Tunings extends BaseModule {
|
|
|
18064
18486
|
let path = '';
|
|
18065
18487
|
let queryParams = {};
|
|
18066
18488
|
if (this.apiClient.isVertexAI()) {
|
|
18067
|
-
const body =
|
|
18489
|
+
const body = createTuningJobParametersPrivateToVertex(params);
|
|
18068
18490
|
path = formatMap('tuningJobs', body['_url']);
|
|
18069
18491
|
queryParams = body['_query'];
|
|
18070
18492
|
delete body['config'];
|
|
@@ -18106,7 +18528,7 @@ class Tunings extends BaseModule {
|
|
|
18106
18528
|
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
18107
18529
|
}
|
|
18108
18530
|
else {
|
|
18109
|
-
const body =
|
|
18531
|
+
const body = createTuningJobParametersPrivateToMldev(params);
|
|
18110
18532
|
path = formatMap('tunedModels', body['_url']);
|
|
18111
18533
|
queryParams = body['_query'];
|
|
18112
18534
|
delete body['config'];
|
|
@@ -18275,6 +18697,7 @@ exports.Pager = Pager;
|
|
|
18275
18697
|
exports.RawReferenceImage = RawReferenceImage;
|
|
18276
18698
|
exports.RecontextImageResponse = RecontextImageResponse;
|
|
18277
18699
|
exports.ReplayResponse = ReplayResponse;
|
|
18700
|
+
exports.SegmentImageResponse = SegmentImageResponse;
|
|
18278
18701
|
exports.Session = Session;
|
|
18279
18702
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
18280
18703
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|