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