@google/genai 0.3.1 → 0.4.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 +1 -1
- package/dist/genai.d.ts +21 -12
- package/dist/index.js +101 -221
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +102 -221
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +101 -221
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +21 -12
- package/dist/web/index.mjs +105 -221
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +21 -12
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -352,9 +352,6 @@ function processSchema(apiClient, schema) {
|
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
if ('anyOf' in schema) {
|
|
355
|
-
if (!apiClient.isVertexAI()) {
|
|
356
|
-
throw new Error('AnyOf is not supported in the response schema for the Gemini API.');
|
|
357
|
-
}
|
|
358
355
|
if (schema['anyOf'] !== undefined) {
|
|
359
356
|
for (const subSchema of schema['anyOf']) {
|
|
360
357
|
processSchema(apiClient, subSchema);
|
|
@@ -908,17 +905,6 @@ function createPartFromBase64(data, mimeType) {
|
|
|
908
905
|
},
|
|
909
906
|
};
|
|
910
907
|
}
|
|
911
|
-
/**
|
|
912
|
-
* Creates a `Part` object from the `startOffset` and `endOffset` of a `VideoMetadata` object.
|
|
913
|
-
*/
|
|
914
|
-
function createPartFromVideoMetadata(startOffset, endOffset) {
|
|
915
|
-
return {
|
|
916
|
-
videoMetadata: {
|
|
917
|
-
startOffset: startOffset,
|
|
918
|
-
endOffset: endOffset,
|
|
919
|
-
},
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
908
|
/**
|
|
923
909
|
* Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
|
|
924
910
|
*/
|
|
@@ -1456,7 +1442,7 @@ class Caches extends BaseModule {
|
|
|
1456
1442
|
return httpResponse.json();
|
|
1457
1443
|
});
|
|
1458
1444
|
return response.then((apiResponse) => {
|
|
1459
|
-
const resp = deleteCachedContentResponseFromVertex(
|
|
1445
|
+
const resp = deleteCachedContentResponseFromVertex();
|
|
1460
1446
|
const typedResp = new DeleteCachedContentResponse();
|
|
1461
1447
|
Object.assign(typedResp, resp);
|
|
1462
1448
|
return typedResp;
|
|
@@ -1481,7 +1467,7 @@ class Caches extends BaseModule {
|
|
|
1481
1467
|
return httpResponse.json();
|
|
1482
1468
|
});
|
|
1483
1469
|
return response.then((apiResponse) => {
|
|
1484
|
-
const resp = deleteCachedContentResponseFromMldev(
|
|
1470
|
+
const resp = deleteCachedContentResponseFromMldev();
|
|
1485
1471
|
const typedResp = new DeleteCachedContentResponse();
|
|
1486
1472
|
Object.assign(typedResp, resp);
|
|
1487
1473
|
return typedResp;
|
|
@@ -1754,18 +1740,10 @@ function schemaToVertex$1(apiClient, fromObject) {
|
|
|
1754
1740
|
if (fromPattern != null) {
|
|
1755
1741
|
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
1756
1742
|
}
|
|
1757
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
1758
|
-
if (fromMinimum != null) {
|
|
1759
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
1760
|
-
}
|
|
1761
1743
|
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
1762
1744
|
if (fromDefault != null) {
|
|
1763
1745
|
setValueByPath(toObject, ['default'], fromDefault);
|
|
1764
1746
|
}
|
|
1765
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
1766
|
-
if (fromAnyOf != null) {
|
|
1767
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
1768
|
-
}
|
|
1769
1747
|
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
1770
1748
|
if (fromMaxLength != null) {
|
|
1771
1749
|
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
@@ -1784,16 +1762,16 @@ function schemaToVertex$1(apiClient, fromObject) {
|
|
|
1784
1762
|
if (fromMinProperties != null) {
|
|
1785
1763
|
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
1786
1764
|
}
|
|
1787
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
1788
|
-
if (fromMaximum != null) {
|
|
1789
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
1790
|
-
}
|
|
1791
1765
|
const fromMaxProperties = getValueByPath(fromObject, [
|
|
1792
1766
|
'maxProperties',
|
|
1793
1767
|
]);
|
|
1794
1768
|
if (fromMaxProperties != null) {
|
|
1795
1769
|
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
1796
1770
|
}
|
|
1771
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
1772
|
+
if (fromAnyOf != null) {
|
|
1773
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
1774
|
+
}
|
|
1797
1775
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
1798
1776
|
if (fromDescription != null) {
|
|
1799
1777
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -1814,10 +1792,18 @@ function schemaToVertex$1(apiClient, fromObject) {
|
|
|
1814
1792
|
if (fromMaxItems != null) {
|
|
1815
1793
|
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
1816
1794
|
}
|
|
1795
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
1796
|
+
if (fromMaximum != null) {
|
|
1797
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
1798
|
+
}
|
|
1817
1799
|
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
1818
1800
|
if (fromMinItems != null) {
|
|
1819
1801
|
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
1820
1802
|
}
|
|
1803
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
1804
|
+
if (fromMinimum != null) {
|
|
1805
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
1806
|
+
}
|
|
1821
1807
|
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
1822
1808
|
if (fromNullable != null) {
|
|
1823
1809
|
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
@@ -1881,11 +1867,11 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
|
1881
1867
|
}
|
|
1882
1868
|
return toObject;
|
|
1883
1869
|
}
|
|
1884
|
-
function googleSearchToMldev$1(
|
|
1870
|
+
function googleSearchToMldev$1() {
|
|
1885
1871
|
const toObject = {};
|
|
1886
1872
|
return toObject;
|
|
1887
1873
|
}
|
|
1888
|
-
function googleSearchToVertex$1(
|
|
1874
|
+
function googleSearchToVertex$1() {
|
|
1889
1875
|
const toObject = {};
|
|
1890
1876
|
return toObject;
|
|
1891
1877
|
}
|
|
@@ -2384,11 +2370,11 @@ function cachedContentFromVertex(apiClient, fromObject) {
|
|
|
2384
2370
|
}
|
|
2385
2371
|
return toObject;
|
|
2386
2372
|
}
|
|
2387
|
-
function deleteCachedContentResponseFromMldev(
|
|
2373
|
+
function deleteCachedContentResponseFromMldev() {
|
|
2388
2374
|
const toObject = {};
|
|
2389
2375
|
return toObject;
|
|
2390
2376
|
}
|
|
2391
|
-
function deleteCachedContentResponseFromVertex(
|
|
2377
|
+
function deleteCachedContentResponseFromVertex() {
|
|
2392
2378
|
const toObject = {};
|
|
2393
2379
|
return toObject;
|
|
2394
2380
|
}
|
|
@@ -2805,7 +2791,7 @@ class Chat {
|
|
|
2805
2791
|
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
2806
2792
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
2807
2793
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
2808
|
-
const SDK_VERSION = '0.
|
|
2794
|
+
const SDK_VERSION = '0.4.0'; // x-release-please-version
|
|
2809
2795
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
2810
2796
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
2811
2797
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -3381,34 +3367,12 @@ class Files extends BaseModule {
|
|
|
3381
3367
|
});
|
|
3382
3368
|
}
|
|
3383
3369
|
async listInternal(params) {
|
|
3384
|
-
var _a
|
|
3370
|
+
var _a;
|
|
3385
3371
|
let response;
|
|
3386
3372
|
let path = '';
|
|
3387
3373
|
let queryParams = {};
|
|
3388
3374
|
if (this.apiClient.isVertexAI()) {
|
|
3389
|
-
|
|
3390
|
-
path = formatMap('None', body['_url']);
|
|
3391
|
-
queryParams = body['_query'];
|
|
3392
|
-
delete body['config'];
|
|
3393
|
-
delete body['_url'];
|
|
3394
|
-
delete body['_query'];
|
|
3395
|
-
response = this.apiClient
|
|
3396
|
-
.request({
|
|
3397
|
-
path: path,
|
|
3398
|
-
queryParams: queryParams,
|
|
3399
|
-
body: JSON.stringify(body),
|
|
3400
|
-
httpMethod: 'GET',
|
|
3401
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3402
|
-
})
|
|
3403
|
-
.then((httpResponse) => {
|
|
3404
|
-
return httpResponse.json();
|
|
3405
|
-
});
|
|
3406
|
-
return response.then((apiResponse) => {
|
|
3407
|
-
const resp = listFilesResponseFromVertex(this.apiClient);
|
|
3408
|
-
const typedResp = new ListFilesResponse();
|
|
3409
|
-
Object.assign(typedResp, resp);
|
|
3410
|
-
return typedResp;
|
|
3411
|
-
});
|
|
3375
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
3412
3376
|
}
|
|
3413
3377
|
else {
|
|
3414
3378
|
const body = listFilesParametersToMldev(this.apiClient, params);
|
|
@@ -3423,7 +3387,7 @@ class Files extends BaseModule {
|
|
|
3423
3387
|
queryParams: queryParams,
|
|
3424
3388
|
body: JSON.stringify(body),
|
|
3425
3389
|
httpMethod: 'GET',
|
|
3426
|
-
httpOptions: (
|
|
3390
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3427
3391
|
})
|
|
3428
3392
|
.then((httpResponse) => {
|
|
3429
3393
|
return httpResponse.json();
|
|
@@ -3437,34 +3401,12 @@ class Files extends BaseModule {
|
|
|
3437
3401
|
}
|
|
3438
3402
|
}
|
|
3439
3403
|
async createInternal(params) {
|
|
3440
|
-
var _a
|
|
3404
|
+
var _a;
|
|
3441
3405
|
let response;
|
|
3442
3406
|
let path = '';
|
|
3443
3407
|
let queryParams = {};
|
|
3444
3408
|
if (this.apiClient.isVertexAI()) {
|
|
3445
|
-
|
|
3446
|
-
path = formatMap('', body['_url']);
|
|
3447
|
-
queryParams = body['_query'];
|
|
3448
|
-
delete body['config'];
|
|
3449
|
-
delete body['_url'];
|
|
3450
|
-
delete body['_query'];
|
|
3451
|
-
response = this.apiClient
|
|
3452
|
-
.request({
|
|
3453
|
-
path: path,
|
|
3454
|
-
queryParams: queryParams,
|
|
3455
|
-
body: JSON.stringify(body),
|
|
3456
|
-
httpMethod: 'POST',
|
|
3457
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3458
|
-
})
|
|
3459
|
-
.then((httpResponse) => {
|
|
3460
|
-
return httpResponse.json();
|
|
3461
|
-
});
|
|
3462
|
-
return response.then((apiResponse) => {
|
|
3463
|
-
const resp = createFileResponseFromVertex(this.apiClient, apiResponse);
|
|
3464
|
-
const typedResp = new CreateFileResponse();
|
|
3465
|
-
Object.assign(typedResp, resp);
|
|
3466
|
-
return typedResp;
|
|
3467
|
-
});
|
|
3409
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
3468
3410
|
}
|
|
3469
3411
|
else {
|
|
3470
3412
|
const body = createFileParametersToMldev(this.apiClient, params);
|
|
@@ -3479,7 +3421,7 @@ class Files extends BaseModule {
|
|
|
3479
3421
|
queryParams: queryParams,
|
|
3480
3422
|
body: JSON.stringify(body),
|
|
3481
3423
|
httpMethod: 'POST',
|
|
3482
|
-
httpOptions: (
|
|
3424
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3483
3425
|
})
|
|
3484
3426
|
.then((httpResponse) => {
|
|
3485
3427
|
return httpResponse.json();
|
|
@@ -3508,32 +3450,12 @@ class Files extends BaseModule {
|
|
|
3508
3450
|
* ```
|
|
3509
3451
|
*/
|
|
3510
3452
|
async get(params) {
|
|
3511
|
-
var _a
|
|
3453
|
+
var _a;
|
|
3512
3454
|
let response;
|
|
3513
3455
|
let path = '';
|
|
3514
3456
|
let queryParams = {};
|
|
3515
3457
|
if (this.apiClient.isVertexAI()) {
|
|
3516
|
-
|
|
3517
|
-
path = formatMap('None', body['_url']);
|
|
3518
|
-
queryParams = body['_query'];
|
|
3519
|
-
delete body['config'];
|
|
3520
|
-
delete body['_url'];
|
|
3521
|
-
delete body['_query'];
|
|
3522
|
-
response = this.apiClient
|
|
3523
|
-
.request({
|
|
3524
|
-
path: path,
|
|
3525
|
-
queryParams: queryParams,
|
|
3526
|
-
body: JSON.stringify(body),
|
|
3527
|
-
httpMethod: 'GET',
|
|
3528
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3529
|
-
})
|
|
3530
|
-
.then((httpResponse) => {
|
|
3531
|
-
return httpResponse.json();
|
|
3532
|
-
});
|
|
3533
|
-
return response.then((apiResponse) => {
|
|
3534
|
-
const resp = fileFromVertex(this.apiClient);
|
|
3535
|
-
return resp;
|
|
3536
|
-
});
|
|
3458
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
3537
3459
|
}
|
|
3538
3460
|
else {
|
|
3539
3461
|
const body = getFileParametersToMldev(this.apiClient, params);
|
|
@@ -3548,7 +3470,7 @@ class Files extends BaseModule {
|
|
|
3548
3470
|
queryParams: queryParams,
|
|
3549
3471
|
body: JSON.stringify(body),
|
|
3550
3472
|
httpMethod: 'GET',
|
|
3551
|
-
httpOptions: (
|
|
3473
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3552
3474
|
})
|
|
3553
3475
|
.then((httpResponse) => {
|
|
3554
3476
|
return httpResponse.json();
|
|
@@ -3580,13 +3502,6 @@ function listFilesParametersToMldev(apiClient, fromObject) {
|
|
|
3580
3502
|
}
|
|
3581
3503
|
return toObject;
|
|
3582
3504
|
}
|
|
3583
|
-
function listFilesParametersToVertex(apiClient, fromObject) {
|
|
3584
|
-
const toObject = {};
|
|
3585
|
-
if (getValueByPath(fromObject, ['config']) !== undefined) {
|
|
3586
|
-
throw new Error('config parameter is not supported in Vertex AI.');
|
|
3587
|
-
}
|
|
3588
|
-
return toObject;
|
|
3589
|
-
}
|
|
3590
3505
|
function fileStatusToMldev(apiClient, fromObject) {
|
|
3591
3506
|
const toObject = {};
|
|
3592
3507
|
const fromDetails = getValueByPath(fromObject, ['details']);
|
|
@@ -3679,16 +3594,6 @@ function createFileParametersToMldev(apiClient, fromObject) {
|
|
|
3679
3594
|
}
|
|
3680
3595
|
return toObject;
|
|
3681
3596
|
}
|
|
3682
|
-
function createFileParametersToVertex(apiClient, fromObject) {
|
|
3683
|
-
const toObject = {};
|
|
3684
|
-
if (getValueByPath(fromObject, ['file']) !== undefined) {
|
|
3685
|
-
throw new Error('file parameter is not supported in Vertex AI.');
|
|
3686
|
-
}
|
|
3687
|
-
if (getValueByPath(fromObject, ['config']) !== undefined) {
|
|
3688
|
-
throw new Error('config parameter is not supported in Vertex AI.');
|
|
3689
|
-
}
|
|
3690
|
-
return toObject;
|
|
3691
|
-
}
|
|
3692
3597
|
function getFileParametersToMldev(apiClient, fromObject) {
|
|
3693
3598
|
const toObject = {};
|
|
3694
3599
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -3701,16 +3606,6 @@ function getFileParametersToMldev(apiClient, fromObject) {
|
|
|
3701
3606
|
}
|
|
3702
3607
|
return toObject;
|
|
3703
3608
|
}
|
|
3704
|
-
function getFileParametersToVertex(apiClient, fromObject) {
|
|
3705
|
-
const toObject = {};
|
|
3706
|
-
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
3707
|
-
throw new Error('name parameter is not supported in Vertex AI.');
|
|
3708
|
-
}
|
|
3709
|
-
if (getValueByPath(fromObject, ['config']) !== undefined) {
|
|
3710
|
-
throw new Error('config parameter is not supported in Vertex AI.');
|
|
3711
|
-
}
|
|
3712
|
-
return toObject;
|
|
3713
|
-
}
|
|
3714
3609
|
function fileStatusFromMldev(apiClient, fromObject) {
|
|
3715
3610
|
const toObject = {};
|
|
3716
3611
|
const fromDetails = getValueByPath(fromObject, ['details']);
|
|
@@ -3791,10 +3686,6 @@ function fileFromMldev(apiClient, fromObject) {
|
|
|
3791
3686
|
}
|
|
3792
3687
|
return toObject;
|
|
3793
3688
|
}
|
|
3794
|
-
function fileFromVertex(apiClient, fromObject) {
|
|
3795
|
-
const toObject = {};
|
|
3796
|
-
return toObject;
|
|
3797
|
-
}
|
|
3798
3689
|
function listFilesResponseFromMldev(apiClient, fromObject) {
|
|
3799
3690
|
const toObject = {};
|
|
3800
3691
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
@@ -3816,10 +3707,6 @@ function listFilesResponseFromMldev(apiClient, fromObject) {
|
|
|
3816
3707
|
}
|
|
3817
3708
|
return toObject;
|
|
3818
3709
|
}
|
|
3819
|
-
function listFilesResponseFromVertex(apiClient, fromObject) {
|
|
3820
|
-
const toObject = {};
|
|
3821
|
-
return toObject;
|
|
3822
|
-
}
|
|
3823
3710
|
function createFileResponseFromMldev(apiClient, fromObject) {
|
|
3824
3711
|
const toObject = {};
|
|
3825
3712
|
const fromHttpHeaders = getValueByPath(fromObject, ['httpHeaders']);
|
|
@@ -3828,14 +3715,6 @@ function createFileResponseFromMldev(apiClient, fromObject) {
|
|
|
3828
3715
|
}
|
|
3829
3716
|
return toObject;
|
|
3830
3717
|
}
|
|
3831
|
-
function createFileResponseFromVertex(apiClient, fromObject) {
|
|
3832
|
-
const toObject = {};
|
|
3833
|
-
const fromHttpHeaders = getValueByPath(fromObject, ['httpHeaders']);
|
|
3834
|
-
if (fromHttpHeaders != null) {
|
|
3835
|
-
setValueByPath(toObject, ['httpHeaders'], fromHttpHeaders);
|
|
3836
|
-
}
|
|
3837
|
-
return toObject;
|
|
3838
|
-
}
|
|
3839
3718
|
|
|
3840
3719
|
/**
|
|
3841
3720
|
* @license
|
|
@@ -4315,7 +4194,7 @@ class Models extends BaseModule {
|
|
|
4315
4194
|
* ```
|
|
4316
4195
|
*/
|
|
4317
4196
|
async computeTokens(params) {
|
|
4318
|
-
var _a
|
|
4197
|
+
var _a;
|
|
4319
4198
|
let response;
|
|
4320
4199
|
let path = '';
|
|
4321
4200
|
let queryParams = {};
|
|
@@ -4345,29 +4224,7 @@ class Models extends BaseModule {
|
|
|
4345
4224
|
});
|
|
4346
4225
|
}
|
|
4347
4226
|
else {
|
|
4348
|
-
|
|
4349
|
-
path = formatMap('None', body['_url']);
|
|
4350
|
-
queryParams = body['_query'];
|
|
4351
|
-
delete body['config'];
|
|
4352
|
-
delete body['_url'];
|
|
4353
|
-
delete body['_query'];
|
|
4354
|
-
response = this.apiClient
|
|
4355
|
-
.request({
|
|
4356
|
-
path: path,
|
|
4357
|
-
queryParams: queryParams,
|
|
4358
|
-
body: JSON.stringify(body),
|
|
4359
|
-
httpMethod: 'POST',
|
|
4360
|
-
httpOptions: (_b = params.config) === null || _b === void 0 ? void 0 : _b.httpOptions,
|
|
4361
|
-
})
|
|
4362
|
-
.then((httpResponse) => {
|
|
4363
|
-
return httpResponse.json();
|
|
4364
|
-
});
|
|
4365
|
-
return response.then((apiResponse) => {
|
|
4366
|
-
const resp = computeTokensResponseFromMldev(this.apiClient, apiResponse);
|
|
4367
|
-
const typedResp = new ComputeTokensResponse();
|
|
4368
|
-
Object.assign(typedResp, resp);
|
|
4369
|
-
return typedResp;
|
|
4370
|
-
});
|
|
4227
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
4371
4228
|
}
|
|
4372
4229
|
}
|
|
4373
4230
|
}
|
|
@@ -4512,15 +4369,9 @@ function schemaToMldev(apiClient, fromObject) {
|
|
|
4512
4369
|
if (getValueByPath(fromObject, ['pattern']) !== undefined) {
|
|
4513
4370
|
throw new Error('pattern parameter is not supported in Gemini API.');
|
|
4514
4371
|
}
|
|
4515
|
-
if (getValueByPath(fromObject, ['minimum']) !== undefined) {
|
|
4516
|
-
throw new Error('minimum parameter is not supported in Gemini API.');
|
|
4517
|
-
}
|
|
4518
4372
|
if (getValueByPath(fromObject, ['default']) !== undefined) {
|
|
4519
4373
|
throw new Error('default parameter is not supported in Gemini API.');
|
|
4520
4374
|
}
|
|
4521
|
-
if (getValueByPath(fromObject, ['anyOf']) !== undefined) {
|
|
4522
|
-
throw new Error('anyOf parameter is not supported in Gemini API.');
|
|
4523
|
-
}
|
|
4524
4375
|
if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
|
|
4525
4376
|
throw new Error('maxLength parameter is not supported in Gemini API.');
|
|
4526
4377
|
}
|
|
@@ -4533,12 +4384,13 @@ function schemaToMldev(apiClient, fromObject) {
|
|
|
4533
4384
|
if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
|
|
4534
4385
|
throw new Error('minProperties parameter is not supported in Gemini API.');
|
|
4535
4386
|
}
|
|
4536
|
-
if (getValueByPath(fromObject, ['maximum']) !== undefined) {
|
|
4537
|
-
throw new Error('maximum parameter is not supported in Gemini API.');
|
|
4538
|
-
}
|
|
4539
4387
|
if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
|
|
4540
4388
|
throw new Error('maxProperties parameter is not supported in Gemini API.');
|
|
4541
4389
|
}
|
|
4390
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
4391
|
+
if (fromAnyOf != null) {
|
|
4392
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
4393
|
+
}
|
|
4542
4394
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
4543
4395
|
if (fromDescription != null) {
|
|
4544
4396
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -4559,10 +4411,18 @@ function schemaToMldev(apiClient, fromObject) {
|
|
|
4559
4411
|
if (fromMaxItems != null) {
|
|
4560
4412
|
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
4561
4413
|
}
|
|
4414
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
4415
|
+
if (fromMaximum != null) {
|
|
4416
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
4417
|
+
}
|
|
4562
4418
|
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
4563
4419
|
if (fromMinItems != null) {
|
|
4564
4420
|
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
4565
4421
|
}
|
|
4422
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
4423
|
+
if (fromMinimum != null) {
|
|
4424
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
4425
|
+
}
|
|
4566
4426
|
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
4567
4427
|
if (fromNullable != null) {
|
|
4568
4428
|
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
@@ -4597,18 +4457,10 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
4597
4457
|
if (fromPattern != null) {
|
|
4598
4458
|
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
4599
4459
|
}
|
|
4600
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
4601
|
-
if (fromMinimum != null) {
|
|
4602
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
4603
|
-
}
|
|
4604
4460
|
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
4605
4461
|
if (fromDefault != null) {
|
|
4606
4462
|
setValueByPath(toObject, ['default'], fromDefault);
|
|
4607
4463
|
}
|
|
4608
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
4609
|
-
if (fromAnyOf != null) {
|
|
4610
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
4611
|
-
}
|
|
4612
4464
|
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
4613
4465
|
if (fromMaxLength != null) {
|
|
4614
4466
|
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
@@ -4627,16 +4479,16 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
4627
4479
|
if (fromMinProperties != null) {
|
|
4628
4480
|
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
4629
4481
|
}
|
|
4630
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
4631
|
-
if (fromMaximum != null) {
|
|
4632
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
4633
|
-
}
|
|
4634
4482
|
const fromMaxProperties = getValueByPath(fromObject, [
|
|
4635
4483
|
'maxProperties',
|
|
4636
4484
|
]);
|
|
4637
4485
|
if (fromMaxProperties != null) {
|
|
4638
4486
|
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
4639
4487
|
}
|
|
4488
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
4489
|
+
if (fromAnyOf != null) {
|
|
4490
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
4491
|
+
}
|
|
4640
4492
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
4641
4493
|
if (fromDescription != null) {
|
|
4642
4494
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -4657,10 +4509,18 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
4657
4509
|
if (fromMaxItems != null) {
|
|
4658
4510
|
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
4659
4511
|
}
|
|
4512
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
4513
|
+
if (fromMaximum != null) {
|
|
4514
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
4515
|
+
}
|
|
4660
4516
|
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
4661
4517
|
if (fromMinItems != null) {
|
|
4662
4518
|
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
4663
4519
|
}
|
|
4520
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
4521
|
+
if (fromMinimum != null) {
|
|
4522
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
4523
|
+
}
|
|
4664
4524
|
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
4665
4525
|
if (fromNullable != null) {
|
|
4666
4526
|
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
@@ -4755,11 +4615,11 @@ function functionDeclarationToVertex(apiClient, fromObject) {
|
|
|
4755
4615
|
}
|
|
4756
4616
|
return toObject;
|
|
4757
4617
|
}
|
|
4758
|
-
function googleSearchToMldev(
|
|
4618
|
+
function googleSearchToMldev() {
|
|
4759
4619
|
const toObject = {};
|
|
4760
4620
|
return toObject;
|
|
4761
4621
|
}
|
|
4762
|
-
function googleSearchToVertex(
|
|
4622
|
+
function googleSearchToVertex() {
|
|
4763
4623
|
const toObject = {};
|
|
4764
4624
|
return toObject;
|
|
4765
4625
|
}
|
|
@@ -5708,21 +5568,6 @@ function countTokensParametersToVertex(apiClient, fromObject) {
|
|
|
5708
5568
|
}
|
|
5709
5569
|
return toObject;
|
|
5710
5570
|
}
|
|
5711
|
-
function computeTokensParametersToMldev(apiClient, fromObject) {
|
|
5712
|
-
const toObject = {};
|
|
5713
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
5714
|
-
if (fromModel != null) {
|
|
5715
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
5716
|
-
}
|
|
5717
|
-
if (getValueByPath(fromObject, ['contents']) !== undefined) {
|
|
5718
|
-
throw new Error('contents parameter is not supported in Gemini API.');
|
|
5719
|
-
}
|
|
5720
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5721
|
-
if (fromConfig != null) {
|
|
5722
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
5723
|
-
}
|
|
5724
|
-
return toObject;
|
|
5725
|
-
}
|
|
5726
5571
|
function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
5727
5572
|
const toObject = {};
|
|
5728
5573
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -6092,7 +5937,7 @@ function contentEmbeddingFromVertex(apiClient, fromObject) {
|
|
|
6092
5937
|
}
|
|
6093
5938
|
return toObject;
|
|
6094
5939
|
}
|
|
6095
|
-
function embedContentMetadataFromMldev(
|
|
5940
|
+
function embedContentMetadataFromMldev() {
|
|
6096
5941
|
const toObject = {};
|
|
6097
5942
|
return toObject;
|
|
6098
5943
|
}
|
|
@@ -6179,6 +6024,42 @@ function imageFromVertex(apiClient, fromObject) {
|
|
|
6179
6024
|
}
|
|
6180
6025
|
return toObject;
|
|
6181
6026
|
}
|
|
6027
|
+
function safetyAttributesFromMldev(apiClient, fromObject) {
|
|
6028
|
+
const toObject = {};
|
|
6029
|
+
const fromCategories = getValueByPath(fromObject, [
|
|
6030
|
+
'safetyAttributes',
|
|
6031
|
+
'categories',
|
|
6032
|
+
]);
|
|
6033
|
+
if (fromCategories != null) {
|
|
6034
|
+
setValueByPath(toObject, ['categories'], fromCategories);
|
|
6035
|
+
}
|
|
6036
|
+
const fromScores = getValueByPath(fromObject, [
|
|
6037
|
+
'safetyAttributes',
|
|
6038
|
+
'scores',
|
|
6039
|
+
]);
|
|
6040
|
+
if (fromScores != null) {
|
|
6041
|
+
setValueByPath(toObject, ['scores'], fromScores);
|
|
6042
|
+
}
|
|
6043
|
+
return toObject;
|
|
6044
|
+
}
|
|
6045
|
+
function safetyAttributesFromVertex(apiClient, fromObject) {
|
|
6046
|
+
const toObject = {};
|
|
6047
|
+
const fromCategories = getValueByPath(fromObject, [
|
|
6048
|
+
'safetyAttributes',
|
|
6049
|
+
'categories',
|
|
6050
|
+
]);
|
|
6051
|
+
if (fromCategories != null) {
|
|
6052
|
+
setValueByPath(toObject, ['categories'], fromCategories);
|
|
6053
|
+
}
|
|
6054
|
+
const fromScores = getValueByPath(fromObject, [
|
|
6055
|
+
'safetyAttributes',
|
|
6056
|
+
'scores',
|
|
6057
|
+
]);
|
|
6058
|
+
if (fromScores != null) {
|
|
6059
|
+
setValueByPath(toObject, ['scores'], fromScores);
|
|
6060
|
+
}
|
|
6061
|
+
return toObject;
|
|
6062
|
+
}
|
|
6182
6063
|
function generatedImageFromMldev(apiClient, fromObject) {
|
|
6183
6064
|
const toObject = {};
|
|
6184
6065
|
const fromImage = getValueByPath(fromObject, ['_self']);
|
|
@@ -6191,6 +6072,10 @@ function generatedImageFromMldev(apiClient, fromObject) {
|
|
|
6191
6072
|
if (fromRaiFilteredReason != null) {
|
|
6192
6073
|
setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
|
|
6193
6074
|
}
|
|
6075
|
+
const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
|
|
6076
|
+
if (fromSafetyAttributes != null) {
|
|
6077
|
+
setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromMldev(apiClient, fromSafetyAttributes));
|
|
6078
|
+
}
|
|
6194
6079
|
return toObject;
|
|
6195
6080
|
}
|
|
6196
6081
|
function generatedImageFromVertex(apiClient, fromObject) {
|
|
@@ -6205,6 +6090,10 @@ function generatedImageFromVertex(apiClient, fromObject) {
|
|
|
6205
6090
|
if (fromRaiFilteredReason != null) {
|
|
6206
6091
|
setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
|
|
6207
6092
|
}
|
|
6093
|
+
const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
|
|
6094
|
+
if (fromSafetyAttributes != null) {
|
|
6095
|
+
setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromVertex(apiClient, fromSafetyAttributes));
|
|
6096
|
+
}
|
|
6208
6097
|
const fromEnhancedPrompt = getValueByPath(fromObject, ['prompt']);
|
|
6209
6098
|
if (fromEnhancedPrompt != null) {
|
|
6210
6099
|
setValueByPath(toObject, ['enhancedPrompt'], fromEnhancedPrompt);
|
|
@@ -6267,14 +6156,6 @@ function countTokensResponseFromVertex(apiClient, fromObject) {
|
|
|
6267
6156
|
}
|
|
6268
6157
|
return toObject;
|
|
6269
6158
|
}
|
|
6270
|
-
function computeTokensResponseFromMldev(apiClient, fromObject) {
|
|
6271
|
-
const toObject = {};
|
|
6272
|
-
const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
|
|
6273
|
-
if (fromTokensInfo != null) {
|
|
6274
|
-
setValueByPath(toObject, ['tokensInfo'], fromTokensInfo);
|
|
6275
|
-
}
|
|
6276
|
-
return toObject;
|
|
6277
|
-
}
|
|
6278
6159
|
function computeTokensResponseFromVertex(apiClient, fromObject) {
|
|
6279
6160
|
const toObject = {};
|
|
6280
6161
|
const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
|
|
@@ -6983,5 +6864,5 @@ class GoogleGenAI {
|
|
|
6983
6864
|
}
|
|
6984
6865
|
}
|
|
6985
6866
|
|
|
6986
|
-
export { BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DynamicRetrievalConfigMode, EmbedContentResponse, FileSource, FileState, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, Live, LiveClientToolResponse, MaskReferenceMode, MediaResolution, Modality, Mode, Models, Outcome, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session, SessionSendToolResponseParameters, State, SubjectReferenceType, Type, contentToMldev$1 as contentToMldev, contentToVertex$1 as contentToVertex, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri,
|
|
6867
|
+
export { BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DynamicRetrievalConfigMode, EmbedContentResponse, FileSource, FileState, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, Live, LiveClientToolResponse, MaskReferenceMode, MediaResolution, Modality, Mode, Models, Outcome, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session, SessionSendToolResponseParameters, State, SubjectReferenceType, Type, contentToMldev$1 as contentToMldev, contentToVertex$1 as contentToVertex, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, toolToMldev$1 as toolToMldev, toolToVertex$1 as toolToVertex };
|
|
6987
6868
|
//# sourceMappingURL=index.mjs.map
|