@google/genai 1.34.0 → 1.36.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/dist/genai.d.ts +151 -71
- package/dist/index.cjs +282 -251
- package/dist/index.mjs +283 -252
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +282 -251
- package/dist/node/index.mjs +283 -252
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +151 -71
- package/dist/tokenizer/node.cjs +5664 -0
- package/dist/tokenizer/node.d.ts +1145 -0
- package/dist/tokenizer/node.mjs +5640 -0
- package/dist/tokenizer/node.mjs.map +1 -0
- package/dist/web/index.mjs +283 -252
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +151 -71
- package/package.json +30 -3
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,6 +746,58 @@ exports.PhishBlockThreshold = void 0;
|
|
|
758
746
|
*/
|
|
759
747
|
PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
|
|
760
748
|
})(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
|
|
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 = {}));
|
|
761
801
|
/** The number of thoughts tokens that the model should generate. */
|
|
762
802
|
exports.ThinkingLevel = void 0;
|
|
763
803
|
(function (ThinkingLevel) {
|
|
@@ -1264,34 +1304,6 @@ exports.FeatureSelectionPreference = void 0;
|
|
|
1264
1304
|
FeatureSelectionPreference["BALANCED"] = "BALANCED";
|
|
1265
1305
|
FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
|
|
1266
1306
|
})(exports.FeatureSelectionPreference || (exports.FeatureSelectionPreference = {}));
|
|
1267
|
-
/** Defines the function behavior. Defaults to `BLOCKING`. */
|
|
1268
|
-
exports.Behavior = void 0;
|
|
1269
|
-
(function (Behavior) {
|
|
1270
|
-
/**
|
|
1271
|
-
* This value is unused.
|
|
1272
|
-
*/
|
|
1273
|
-
Behavior["UNSPECIFIED"] = "UNSPECIFIED";
|
|
1274
|
-
/**
|
|
1275
|
-
* If set, the system will wait to receive the function response before continuing the conversation.
|
|
1276
|
-
*/
|
|
1277
|
-
Behavior["BLOCKING"] = "BLOCKING";
|
|
1278
|
-
/**
|
|
1279
|
-
* 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.
|
|
1280
|
-
*/
|
|
1281
|
-
Behavior["NON_BLOCKING"] = "NON_BLOCKING";
|
|
1282
|
-
})(exports.Behavior || (exports.Behavior = {}));
|
|
1283
|
-
/** Config for the dynamic retrieval config mode. */
|
|
1284
|
-
exports.DynamicRetrievalConfigMode = void 0;
|
|
1285
|
-
(function (DynamicRetrievalConfigMode) {
|
|
1286
|
-
/**
|
|
1287
|
-
* Always trigger retrieval.
|
|
1288
|
-
*/
|
|
1289
|
-
DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1290
|
-
/**
|
|
1291
|
-
* Run retrieval only when system decides it is necessary.
|
|
1292
|
-
*/
|
|
1293
|
-
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1294
|
-
})(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
|
|
1295
1307
|
/** The environment being operated. */
|
|
1296
1308
|
exports.Environment = void 0;
|
|
1297
1309
|
(function (Environment) {
|
|
@@ -1304,30 +1316,6 @@ exports.Environment = void 0;
|
|
|
1304
1316
|
*/
|
|
1305
1317
|
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
1306
1318
|
})(exports.Environment || (exports.Environment = {}));
|
|
1307
|
-
/** Config for the function calling config mode. */
|
|
1308
|
-
exports.FunctionCallingConfigMode = void 0;
|
|
1309
|
-
(function (FunctionCallingConfigMode) {
|
|
1310
|
-
/**
|
|
1311
|
-
* The function calling config mode is unspecified. Should not be used.
|
|
1312
|
-
*/
|
|
1313
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1314
|
-
/**
|
|
1315
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
1316
|
-
*/
|
|
1317
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
1318
|
-
/**
|
|
1319
|
-
* 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".
|
|
1320
|
-
*/
|
|
1321
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
1322
|
-
/**
|
|
1323
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
1324
|
-
*/
|
|
1325
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
1326
|
-
/**
|
|
1327
|
-
* 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".
|
|
1328
|
-
*/
|
|
1329
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
1330
|
-
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
1331
1319
|
/** Enum that controls the safety filter level for objectionable content. */
|
|
1332
1320
|
exports.SafetyFilterLevel = void 0;
|
|
1333
1321
|
(function (SafetyFilterLevel) {
|
|
@@ -1524,6 +1512,7 @@ exports.FileSource = void 0;
|
|
|
1524
1512
|
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1525
1513
|
FileSource["UPLOADED"] = "UPLOADED";
|
|
1526
1514
|
FileSource["GENERATED"] = "GENERATED";
|
|
1515
|
+
FileSource["REGISTERED"] = "REGISTERED";
|
|
1527
1516
|
})(exports.FileSource || (exports.FileSource = {}));
|
|
1528
1517
|
/** The reason why the turn is complete. */
|
|
1529
1518
|
exports.TurnCompleteReason = void 0;
|
|
@@ -1589,6 +1578,22 @@ exports.VadSignalType = void 0;
|
|
|
1589
1578
|
*/
|
|
1590
1579
|
VadSignalType["VAD_SIGNAL_TYPE_EOS"] = "VAD_SIGNAL_TYPE_EOS";
|
|
1591
1580
|
})(exports.VadSignalType || (exports.VadSignalType = {}));
|
|
1581
|
+
/** The type of the voice activity signal. */
|
|
1582
|
+
exports.VoiceActivityType = void 0;
|
|
1583
|
+
(function (VoiceActivityType) {
|
|
1584
|
+
/**
|
|
1585
|
+
* The default is VOICE_ACTIVITY_TYPE_UNSPECIFIED.
|
|
1586
|
+
*/
|
|
1587
|
+
VoiceActivityType["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
|
|
1588
|
+
/**
|
|
1589
|
+
* Start of sentence signal.
|
|
1590
|
+
*/
|
|
1591
|
+
VoiceActivityType["ACTIVITY_START"] = "ACTIVITY_START";
|
|
1592
|
+
/**
|
|
1593
|
+
* End of sentence signal.
|
|
1594
|
+
*/
|
|
1595
|
+
VoiceActivityType["ACTIVITY_END"] = "ACTIVITY_END";
|
|
1596
|
+
})(exports.VoiceActivityType || (exports.VoiceActivityType = {}));
|
|
1592
1597
|
/** Start of speech sensitivity. */
|
|
1593
1598
|
exports.StartSensitivity = void 0;
|
|
1594
1599
|
(function (StartSensitivity) {
|
|
@@ -3953,16 +3958,16 @@ function functionCallToMldev$4(fromObject) {
|
|
|
3953
3958
|
}
|
|
3954
3959
|
function functionCallingConfigToMldev$2(fromObject) {
|
|
3955
3960
|
const toObject = {};
|
|
3956
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3957
|
-
if (fromMode != null) {
|
|
3958
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3959
|
-
}
|
|
3960
3961
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
3961
3962
|
'allowedFunctionNames',
|
|
3962
3963
|
]);
|
|
3963
3964
|
if (fromAllowedFunctionNames != null) {
|
|
3964
3965
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
3965
3966
|
}
|
|
3967
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3968
|
+
if (fromMode != null) {
|
|
3969
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3970
|
+
}
|
|
3966
3971
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
3967
3972
|
undefined) {
|
|
3968
3973
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -4222,6 +4227,9 @@ function imageConfigToMldev$1(fromObject) {
|
|
|
4222
4227
|
if (fromImageSize != null) {
|
|
4223
4228
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
4224
4229
|
}
|
|
4230
|
+
if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
|
|
4231
|
+
throw new Error('personGeneration parameter is not supported in Gemini API.');
|
|
4232
|
+
}
|
|
4225
4233
|
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
4226
4234
|
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
4227
4235
|
}
|
|
@@ -4447,43 +4455,25 @@ function safetySettingToMldev$1(fromObject) {
|
|
|
4447
4455
|
}
|
|
4448
4456
|
function toolConfigToMldev$2(fromObject) {
|
|
4449
4457
|
const toObject = {};
|
|
4450
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
4451
|
-
'functionCallingConfig',
|
|
4452
|
-
]);
|
|
4453
|
-
if (fromFunctionCallingConfig != null) {
|
|
4454
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4455
|
-
}
|
|
4456
4458
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
4457
4459
|
'retrievalConfig',
|
|
4458
4460
|
]);
|
|
4459
4461
|
if (fromRetrievalConfig != null) {
|
|
4460
4462
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
4461
4463
|
}
|
|
4464
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
4465
|
+
'functionCallingConfig',
|
|
4466
|
+
]);
|
|
4467
|
+
if (fromFunctionCallingConfig != null) {
|
|
4468
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4469
|
+
}
|
|
4462
4470
|
return toObject;
|
|
4463
4471
|
}
|
|
4464
4472
|
function toolToMldev$4(fromObject) {
|
|
4465
4473
|
const toObject = {};
|
|
4466
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4467
|
-
'functionDeclarations',
|
|
4468
|
-
]);
|
|
4469
|
-
if (fromFunctionDeclarations != null) {
|
|
4470
|
-
let transformedList = fromFunctionDeclarations;
|
|
4471
|
-
if (Array.isArray(transformedList)) {
|
|
4472
|
-
transformedList = transformedList.map((item) => {
|
|
4473
|
-
return item;
|
|
4474
|
-
});
|
|
4475
|
-
}
|
|
4476
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
4477
|
-
}
|
|
4478
4474
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
4479
4475
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
4480
4476
|
}
|
|
4481
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
4482
|
-
'googleSearchRetrieval',
|
|
4483
|
-
]);
|
|
4484
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
4485
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4486
|
-
}
|
|
4487
4477
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4488
4478
|
if (fromComputerUse != null) {
|
|
4489
4479
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -4501,6 +4491,18 @@ function toolToMldev$4(fromObject) {
|
|
|
4501
4491
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
4502
4492
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
4503
4493
|
}
|
|
4494
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4495
|
+
'functionDeclarations',
|
|
4496
|
+
]);
|
|
4497
|
+
if (fromFunctionDeclarations != null) {
|
|
4498
|
+
let transformedList = fromFunctionDeclarations;
|
|
4499
|
+
if (Array.isArray(transformedList)) {
|
|
4500
|
+
transformedList = transformedList.map((item) => {
|
|
4501
|
+
return item;
|
|
4502
|
+
});
|
|
4503
|
+
}
|
|
4504
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
4505
|
+
}
|
|
4504
4506
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
4505
4507
|
if (fromGoogleMaps != null) {
|
|
4506
4508
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
|
|
@@ -4509,6 +4511,12 @@ function toolToMldev$4(fromObject) {
|
|
|
4509
4511
|
if (fromGoogleSearch != null) {
|
|
4510
4512
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
|
|
4511
4513
|
}
|
|
4514
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
4515
|
+
'googleSearchRetrieval',
|
|
4516
|
+
]);
|
|
4517
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
4518
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4519
|
+
}
|
|
4512
4520
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
4513
4521
|
if (fromUrlContext != null) {
|
|
4514
4522
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -5439,16 +5447,16 @@ function functionCallToMldev$3(fromObject) {
|
|
|
5439
5447
|
}
|
|
5440
5448
|
function functionCallingConfigToMldev$1(fromObject) {
|
|
5441
5449
|
const toObject = {};
|
|
5442
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5443
|
-
if (fromMode != null) {
|
|
5444
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
5445
|
-
}
|
|
5446
5450
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
5447
5451
|
'allowedFunctionNames',
|
|
5448
5452
|
]);
|
|
5449
5453
|
if (fromAllowedFunctionNames != null) {
|
|
5450
5454
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
5451
5455
|
}
|
|
5456
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5457
|
+
if (fromMode != null) {
|
|
5458
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
5459
|
+
}
|
|
5452
5460
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
5453
5461
|
undefined) {
|
|
5454
5462
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -5457,9 +5465,6 @@ function functionCallingConfigToMldev$1(fromObject) {
|
|
|
5457
5465
|
}
|
|
5458
5466
|
function functionDeclarationToVertex$2(fromObject) {
|
|
5459
5467
|
const toObject = {};
|
|
5460
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
5461
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
5462
|
-
}
|
|
5463
5468
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
5464
5469
|
if (fromDescription != null) {
|
|
5465
5470
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -5488,6 +5493,9 @@ function functionDeclarationToVertex$2(fromObject) {
|
|
|
5488
5493
|
if (fromResponseJsonSchema != null) {
|
|
5489
5494
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
5490
5495
|
}
|
|
5496
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
5497
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
5498
|
+
}
|
|
5491
5499
|
return toObject;
|
|
5492
5500
|
}
|
|
5493
5501
|
function getCachedContentParametersToMldev(apiClient, fromObject) {
|
|
@@ -5691,43 +5699,25 @@ function partToMldev$3(fromObject) {
|
|
|
5691
5699
|
}
|
|
5692
5700
|
function toolConfigToMldev$1(fromObject) {
|
|
5693
5701
|
const toObject = {};
|
|
5694
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
5695
|
-
'functionCallingConfig',
|
|
5696
|
-
]);
|
|
5697
|
-
if (fromFunctionCallingConfig != null) {
|
|
5698
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5699
|
-
}
|
|
5700
5702
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
5701
5703
|
'retrievalConfig',
|
|
5702
5704
|
]);
|
|
5703
5705
|
if (fromRetrievalConfig != null) {
|
|
5704
5706
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
5705
5707
|
}
|
|
5708
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
5709
|
+
'functionCallingConfig',
|
|
5710
|
+
]);
|
|
5711
|
+
if (fromFunctionCallingConfig != null) {
|
|
5712
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5713
|
+
}
|
|
5706
5714
|
return toObject;
|
|
5707
5715
|
}
|
|
5708
5716
|
function toolToMldev$3(fromObject) {
|
|
5709
5717
|
const toObject = {};
|
|
5710
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5711
|
-
'functionDeclarations',
|
|
5712
|
-
]);
|
|
5713
|
-
if (fromFunctionDeclarations != null) {
|
|
5714
|
-
let transformedList = fromFunctionDeclarations;
|
|
5715
|
-
if (Array.isArray(transformedList)) {
|
|
5716
|
-
transformedList = transformedList.map((item) => {
|
|
5717
|
-
return item;
|
|
5718
|
-
});
|
|
5719
|
-
}
|
|
5720
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5721
|
-
}
|
|
5722
5718
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
5723
5719
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
5724
5720
|
}
|
|
5725
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5726
|
-
'googleSearchRetrieval',
|
|
5727
|
-
]);
|
|
5728
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
5729
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5730
|
-
}
|
|
5731
5721
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5732
5722
|
if (fromComputerUse != null) {
|
|
5733
5723
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -5745,6 +5735,18 @@ function toolToMldev$3(fromObject) {
|
|
|
5745
5735
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5746
5736
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
5747
5737
|
}
|
|
5738
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5739
|
+
'functionDeclarations',
|
|
5740
|
+
]);
|
|
5741
|
+
if (fromFunctionDeclarations != null) {
|
|
5742
|
+
let transformedList = fromFunctionDeclarations;
|
|
5743
|
+
if (Array.isArray(transformedList)) {
|
|
5744
|
+
transformedList = transformedList.map((item) => {
|
|
5745
|
+
return item;
|
|
5746
|
+
});
|
|
5747
|
+
}
|
|
5748
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5749
|
+
}
|
|
5748
5750
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5749
5751
|
if (fromGoogleMaps != null) {
|
|
5750
5752
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
|
|
@@ -5753,6 +5755,12 @@ function toolToMldev$3(fromObject) {
|
|
|
5753
5755
|
if (fromGoogleSearch != null) {
|
|
5754
5756
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
|
|
5755
5757
|
}
|
|
5758
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5759
|
+
'googleSearchRetrieval',
|
|
5760
|
+
]);
|
|
5761
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
5762
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5763
|
+
}
|
|
5756
5764
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5757
5765
|
if (fromUrlContext != null) {
|
|
5758
5766
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -5761,28 +5769,10 @@ function toolToMldev$3(fromObject) {
|
|
|
5761
5769
|
}
|
|
5762
5770
|
function toolToVertex$2(fromObject) {
|
|
5763
5771
|
const toObject = {};
|
|
5764
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5765
|
-
'functionDeclarations',
|
|
5766
|
-
]);
|
|
5767
|
-
if (fromFunctionDeclarations != null) {
|
|
5768
|
-
let transformedList = fromFunctionDeclarations;
|
|
5769
|
-
if (Array.isArray(transformedList)) {
|
|
5770
|
-
transformedList = transformedList.map((item) => {
|
|
5771
|
-
return functionDeclarationToVertex$2(item);
|
|
5772
|
-
});
|
|
5773
|
-
}
|
|
5774
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5775
|
-
}
|
|
5776
5772
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
5777
5773
|
if (fromRetrieval != null) {
|
|
5778
5774
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
5779
5775
|
}
|
|
5780
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5781
|
-
'googleSearchRetrieval',
|
|
5782
|
-
]);
|
|
5783
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
5784
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5785
|
-
}
|
|
5786
5776
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5787
5777
|
if (fromComputerUse != null) {
|
|
5788
5778
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -5802,6 +5792,18 @@ function toolToVertex$2(fromObject) {
|
|
|
5802
5792
|
if (fromEnterpriseWebSearch != null) {
|
|
5803
5793
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
5804
5794
|
}
|
|
5795
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5796
|
+
'functionDeclarations',
|
|
5797
|
+
]);
|
|
5798
|
+
if (fromFunctionDeclarations != null) {
|
|
5799
|
+
let transformedList = fromFunctionDeclarations;
|
|
5800
|
+
if (Array.isArray(transformedList)) {
|
|
5801
|
+
transformedList = transformedList.map((item) => {
|
|
5802
|
+
return functionDeclarationToVertex$2(item);
|
|
5803
|
+
});
|
|
5804
|
+
}
|
|
5805
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5806
|
+
}
|
|
5805
5807
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5806
5808
|
if (fromGoogleMaps != null) {
|
|
5807
5809
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -5810,6 +5812,12 @@ function toolToVertex$2(fromObject) {
|
|
|
5810
5812
|
if (fromGoogleSearch != null) {
|
|
5811
5813
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
5812
5814
|
}
|
|
5815
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5816
|
+
'googleSearchRetrieval',
|
|
5817
|
+
]);
|
|
5818
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
5819
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5820
|
+
}
|
|
5813
5821
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5814
5822
|
if (fromUrlContext != null) {
|
|
5815
5823
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -6897,7 +6905,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6897
6905
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6898
6906
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6899
6907
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6900
|
-
const SDK_VERSION = '1.
|
|
6908
|
+
const SDK_VERSION = '1.36.0'; // x-release-please-version
|
|
6901
6909
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6902
6910
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6903
6911
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -10607,9 +10615,6 @@ function functionCallToMldev$2(fromObject) {
|
|
|
10607
10615
|
}
|
|
10608
10616
|
function functionDeclarationToVertex$1(fromObject) {
|
|
10609
10617
|
const toObject = {};
|
|
10610
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
10611
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
10612
|
-
}
|
|
10613
10618
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
10614
10619
|
if (fromDescription != null) {
|
|
10615
10620
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -10638,6 +10643,9 @@ function functionDeclarationToVertex$1(fromObject) {
|
|
|
10638
10643
|
if (fromResponseJsonSchema != null) {
|
|
10639
10644
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
10640
10645
|
}
|
|
10646
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
10647
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
10648
|
+
}
|
|
10641
10649
|
return toObject;
|
|
10642
10650
|
}
|
|
10643
10651
|
function generationConfigToVertex$1(fromObject) {
|
|
@@ -11204,6 +11212,12 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
11204
11212
|
if (fromVoiceActivityDetectionSignal != null) {
|
|
11205
11213
|
setValueByPath(toObject, ['voiceActivityDetectionSignal'], fromVoiceActivityDetectionSignal);
|
|
11206
11214
|
}
|
|
11215
|
+
const fromVoiceActivity = getValueByPath(fromObject, [
|
|
11216
|
+
'voiceActivity',
|
|
11217
|
+
]);
|
|
11218
|
+
if (fromVoiceActivity != null) {
|
|
11219
|
+
setValueByPath(toObject, ['voiceActivity'], voiceActivityFromVertex(fromVoiceActivity));
|
|
11220
|
+
}
|
|
11207
11221
|
return toObject;
|
|
11208
11222
|
}
|
|
11209
11223
|
function partToMldev$2(fromObject) {
|
|
@@ -11279,27 +11293,9 @@ function sessionResumptionConfigToMldev$1(fromObject) {
|
|
|
11279
11293
|
}
|
|
11280
11294
|
function toolToMldev$2(fromObject) {
|
|
11281
11295
|
const toObject = {};
|
|
11282
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
11283
|
-
'functionDeclarations',
|
|
11284
|
-
]);
|
|
11285
|
-
if (fromFunctionDeclarations != null) {
|
|
11286
|
-
let transformedList = fromFunctionDeclarations;
|
|
11287
|
-
if (Array.isArray(transformedList)) {
|
|
11288
|
-
transformedList = transformedList.map((item) => {
|
|
11289
|
-
return item;
|
|
11290
|
-
});
|
|
11291
|
-
}
|
|
11292
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
11293
|
-
}
|
|
11294
11296
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
11295
11297
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
11296
11298
|
}
|
|
11297
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
11298
|
-
'googleSearchRetrieval',
|
|
11299
|
-
]);
|
|
11300
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
11301
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
11302
|
-
}
|
|
11303
11299
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
11304
11300
|
if (fromComputerUse != null) {
|
|
11305
11301
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -11317,6 +11313,18 @@ function toolToMldev$2(fromObject) {
|
|
|
11317
11313
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
11318
11314
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
11319
11315
|
}
|
|
11316
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
11317
|
+
'functionDeclarations',
|
|
11318
|
+
]);
|
|
11319
|
+
if (fromFunctionDeclarations != null) {
|
|
11320
|
+
let transformedList = fromFunctionDeclarations;
|
|
11321
|
+
if (Array.isArray(transformedList)) {
|
|
11322
|
+
transformedList = transformedList.map((item) => {
|
|
11323
|
+
return item;
|
|
11324
|
+
});
|
|
11325
|
+
}
|
|
11326
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
11327
|
+
}
|
|
11320
11328
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
11321
11329
|
if (fromGoogleMaps != null) {
|
|
11322
11330
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
|
|
@@ -11325,6 +11333,12 @@ function toolToMldev$2(fromObject) {
|
|
|
11325
11333
|
if (fromGoogleSearch != null) {
|
|
11326
11334
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
|
|
11327
11335
|
}
|
|
11336
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
11337
|
+
'googleSearchRetrieval',
|
|
11338
|
+
]);
|
|
11339
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
11340
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
11341
|
+
}
|
|
11328
11342
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
11329
11343
|
if (fromUrlContext != null) {
|
|
11330
11344
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -11333,28 +11347,10 @@ function toolToMldev$2(fromObject) {
|
|
|
11333
11347
|
}
|
|
11334
11348
|
function toolToVertex$1(fromObject) {
|
|
11335
11349
|
const toObject = {};
|
|
11336
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
11337
|
-
'functionDeclarations',
|
|
11338
|
-
]);
|
|
11339
|
-
if (fromFunctionDeclarations != null) {
|
|
11340
|
-
let transformedList = fromFunctionDeclarations;
|
|
11341
|
-
if (Array.isArray(transformedList)) {
|
|
11342
|
-
transformedList = transformedList.map((item) => {
|
|
11343
|
-
return functionDeclarationToVertex$1(item);
|
|
11344
|
-
});
|
|
11345
|
-
}
|
|
11346
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
11347
|
-
}
|
|
11348
11350
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
11349
11351
|
if (fromRetrieval != null) {
|
|
11350
11352
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
11351
11353
|
}
|
|
11352
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
11353
|
-
'googleSearchRetrieval',
|
|
11354
|
-
]);
|
|
11355
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
11356
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
11357
|
-
}
|
|
11358
11354
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
11359
11355
|
if (fromComputerUse != null) {
|
|
11360
11356
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -11374,6 +11370,18 @@ function toolToVertex$1(fromObject) {
|
|
|
11374
11370
|
if (fromEnterpriseWebSearch != null) {
|
|
11375
11371
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
11376
11372
|
}
|
|
11373
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
11374
|
+
'functionDeclarations',
|
|
11375
|
+
]);
|
|
11376
|
+
if (fromFunctionDeclarations != null) {
|
|
11377
|
+
let transformedList = fromFunctionDeclarations;
|
|
11378
|
+
if (Array.isArray(transformedList)) {
|
|
11379
|
+
transformedList = transformedList.map((item) => {
|
|
11380
|
+
return functionDeclarationToVertex$1(item);
|
|
11381
|
+
});
|
|
11382
|
+
}
|
|
11383
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
11384
|
+
}
|
|
11377
11385
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
11378
11386
|
if (fromGoogleMaps != null) {
|
|
11379
11387
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -11382,6 +11390,12 @@ function toolToVertex$1(fromObject) {
|
|
|
11382
11390
|
if (fromGoogleSearch != null) {
|
|
11383
11391
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
11384
11392
|
}
|
|
11393
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
11394
|
+
'googleSearchRetrieval',
|
|
11395
|
+
]);
|
|
11396
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
11397
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
11398
|
+
}
|
|
11385
11399
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
11386
11400
|
if (fromUrlContext != null) {
|
|
11387
11401
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -11480,6 +11494,14 @@ function usageMetadataFromVertex(fromObject) {
|
|
|
11480
11494
|
}
|
|
11481
11495
|
return toObject;
|
|
11482
11496
|
}
|
|
11497
|
+
function voiceActivityFromVertex(fromObject) {
|
|
11498
|
+
const toObject = {};
|
|
11499
|
+
const fromVoiceActivityType = getValueByPath(fromObject, ['type']);
|
|
11500
|
+
if (fromVoiceActivityType != null) {
|
|
11501
|
+
setValueByPath(toObject, ['voiceActivityType'], fromVoiceActivityType);
|
|
11502
|
+
}
|
|
11503
|
+
return toObject;
|
|
11504
|
+
}
|
|
11483
11505
|
|
|
11484
11506
|
/**
|
|
11485
11507
|
* @license
|
|
@@ -12164,16 +12186,16 @@ function functionCallToMldev$1(fromObject) {
|
|
|
12164
12186
|
}
|
|
12165
12187
|
function functionCallingConfigToMldev(fromObject) {
|
|
12166
12188
|
const toObject = {};
|
|
12167
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
12168
|
-
if (fromMode != null) {
|
|
12169
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
12170
|
-
}
|
|
12171
12189
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
12172
12190
|
'allowedFunctionNames',
|
|
12173
12191
|
]);
|
|
12174
12192
|
if (fromAllowedFunctionNames != null) {
|
|
12175
12193
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
12176
12194
|
}
|
|
12195
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
12196
|
+
if (fromMode != null) {
|
|
12197
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
12198
|
+
}
|
|
12177
12199
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
12178
12200
|
undefined) {
|
|
12179
12201
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -12182,9 +12204,6 @@ function functionCallingConfigToMldev(fromObject) {
|
|
|
12182
12204
|
}
|
|
12183
12205
|
function functionDeclarationToVertex(fromObject) {
|
|
12184
12206
|
const toObject = {};
|
|
12185
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
12186
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
12187
|
-
}
|
|
12188
12207
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
12189
12208
|
if (fromDescription != null) {
|
|
12190
12209
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -12213,6 +12232,9 @@ function functionDeclarationToVertex(fromObject) {
|
|
|
12213
12232
|
if (fromResponseJsonSchema != null) {
|
|
12214
12233
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
12215
12234
|
}
|
|
12235
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
12236
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
12237
|
+
}
|
|
12216
12238
|
return toObject;
|
|
12217
12239
|
}
|
|
12218
12240
|
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
@@ -13550,6 +13572,9 @@ function imageConfigToMldev(fromObject) {
|
|
|
13550
13572
|
if (fromImageSize != null) {
|
|
13551
13573
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
13552
13574
|
}
|
|
13575
|
+
if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
|
|
13576
|
+
throw new Error('personGeneration parameter is not supported in Gemini API.');
|
|
13577
|
+
}
|
|
13553
13578
|
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
13554
13579
|
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
13555
13580
|
}
|
|
@@ -13569,6 +13594,12 @@ function imageConfigToVertex(fromObject) {
|
|
|
13569
13594
|
if (fromImageSize != null) {
|
|
13570
13595
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
13571
13596
|
}
|
|
13597
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
13598
|
+
'personGeneration',
|
|
13599
|
+
]);
|
|
13600
|
+
if (fromPersonGeneration != null) {
|
|
13601
|
+
setValueByPath(toObject, ['personGeneration'], fromPersonGeneration);
|
|
13602
|
+
}
|
|
13572
13603
|
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
13573
13604
|
'outputMimeType',
|
|
13574
13605
|
]);
|
|
@@ -14269,43 +14300,25 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
|
|
|
14269
14300
|
}
|
|
14270
14301
|
function toolConfigToMldev(fromObject) {
|
|
14271
14302
|
const toObject = {};
|
|
14272
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
14273
|
-
'functionCallingConfig',
|
|
14274
|
-
]);
|
|
14275
|
-
if (fromFunctionCallingConfig != null) {
|
|
14276
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
14277
|
-
}
|
|
14278
14303
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
14279
14304
|
'retrievalConfig',
|
|
14280
14305
|
]);
|
|
14281
14306
|
if (fromRetrievalConfig != null) {
|
|
14282
14307
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
14283
14308
|
}
|
|
14309
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
14310
|
+
'functionCallingConfig',
|
|
14311
|
+
]);
|
|
14312
|
+
if (fromFunctionCallingConfig != null) {
|
|
14313
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
14314
|
+
}
|
|
14284
14315
|
return toObject;
|
|
14285
14316
|
}
|
|
14286
14317
|
function toolToMldev$1(fromObject) {
|
|
14287
14318
|
const toObject = {};
|
|
14288
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14289
|
-
'functionDeclarations',
|
|
14290
|
-
]);
|
|
14291
|
-
if (fromFunctionDeclarations != null) {
|
|
14292
|
-
let transformedList = fromFunctionDeclarations;
|
|
14293
|
-
if (Array.isArray(transformedList)) {
|
|
14294
|
-
transformedList = transformedList.map((item) => {
|
|
14295
|
-
return item;
|
|
14296
|
-
});
|
|
14297
|
-
}
|
|
14298
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14299
|
-
}
|
|
14300
14319
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
14301
14320
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
14302
14321
|
}
|
|
14303
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14304
|
-
'googleSearchRetrieval',
|
|
14305
|
-
]);
|
|
14306
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
14307
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14308
|
-
}
|
|
14309
14322
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14310
14323
|
if (fromComputerUse != null) {
|
|
14311
14324
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -14323,6 +14336,18 @@ function toolToMldev$1(fromObject) {
|
|
|
14323
14336
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
14324
14337
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
14325
14338
|
}
|
|
14339
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14340
|
+
'functionDeclarations',
|
|
14341
|
+
]);
|
|
14342
|
+
if (fromFunctionDeclarations != null) {
|
|
14343
|
+
let transformedList = fromFunctionDeclarations;
|
|
14344
|
+
if (Array.isArray(transformedList)) {
|
|
14345
|
+
transformedList = transformedList.map((item) => {
|
|
14346
|
+
return item;
|
|
14347
|
+
});
|
|
14348
|
+
}
|
|
14349
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14350
|
+
}
|
|
14326
14351
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
14327
14352
|
if (fromGoogleMaps != null) {
|
|
14328
14353
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
|
|
@@ -14331,6 +14356,12 @@ function toolToMldev$1(fromObject) {
|
|
|
14331
14356
|
if (fromGoogleSearch != null) {
|
|
14332
14357
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
|
|
14333
14358
|
}
|
|
14359
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14360
|
+
'googleSearchRetrieval',
|
|
14361
|
+
]);
|
|
14362
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
14363
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14364
|
+
}
|
|
14334
14365
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
14335
14366
|
if (fromUrlContext != null) {
|
|
14336
14367
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -14339,28 +14370,10 @@ function toolToMldev$1(fromObject) {
|
|
|
14339
14370
|
}
|
|
14340
14371
|
function toolToVertex(fromObject) {
|
|
14341
14372
|
const toObject = {};
|
|
14342
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14343
|
-
'functionDeclarations',
|
|
14344
|
-
]);
|
|
14345
|
-
if (fromFunctionDeclarations != null) {
|
|
14346
|
-
let transformedList = fromFunctionDeclarations;
|
|
14347
|
-
if (Array.isArray(transformedList)) {
|
|
14348
|
-
transformedList = transformedList.map((item) => {
|
|
14349
|
-
return functionDeclarationToVertex(item);
|
|
14350
|
-
});
|
|
14351
|
-
}
|
|
14352
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14353
|
-
}
|
|
14354
14373
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
14355
14374
|
if (fromRetrieval != null) {
|
|
14356
14375
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
14357
14376
|
}
|
|
14358
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14359
|
-
'googleSearchRetrieval',
|
|
14360
|
-
]);
|
|
14361
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
14362
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14363
|
-
}
|
|
14364
14377
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14365
14378
|
if (fromComputerUse != null) {
|
|
14366
14379
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -14380,6 +14393,18 @@ function toolToVertex(fromObject) {
|
|
|
14380
14393
|
if (fromEnterpriseWebSearch != null) {
|
|
14381
14394
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
14382
14395
|
}
|
|
14396
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
14397
|
+
'functionDeclarations',
|
|
14398
|
+
]);
|
|
14399
|
+
if (fromFunctionDeclarations != null) {
|
|
14400
|
+
let transformedList = fromFunctionDeclarations;
|
|
14401
|
+
if (Array.isArray(transformedList)) {
|
|
14402
|
+
transformedList = transformedList.map((item) => {
|
|
14403
|
+
return functionDeclarationToVertex(item);
|
|
14404
|
+
});
|
|
14405
|
+
}
|
|
14406
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
14407
|
+
}
|
|
14383
14408
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
14384
14409
|
if (fromGoogleMaps != null) {
|
|
14385
14410
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -14388,6 +14413,12 @@ function toolToVertex(fromObject) {
|
|
|
14388
14413
|
if (fromGoogleSearch != null) {
|
|
14389
14414
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
14390
14415
|
}
|
|
14416
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14417
|
+
'googleSearchRetrieval',
|
|
14418
|
+
]);
|
|
14419
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
14420
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14421
|
+
}
|
|
14391
14422
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
14392
14423
|
if (fromUrlContext != null) {
|
|
14393
14424
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -15793,7 +15824,7 @@ class Models extends BaseModule {
|
|
|
15793
15824
|
* @example
|
|
15794
15825
|
* ```ts
|
|
15795
15826
|
* const response = await client.models.generateImages({
|
|
15796
|
-
* model: 'imagen-
|
|
15827
|
+
* model: 'imagen-4.0-generate-001',
|
|
15797
15828
|
* prompt: 'Robot holding a red skateboard',
|
|
15798
15829
|
* config: {
|
|
15799
15830
|
* numberOfImages: 1,
|
|
@@ -15902,7 +15933,7 @@ class Models extends BaseModule {
|
|
|
15902
15933
|
* @example
|
|
15903
15934
|
* ```ts
|
|
15904
15935
|
* const response = await client.models.upscaleImage({
|
|
15905
|
-
* model: 'imagen-
|
|
15936
|
+
* model: 'imagen-4.0-upscale-preview',
|
|
15906
15937
|
* image: image,
|
|
15907
15938
|
* upscaleFactor: 'x2',
|
|
15908
15939
|
* config: {
|
|
@@ -16564,7 +16595,7 @@ class Models extends BaseModule {
|
|
|
16564
16595
|
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
16565
16596
|
*
|
|
16566
16597
|
* const response2 = await ai.models.recontextImage({
|
|
16567
|
-
* model: 'virtual-try-on-
|
|
16598
|
+
* model: 'virtual-try-on-001',
|
|
16568
16599
|
* source: {
|
|
16569
16600
|
* personImage: personImage,
|
|
16570
16601
|
* productImages: [productImage],
|
|
@@ -17646,27 +17677,9 @@ function sessionResumptionConfigToMldev(fromObject) {
|
|
|
17646
17677
|
}
|
|
17647
17678
|
function toolToMldev(fromObject) {
|
|
17648
17679
|
const toObject = {};
|
|
17649
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
17650
|
-
'functionDeclarations',
|
|
17651
|
-
]);
|
|
17652
|
-
if (fromFunctionDeclarations != null) {
|
|
17653
|
-
let transformedList = fromFunctionDeclarations;
|
|
17654
|
-
if (Array.isArray(transformedList)) {
|
|
17655
|
-
transformedList = transformedList.map((item) => {
|
|
17656
|
-
return item;
|
|
17657
|
-
});
|
|
17658
|
-
}
|
|
17659
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
17660
|
-
}
|
|
17661
17680
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
17662
17681
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
17663
17682
|
}
|
|
17664
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
17665
|
-
'googleSearchRetrieval',
|
|
17666
|
-
]);
|
|
17667
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
17668
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
17669
|
-
}
|
|
17670
17683
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
17671
17684
|
if (fromComputerUse != null) {
|
|
17672
17685
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -17684,6 +17697,18 @@ function toolToMldev(fromObject) {
|
|
|
17684
17697
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
17685
17698
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
17686
17699
|
}
|
|
17700
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
17701
|
+
'functionDeclarations',
|
|
17702
|
+
]);
|
|
17703
|
+
if (fromFunctionDeclarations != null) {
|
|
17704
|
+
let transformedList = fromFunctionDeclarations;
|
|
17705
|
+
if (Array.isArray(transformedList)) {
|
|
17706
|
+
transformedList = transformedList.map((item) => {
|
|
17707
|
+
return item;
|
|
17708
|
+
});
|
|
17709
|
+
}
|
|
17710
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
17711
|
+
}
|
|
17687
17712
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
17688
17713
|
if (fromGoogleMaps != null) {
|
|
17689
17714
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
@@ -17692,6 +17717,12 @@ function toolToMldev(fromObject) {
|
|
|
17692
17717
|
if (fromGoogleSearch != null) {
|
|
17693
17718
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
|
|
17694
17719
|
}
|
|
17720
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
17721
|
+
'googleSearchRetrieval',
|
|
17722
|
+
]);
|
|
17723
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
17724
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
17725
|
+
}
|
|
17695
17726
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
17696
17727
|
if (fromUrlContext != null) {
|
|
17697
17728
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|