@google/genai 1.7.0 → 1.8.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 +43 -0
- package/dist/genai.d.ts +195 -18
- package/dist/index.cjs +275 -33
- package/dist/index.mjs +276 -34
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +275 -33
- package/dist/node/index.mjs +276 -34
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +195 -18
- package/dist/web/index.mjs +276 -34
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +195 -18
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -292,6 +292,22 @@ var HarmCategory;
|
|
|
292
292
|
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
293
293
|
*/
|
|
294
294
|
HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
295
|
+
/**
|
|
296
|
+
* The harm category is image hate.
|
|
297
|
+
*/
|
|
298
|
+
HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
|
|
299
|
+
/**
|
|
300
|
+
* The harm category is image dangerous content.
|
|
301
|
+
*/
|
|
302
|
+
HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
|
|
303
|
+
/**
|
|
304
|
+
* The harm category is image harassment.
|
|
305
|
+
*/
|
|
306
|
+
HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
|
|
307
|
+
/**
|
|
308
|
+
* The harm category is image sexually explicit content.
|
|
309
|
+
*/
|
|
310
|
+
HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
|
|
295
311
|
})(HarmCategory || (HarmCategory = {}));
|
|
296
312
|
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
297
313
|
var HarmBlockMethod;
|
|
@@ -378,6 +394,50 @@ var AuthType;
|
|
|
378
394
|
*/
|
|
379
395
|
AuthType["OIDC_AUTH"] = "OIDC_AUTH";
|
|
380
396
|
})(AuthType || (AuthType = {}));
|
|
397
|
+
/** The API spec that the external API implements. */
|
|
398
|
+
var ApiSpec;
|
|
399
|
+
(function (ApiSpec) {
|
|
400
|
+
/**
|
|
401
|
+
* Unspecified API spec. This value should not be used.
|
|
402
|
+
*/
|
|
403
|
+
ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
|
|
404
|
+
/**
|
|
405
|
+
* Simple search API spec.
|
|
406
|
+
*/
|
|
407
|
+
ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
|
|
408
|
+
/**
|
|
409
|
+
* Elastic search API spec.
|
|
410
|
+
*/
|
|
411
|
+
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
412
|
+
})(ApiSpec || (ApiSpec = {}));
|
|
413
|
+
/** Required. The environment being operated. */
|
|
414
|
+
var Environment;
|
|
415
|
+
(function (Environment) {
|
|
416
|
+
/**
|
|
417
|
+
* Defaults to browser.
|
|
418
|
+
*/
|
|
419
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
420
|
+
/**
|
|
421
|
+
* Operates in a web browser.
|
|
422
|
+
*/
|
|
423
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
424
|
+
})(Environment || (Environment = {}));
|
|
425
|
+
/** Status of the url retrieval. */
|
|
426
|
+
var UrlRetrievalStatus;
|
|
427
|
+
(function (UrlRetrievalStatus) {
|
|
428
|
+
/**
|
|
429
|
+
* Default value. This value is unused
|
|
430
|
+
*/
|
|
431
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
|
|
432
|
+
/**
|
|
433
|
+
* Url retrieval is successful.
|
|
434
|
+
*/
|
|
435
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
|
|
436
|
+
/**
|
|
437
|
+
* Url retrieval is failed due to error.
|
|
438
|
+
*/
|
|
439
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
|
|
440
|
+
})(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
|
|
381
441
|
/** Output only. The reason why the model stopped generating tokens.
|
|
382
442
|
|
|
383
443
|
If empty, the model has not stopped generating the tokens.
|
|
@@ -508,6 +568,10 @@ var BlockedReason;
|
|
|
508
568
|
* Candidates blocked due to prohibited content.
|
|
509
569
|
*/
|
|
510
570
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
571
|
+
/**
|
|
572
|
+
* Candidates blocked due to unsafe image generation content.
|
|
573
|
+
*/
|
|
574
|
+
BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
511
575
|
})(BlockedReason || (BlockedReason = {}));
|
|
512
576
|
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
513
577
|
var TrafficType;
|
|
@@ -705,22 +769,6 @@ var FunctionCallingConfigMode;
|
|
|
705
769
|
*/
|
|
706
770
|
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
707
771
|
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
708
|
-
/** Status of the url retrieval. */
|
|
709
|
-
var UrlRetrievalStatus;
|
|
710
|
-
(function (UrlRetrievalStatus) {
|
|
711
|
-
/**
|
|
712
|
-
* Default value. This value is unused
|
|
713
|
-
*/
|
|
714
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
|
|
715
|
-
/**
|
|
716
|
-
* Url retrieval is successful.
|
|
717
|
-
*/
|
|
718
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
|
|
719
|
-
/**
|
|
720
|
-
* Url retrieval is failed due to error.
|
|
721
|
-
*/
|
|
722
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
|
|
723
|
-
})(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
|
|
724
772
|
/** Enum that controls the safety filter level for objectionable content. */
|
|
725
773
|
var SafetyFilterLevel;
|
|
726
774
|
(function (SafetyFilterLevel) {
|
|
@@ -2923,6 +2971,10 @@ function toolToMldev$4(fromObject) {
|
|
|
2923
2971
|
if (fromCodeExecution != null) {
|
|
2924
2972
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
2925
2973
|
}
|
|
2974
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
2975
|
+
if (fromComputerUse != null) {
|
|
2976
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
2977
|
+
}
|
|
2926
2978
|
return toObject;
|
|
2927
2979
|
}
|
|
2928
2980
|
function functionCallingConfigToMldev$2(fromObject) {
|
|
@@ -3334,6 +3386,18 @@ function listBatchJobsParametersToMldev(fromObject) {
|
|
|
3334
3386
|
}
|
|
3335
3387
|
return toObject;
|
|
3336
3388
|
}
|
|
3389
|
+
function deleteBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3390
|
+
const toObject = {};
|
|
3391
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3392
|
+
if (fromName != null) {
|
|
3393
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3394
|
+
}
|
|
3395
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3396
|
+
if (fromConfig != null) {
|
|
3397
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3398
|
+
}
|
|
3399
|
+
return toObject;
|
|
3400
|
+
}
|
|
3337
3401
|
function batchJobSourceToVertex(fromObject) {
|
|
3338
3402
|
const toObject = {};
|
|
3339
3403
|
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
@@ -3454,6 +3518,18 @@ function listBatchJobsParametersToVertex(fromObject) {
|
|
|
3454
3518
|
}
|
|
3455
3519
|
return toObject;
|
|
3456
3520
|
}
|
|
3521
|
+
function deleteBatchJobParametersToVertex(apiClient, fromObject) {
|
|
3522
|
+
const toObject = {};
|
|
3523
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3524
|
+
if (fromName != null) {
|
|
3525
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3526
|
+
}
|
|
3527
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3528
|
+
if (fromConfig != null) {
|
|
3529
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3530
|
+
}
|
|
3531
|
+
return toObject;
|
|
3532
|
+
}
|
|
3457
3533
|
function jobErrorFromMldev() {
|
|
3458
3534
|
const toObject = {};
|
|
3459
3535
|
return toObject;
|
|
@@ -3791,6 +3867,22 @@ function listBatchJobsResponseFromMldev(fromObject) {
|
|
|
3791
3867
|
}
|
|
3792
3868
|
return toObject;
|
|
3793
3869
|
}
|
|
3870
|
+
function deleteResourceJobFromMldev(fromObject) {
|
|
3871
|
+
const toObject = {};
|
|
3872
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3873
|
+
if (fromName != null) {
|
|
3874
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3875
|
+
}
|
|
3876
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
3877
|
+
if (fromDone != null) {
|
|
3878
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
3879
|
+
}
|
|
3880
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
3881
|
+
if (fromError != null) {
|
|
3882
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev());
|
|
3883
|
+
}
|
|
3884
|
+
return toObject;
|
|
3885
|
+
}
|
|
3794
3886
|
function jobErrorFromVertex(fromObject) {
|
|
3795
3887
|
const toObject = {};
|
|
3796
3888
|
const fromDetails = getValueByPath(fromObject, ['details']);
|
|
@@ -3918,6 +4010,22 @@ function listBatchJobsResponseFromVertex(fromObject) {
|
|
|
3918
4010
|
}
|
|
3919
4011
|
return toObject;
|
|
3920
4012
|
}
|
|
4013
|
+
function deleteResourceJobFromVertex(fromObject) {
|
|
4014
|
+
const toObject = {};
|
|
4015
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
4016
|
+
if (fromName != null) {
|
|
4017
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
4018
|
+
}
|
|
4019
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
4020
|
+
if (fromDone != null) {
|
|
4021
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
4022
|
+
}
|
|
4023
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
4024
|
+
if (fromError != null) {
|
|
4025
|
+
setValueByPath(toObject, ['error'], jobErrorFromVertex(fromError));
|
|
4026
|
+
}
|
|
4027
|
+
return toObject;
|
|
4028
|
+
}
|
|
3921
4029
|
|
|
3922
4030
|
/**
|
|
3923
4031
|
* @license
|
|
@@ -4125,20 +4233,23 @@ class Batches extends BaseModule {
|
|
|
4125
4233
|
*/
|
|
4126
4234
|
this.create = async (params) => {
|
|
4127
4235
|
if (this.apiClient.isVertexAI()) {
|
|
4236
|
+
const timestamp = Date.now();
|
|
4237
|
+
const timestampStr = timestamp.toString();
|
|
4128
4238
|
if (Array.isArray(params.src)) {
|
|
4129
4239
|
throw new Error('InlinedRequest[] is not supported in Vertex AI. Please use ' +
|
|
4130
4240
|
'Google Cloud Storage URI or BigQuery URI instead.');
|
|
4131
4241
|
}
|
|
4132
4242
|
params.config = params.config || {};
|
|
4133
4243
|
if (params.config.displayName === undefined) {
|
|
4134
|
-
params.config.displayName = 'genaiBatchJob_';
|
|
4244
|
+
params.config.displayName = 'genaiBatchJob_${timestampStr}';
|
|
4135
4245
|
}
|
|
4136
4246
|
if (params.config.dest === undefined && typeof params.src === 'string') {
|
|
4137
4247
|
if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
|
|
4138
4248
|
params.config.dest = `${params.src.slice(0, -6)}/dest`;
|
|
4139
4249
|
}
|
|
4140
4250
|
else if (params.src.startsWith('bq://')) {
|
|
4141
|
-
params.config.dest =
|
|
4251
|
+
params.config.dest =
|
|
4252
|
+
`${params.src}_dest_${timestampStr}`;
|
|
4142
4253
|
}
|
|
4143
4254
|
else {
|
|
4144
4255
|
throw new Error('Unsupported source:' + params.src);
|
|
@@ -4397,6 +4508,71 @@ class Batches extends BaseModule {
|
|
|
4397
4508
|
});
|
|
4398
4509
|
}
|
|
4399
4510
|
}
|
|
4511
|
+
/**
|
|
4512
|
+
* Deletes a batch job.
|
|
4513
|
+
*
|
|
4514
|
+
* @param params - The parameters for the delete request.
|
|
4515
|
+
* @return The empty response returned by the API.
|
|
4516
|
+
*
|
|
4517
|
+
* @example
|
|
4518
|
+
* ```ts
|
|
4519
|
+
* await ai.batches.delete({name: '...'}); // The server-generated resource name.
|
|
4520
|
+
* ```
|
|
4521
|
+
*/
|
|
4522
|
+
async delete(params) {
|
|
4523
|
+
var _a, _b, _c, _d;
|
|
4524
|
+
let response;
|
|
4525
|
+
let path = '';
|
|
4526
|
+
let queryParams = {};
|
|
4527
|
+
if (this.apiClient.isVertexAI()) {
|
|
4528
|
+
const body = deleteBatchJobParametersToVertex(this.apiClient, params);
|
|
4529
|
+
path = formatMap('batchPredictionJobs/{name}', body['_url']);
|
|
4530
|
+
queryParams = body['_query'];
|
|
4531
|
+
delete body['config'];
|
|
4532
|
+
delete body['_url'];
|
|
4533
|
+
delete body['_query'];
|
|
4534
|
+
response = this.apiClient
|
|
4535
|
+
.request({
|
|
4536
|
+
path: path,
|
|
4537
|
+
queryParams: queryParams,
|
|
4538
|
+
body: JSON.stringify(body),
|
|
4539
|
+
httpMethod: 'DELETE',
|
|
4540
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4541
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4542
|
+
})
|
|
4543
|
+
.then((httpResponse) => {
|
|
4544
|
+
return httpResponse.json();
|
|
4545
|
+
});
|
|
4546
|
+
return response.then((apiResponse) => {
|
|
4547
|
+
const resp = deleteResourceJobFromVertex(apiResponse);
|
|
4548
|
+
return resp;
|
|
4549
|
+
});
|
|
4550
|
+
}
|
|
4551
|
+
else {
|
|
4552
|
+
const body = deleteBatchJobParametersToMldev(this.apiClient, params);
|
|
4553
|
+
path = formatMap('batches/{name}', body['_url']);
|
|
4554
|
+
queryParams = body['_query'];
|
|
4555
|
+
delete body['config'];
|
|
4556
|
+
delete body['_url'];
|
|
4557
|
+
delete body['_query'];
|
|
4558
|
+
response = this.apiClient
|
|
4559
|
+
.request({
|
|
4560
|
+
path: path,
|
|
4561
|
+
queryParams: queryParams,
|
|
4562
|
+
body: JSON.stringify(body),
|
|
4563
|
+
httpMethod: 'DELETE',
|
|
4564
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4565
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4566
|
+
})
|
|
4567
|
+
.then((httpResponse) => {
|
|
4568
|
+
return httpResponse.json();
|
|
4569
|
+
});
|
|
4570
|
+
return response.then((apiResponse) => {
|
|
4571
|
+
const resp = deleteResourceJobFromMldev(apiResponse);
|
|
4572
|
+
return resp;
|
|
4573
|
+
});
|
|
4574
|
+
}
|
|
4575
|
+
}
|
|
4400
4576
|
}
|
|
4401
4577
|
|
|
4402
4578
|
/**
|
|
@@ -4651,6 +4827,10 @@ function toolToMldev$3(fromObject) {
|
|
|
4651
4827
|
if (fromCodeExecution != null) {
|
|
4652
4828
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
4653
4829
|
}
|
|
4830
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4831
|
+
if (fromComputerUse != null) {
|
|
4832
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
4833
|
+
}
|
|
4654
4834
|
return toObject;
|
|
4655
4835
|
}
|
|
4656
4836
|
function functionCallingConfigToMldev$1(fromObject) {
|
|
@@ -5141,6 +5321,10 @@ function toolToVertex$2(fromObject) {
|
|
|
5141
5321
|
if (fromCodeExecution != null) {
|
|
5142
5322
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5143
5323
|
}
|
|
5324
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5325
|
+
if (fromComputerUse != null) {
|
|
5326
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5327
|
+
}
|
|
5144
5328
|
return toObject;
|
|
5145
5329
|
}
|
|
5146
5330
|
function functionCallingConfigToVertex$1(fromObject) {
|
|
@@ -7347,6 +7531,10 @@ function toolToMldev$2(fromObject) {
|
|
|
7347
7531
|
if (fromCodeExecution != null) {
|
|
7348
7532
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
7349
7533
|
}
|
|
7534
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7535
|
+
if (fromComputerUse != null) {
|
|
7536
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
7537
|
+
}
|
|
7350
7538
|
return toObject;
|
|
7351
7539
|
}
|
|
7352
7540
|
function toolToVertex$1(fromObject) {
|
|
@@ -7397,6 +7585,10 @@ function toolToVertex$1(fromObject) {
|
|
|
7397
7585
|
if (fromCodeExecution != null) {
|
|
7398
7586
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
7399
7587
|
}
|
|
7588
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7589
|
+
if (fromComputerUse != null) {
|
|
7590
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
7591
|
+
}
|
|
7400
7592
|
return toObject;
|
|
7401
7593
|
}
|
|
7402
7594
|
function sessionResumptionConfigToMldev$1(fromObject) {
|
|
@@ -7892,8 +8084,9 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
|
|
|
7892
8084
|
if (fromMedia != null) {
|
|
7893
8085
|
setValueByPath(toObject, ['mediaChunks'], tBlobs(fromMedia));
|
|
7894
8086
|
}
|
|
7895
|
-
|
|
7896
|
-
|
|
8087
|
+
const fromAudio = getValueByPath(fromObject, ['audio']);
|
|
8088
|
+
if (fromAudio != null) {
|
|
8089
|
+
setValueByPath(toObject, ['audio'], tAudioBlob(fromAudio));
|
|
7897
8090
|
}
|
|
7898
8091
|
const fromAudioStreamEnd = getValueByPath(fromObject, [
|
|
7899
8092
|
'audioStreamEnd',
|
|
@@ -7901,11 +8094,13 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
|
|
|
7901
8094
|
if (fromAudioStreamEnd != null) {
|
|
7902
8095
|
setValueByPath(toObject, ['audioStreamEnd'], fromAudioStreamEnd);
|
|
7903
8096
|
}
|
|
7904
|
-
|
|
7905
|
-
|
|
8097
|
+
const fromVideo = getValueByPath(fromObject, ['video']);
|
|
8098
|
+
if (fromVideo != null) {
|
|
8099
|
+
setValueByPath(toObject, ['video'], tImageBlob(fromVideo));
|
|
7906
8100
|
}
|
|
7907
|
-
|
|
7908
|
-
|
|
8101
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
8102
|
+
if (fromText != null) {
|
|
8103
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
7909
8104
|
}
|
|
7910
8105
|
const fromActivityStart = getValueByPath(fromObject, [
|
|
7911
8106
|
'activityStart',
|
|
@@ -8061,8 +8256,12 @@ function liveServerSetupCompleteFromMldev() {
|
|
|
8061
8256
|
const toObject = {};
|
|
8062
8257
|
return toObject;
|
|
8063
8258
|
}
|
|
8064
|
-
function liveServerSetupCompleteFromVertex() {
|
|
8259
|
+
function liveServerSetupCompleteFromVertex(fromObject) {
|
|
8065
8260
|
const toObject = {};
|
|
8261
|
+
const fromSessionId = getValueByPath(fromObject, ['sessionId']);
|
|
8262
|
+
if (fromSessionId != null) {
|
|
8263
|
+
setValueByPath(toObject, ['sessionId'], fromSessionId);
|
|
8264
|
+
}
|
|
8066
8265
|
return toObject;
|
|
8067
8266
|
}
|
|
8068
8267
|
function videoMetadataFromMldev$1(fromObject) {
|
|
@@ -8815,7 +9014,7 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
8815
9014
|
'setupComplete',
|
|
8816
9015
|
]);
|
|
8817
9016
|
if (fromSetupComplete != null) {
|
|
8818
|
-
setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex());
|
|
9017
|
+
setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex(fromSetupComplete));
|
|
8819
9018
|
}
|
|
8820
9019
|
const fromServerContent = getValueByPath(fromObject, [
|
|
8821
9020
|
'serverContent',
|
|
@@ -9383,6 +9582,10 @@ function toolToMldev$1(fromObject) {
|
|
|
9383
9582
|
if (fromCodeExecution != null) {
|
|
9384
9583
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
9385
9584
|
}
|
|
9585
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
9586
|
+
if (fromComputerUse != null) {
|
|
9587
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
9588
|
+
}
|
|
9386
9589
|
return toObject;
|
|
9387
9590
|
}
|
|
9388
9591
|
function functionCallingConfigToMldev(fromObject) {
|
|
@@ -10472,6 +10675,10 @@ function toolToVertex(fromObject) {
|
|
|
10472
10675
|
if (fromCodeExecution != null) {
|
|
10473
10676
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
10474
10677
|
}
|
|
10678
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10679
|
+
if (fromComputerUse != null) {
|
|
10680
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
10681
|
+
}
|
|
10475
10682
|
return toObject;
|
|
10476
10683
|
}
|
|
10477
10684
|
function functionCallingConfigToVertex(fromObject) {
|
|
@@ -11855,7 +12062,7 @@ function modelFromMldev(fromObject) {
|
|
|
11855
12062
|
}
|
|
11856
12063
|
return toObject;
|
|
11857
12064
|
}
|
|
11858
|
-
function listModelsResponseFromMldev(
|
|
12065
|
+
function listModelsResponseFromMldev(fromObject) {
|
|
11859
12066
|
const toObject = {};
|
|
11860
12067
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
11861
12068
|
'nextPageToken',
|
|
@@ -12499,7 +12706,7 @@ function modelFromVertex(fromObject) {
|
|
|
12499
12706
|
}
|
|
12500
12707
|
return toObject;
|
|
12501
12708
|
}
|
|
12502
|
-
function listModelsResponseFromVertex(
|
|
12709
|
+
function listModelsResponseFromVertex(fromObject) {
|
|
12503
12710
|
const toObject = {};
|
|
12504
12711
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
12505
12712
|
'nextPageToken',
|
|
@@ -12625,7 +12832,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12625
12832
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12626
12833
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12627
12834
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12628
|
-
const SDK_VERSION = '1.
|
|
12835
|
+
const SDK_VERSION = '1.8.0'; // x-release-please-version
|
|
12629
12836
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12630
12837
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12631
12838
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -14959,7 +15166,7 @@ class Models extends BaseModule {
|
|
|
14959
15166
|
return httpResponse.json();
|
|
14960
15167
|
});
|
|
14961
15168
|
return response.then((apiResponse) => {
|
|
14962
|
-
const resp = listModelsResponseFromVertex(
|
|
15169
|
+
const resp = listModelsResponseFromVertex(apiResponse);
|
|
14963
15170
|
const typedResp = new ListModelsResponse();
|
|
14964
15171
|
Object.assign(typedResp, resp);
|
|
14965
15172
|
return typedResp;
|
|
@@ -14985,7 +15192,7 @@ class Models extends BaseModule {
|
|
|
14985
15192
|
return httpResponse.json();
|
|
14986
15193
|
});
|
|
14987
15194
|
return response.then((apiResponse) => {
|
|
14988
|
-
const resp = listModelsResponseFromMldev(
|
|
15195
|
+
const resp = listModelsResponseFromMldev(apiResponse);
|
|
14989
15196
|
const typedResp = new ListModelsResponse();
|
|
14990
15197
|
Object.assign(typedResp, resp);
|
|
14991
15198
|
return typedResp;
|
|
@@ -15995,6 +16202,10 @@ function toolToMldev(fromObject) {
|
|
|
15995
16202
|
if (fromCodeExecution != null) {
|
|
15996
16203
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
15997
16204
|
}
|
|
16205
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
16206
|
+
if (fromComputerUse != null) {
|
|
16207
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
16208
|
+
}
|
|
15998
16209
|
return toObject;
|
|
15999
16210
|
}
|
|
16000
16211
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
@@ -16759,6 +16970,9 @@ function tuningDatasetToMldev(fromObject) {
|
|
|
16759
16970
|
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
16760
16971
|
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
16761
16972
|
}
|
|
16973
|
+
if (getValueByPath(fromObject, ['vertexDatasetResource']) !== undefined) {
|
|
16974
|
+
throw new Error('vertexDatasetResource parameter is not supported in Gemini API.');
|
|
16975
|
+
}
|
|
16762
16976
|
const fromExamples = getValueByPath(fromObject, ['examples']);
|
|
16763
16977
|
if (fromExamples != null) {
|
|
16764
16978
|
let transformedList = fromExamples;
|
|
@@ -16872,17 +17086,29 @@ function tuningDatasetToVertex(fromObject, parentObject) {
|
|
|
16872
17086
|
if (parentObject !== undefined && fromGcsUri != null) {
|
|
16873
17087
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
16874
17088
|
}
|
|
17089
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
17090
|
+
'vertexDatasetResource',
|
|
17091
|
+
]);
|
|
17092
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
17093
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
17094
|
+
}
|
|
16875
17095
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
16876
17096
|
throw new Error('examples parameter is not supported in Vertex AI.');
|
|
16877
17097
|
}
|
|
16878
17098
|
return toObject;
|
|
16879
17099
|
}
|
|
16880
|
-
function tuningValidationDatasetToVertex(fromObject) {
|
|
17100
|
+
function tuningValidationDatasetToVertex(fromObject, parentObject) {
|
|
16881
17101
|
const toObject = {};
|
|
16882
17102
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
16883
17103
|
if (fromGcsUri != null) {
|
|
16884
17104
|
setValueByPath(toObject, ['validationDatasetUri'], fromGcsUri);
|
|
16885
17105
|
}
|
|
17106
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
17107
|
+
'vertexDatasetResource',
|
|
17108
|
+
]);
|
|
17109
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
17110
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
17111
|
+
}
|
|
16886
17112
|
return toObject;
|
|
16887
17113
|
}
|
|
16888
17114
|
function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -16891,7 +17117,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
16891
17117
|
'validationDataset',
|
|
16892
17118
|
]);
|
|
16893
17119
|
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
16894
|
-
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
17120
|
+
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset, toObject));
|
|
16895
17121
|
}
|
|
16896
17122
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
16897
17123
|
'tunedModelDisplayName',
|
|
@@ -17023,6 +17249,14 @@ function tuningJobFromMldev(fromObject) {
|
|
|
17023
17249
|
if (fromPipelineJob != null) {
|
|
17024
17250
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
17025
17251
|
}
|
|
17252
|
+
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17253
|
+
if (fromSatisfiesPzi != null) {
|
|
17254
|
+
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17255
|
+
}
|
|
17256
|
+
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17257
|
+
if (fromSatisfiesPzs != null) {
|
|
17258
|
+
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17259
|
+
}
|
|
17026
17260
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
17027
17261
|
'serviceAccount',
|
|
17028
17262
|
]);
|
|
@@ -17203,6 +17437,14 @@ function tuningJobFromVertex(fromObject) {
|
|
|
17203
17437
|
if (fromPipelineJob != null) {
|
|
17204
17438
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
17205
17439
|
}
|
|
17440
|
+
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17441
|
+
if (fromSatisfiesPzi != null) {
|
|
17442
|
+
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17443
|
+
}
|
|
17444
|
+
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17445
|
+
if (fromSatisfiesPzs != null) {
|
|
17446
|
+
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17447
|
+
}
|
|
17206
17448
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
17207
17449
|
'serviceAccount',
|
|
17208
17450
|
]);
|
|
@@ -17889,5 +18131,5 @@ function getApiKeyFromEnv() {
|
|
|
17889
18131
|
return envGoogleApiKey || envGeminiApiKey;
|
|
17890
18132
|
}
|
|
17891
18133
|
|
|
17892
|
-
export { ActivityHandling, AdapterSize, ApiError, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
18134
|
+
export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
17893
18135
|
//# sourceMappingURL=index.mjs.map
|