@google/genai 1.28.0 → 1.29.1
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 +4 -4
- package/dist/genai.d.ts +769 -47
- package/dist/index.cjs +1281 -165
- package/dist/index.mjs +1275 -166
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +1429 -292
- package/dist/node/index.mjs +1422 -293
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +769 -47
- package/dist/web/index.mjs +1306 -199
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +769 -47
- package/package.json +11 -6
package/dist/index.cjs
CHANGED
|
@@ -432,6 +432,90 @@ function getOperationParametersToVertex(fromObject) {
|
|
|
432
432
|
}
|
|
433
433
|
return toObject;
|
|
434
434
|
}
|
|
435
|
+
function importFileOperationFromMldev$1(fromObject) {
|
|
436
|
+
const toObject = {};
|
|
437
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
438
|
+
if (fromName != null) {
|
|
439
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
440
|
+
}
|
|
441
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
442
|
+
if (fromMetadata != null) {
|
|
443
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
444
|
+
}
|
|
445
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
446
|
+
if (fromDone != null) {
|
|
447
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
448
|
+
}
|
|
449
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
450
|
+
if (fromError != null) {
|
|
451
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
452
|
+
}
|
|
453
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
454
|
+
if (fromResponse != null) {
|
|
455
|
+
setValueByPath(toObject, ['response'], importFileResponseFromMldev$1(fromResponse));
|
|
456
|
+
}
|
|
457
|
+
return toObject;
|
|
458
|
+
}
|
|
459
|
+
function importFileResponseFromMldev$1(fromObject) {
|
|
460
|
+
const toObject = {};
|
|
461
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
462
|
+
'sdkHttpResponse',
|
|
463
|
+
]);
|
|
464
|
+
if (fromSdkHttpResponse != null) {
|
|
465
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
466
|
+
}
|
|
467
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
468
|
+
if (fromParent != null) {
|
|
469
|
+
setValueByPath(toObject, ['parent'], fromParent);
|
|
470
|
+
}
|
|
471
|
+
const fromDocumentName = getValueByPath(fromObject, ['documentName']);
|
|
472
|
+
if (fromDocumentName != null) {
|
|
473
|
+
setValueByPath(toObject, ['documentName'], fromDocumentName);
|
|
474
|
+
}
|
|
475
|
+
return toObject;
|
|
476
|
+
}
|
|
477
|
+
function uploadToFileSearchStoreOperationFromMldev(fromObject) {
|
|
478
|
+
const toObject = {};
|
|
479
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
480
|
+
if (fromName != null) {
|
|
481
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
482
|
+
}
|
|
483
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
484
|
+
if (fromMetadata != null) {
|
|
485
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
486
|
+
}
|
|
487
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
488
|
+
if (fromDone != null) {
|
|
489
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
490
|
+
}
|
|
491
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
492
|
+
if (fromError != null) {
|
|
493
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
494
|
+
}
|
|
495
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
496
|
+
if (fromResponse != null) {
|
|
497
|
+
setValueByPath(toObject, ['response'], uploadToFileSearchStoreResponseFromMldev(fromResponse));
|
|
498
|
+
}
|
|
499
|
+
return toObject;
|
|
500
|
+
}
|
|
501
|
+
function uploadToFileSearchStoreResponseFromMldev(fromObject) {
|
|
502
|
+
const toObject = {};
|
|
503
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
504
|
+
'sdkHttpResponse',
|
|
505
|
+
]);
|
|
506
|
+
if (fromSdkHttpResponse != null) {
|
|
507
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
508
|
+
}
|
|
509
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
510
|
+
if (fromParent != null) {
|
|
511
|
+
setValueByPath(toObject, ['parent'], fromParent);
|
|
512
|
+
}
|
|
513
|
+
const fromDocumentName = getValueByPath(fromObject, ['documentName']);
|
|
514
|
+
if (fromDocumentName != null) {
|
|
515
|
+
setValueByPath(toObject, ['documentName'], fromDocumentName);
|
|
516
|
+
}
|
|
517
|
+
return toObject;
|
|
518
|
+
}
|
|
435
519
|
function videoFromMldev$1(fromObject) {
|
|
436
520
|
const toObject = {};
|
|
437
521
|
const fromUri = getValueByPath(fromObject, ['uri']);
|
|
@@ -572,6 +656,22 @@ exports.Mode = void 0;
|
|
|
572
656
|
*/
|
|
573
657
|
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
574
658
|
})(exports.Mode || (exports.Mode = {}));
|
|
659
|
+
/** The API spec that the external API implements. This enum is not supported in Gemini API. */
|
|
660
|
+
exports.ApiSpec = void 0;
|
|
661
|
+
(function (ApiSpec) {
|
|
662
|
+
/**
|
|
663
|
+
* Unspecified API spec. This value should not be used.
|
|
664
|
+
*/
|
|
665
|
+
ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
|
|
666
|
+
/**
|
|
667
|
+
* Simple search API spec.
|
|
668
|
+
*/
|
|
669
|
+
ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
|
|
670
|
+
/**
|
|
671
|
+
* Elastic search API spec.
|
|
672
|
+
*/
|
|
673
|
+
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
674
|
+
})(exports.ApiSpec || (exports.ApiSpec = {}));
|
|
575
675
|
/** Type of auth scheme. This enum is not supported in Gemini API. */
|
|
576
676
|
exports.AuthType = void 0;
|
|
577
677
|
(function (AuthType) {
|
|
@@ -601,22 +701,63 @@ exports.AuthType = void 0;
|
|
|
601
701
|
*/
|
|
602
702
|
AuthType["OIDC_AUTH"] = "OIDC_AUTH";
|
|
603
703
|
})(exports.AuthType || (exports.AuthType = {}));
|
|
604
|
-
/** The
|
|
605
|
-
exports.
|
|
606
|
-
(function (
|
|
704
|
+
/** The location of the API key. This enum is not supported in Gemini API. */
|
|
705
|
+
exports.HttpElementLocation = void 0;
|
|
706
|
+
(function (HttpElementLocation) {
|
|
707
|
+
HttpElementLocation["HTTP_IN_UNSPECIFIED"] = "HTTP_IN_UNSPECIFIED";
|
|
607
708
|
/**
|
|
608
|
-
*
|
|
709
|
+
* Element is in the HTTP request query.
|
|
609
710
|
*/
|
|
610
|
-
|
|
711
|
+
HttpElementLocation["HTTP_IN_QUERY"] = "HTTP_IN_QUERY";
|
|
611
712
|
/**
|
|
612
|
-
*
|
|
713
|
+
* Element is in the HTTP request header.
|
|
613
714
|
*/
|
|
614
|
-
|
|
715
|
+
HttpElementLocation["HTTP_IN_HEADER"] = "HTTP_IN_HEADER";
|
|
615
716
|
/**
|
|
616
|
-
*
|
|
717
|
+
* Element is in the HTTP request path.
|
|
617
718
|
*/
|
|
618
|
-
|
|
619
|
-
|
|
719
|
+
HttpElementLocation["HTTP_IN_PATH"] = "HTTP_IN_PATH";
|
|
720
|
+
/**
|
|
721
|
+
* Element is in the HTTP request body.
|
|
722
|
+
*/
|
|
723
|
+
HttpElementLocation["HTTP_IN_BODY"] = "HTTP_IN_BODY";
|
|
724
|
+
/**
|
|
725
|
+
* Element is in the HTTP request cookie.
|
|
726
|
+
*/
|
|
727
|
+
HttpElementLocation["HTTP_IN_COOKIE"] = "HTTP_IN_COOKIE";
|
|
728
|
+
})(exports.HttpElementLocation || (exports.HttpElementLocation = {}));
|
|
729
|
+
/** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
|
|
730
|
+
exports.PhishBlockThreshold = void 0;
|
|
731
|
+
(function (PhishBlockThreshold) {
|
|
732
|
+
/**
|
|
733
|
+
* Defaults to unspecified.
|
|
734
|
+
*/
|
|
735
|
+
PhishBlockThreshold["PHISH_BLOCK_THRESHOLD_UNSPECIFIED"] = "PHISH_BLOCK_THRESHOLD_UNSPECIFIED";
|
|
736
|
+
/**
|
|
737
|
+
* Blocks Low and above confidence URL that is risky.
|
|
738
|
+
*/
|
|
739
|
+
PhishBlockThreshold["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE";
|
|
740
|
+
/**
|
|
741
|
+
* Blocks Medium and above confidence URL that is risky.
|
|
742
|
+
*/
|
|
743
|
+
PhishBlockThreshold["BLOCK_MEDIUM_AND_ABOVE"] = "BLOCK_MEDIUM_AND_ABOVE";
|
|
744
|
+
/**
|
|
745
|
+
* Blocks High and above confidence URL that is risky.
|
|
746
|
+
*/
|
|
747
|
+
PhishBlockThreshold["BLOCK_HIGH_AND_ABOVE"] = "BLOCK_HIGH_AND_ABOVE";
|
|
748
|
+
/**
|
|
749
|
+
* Blocks Higher and above confidence URL that is risky.
|
|
750
|
+
*/
|
|
751
|
+
PhishBlockThreshold["BLOCK_HIGHER_AND_ABOVE"] = "BLOCK_HIGHER_AND_ABOVE";
|
|
752
|
+
/**
|
|
753
|
+
* Blocks Very high and above confidence URL that is risky.
|
|
754
|
+
*/
|
|
755
|
+
PhishBlockThreshold["BLOCK_VERY_HIGH_AND_ABOVE"] = "BLOCK_VERY_HIGH_AND_ABOVE";
|
|
756
|
+
/**
|
|
757
|
+
* Blocks Extremely high confidence URL that is risky.
|
|
758
|
+
*/
|
|
759
|
+
PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
|
|
760
|
+
})(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
|
|
620
761
|
/** Harm category. */
|
|
621
762
|
exports.HarmCategory = void 0;
|
|
622
763
|
(function (HarmCategory) {
|
|
@@ -883,7 +1024,7 @@ exports.BlockedReason = void 0;
|
|
|
883
1024
|
*/
|
|
884
1025
|
BlockedReason["JAILBREAK"] = "JAILBREAK";
|
|
885
1026
|
})(exports.BlockedReason || (exports.BlockedReason = {}));
|
|
886
|
-
/** Output only.
|
|
1027
|
+
/** Output only. The traffic type for this request. This enum is not supported in Gemini API. */
|
|
887
1028
|
exports.TrafficType = void 0;
|
|
888
1029
|
(function (TrafficType) {
|
|
889
1030
|
/**
|
|
@@ -891,7 +1032,7 @@ exports.TrafficType = void 0;
|
|
|
891
1032
|
*/
|
|
892
1033
|
TrafficType["TRAFFIC_TYPE_UNSPECIFIED"] = "TRAFFIC_TYPE_UNSPECIFIED";
|
|
893
1034
|
/**
|
|
894
|
-
*
|
|
1035
|
+
* The request was processed using Pay-As-You-Go quota.
|
|
895
1036
|
*/
|
|
896
1037
|
TrafficType["ON_DEMAND"] = "ON_DEMAND";
|
|
897
1038
|
/**
|
|
@@ -1054,6 +1195,10 @@ exports.TuningTask = void 0;
|
|
|
1054
1195
|
* Tuning task for text to video.
|
|
1055
1196
|
*/
|
|
1056
1197
|
TuningTask["TUNING_TASK_T2V"] = "TUNING_TASK_T2V";
|
|
1198
|
+
/**
|
|
1199
|
+
* Tuning task for reference to video.
|
|
1200
|
+
*/
|
|
1201
|
+
TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
|
|
1057
1202
|
})(exports.TuningTask || (exports.TuningTask = {}));
|
|
1058
1203
|
/** Options for feature selection preference. */
|
|
1059
1204
|
exports.FeatureSelectionPreference = void 0;
|
|
@@ -1301,6 +1446,14 @@ exports.TuningMethod = void 0;
|
|
|
1301
1446
|
*/
|
|
1302
1447
|
TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
|
|
1303
1448
|
})(exports.TuningMethod || (exports.TuningMethod = {}));
|
|
1449
|
+
/** State for the lifecycle of a Document. */
|
|
1450
|
+
exports.DocumentState = void 0;
|
|
1451
|
+
(function (DocumentState) {
|
|
1452
|
+
DocumentState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
1453
|
+
DocumentState["STATE_PENDING"] = "STATE_PENDING";
|
|
1454
|
+
DocumentState["STATE_ACTIVE"] = "STATE_ACTIVE";
|
|
1455
|
+
DocumentState["STATE_FAILED"] = "STATE_FAILED";
|
|
1456
|
+
})(exports.DocumentState || (exports.DocumentState = {}));
|
|
1304
1457
|
/** State for the lifecycle of a File. */
|
|
1305
1458
|
exports.FileState = void 0;
|
|
1306
1459
|
(function (FileState) {
|
|
@@ -1728,7 +1881,7 @@ class HttpResponse {
|
|
|
1728
1881
|
/** Content filter results for a prompt sent in the request. Note: This is sent only in the first stream chunk and only if no candidates were generated due to content violations. */
|
|
1729
1882
|
class GenerateContentResponsePromptFeedback {
|
|
1730
1883
|
}
|
|
1731
|
-
/** Usage metadata about response
|
|
1884
|
+
/** Usage metadata about the content generation request and response. This message provides a detailed breakdown of token usage and other relevant metrics. This data type is not supported in Gemini API. */
|
|
1732
1885
|
class GenerateContentResponseUsageMetadata {
|
|
1733
1886
|
}
|
|
1734
1887
|
/** Response message for PredictionService.GenerateContent. */
|
|
@@ -1770,6 +1923,7 @@ class GenerateContentResponse {
|
|
|
1770
1923
|
for (const [fieldName, fieldValue] of Object.entries(part)) {
|
|
1771
1924
|
if (fieldName !== 'text' &&
|
|
1772
1925
|
fieldName !== 'thought' &&
|
|
1926
|
+
fieldName !== 'thoughtSignature' &&
|
|
1773
1927
|
(fieldValue !== null || fieldValue !== undefined)) {
|
|
1774
1928
|
nonTextParts.push(fieldName);
|
|
1775
1929
|
}
|
|
@@ -1993,11 +2147,11 @@ class GenerateVideosOperation {
|
|
|
1993
2147
|
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
1994
2148
|
* @internal
|
|
1995
2149
|
*/
|
|
1996
|
-
_fromAPIResponse({ apiResponse,
|
|
2150
|
+
_fromAPIResponse({ apiResponse, _isVertexAI, }) {
|
|
1997
2151
|
const operation = new GenerateVideosOperation();
|
|
1998
2152
|
let response;
|
|
1999
2153
|
const op = apiResponse;
|
|
2000
|
-
if (
|
|
2154
|
+
if (_isVertexAI) {
|
|
2001
2155
|
response = generateVideosOperationFromVertex$1(op);
|
|
2002
2156
|
}
|
|
2003
2157
|
else {
|
|
@@ -2015,6 +2169,32 @@ class DeleteCachedContentResponse {
|
|
|
2015
2169
|
}
|
|
2016
2170
|
class ListCachedContentsResponse {
|
|
2017
2171
|
}
|
|
2172
|
+
/** Config for documents.list return value. */
|
|
2173
|
+
class ListDocumentsResponse {
|
|
2174
|
+
}
|
|
2175
|
+
/** Config for file_search_stores.list return value. */
|
|
2176
|
+
class ListFileSearchStoresResponse {
|
|
2177
|
+
}
|
|
2178
|
+
/** Response for the resumable upload method. */
|
|
2179
|
+
class UploadToFileSearchStoreResumableResponse {
|
|
2180
|
+
}
|
|
2181
|
+
/** Response for ImportFile to import a File API file with a file search store. */
|
|
2182
|
+
class ImportFileResponse {
|
|
2183
|
+
}
|
|
2184
|
+
/** Long-running operation for importing a file to a FileSearchStore. */
|
|
2185
|
+
class ImportFileOperation {
|
|
2186
|
+
/**
|
|
2187
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
2188
|
+
* @internal
|
|
2189
|
+
*/
|
|
2190
|
+
_fromAPIResponse({ apiResponse, _isVertexAI, }) {
|
|
2191
|
+
const operation = new ImportFileOperation();
|
|
2192
|
+
const op = apiResponse;
|
|
2193
|
+
const response = importFileOperationFromMldev$1(op);
|
|
2194
|
+
Object.assign(operation, response);
|
|
2195
|
+
return operation;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2018
2198
|
/** Response for the list files method. */
|
|
2019
2199
|
class ListFilesResponse {
|
|
2020
2200
|
}
|
|
@@ -2250,6 +2430,23 @@ class LiveMusicServerMessage {
|
|
|
2250
2430
|
return undefined;
|
|
2251
2431
|
}
|
|
2252
2432
|
}
|
|
2433
|
+
/** The response when long-running operation for uploading a file to a FileSearchStore complete. */
|
|
2434
|
+
class UploadToFileSearchStoreResponse {
|
|
2435
|
+
}
|
|
2436
|
+
/** Long-running operation for uploading a file to a FileSearchStore. */
|
|
2437
|
+
class UploadToFileSearchStoreOperation {
|
|
2438
|
+
/**
|
|
2439
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
2440
|
+
* @internal
|
|
2441
|
+
*/
|
|
2442
|
+
_fromAPIResponse({ apiResponse, _isVertexAI, }) {
|
|
2443
|
+
const operation = new UploadToFileSearchStoreOperation();
|
|
2444
|
+
const op = apiResponse;
|
|
2445
|
+
const response = uploadToFileSearchStoreOperationFromMldev(op);
|
|
2446
|
+
Object.assign(operation, response);
|
|
2447
|
+
return operation;
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2253
2450
|
|
|
2254
2451
|
/**
|
|
2255
2452
|
* @license
|
|
@@ -2260,6 +2457,9 @@ function tModel(apiClient, model) {
|
|
|
2260
2457
|
if (!model || typeof model !== 'string') {
|
|
2261
2458
|
throw new Error('model is required and must be a string');
|
|
2262
2459
|
}
|
|
2460
|
+
if (model.includes('..') || model.includes('?') || model.includes('&')) {
|
|
2461
|
+
throw new Error('invalid model parameter');
|
|
2462
|
+
}
|
|
2263
2463
|
if (apiClient.isVertexAI()) {
|
|
2264
2464
|
if (model.startsWith('publishers/') ||
|
|
2265
2465
|
model.startsWith('projects/') ||
|
|
@@ -3246,6 +3446,12 @@ function batchJobFromVertex(fromObject) {
|
|
|
3246
3446
|
if (fromDest != null) {
|
|
3247
3447
|
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
|
|
3248
3448
|
}
|
|
3449
|
+
const fromCompletionStats = getValueByPath(fromObject, [
|
|
3450
|
+
'completionStats',
|
|
3451
|
+
]);
|
|
3452
|
+
if (fromCompletionStats != null) {
|
|
3453
|
+
setValueByPath(toObject, ['completionStats'], fromCompletionStats);
|
|
3454
|
+
}
|
|
3249
3455
|
return toObject;
|
|
3250
3456
|
}
|
|
3251
3457
|
function batchJobSourceFromVertex(fromObject) {
|
|
@@ -3878,6 +4084,9 @@ function googleSearchToMldev$4(fromObject) {
|
|
|
3878
4084
|
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
3879
4085
|
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
3880
4086
|
}
|
|
4087
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
4088
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
4089
|
+
}
|
|
3881
4090
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
3882
4091
|
'timeRangeFilter',
|
|
3883
4092
|
]);
|
|
@@ -4117,14 +4326,14 @@ function toolToMldev$4(fromObject) {
|
|
|
4117
4326
|
if (fromGoogleSearchRetrieval != null) {
|
|
4118
4327
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4119
4328
|
}
|
|
4120
|
-
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
4121
|
-
if (fromGoogleMaps != null) {
|
|
4122
|
-
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
|
|
4123
|
-
}
|
|
4124
4329
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4125
4330
|
if (fromComputerUse != null) {
|
|
4126
4331
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
4127
4332
|
}
|
|
4333
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
4334
|
+
if (fromFileSearch != null) {
|
|
4335
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
4336
|
+
}
|
|
4128
4337
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
4129
4338
|
'codeExecution',
|
|
4130
4339
|
]);
|
|
@@ -4134,6 +4343,10 @@ function toolToMldev$4(fromObject) {
|
|
|
4134
4343
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
4135
4344
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
4136
4345
|
}
|
|
4346
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
4347
|
+
if (fromGoogleMaps != null) {
|
|
4348
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
|
|
4349
|
+
}
|
|
4137
4350
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
4138
4351
|
if (fromGoogleSearch != null) {
|
|
4139
4352
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
|
|
@@ -4157,7 +4370,7 @@ exports.PagedItem = void 0;
|
|
|
4157
4370
|
PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
|
|
4158
4371
|
PagedItem["PAGED_ITEM_FILES"] = "files";
|
|
4159
4372
|
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
4160
|
-
PagedItem["
|
|
4373
|
+
PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
|
|
4161
4374
|
PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
|
|
4162
4375
|
})(exports.PagedItem || (exports.PagedItem = {}));
|
|
4163
4376
|
/**
|
|
@@ -5111,6 +5324,9 @@ function googleSearchToMldev$3(fromObject) {
|
|
|
5111
5324
|
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
5112
5325
|
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
5113
5326
|
}
|
|
5327
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
5328
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
5329
|
+
}
|
|
5114
5330
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
5115
5331
|
'timeRangeFilter',
|
|
5116
5332
|
]);
|
|
@@ -5292,14 +5508,14 @@ function toolToMldev$3(fromObject) {
|
|
|
5292
5508
|
if (fromGoogleSearchRetrieval != null) {
|
|
5293
5509
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5294
5510
|
}
|
|
5295
|
-
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5296
|
-
if (fromGoogleMaps != null) {
|
|
5297
|
-
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
|
|
5298
|
-
}
|
|
5299
5511
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5300
5512
|
if (fromComputerUse != null) {
|
|
5301
5513
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5302
5514
|
}
|
|
5515
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
5516
|
+
if (fromFileSearch != null) {
|
|
5517
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
5518
|
+
}
|
|
5303
5519
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5304
5520
|
'codeExecution',
|
|
5305
5521
|
]);
|
|
@@ -5309,6 +5525,10 @@ function toolToMldev$3(fromObject) {
|
|
|
5309
5525
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5310
5526
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
5311
5527
|
}
|
|
5528
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5529
|
+
if (fromGoogleMaps != null) {
|
|
5530
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
|
|
5531
|
+
}
|
|
5312
5532
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5313
5533
|
if (fromGoogleSearch != null) {
|
|
5314
5534
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
|
|
@@ -5343,14 +5563,13 @@ function toolToVertex$2(fromObject) {
|
|
|
5343
5563
|
if (fromGoogleSearchRetrieval != null) {
|
|
5344
5564
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5345
5565
|
}
|
|
5346
|
-
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5347
|
-
if (fromGoogleMaps != null) {
|
|
5348
|
-
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
5349
|
-
}
|
|
5350
5566
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5351
5567
|
if (fromComputerUse != null) {
|
|
5352
5568
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5353
5569
|
}
|
|
5570
|
+
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
5571
|
+
throw new Error('fileSearch parameter is not supported in Vertex AI.');
|
|
5572
|
+
}
|
|
5354
5573
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5355
5574
|
'codeExecution',
|
|
5356
5575
|
]);
|
|
@@ -5363,6 +5582,10 @@ function toolToVertex$2(fromObject) {
|
|
|
5363
5582
|
if (fromEnterpriseWebSearch != null) {
|
|
5364
5583
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
5365
5584
|
}
|
|
5585
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5586
|
+
if (fromGoogleMaps != null) {
|
|
5587
|
+
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
5588
|
+
}
|
|
5366
5589
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5367
5590
|
if (fromGoogleSearch != null) {
|
|
5368
5591
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
@@ -6207,7 +6430,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6207
6430
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6208
6431
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6209
6432
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6210
|
-
const SDK_VERSION = '1.
|
|
6433
|
+
const SDK_VERSION = '1.29.1'; // x-release-please-version
|
|
6211
6434
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6212
6435
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6213
6436
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -6585,6 +6808,15 @@ class ApiClient {
|
|
|
6585
6808
|
await this.clientOptions.auth.addAuthHeaders(headers, url);
|
|
6586
6809
|
return headers;
|
|
6587
6810
|
}
|
|
6811
|
+
getFileName(file) {
|
|
6812
|
+
var _a;
|
|
6813
|
+
let fileName = '';
|
|
6814
|
+
if (typeof file === 'string') {
|
|
6815
|
+
fileName = file.replace(/[/\\]+$/, '');
|
|
6816
|
+
fileName = (_a = fileName.split(/[/\\]/).pop()) !== null && _a !== void 0 ? _a : '';
|
|
6817
|
+
}
|
|
6818
|
+
return fileName;
|
|
6819
|
+
}
|
|
6588
6820
|
/**
|
|
6589
6821
|
* Uploads a file asynchronously using Gemini API only, this is not supported
|
|
6590
6822
|
* in Vertex AI.
|
|
@@ -6597,7 +6829,7 @@ class ApiClient {
|
|
|
6597
6829
|
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
6598
6830
|
*/
|
|
6599
6831
|
async uploadFile(file, config) {
|
|
6600
|
-
var _a
|
|
6832
|
+
var _a;
|
|
6601
6833
|
const fileToUpload = {};
|
|
6602
6834
|
if (config != null) {
|
|
6603
6835
|
fileToUpload.mimeType = config.mimeType;
|
|
@@ -6615,14 +6847,47 @@ class ApiClient {
|
|
|
6615
6847
|
throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
|
|
6616
6848
|
}
|
|
6617
6849
|
fileToUpload.mimeType = mimeType;
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
const uploadUrl = await this.fetchUploadUrl(fileToUpload, fileName, config);
|
|
6850
|
+
const body = {
|
|
6851
|
+
file: fileToUpload,
|
|
6852
|
+
};
|
|
6853
|
+
const fileName = this.getFileName(file);
|
|
6854
|
+
const path = formatMap('upload/v1beta/files', body['_url']);
|
|
6855
|
+
const uploadUrl = await this.fetchUploadUrl(path, fileToUpload.sizeBytes, fileToUpload.mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
|
|
6624
6856
|
return uploader.upload(file, uploadUrl, this);
|
|
6625
6857
|
}
|
|
6858
|
+
/**
|
|
6859
|
+
* Uploads a file to a given file search store asynchronously using Gemini API only, this is not supported
|
|
6860
|
+
* in Vertex AI.
|
|
6861
|
+
*
|
|
6862
|
+
* @param fileSearchStoreName The name of the file search store to upload the file to.
|
|
6863
|
+
* @param file The string path to the file to be uploaded or a Blob object.
|
|
6864
|
+
* @param config Optional parameters specified in the `UploadFileConfig`
|
|
6865
|
+
* interface. @see {@link UploadFileConfig}
|
|
6866
|
+
* @return A promise that resolves to a `File` object.
|
|
6867
|
+
* @throws An error if called on a Vertex AI client.
|
|
6868
|
+
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
6869
|
+
*/
|
|
6870
|
+
async uploadFileToFileSearchStore(fileSearchStoreName, file, config) {
|
|
6871
|
+
var _a;
|
|
6872
|
+
const uploader = this.clientOptions.uploader;
|
|
6873
|
+
const fileStat = await uploader.stat(file);
|
|
6874
|
+
const sizeBytes = String(fileStat.size);
|
|
6875
|
+
const mimeType = (_a = config === null || config === void 0 ? void 0 : config.mimeType) !== null && _a !== void 0 ? _a : fileStat.type;
|
|
6876
|
+
if (mimeType === undefined || mimeType === '') {
|
|
6877
|
+
throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
|
|
6878
|
+
}
|
|
6879
|
+
const path = `upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`;
|
|
6880
|
+
const fileName = this.getFileName(file);
|
|
6881
|
+
const body = {};
|
|
6882
|
+
if (config === null || config === void 0 ? void 0 : config.customMetadata) {
|
|
6883
|
+
body['customMetadata'] = config.customMetadata;
|
|
6884
|
+
}
|
|
6885
|
+
if (config === null || config === void 0 ? void 0 : config.chunkingConfig) {
|
|
6886
|
+
body['chunkingConfig'] = config.chunkingConfig;
|
|
6887
|
+
}
|
|
6888
|
+
const uploadUrl = await this.fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
|
|
6889
|
+
return uploader.uploadToFileSearchStore(file, uploadUrl, this);
|
|
6890
|
+
}
|
|
6626
6891
|
/**
|
|
6627
6892
|
* Downloads a file asynchronously to the specified path.
|
|
6628
6893
|
*
|
|
@@ -6633,23 +6898,20 @@ class ApiClient {
|
|
|
6633
6898
|
const downloader = this.clientOptions.downloader;
|
|
6634
6899
|
await downloader.download(params, this);
|
|
6635
6900
|
}
|
|
6636
|
-
async fetchUploadUrl(
|
|
6901
|
+
async fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, configHttpOptions) {
|
|
6637
6902
|
var _a;
|
|
6638
6903
|
let httpOptions = {};
|
|
6639
|
-
if (
|
|
6640
|
-
httpOptions =
|
|
6904
|
+
if (configHttpOptions) {
|
|
6905
|
+
httpOptions = configHttpOptions;
|
|
6641
6906
|
}
|
|
6642
6907
|
else {
|
|
6643
6908
|
httpOptions = {
|
|
6644
6909
|
apiVersion: '',
|
|
6645
|
-
headers: Object.assign({ 'Content-Type': 'application/json', 'X-Goog-Upload-Protocol': 'resumable', 'X-Goog-Upload-Command': 'start', 'X-Goog-Upload-Header-Content-Length': `${
|
|
6910
|
+
headers: Object.assign({ 'Content-Type': 'application/json', 'X-Goog-Upload-Protocol': 'resumable', 'X-Goog-Upload-Command': 'start', 'X-Goog-Upload-Header-Content-Length': `${sizeBytes}`, 'X-Goog-Upload-Header-Content-Type': `${mimeType}` }, (fileName ? { 'X-Goog-Upload-File-Name': fileName } : {})),
|
|
6646
6911
|
};
|
|
6647
6912
|
}
|
|
6648
|
-
const body = {
|
|
6649
|
-
'file': file,
|
|
6650
|
-
};
|
|
6651
6913
|
const httpResponse = await this.request({
|
|
6652
|
-
path
|
|
6914
|
+
path,
|
|
6653
6915
|
body: JSON.stringify(body),
|
|
6654
6916
|
httpMethod: 'POST',
|
|
6655
6917
|
httpOptions,
|
|
@@ -6811,6 +7073,14 @@ class CrossUploader {
|
|
|
6811
7073
|
return uploadBlob(file, uploadUrl, apiClient);
|
|
6812
7074
|
}
|
|
6813
7075
|
}
|
|
7076
|
+
async uploadToFileSearchStore(file, uploadUrl, apiClient) {
|
|
7077
|
+
if (typeof file === 'string') {
|
|
7078
|
+
throw crossError();
|
|
7079
|
+
}
|
|
7080
|
+
else {
|
|
7081
|
+
return uploadBlobToFileSearchStore(file, uploadUrl, apiClient);
|
|
7082
|
+
}
|
|
7083
|
+
}
|
|
6814
7084
|
async stat(file) {
|
|
6815
7085
|
if (typeof file === 'string') {
|
|
6816
7086
|
throw crossError();
|
|
@@ -6821,7 +7091,28 @@ class CrossUploader {
|
|
|
6821
7091
|
}
|
|
6822
7092
|
}
|
|
6823
7093
|
async function uploadBlob(file, uploadUrl, apiClient) {
|
|
6824
|
-
var _a
|
|
7094
|
+
var _a;
|
|
7095
|
+
const response = await uploadBlobInternal(file, uploadUrl, apiClient);
|
|
7096
|
+
const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
|
|
7097
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
|
|
7098
|
+
throw new Error('Failed to upload file: Upload status is not finalized.');
|
|
7099
|
+
}
|
|
7100
|
+
return responseJson['file'];
|
|
7101
|
+
}
|
|
7102
|
+
async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient) {
|
|
7103
|
+
var _a;
|
|
7104
|
+
const response = await uploadBlobInternal(file, uploadUrl, apiClient);
|
|
7105
|
+
const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
|
|
7106
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
|
|
7107
|
+
throw new Error('Failed to upload file: Upload status is not finalized.');
|
|
7108
|
+
}
|
|
7109
|
+
const resp = uploadToFileSearchStoreOperationFromMldev(responseJson);
|
|
7110
|
+
const typedResp = new UploadToFileSearchStoreOperation();
|
|
7111
|
+
Object.assign(typedResp, resp);
|
|
7112
|
+
return typedResp;
|
|
7113
|
+
}
|
|
7114
|
+
async function uploadBlobInternal(file, uploadUrl, apiClient) {
|
|
7115
|
+
var _a, _b;
|
|
6825
7116
|
let fileSize = 0;
|
|
6826
7117
|
let offset = 0;
|
|
6827
7118
|
let response = new HttpResponse(new Response());
|
|
@@ -6869,11 +7160,7 @@ async function uploadBlob(file, uploadUrl, apiClient) {
|
|
|
6869
7160
|
throw new Error('All content has been uploaded, but the upload status is not finalized.');
|
|
6870
7161
|
}
|
|
6871
7162
|
}
|
|
6872
|
-
|
|
6873
|
-
if (((_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
|
|
6874
|
-
throw new Error('Failed to upload file: Upload status is not finalized.');
|
|
6875
|
-
}
|
|
6876
|
-
return responseJson['file'];
|
|
7163
|
+
return response;
|
|
6877
7164
|
}
|
|
6878
7165
|
async function getBlobStat(file) {
|
|
6879
7166
|
const fileStat = { size: file.size, type: file.type };
|
|
@@ -7080,20 +7367,728 @@ class Files extends BaseModule {
|
|
|
7080
7367
|
* download files in the browser, use a browser compliant method like an <a>
|
|
7081
7368
|
* tag.
|
|
7082
7369
|
*
|
|
7083
|
-
* @param params - The parameters for the download request.
|
|
7370
|
+
* @param params - The parameters for the download request.
|
|
7371
|
+
*
|
|
7372
|
+
* @example
|
|
7373
|
+
* The following code downloads an example file named "files/mehozpxf877d" as
|
|
7374
|
+
* "file.txt".
|
|
7375
|
+
*
|
|
7376
|
+
* ```ts
|
|
7377
|
+
* await ai.files.download({file: file.name, downloadPath: 'file.txt'});
|
|
7378
|
+
* ```
|
|
7379
|
+
*/
|
|
7380
|
+
async download(params) {
|
|
7381
|
+
await this.apiClient.downloadFile(params);
|
|
7382
|
+
}
|
|
7383
|
+
async listInternal(params) {
|
|
7384
|
+
var _a, _b;
|
|
7385
|
+
let response;
|
|
7386
|
+
let path = '';
|
|
7387
|
+
let queryParams = {};
|
|
7388
|
+
if (this.apiClient.isVertexAI()) {
|
|
7389
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7390
|
+
}
|
|
7391
|
+
else {
|
|
7392
|
+
const body = listFilesParametersToMldev(params);
|
|
7393
|
+
path = formatMap('files', body['_url']);
|
|
7394
|
+
queryParams = body['_query'];
|
|
7395
|
+
delete body['_url'];
|
|
7396
|
+
delete body['_query'];
|
|
7397
|
+
response = this.apiClient
|
|
7398
|
+
.request({
|
|
7399
|
+
path: path,
|
|
7400
|
+
queryParams: queryParams,
|
|
7401
|
+
body: JSON.stringify(body),
|
|
7402
|
+
httpMethod: 'GET',
|
|
7403
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7404
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7405
|
+
})
|
|
7406
|
+
.then((httpResponse) => {
|
|
7407
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
7408
|
+
const response = jsonResponse;
|
|
7409
|
+
response.sdkHttpResponse = {
|
|
7410
|
+
headers: httpResponse.headers,
|
|
7411
|
+
};
|
|
7412
|
+
return response;
|
|
7413
|
+
});
|
|
7414
|
+
});
|
|
7415
|
+
return response.then((apiResponse) => {
|
|
7416
|
+
const resp = listFilesResponseFromMldev(apiResponse);
|
|
7417
|
+
const typedResp = new ListFilesResponse();
|
|
7418
|
+
Object.assign(typedResp, resp);
|
|
7419
|
+
return typedResp;
|
|
7420
|
+
});
|
|
7421
|
+
}
|
|
7422
|
+
}
|
|
7423
|
+
async createInternal(params) {
|
|
7424
|
+
var _a, _b;
|
|
7425
|
+
let response;
|
|
7426
|
+
let path = '';
|
|
7427
|
+
let queryParams = {};
|
|
7428
|
+
if (this.apiClient.isVertexAI()) {
|
|
7429
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7430
|
+
}
|
|
7431
|
+
else {
|
|
7432
|
+
const body = createFileParametersToMldev(params);
|
|
7433
|
+
path = formatMap('upload/v1beta/files', body['_url']);
|
|
7434
|
+
queryParams = body['_query'];
|
|
7435
|
+
delete body['_url'];
|
|
7436
|
+
delete body['_query'];
|
|
7437
|
+
response = this.apiClient
|
|
7438
|
+
.request({
|
|
7439
|
+
path: path,
|
|
7440
|
+
queryParams: queryParams,
|
|
7441
|
+
body: JSON.stringify(body),
|
|
7442
|
+
httpMethod: 'POST',
|
|
7443
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7444
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7445
|
+
})
|
|
7446
|
+
.then((httpResponse) => {
|
|
7447
|
+
return httpResponse.json();
|
|
7448
|
+
});
|
|
7449
|
+
return response.then((apiResponse) => {
|
|
7450
|
+
const resp = createFileResponseFromMldev(apiResponse);
|
|
7451
|
+
const typedResp = new CreateFileResponse();
|
|
7452
|
+
Object.assign(typedResp, resp);
|
|
7453
|
+
return typedResp;
|
|
7454
|
+
});
|
|
7455
|
+
}
|
|
7456
|
+
}
|
|
7457
|
+
/**
|
|
7458
|
+
* Retrieves the file information from the service.
|
|
7459
|
+
*
|
|
7460
|
+
* @param params - The parameters for the get request
|
|
7461
|
+
* @return The Promise that resolves to the types.File object requested.
|
|
7462
|
+
*
|
|
7463
|
+
* @example
|
|
7464
|
+
* ```ts
|
|
7465
|
+
* const config: GetFileParameters = {
|
|
7466
|
+
* name: fileName,
|
|
7467
|
+
* };
|
|
7468
|
+
* file = await ai.files.get(config);
|
|
7469
|
+
* console.log(file.name);
|
|
7470
|
+
* ```
|
|
7471
|
+
*/
|
|
7472
|
+
async get(params) {
|
|
7473
|
+
var _a, _b;
|
|
7474
|
+
let response;
|
|
7475
|
+
let path = '';
|
|
7476
|
+
let queryParams = {};
|
|
7477
|
+
if (this.apiClient.isVertexAI()) {
|
|
7478
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7479
|
+
}
|
|
7480
|
+
else {
|
|
7481
|
+
const body = getFileParametersToMldev(params);
|
|
7482
|
+
path = formatMap('files/{file}', body['_url']);
|
|
7483
|
+
queryParams = body['_query'];
|
|
7484
|
+
delete body['_url'];
|
|
7485
|
+
delete body['_query'];
|
|
7486
|
+
response = this.apiClient
|
|
7487
|
+
.request({
|
|
7488
|
+
path: path,
|
|
7489
|
+
queryParams: queryParams,
|
|
7490
|
+
body: JSON.stringify(body),
|
|
7491
|
+
httpMethod: 'GET',
|
|
7492
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7493
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7494
|
+
})
|
|
7495
|
+
.then((httpResponse) => {
|
|
7496
|
+
return httpResponse.json();
|
|
7497
|
+
});
|
|
7498
|
+
return response.then((resp) => {
|
|
7499
|
+
return resp;
|
|
7500
|
+
});
|
|
7501
|
+
}
|
|
7502
|
+
}
|
|
7503
|
+
/**
|
|
7504
|
+
* Deletes a remotely stored file.
|
|
7505
|
+
*
|
|
7506
|
+
* @param params - The parameters for the delete request.
|
|
7507
|
+
* @return The DeleteFileResponse, the response for the delete method.
|
|
7508
|
+
*
|
|
7509
|
+
* @example
|
|
7510
|
+
* The following code deletes an example file named "files/mehozpxf877d".
|
|
7511
|
+
*
|
|
7512
|
+
* ```ts
|
|
7513
|
+
* await ai.files.delete({name: file.name});
|
|
7514
|
+
* ```
|
|
7515
|
+
*/
|
|
7516
|
+
async delete(params) {
|
|
7517
|
+
var _a, _b;
|
|
7518
|
+
let response;
|
|
7519
|
+
let path = '';
|
|
7520
|
+
let queryParams = {};
|
|
7521
|
+
if (this.apiClient.isVertexAI()) {
|
|
7522
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7523
|
+
}
|
|
7524
|
+
else {
|
|
7525
|
+
const body = deleteFileParametersToMldev(params);
|
|
7526
|
+
path = formatMap('files/{file}', body['_url']);
|
|
7527
|
+
queryParams = body['_query'];
|
|
7528
|
+
delete body['_url'];
|
|
7529
|
+
delete body['_query'];
|
|
7530
|
+
response = this.apiClient
|
|
7531
|
+
.request({
|
|
7532
|
+
path: path,
|
|
7533
|
+
queryParams: queryParams,
|
|
7534
|
+
body: JSON.stringify(body),
|
|
7535
|
+
httpMethod: 'DELETE',
|
|
7536
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7537
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7538
|
+
})
|
|
7539
|
+
.then((httpResponse) => {
|
|
7540
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
7541
|
+
const response = jsonResponse;
|
|
7542
|
+
response.sdkHttpResponse = {
|
|
7543
|
+
headers: httpResponse.headers,
|
|
7544
|
+
};
|
|
7545
|
+
return response;
|
|
7546
|
+
});
|
|
7547
|
+
});
|
|
7548
|
+
return response.then((apiResponse) => {
|
|
7549
|
+
const resp = deleteFileResponseFromMldev(apiResponse);
|
|
7550
|
+
const typedResp = new DeleteFileResponse();
|
|
7551
|
+
Object.assign(typedResp, resp);
|
|
7552
|
+
return typedResp;
|
|
7553
|
+
});
|
|
7554
|
+
}
|
|
7555
|
+
}
|
|
7556
|
+
}
|
|
7557
|
+
|
|
7558
|
+
/**
|
|
7559
|
+
* @license
|
|
7560
|
+
* Copyright 2025 Google LLC
|
|
7561
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7562
|
+
*/
|
|
7563
|
+
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
7564
|
+
function createFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
7565
|
+
const toObject = {};
|
|
7566
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7567
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
7568
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
7569
|
+
}
|
|
7570
|
+
return toObject;
|
|
7571
|
+
}
|
|
7572
|
+
function createFileSearchStoreParametersToMldev(fromObject) {
|
|
7573
|
+
const toObject = {};
|
|
7574
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7575
|
+
if (fromConfig != null) {
|
|
7576
|
+
createFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
7577
|
+
}
|
|
7578
|
+
return toObject;
|
|
7579
|
+
}
|
|
7580
|
+
function deleteFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
7581
|
+
const toObject = {};
|
|
7582
|
+
const fromForce = getValueByPath(fromObject, ['force']);
|
|
7583
|
+
if (parentObject !== undefined && fromForce != null) {
|
|
7584
|
+
setValueByPath(parentObject, ['_query', 'force'], fromForce);
|
|
7585
|
+
}
|
|
7586
|
+
return toObject;
|
|
7587
|
+
}
|
|
7588
|
+
function deleteFileSearchStoreParametersToMldev(fromObject) {
|
|
7589
|
+
const toObject = {};
|
|
7590
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7591
|
+
if (fromName != null) {
|
|
7592
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7593
|
+
}
|
|
7594
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7595
|
+
if (fromConfig != null) {
|
|
7596
|
+
deleteFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
7597
|
+
}
|
|
7598
|
+
return toObject;
|
|
7599
|
+
}
|
|
7600
|
+
function getFileSearchStoreParametersToMldev(fromObject) {
|
|
7601
|
+
const toObject = {};
|
|
7602
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7603
|
+
if (fromName != null) {
|
|
7604
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7605
|
+
}
|
|
7606
|
+
return toObject;
|
|
7607
|
+
}
|
|
7608
|
+
function importFileConfigToMldev(fromObject, parentObject) {
|
|
7609
|
+
const toObject = {};
|
|
7610
|
+
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
7611
|
+
'customMetadata',
|
|
7612
|
+
]);
|
|
7613
|
+
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
7614
|
+
let transformedList = fromCustomMetadata;
|
|
7615
|
+
if (Array.isArray(transformedList)) {
|
|
7616
|
+
transformedList = transformedList.map((item) => {
|
|
7617
|
+
return item;
|
|
7618
|
+
});
|
|
7619
|
+
}
|
|
7620
|
+
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
7621
|
+
}
|
|
7622
|
+
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
7623
|
+
'chunkingConfig',
|
|
7624
|
+
]);
|
|
7625
|
+
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
7626
|
+
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
7627
|
+
}
|
|
7628
|
+
return toObject;
|
|
7629
|
+
}
|
|
7630
|
+
function importFileOperationFromMldev(fromObject) {
|
|
7631
|
+
const toObject = {};
|
|
7632
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7633
|
+
if (fromName != null) {
|
|
7634
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
7635
|
+
}
|
|
7636
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
7637
|
+
if (fromMetadata != null) {
|
|
7638
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
7639
|
+
}
|
|
7640
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
7641
|
+
if (fromDone != null) {
|
|
7642
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
7643
|
+
}
|
|
7644
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
7645
|
+
if (fromError != null) {
|
|
7646
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
7647
|
+
}
|
|
7648
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
7649
|
+
if (fromResponse != null) {
|
|
7650
|
+
setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
|
|
7651
|
+
}
|
|
7652
|
+
return toObject;
|
|
7653
|
+
}
|
|
7654
|
+
function importFileParametersToMldev(fromObject) {
|
|
7655
|
+
const toObject = {};
|
|
7656
|
+
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
7657
|
+
'fileSearchStoreName',
|
|
7658
|
+
]);
|
|
7659
|
+
if (fromFileSearchStoreName != null) {
|
|
7660
|
+
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
7661
|
+
}
|
|
7662
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
7663
|
+
if (fromFileName != null) {
|
|
7664
|
+
setValueByPath(toObject, ['fileName'], fromFileName);
|
|
7665
|
+
}
|
|
7666
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7667
|
+
if (fromConfig != null) {
|
|
7668
|
+
importFileConfigToMldev(fromConfig, toObject);
|
|
7669
|
+
}
|
|
7670
|
+
return toObject;
|
|
7671
|
+
}
|
|
7672
|
+
function importFileResponseFromMldev(fromObject) {
|
|
7673
|
+
const toObject = {};
|
|
7674
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7675
|
+
'sdkHttpResponse',
|
|
7676
|
+
]);
|
|
7677
|
+
if (fromSdkHttpResponse != null) {
|
|
7678
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7679
|
+
}
|
|
7680
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
7681
|
+
if (fromParent != null) {
|
|
7682
|
+
setValueByPath(toObject, ['parent'], fromParent);
|
|
7683
|
+
}
|
|
7684
|
+
const fromDocumentName = getValueByPath(fromObject, ['documentName']);
|
|
7685
|
+
if (fromDocumentName != null) {
|
|
7686
|
+
setValueByPath(toObject, ['documentName'], fromDocumentName);
|
|
7687
|
+
}
|
|
7688
|
+
return toObject;
|
|
7689
|
+
}
|
|
7690
|
+
function listFileSearchStoresConfigToMldev(fromObject, parentObject) {
|
|
7691
|
+
const toObject = {};
|
|
7692
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
7693
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
7694
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
7695
|
+
}
|
|
7696
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
7697
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
7698
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
7699
|
+
}
|
|
7700
|
+
return toObject;
|
|
7701
|
+
}
|
|
7702
|
+
function listFileSearchStoresParametersToMldev(fromObject) {
|
|
7703
|
+
const toObject = {};
|
|
7704
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7705
|
+
if (fromConfig != null) {
|
|
7706
|
+
listFileSearchStoresConfigToMldev(fromConfig, toObject);
|
|
7707
|
+
}
|
|
7708
|
+
return toObject;
|
|
7709
|
+
}
|
|
7710
|
+
function listFileSearchStoresResponseFromMldev(fromObject) {
|
|
7711
|
+
const toObject = {};
|
|
7712
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7713
|
+
'sdkHttpResponse',
|
|
7714
|
+
]);
|
|
7715
|
+
if (fromSdkHttpResponse != null) {
|
|
7716
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7717
|
+
}
|
|
7718
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
7719
|
+
'nextPageToken',
|
|
7720
|
+
]);
|
|
7721
|
+
if (fromNextPageToken != null) {
|
|
7722
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
7723
|
+
}
|
|
7724
|
+
const fromFileSearchStores = getValueByPath(fromObject, [
|
|
7725
|
+
'fileSearchStores',
|
|
7726
|
+
]);
|
|
7727
|
+
if (fromFileSearchStores != null) {
|
|
7728
|
+
let transformedList = fromFileSearchStores;
|
|
7729
|
+
if (Array.isArray(transformedList)) {
|
|
7730
|
+
transformedList = transformedList.map((item) => {
|
|
7731
|
+
return item;
|
|
7732
|
+
});
|
|
7733
|
+
}
|
|
7734
|
+
setValueByPath(toObject, ['fileSearchStores'], transformedList);
|
|
7735
|
+
}
|
|
7736
|
+
return toObject;
|
|
7737
|
+
}
|
|
7738
|
+
function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
7739
|
+
const toObject = {};
|
|
7740
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7741
|
+
if (parentObject !== undefined && fromMimeType != null) {
|
|
7742
|
+
setValueByPath(parentObject, ['mimeType'], fromMimeType);
|
|
7743
|
+
}
|
|
7744
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7745
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
7746
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
7747
|
+
}
|
|
7748
|
+
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
7749
|
+
'customMetadata',
|
|
7750
|
+
]);
|
|
7751
|
+
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
7752
|
+
let transformedList = fromCustomMetadata;
|
|
7753
|
+
if (Array.isArray(transformedList)) {
|
|
7754
|
+
transformedList = transformedList.map((item) => {
|
|
7755
|
+
return item;
|
|
7756
|
+
});
|
|
7757
|
+
}
|
|
7758
|
+
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
7759
|
+
}
|
|
7760
|
+
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
7761
|
+
'chunkingConfig',
|
|
7762
|
+
]);
|
|
7763
|
+
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
7764
|
+
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
7765
|
+
}
|
|
7766
|
+
return toObject;
|
|
7767
|
+
}
|
|
7768
|
+
function uploadToFileSearchStoreParametersToMldev(fromObject) {
|
|
7769
|
+
const toObject = {};
|
|
7770
|
+
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
7771
|
+
'fileSearchStoreName',
|
|
7772
|
+
]);
|
|
7773
|
+
if (fromFileSearchStoreName != null) {
|
|
7774
|
+
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
7775
|
+
}
|
|
7776
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7777
|
+
if (fromConfig != null) {
|
|
7778
|
+
uploadToFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
7779
|
+
}
|
|
7780
|
+
return toObject;
|
|
7781
|
+
}
|
|
7782
|
+
function uploadToFileSearchStoreResumableResponseFromMldev(fromObject) {
|
|
7783
|
+
const toObject = {};
|
|
7784
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7785
|
+
'sdkHttpResponse',
|
|
7786
|
+
]);
|
|
7787
|
+
if (fromSdkHttpResponse != null) {
|
|
7788
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7789
|
+
}
|
|
7790
|
+
return toObject;
|
|
7791
|
+
}
|
|
7792
|
+
|
|
7793
|
+
/**
|
|
7794
|
+
* @license
|
|
7795
|
+
* Copyright 2025 Google LLC
|
|
7796
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7797
|
+
*/
|
|
7798
|
+
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
7799
|
+
function deleteDocumentConfigToMldev(fromObject, parentObject) {
|
|
7800
|
+
const toObject = {};
|
|
7801
|
+
const fromForce = getValueByPath(fromObject, ['force']);
|
|
7802
|
+
if (parentObject !== undefined && fromForce != null) {
|
|
7803
|
+
setValueByPath(parentObject, ['_query', 'force'], fromForce);
|
|
7804
|
+
}
|
|
7805
|
+
return toObject;
|
|
7806
|
+
}
|
|
7807
|
+
function deleteDocumentParametersToMldev(fromObject) {
|
|
7808
|
+
const toObject = {};
|
|
7809
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7810
|
+
if (fromName != null) {
|
|
7811
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7812
|
+
}
|
|
7813
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7814
|
+
if (fromConfig != null) {
|
|
7815
|
+
deleteDocumentConfigToMldev(fromConfig, toObject);
|
|
7816
|
+
}
|
|
7817
|
+
return toObject;
|
|
7818
|
+
}
|
|
7819
|
+
function getDocumentParametersToMldev(fromObject) {
|
|
7820
|
+
const toObject = {};
|
|
7821
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7822
|
+
if (fromName != null) {
|
|
7823
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7824
|
+
}
|
|
7825
|
+
return toObject;
|
|
7826
|
+
}
|
|
7827
|
+
function listDocumentsConfigToMldev(fromObject, parentObject) {
|
|
7828
|
+
const toObject = {};
|
|
7829
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
7830
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
7831
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
7832
|
+
}
|
|
7833
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
7834
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
7835
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
7836
|
+
}
|
|
7837
|
+
return toObject;
|
|
7838
|
+
}
|
|
7839
|
+
function listDocumentsParametersToMldev(fromObject) {
|
|
7840
|
+
const toObject = {};
|
|
7841
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
7842
|
+
if (fromParent != null) {
|
|
7843
|
+
setValueByPath(toObject, ['_url', 'parent'], fromParent);
|
|
7844
|
+
}
|
|
7845
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7846
|
+
if (fromConfig != null) {
|
|
7847
|
+
listDocumentsConfigToMldev(fromConfig, toObject);
|
|
7848
|
+
}
|
|
7849
|
+
return toObject;
|
|
7850
|
+
}
|
|
7851
|
+
function listDocumentsResponseFromMldev(fromObject) {
|
|
7852
|
+
const toObject = {};
|
|
7853
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7854
|
+
'sdkHttpResponse',
|
|
7855
|
+
]);
|
|
7856
|
+
if (fromSdkHttpResponse != null) {
|
|
7857
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7858
|
+
}
|
|
7859
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
7860
|
+
'nextPageToken',
|
|
7861
|
+
]);
|
|
7862
|
+
if (fromNextPageToken != null) {
|
|
7863
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
7864
|
+
}
|
|
7865
|
+
const fromDocuments = getValueByPath(fromObject, ['documents']);
|
|
7866
|
+
if (fromDocuments != null) {
|
|
7867
|
+
let transformedList = fromDocuments;
|
|
7868
|
+
if (Array.isArray(transformedList)) {
|
|
7869
|
+
transformedList = transformedList.map((item) => {
|
|
7870
|
+
return item;
|
|
7871
|
+
});
|
|
7872
|
+
}
|
|
7873
|
+
setValueByPath(toObject, ['documents'], transformedList);
|
|
7874
|
+
}
|
|
7875
|
+
return toObject;
|
|
7876
|
+
}
|
|
7877
|
+
|
|
7878
|
+
/**
|
|
7879
|
+
* @license
|
|
7880
|
+
* Copyright 2025 Google LLC
|
|
7881
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7882
|
+
*/
|
|
7883
|
+
class Documents extends BaseModule {
|
|
7884
|
+
constructor(apiClient) {
|
|
7885
|
+
super();
|
|
7886
|
+
this.apiClient = apiClient;
|
|
7887
|
+
/**
|
|
7888
|
+
* Lists documents.
|
|
7889
|
+
*
|
|
7890
|
+
* @param params - The parameters for the list request.
|
|
7891
|
+
* @return - A pager of documents.
|
|
7892
|
+
*
|
|
7893
|
+
* @example
|
|
7894
|
+
* ```ts
|
|
7895
|
+
* const documents = await ai.documents.list({config: {'pageSize': 2}});
|
|
7896
|
+
* for await (const document of documents) {
|
|
7897
|
+
* console.log(document);
|
|
7898
|
+
* }
|
|
7899
|
+
* ```
|
|
7900
|
+
*/
|
|
7901
|
+
this.list = async (params) => {
|
|
7902
|
+
return new Pager(exports.PagedItem.PAGED_ITEM_DOCUMENTS, (x) => this.listInternal({
|
|
7903
|
+
parent: params.parent,
|
|
7904
|
+
config: x.config,
|
|
7905
|
+
}), await this.listInternal(params), params);
|
|
7906
|
+
};
|
|
7907
|
+
}
|
|
7908
|
+
/**
|
|
7909
|
+
* Gets a Document.
|
|
7910
|
+
*
|
|
7911
|
+
* @param params - The parameters for getting a document.
|
|
7912
|
+
* @return Document.
|
|
7913
|
+
*/
|
|
7914
|
+
async get(params) {
|
|
7915
|
+
var _a, _b;
|
|
7916
|
+
let response;
|
|
7917
|
+
let path = '';
|
|
7918
|
+
let queryParams = {};
|
|
7919
|
+
if (this.apiClient.isVertexAI()) {
|
|
7920
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7921
|
+
}
|
|
7922
|
+
else {
|
|
7923
|
+
const body = getDocumentParametersToMldev(params);
|
|
7924
|
+
path = formatMap('{name}', body['_url']);
|
|
7925
|
+
queryParams = body['_query'];
|
|
7926
|
+
delete body['_url'];
|
|
7927
|
+
delete body['_query'];
|
|
7928
|
+
response = this.apiClient
|
|
7929
|
+
.request({
|
|
7930
|
+
path: path,
|
|
7931
|
+
queryParams: queryParams,
|
|
7932
|
+
body: JSON.stringify(body),
|
|
7933
|
+
httpMethod: 'GET',
|
|
7934
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7935
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7936
|
+
})
|
|
7937
|
+
.then((httpResponse) => {
|
|
7938
|
+
return httpResponse.json();
|
|
7939
|
+
});
|
|
7940
|
+
return response.then((resp) => {
|
|
7941
|
+
return resp;
|
|
7942
|
+
});
|
|
7943
|
+
}
|
|
7944
|
+
}
|
|
7945
|
+
/**
|
|
7946
|
+
* Deletes a Document.
|
|
7947
|
+
*
|
|
7948
|
+
* @param params - The parameters for deleting a document.
|
|
7949
|
+
*/
|
|
7950
|
+
async delete(params) {
|
|
7951
|
+
var _a, _b;
|
|
7952
|
+
let path = '';
|
|
7953
|
+
let queryParams = {};
|
|
7954
|
+
if (this.apiClient.isVertexAI()) {
|
|
7955
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7956
|
+
}
|
|
7957
|
+
else {
|
|
7958
|
+
const body = deleteDocumentParametersToMldev(params);
|
|
7959
|
+
path = formatMap('{name}', body['_url']);
|
|
7960
|
+
queryParams = body['_query'];
|
|
7961
|
+
delete body['_url'];
|
|
7962
|
+
delete body['_query'];
|
|
7963
|
+
await this.apiClient.request({
|
|
7964
|
+
path: path,
|
|
7965
|
+
queryParams: queryParams,
|
|
7966
|
+
body: JSON.stringify(body),
|
|
7967
|
+
httpMethod: 'DELETE',
|
|
7968
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7969
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7970
|
+
});
|
|
7971
|
+
}
|
|
7972
|
+
}
|
|
7973
|
+
/**
|
|
7974
|
+
* Lists all Documents in a FileSearchStore.
|
|
7975
|
+
*
|
|
7976
|
+
* @param params - The parameters for listing documents.
|
|
7977
|
+
* @return ListDocumentsResponse.
|
|
7978
|
+
*/
|
|
7979
|
+
async listInternal(params) {
|
|
7980
|
+
var _a, _b;
|
|
7981
|
+
let response;
|
|
7982
|
+
let path = '';
|
|
7983
|
+
let queryParams = {};
|
|
7984
|
+
if (this.apiClient.isVertexAI()) {
|
|
7985
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7986
|
+
}
|
|
7987
|
+
else {
|
|
7988
|
+
const body = listDocumentsParametersToMldev(params);
|
|
7989
|
+
path = formatMap('{parent}/documents', body['_url']);
|
|
7990
|
+
queryParams = body['_query'];
|
|
7991
|
+
delete body['_url'];
|
|
7992
|
+
delete body['_query'];
|
|
7993
|
+
response = this.apiClient
|
|
7994
|
+
.request({
|
|
7995
|
+
path: path,
|
|
7996
|
+
queryParams: queryParams,
|
|
7997
|
+
body: JSON.stringify(body),
|
|
7998
|
+
httpMethod: 'GET',
|
|
7999
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8000
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8001
|
+
})
|
|
8002
|
+
.then((httpResponse) => {
|
|
8003
|
+
return httpResponse.json();
|
|
8004
|
+
});
|
|
8005
|
+
return response.then((apiResponse) => {
|
|
8006
|
+
const resp = listDocumentsResponseFromMldev(apiResponse);
|
|
8007
|
+
const typedResp = new ListDocumentsResponse();
|
|
8008
|
+
Object.assign(typedResp, resp);
|
|
8009
|
+
return typedResp;
|
|
8010
|
+
});
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
}
|
|
8014
|
+
|
|
8015
|
+
/**
|
|
8016
|
+
* @license
|
|
8017
|
+
* Copyright 2025 Google LLC
|
|
8018
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8019
|
+
*/
|
|
8020
|
+
class FileSearchStores extends BaseModule {
|
|
8021
|
+
constructor(apiClient, documents = new Documents(apiClient)) {
|
|
8022
|
+
super();
|
|
8023
|
+
this.apiClient = apiClient;
|
|
8024
|
+
this.documents = documents;
|
|
8025
|
+
/**
|
|
8026
|
+
* Lists file search stores.
|
|
8027
|
+
*
|
|
8028
|
+
* @param params - The parameters for the list request.
|
|
8029
|
+
* @return - A pager of file search stores.
|
|
8030
|
+
*
|
|
8031
|
+
* @example
|
|
8032
|
+
* ```ts
|
|
8033
|
+
* const fileSearchStores = await ai.fileSearchStores.list({config: {'pageSize': 2}});
|
|
8034
|
+
* for await (const fileSearchStore of fileSearchStores) {
|
|
8035
|
+
* console.log(fileSearchStore);
|
|
8036
|
+
* }
|
|
8037
|
+
* ```
|
|
8038
|
+
*/
|
|
8039
|
+
this.list = async (params = {}) => {
|
|
8040
|
+
return new Pager(exports.PagedItem.PAGED_ITEM_FILE_SEARCH_STORES, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
8041
|
+
};
|
|
8042
|
+
}
|
|
8043
|
+
/**
|
|
8044
|
+
* Uploads a file asynchronously to a given File Search Store.
|
|
8045
|
+
* This method is not available in Vertex AI.
|
|
8046
|
+
* Supported upload sources:
|
|
8047
|
+
* - Node.js: File path (string) or Blob object.
|
|
8048
|
+
* - Browser: Blob object (e.g., File).
|
|
8049
|
+
*
|
|
8050
|
+
* @remarks
|
|
8051
|
+
* The `mimeType` can be specified in the `config` parameter. If omitted:
|
|
8052
|
+
* - For file path (string) inputs, the `mimeType` will be inferred from the
|
|
8053
|
+
* file extension.
|
|
8054
|
+
* - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
|
|
8055
|
+
* property.
|
|
8056
|
+
*
|
|
8057
|
+
* This section can contain multiple paragraphs and code examples.
|
|
8058
|
+
*
|
|
8059
|
+
* @param params - Optional parameters specified in the
|
|
8060
|
+
* `types.UploadToFileSearchStoreParameters` interface.
|
|
8061
|
+
* @see {@link types.UploadToFileSearchStoreParameters#config} for the optional
|
|
8062
|
+
* config in the parameters.
|
|
8063
|
+
* @return A promise that resolves to a long running operation.
|
|
8064
|
+
* @throws An error if called on a Vertex AI client.
|
|
8065
|
+
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
8066
|
+
* the `mimeType` can be provided in the `params.config` parameter.
|
|
8067
|
+
* @throws An error occurs if a suitable upload location cannot be established.
|
|
7084
8068
|
*
|
|
7085
8069
|
* @example
|
|
7086
|
-
* The following code
|
|
7087
|
-
* "file.txt".
|
|
8070
|
+
* The following code uploads a file to a given file search store.
|
|
7088
8071
|
*
|
|
7089
8072
|
* ```ts
|
|
7090
|
-
* await ai.
|
|
8073
|
+
* const operation = await ai.fileSearchStores.upload({fileSearchStoreName: 'fileSearchStores/foo-bar', file: 'file.txt', config: {
|
|
8074
|
+
* mimeType: 'text/plain',
|
|
8075
|
+
* }});
|
|
8076
|
+
* console.log(operation.name);
|
|
7091
8077
|
* ```
|
|
7092
8078
|
*/
|
|
7093
|
-
async
|
|
7094
|
-
|
|
8079
|
+
async uploadToFileSearchStore(params) {
|
|
8080
|
+
if (this.apiClient.isVertexAI()) {
|
|
8081
|
+
throw new Error('Vertex AI does not support uploading files to a file search store.');
|
|
8082
|
+
}
|
|
8083
|
+
return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName, params.file, params.config);
|
|
7095
8084
|
}
|
|
7096
|
-
|
|
8085
|
+
/**
|
|
8086
|
+
* Creates a File Search Store.
|
|
8087
|
+
*
|
|
8088
|
+
* @param params - The parameters for creating a File Search Store.
|
|
8089
|
+
* @return FileSearchStore.
|
|
8090
|
+
*/
|
|
8091
|
+
async create(params) {
|
|
7097
8092
|
var _a, _b;
|
|
7098
8093
|
let response;
|
|
7099
8094
|
let path = '';
|
|
@@ -7102,8 +8097,8 @@ class Files extends BaseModule {
|
|
|
7102
8097
|
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7103
8098
|
}
|
|
7104
8099
|
else {
|
|
7105
|
-
const body =
|
|
7106
|
-
path = formatMap('
|
|
8100
|
+
const body = createFileSearchStoreParametersToMldev(params);
|
|
8101
|
+
path = formatMap('fileSearchStores', body['_url']);
|
|
7107
8102
|
queryParams = body['_query'];
|
|
7108
8103
|
delete body['_url'];
|
|
7109
8104
|
delete body['_query'];
|
|
@@ -7112,28 +8107,25 @@ class Files extends BaseModule {
|
|
|
7112
8107
|
path: path,
|
|
7113
8108
|
queryParams: queryParams,
|
|
7114
8109
|
body: JSON.stringify(body),
|
|
7115
|
-
httpMethod: '
|
|
8110
|
+
httpMethod: 'POST',
|
|
7116
8111
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7117
8112
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7118
8113
|
})
|
|
7119
8114
|
.then((httpResponse) => {
|
|
7120
|
-
return httpResponse.json()
|
|
7121
|
-
const response = jsonResponse;
|
|
7122
|
-
response.sdkHttpResponse = {
|
|
7123
|
-
headers: httpResponse.headers,
|
|
7124
|
-
};
|
|
7125
|
-
return response;
|
|
7126
|
-
});
|
|
8115
|
+
return httpResponse.json();
|
|
7127
8116
|
});
|
|
7128
|
-
return response.then((
|
|
7129
|
-
|
|
7130
|
-
const typedResp = new ListFilesResponse();
|
|
7131
|
-
Object.assign(typedResp, resp);
|
|
7132
|
-
return typedResp;
|
|
8117
|
+
return response.then((resp) => {
|
|
8118
|
+
return resp;
|
|
7133
8119
|
});
|
|
7134
8120
|
}
|
|
7135
8121
|
}
|
|
7136
|
-
|
|
8122
|
+
/**
|
|
8123
|
+
* Gets a File Search Store.
|
|
8124
|
+
*
|
|
8125
|
+
* @param params - The parameters for getting a File Search Store.
|
|
8126
|
+
* @return FileSearchStore.
|
|
8127
|
+
*/
|
|
8128
|
+
async get(params) {
|
|
7137
8129
|
var _a, _b;
|
|
7138
8130
|
let response;
|
|
7139
8131
|
let path = '';
|
|
@@ -7142,8 +8134,8 @@ class Files extends BaseModule {
|
|
|
7142
8134
|
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7143
8135
|
}
|
|
7144
8136
|
else {
|
|
7145
|
-
const body =
|
|
7146
|
-
path = formatMap('
|
|
8137
|
+
const body = getFileSearchStoreParametersToMldev(params);
|
|
8138
|
+
path = formatMap('{name}', body['_url']);
|
|
7147
8139
|
queryParams = body['_query'];
|
|
7148
8140
|
delete body['_url'];
|
|
7149
8141
|
delete body['_query'];
|
|
@@ -7152,37 +8144,53 @@ class Files extends BaseModule {
|
|
|
7152
8144
|
path: path,
|
|
7153
8145
|
queryParams: queryParams,
|
|
7154
8146
|
body: JSON.stringify(body),
|
|
7155
|
-
httpMethod: '
|
|
8147
|
+
httpMethod: 'GET',
|
|
7156
8148
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7157
8149
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7158
8150
|
})
|
|
7159
8151
|
.then((httpResponse) => {
|
|
7160
8152
|
return httpResponse.json();
|
|
7161
8153
|
});
|
|
7162
|
-
return response.then((
|
|
7163
|
-
|
|
7164
|
-
const typedResp = new CreateFileResponse();
|
|
7165
|
-
Object.assign(typedResp, resp);
|
|
7166
|
-
return typedResp;
|
|
8154
|
+
return response.then((resp) => {
|
|
8155
|
+
return resp;
|
|
7167
8156
|
});
|
|
7168
8157
|
}
|
|
7169
8158
|
}
|
|
7170
8159
|
/**
|
|
7171
|
-
*
|
|
8160
|
+
* Deletes a File Search Store.
|
|
7172
8161
|
*
|
|
7173
|
-
* @param params - The parameters for
|
|
7174
|
-
|
|
8162
|
+
* @param params - The parameters for deleting a File Search Store.
|
|
8163
|
+
*/
|
|
8164
|
+
async delete(params) {
|
|
8165
|
+
var _a, _b;
|
|
8166
|
+
let path = '';
|
|
8167
|
+
let queryParams = {};
|
|
8168
|
+
if (this.apiClient.isVertexAI()) {
|
|
8169
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
8170
|
+
}
|
|
8171
|
+
else {
|
|
8172
|
+
const body = deleteFileSearchStoreParametersToMldev(params);
|
|
8173
|
+
path = formatMap('{name}', body['_url']);
|
|
8174
|
+
queryParams = body['_query'];
|
|
8175
|
+
delete body['_url'];
|
|
8176
|
+
delete body['_query'];
|
|
8177
|
+
await this.apiClient.request({
|
|
8178
|
+
path: path,
|
|
8179
|
+
queryParams: queryParams,
|
|
8180
|
+
body: JSON.stringify(body),
|
|
8181
|
+
httpMethod: 'DELETE',
|
|
8182
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8183
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8184
|
+
});
|
|
8185
|
+
}
|
|
8186
|
+
}
|
|
8187
|
+
/**
|
|
8188
|
+
* Lists all FileSearchStore owned by the user.
|
|
7175
8189
|
*
|
|
7176
|
-
* @
|
|
7177
|
-
*
|
|
7178
|
-
* const config: GetFileParameters = {
|
|
7179
|
-
* name: fileName,
|
|
7180
|
-
* };
|
|
7181
|
-
* file = await ai.files.get(config);
|
|
7182
|
-
* console.log(file.name);
|
|
7183
|
-
* ```
|
|
8190
|
+
* @param params - The parameters for listing file search stores.
|
|
8191
|
+
* @return ListFileSearchStoresResponse.
|
|
7184
8192
|
*/
|
|
7185
|
-
async
|
|
8193
|
+
async listInternal(params) {
|
|
7186
8194
|
var _a, _b;
|
|
7187
8195
|
let response;
|
|
7188
8196
|
let path = '';
|
|
@@ -7191,8 +8199,8 @@ class Files extends BaseModule {
|
|
|
7191
8199
|
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7192
8200
|
}
|
|
7193
8201
|
else {
|
|
7194
|
-
const body =
|
|
7195
|
-
path = formatMap('
|
|
8202
|
+
const body = listFileSearchStoresParametersToMldev(params);
|
|
8203
|
+
path = formatMap('fileSearchStores', body['_url']);
|
|
7196
8204
|
queryParams = body['_query'];
|
|
7197
8205
|
delete body['_url'];
|
|
7198
8206
|
delete body['_query'];
|
|
@@ -7208,25 +8216,57 @@ class Files extends BaseModule {
|
|
|
7208
8216
|
.then((httpResponse) => {
|
|
7209
8217
|
return httpResponse.json();
|
|
7210
8218
|
});
|
|
7211
|
-
return response.then((
|
|
7212
|
-
|
|
8219
|
+
return response.then((apiResponse) => {
|
|
8220
|
+
const resp = listFileSearchStoresResponseFromMldev(apiResponse);
|
|
8221
|
+
const typedResp = new ListFileSearchStoresResponse();
|
|
8222
|
+
Object.assign(typedResp, resp);
|
|
8223
|
+
return typedResp;
|
|
8224
|
+
});
|
|
8225
|
+
}
|
|
8226
|
+
}
|
|
8227
|
+
async uploadToFileSearchStoreInternal(params) {
|
|
8228
|
+
var _a, _b;
|
|
8229
|
+
let response;
|
|
8230
|
+
let path = '';
|
|
8231
|
+
let queryParams = {};
|
|
8232
|
+
if (this.apiClient.isVertexAI()) {
|
|
8233
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
8234
|
+
}
|
|
8235
|
+
else {
|
|
8236
|
+
const body = uploadToFileSearchStoreParametersToMldev(params);
|
|
8237
|
+
path = formatMap('upload/v1beta/{file_search_store_name}:uploadToFileSearchStore', body['_url']);
|
|
8238
|
+
queryParams = body['_query'];
|
|
8239
|
+
delete body['_url'];
|
|
8240
|
+
delete body['_query'];
|
|
8241
|
+
response = this.apiClient
|
|
8242
|
+
.request({
|
|
8243
|
+
path: path,
|
|
8244
|
+
queryParams: queryParams,
|
|
8245
|
+
body: JSON.stringify(body),
|
|
8246
|
+
httpMethod: 'POST',
|
|
8247
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8248
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8249
|
+
})
|
|
8250
|
+
.then((httpResponse) => {
|
|
8251
|
+
return httpResponse.json();
|
|
8252
|
+
});
|
|
8253
|
+
return response.then((apiResponse) => {
|
|
8254
|
+
const resp = uploadToFileSearchStoreResumableResponseFromMldev(apiResponse);
|
|
8255
|
+
const typedResp = new UploadToFileSearchStoreResumableResponse();
|
|
8256
|
+
Object.assign(typedResp, resp);
|
|
8257
|
+
return typedResp;
|
|
7213
8258
|
});
|
|
7214
8259
|
}
|
|
7215
8260
|
}
|
|
7216
8261
|
/**
|
|
7217
|
-
*
|
|
7218
|
-
*
|
|
7219
|
-
* @param params - The parameters for the delete request.
|
|
7220
|
-
* @return The DeleteFileResponse, the response for the delete method.
|
|
8262
|
+
* Imports a File from File Service to a FileSearchStore.
|
|
7221
8263
|
*
|
|
7222
|
-
*
|
|
7223
|
-
* The following code deletes an example file named "files/mehozpxf877d".
|
|
8264
|
+
* This is a long-running operation, see aip.dev/151
|
|
7224
8265
|
*
|
|
7225
|
-
*
|
|
7226
|
-
*
|
|
7227
|
-
* ```
|
|
8266
|
+
* @param params - The parameters for importing a file to a file search store.
|
|
8267
|
+
* @return ImportFileOperation.
|
|
7228
8268
|
*/
|
|
7229
|
-
async
|
|
8269
|
+
async importFile(params) {
|
|
7230
8270
|
var _a, _b;
|
|
7231
8271
|
let response;
|
|
7232
8272
|
let path = '';
|
|
@@ -7235,8 +8275,8 @@ class Files extends BaseModule {
|
|
|
7235
8275
|
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7236
8276
|
}
|
|
7237
8277
|
else {
|
|
7238
|
-
const body =
|
|
7239
|
-
path = formatMap('
|
|
8278
|
+
const body = importFileParametersToMldev(params);
|
|
8279
|
+
path = formatMap('{file_search_store_name}:importFile', body['_url']);
|
|
7240
8280
|
queryParams = body['_query'];
|
|
7241
8281
|
delete body['_url'];
|
|
7242
8282
|
delete body['_query'];
|
|
@@ -7245,22 +8285,16 @@ class Files extends BaseModule {
|
|
|
7245
8285
|
path: path,
|
|
7246
8286
|
queryParams: queryParams,
|
|
7247
8287
|
body: JSON.stringify(body),
|
|
7248
|
-
httpMethod: '
|
|
8288
|
+
httpMethod: 'POST',
|
|
7249
8289
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7250
8290
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7251
8291
|
})
|
|
7252
8292
|
.then((httpResponse) => {
|
|
7253
|
-
return httpResponse.json()
|
|
7254
|
-
const response = jsonResponse;
|
|
7255
|
-
response.sdkHttpResponse = {
|
|
7256
|
-
headers: httpResponse.headers,
|
|
7257
|
-
};
|
|
7258
|
-
return response;
|
|
7259
|
-
});
|
|
8293
|
+
return httpResponse.json();
|
|
7260
8294
|
});
|
|
7261
8295
|
return response.then((apiResponse) => {
|
|
7262
|
-
const resp =
|
|
7263
|
-
const typedResp = new
|
|
8296
|
+
const resp = importFileOperationFromMldev(apiResponse);
|
|
8297
|
+
const typedResp = new ImportFileOperation();
|
|
7264
8298
|
Object.assign(typedResp, resp);
|
|
7265
8299
|
return typedResp;
|
|
7266
8300
|
});
|
|
@@ -7364,6 +8398,12 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
7364
8398
|
if (fromModelSelectionConfig != null) {
|
|
7365
8399
|
setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
|
|
7366
8400
|
}
|
|
8401
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
8402
|
+
'responseJsonSchema',
|
|
8403
|
+
]);
|
|
8404
|
+
if (fromResponseJsonSchema != null) {
|
|
8405
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
8406
|
+
}
|
|
7367
8407
|
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
7368
8408
|
'audioTimestamp',
|
|
7369
8409
|
]);
|
|
@@ -7410,12 +8450,6 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
7410
8450
|
if (fromPresencePenalty != null) {
|
|
7411
8451
|
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
7412
8452
|
}
|
|
7413
|
-
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
7414
|
-
'responseJsonSchema',
|
|
7415
|
-
]);
|
|
7416
|
-
if (fromResponseJsonSchema != null) {
|
|
7417
|
-
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
7418
|
-
}
|
|
7419
8453
|
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
7420
8454
|
'responseLogprobs',
|
|
7421
8455
|
]);
|
|
@@ -7500,6 +8534,9 @@ function googleSearchToMldev$2(fromObject) {
|
|
|
7500
8534
|
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
7501
8535
|
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
7502
8536
|
}
|
|
8537
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
8538
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
8539
|
+
}
|
|
7503
8540
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
7504
8541
|
'timeRangeFilter',
|
|
7505
8542
|
]);
|
|
@@ -8007,14 +9044,14 @@ function toolToMldev$2(fromObject) {
|
|
|
8007
9044
|
if (fromGoogleSearchRetrieval != null) {
|
|
8008
9045
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
8009
9046
|
}
|
|
8010
|
-
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
8011
|
-
if (fromGoogleMaps != null) {
|
|
8012
|
-
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
|
|
8013
|
-
}
|
|
8014
9047
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8015
9048
|
if (fromComputerUse != null) {
|
|
8016
9049
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8017
9050
|
}
|
|
9051
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
9052
|
+
if (fromFileSearch != null) {
|
|
9053
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
9054
|
+
}
|
|
8018
9055
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8019
9056
|
'codeExecution',
|
|
8020
9057
|
]);
|
|
@@ -8024,6 +9061,10 @@ function toolToMldev$2(fromObject) {
|
|
|
8024
9061
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
8025
9062
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
8026
9063
|
}
|
|
9064
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
9065
|
+
if (fromGoogleMaps != null) {
|
|
9066
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
|
|
9067
|
+
}
|
|
8027
9068
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
8028
9069
|
if (fromGoogleSearch != null) {
|
|
8029
9070
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
|
|
@@ -8058,14 +9099,13 @@ function toolToVertex$1(fromObject) {
|
|
|
8058
9099
|
if (fromGoogleSearchRetrieval != null) {
|
|
8059
9100
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
8060
9101
|
}
|
|
8061
|
-
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
8062
|
-
if (fromGoogleMaps != null) {
|
|
8063
|
-
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
8064
|
-
}
|
|
8065
9102
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8066
9103
|
if (fromComputerUse != null) {
|
|
8067
9104
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8068
9105
|
}
|
|
9106
|
+
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
9107
|
+
throw new Error('fileSearch parameter is not supported in Vertex AI.');
|
|
9108
|
+
}
|
|
8069
9109
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8070
9110
|
'codeExecution',
|
|
8071
9111
|
]);
|
|
@@ -8078,6 +9118,10 @@ function toolToVertex$1(fromObject) {
|
|
|
8078
9118
|
if (fromEnterpriseWebSearch != null) {
|
|
8079
9119
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
8080
9120
|
}
|
|
9121
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
9122
|
+
if (fromGoogleMaps != null) {
|
|
9123
|
+
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
9124
|
+
}
|
|
8081
9125
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
8082
9126
|
if (fromGoogleSearch != null) {
|
|
8083
9127
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
@@ -10027,6 +11071,12 @@ function generationConfigToVertex(fromObject) {
|
|
|
10027
11071
|
if (fromModelSelectionConfig != null) {
|
|
10028
11072
|
setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
|
|
10029
11073
|
}
|
|
11074
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
11075
|
+
'responseJsonSchema',
|
|
11076
|
+
]);
|
|
11077
|
+
if (fromResponseJsonSchema != null) {
|
|
11078
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
11079
|
+
}
|
|
10030
11080
|
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
10031
11081
|
'audioTimestamp',
|
|
10032
11082
|
]);
|
|
@@ -10073,12 +11123,6 @@ function generationConfigToVertex(fromObject) {
|
|
|
10073
11123
|
if (fromPresencePenalty != null) {
|
|
10074
11124
|
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
10075
11125
|
}
|
|
10076
|
-
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
10077
|
-
'responseJsonSchema',
|
|
10078
|
-
]);
|
|
10079
|
-
if (fromResponseJsonSchema != null) {
|
|
10080
|
-
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
10081
|
-
}
|
|
10082
11126
|
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
10083
11127
|
'responseLogprobs',
|
|
10084
11128
|
]);
|
|
@@ -10179,6 +11223,9 @@ function googleSearchToMldev$1(fromObject) {
|
|
|
10179
11223
|
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
10180
11224
|
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
10181
11225
|
}
|
|
11226
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
11227
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
11228
|
+
}
|
|
10182
11229
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
10183
11230
|
'timeRangeFilter',
|
|
10184
11231
|
]);
|
|
@@ -10416,6 +11463,28 @@ function modelFromMldev(fromObject) {
|
|
|
10416
11463
|
if (fromSupportedActions != null) {
|
|
10417
11464
|
setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
|
|
10418
11465
|
}
|
|
11466
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
11467
|
+
if (fromTemperature != null) {
|
|
11468
|
+
setValueByPath(toObject, ['temperature'], fromTemperature);
|
|
11469
|
+
}
|
|
11470
|
+
const fromMaxTemperature = getValueByPath(fromObject, [
|
|
11471
|
+
'maxTemperature',
|
|
11472
|
+
]);
|
|
11473
|
+
if (fromMaxTemperature != null) {
|
|
11474
|
+
setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
|
|
11475
|
+
}
|
|
11476
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
11477
|
+
if (fromTopP != null) {
|
|
11478
|
+
setValueByPath(toObject, ['topP'], fromTopP);
|
|
11479
|
+
}
|
|
11480
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
11481
|
+
if (fromTopK != null) {
|
|
11482
|
+
setValueByPath(toObject, ['topK'], fromTopK);
|
|
11483
|
+
}
|
|
11484
|
+
const fromThinking = getValueByPath(fromObject, ['thinking']);
|
|
11485
|
+
if (fromThinking != null) {
|
|
11486
|
+
setValueByPath(toObject, ['thinking'], fromThinking);
|
|
11487
|
+
}
|
|
10419
11488
|
return toObject;
|
|
10420
11489
|
}
|
|
10421
11490
|
function modelFromVertex(fromObject) {
|
|
@@ -10544,7 +11613,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
|
|
|
10544
11613
|
}
|
|
10545
11614
|
const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
|
|
10546
11615
|
if (parentObject !== undefined && fromBaseSteps != null) {
|
|
10547
|
-
setValueByPath(parentObject, ['parameters', '
|
|
11616
|
+
setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
|
|
10548
11617
|
}
|
|
10549
11618
|
const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
|
|
10550
11619
|
if (parentObject !== undefined && fromOutputGcsUri != null) {
|
|
@@ -10881,14 +11950,14 @@ function toolToMldev$1(fromObject) {
|
|
|
10881
11950
|
if (fromGoogleSearchRetrieval != null) {
|
|
10882
11951
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10883
11952
|
}
|
|
10884
|
-
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
10885
|
-
if (fromGoogleMaps != null) {
|
|
10886
|
-
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
|
|
10887
|
-
}
|
|
10888
11953
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10889
11954
|
if (fromComputerUse != null) {
|
|
10890
11955
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
10891
11956
|
}
|
|
11957
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
11958
|
+
if (fromFileSearch != null) {
|
|
11959
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
11960
|
+
}
|
|
10892
11961
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
10893
11962
|
'codeExecution',
|
|
10894
11963
|
]);
|
|
@@ -10898,6 +11967,10 @@ function toolToMldev$1(fromObject) {
|
|
|
10898
11967
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
10899
11968
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
10900
11969
|
}
|
|
11970
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
11971
|
+
if (fromGoogleMaps != null) {
|
|
11972
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
|
|
11973
|
+
}
|
|
10901
11974
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
10902
11975
|
if (fromGoogleSearch != null) {
|
|
10903
11976
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
|
|
@@ -10932,14 +12005,13 @@ function toolToVertex(fromObject) {
|
|
|
10932
12005
|
if (fromGoogleSearchRetrieval != null) {
|
|
10933
12006
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10934
12007
|
}
|
|
10935
|
-
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
10936
|
-
if (fromGoogleMaps != null) {
|
|
10937
|
-
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
10938
|
-
}
|
|
10939
12008
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10940
12009
|
if (fromComputerUse != null) {
|
|
10941
12010
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
10942
12011
|
}
|
|
12012
|
+
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12013
|
+
throw new Error('fileSearch parameter is not supported in Vertex AI.');
|
|
12014
|
+
}
|
|
10943
12015
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
10944
12016
|
'codeExecution',
|
|
10945
12017
|
]);
|
|
@@ -10952,6 +12024,10 @@ function toolToVertex(fromObject) {
|
|
|
10952
12024
|
if (fromEnterpriseWebSearch != null) {
|
|
10953
12025
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
10954
12026
|
}
|
|
12027
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
12028
|
+
if (fromGoogleMaps != null) {
|
|
12029
|
+
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
12030
|
+
}
|
|
10955
12031
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
10956
12032
|
if (fromGoogleSearch != null) {
|
|
10957
12033
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
@@ -12154,11 +13230,27 @@ function hasCallableTools(params) {
|
|
|
12154
13230
|
var _a, _b, _c;
|
|
12155
13231
|
return (_c = (_b = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools) === null || _b === void 0 ? void 0 : _b.some((tool) => isCallableTool(tool))) !== null && _c !== void 0 ? _c : false;
|
|
12156
13232
|
}
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
13233
|
+
/**
|
|
13234
|
+
* Returns the indexes of the tools that are not compatible with AFC.
|
|
13235
|
+
*/
|
|
13236
|
+
function findAfcIncompatibleToolIndexes(params) {
|
|
13237
|
+
var _a;
|
|
13238
|
+
// Use number[] for an array of numbers in TypeScript
|
|
13239
|
+
const afcIncompatibleToolIndexes = [];
|
|
13240
|
+
if (!((_a = params === null || params === void 0 ? void 0 : params.config) === null || _a === void 0 ? void 0 : _a.tools)) {
|
|
13241
|
+
return afcIncompatibleToolIndexes;
|
|
13242
|
+
}
|
|
13243
|
+
params.config.tools.forEach((tool, index) => {
|
|
13244
|
+
if (isCallableTool(tool)) {
|
|
13245
|
+
return;
|
|
13246
|
+
}
|
|
13247
|
+
const geminiTool = tool;
|
|
13248
|
+
if (geminiTool.functionDeclarations &&
|
|
13249
|
+
geminiTool.functionDeclarations.length > 0) {
|
|
13250
|
+
afcIncompatibleToolIndexes.push(index);
|
|
13251
|
+
}
|
|
13252
|
+
});
|
|
13253
|
+
return afcIncompatibleToolIndexes;
|
|
12162
13254
|
}
|
|
12163
13255
|
/**
|
|
12164
13256
|
* Returns whether to append automatic function calling history to the
|
|
@@ -12223,8 +13315,12 @@ class Models extends BaseModule {
|
|
|
12223
13315
|
if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
|
|
12224
13316
|
return await this.generateContentInternal(transformedParams);
|
|
12225
13317
|
}
|
|
12226
|
-
|
|
12227
|
-
|
|
13318
|
+
const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
|
|
13319
|
+
if (incompatibleToolIndexes.length > 0) {
|
|
13320
|
+
const formattedIndexes = incompatibleToolIndexes
|
|
13321
|
+
.map((index) => `tools[${index}]`)
|
|
13322
|
+
.join(', ');
|
|
13323
|
+
throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${formattedIndexes}.`);
|
|
12228
13324
|
}
|
|
12229
13325
|
let response;
|
|
12230
13326
|
let functionResponseContent;
|
|
@@ -12311,9 +13407,14 @@ class Models extends BaseModule {
|
|
|
12311
13407
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
12312
13408
|
return await this.generateContentStreamInternal(transformedParams);
|
|
12313
13409
|
}
|
|
12314
|
-
|
|
12315
|
-
|
|
13410
|
+
const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
|
|
13411
|
+
if (incompatibleToolIndexes.length > 0) {
|
|
13412
|
+
const formattedIndexes = incompatibleToolIndexes
|
|
13413
|
+
.map((index) => `tools[${index}]`)
|
|
13414
|
+
.join(', ');
|
|
13415
|
+
throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
|
|
12316
13416
|
}
|
|
13417
|
+
return await this.processAfcStream(params);
|
|
12317
13418
|
};
|
|
12318
13419
|
/**
|
|
12319
13420
|
* Generates an image based on a text description and configuration.
|
|
@@ -13709,7 +14810,7 @@ class Operations extends BaseModule {
|
|
|
13709
14810
|
});
|
|
13710
14811
|
return operation._fromAPIResponse({
|
|
13711
14812
|
apiResponse: rawOperation,
|
|
13712
|
-
|
|
14813
|
+
_isVertexAI: true,
|
|
13713
14814
|
});
|
|
13714
14815
|
}
|
|
13715
14816
|
else {
|
|
@@ -13719,7 +14820,7 @@ class Operations extends BaseModule {
|
|
|
13719
14820
|
});
|
|
13720
14821
|
return operation._fromAPIResponse({
|
|
13721
14822
|
apiResponse: rawOperation,
|
|
13722
|
-
|
|
14823
|
+
_isVertexAI: false,
|
|
13723
14824
|
});
|
|
13724
14825
|
}
|
|
13725
14826
|
}
|
|
@@ -13748,7 +14849,7 @@ class Operations extends BaseModule {
|
|
|
13748
14849
|
});
|
|
13749
14850
|
return operation._fromAPIResponse({
|
|
13750
14851
|
apiResponse: rawOperation,
|
|
13751
|
-
|
|
14852
|
+
_isVertexAI: true,
|
|
13752
14853
|
});
|
|
13753
14854
|
}
|
|
13754
14855
|
else {
|
|
@@ -13758,7 +14859,7 @@ class Operations extends BaseModule {
|
|
|
13758
14859
|
});
|
|
13759
14860
|
return operation._fromAPIResponse({
|
|
13760
14861
|
apiResponse: rawOperation,
|
|
13761
|
-
|
|
14862
|
+
_isVertexAI: false,
|
|
13762
14863
|
});
|
|
13763
14864
|
}
|
|
13764
14865
|
}
|
|
@@ -13946,6 +15047,9 @@ function googleSearchToMldev(fromObject) {
|
|
|
13946
15047
|
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
13947
15048
|
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
13948
15049
|
}
|
|
15050
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
15051
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
15052
|
+
}
|
|
13949
15053
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
13950
15054
|
'timeRangeFilter',
|
|
13951
15055
|
]);
|
|
@@ -14164,14 +15268,14 @@ function toolToMldev(fromObject) {
|
|
|
14164
15268
|
if (fromGoogleSearchRetrieval != null) {
|
|
14165
15269
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14166
15270
|
}
|
|
14167
|
-
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
14168
|
-
if (fromGoogleMaps != null) {
|
|
14169
|
-
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
14170
|
-
}
|
|
14171
15271
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14172
15272
|
if (fromComputerUse != null) {
|
|
14173
15273
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
14174
15274
|
}
|
|
15275
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
15276
|
+
if (fromFileSearch != null) {
|
|
15277
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
15278
|
+
}
|
|
14175
15279
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
14176
15280
|
'codeExecution',
|
|
14177
15281
|
]);
|
|
@@ -14181,6 +15285,10 @@ function toolToMldev(fromObject) {
|
|
|
14181
15285
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
14182
15286
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
14183
15287
|
}
|
|
15288
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
15289
|
+
if (fromGoogleMaps != null) {
|
|
15290
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
15291
|
+
}
|
|
14184
15292
|
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
14185
15293
|
if (fromGoogleSearch != null) {
|
|
14186
15294
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
|
|
@@ -15565,6 +16673,7 @@ class GoogleGenAI {
|
|
|
15565
16673
|
this.operations = new Operations(this.apiClient);
|
|
15566
16674
|
this.authTokens = new Tokens(this.apiClient);
|
|
15567
16675
|
this.tunings = new Tunings(this.apiClient);
|
|
16676
|
+
this.fileSearchStores = new FileSearchStores(this.apiClient);
|
|
15568
16677
|
}
|
|
15569
16678
|
}
|
|
15570
16679
|
|
|
@@ -15596,10 +16705,14 @@ exports.GenerateVideosOperation = GenerateVideosOperation;
|
|
|
15596
16705
|
exports.GenerateVideosResponse = GenerateVideosResponse;
|
|
15597
16706
|
exports.GoogleGenAI = GoogleGenAI;
|
|
15598
16707
|
exports.HttpResponse = HttpResponse;
|
|
16708
|
+
exports.ImportFileOperation = ImportFileOperation;
|
|
16709
|
+
exports.ImportFileResponse = ImportFileResponse;
|
|
15599
16710
|
exports.InlinedEmbedContentResponse = InlinedEmbedContentResponse;
|
|
15600
16711
|
exports.InlinedResponse = InlinedResponse;
|
|
15601
16712
|
exports.ListBatchJobsResponse = ListBatchJobsResponse;
|
|
15602
16713
|
exports.ListCachedContentsResponse = ListCachedContentsResponse;
|
|
16714
|
+
exports.ListDocumentsResponse = ListDocumentsResponse;
|
|
16715
|
+
exports.ListFileSearchStoresResponse = ListFileSearchStoresResponse;
|
|
15603
16716
|
exports.ListFilesResponse = ListFilesResponse;
|
|
15604
16717
|
exports.ListModelsResponse = ListModelsResponse;
|
|
15605
16718
|
exports.ListTuningJobsResponse = ListTuningJobsResponse;
|
|
@@ -15621,6 +16734,9 @@ exports.SingleEmbedContentResponse = SingleEmbedContentResponse;
|
|
|
15621
16734
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
15622
16735
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
15623
16736
|
exports.Tokens = Tokens;
|
|
16737
|
+
exports.UploadToFileSearchStoreOperation = UploadToFileSearchStoreOperation;
|
|
16738
|
+
exports.UploadToFileSearchStoreResponse = UploadToFileSearchStoreResponse;
|
|
16739
|
+
exports.UploadToFileSearchStoreResumableResponse = UploadToFileSearchStoreResumableResponse;
|
|
15624
16740
|
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
15625
16741
|
exports.createFunctionResponsePartFromBase64 = createFunctionResponsePartFromBase64;
|
|
15626
16742
|
exports.createFunctionResponsePartFromUri = createFunctionResponsePartFromUri;
|