@google/genai 1.33.0 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +233 -1
- package/dist/genai.d.ts +117 -201
- package/dist/index.cjs +304 -293
- package/dist/index.mjs +305 -294
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +304 -296
- package/dist/node/index.mjs +305 -297
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +117 -201
- package/dist/web/index.mjs +305 -297
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +117 -201
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -644,18 +644,6 @@ exports.Type = void 0;
|
|
|
644
644
|
*/
|
|
645
645
|
Type["NULL"] = "NULL";
|
|
646
646
|
})(exports.Type || (exports.Type = {}));
|
|
647
|
-
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
648
|
-
exports.Mode = void 0;
|
|
649
|
-
(function (Mode) {
|
|
650
|
-
/**
|
|
651
|
-
* Always trigger retrieval.
|
|
652
|
-
*/
|
|
653
|
-
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
654
|
-
/**
|
|
655
|
-
* Run retrieval only when system decides it is necessary.
|
|
656
|
-
*/
|
|
657
|
-
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
658
|
-
})(exports.Mode || (exports.Mode = {}));
|
|
659
647
|
/** The API spec that the external API implements. This enum is not supported in Gemini API. */
|
|
660
648
|
exports.ApiSpec = void 0;
|
|
661
649
|
(function (ApiSpec) {
|
|
@@ -758,21 +746,81 @@ exports.PhishBlockThreshold = void 0;
|
|
|
758
746
|
*/
|
|
759
747
|
PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
|
|
760
748
|
})(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
|
|
761
|
-
/**
|
|
749
|
+
/** Specifies the function Behavior. Currently only supported by the BidiGenerateContent method. This enum is not supported in Vertex AI. */
|
|
750
|
+
exports.Behavior = void 0;
|
|
751
|
+
(function (Behavior) {
|
|
752
|
+
/**
|
|
753
|
+
* This value is unused.
|
|
754
|
+
*/
|
|
755
|
+
Behavior["UNSPECIFIED"] = "UNSPECIFIED";
|
|
756
|
+
/**
|
|
757
|
+
* If set, the system will wait to receive the function response before continuing the conversation.
|
|
758
|
+
*/
|
|
759
|
+
Behavior["BLOCKING"] = "BLOCKING";
|
|
760
|
+
/**
|
|
761
|
+
* If set, the system will not wait to receive the function response. Instead, it will attempt to handle function responses as they become available while maintaining the conversation between the user and the model.
|
|
762
|
+
*/
|
|
763
|
+
Behavior["NON_BLOCKING"] = "NON_BLOCKING";
|
|
764
|
+
})(exports.Behavior || (exports.Behavior = {}));
|
|
765
|
+
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
766
|
+
exports.DynamicRetrievalConfigMode = void 0;
|
|
767
|
+
(function (DynamicRetrievalConfigMode) {
|
|
768
|
+
/**
|
|
769
|
+
* Always trigger retrieval.
|
|
770
|
+
*/
|
|
771
|
+
DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
772
|
+
/**
|
|
773
|
+
* Run retrieval only when system decides it is necessary.
|
|
774
|
+
*/
|
|
775
|
+
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
776
|
+
})(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
|
|
777
|
+
/** Function calling mode. */
|
|
778
|
+
exports.FunctionCallingConfigMode = void 0;
|
|
779
|
+
(function (FunctionCallingConfigMode) {
|
|
780
|
+
/**
|
|
781
|
+
* Unspecified function calling mode. This value should not be used.
|
|
782
|
+
*/
|
|
783
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
784
|
+
/**
|
|
785
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
786
|
+
*/
|
|
787
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
788
|
+
/**
|
|
789
|
+
* Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
790
|
+
*/
|
|
791
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
792
|
+
/**
|
|
793
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
794
|
+
*/
|
|
795
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
796
|
+
/**
|
|
797
|
+
* Model is constrained to predict either function calls or natural language response. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
798
|
+
*/
|
|
799
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
800
|
+
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
801
|
+
/** The number of thoughts tokens that the model should generate. */
|
|
762
802
|
exports.ThinkingLevel = void 0;
|
|
763
803
|
(function (ThinkingLevel) {
|
|
764
804
|
/**
|
|
765
|
-
*
|
|
805
|
+
* Unspecified thinking level.
|
|
766
806
|
*/
|
|
767
807
|
ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
|
|
768
808
|
/**
|
|
769
809
|
* Low thinking level.
|
|
770
810
|
*/
|
|
771
811
|
ThinkingLevel["LOW"] = "LOW";
|
|
812
|
+
/**
|
|
813
|
+
* Medium thinking level.
|
|
814
|
+
*/
|
|
815
|
+
ThinkingLevel["MEDIUM"] = "MEDIUM";
|
|
772
816
|
/**
|
|
773
817
|
* High thinking level.
|
|
774
818
|
*/
|
|
775
819
|
ThinkingLevel["HIGH"] = "HIGH";
|
|
820
|
+
/**
|
|
821
|
+
* MINIMAL thinking level.
|
|
822
|
+
*/
|
|
823
|
+
ThinkingLevel["MINIMAL"] = "MINIMAL";
|
|
776
824
|
})(exports.ThinkingLevel || (exports.ThinkingLevel = {}));
|
|
777
825
|
/** Harm category. */
|
|
778
826
|
exports.HarmCategory = void 0;
|
|
@@ -1243,6 +1291,10 @@ exports.PartMediaResolutionLevel = void 0;
|
|
|
1243
1291
|
* Media resolution set to high.
|
|
1244
1292
|
*/
|
|
1245
1293
|
PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1294
|
+
/**
|
|
1295
|
+
* Media resolution set to ultra high.
|
|
1296
|
+
*/
|
|
1297
|
+
PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
|
|
1246
1298
|
})(exports.PartMediaResolutionLevel || (exports.PartMediaResolutionLevel = {}));
|
|
1247
1299
|
/** Options for feature selection preference. */
|
|
1248
1300
|
exports.FeatureSelectionPreference = void 0;
|
|
@@ -1252,34 +1304,6 @@ exports.FeatureSelectionPreference = void 0;
|
|
|
1252
1304
|
FeatureSelectionPreference["BALANCED"] = "BALANCED";
|
|
1253
1305
|
FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
|
|
1254
1306
|
})(exports.FeatureSelectionPreference || (exports.FeatureSelectionPreference = {}));
|
|
1255
|
-
/** Defines the function behavior. Defaults to `BLOCKING`. */
|
|
1256
|
-
exports.Behavior = void 0;
|
|
1257
|
-
(function (Behavior) {
|
|
1258
|
-
/**
|
|
1259
|
-
* This value is unused.
|
|
1260
|
-
*/
|
|
1261
|
-
Behavior["UNSPECIFIED"] = "UNSPECIFIED";
|
|
1262
|
-
/**
|
|
1263
|
-
* If set, the system will wait to receive the function response before continuing the conversation.
|
|
1264
|
-
*/
|
|
1265
|
-
Behavior["BLOCKING"] = "BLOCKING";
|
|
1266
|
-
/**
|
|
1267
|
-
* If set, the system will not wait to receive the function response. Instead, it will attempt to handle function responses as they become available while maintaining the conversation between the user and the model.
|
|
1268
|
-
*/
|
|
1269
|
-
Behavior["NON_BLOCKING"] = "NON_BLOCKING";
|
|
1270
|
-
})(exports.Behavior || (exports.Behavior = {}));
|
|
1271
|
-
/** Config for the dynamic retrieval config mode. */
|
|
1272
|
-
exports.DynamicRetrievalConfigMode = void 0;
|
|
1273
|
-
(function (DynamicRetrievalConfigMode) {
|
|
1274
|
-
/**
|
|
1275
|
-
* Always trigger retrieval.
|
|
1276
|
-
*/
|
|
1277
|
-
DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1278
|
-
/**
|
|
1279
|
-
* Run retrieval only when system decides it is necessary.
|
|
1280
|
-
*/
|
|
1281
|
-
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1282
|
-
})(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
|
|
1283
1307
|
/** The environment being operated. */
|
|
1284
1308
|
exports.Environment = void 0;
|
|
1285
1309
|
(function (Environment) {
|
|
@@ -1292,30 +1316,6 @@ exports.Environment = void 0;
|
|
|
1292
1316
|
*/
|
|
1293
1317
|
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
1294
1318
|
})(exports.Environment || (exports.Environment = {}));
|
|
1295
|
-
/** Config for the function calling config mode. */
|
|
1296
|
-
exports.FunctionCallingConfigMode = void 0;
|
|
1297
|
-
(function (FunctionCallingConfigMode) {
|
|
1298
|
-
/**
|
|
1299
|
-
* The function calling config mode is unspecified. Should not be used.
|
|
1300
|
-
*/
|
|
1301
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1302
|
-
/**
|
|
1303
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
1304
|
-
*/
|
|
1305
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
1306
|
-
/**
|
|
1307
|
-
* Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
1308
|
-
*/
|
|
1309
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
1310
|
-
/**
|
|
1311
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
1312
|
-
*/
|
|
1313
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
1314
|
-
/**
|
|
1315
|
-
* Model decides to predict either a function call or a natural language response, but will validate function calls with constrained decoding. If "allowed_function_names" are set, the predicted function call will be limited to any one of "allowed_function_names", else the predicted function call will be any one of the provided "function_declarations".
|
|
1316
|
-
*/
|
|
1317
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
1318
|
-
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
1319
1319
|
/** Enum that controls the safety filter level for objectionable content. */
|
|
1320
1320
|
exports.SafetyFilterLevel = void 0;
|
|
1321
1321
|
(function (SafetyFilterLevel) {
|
|
@@ -1512,6 +1512,7 @@ exports.FileSource = void 0;
|
|
|
1512
1512
|
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1513
1513
|
FileSource["UPLOADED"] = "UPLOADED";
|
|
1514
1514
|
FileSource["GENERATED"] = "GENERATED";
|
|
1515
|
+
FileSource["REGISTERED"] = "REGISTERED";
|
|
1515
1516
|
})(exports.FileSource || (exports.FileSource = {}));
|
|
1516
1517
|
/** The reason why the turn is complete. */
|
|
1517
1518
|
exports.TurnCompleteReason = void 0;
|
|
@@ -3941,16 +3942,16 @@ function functionCallToMldev$4(fromObject) {
|
|
|
3941
3942
|
}
|
|
3942
3943
|
function functionCallingConfigToMldev$2(fromObject) {
|
|
3943
3944
|
const toObject = {};
|
|
3944
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3945
|
-
if (fromMode != null) {
|
|
3946
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3947
|
-
}
|
|
3948
3945
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
3949
3946
|
'allowedFunctionNames',
|
|
3950
3947
|
]);
|
|
3951
3948
|
if (fromAllowedFunctionNames != null) {
|
|
3952
3949
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
3953
3950
|
}
|
|
3951
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3952
|
+
if (fromMode != null) {
|
|
3953
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3954
|
+
}
|
|
3954
3955
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
3955
3956
|
undefined) {
|
|
3956
3957
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -4210,6 +4211,9 @@ function imageConfigToMldev$1(fromObject) {
|
|
|
4210
4211
|
if (fromImageSize != null) {
|
|
4211
4212
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
4212
4213
|
}
|
|
4214
|
+
if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
|
|
4215
|
+
throw new Error('personGeneration parameter is not supported in Gemini API.');
|
|
4216
|
+
}
|
|
4213
4217
|
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
4214
4218
|
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
4215
4219
|
}
|
|
@@ -4435,43 +4439,25 @@ function safetySettingToMldev$1(fromObject) {
|
|
|
4435
4439
|
}
|
|
4436
4440
|
function toolConfigToMldev$2(fromObject) {
|
|
4437
4441
|
const toObject = {};
|
|
4438
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
4439
|
-
'functionCallingConfig',
|
|
4440
|
-
]);
|
|
4441
|
-
if (fromFunctionCallingConfig != null) {
|
|
4442
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4443
|
-
}
|
|
4444
4442
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
4445
4443
|
'retrievalConfig',
|
|
4446
4444
|
]);
|
|
4447
4445
|
if (fromRetrievalConfig != null) {
|
|
4448
4446
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
4449
4447
|
}
|
|
4448
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
4449
|
+
'functionCallingConfig',
|
|
4450
|
+
]);
|
|
4451
|
+
if (fromFunctionCallingConfig != null) {
|
|
4452
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4453
|
+
}
|
|
4450
4454
|
return toObject;
|
|
4451
4455
|
}
|
|
4452
4456
|
function toolToMldev$4(fromObject) {
|
|
4453
4457
|
const toObject = {};
|
|
4454
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4455
|
-
'functionDeclarations',
|
|
4456
|
-
]);
|
|
4457
|
-
if (fromFunctionDeclarations != null) {
|
|
4458
|
-
let transformedList = fromFunctionDeclarations;
|
|
4459
|
-
if (Array.isArray(transformedList)) {
|
|
4460
|
-
transformedList = transformedList.map((item) => {
|
|
4461
|
-
return item;
|
|
4462
|
-
});
|
|
4463
|
-
}
|
|
4464
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
4465
|
-
}
|
|
4466
4458
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
4467
4459
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
4468
4460
|
}
|
|
4469
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
4470
|
-
'googleSearchRetrieval',
|
|
4471
|
-
]);
|
|
4472
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
4473
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4474
|
-
}
|
|
4475
4461
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4476
4462
|
if (fromComputerUse != null) {
|
|
4477
4463
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -4489,6 +4475,18 @@ function toolToMldev$4(fromObject) {
|
|
|
4489
4475
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
4490
4476
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
4491
4477
|
}
|
|
4478
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4479
|
+
'functionDeclarations',
|
|
4480
|
+
]);
|
|
4481
|
+
if (fromFunctionDeclarations != null) {
|
|
4482
|
+
let transformedList = fromFunctionDeclarations;
|
|
4483
|
+
if (Array.isArray(transformedList)) {
|
|
4484
|
+
transformedList = transformedList.map((item) => {
|
|
4485
|
+
return item;
|
|
4486
|
+
});
|
|
4487
|
+
}
|
|
4488
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
4489
|
+
}
|
|
4492
4490
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
4493
4491
|
if (fromGoogleMaps != null) {
|
|
4494
4492
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
|
|
@@ -4497,6 +4495,12 @@ function toolToMldev$4(fromObject) {
|
|
|
4497
4495
|
if (fromGoogleSearch != null) {
|
|
4498
4496
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
|
|
4499
4497
|
}
|
|
4498
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
4499
|
+
'googleSearchRetrieval',
|
|
4500
|
+
]);
|
|
4501
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
4502
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4503
|
+
}
|
|
4500
4504
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
4501
4505
|
if (fromUrlContext != null) {
|
|
4502
4506
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -5427,16 +5431,16 @@ function functionCallToMldev$3(fromObject) {
|
|
|
5427
5431
|
}
|
|
5428
5432
|
function functionCallingConfigToMldev$1(fromObject) {
|
|
5429
5433
|
const toObject = {};
|
|
5430
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5431
|
-
if (fromMode != null) {
|
|
5432
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
5433
|
-
}
|
|
5434
5434
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
5435
5435
|
'allowedFunctionNames',
|
|
5436
5436
|
]);
|
|
5437
5437
|
if (fromAllowedFunctionNames != null) {
|
|
5438
5438
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
5439
5439
|
}
|
|
5440
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5441
|
+
if (fromMode != null) {
|
|
5442
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
5443
|
+
}
|
|
5440
5444
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
5441
5445
|
undefined) {
|
|
5442
5446
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -5445,9 +5449,6 @@ function functionCallingConfigToMldev$1(fromObject) {
|
|
|
5445
5449
|
}
|
|
5446
5450
|
function functionDeclarationToVertex$2(fromObject) {
|
|
5447
5451
|
const toObject = {};
|
|
5448
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
5449
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
5450
|
-
}
|
|
5451
5452
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
5452
5453
|
if (fromDescription != null) {
|
|
5453
5454
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -5476,6 +5477,9 @@ function functionDeclarationToVertex$2(fromObject) {
|
|
|
5476
5477
|
if (fromResponseJsonSchema != null) {
|
|
5477
5478
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
5478
5479
|
}
|
|
5480
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
5481
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
5482
|
+
}
|
|
5479
5483
|
return toObject;
|
|
5480
5484
|
}
|
|
5481
5485
|
function getCachedContentParametersToMldev(apiClient, fromObject) {
|
|
@@ -5679,43 +5683,25 @@ function partToMldev$3(fromObject) {
|
|
|
5679
5683
|
}
|
|
5680
5684
|
function toolConfigToMldev$1(fromObject) {
|
|
5681
5685
|
const toObject = {};
|
|
5682
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
5683
|
-
'functionCallingConfig',
|
|
5684
|
-
]);
|
|
5685
|
-
if (fromFunctionCallingConfig != null) {
|
|
5686
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5687
|
-
}
|
|
5688
5686
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
5689
5687
|
'retrievalConfig',
|
|
5690
5688
|
]);
|
|
5691
5689
|
if (fromRetrievalConfig != null) {
|
|
5692
5690
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
5693
5691
|
}
|
|
5692
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
5693
|
+
'functionCallingConfig',
|
|
5694
|
+
]);
|
|
5695
|
+
if (fromFunctionCallingConfig != null) {
|
|
5696
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5697
|
+
}
|
|
5694
5698
|
return toObject;
|
|
5695
5699
|
}
|
|
5696
5700
|
function toolToMldev$3(fromObject) {
|
|
5697
5701
|
const toObject = {};
|
|
5698
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5699
|
-
'functionDeclarations',
|
|
5700
|
-
]);
|
|
5701
|
-
if (fromFunctionDeclarations != null) {
|
|
5702
|
-
let transformedList = fromFunctionDeclarations;
|
|
5703
|
-
if (Array.isArray(transformedList)) {
|
|
5704
|
-
transformedList = transformedList.map((item) => {
|
|
5705
|
-
return item;
|
|
5706
|
-
});
|
|
5707
|
-
}
|
|
5708
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5709
|
-
}
|
|
5710
5702
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
5711
5703
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
5712
5704
|
}
|
|
5713
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5714
|
-
'googleSearchRetrieval',
|
|
5715
|
-
]);
|
|
5716
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
5717
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5718
|
-
}
|
|
5719
5705
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5720
5706
|
if (fromComputerUse != null) {
|
|
5721
5707
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -5733,6 +5719,18 @@ function toolToMldev$3(fromObject) {
|
|
|
5733
5719
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5734
5720
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
5735
5721
|
}
|
|
5722
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5723
|
+
'functionDeclarations',
|
|
5724
|
+
]);
|
|
5725
|
+
if (fromFunctionDeclarations != null) {
|
|
5726
|
+
let transformedList = fromFunctionDeclarations;
|
|
5727
|
+
if (Array.isArray(transformedList)) {
|
|
5728
|
+
transformedList = transformedList.map((item) => {
|
|
5729
|
+
return item;
|
|
5730
|
+
});
|
|
5731
|
+
}
|
|
5732
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5733
|
+
}
|
|
5736
5734
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5737
5735
|
if (fromGoogleMaps != null) {
|
|
5738
5736
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
|
|
@@ -5741,6 +5739,12 @@ function toolToMldev$3(fromObject) {
|
|
|
5741
5739
|
if (fromGoogleSearch != null) {
|
|
5742
5740
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
|
|
5743
5741
|
}
|
|
5742
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5743
|
+
'googleSearchRetrieval',
|
|
5744
|
+
]);
|
|
5745
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
5746
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5747
|
+
}
|
|
5744
5748
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5745
5749
|
if (fromUrlContext != null) {
|
|
5746
5750
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -5749,28 +5753,10 @@ function toolToMldev$3(fromObject) {
|
|
|
5749
5753
|
}
|
|
5750
5754
|
function toolToVertex$2(fromObject) {
|
|
5751
5755
|
const toObject = {};
|
|
5752
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5753
|
-
'functionDeclarations',
|
|
5754
|
-
]);
|
|
5755
|
-
if (fromFunctionDeclarations != null) {
|
|
5756
|
-
let transformedList = fromFunctionDeclarations;
|
|
5757
|
-
if (Array.isArray(transformedList)) {
|
|
5758
|
-
transformedList = transformedList.map((item) => {
|
|
5759
|
-
return functionDeclarationToVertex$2(item);
|
|
5760
|
-
});
|
|
5761
|
-
}
|
|
5762
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5763
|
-
}
|
|
5764
5756
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
5765
5757
|
if (fromRetrieval != null) {
|
|
5766
5758
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
5767
5759
|
}
|
|
5768
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5769
|
-
'googleSearchRetrieval',
|
|
5770
|
-
]);
|
|
5771
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
5772
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5773
|
-
}
|
|
5774
5760
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5775
5761
|
if (fromComputerUse != null) {
|
|
5776
5762
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -5790,6 +5776,18 @@ function toolToVertex$2(fromObject) {
|
|
|
5790
5776
|
if (fromEnterpriseWebSearch != null) {
|
|
5791
5777
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
5792
5778
|
}
|
|
5779
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5780
|
+
'functionDeclarations',
|
|
5781
|
+
]);
|
|
5782
|
+
if (fromFunctionDeclarations != null) {
|
|
5783
|
+
let transformedList = fromFunctionDeclarations;
|
|
5784
|
+
if (Array.isArray(transformedList)) {
|
|
5785
|
+
transformedList = transformedList.map((item) => {
|
|
5786
|
+
return functionDeclarationToVertex$2(item);
|
|
5787
|
+
});
|
|
5788
|
+
}
|
|
5789
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5790
|
+
}
|
|
5793
5791
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5794
5792
|
if (fromGoogleMaps != null) {
|
|
5795
5793
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -5798,6 +5796,12 @@ function toolToVertex$2(fromObject) {
|
|
|
5798
5796
|
if (fromGoogleSearch != null) {
|
|
5799
5797
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
5800
5798
|
}
|
|
5799
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5800
|
+
'googleSearchRetrieval',
|
|
5801
|
+
]);
|
|
5802
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
5803
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5804
|
+
}
|
|
5801
5805
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5802
5806
|
if (fromUrlContext != null) {
|
|
5803
5807
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -6885,7 +6889,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6885
6889
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6886
6890
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6887
6891
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6888
|
-
const SDK_VERSION = '1.
|
|
6892
|
+
const SDK_VERSION = '1.35.0'; // x-release-please-version
|
|
6889
6893
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6890
6894
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6891
6895
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -6959,6 +6963,11 @@ class ApiClient {
|
|
|
6959
6963
|
getLocation() {
|
|
6960
6964
|
return this.clientOptions.location;
|
|
6961
6965
|
}
|
|
6966
|
+
async getAuthHeaders() {
|
|
6967
|
+
const headers = new Headers();
|
|
6968
|
+
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
6969
|
+
return headers;
|
|
6970
|
+
}
|
|
6962
6971
|
getApiVersion() {
|
|
6963
6972
|
if (this.clientOptions.httpOptions &&
|
|
6964
6973
|
this.clientOptions.httpOptions.apiVersion !== undefined) {
|
|
@@ -10085,7 +10094,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10085
10094
|
*/
|
|
10086
10095
|
constructor(_b) {
|
|
10087
10096
|
var _c, _d, _e, _f, _g, _h, _j;
|
|
10088
|
-
var
|
|
10097
|
+
var { baseURL = readEnv('GEMINI_NEXT_GEN_API_BASE_URL'), apiKey = (_c = readEnv('GEMINI_API_KEY')) !== null && _c !== void 0 ? _c : null, apiVersion = 'v1beta' } = _b, opts = __rest(_b, ["baseURL", "apiKey", "apiVersion"]);
|
|
10089
10098
|
const options = Object.assign(Object.assign({ apiKey,
|
|
10090
10099
|
apiVersion }, opts), { baseURL: baseURL || `https://generativelanguage.googleapis.com` });
|
|
10091
10100
|
this.baseURL = options.baseURL;
|
|
@@ -10103,6 +10112,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10103
10112
|
this._options = options;
|
|
10104
10113
|
this.apiKey = apiKey;
|
|
10105
10114
|
this.apiVersion = apiVersion;
|
|
10115
|
+
this.clientAdapter = options.clientAdapter;
|
|
10106
10116
|
}
|
|
10107
10117
|
/**
|
|
10108
10118
|
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
@@ -10121,6 +10131,10 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10121
10131
|
return this._options.defaultQuery;
|
|
10122
10132
|
}
|
|
10123
10133
|
validateHeaders({ values, nulls }) {
|
|
10134
|
+
// The headers object handles case insensitivity.
|
|
10135
|
+
if (values.has('authorization') || values.has('x-goog-api-key')) {
|
|
10136
|
+
return;
|
|
10137
|
+
}
|
|
10124
10138
|
if (this.apiKey && values.get('x-goog-api-key')) {
|
|
10125
10139
|
return;
|
|
10126
10140
|
}
|
|
@@ -10130,10 +10144,17 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10130
10144
|
throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted');
|
|
10131
10145
|
}
|
|
10132
10146
|
async authHeaders(opts) {
|
|
10133
|
-
|
|
10147
|
+
const existingHeaders = buildHeaders([opts.headers]);
|
|
10148
|
+
if (existingHeaders.values.has('authorization') || existingHeaders.values.has('x-goog-api-key')) {
|
|
10134
10149
|
return undefined;
|
|
10135
10150
|
}
|
|
10136
|
-
|
|
10151
|
+
if (this.apiKey) {
|
|
10152
|
+
return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
|
|
10153
|
+
}
|
|
10154
|
+
if (this.clientAdapter.isVertexAI()) {
|
|
10155
|
+
return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
|
|
10156
|
+
}
|
|
10157
|
+
return undefined;
|
|
10137
10158
|
}
|
|
10138
10159
|
/**
|
|
10139
10160
|
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
@@ -10177,8 +10198,16 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10177
10198
|
}
|
|
10178
10199
|
/**
|
|
10179
10200
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
10201
|
+
|
|
10180
10202
|
*/
|
|
10181
|
-
async prepareOptions(options) {
|
|
10203
|
+
async prepareOptions(options) {
|
|
10204
|
+
if (this.clientAdapter &&
|
|
10205
|
+
this.clientAdapter.isVertexAI() &&
|
|
10206
|
+
!options.path.startsWith(`/${this.apiVersion}/projects/`)) {
|
|
10207
|
+
const oldPath = options.path.slice(this.apiVersion.length + 1);
|
|
10208
|
+
options.path = `/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${oldPath}`;
|
|
10209
|
+
}
|
|
10210
|
+
}
|
|
10182
10211
|
/**
|
|
10183
10212
|
* Used as a callback for mutating the given `RequestInit` object.
|
|
10184
10213
|
*
|
|
@@ -10420,13 +10449,14 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10420
10449
|
options.idempotencyKey = this.defaultIdempotencyKey();
|
|
10421
10450
|
idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
|
|
10422
10451
|
}
|
|
10423
|
-
const
|
|
10452
|
+
const authHeaders = await this.authHeaders(options);
|
|
10453
|
+
let headers = buildHeaders([
|
|
10424
10454
|
idempotencyHeaders,
|
|
10425
10455
|
Object.assign(Object.assign({ Accept: 'application/json', 'User-Agent': this.getUserAgent(), 'X-Stainless-Retry-Count': String(retryCount) }, (options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {})), getPlatformHeaders()),
|
|
10426
|
-
await this.authHeaders(options),
|
|
10427
10456
|
this._options.defaultHeaders,
|
|
10428
10457
|
bodyHeaders,
|
|
10429
10458
|
options.headers,
|
|
10459
|
+
authHeaders,
|
|
10430
10460
|
]);
|
|
10431
10461
|
this.validateHeaders(headers);
|
|
10432
10462
|
return headers.values;
|
|
@@ -10569,9 +10599,6 @@ function functionCallToMldev$2(fromObject) {
|
|
|
10569
10599
|
}
|
|
10570
10600
|
function functionDeclarationToVertex$1(fromObject) {
|
|
10571
10601
|
const toObject = {};
|
|
10572
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
10573
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
10574
|
-
}
|
|
10575
10602
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
10576
10603
|
if (fromDescription != null) {
|
|
10577
10604
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -10600,6 +10627,9 @@ function functionDeclarationToVertex$1(fromObject) {
|
|
|
10600
10627
|
if (fromResponseJsonSchema != null) {
|
|
10601
10628
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
10602
10629
|
}
|
|
10630
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
10631
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
10632
|
+
}
|
|
10603
10633
|
return toObject;
|
|
10604
10634
|
}
|
|
10605
10635
|
function generationConfigToVertex$1(fromObject) {
|
|
@@ -10698,7 +10728,7 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
10698
10728
|
}
|
|
10699
10729
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
10700
10730
|
if (fromSpeechConfig != null) {
|
|
10701
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
10731
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
10702
10732
|
}
|
|
10703
10733
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
10704
10734
|
'stopSequences',
|
|
@@ -10914,7 +10944,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
10914
10944
|
}
|
|
10915
10945
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
10916
10946
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
10917
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'],
|
|
10947
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
|
|
10918
10948
|
}
|
|
10919
10949
|
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
10920
10950
|
'thinkingConfig',
|
|
@@ -11239,44 +11269,11 @@ function sessionResumptionConfigToMldev$1(fromObject) {
|
|
|
11239
11269
|
}
|
|
11240
11270
|
return toObject;
|
|
11241
11271
|
}
|
|
11242
|
-
function speechConfigToVertex$1(fromObject) {
|
|
11243
|
-
const toObject = {};
|
|
11244
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
11245
|
-
if (fromVoiceConfig != null) {
|
|
11246
|
-
setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
|
|
11247
|
-
}
|
|
11248
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
11249
|
-
if (fromLanguageCode != null) {
|
|
11250
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
11251
|
-
}
|
|
11252
|
-
if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
|
|
11253
|
-
throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
|
|
11254
|
-
}
|
|
11255
|
-
return toObject;
|
|
11256
|
-
}
|
|
11257
11272
|
function toolToMldev$2(fromObject) {
|
|
11258
11273
|
const toObject = {};
|
|
11259
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
11260
|
-
'functionDeclarations',
|
|
11261
|
-
]);
|
|
11262
|
-
if (fromFunctionDeclarations != null) {
|
|
11263
|
-
let transformedList = fromFunctionDeclarations;
|
|
11264
|
-
if (Array.isArray(transformedList)) {
|
|
11265
|
-
transformedList = transformedList.map((item) => {
|
|
11266
|
-
return item;
|
|
11267
|
-
});
|
|
11268
|
-
}
|
|
11269
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
11270
|
-
}
|
|
11271
11274
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
11272
11275
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
11273
11276
|
}
|
|
11274
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
11275
|
-
'googleSearchRetrieval',
|
|
11276
|
-
]);
|
|
11277
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
11278
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
11279
|
-
}
|
|
11280
11277
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
11281
11278
|
if (fromComputerUse != null) {
|
|
11282
11279
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -11294,6 +11291,18 @@ function toolToMldev$2(fromObject) {
|
|
|
11294
11291
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
11295
11292
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
11296
11293
|
}
|
|
11294
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
11295
|
+
'functionDeclarations',
|
|
11296
|
+
]);
|
|
11297
|
+
if (fromFunctionDeclarations != null) {
|
|
11298
|
+
let transformedList = fromFunctionDeclarations;
|
|
11299
|
+
if (Array.isArray(transformedList)) {
|
|
11300
|
+
transformedList = transformedList.map((item) => {
|
|
11301
|
+
return item;
|
|
11302
|
+
});
|
|
11303
|
+
}
|
|
11304
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
11305
|
+
}
|
|
11297
11306
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
11298
11307
|
if (fromGoogleMaps != null) {
|
|
11299
11308
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
|
|
@@ -11302,6 +11311,12 @@ function toolToMldev$2(fromObject) {
|
|
|
11302
11311
|
if (fromGoogleSearch != null) {
|
|
11303
11312
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
|
|
11304
11313
|
}
|
|
11314
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
11315
|
+
'googleSearchRetrieval',
|
|
11316
|
+
]);
|
|
11317
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
11318
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
11319
|
+
}
|
|
11305
11320
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
11306
11321
|
if (fromUrlContext != null) {
|
|
11307
11322
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -11310,28 +11325,10 @@ function toolToMldev$2(fromObject) {
|
|
|
11310
11325
|
}
|
|
11311
11326
|
function toolToVertex$1(fromObject) {
|
|
11312
11327
|
const toObject = {};
|
|
11313
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
11314
|
-
'functionDeclarations',
|
|
11315
|
-
]);
|
|
11316
|
-
if (fromFunctionDeclarations != null) {
|
|
11317
|
-
let transformedList = fromFunctionDeclarations;
|
|
11318
|
-
if (Array.isArray(transformedList)) {
|
|
11319
|
-
transformedList = transformedList.map((item) => {
|
|
11320
|
-
return functionDeclarationToVertex$1(item);
|
|
11321
|
-
});
|
|
11322
|
-
}
|
|
11323
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
11324
|
-
}
|
|
11325
11328
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
11326
11329
|
if (fromRetrieval != null) {
|
|
11327
11330
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
11328
11331
|
}
|
|
11329
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
11330
|
-
'googleSearchRetrieval',
|
|
11331
|
-
]);
|
|
11332
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
11333
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
11334
|
-
}
|
|
11335
11332
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
11336
11333
|
if (fromComputerUse != null) {
|
|
11337
11334
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -11351,6 +11348,18 @@ function toolToVertex$1(fromObject) {
|
|
|
11351
11348
|
if (fromEnterpriseWebSearch != null) {
|
|
11352
11349
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
11353
11350
|
}
|
|
11351
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
11352
|
+
'functionDeclarations',
|
|
11353
|
+
]);
|
|
11354
|
+
if (fromFunctionDeclarations != null) {
|
|
11355
|
+
let transformedList = fromFunctionDeclarations;
|
|
11356
|
+
if (Array.isArray(transformedList)) {
|
|
11357
|
+
transformedList = transformedList.map((item) => {
|
|
11358
|
+
return functionDeclarationToVertex$1(item);
|
|
11359
|
+
});
|
|
11360
|
+
}
|
|
11361
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
11362
|
+
}
|
|
11354
11363
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
11355
11364
|
if (fromGoogleMaps != null) {
|
|
11356
11365
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -11359,6 +11368,12 @@ function toolToVertex$1(fromObject) {
|
|
|
11359
11368
|
if (fromGoogleSearch != null) {
|
|
11360
11369
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
11361
11370
|
}
|
|
11371
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
11372
|
+
'googleSearchRetrieval',
|
|
11373
|
+
]);
|
|
11374
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
11375
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
11376
|
+
}
|
|
11362
11377
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
11363
11378
|
if (fromUrlContext != null) {
|
|
11364
11379
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -12141,16 +12156,16 @@ function functionCallToMldev$1(fromObject) {
|
|
|
12141
12156
|
}
|
|
12142
12157
|
function functionCallingConfigToMldev(fromObject) {
|
|
12143
12158
|
const toObject = {};
|
|
12144
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
12145
|
-
if (fromMode != null) {
|
|
12146
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
12147
|
-
}
|
|
12148
12159
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
12149
12160
|
'allowedFunctionNames',
|
|
12150
12161
|
]);
|
|
12151
12162
|
if (fromAllowedFunctionNames != null) {
|
|
12152
12163
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
12153
12164
|
}
|
|
12165
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
12166
|
+
if (fromMode != null) {
|
|
12167
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
12168
|
+
}
|
|
12154
12169
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
12155
12170
|
undefined) {
|
|
12156
12171
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -12159,9 +12174,6 @@ function functionCallingConfigToMldev(fromObject) {
|
|
|
12159
12174
|
}
|
|
12160
12175
|
function functionDeclarationToVertex(fromObject) {
|
|
12161
12176
|
const toObject = {};
|
|
12162
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
12163
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
12164
|
-
}
|
|
12165
12177
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
12166
12178
|
if (fromDescription != null) {
|
|
12167
12179
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -12190,6 +12202,9 @@ function functionDeclarationToVertex(fromObject) {
|
|
|
12190
12202
|
if (fromResponseJsonSchema != null) {
|
|
12191
12203
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
12192
12204
|
}
|
|
12205
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
12206
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
12207
|
+
}
|
|
12193
12208
|
return toObject;
|
|
12194
12209
|
}
|
|
12195
12210
|
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
@@ -12496,7 +12511,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
12496
12511
|
}
|
|
12497
12512
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
12498
12513
|
if (fromSpeechConfig != null) {
|
|
12499
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
12514
|
+
setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
|
|
12500
12515
|
}
|
|
12501
12516
|
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
12502
12517
|
'audioTimestamp',
|
|
@@ -13442,7 +13457,7 @@ function generationConfigToVertex(fromObject) {
|
|
|
13442
13457
|
}
|
|
13443
13458
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
13444
13459
|
if (fromSpeechConfig != null) {
|
|
13445
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
13460
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
13446
13461
|
}
|
|
13447
13462
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
13448
13463
|
'stopSequences',
|
|
@@ -13527,6 +13542,9 @@ function imageConfigToMldev(fromObject) {
|
|
|
13527
13542
|
if (fromImageSize != null) {
|
|
13528
13543
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
13529
13544
|
}
|
|
13545
|
+
if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
|
|
13546
|
+
throw new Error('personGeneration parameter is not supported in Gemini API.');
|
|
13547
|
+
}
|
|
13530
13548
|
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
13531
13549
|
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
13532
13550
|
}
|
|
@@ -13546,6 +13564,12 @@ function imageConfigToVertex(fromObject) {
|
|
|
13546
13564
|
if (fromImageSize != null) {
|
|
13547
13565
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
13548
13566
|
}
|
|
13567
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
13568
|
+
'personGeneration',
|
|
13569
|
+
]);
|
|
13570
|
+
if (fromPersonGeneration != null) {
|
|
13571
|
+
setValueByPath(toObject, ['personGeneration'], fromPersonGeneration);
|
|
13572
|
+
}
|
|
13549
13573
|
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
13550
13574
|
'outputMimeType',
|
|
13551
13575
|
]);
|
|
@@ -14244,60 +14268,27 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
|
|
|
14244
14268
|
}
|
|
14245
14269
|
return toObject;
|
|
14246
14270
|
}
|
|
14247
|
-
function speechConfigToVertex(fromObject) {
|
|
14248
|
-
const toObject = {};
|
|
14249
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
14250
|
-
if (fromVoiceConfig != null) {
|
|
14251
|
-
setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
|
|
14252
|
-
}
|
|
14253
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
14254
|
-
if (fromLanguageCode != null) {
|
|
14255
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
14256
|
-
}
|
|
14257
|
-
if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
|
|
14258
|
-
throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
|
|
14259
|
-
}
|
|
14260
|
-
return toObject;
|
|
14261
|
-
}
|
|
14262
14271
|
function toolConfigToMldev(fromObject) {
|
|
14263
14272
|
const toObject = {};
|
|
14264
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
14265
|
-
'functionCallingConfig',
|
|
14266
|
-
]);
|
|
14267
|
-
if (fromFunctionCallingConfig != null) {
|
|
14268
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
14269
|
-
}
|
|
14270
14273
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
14271
14274
|
'retrievalConfig',
|
|
14272
14275
|
]);
|
|
14273
14276
|
if (fromRetrievalConfig != null) {
|
|
14274
14277
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
14275
14278
|
}
|
|
14279
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
14280
|
+
'functionCallingConfig',
|
|
14281
|
+
]);
|
|
14282
|
+
if (fromFunctionCallingConfig != null) {
|
|
14283
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
14284
|
+
}
|
|
14276
14285
|
return toObject;
|
|
14277
14286
|
}
|
|
14278
14287
|
function toolToMldev$1(fromObject) {
|
|
14279
14288
|
const toObject = {};
|
|
14280
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14281
|
-
'functionDeclarations',
|
|
14282
|
-
]);
|
|
14283
|
-
if (fromFunctionDeclarations != null) {
|
|
14284
|
-
let transformedList = fromFunctionDeclarations;
|
|
14285
|
-
if (Array.isArray(transformedList)) {
|
|
14286
|
-
transformedList = transformedList.map((item) => {
|
|
14287
|
-
return item;
|
|
14288
|
-
});
|
|
14289
|
-
}
|
|
14290
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14291
|
-
}
|
|
14292
14289
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
14293
14290
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
14294
14291
|
}
|
|
14295
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14296
|
-
'googleSearchRetrieval',
|
|
14297
|
-
]);
|
|
14298
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
14299
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14300
|
-
}
|
|
14301
14292
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14302
14293
|
if (fromComputerUse != null) {
|
|
14303
14294
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -14315,6 +14306,18 @@ function toolToMldev$1(fromObject) {
|
|
|
14315
14306
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
14316
14307
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
14317
14308
|
}
|
|
14309
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14310
|
+
'functionDeclarations',
|
|
14311
|
+
]);
|
|
14312
|
+
if (fromFunctionDeclarations != null) {
|
|
14313
|
+
let transformedList = fromFunctionDeclarations;
|
|
14314
|
+
if (Array.isArray(transformedList)) {
|
|
14315
|
+
transformedList = transformedList.map((item) => {
|
|
14316
|
+
return item;
|
|
14317
|
+
});
|
|
14318
|
+
}
|
|
14319
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14320
|
+
}
|
|
14318
14321
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
14319
14322
|
if (fromGoogleMaps != null) {
|
|
14320
14323
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
|
|
@@ -14323,6 +14326,12 @@ function toolToMldev$1(fromObject) {
|
|
|
14323
14326
|
if (fromGoogleSearch != null) {
|
|
14324
14327
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
|
|
14325
14328
|
}
|
|
14329
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14330
|
+
'googleSearchRetrieval',
|
|
14331
|
+
]);
|
|
14332
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
14333
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14334
|
+
}
|
|
14326
14335
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
14327
14336
|
if (fromUrlContext != null) {
|
|
14328
14337
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -14331,28 +14340,10 @@ function toolToMldev$1(fromObject) {
|
|
|
14331
14340
|
}
|
|
14332
14341
|
function toolToVertex(fromObject) {
|
|
14333
14342
|
const toObject = {};
|
|
14334
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14335
|
-
'functionDeclarations',
|
|
14336
|
-
]);
|
|
14337
|
-
if (fromFunctionDeclarations != null) {
|
|
14338
|
-
let transformedList = fromFunctionDeclarations;
|
|
14339
|
-
if (Array.isArray(transformedList)) {
|
|
14340
|
-
transformedList = transformedList.map((item) => {
|
|
14341
|
-
return functionDeclarationToVertex(item);
|
|
14342
|
-
});
|
|
14343
|
-
}
|
|
14344
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14345
|
-
}
|
|
14346
14343
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
14347
14344
|
if (fromRetrieval != null) {
|
|
14348
14345
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
14349
14346
|
}
|
|
14350
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14351
|
-
'googleSearchRetrieval',
|
|
14352
|
-
]);
|
|
14353
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
14354
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14355
|
-
}
|
|
14356
14347
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14357
14348
|
if (fromComputerUse != null) {
|
|
14358
14349
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -14372,6 +14363,18 @@ function toolToVertex(fromObject) {
|
|
|
14372
14363
|
if (fromEnterpriseWebSearch != null) {
|
|
14373
14364
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
14374
14365
|
}
|
|
14366
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14367
|
+
'functionDeclarations',
|
|
14368
|
+
]);
|
|
14369
|
+
if (fromFunctionDeclarations != null) {
|
|
14370
|
+
let transformedList = fromFunctionDeclarations;
|
|
14371
|
+
if (Array.isArray(transformedList)) {
|
|
14372
|
+
transformedList = transformedList.map((item) => {
|
|
14373
|
+
return functionDeclarationToVertex(item);
|
|
14374
|
+
});
|
|
14375
|
+
}
|
|
14376
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14377
|
+
}
|
|
14375
14378
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
14376
14379
|
if (fromGoogleMaps != null) {
|
|
14377
14380
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -14380,6 +14383,12 @@ function toolToVertex(fromObject) {
|
|
|
14380
14383
|
if (fromGoogleSearch != null) {
|
|
14381
14384
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
14382
14385
|
}
|
|
14386
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14387
|
+
'googleSearchRetrieval',
|
|
14388
|
+
]);
|
|
14389
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
14390
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14391
|
+
}
|
|
14383
14392
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
14384
14393
|
if (fromUrlContext != null) {
|
|
14385
14394
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -15785,7 +15794,7 @@ class Models extends BaseModule {
|
|
|
15785
15794
|
* @example
|
|
15786
15795
|
* ```ts
|
|
15787
15796
|
* const response = await client.models.generateImages({
|
|
15788
|
-
* model: 'imagen-
|
|
15797
|
+
* model: 'imagen-4.0-generate-001',
|
|
15789
15798
|
* prompt: 'Robot holding a red skateboard',
|
|
15790
15799
|
* config: {
|
|
15791
15800
|
* numberOfImages: 1,
|
|
@@ -15894,7 +15903,7 @@ class Models extends BaseModule {
|
|
|
15894
15903
|
* @example
|
|
15895
15904
|
* ```ts
|
|
15896
15905
|
* const response = await client.models.upscaleImage({
|
|
15897
|
-
* model: 'imagen-
|
|
15906
|
+
* model: 'imagen-4.0-upscale-preview',
|
|
15898
15907
|
* image: image,
|
|
15899
15908
|
* upscaleFactor: 'x2',
|
|
15900
15909
|
* config: {
|
|
@@ -16556,7 +16565,7 @@ class Models extends BaseModule {
|
|
|
16556
16565
|
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
16557
16566
|
*
|
|
16558
16567
|
* const response2 = await ai.models.recontextImage({
|
|
16559
|
-
* model: 'virtual-try-on-
|
|
16568
|
+
* model: 'virtual-try-on-001',
|
|
16560
16569
|
* source: {
|
|
16561
16570
|
* personImage: personImage,
|
|
16562
16571
|
* productImages: [productImage],
|
|
@@ -17638,27 +17647,9 @@ function sessionResumptionConfigToMldev(fromObject) {
|
|
|
17638
17647
|
}
|
|
17639
17648
|
function toolToMldev(fromObject) {
|
|
17640
17649
|
const toObject = {};
|
|
17641
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
17642
|
-
'functionDeclarations',
|
|
17643
|
-
]);
|
|
17644
|
-
if (fromFunctionDeclarations != null) {
|
|
17645
|
-
let transformedList = fromFunctionDeclarations;
|
|
17646
|
-
if (Array.isArray(transformedList)) {
|
|
17647
|
-
transformedList = transformedList.map((item) => {
|
|
17648
|
-
return item;
|
|
17649
|
-
});
|
|
17650
|
-
}
|
|
17651
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
17652
|
-
}
|
|
17653
17650
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
17654
17651
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
17655
17652
|
}
|
|
17656
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
17657
|
-
'googleSearchRetrieval',
|
|
17658
|
-
]);
|
|
17659
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
17660
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
17661
|
-
}
|
|
17662
17653
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
17663
17654
|
if (fromComputerUse != null) {
|
|
17664
17655
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -17676,6 +17667,18 @@ function toolToMldev(fromObject) {
|
|
|
17676
17667
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
17677
17668
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
17678
17669
|
}
|
|
17670
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
17671
|
+
'functionDeclarations',
|
|
17672
|
+
]);
|
|
17673
|
+
if (fromFunctionDeclarations != null) {
|
|
17674
|
+
let transformedList = fromFunctionDeclarations;
|
|
17675
|
+
if (Array.isArray(transformedList)) {
|
|
17676
|
+
transformedList = transformedList.map((item) => {
|
|
17677
|
+
return item;
|
|
17678
|
+
});
|
|
17679
|
+
}
|
|
17680
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
17681
|
+
}
|
|
17679
17682
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
17680
17683
|
if (fromGoogleMaps != null) {
|
|
17681
17684
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
@@ -17684,6 +17687,12 @@ function toolToMldev(fromObject) {
|
|
|
17684
17687
|
if (fromGoogleSearch != null) {
|
|
17685
17688
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
|
|
17686
17689
|
}
|
|
17690
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
17691
|
+
'googleSearchRetrieval',
|
|
17692
|
+
]);
|
|
17693
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
17694
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
17695
|
+
}
|
|
17687
17696
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
17688
17697
|
if (fromUrlContext != null) {
|
|
17689
17698
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -19110,6 +19119,8 @@ class GoogleGenAI {
|
|
|
19110
19119
|
const nextGenClient = new GeminiNextGenAPIClient({
|
|
19111
19120
|
baseURL: this.apiClient.getBaseUrl(),
|
|
19112
19121
|
apiKey: this.apiKey,
|
|
19122
|
+
apiVersion: this.apiClient.getApiVersion(),
|
|
19123
|
+
clientAdapter: this.apiClient,
|
|
19113
19124
|
defaultHeaders: this.apiClient.getDefaultHeaders(),
|
|
19114
19125
|
timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
|
|
19115
19126
|
});
|