@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.js
CHANGED
|
@@ -354,9 +354,6 @@ function processSchema(apiClient, schema) {
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
if ('anyOf' in schema) {
|
|
357
|
-
if (!apiClient.isVertexAI()) {
|
|
358
|
-
throw new Error('AnyOf is not supported in the response schema for the Gemini API.');
|
|
359
|
-
}
|
|
360
357
|
if (schema['anyOf'] !== undefined) {
|
|
361
358
|
for (const subSchema of schema['anyOf']) {
|
|
362
359
|
processSchema(apiClient, subSchema);
|
|
@@ -910,17 +907,6 @@ function createPartFromBase64(data, mimeType) {
|
|
|
910
907
|
},
|
|
911
908
|
};
|
|
912
909
|
}
|
|
913
|
-
/**
|
|
914
|
-
* Creates a `Part` object from the `startOffset` and `endOffset` of a `VideoMetadata` object.
|
|
915
|
-
*/
|
|
916
|
-
function createPartFromVideoMetadata(startOffset, endOffset) {
|
|
917
|
-
return {
|
|
918
|
-
videoMetadata: {
|
|
919
|
-
startOffset: startOffset,
|
|
920
|
-
endOffset: endOffset,
|
|
921
|
-
},
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
910
|
/**
|
|
925
911
|
* Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
|
|
926
912
|
*/
|
|
@@ -1458,7 +1444,7 @@ class Caches extends BaseModule {
|
|
|
1458
1444
|
return httpResponse.json();
|
|
1459
1445
|
});
|
|
1460
1446
|
return response.then((apiResponse) => {
|
|
1461
|
-
const resp = deleteCachedContentResponseFromVertex(
|
|
1447
|
+
const resp = deleteCachedContentResponseFromVertex();
|
|
1462
1448
|
const typedResp = new DeleteCachedContentResponse();
|
|
1463
1449
|
Object.assign(typedResp, resp);
|
|
1464
1450
|
return typedResp;
|
|
@@ -1483,7 +1469,7 @@ class Caches extends BaseModule {
|
|
|
1483
1469
|
return httpResponse.json();
|
|
1484
1470
|
});
|
|
1485
1471
|
return response.then((apiResponse) => {
|
|
1486
|
-
const resp = deleteCachedContentResponseFromMldev(
|
|
1472
|
+
const resp = deleteCachedContentResponseFromMldev();
|
|
1487
1473
|
const typedResp = new DeleteCachedContentResponse();
|
|
1488
1474
|
Object.assign(typedResp, resp);
|
|
1489
1475
|
return typedResp;
|
|
@@ -1756,18 +1742,10 @@ function schemaToVertex$1(apiClient, fromObject) {
|
|
|
1756
1742
|
if (fromPattern != null) {
|
|
1757
1743
|
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
1758
1744
|
}
|
|
1759
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
1760
|
-
if (fromMinimum != null) {
|
|
1761
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
1762
|
-
}
|
|
1763
1745
|
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
1764
1746
|
if (fromDefault != null) {
|
|
1765
1747
|
setValueByPath(toObject, ['default'], fromDefault);
|
|
1766
1748
|
}
|
|
1767
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
1768
|
-
if (fromAnyOf != null) {
|
|
1769
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
1770
|
-
}
|
|
1771
1749
|
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
1772
1750
|
if (fromMaxLength != null) {
|
|
1773
1751
|
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
@@ -1786,16 +1764,16 @@ function schemaToVertex$1(apiClient, fromObject) {
|
|
|
1786
1764
|
if (fromMinProperties != null) {
|
|
1787
1765
|
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
1788
1766
|
}
|
|
1789
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
1790
|
-
if (fromMaximum != null) {
|
|
1791
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
1792
|
-
}
|
|
1793
1767
|
const fromMaxProperties = getValueByPath(fromObject, [
|
|
1794
1768
|
'maxProperties',
|
|
1795
1769
|
]);
|
|
1796
1770
|
if (fromMaxProperties != null) {
|
|
1797
1771
|
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
1798
1772
|
}
|
|
1773
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
1774
|
+
if (fromAnyOf != null) {
|
|
1775
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
1776
|
+
}
|
|
1799
1777
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
1800
1778
|
if (fromDescription != null) {
|
|
1801
1779
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -1816,10 +1794,18 @@ function schemaToVertex$1(apiClient, fromObject) {
|
|
|
1816
1794
|
if (fromMaxItems != null) {
|
|
1817
1795
|
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
1818
1796
|
}
|
|
1797
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
1798
|
+
if (fromMaximum != null) {
|
|
1799
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
1800
|
+
}
|
|
1819
1801
|
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
1820
1802
|
if (fromMinItems != null) {
|
|
1821
1803
|
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
1822
1804
|
}
|
|
1805
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
1806
|
+
if (fromMinimum != null) {
|
|
1807
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
1808
|
+
}
|
|
1823
1809
|
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
1824
1810
|
if (fromNullable != null) {
|
|
1825
1811
|
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
@@ -1883,11 +1869,11 @@ function functionDeclarationToVertex$1(apiClient, fromObject) {
|
|
|
1883
1869
|
}
|
|
1884
1870
|
return toObject;
|
|
1885
1871
|
}
|
|
1886
|
-
function googleSearchToMldev$1(
|
|
1872
|
+
function googleSearchToMldev$1() {
|
|
1887
1873
|
const toObject = {};
|
|
1888
1874
|
return toObject;
|
|
1889
1875
|
}
|
|
1890
|
-
function googleSearchToVertex$1(
|
|
1876
|
+
function googleSearchToVertex$1() {
|
|
1891
1877
|
const toObject = {};
|
|
1892
1878
|
return toObject;
|
|
1893
1879
|
}
|
|
@@ -2386,11 +2372,11 @@ function cachedContentFromVertex(apiClient, fromObject) {
|
|
|
2386
2372
|
}
|
|
2387
2373
|
return toObject;
|
|
2388
2374
|
}
|
|
2389
|
-
function deleteCachedContentResponseFromMldev(
|
|
2375
|
+
function deleteCachedContentResponseFromMldev() {
|
|
2390
2376
|
const toObject = {};
|
|
2391
2377
|
return toObject;
|
|
2392
2378
|
}
|
|
2393
|
-
function deleteCachedContentResponseFromVertex(
|
|
2379
|
+
function deleteCachedContentResponseFromVertex() {
|
|
2394
2380
|
const toObject = {};
|
|
2395
2381
|
return toObject;
|
|
2396
2382
|
}
|
|
@@ -2807,7 +2793,7 @@ class Chat {
|
|
|
2807
2793
|
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
2808
2794
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
2809
2795
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
2810
|
-
const SDK_VERSION = '0.
|
|
2796
|
+
const SDK_VERSION = '0.4.0'; // x-release-please-version
|
|
2811
2797
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
2812
2798
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
2813
2799
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -3383,34 +3369,12 @@ class Files extends BaseModule {
|
|
|
3383
3369
|
});
|
|
3384
3370
|
}
|
|
3385
3371
|
async listInternal(params) {
|
|
3386
|
-
var _a
|
|
3372
|
+
var _a;
|
|
3387
3373
|
let response;
|
|
3388
3374
|
let path = '';
|
|
3389
3375
|
let queryParams = {};
|
|
3390
3376
|
if (this.apiClient.isVertexAI()) {
|
|
3391
|
-
|
|
3392
|
-
path = formatMap('None', body['_url']);
|
|
3393
|
-
queryParams = body['_query'];
|
|
3394
|
-
delete body['config'];
|
|
3395
|
-
delete body['_url'];
|
|
3396
|
-
delete body['_query'];
|
|
3397
|
-
response = this.apiClient
|
|
3398
|
-
.request({
|
|
3399
|
-
path: path,
|
|
3400
|
-
queryParams: queryParams,
|
|
3401
|
-
body: JSON.stringify(body),
|
|
3402
|
-
httpMethod: 'GET',
|
|
3403
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3404
|
-
})
|
|
3405
|
-
.then((httpResponse) => {
|
|
3406
|
-
return httpResponse.json();
|
|
3407
|
-
});
|
|
3408
|
-
return response.then((apiResponse) => {
|
|
3409
|
-
const resp = listFilesResponseFromVertex(this.apiClient);
|
|
3410
|
-
const typedResp = new ListFilesResponse();
|
|
3411
|
-
Object.assign(typedResp, resp);
|
|
3412
|
-
return typedResp;
|
|
3413
|
-
});
|
|
3377
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
3414
3378
|
}
|
|
3415
3379
|
else {
|
|
3416
3380
|
const body = listFilesParametersToMldev(this.apiClient, params);
|
|
@@ -3425,7 +3389,7 @@ class Files extends BaseModule {
|
|
|
3425
3389
|
queryParams: queryParams,
|
|
3426
3390
|
body: JSON.stringify(body),
|
|
3427
3391
|
httpMethod: 'GET',
|
|
3428
|
-
httpOptions: (
|
|
3392
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3429
3393
|
})
|
|
3430
3394
|
.then((httpResponse) => {
|
|
3431
3395
|
return httpResponse.json();
|
|
@@ -3439,34 +3403,12 @@ class Files extends BaseModule {
|
|
|
3439
3403
|
}
|
|
3440
3404
|
}
|
|
3441
3405
|
async createInternal(params) {
|
|
3442
|
-
var _a
|
|
3406
|
+
var _a;
|
|
3443
3407
|
let response;
|
|
3444
3408
|
let path = '';
|
|
3445
3409
|
let queryParams = {};
|
|
3446
3410
|
if (this.apiClient.isVertexAI()) {
|
|
3447
|
-
|
|
3448
|
-
path = formatMap('', body['_url']);
|
|
3449
|
-
queryParams = body['_query'];
|
|
3450
|
-
delete body['config'];
|
|
3451
|
-
delete body['_url'];
|
|
3452
|
-
delete body['_query'];
|
|
3453
|
-
response = this.apiClient
|
|
3454
|
-
.request({
|
|
3455
|
-
path: path,
|
|
3456
|
-
queryParams: queryParams,
|
|
3457
|
-
body: JSON.stringify(body),
|
|
3458
|
-
httpMethod: 'POST',
|
|
3459
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3460
|
-
})
|
|
3461
|
-
.then((httpResponse) => {
|
|
3462
|
-
return httpResponse.json();
|
|
3463
|
-
});
|
|
3464
|
-
return response.then((apiResponse) => {
|
|
3465
|
-
const resp = createFileResponseFromVertex(this.apiClient, apiResponse);
|
|
3466
|
-
const typedResp = new CreateFileResponse();
|
|
3467
|
-
Object.assign(typedResp, resp);
|
|
3468
|
-
return typedResp;
|
|
3469
|
-
});
|
|
3411
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
3470
3412
|
}
|
|
3471
3413
|
else {
|
|
3472
3414
|
const body = createFileParametersToMldev(this.apiClient, params);
|
|
@@ -3481,7 +3423,7 @@ class Files extends BaseModule {
|
|
|
3481
3423
|
queryParams: queryParams,
|
|
3482
3424
|
body: JSON.stringify(body),
|
|
3483
3425
|
httpMethod: 'POST',
|
|
3484
|
-
httpOptions: (
|
|
3426
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3485
3427
|
})
|
|
3486
3428
|
.then((httpResponse) => {
|
|
3487
3429
|
return httpResponse.json();
|
|
@@ -3510,32 +3452,12 @@ class Files extends BaseModule {
|
|
|
3510
3452
|
* ```
|
|
3511
3453
|
*/
|
|
3512
3454
|
async get(params) {
|
|
3513
|
-
var _a
|
|
3455
|
+
var _a;
|
|
3514
3456
|
let response;
|
|
3515
3457
|
let path = '';
|
|
3516
3458
|
let queryParams = {};
|
|
3517
3459
|
if (this.apiClient.isVertexAI()) {
|
|
3518
|
-
|
|
3519
|
-
path = formatMap('None', body['_url']);
|
|
3520
|
-
queryParams = body['_query'];
|
|
3521
|
-
delete body['config'];
|
|
3522
|
-
delete body['_url'];
|
|
3523
|
-
delete body['_query'];
|
|
3524
|
-
response = this.apiClient
|
|
3525
|
-
.request({
|
|
3526
|
-
path: path,
|
|
3527
|
-
queryParams: queryParams,
|
|
3528
|
-
body: JSON.stringify(body),
|
|
3529
|
-
httpMethod: 'GET',
|
|
3530
|
-
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3531
|
-
})
|
|
3532
|
-
.then((httpResponse) => {
|
|
3533
|
-
return httpResponse.json();
|
|
3534
|
-
});
|
|
3535
|
-
return response.then((apiResponse) => {
|
|
3536
|
-
const resp = fileFromVertex(this.apiClient);
|
|
3537
|
-
return resp;
|
|
3538
|
-
});
|
|
3460
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
3539
3461
|
}
|
|
3540
3462
|
else {
|
|
3541
3463
|
const body = getFileParametersToMldev(this.apiClient, params);
|
|
@@ -3550,7 +3472,7 @@ class Files extends BaseModule {
|
|
|
3550
3472
|
queryParams: queryParams,
|
|
3551
3473
|
body: JSON.stringify(body),
|
|
3552
3474
|
httpMethod: 'GET',
|
|
3553
|
-
httpOptions: (
|
|
3475
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
3554
3476
|
})
|
|
3555
3477
|
.then((httpResponse) => {
|
|
3556
3478
|
return httpResponse.json();
|
|
@@ -3582,13 +3504,6 @@ function listFilesParametersToMldev(apiClient, fromObject) {
|
|
|
3582
3504
|
}
|
|
3583
3505
|
return toObject;
|
|
3584
3506
|
}
|
|
3585
|
-
function listFilesParametersToVertex(apiClient, fromObject) {
|
|
3586
|
-
const toObject = {};
|
|
3587
|
-
if (getValueByPath(fromObject, ['config']) !== undefined) {
|
|
3588
|
-
throw new Error('config parameter is not supported in Vertex AI.');
|
|
3589
|
-
}
|
|
3590
|
-
return toObject;
|
|
3591
|
-
}
|
|
3592
3507
|
function fileStatusToMldev(apiClient, fromObject) {
|
|
3593
3508
|
const toObject = {};
|
|
3594
3509
|
const fromDetails = getValueByPath(fromObject, ['details']);
|
|
@@ -3681,16 +3596,6 @@ function createFileParametersToMldev(apiClient, fromObject) {
|
|
|
3681
3596
|
}
|
|
3682
3597
|
return toObject;
|
|
3683
3598
|
}
|
|
3684
|
-
function createFileParametersToVertex(apiClient, fromObject) {
|
|
3685
|
-
const toObject = {};
|
|
3686
|
-
if (getValueByPath(fromObject, ['file']) !== undefined) {
|
|
3687
|
-
throw new Error('file parameter is not supported in Vertex AI.');
|
|
3688
|
-
}
|
|
3689
|
-
if (getValueByPath(fromObject, ['config']) !== undefined) {
|
|
3690
|
-
throw new Error('config parameter is not supported in Vertex AI.');
|
|
3691
|
-
}
|
|
3692
|
-
return toObject;
|
|
3693
|
-
}
|
|
3694
3599
|
function getFileParametersToMldev(apiClient, fromObject) {
|
|
3695
3600
|
const toObject = {};
|
|
3696
3601
|
const fromName = getValueByPath(fromObject, ['name']);
|
|
@@ -3703,16 +3608,6 @@ function getFileParametersToMldev(apiClient, fromObject) {
|
|
|
3703
3608
|
}
|
|
3704
3609
|
return toObject;
|
|
3705
3610
|
}
|
|
3706
|
-
function getFileParametersToVertex(apiClient, fromObject) {
|
|
3707
|
-
const toObject = {};
|
|
3708
|
-
if (getValueByPath(fromObject, ['name']) !== undefined) {
|
|
3709
|
-
throw new Error('name parameter is not supported in Vertex AI.');
|
|
3710
|
-
}
|
|
3711
|
-
if (getValueByPath(fromObject, ['config']) !== undefined) {
|
|
3712
|
-
throw new Error('config parameter is not supported in Vertex AI.');
|
|
3713
|
-
}
|
|
3714
|
-
return toObject;
|
|
3715
|
-
}
|
|
3716
3611
|
function fileStatusFromMldev(apiClient, fromObject) {
|
|
3717
3612
|
const toObject = {};
|
|
3718
3613
|
const fromDetails = getValueByPath(fromObject, ['details']);
|
|
@@ -3793,10 +3688,6 @@ function fileFromMldev(apiClient, fromObject) {
|
|
|
3793
3688
|
}
|
|
3794
3689
|
return toObject;
|
|
3795
3690
|
}
|
|
3796
|
-
function fileFromVertex(apiClient, fromObject) {
|
|
3797
|
-
const toObject = {};
|
|
3798
|
-
return toObject;
|
|
3799
|
-
}
|
|
3800
3691
|
function listFilesResponseFromMldev(apiClient, fromObject) {
|
|
3801
3692
|
const toObject = {};
|
|
3802
3693
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
@@ -3818,10 +3709,6 @@ function listFilesResponseFromMldev(apiClient, fromObject) {
|
|
|
3818
3709
|
}
|
|
3819
3710
|
return toObject;
|
|
3820
3711
|
}
|
|
3821
|
-
function listFilesResponseFromVertex(apiClient, fromObject) {
|
|
3822
|
-
const toObject = {};
|
|
3823
|
-
return toObject;
|
|
3824
|
-
}
|
|
3825
3712
|
function createFileResponseFromMldev(apiClient, fromObject) {
|
|
3826
3713
|
const toObject = {};
|
|
3827
3714
|
const fromHttpHeaders = getValueByPath(fromObject, ['httpHeaders']);
|
|
@@ -3830,14 +3717,6 @@ function createFileResponseFromMldev(apiClient, fromObject) {
|
|
|
3830
3717
|
}
|
|
3831
3718
|
return toObject;
|
|
3832
3719
|
}
|
|
3833
|
-
function createFileResponseFromVertex(apiClient, fromObject) {
|
|
3834
|
-
const toObject = {};
|
|
3835
|
-
const fromHttpHeaders = getValueByPath(fromObject, ['httpHeaders']);
|
|
3836
|
-
if (fromHttpHeaders != null) {
|
|
3837
|
-
setValueByPath(toObject, ['httpHeaders'], fromHttpHeaders);
|
|
3838
|
-
}
|
|
3839
|
-
return toObject;
|
|
3840
|
-
}
|
|
3841
3720
|
|
|
3842
3721
|
/**
|
|
3843
3722
|
* @license
|
|
@@ -4317,7 +4196,7 @@ class Models extends BaseModule {
|
|
|
4317
4196
|
* ```
|
|
4318
4197
|
*/
|
|
4319
4198
|
async computeTokens(params) {
|
|
4320
|
-
var _a
|
|
4199
|
+
var _a;
|
|
4321
4200
|
let response;
|
|
4322
4201
|
let path = '';
|
|
4323
4202
|
let queryParams = {};
|
|
@@ -4347,29 +4226,7 @@ class Models extends BaseModule {
|
|
|
4347
4226
|
});
|
|
4348
4227
|
}
|
|
4349
4228
|
else {
|
|
4350
|
-
|
|
4351
|
-
path = formatMap('None', body['_url']);
|
|
4352
|
-
queryParams = body['_query'];
|
|
4353
|
-
delete body['config'];
|
|
4354
|
-
delete body['_url'];
|
|
4355
|
-
delete body['_query'];
|
|
4356
|
-
response = this.apiClient
|
|
4357
|
-
.request({
|
|
4358
|
-
path: path,
|
|
4359
|
-
queryParams: queryParams,
|
|
4360
|
-
body: JSON.stringify(body),
|
|
4361
|
-
httpMethod: 'POST',
|
|
4362
|
-
httpOptions: (_b = params.config) === null || _b === void 0 ? void 0 : _b.httpOptions,
|
|
4363
|
-
})
|
|
4364
|
-
.then((httpResponse) => {
|
|
4365
|
-
return httpResponse.json();
|
|
4366
|
-
});
|
|
4367
|
-
return response.then((apiResponse) => {
|
|
4368
|
-
const resp = computeTokensResponseFromMldev(this.apiClient, apiResponse);
|
|
4369
|
-
const typedResp = new ComputeTokensResponse();
|
|
4370
|
-
Object.assign(typedResp, resp);
|
|
4371
|
-
return typedResp;
|
|
4372
|
-
});
|
|
4229
|
+
throw new Error('This method is only supported by the Vertex AI.');
|
|
4373
4230
|
}
|
|
4374
4231
|
}
|
|
4375
4232
|
}
|
|
@@ -4514,15 +4371,9 @@ function schemaToMldev(apiClient, fromObject) {
|
|
|
4514
4371
|
if (getValueByPath(fromObject, ['pattern']) !== undefined) {
|
|
4515
4372
|
throw new Error('pattern parameter is not supported in Gemini API.');
|
|
4516
4373
|
}
|
|
4517
|
-
if (getValueByPath(fromObject, ['minimum']) !== undefined) {
|
|
4518
|
-
throw new Error('minimum parameter is not supported in Gemini API.');
|
|
4519
|
-
}
|
|
4520
4374
|
if (getValueByPath(fromObject, ['default']) !== undefined) {
|
|
4521
4375
|
throw new Error('default parameter is not supported in Gemini API.');
|
|
4522
4376
|
}
|
|
4523
|
-
if (getValueByPath(fromObject, ['anyOf']) !== undefined) {
|
|
4524
|
-
throw new Error('anyOf parameter is not supported in Gemini API.');
|
|
4525
|
-
}
|
|
4526
4377
|
if (getValueByPath(fromObject, ['maxLength']) !== undefined) {
|
|
4527
4378
|
throw new Error('maxLength parameter is not supported in Gemini API.');
|
|
4528
4379
|
}
|
|
@@ -4535,12 +4386,13 @@ function schemaToMldev(apiClient, fromObject) {
|
|
|
4535
4386
|
if (getValueByPath(fromObject, ['minProperties']) !== undefined) {
|
|
4536
4387
|
throw new Error('minProperties parameter is not supported in Gemini API.');
|
|
4537
4388
|
}
|
|
4538
|
-
if (getValueByPath(fromObject, ['maximum']) !== undefined) {
|
|
4539
|
-
throw new Error('maximum parameter is not supported in Gemini API.');
|
|
4540
|
-
}
|
|
4541
4389
|
if (getValueByPath(fromObject, ['maxProperties']) !== undefined) {
|
|
4542
4390
|
throw new Error('maxProperties parameter is not supported in Gemini API.');
|
|
4543
4391
|
}
|
|
4392
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
4393
|
+
if (fromAnyOf != null) {
|
|
4394
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
4395
|
+
}
|
|
4544
4396
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
4545
4397
|
if (fromDescription != null) {
|
|
4546
4398
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -4561,10 +4413,18 @@ function schemaToMldev(apiClient, fromObject) {
|
|
|
4561
4413
|
if (fromMaxItems != null) {
|
|
4562
4414
|
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
4563
4415
|
}
|
|
4416
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
4417
|
+
if (fromMaximum != null) {
|
|
4418
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
4419
|
+
}
|
|
4564
4420
|
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
4565
4421
|
if (fromMinItems != null) {
|
|
4566
4422
|
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
4567
4423
|
}
|
|
4424
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
4425
|
+
if (fromMinimum != null) {
|
|
4426
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
4427
|
+
}
|
|
4568
4428
|
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
4569
4429
|
if (fromNullable != null) {
|
|
4570
4430
|
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
@@ -4599,18 +4459,10 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
4599
4459
|
if (fromPattern != null) {
|
|
4600
4460
|
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
4601
4461
|
}
|
|
4602
|
-
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
4603
|
-
if (fromMinimum != null) {
|
|
4604
|
-
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
4605
|
-
}
|
|
4606
4462
|
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
4607
4463
|
if (fromDefault != null) {
|
|
4608
4464
|
setValueByPath(toObject, ['default'], fromDefault);
|
|
4609
4465
|
}
|
|
4610
|
-
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
4611
|
-
if (fromAnyOf != null) {
|
|
4612
|
-
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
4613
|
-
}
|
|
4614
4466
|
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
4615
4467
|
if (fromMaxLength != null) {
|
|
4616
4468
|
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
@@ -4629,16 +4481,16 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
4629
4481
|
if (fromMinProperties != null) {
|
|
4630
4482
|
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
4631
4483
|
}
|
|
4632
|
-
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
4633
|
-
if (fromMaximum != null) {
|
|
4634
|
-
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
4635
|
-
}
|
|
4636
4484
|
const fromMaxProperties = getValueByPath(fromObject, [
|
|
4637
4485
|
'maxProperties',
|
|
4638
4486
|
]);
|
|
4639
4487
|
if (fromMaxProperties != null) {
|
|
4640
4488
|
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
4641
4489
|
}
|
|
4490
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
4491
|
+
if (fromAnyOf != null) {
|
|
4492
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
4493
|
+
}
|
|
4642
4494
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
4643
4495
|
if (fromDescription != null) {
|
|
4644
4496
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -4659,10 +4511,18 @@ function schemaToVertex(apiClient, fromObject) {
|
|
|
4659
4511
|
if (fromMaxItems != null) {
|
|
4660
4512
|
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
4661
4513
|
}
|
|
4514
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
4515
|
+
if (fromMaximum != null) {
|
|
4516
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
4517
|
+
}
|
|
4662
4518
|
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
4663
4519
|
if (fromMinItems != null) {
|
|
4664
4520
|
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
4665
4521
|
}
|
|
4522
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
4523
|
+
if (fromMinimum != null) {
|
|
4524
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
4525
|
+
}
|
|
4666
4526
|
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
4667
4527
|
if (fromNullable != null) {
|
|
4668
4528
|
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
@@ -4757,11 +4617,11 @@ function functionDeclarationToVertex(apiClient, fromObject) {
|
|
|
4757
4617
|
}
|
|
4758
4618
|
return toObject;
|
|
4759
4619
|
}
|
|
4760
|
-
function googleSearchToMldev(
|
|
4620
|
+
function googleSearchToMldev() {
|
|
4761
4621
|
const toObject = {};
|
|
4762
4622
|
return toObject;
|
|
4763
4623
|
}
|
|
4764
|
-
function googleSearchToVertex(
|
|
4624
|
+
function googleSearchToVertex() {
|
|
4765
4625
|
const toObject = {};
|
|
4766
4626
|
return toObject;
|
|
4767
4627
|
}
|
|
@@ -5710,21 +5570,6 @@ function countTokensParametersToVertex(apiClient, fromObject) {
|
|
|
5710
5570
|
}
|
|
5711
5571
|
return toObject;
|
|
5712
5572
|
}
|
|
5713
|
-
function computeTokensParametersToMldev(apiClient, fromObject) {
|
|
5714
|
-
const toObject = {};
|
|
5715
|
-
const fromModel = getValueByPath(fromObject, ['model']);
|
|
5716
|
-
if (fromModel != null) {
|
|
5717
|
-
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
5718
|
-
}
|
|
5719
|
-
if (getValueByPath(fromObject, ['contents']) !== undefined) {
|
|
5720
|
-
throw new Error('contents parameter is not supported in Gemini API.');
|
|
5721
|
-
}
|
|
5722
|
-
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
5723
|
-
if (fromConfig != null) {
|
|
5724
|
-
setValueByPath(toObject, ['config'], fromConfig);
|
|
5725
|
-
}
|
|
5726
|
-
return toObject;
|
|
5727
|
-
}
|
|
5728
5573
|
function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
5729
5574
|
const toObject = {};
|
|
5730
5575
|
const fromModel = getValueByPath(fromObject, ['model']);
|
|
@@ -6094,7 +5939,7 @@ function contentEmbeddingFromVertex(apiClient, fromObject) {
|
|
|
6094
5939
|
}
|
|
6095
5940
|
return toObject;
|
|
6096
5941
|
}
|
|
6097
|
-
function embedContentMetadataFromMldev(
|
|
5942
|
+
function embedContentMetadataFromMldev() {
|
|
6098
5943
|
const toObject = {};
|
|
6099
5944
|
return toObject;
|
|
6100
5945
|
}
|
|
@@ -6181,6 +6026,42 @@ function imageFromVertex(apiClient, fromObject) {
|
|
|
6181
6026
|
}
|
|
6182
6027
|
return toObject;
|
|
6183
6028
|
}
|
|
6029
|
+
function safetyAttributesFromMldev(apiClient, fromObject) {
|
|
6030
|
+
const toObject = {};
|
|
6031
|
+
const fromCategories = getValueByPath(fromObject, [
|
|
6032
|
+
'safetyAttributes',
|
|
6033
|
+
'categories',
|
|
6034
|
+
]);
|
|
6035
|
+
if (fromCategories != null) {
|
|
6036
|
+
setValueByPath(toObject, ['categories'], fromCategories);
|
|
6037
|
+
}
|
|
6038
|
+
const fromScores = getValueByPath(fromObject, [
|
|
6039
|
+
'safetyAttributes',
|
|
6040
|
+
'scores',
|
|
6041
|
+
]);
|
|
6042
|
+
if (fromScores != null) {
|
|
6043
|
+
setValueByPath(toObject, ['scores'], fromScores);
|
|
6044
|
+
}
|
|
6045
|
+
return toObject;
|
|
6046
|
+
}
|
|
6047
|
+
function safetyAttributesFromVertex(apiClient, fromObject) {
|
|
6048
|
+
const toObject = {};
|
|
6049
|
+
const fromCategories = getValueByPath(fromObject, [
|
|
6050
|
+
'safetyAttributes',
|
|
6051
|
+
'categories',
|
|
6052
|
+
]);
|
|
6053
|
+
if (fromCategories != null) {
|
|
6054
|
+
setValueByPath(toObject, ['categories'], fromCategories);
|
|
6055
|
+
}
|
|
6056
|
+
const fromScores = getValueByPath(fromObject, [
|
|
6057
|
+
'safetyAttributes',
|
|
6058
|
+
'scores',
|
|
6059
|
+
]);
|
|
6060
|
+
if (fromScores != null) {
|
|
6061
|
+
setValueByPath(toObject, ['scores'], fromScores);
|
|
6062
|
+
}
|
|
6063
|
+
return toObject;
|
|
6064
|
+
}
|
|
6184
6065
|
function generatedImageFromMldev(apiClient, fromObject) {
|
|
6185
6066
|
const toObject = {};
|
|
6186
6067
|
const fromImage = getValueByPath(fromObject, ['_self']);
|
|
@@ -6193,6 +6074,10 @@ function generatedImageFromMldev(apiClient, fromObject) {
|
|
|
6193
6074
|
if (fromRaiFilteredReason != null) {
|
|
6194
6075
|
setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
|
|
6195
6076
|
}
|
|
6077
|
+
const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
|
|
6078
|
+
if (fromSafetyAttributes != null) {
|
|
6079
|
+
setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromMldev(apiClient, fromSafetyAttributes));
|
|
6080
|
+
}
|
|
6196
6081
|
return toObject;
|
|
6197
6082
|
}
|
|
6198
6083
|
function generatedImageFromVertex(apiClient, fromObject) {
|
|
@@ -6207,6 +6092,10 @@ function generatedImageFromVertex(apiClient, fromObject) {
|
|
|
6207
6092
|
if (fromRaiFilteredReason != null) {
|
|
6208
6093
|
setValueByPath(toObject, ['raiFilteredReason'], fromRaiFilteredReason);
|
|
6209
6094
|
}
|
|
6095
|
+
const fromSafetyAttributes = getValueByPath(fromObject, ['_self']);
|
|
6096
|
+
if (fromSafetyAttributes != null) {
|
|
6097
|
+
setValueByPath(toObject, ['safetyAttributes'], safetyAttributesFromVertex(apiClient, fromSafetyAttributes));
|
|
6098
|
+
}
|
|
6210
6099
|
const fromEnhancedPrompt = getValueByPath(fromObject, ['prompt']);
|
|
6211
6100
|
if (fromEnhancedPrompt != null) {
|
|
6212
6101
|
setValueByPath(toObject, ['enhancedPrompt'], fromEnhancedPrompt);
|
|
@@ -6269,14 +6158,6 @@ function countTokensResponseFromVertex(apiClient, fromObject) {
|
|
|
6269
6158
|
}
|
|
6270
6159
|
return toObject;
|
|
6271
6160
|
}
|
|
6272
|
-
function computeTokensResponseFromMldev(apiClient, fromObject) {
|
|
6273
|
-
const toObject = {};
|
|
6274
|
-
const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
|
|
6275
|
-
if (fromTokensInfo != null) {
|
|
6276
|
-
setValueByPath(toObject, ['tokensInfo'], fromTokensInfo);
|
|
6277
|
-
}
|
|
6278
|
-
return toObject;
|
|
6279
|
-
}
|
|
6280
6161
|
function computeTokensResponseFromVertex(apiClient, fromObject) {
|
|
6281
6162
|
const toObject = {};
|
|
6282
6163
|
const fromTokensInfo = getValueByPath(fromObject, ['tokensInfo']);
|
|
@@ -7018,7 +6899,6 @@ exports.createPartFromFunctionCall = createPartFromFunctionCall;
|
|
|
7018
6899
|
exports.createPartFromFunctionResponse = createPartFromFunctionResponse;
|
|
7019
6900
|
exports.createPartFromText = createPartFromText;
|
|
7020
6901
|
exports.createPartFromUri = createPartFromUri;
|
|
7021
|
-
exports.createPartFromVideoMetadata = createPartFromVideoMetadata;
|
|
7022
6902
|
exports.createUserContent = createUserContent;
|
|
7023
6903
|
exports.toolToMldev = toolToMldev$1;
|
|
7024
6904
|
exports.toolToVertex = toolToVertex$1;
|